Re: Somewhat OT: gcc, x86, -ffast-math, and Linux

From: J.A. Magallon
Date: Wed Mar 31 2004 - 02:16:11 EST

On 26 mar 2004, at 21:54, Daniel Forrest wrote:

different machines. However, the differences are all less than the
precision of a single-precision floating point number. By this I mean
that if the results (which are written to 15 digits of precision) are
only compared to 7 digits then the results are the same. Also, most
of the time the 15 digit values are the same.

(sorry if this is stupid, but anyways...)

Don't blame fast-math, if I undestood what you did...
With single-precission floats, you just have 7 digits of precission
(scientific notation) [1].
If you ask printf() to write 15 decimal places, it just _lies_.
How does it invent the rest of decimals, is up to glibc. Just
get glibc sources.

In short, anything past the 7th digit is crap, and can be different
depending on the box, cosmic rays and a butterfly waving its wings.

[1] cpp -dM /dev/null | grep EPSILON
cpp -dM /dev/null | grep FLT

J.A. Magallon <jamagallon()able!es> \ Software is like sex:
werewolf!able!es \ It's better when it's free
MacOS X 10.3.3, Build 7F44, Darwin Kernel Version 7.3.0

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at