Add fpclassify.

This commit is contained in:
Peter Dimov
2020-12-24 00:58:56 +02:00
parent c307f86520
commit bee040b8cc
2 changed files with 93 additions and 0 deletions

View File

@@ -16,6 +16,8 @@ template<class T> void test_positive_normal( T x )
BOOST_TEST( !boost::core::isnan( x ) );
BOOST_TEST( boost::core::isnormal( x ) );
BOOST_TEST_EQ( boost::core::fpclassify( x ), boost::core::fp_normal );
BOOST_TEST( !boost::core::signbit( x ) );
BOOST_TEST_EQ( boost::core::copysign( T(+2), x ), T(+2) );
@@ -29,6 +31,8 @@ template<class T> void test_negative_normal( T x )
BOOST_TEST( !boost::core::isnan( x ) );
BOOST_TEST( boost::core::isnormal( x ) );
BOOST_TEST_EQ( boost::core::fpclassify( x ), boost::core::fp_normal );
BOOST_TEST( boost::core::signbit( x ) );
BOOST_TEST_EQ( boost::core::copysign( T(+2), x ), T(-2) );
@@ -42,6 +46,8 @@ template<class T> void test_positive_zero( T x )
BOOST_TEST( !boost::core::isnan( x ) );
BOOST_TEST( !boost::core::isnormal( x ) );
BOOST_TEST_EQ( boost::core::fpclassify( x ), boost::core::fp_zero );
BOOST_TEST( !boost::core::signbit( x ) );
BOOST_TEST_EQ( boost::core::copysign( T(+2), x ), T(+2) );
@@ -55,6 +61,8 @@ template<class T> void test_negative_zero( T x )
BOOST_TEST( !boost::core::isnan( x ) );
BOOST_TEST( !boost::core::isnormal( x ) );
BOOST_TEST_EQ( boost::core::fpclassify( x ), boost::core::fp_zero );
BOOST_TEST( boost::core::signbit( x ) );
BOOST_TEST_EQ( boost::core::copysign( T(+2), x ), T(-2) );
@@ -68,6 +76,8 @@ template<class T> void test_positive_infinity( T x )
BOOST_TEST( !boost::core::isnan( x ) );
BOOST_TEST( !boost::core::isnormal( x ) );
BOOST_TEST_EQ( boost::core::fpclassify( x ), boost::core::fp_infinite );
BOOST_TEST( !boost::core::signbit( x ) );
BOOST_TEST_EQ( boost::core::copysign( T(+2), x ), T(+2) );
@@ -81,6 +91,8 @@ template<class T> void test_negative_infinity( T x )
BOOST_TEST( !boost::core::isnan( x ) );
BOOST_TEST( !boost::core::isnormal( x ) );
BOOST_TEST_EQ( boost::core::fpclassify( x ), boost::core::fp_infinite );
BOOST_TEST( boost::core::signbit( x ) );
BOOST_TEST_EQ( boost::core::copysign( T(+2), x ), T(-2) );
@@ -94,6 +106,8 @@ template<class T> void test_positive_nan( T x )
BOOST_TEST( boost::core::isnan( x ) );
BOOST_TEST( !boost::core::isnormal( x ) );
BOOST_TEST_EQ( boost::core::fpclassify( x ), boost::core::fp_nan );
BOOST_TEST( !boost::core::signbit( x ) );
BOOST_TEST_EQ( boost::core::copysign( T(+2), x ), T(+2) );
@@ -107,6 +121,8 @@ template<class T> void test_negative_nan( T x )
BOOST_TEST( boost::core::isnan( x ) );
BOOST_TEST( !boost::core::isnormal( x ) );
BOOST_TEST_EQ( boost::core::fpclassify( x ), boost::core::fp_nan );
BOOST_TEST( boost::core::signbit( x ) );
BOOST_TEST_EQ( boost::core::copysign( T(+2), x ), T(-2) );
@@ -120,6 +136,8 @@ template<class T> void test_positive_subnormal( T x )
BOOST_TEST( !boost::core::isnan( x ) );
BOOST_TEST( !boost::core::isnormal( x ) );
BOOST_TEST_EQ( boost::core::fpclassify( x ), boost::core::fp_subnormal );
BOOST_TEST( !boost::core::signbit( x ) );
BOOST_TEST_EQ( boost::core::copysign( T(+2), x ), T(+2) );
@@ -133,6 +151,8 @@ template<class T> void test_negative_subnormal( T x )
BOOST_TEST( !boost::core::isnan( x ) );
BOOST_TEST( !boost::core::isnormal( x ) );
BOOST_TEST_EQ( boost::core::fpclassify( x ), boost::core::fp_subnormal );
BOOST_TEST( boost::core::signbit( x ) );
BOOST_TEST_EQ( boost::core::copysign( T(+2), x ), T(-2) );