From mboxrd@z Thu Jan 1 00:00:00 1970 From: Geoffrey KEATING To: hjl@lucon.org (H.J. Lu) Cc: zack@rabi.phys.columbia.edu (Zack Weinberg), egcs@cygnus.com, libc-linux@gnu.org (GNU C Library) Subject: Re: A patch for libm-ieee754 Date: Sun, 22 Feb 1998 18:18:00 -0000 Message-id: <199802230218.NAA13525@discus.anu.edu.au> References: X-SW-Source: 1998-02/msg01037.html > 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