Skip to content

Commit

Permalink
try function to detec ieee violation
Browse files Browse the repository at this point in the history
  • Loading branch information
Expander committed Mar 6, 2024
1 parent 0cd64ec commit be53ae4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test/test.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,14 @@ inline bool has_signed_zero() noexcept
}


inline bool is_ieee754_compliant() noexcept
{
constexpr bool no_fast_math = (1.0 + 0.1) - 1.0 != 0.1;

return has_inf() && has_signed_zero() && no_fast_math;
}


inline bool is_close_rel(double x, double y, double eps) noexcept
{
const double ma = std::max(std::abs(x), std::abs(y));
Expand Down
4 changes: 4 additions & 0 deletions test/test_log.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
// tests log(z) and log1p(1+z) for small complex z
TEST_CASE("test_log_and_log1p")
{
if (!is_ieee754_compliant()) {
return;
}

using namespace polylogarithm;

const double eps = std::numeric_limits<double>::epsilon();
Expand Down

0 comments on commit be53ae4

Please sign in to comment.