mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-22 05:16:10 +01:00
Add tests for scaled ULP distance between +/- FLT/DBL_MAX
This commit is contained in:
parent
a0ef2115f8
commit
7f931d6df4
@ -123,6 +123,12 @@ TEST_CASE( "count_equidistant_floats",
|
||||
CHECK( count_floats_with_scaled_ulp( 1., 1.5 ) == 1ull << 51 );
|
||||
CHECK( count_floats_with_scaled_ulp( 1.25, 1.5 ) == 1ull << 50 );
|
||||
CHECK( count_floats_with_scaled_ulp( 1.f, 1.5f ) == 1 << 22 );
|
||||
CHECK( count_floats_with_scaled_ulp( -std::numeric_limits<float>::max(),
|
||||
std::numeric_limits<float>::max() ) ==
|
||||
33554430 ); // (1 << 25) - 2 due to not including infinities
|
||||
CHECK( count_floats_with_scaled_ulp( -std::numeric_limits<double>::max(),
|
||||
std::numeric_limits<double>::max() ) ==
|
||||
18014398509481982 ); // (1 << 54) - 2 due to not including infinities
|
||||
|
||||
STATIC_REQUIRE( std::is_same<std::uint64_t,
|
||||
decltype( count_floats_with_scaled_ulp(
|
||||
|
Loading…
Reference in New Issue
Block a user