mirror of
https://github.com/boostorg/core.git
synced 2025-11-28 21:30:09 +01:00
Add fpclassify.
This commit is contained in:
@@ -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) );
|
||||
|
||||
Reference in New Issue
Block a user