Re: Relying on precise integer calculation with double

2006-04-07 Thread Morten Welinder
gcc really, really ought to specify more precisely what floating point semantics one can depend on. Bug 323, paraphrased, says "floating point comparisons return random numbers". Ok, that's pumping it a bit, but consider the following qsort comparison function right out of K&R 2nd Edition page 1

Re: Relying on precise integer calculation with double

2006-04-06 Thread Roger Sayle
On Thu, 6 Apr 2006, Daniel Bratell wrote: > that it would be safe to use that flag unless I relied on extreme > precision or behaviour related to NaN or +-Inf, and that normal simple > arithmetics should still give the same result. Unfortunately, with -ffast-math simple arithemtics no longer have

Re: Relying on precise integer calculation with double

2006-04-06 Thread Andrew Haley
Daniel Bratell writes: > This is likely to be the one FAQ you've all learned to answer but > as I was bitten by it, I just wanted to make sure that what I saw > was expected. > > I've used -ffast-math for a slight speedup of floating point > arithmetics, but I've also used doubles to store

Relying on precise integer calculation with double

2006-04-06 Thread Daniel Bratell
Hi, This is likely to be the one FAQ you've all learned to answer but as I was bitten by it, I just wanted to make sure that what I saw was expected. I've used -ffast-math for a slight speedup of floating point arithmetics, but I've also used doubles to store integers. Since integers (up to