A patch for libm-ieee754
Geoffrey KEATING
geoffk@discus.anu.edu.au
Sun Feb 22 18:18:00 GMT 1998
> From: hjl@lucon.org (H.J. Lu)
> Date: Sat, 21 Feb 1998 18:55:18 -0800 (PST)
> It turns out those libm-ieee754 bugs are not in egcs. Here is the patch
> for glibc 2.1 to fix a few libm-ieee754 bugs. Ulrich, could you please
> take a look?
>
> When you use fpu/cpu to do rounding, you have to mark the variable
> volatile. Otherwise, the compiler may do some thing you don't want.
libm-ieee754 expects ieee754 behaviour, and in particular that when a
value is stored to a 'double' variable or returned from a function of
type 'double', then that value is representable as a 'double' (and
similarly for 'float'). In fact, some functions basically do nothing
but invoke the FPU's rounder (like s_rint.c).
To get this behaviour with gcc, you may need to use the -ffloat-store
flag:
For most programs, the excess precision does only good, but a few
programs rely on the precise definition of IEEE floating point. Use
`-ffloat-store' for such programs.
Do _not_ mark the variables 'volatile'. This causes a performance
reduction on sparc and powerpc, and probably on alpha and x86 too,
because of the memory traffic it generates.
--
Geoff Keating <Geoff.Keating@anu.edu.au>
More information about the Gcc
mailing list