libm-i387 bug?

Andreas Jaeger aj@arthur.rhein-neckar.de
Thu Jul 16 01:00:00 GMT 1998


>>>>> Zack Weinberg writes:

 > This test program prints "-1.949464 0.000000". Shouldn't it print
 > "0.000000 1.000000" ?
It should - but the problem is even more obscure.  The appended
program prints:
$ ./fdim 
-1.949464 0.000000
8192.000000 6144.000000
6144.000000 8192.000000
0.000000 6144.000000
0.000000 6144.000000

but it should output 1's and 0's instead:-(.

In what kind of trap did both of us fall?
Andreas

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

int main(void)
{
  double two, three, r1, r2;
  
  printf("%f %f\n", fdim(2.0, 3.0), fdim(3.0, 2.0));
  two = 2.0;
  three = 3.0;
  r1 = fdim (two, three);
  r2 = fdim (two, three);
  printf("%f %f\n", r1, r2);
  printf("%f %f\n", r2, r1);
  
  printf("%f %f\n", fdim(two, three), fdim(two, three));
  printf("%f %f\n", fdim(three, two), fdim(three, two));
  
  return 0;
}


-- 
 Andreas Jaeger   aj@arthur.rhein-neckar.de    jaeger@informatik.uni-kl.de
  for pgp-key finger ajaeger@alma.student.uni-kl.de



More information about the Libc-hacker mailing list