-----Original Message----- From: Boost [mailto:boost-bounces@lists.boost.org] On Behalf Of Steven Watanabe Sent: 18 March 2015 15:20 To: boost@lists.boost.org Subject: Re: [boost] [endian] Testing floating point interoperability
AMDG
On 03/18/2015 07:24 AM, Beman Dawes wrote:
On Fri, Jan 30, 2015 at 5:25 AM, Paul A. Bristow
wrote: You can't test all possible values (except for 32-bit float - 64-bit double takes about 50 years at current processor speeds ;-) but you can chose values (floating-point bit patterns) at random for a test lasting some minutes or even hours.
Could you provide the random number generation and otherwise help with this? I've only ever used integer RNGs.
Since you want to test random bit patterns, the easiest way is to generate a 64-bit integer and memcpy it to a double.
I'm not sure if it will prove realistic to test all the possible NaN patterns provided by IEEE
floating-point layout?
I would expect only those 'funny numbers' in std::numeric_limits to work
numeric_limits<>::infinity()
-numeric_limits<>::infinity()
numeric_limits<>::quiet_NaN()
perhaps (despite its meaninglessness) even
-numeric_limits<>::quiet_NaN()
There was some discussion about removing signaling_NaN
std::numeric_limits<float>::signaling_NaN() representation is
0x7fc00001 for Microsoft/Dinkumware, but is 0x7fa00000 for gcc and clang:-(
I would simply accept and document that signaling_NaN won't work (unless it does ;-)?
But if all of the tests prove to work, then fine.
If not, then in our round-trip testing John and I just tested for 'funny' with
#include