tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

floating point problems on amd64?



I ran 'make check' on guile on NetBSD-current on amd64, and got a
failure:

guile> (version)
"1.8.5"
guile> (eqv? 0.0 (exp -inf.0))
#f
guile> (exp -inf.0)
+nan.0

On i386 and sparc64 this passes.  I ran paranoia and that passed (with
not even flaws).

POSIX says that exp(-Inf) is +0:

  http://www.opengroup.org/onlinepubs/009695399/functions/exp.html

This program produces "e -inf z 0.000000" on NetBSD on i386 (older, with
no EM64T), i386 core duo, an i386PAE domU on amd64 (on same dom0 as the
problem), sparc and sparc64.  Also on Mac OS X 10.5.3 with Core 2 Duo.

But, on NetBSD-current amd64, I get:  "e -inf z nan".


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

int
main()
{
  double e;
  double z;
  
  e = -INFINITY;
  z = exp(e);

  printf("e %f z %f\n", e, z);

  return(0);
}


Home | Main Index | Thread Index | Old Index