Made use of std::numeric_limits::is_iec559

This commit is contained in:
Charles Dang 2018-03-15 22:22:31 +11:00
parent e8da52f4c4
commit bba1dc264b

View file

@ -1,18 +1,11 @@
#include <cstdint>
#include <limits>
// This test verifies that floating point numbers are represented in the IEEE 754 format.
// Wesnoth requires that.
int main()
{
union
{
double floating_point_number;
uint64_t integer;
} number;
number.floating_point_number = 1.2;
bool match = (number.integer == 0x3FF3333333333333ull);
// Return code zero means success.
// Thus, check that the bit representation is *not* what IEEE 754 specifies.
bool match = std::numeric_limits<double>::is_iec559;
return !match;
}