Skip to content

Commit 89e4065

Browse files
committed
Disable nan on platforms without string manip
1 parent a1937d7 commit 89e4065

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

include/boost/decimal/detail/cmath/nan.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
#include <boost/decimal/cstdlib.hpp>
1212
#include <limits>
1313

14+
#if !defined(BOOST_DECIMAL_DISABLE_CLIB)
15+
1416
namespace boost {
1517
namespace decimal {
1618

@@ -50,4 +52,6 @@ constexpr auto nand128(const char* arg) noexcept -> decimal128
5052
} //namespace decimal
5153
} //namespace boost
5254

55+
#endif //#if !defined(BOOST_DECIMAL_DISABLE_CLIB)
56+
5357
#endif //BOOST_DECIMAL_DETAIL_CMATH_NAN_HPP

test/test_cmath.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1340,13 +1340,15 @@ void test_exp2()
13401340
BOOST_TEST_EQ(exp2(-std::numeric_limits<T>::infinity()), T(0 * dist(rng)));
13411341
}
13421342

1343+
#if !defined(BOOST_DECIMAL_DISABLE_CLIB)
13431344
template <typename T>
13441345
void test_nan()
13451346
{
13461347
BOOST_TEST(!isnan(nan<T>("1") & std::numeric_limits<T>::quiet_NaN()));
13471348
BOOST_TEST(!isnan(nan<T>("2") & std::numeric_limits<T>::quiet_NaN()));
13481349
BOOST_TEST(!isnan(nan<T>("-1") & std::numeric_limits<T>::quiet_NaN()));
13491350
}
1351+
#endif
13501352

13511353
int main()
13521354
{
@@ -1456,9 +1458,11 @@ int main()
14561458
test_exp2<decimal32>();
14571459
test_exp2<decimal64>();
14581460

1461+
#if !defined(BOOST_DECIMAL_DISABLE_CLIB)
14591462
test_nan<decimal32>();
14601463
test_nan<decimal64>();
14611464
test_nan<decimal128>();
1465+
#endif
14621466

14631467
return boost::report_errors();
14641468
}

0 commit comments

Comments
 (0)