
Johan RĂ¥de wrote:
John,
Thanks a lot for running these tests.
Here is a summary of what you have done (could you double check that I've got the operating systems / compilers / processors right), and my interpretation of the results:
---- pass ----
Win32 / Intel 8.? / ia32 Win32 / Intel 9.1 / ia32 Linux / Intel 9.1 / ia32 HP-UX / GCC ? / ia64
Add to that HP aCC with -O4.
---- fail ----
Win32 / Intel 7.? / ia32
where: basic_test<float> line 242 what: !isinf(signalling_NaN()) why: broken numeric_limits<T>::signalling_NaN
Not sure about that: the std lib is the same as that used by VC6, however these are both old compilers now, so maybe ignor this one for now (your code doesn't compile on VC6 anyway).
HP-UX / aCC / ia64
where: basic_test<float> line 122 what: fpclassify(denorm_min()) == FP_SUBNORMAL why: multiple definitions of FP_SUBNORMAL ?
I don't think that's the cause: it passes with -O4 but not -Ofaster. The docs for -Ofaster state that it breaks code that relies on denorms, and it's noticable that your first denorm test passes, but the second (which negates denorm_min()) fails. I suspect that the negation of the denorm causes it to round down to zero maybe?
Linux / Intel 9.1 / ia64
where: basic_test<float> line 139 what: !isnormal(min()/2) why: broken numeric_limits<T>::min ?
I don't believe that's the cause: the test passes when built in debug mode, or with -O1, but fails with -O2 or -O3, so it's an optimiser issue again. My suspicion would be that: x = (std::numeric_limits<T>::min)() / 2; either underflows to zero, or is evaluated by the compiler at compile time maybe?
Could you run the inspect tool on the last two platforms as well?
Here's HP-UX: maddock@td176> aCC -AA -I../../ -I ~ -Ofaster *.cpp maddock@td176> ./a.out This platform is big-endian. BOOST_LITTTLE_ENDIAN is defined. ---------- float -------------------- 000 00 00 00 sn. min00 00 00 01 n. min00 80 00 00 13f 80 00 00 4/33f aa aa ab max7f 7f ff ff inf7f 80 00 00 q. nan7f c0 00 00 s. nan7f a0 00 00 -1bf 80 00 00 ---------- double ------------------- 000 00 00 00 00 00 00 00 sn. min00 00 00 00 00 00 00 01 n. min00 10 00 00 00 00 00 00 13f f0 00 00 00 00 00 00 4/33f f5 55 55 55 55 55 55 max7f ef ff ff ff ff ff ff inf7f f0 00 00 00 00 00 00 q. nan7f f8 00 00 00 00 00 00 s. nan7f f4 00 00 00 00 00 00 -1bf f0 00 00 00 00 00 00 ---------- long double -------------- 000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 sn. min00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 n. min00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 13f ff 00 00 00 00 00 00 00 00 00 00 00 00 00 00 4/33f ff 55 55 55 55 55 55 55 55 55 55 55 55 55 55 max7f fe ff ff ff ff ff ff ff ff ff ff ff ff ff ff inf7f ff 00 00 00 00 00 00 00 00 00 00 00 00 00 00 q. nan7f ff 80 00 00 00 00 00 00 00 00 00 00 00 00 00 s. nan7f ff 40 00 00 00 00 00 00 00 00 00 00 00 00 00 -1bf ff 00 00 00 00 00 00 00 00 00 00 00 00 00 00 And Intel on Linux/IA64 maddock@td178.testdrive.hp.com> icc -O3 -I../../ -I ~ *.cpp -static maddock@td178.testdrive.hp.com> ./a.out This platform is little-endian. BOOST_LITTTLE_ENDIAN is defined. ---------- float -------------------- 0 00 00 00 00 sn. min 00 00 00 01 n. min 00 80 00 00 1 3f 80 00 00 4/3 3f aa aa ab max 7f 7f ff ff inf 7f 80 00 00 q. nan 7f e0 00 00 s. nan 7f a0 00 00 -1 bf 80 00 00 ---------- double ------------------- 0 00 00 00 00 00 00 00 00 sn. min 00 00 00 00 00 00 00 01 n. min 00 10 00 00 00 00 00 00 1 3f f0 00 00 00 00 00 00 4/3 3f f5 55 55 55 55 55 55 max 7f ef ff ff ff ff ff ff inf 7f f0 00 00 00 00 00 00 q. nan 7f fc 00 00 00 00 00 00 s. nan 7f f4 00 00 00 00 00 00 -1 bf f0 00 00 00 00 00 00 ---------- long double -------------- 0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 sn. min 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 n. min 00 00 00 00 00 00 00 00 80 00 00 00 00 00 00 00 1 00 00 00 00 00 00 3f ff 80 00 00 00 00 00 00 00 4/3 00 00 00 00 00 00 3f ff aa aa aa aa aa aa aa ab max 00 00 00 00 00 00 7f fe ff ff ff ff ff ff ff ff inf 00 00 00 00 00 00 7f ff 80 00 00 00 00 00 00 00 q. nan 00 00 00 00 00 00 7f ff e0 00 00 00 00 00 00 00 s. nan 00 00 00 00 00 00 7f ff a0 00 00 00 00 00 00 00 -1 00 00 00 00 00 00 bf ff 80 00 00 00 00 00 00 00 Can I make a couple of suggestions with respect to your test program? 1) It would be useful if the asserts were changed to something that didn't abort so we could see all the possible failures at once. 2) It would be useful if failed tests printed out the binary representation of the failed value (merge the inspect tool into the test. 3) It would help to check whether numeric_limits::has_infinity/has_denorm etc is true before testing those features. 4) It might pay to sanity check that denorm test values aren't zero or >= numeric_limits<>::min() before using them. That would catch out clever compilers right away: there's no point in testing for a denorm if the value isn't a denorm! :-) HTH, John.