[ieeefp-tests-devel] C results

Raymond Toy toy at rtp.ericsson.se
Thu Jun 10 17:16:56 UTC 2004


>>>>> "Raymond" == Raymond Toy <toy at rtp.ericsson.se> writes:

    Raymond> Apologies for the long post.

    Raymond> I decided it would be useful to see how the C version of the
    Raymond> ieeefp-tests works.  I've appended the double-float output file
    Raymond> generated via GCC on a sparc/solaris8 box.

[snip]

    Raymond> Total   68 tests:  pass   68,  flags err    0,  value err   0,     coshd

So all coshd tests pass.  But the Lisp version says not.  In
particular double-cosh-value.10 fails.  The expected result is
most-positive-double-float, but we return infinity.  Calling
kernel:%cosh returns infinity too.

A simple C test program for sparc confirms that cosh does indeed
return infinity.  So either the C test is messed up or my simple test
is.

Aargh.

Ray

#include <stdio.h>
#include <math.h>
#include <ieeefp.h>

union dnum 
{
  long words[2];
  double fl;
};

int
main()
{
  union dnum x;
  union dnum y;
  
  x.words[0] = 0xC08633CE;
  x.words[1] = 0x8FB9F87E;

  printf("x = %lg\n", x.fl);

  fpsetround(FP_RM);
  
  y.fl = cosh(x.fl);

  printf("y = 0x%08lx%08lx = %lg\n", y.words[0], y.words[1], y.fl);

  return 0;
}

Output:

x = -710.476
y = 0x7ff0000000000000 = Inf





More information about the Ieeefp-tests-devel mailing list