Skip to content

Commit

Permalink
Fix test to match new behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
mborland committed Jan 31, 2025
1 parent b5ecfcd commit f8a3b3f
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions test/test_cmath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1128,7 +1128,7 @@ void test_nextafter()
{
BOOST_TEST_EQ(ret_val, ret_dec); // LCOV_EXCL_LINE
}
else if (!BOOST_TEST(boost::math::float_distance(ret_val, ret_dec) < 10))
else if (!BOOST_TEST(boost::math::float_distance(ret_val, ret_dec) < 25))
{
// LCOV_EXCL_START
std::cerr << "Val 1: " << val1
Expand All @@ -1137,7 +1137,7 @@ void test_nextafter()
<< "\nDec 2: " << d2
<< "\nRet val: " << ret_val
<< "\nRet dec: " << ret_dec
<< "\nDist: " << boost::math::float_distance(ret_val, ret_dec);
<< "\nDist: " << boost::math::float_distance(ret_val, ret_dec) << std::endl;
// LCOV_EXCL_STOP
}
}
Expand All @@ -1147,8 +1147,8 @@ void test_nextafter()
BOOST_TEST(isnan(nextafter(Dec(1), std::numeric_limits<Dec>::quiet_NaN() * Dec(dist(rng)))));
BOOST_TEST(!isinf(nextafter(Dec(1), std::numeric_limits<Dec>::infinity() * Dec(dist(rng)))));
BOOST_TEST_EQ(nextafter(Dec(1), Dec(1)), Dec(1));
BOOST_TEST_EQ(nextafter(Dec(0), Dec(1)), std::numeric_limits<Dec>::epsilon());
BOOST_TEST_EQ(nextafter(Dec(0), Dec(-1)), -std::numeric_limits<Dec>::epsilon());
BOOST_TEST_EQ(nextafter(Dec(0), Dec(1)), std::numeric_limits<Dec>::denorm_min());
BOOST_TEST_EQ(nextafter(Dec(0), Dec(-1)), -std::numeric_limits<Dec>::denorm_min());
}

template <typename Dec>
Expand All @@ -1171,7 +1171,7 @@ void test_nexttoward()
{
BOOST_TEST_EQ(ret_val, ret_dec); // LCOV_EXCL_LINE
}
else if (!BOOST_TEST(boost::math::float_distance(ret_val, ret_dec) < 10))
else if (!BOOST_TEST(boost::math::float_distance(ret_val, ret_dec) < 25))
{
// LCOV_EXCL_START
std::cerr << "Val 1: " << val1
Expand All @@ -1180,16 +1180,16 @@ void test_nexttoward()
<< "\nDec 2: " << d2
<< "\nRet val: " << ret_val
<< "\nRet dec: " << ret_dec
<< "\nDist: " << boost::math::float_distance(ret_val, ret_dec);
<< "\nDist: " << boost::math::float_distance(ret_val, ret_dec) << std::endl;
// LCOV_EXCL_STOP
}
}

BOOST_TEST(isinf(nexttoward(std::numeric_limits<Dec>::infinity() * Dec(dist(rng)), 1)));
BOOST_TEST(isnan(nexttoward(std::numeric_limits<Dec>::quiet_NaN() * Dec(dist(rng)), 1)));
BOOST_TEST_EQ(nexttoward(Dec(1), 1), Dec(1));
BOOST_TEST_EQ(nexttoward(Dec(0), 1), std::numeric_limits<Dec>::epsilon());
BOOST_TEST_EQ(nexttoward(Dec(0), -1), -std::numeric_limits<Dec>::epsilon());
BOOST_TEST_EQ(nexttoward(Dec(0), 1), std::numeric_limits<Dec>::denorm_min());
BOOST_TEST_EQ(nexttoward(Dec(0), -1), -std::numeric_limits<Dec>::denorm_min());
}

template <typename T>
Expand Down

0 comments on commit f8a3b3f

Please sign in to comment.