How to test for +/- INFINITY, etc. in C with IEEE
Andrew Koenig
ark at alice.UucP
Fri Dec 13 02:32:21 AEST 1985
> The C compiler should assume that only decimal constants need be
> converted from integer to floating point.
> Octal and hexadecimal constants are used to represent bit patterns, not
> numbers. There is no reason that the compiler should assume that a
> particular bit pattern represents an integer rather than a
> floating-point number or something even more exotic.
Every constant is an expression. Every expression has a type.
The meaning of an operator depends only on the type of the expressions
that are its operand and on which operator it is.
If you need to get at the bits in a float, do something like this:
union {float f; long l;} bits;
bits.f = ....;
if ((bits.l & 0x7f800000) == 0x7f800000) ...
More information about the Comp.lang.c
mailing list