// Copyright 2023 Matt Borland // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt #ifndef BOOST_DECIMAL_CMATH_HPP #define BOOST_DECIMAL_CMATH_HPP #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include // Macros from 3.6.2 #define BOOST_DECIMAL_HUGE_VAL_D32 std::numeric_limits::infinity() #define BOOST_DECIMAL_HUGE_VAL_D64 std::numeric_limits::infinity() #define BOOST_DECIMAL_DEC_INFINITY std::numeric_limits::infinity() #define BOOST_DECIMAL_DEC_NAN std::numeric_limits::signaling_NaN() #define BOOST_DECIMAL_FP_FAST_FMAD32 1 #define BOOST_DECIMAL_FP_FAST_FMAD64 1 #define BOOST_DECIMAL_FP_FAST_FMAD128 1 namespace boost { namespace decimal { // Overloads for all the functions that are implemented individually as friends BOOST_DECIMAL_EXPORT constexpr auto scalbn(decimal32_t num, int expval) noexcept -> decimal32_t { return scalbnd32(num, expval); } BOOST_DECIMAL_EXPORT constexpr auto scalbn(decimal_fast32_t num, int expval) noexcept -> decimal_fast32_t { return scalbnd32f(num, expval); } BOOST_DECIMAL_EXPORT constexpr auto scalbn(decimal64_t num, int expval) noexcept -> decimal64_t { return scalbnd64(num, expval); } BOOST_DECIMAL_EXPORT constexpr auto scalbn(decimal_fast64_t num, int expval) noexcept -> decimal_fast64_t { return scalbnd64f(num, expval); } BOOST_DECIMAL_EXPORT constexpr auto scalbn(decimal128_t num, int expval) noexcept -> decimal128_t { return scalbnd128(num, expval); } BOOST_DECIMAL_EXPORT constexpr auto scalbn(decimal_fast128_t num, int expval) noexcept -> decimal_fast128_t { return scalbnd128f(num, expval); } BOOST_DECIMAL_EXPORT constexpr auto scalbln(decimal32_t num, long expval) noexcept -> decimal32_t { return scalblnd32(num, expval); } BOOST_DECIMAL_EXPORT constexpr auto scalbln(decimal_fast32_t num, long expval) noexcept -> decimal_fast32_t { return scalblnd32f(num, expval); } BOOST_DECIMAL_EXPORT constexpr auto scalbln(decimal64_t num, long expval) noexcept -> decimal64_t { return scalblnd64(num, expval); } BOOST_DECIMAL_EXPORT constexpr auto scalbln(decimal_fast64_t num, long expval) noexcept -> decimal_fast64_t { return scalblnd64f(num, expval); } BOOST_DECIMAL_EXPORT constexpr auto scalbln(decimal128_t num, long expval) noexcept -> decimal128_t { return scalblnd128(num, expval); } BOOST_DECIMAL_EXPORT constexpr auto scalbln(decimal_fast128_t num, long expval) noexcept -> decimal_fast128_t { return scalblnd128f(num, expval); } BOOST_DECIMAL_EXPORT constexpr auto copysign(decimal32_t mag, decimal32_t sgn) noexcept -> decimal32_t { return copysignd32(mag, sgn); } BOOST_DECIMAL_EXPORT constexpr auto copysign(decimal_fast32_t mag, decimal_fast32_t sgn) noexcept -> decimal_fast32_t { return copysignd32f(mag, sgn); } BOOST_DECIMAL_EXPORT constexpr auto copysign(decimal64_t mag, decimal64_t sgn) noexcept -> decimal64_t { return copysignd64(mag, sgn); } BOOST_DECIMAL_EXPORT constexpr auto copysign(decimal_fast64_t mag, decimal_fast64_t sgn) noexcept -> decimal_fast64_t { return copysignd64f(mag, sgn); } BOOST_DECIMAL_EXPORT constexpr auto copysign(decimal128_t mag, decimal128_t sgn) noexcept -> decimal128_t { return copysignd128(mag, sgn); } BOOST_DECIMAL_EXPORT constexpr auto copysign(decimal_fast128_t mag, decimal_fast128_t sgn) noexcept -> decimal_fast128_t { return copysignd128f(mag, sgn); } BOOST_DECIMAL_EXPORT constexpr auto samequantum(decimal32_t lhs, decimal32_t rhs) noexcept -> bool { return samequantumd32(lhs, rhs); } BOOST_DECIMAL_EXPORT constexpr auto samequantum(decimal_fast32_t lhs, decimal_fast32_t rhs) noexcept -> bool { return samequantumd32f(lhs, rhs); } BOOST_DECIMAL_EXPORT constexpr auto samequantum(decimal64_t lhs, decimal64_t rhs) noexcept -> bool { return samequantumd64(lhs, rhs); } BOOST_DECIMAL_EXPORT constexpr auto samequantum(decimal128_t lhs, decimal128_t rhs) noexcept -> bool { return samequantumd128(lhs, rhs); } BOOST_DECIMAL_EXPORT constexpr auto samequantum(decimal_fast128_t lhs, decimal_fast128_t rhs) noexcept -> bool { return samequantumd128f(lhs, rhs); } BOOST_DECIMAL_EXPORT constexpr auto quantexp(decimal32_t x) noexcept -> int { return quantexpd32(x); } BOOST_DECIMAL_EXPORT constexpr auto quantexp(decimal_fast32_t x) noexcept -> int { return quantexpd32f(x); } BOOST_DECIMAL_EXPORT constexpr auto quantexp(decimal64_t x) noexcept -> int { return quantexpd64(x); } BOOST_DECIMAL_EXPORT constexpr auto quantexp(decimal_fast64_t x) noexcept -> int { return quantexpd64f(x); } BOOST_DECIMAL_EXPORT constexpr auto quantexp(decimal128_t x) noexcept -> int { return quantexpd128(x); } BOOST_DECIMAL_EXPORT constexpr auto quantexp(decimal_fast128_t x) noexcept -> int { return quantexpd128f(x); } BOOST_DECIMAL_EXPORT constexpr auto quantize(decimal32_t lhs, decimal32_t rhs) noexcept -> decimal32_t { return quantized32(lhs, rhs); } BOOST_DECIMAL_EXPORT constexpr auto quantize(decimal_fast32_t lhs, decimal_fast32_t rhs) noexcept -> decimal_fast32_t { return quantized32f(lhs, rhs); } BOOST_DECIMAL_EXPORT constexpr auto quantize(decimal64_t lhs, decimal64_t rhs) noexcept -> decimal64_t { return quantized64(lhs, rhs); } BOOST_DECIMAL_EXPORT constexpr auto quantize(decimal128_t lhs, decimal128_t rhs) noexcept -> decimal128_t { return quantized128(lhs, rhs); } BOOST_DECIMAL_EXPORT constexpr auto quantize(decimal_fast128_t lhs, decimal_fast128_t rhs) noexcept -> decimal_fast128_t { return quantized128f(lhs, rhs); } } // namespace decimal } // namespace boost #endif // BOOST_DECIMAL_CMATH_HPP