bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GCC optimizes integer overflow: bug or feature?


From: Richard B. Kreckel
Subject: Re: GCC optimizes integer overflow: bug or feature?
Date: Thu, 21 Dec 2006 21:47:50 +0100
User-agent: Debian Thunderbird 1.0.2 (X11/20061113)

Marcin Dalecki wrote:

But the same applies to floating point numbers. There, the situation is even better, because nowadays I can rely on a float or double being the representation defined in IEEE 754 because there is such overwhelming hardware support.


You better don't. Really! Please just realize for example the impact of the (in)famous 80 bit internal (over)precision of a
very common IEEE 754 implementation...


Well, I know. Which is why I used the term "storage representation" down the rest of the paragraph that you decided not to quote. :)

However it's a quite common mistake to forget how "bad" floats "model" real numbers.


And it's quite a common mistake to forget how "bad" finite ints "model" integer numbers.


No it isn't. Most people don't think in terms of infinite arithmetics when programming. And I hold up that the difference between finite and infinite is actually quite a fundamental
concept.


Let us agree to disagree.

However quite a lot of people expect the floating arithmetics rouding to give them
well behaved results.


I don't know what you mean by "well behaved" in this context, but I am beginning to suspect something: what you were trying to express with that algebra argument was a mere gut feeling of yours that there is a fundamental need to distinguish between discreet and continous domains. Let me just say that "algebra" has not much to do with that distinction and is off-topic. Anyway, you are entitled to feel that way or the other, but I cannot agree.

Leaving such gut feelings aside, I maintain: GCC has been careful not to violate a standard (IEEE 754) that was not binding, but assumed by many of its users, unless told otherwise (using -ffast-math). Now it is violating another standard (LIA-1) that is not binding, but assumed by many of its users, unless explicitly told to follow that standard (with -fwrapv). That is A Bad Idea.

Cheers
-richy.

--
Richard B. Kreckel
<http://www.ginac.de/~kreckel/>





reply via email to

[Prev in Thread] Current Thread [Next in Thread]