]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/math/test/ccmath_floor_test.cpp
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)
10 #include <type_traits>
11 #include <boost/math/ccmath/floor.hpp>
12 #include <boost/math/ccmath/isnan.hpp>
13 #include <boost/math/ccmath/isinf.hpp>
15 #ifdef BOOST_HAS_FLOAT128
16 #include <boost/multiprecision/float128.hpp>
22 if constexpr (std::numeric_limits
<T
>::has_quiet_NaN
)
24 static_assert(boost::math::ccmath::isnan(boost::math::ccmath::floor(std::numeric_limits
<T
>::quiet_NaN())), "If x is NaN, NaN is returned");
27 static_assert(!boost::math::ccmath::floor(T(0)), "If x is +- 0, it is returned, unmodified");
28 static_assert(!boost::math::ccmath::floor(T(-0)), "If x is +- 0, it is returned, unmodified");
30 static_assert(boost::math::ccmath::isinf(boost::math::ccmath::floor(std::numeric_limits
<T
>::infinity())),
31 "If x is +- inf, it is returned, unmodified");
32 static_assert(boost::math::ccmath::isinf(boost::math::ccmath::floor(-std::numeric_limits
<T
>::infinity())),
33 "If x is +- inf, it is returned, unmodified");
35 static_assert(boost::math::ccmath::floor(T(2)) == T(2));
36 static_assert(boost::math::ccmath::floor(T(2.4)) == T(2));
37 static_assert(boost::math::ccmath::floor(T(2.9)) == T(2));
38 static_assert(boost::math::ccmath::floor(T(-2.7)) == T(-3));
39 static_assert(boost::math::ccmath::floor(T(-2)) == T(-2));
42 #if !defined(BOOST_MATH_NO_CONSTEXPR_DETECTION) && !defined(BOOST_MATH_USING_BUILTIN_CONSTANT_P)
48 #ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
52 #ifdef BOOST_HAS_FLOAT128
53 test
<boost::multiprecision::float128
>();