]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/math/test/ccmath_fpclassify_test.cpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / libs / math / test / ccmath_fpclassify_test.cpp
CommitLineData
1e59de90
TL
1// (C) Copyright Matt Borland 2021.
2// Use, modification and distribution are subject to the
3// Boost Software License, Version 1.0. (See accompanying file
4// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5
6#include <cmath>
7#include <cfloat>
8#include <cstdint>
9#include <limits>
10#include <type_traits>
11#include <boost/math/ccmath/fpclassify.hpp>
12
13#ifdef BOOST_HAS_FLOAT128
14#include <boost/multiprecision/float128.hpp>
15#endif
16
17template <typename T>
18void test()
19{
20 if constexpr (std::numeric_limits<T>::has_quiet_NaN)
21 {
22 static_assert(boost::math::ccmath::fpclassify(std::numeric_limits<T>::quiet_NaN()) == FP_NAN);
23 }
24
25 static_assert(boost::math::ccmath::fpclassify(T(0)) == FP_ZERO);
26 static_assert(boost::math::ccmath::fpclassify(std::numeric_limits<T>::infinity()) == FP_INFINITE);
27 static_assert(boost::math::ccmath::fpclassify((std::numeric_limits<T>::min)() / T(2)) == FP_SUBNORMAL);
28 static_assert(boost::math::ccmath::fpclassify(T(1)) == FP_NORMAL);
29}
30
31#ifndef BOOST_MATH_NO_CONSTEXPR_DETECTION
32int main()
33{
34 test<float>();
35 test<double>();
36
37 #ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
38 test<long double>();
39 #endif
40
41 #if defined(BOOST_HAS_FLOAT128) && !defined(BOOST_MATH_USING_BUILTIN_CONSTANT_P)
42 test<boost::multiprecision::float128>();
43 #endif
44
45 return 0;
46}
47#else
48int main()
49{
50 return 0;
51}
52#endif