Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Check that floats are in the IEEE 754 format when building with CMake
SCons version is coming a bit later.
- Loading branch information
Showing
2 changed files
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#include <cstdint> | ||
|
||
// 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; | ||
// Return code zero means success. | ||
// Thus, check that the bit representation is *not* what IEEE 754 specifies. | ||
return number.integer != 0x3FF3333333333333ull; | ||
} |