double rounding in xtime_diff()?
pcg at goof.com
Tue Oct 13 20:29:42 UTC 1998
On Mon, Oct 12, 1998 at 11:24:06AM +0100, Markus Kuhn wrote:
> That's very interesting. Under Linux/Pentium_II (cpu=686, model=3,
> vendor_id=GenuineIntel, stepping=4, gcc 184.108.40.206) the effect does not
> show up immediately. I had to enforce using the software FP-library with
> gcc -msoft-float to reproduce this effect, because without this option
> with the hardware FPU I get the correct result (and this is apparently
> not thanks to Intel's internal 80-bit arithmetic, because I did use gcc
> -ffloat-store to enforce 64-bit rounding).
Have you looked at the actual assemby output? x86 is the worst platform to
"prove" something about double arithmetic. Unless you set the cpu to double
rounding mode (say, using __setfpucw), therefore invalidating long double,
nothing will help. -ffloat-store does not do what you want in every case.
> There seem to be interesting differences between IEEE and IEEE.
No, but between IEEE and x86 ;(
> A somewhat related question: Given a floating-point value X,
> is there in C9X a portable way to get the next smaller and the
You could (in C90 as well) try to mess around with frexp/ldexp and/or scalb.
The draft c9x standard (as well as xopen-extended) seems to contain a
nextafter (x, y): Return X + epsilon if X < Y, X - epsilon if X > Y.
----==-- _ |
---==---(_)__ __ ____ __ Marc Lehmann +--
--==---/ / _ \/ // /\ \/ / pcg at goof.com |e|
-=====/_/_//_/\_,_/ /_/\_\ --+
The choice of a GNU generation |
More information about the tz