This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Floating point comparisons with NaN values produce wrongresults


>>>>> "Andi" == Andi Kleen <ak@muc.de> writes:

    Andi> 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.

    Andi> Are you sure? char is allowd to alias with any type,
    Andi> including double. 

The relation is not symmetric.  You can use a char lvalue to access
anything.  You cannot use a double lvalue to access a bunch of chars.

--
Mark Mitchell                   mark@codesourcery.com
CodeSourcery, LLC               http://www.codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]