From: Bruno Haible <haible@il...> - 2002-07-22 14:46:04
Why did we get a different value of double-float-epsilon and
double-float-negative-epsilon on Linux/x86 than on other platforms?
The definition of FAST_DOUBLE in lispbibl.d was based on the
expectation that the x86 FPU is IEEE 754 compliant. Originally it
is by default. But it depends on the floating point control word. By
default it is 0x27f, which is IEEE 754 compliant. But when glibc is
used (on Linux or FreeBSD), it sets the loating point control word to
0x37f (see <fpu_control.h> for what this means). glibc needs this for
'long double's to work. But it has the effect that the rounding of
doubles is not IEEE compliant - at least with gcc 2.95.2, 3.0.4, 3.1:
(+ 1 double-float-epsilon)
is first computed in 80-bit precision, and when storing it as a clisp
'double-float', it is rounded to 64-bit precision. Rounding twice is
not equivalent to rounding once; therefore it's not IEEE compliant.
Changing the floating point control word is possible but leads to
other problems (what if not using gcc? what if a foreign module linked
to clisp needs to work with 'long double'?). So I disabled FAST_DOUBLE
The test is done at configure time, through the macro
double_rounds_correctly, defined in floatparam.h, generated by
I don't expect a big performance impact from this change.
Also, FAST_FLOAT and FAST_DOUBLE are now disabled when overflow leads
to an exception; this is the case only on Alpha processors, but is
determined at configure time as well.
Get latest updates about Open Source Projects, Conferences and News.