The Battle for Wesnoth  1.13.10+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
ieee_754.cpp
Go to the documentation of this file.
1 #include <cstdint>
2 
3 // This test verifies that floating point numbers are represented in the IEEE 754 format.
4 // Wesnoth requires that.
5 int main()
6 {
7  union
8  {
9  double floating_point_number;
10  uint64_t integer;
11  } number;
12 
13  number.floating_point_number = 1.2;
14  bool match = (number.integer == 0x3FF3333333333333ull);
15  // Return code zero means success.
16  // Thus, check that the bit representation is *not* what IEEE 754 specifies.
17  return !match;
18 }
static const char * match(MatchState *ms, const char *s, const char *p)
Definition: lstrlib.cpp:425
int main()
Definition: ieee_754.cpp:5