Floating point comparisons with NaN values produce wrong results

Andi Kleen ak@muc.de
Sun Sep 5 09:04:00 GMT 1999


moshier@mediaone.net (Stephen L Moshier) writes:

> > static const char double_q_nan_bytes_be[8] = {0x7f, 0xf8, 0, 0, 0, 0,
> 0, 0};
> 
> > #define double_q_nan  (*(const double *)double_q_nan_bytes_be)
> 
> 
> This is not valid C language.  You need to fix your test case.

Are you sure? char is allowd to alias with any type, including double. I see 
nothing wrong with this snippet.

-Andi

-- 
This is like TV. I don't like TV.


More information about the Gcc-bugs mailing list