On Thu, Jun 24, 2004 at 01:20:34 +0200, Clemens Ladisch wrote:
The IEEE standard specifies exactly what happens with
denormals, so,
in theory, the compiler must not optimize this away. However,
optimization options for speed often disable strict IEEE
compatibility. (I don't know how gcc's options behave.)
If you use -ffast-math then it note reuiqred to maintin strict IEEE
semantics. Its a lot faster for some operations if you do.
typedef union
{
float f;
int32_t i;
} ls_pcast32;
AFAIK this isn't safe either because the same type aliasing rules
apply to unions, too. The only safe way is to go through char
pointers.
OK, thats interesting. I though it was OK, in that compiler is required to
make &v.f == &v.i, where sizeof(v.f) == sizeof(v.i)? Maybe I misunderstood.
In any case my code is full of gcc-isms, I doubt it would build on any
signifiantly different compiler.
- Steve