An expression can be evaluated with greater accuracy than a type. In your 32-bit assembly, the compiler probably uses a double bit of 80 bits (which is no longer used in 64 bits) to evaluate x != 0 && x * 0.5 == x .
(GCC knows the problems with these rules, evaluating more accurately in a context where it cannot).
6.3.1.8/2 in C99 (6.2.1.5 in C90 is equivalent):
The values โโof floating operands and the results of floating expressions can be represented in greater accuracy and range than required by the type; types are not changed that way
In the appropriate implementation:
int m_isinf(double x) { double const half_x = x * 0.5; return x != 0 && half_x == x; }
must work. But the gcc bug ( http://gcc.gnu.org/bugzilla/show_bug.cgi?id=323 considers the number of duplicates) often prevents this from working. There are some problems in the error report.
source share