Skip to content

Commit

Permalink
Work around missing standard pre-defined macros
Browse files Browse the repository at this point in the history
When compiling with emscripten em++ FE_INEXACT and __STDC_IEC_559__ are
not defined.

ChangeLog:

	* testsuite/tests/math_1arg.cc: Without FE_INEXACT float
	exceptions are not test anyway. Just #ifdef the code.
	* testsuite/tests/operators.cc: If neither __GCC_IEC_559 nor
	__STDC_IEC_559__ are defined assume no IEC60559 compliance.
  • Loading branch information
mattkretz committed Oct 27, 2023
1 parent 86af02c commit 54a4b0f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions testsuite/tests/math_1arg.cc
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,11 @@ template <typename V>
MAKE_TESTER(lgamma), MAKE_TESTER(nearbyint), MAKE_TESTER(rint),
MAKE_TESTER(lrint), MAKE_TESTER(llrint), MAKE_TESTER(ilogb));


#ifdef FE_INEXACT
FloatExceptCompare::ignore_spurious = FE_INEXACT;
FloatExceptCompare::ignore_missing = FE_INEXACT;
#endif

test_values<V>(input_values, {10000}, MAKE_TESTER(ceil), MAKE_TESTER(floor), MAKE_TESTER(trunc),
MAKE_TESTER(round), MAKE_TESTER(lround), MAKE_TESTER(llround));
Expand Down
4 changes: 3 additions & 1 deletion testsuite/tests/operators.cc
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,10 @@ template <typename V>
constexpr bool is_iec559 =
#ifdef __GCC_IEC_559
__GCC_IEC_559 >= 2;
#else
#elif defined __STDC_IEC_559__
__STDC_IEC_559__ == 1;
#else
false;
#endif
if constexpr (std::is_floating_point_v<T> && !is_iec559)
{ // avoid testing subnormals and expect minor deltas for non-IEC559 float
Expand Down

0 comments on commit 54a4b0f

Please sign in to comment.