From 7f931d6df49bc8810707084480b03259f96d6f72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ho=C5=99e=C5=88ovsk=C3=BD?= Date: Sun, 14 Jan 2024 21:07:43 +0100 Subject: [PATCH] Add tests for scaled ULP distance between +/- FLT/DBL_MAX --- tests/SelfTest/IntrospectiveTests/FloatingPoint.tests.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/SelfTest/IntrospectiveTests/FloatingPoint.tests.cpp b/tests/SelfTest/IntrospectiveTests/FloatingPoint.tests.cpp index eaf22a44..d2181702 100644 --- a/tests/SelfTest/IntrospectiveTests/FloatingPoint.tests.cpp +++ b/tests/SelfTest/IntrospectiveTests/FloatingPoint.tests.cpp @@ -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::max(), + std::numeric_limits::max() ) == + 33554430 ); // (1 << 25) - 2 due to not including infinities + CHECK( count_floats_with_scaled_ulp( -std::numeric_limits::max(), + std::numeric_limits::max() ) == + 18014398509481982 ); // (1 << 54) - 2 due to not including infinities STATIC_REQUIRE( std::is_same