// Copyright 2025 Matt Borland // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt #ifndef BOOST_DECIMAL_DETAIL_CMATH_NORMALIZE_HPP #define BOOST_DECIMAL_DETAIL_CMATH_NORMALIZE_HPP #include #include #include namespace boost { namespace decimal { template , bool> = true> constexpr DecimalType normalize(const DecimalType& value) noexcept { return value; } template , bool> = true> constexpr DecimalType normalize(const DecimalType value) noexcept { int exp {}; const auto significand {frexp10(value, &exp)}; return DecimalType{significand, exp, signbit(value)}; } } // namespace decimal } // namespace boost #endif //BOOST_DECIMAL_DETAIL_CMATH_NORMALIZE_HPP