[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: GCC optimizes integer overflow: bug or feature?
From: |
Marcin Dalecki |
Subject: |
Re: GCC optimizes integer overflow: bug or feature? |
Date: |
Thu, 21 Dec 2006 00:47:05 +0100 |
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...
volatile float b = 1.;
if (1. / 3. == b / 3.) {
printf("HALLO!\n")
} else {
printf("SURPRISE SURPRISE!\n");
}
or just skim through http://gcc.gnu.org/bugzilla/show_bug.cgi?id=323
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. However quite a lot of people expect the floating
arithmetics rouding to give them
well behaved results.
Marcin Dalecki
- Re: GCC optimizes integer overflow: bug or feature?, (continued)
- Re: GCC optimizes integer overflow: bug or feature? (was: avoid integer overflow in mktime.m4), Richard B. Kreckel, 2006/12/20
- Re: GCC optimizes integer overflow: bug or feature?, Robert Dewar, 2006/12/19
- Re: GCC optimizes integer overflow: bug or feature? (was: avoid integer overflow in mktime.m4), Marcin Dalecki, 2006/12/20
- Re: GCC optimizes integer overflow: bug or feature?, Richard B. Kreckel, 2006/12/20
- Re: GCC optimizes integer overflow: bug or feature?, Marcin Dalecki, 2006/12/20
- Re: GCC optimizes integer overflow: bug or feature?, Richard B. Kreckel, 2006/12/20
- Re: GCC optimizes integer overflow: bug or feature?,
Marcin Dalecki <=
- Re: GCC optimizes integer overflow: bug or feature?, Richard B. Kreckel, 2006/12/21
Re: avoid integer overflow in mktime.m4, Paul Eggert, 2006/12/22
Re: avoid integer overflow in mktime.m4, Paul Eggert, 2006/12/22