Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 58 additions & 15 deletions include/boost/decimal/decimal128_t.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2228,22 +2228,12 @@ constexpr auto scalbnd128(decimal128_t num, const int expval) noexcept -> decima
return scalblnd128(num, static_cast<long>(expval));
}

} //namespace decimal
} //namespace boost

namespace std {
namespace detail {

template<>
#ifdef _MSC_VER
class numeric_limits<boost::decimal::decimal128_t>
#else
struct numeric_limits<boost::decimal::decimal128_t>
#endif
template <bool>
class numeric_limits_impl128
{

#ifdef _MSC_VER
public:
#endif
public:

static constexpr bool is_specialized = true;
static constexpr bool is_signed = true;
Expand Down Expand Up @@ -2271,7 +2261,7 @@ struct numeric_limits<boost::decimal::decimal128_t>
static constexpr int min_exponent10 = min_exponent;
static constexpr int max_exponent = 6144;
static constexpr int max_exponent10 = max_exponent;
static constexpr bool traps = numeric_limits<std::uint64_t>::traps;
static constexpr bool traps = std::numeric_limits<std::uint64_t>::traps;
static constexpr bool tinyness_before = true;

// Member functions
Expand All @@ -2286,6 +2276,59 @@ struct numeric_limits<boost::decimal::decimal128_t>
static constexpr auto denorm_min () -> boost::decimal::decimal128_t { return {1, boost::decimal::detail::etiny_v<boost::decimal::decimal128_t>}; }
};

#if !defined(__cpp_inline_variables) || __cpp_inline_variables < 201606L

template <bool b> constexpr bool numeric_limits_impl128<b>::is_specialized;
template <bool b> constexpr bool numeric_limits_impl128<b>::is_signed;
template <bool b> constexpr bool numeric_limits_impl128<b>::is_integer;
template <bool b> constexpr bool numeric_limits_impl128<b>::is_exact;
template <bool b> constexpr bool numeric_limits_impl128<b>::has_infinity;
template <bool b> constexpr bool numeric_limits_impl128<b>::has_quiet_NaN;
template <bool b> constexpr bool numeric_limits_impl128<b>::has_signaling_NaN;

// These members were deprecated in C++23
#if ((!defined(_MSC_VER) && (__cplusplus <= 202002L)) || (defined(_MSC_VER) && (_MSVC_LANG <= 202002L)))
template <bool b> constexpr std::float_denorm_style numeric_limits_impl128<b>::has_denorm;
template <bool b> constexpr bool numeric_limits_impl128<b>::has_denorm_loss;
#endif

template <bool b> constexpr std::float_round_style numeric_limits_impl128<b>::round_style;
template <bool b> constexpr bool numeric_limits_impl128<b>::is_iec559;
template <bool b> constexpr bool numeric_limits_impl128<b>::is_bounded;
template <bool b> constexpr bool numeric_limits_impl128<b>::is_modulo;
template <bool b> constexpr int numeric_limits_impl128<b>::digits;
template <bool b> constexpr int numeric_limits_impl128<b>::digits10;
template <bool b> constexpr int numeric_limits_impl128<b>::max_digits10;
template <bool b> constexpr int numeric_limits_impl128<b>::radix;
template <bool b> constexpr int numeric_limits_impl128<b>::min_exponent;
template <bool b> constexpr int numeric_limits_impl128<b>::min_exponent10;
template <bool b> constexpr int numeric_limits_impl128<b>::max_exponent;
template <bool b> constexpr int numeric_limits_impl128<b>::max_exponent10;
template <bool b> constexpr bool numeric_limits_impl128<b>::traps;
template <bool b> constexpr bool numeric_limits_impl128<b>::tinyness_before;

#endif // !defined(__cpp_inline_variables) || __cpp_inline_variables < 201606L

} // namespace detail

} //namespace decimal
} //namespace boost

namespace std {

#ifdef __clang__
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wmismatched-tags"
#endif

template <>
class numeric_limits<boost::decimal::decimal128_t> :
public boost::decimal::detail::numeric_limits_impl128<true> {};

#ifdef __clang__
# pragma clang diagnostic pop
#endif

} //namespace std

#include <boost/decimal/charconv.hpp>
Expand Down
72 changes: 58 additions & 14 deletions include/boost/decimal/decimal32_t.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2297,22 +2297,12 @@ constexpr auto copysignd32(decimal32_t mag, const decimal32_t sgn) noexcept -> d
return mag;
}

} // namespace decimal
} // namespace boost

namespace std {
namespace detail {

template <>
#ifdef _MSC_VER
class numeric_limits<boost::decimal::decimal32_t>
#else
struct numeric_limits<boost::decimal::decimal32_t>
#endif
template <bool>
class numeric_limits_impl32
{

#ifdef _MSC_VER
public:
#endif

static constexpr bool is_specialized = true;
static constexpr bool is_signed = true;
Expand Down Expand Up @@ -2340,7 +2330,7 @@ struct numeric_limits<boost::decimal::decimal32_t>
static constexpr int min_exponent10 = min_exponent;
static constexpr int max_exponent = 96;
static constexpr int max_exponent10 = max_exponent;
static constexpr bool traps = numeric_limits<std::uint32_t>::traps;
static constexpr bool traps = std::numeric_limits<std::uint32_t>::traps;
static constexpr bool tinyness_before = true;

// Member functions
Expand All @@ -2353,8 +2343,62 @@ struct numeric_limits<boost::decimal::decimal32_t>
static constexpr auto quiet_NaN () -> boost::decimal::decimal32_t { return boost::decimal::from_bits(boost::decimal::detail::d32_nan_mask); }
static constexpr auto signaling_NaN() -> boost::decimal::decimal32_t { return boost::decimal::from_bits(boost::decimal::detail::d32_snan_mask); }
static constexpr auto denorm_min () -> boost::decimal::decimal32_t { return {1, boost::decimal::detail::etiny}; }

};

#if !defined(__cpp_inline_variables) || __cpp_inline_variables < 201606L

template <bool b> constexpr bool numeric_limits_impl32<b>::is_specialized;
template <bool b> constexpr bool numeric_limits_impl32<b>::is_signed;
template <bool b> constexpr bool numeric_limits_impl32<b>::is_integer;
template <bool b> constexpr bool numeric_limits_impl32<b>::is_exact;
template <bool b> constexpr bool numeric_limits_impl32<b>::has_infinity;
template <bool b> constexpr bool numeric_limits_impl32<b>::has_quiet_NaN;
template <bool b> constexpr bool numeric_limits_impl32<b>::has_signaling_NaN;

// These members were deprecated in C++23
#if ((!defined(_MSC_VER) && (__cplusplus <= 202002L)) || (defined(_MSC_VER) && (_MSVC_LANG <= 202002L)))
template <bool b> constexpr std::float_denorm_style numeric_limits_impl32<b>::has_denorm;
template <bool b> constexpr bool numeric_limits_impl32<b>::has_denorm_loss;
#endif

template <bool b> constexpr std::float_round_style numeric_limits_impl32<b>::round_style;
template <bool b> constexpr bool numeric_limits_impl32<b>::is_iec559;
template <bool b> constexpr bool numeric_limits_impl32<b>::is_bounded;
template <bool b> constexpr bool numeric_limits_impl32<b>::is_modulo;
template <bool b> constexpr int numeric_limits_impl32<b>::digits;
template <bool b> constexpr int numeric_limits_impl32<b>::digits10;
template <bool b> constexpr int numeric_limits_impl32<b>::max_digits10;
template <bool b> constexpr int numeric_limits_impl32<b>::radix;
template <bool b> constexpr int numeric_limits_impl32<b>::min_exponent;
template <bool b> constexpr int numeric_limits_impl32<b>::min_exponent10;
template <bool b> constexpr int numeric_limits_impl32<b>::max_exponent;
template <bool b> constexpr int numeric_limits_impl32<b>::max_exponent10;
template <bool b> constexpr bool numeric_limits_impl32<b>::traps;
template <bool b> constexpr bool numeric_limits_impl32<b>::tinyness_before;

#endif // !defined(__cpp_inline_variables) || __cpp_inline_variables < 201606L

} // namespace detail

} // namespace decimal
} // namespace boost

namespace std {

#ifdef __clang__
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wmismatched-tags"
#endif

template <>
class numeric_limits<boost::decimal::decimal32_t> :
public boost::decimal::detail::numeric_limits_impl32<true> {};

#ifdef __clang__
# pragma clang diagnostic pop
#endif

} // Namespace std

#include <boost/decimal/charconv.hpp>
Expand Down
73 changes: 58 additions & 15 deletions include/boost/decimal/decimal64_t.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2192,22 +2192,12 @@ constexpr auto copysignd64(decimal64_t mag, const decimal64_t sgn) noexcept -> d
return mag;
}

} //namespace decimal
} //namespace boost

namespace std {
namespace detail {

template <>
#ifdef _MSC_VER
class numeric_limits<boost::decimal::decimal64_t>
#else
struct numeric_limits<boost::decimal::decimal64_t>
#endif
template <bool>
class numeric_limits_impl64
{

#ifdef _MSC_VER
public:
#endif
public:

static constexpr bool is_specialized = true;
static constexpr bool is_signed = true;
Expand Down Expand Up @@ -2235,7 +2225,7 @@ struct numeric_limits<boost::decimal::decimal64_t>
static constexpr int min_exponent10 = min_exponent;
static constexpr int max_exponent = 384;
static constexpr int max_exponent10 = max_exponent;
static constexpr bool traps = numeric_limits<std::uint64_t>::traps;
static constexpr bool traps = std::numeric_limits<std::uint64_t>::traps;
static constexpr bool tinyness_before = true;

// Member functions
Expand All @@ -2250,6 +2240,59 @@ struct numeric_limits<boost::decimal::decimal64_t>
static constexpr auto denorm_min () -> boost::decimal::decimal64_t { return {1, boost::decimal::detail::etiny_v<boost::decimal::decimal64_t>}; }
};

#if !defined(__cpp_inline_variables) || __cpp_inline_variables < 201606L

template <bool b> constexpr bool numeric_limits_impl64<b>::is_specialized;
template <bool b> constexpr bool numeric_limits_impl64<b>::is_signed;
template <bool b> constexpr bool numeric_limits_impl64<b>::is_integer;
template <bool b> constexpr bool numeric_limits_impl64<b>::is_exact;
template <bool b> constexpr bool numeric_limits_impl64<b>::has_infinity;
template <bool b> constexpr bool numeric_limits_impl64<b>::has_quiet_NaN;
template <bool b> constexpr bool numeric_limits_impl64<b>::has_signaling_NaN;

// These members were deprecated in C++23
#if ((!defined(_MSC_VER) && (__cplusplus <= 202002L)) || (defined(_MSC_VER) && (_MSVC_LANG <= 202002L)))
template <bool b> constexpr std::float_denorm_style numeric_limits_impl64<b>::has_denorm;
template <bool b> constexpr bool numeric_limits_impl64<b>::has_denorm_loss;
#endif

template <bool b> constexpr std::float_round_style numeric_limits_impl64<b>::round_style;
template <bool b> constexpr bool numeric_limits_impl64<b>::is_iec559;
template <bool b> constexpr bool numeric_limits_impl64<b>::is_bounded;
template <bool b> constexpr bool numeric_limits_impl64<b>::is_modulo;
template <bool b> constexpr int numeric_limits_impl64<b>::digits;
template <bool b> constexpr int numeric_limits_impl64<b>::digits10;
template <bool b> constexpr int numeric_limits_impl64<b>::max_digits10;
template <bool b> constexpr int numeric_limits_impl64<b>::radix;
template <bool b> constexpr int numeric_limits_impl64<b>::min_exponent;
template <bool b> constexpr int numeric_limits_impl64<b>::min_exponent10;
template <bool b> constexpr int numeric_limits_impl64<b>::max_exponent;
template <bool b> constexpr int numeric_limits_impl64<b>::max_exponent10;
template <bool b> constexpr bool numeric_limits_impl64<b>::traps;
template <bool b> constexpr bool numeric_limits_impl64<b>::tinyness_before;

#endif // !defined(__cpp_inline_variables) || __cpp_inline_variables < 201606L

} // namespace detail

} //namespace decimal
} //namespace boost

namespace std {

#ifdef __clang__
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wmismatched-tags"
#endif

template <>
class numeric_limits<boost::decimal::decimal64_t> :
public boost::decimal::detail::numeric_limits_impl64<true> {};

#ifdef __clang__
# pragma clang diagnostic pop
#endif

} // Namespace std

#include <boost/decimal/charconv.hpp>
Expand Down
73 changes: 58 additions & 15 deletions include/boost/decimal/decimal_fast128_t.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1577,22 +1577,12 @@ constexpr auto quantized128f(const decimal_fast128_t& lhs, const decimal_fast128
return {lhs.full_significand(), rhs.biased_exponent(), lhs.isneg()};
}

} // namespace decimal
} // namespace boost

namespace std {
namespace detail {

template<>
#ifdef _MSC_VER
class numeric_limits<boost::decimal::decimal_fast128_t>
#else
struct numeric_limits<boost::decimal::decimal_fast128_t>
#endif
template <bool>
class numeric_limits_impl128f
{

#ifdef _MSC_VER
public:
#endif
public:

static constexpr bool is_specialized = true;
static constexpr bool is_signed = true;
Expand Down Expand Up @@ -1620,7 +1610,7 @@ struct numeric_limits<boost::decimal::decimal_fast128_t>
static constexpr int min_exponent10 = min_exponent;
static constexpr int max_exponent = 6144;
static constexpr int max_exponent10 = max_exponent;
static constexpr bool traps = numeric_limits<std::uint64_t>::traps;
static constexpr bool traps = std::numeric_limits<std::uint64_t>::traps;
static constexpr bool tinyness_before = true;

// Member functions
Expand All @@ -1635,6 +1625,59 @@ struct numeric_limits<boost::decimal::decimal_fast128_t>
static constexpr auto denorm_min () -> boost::decimal::decimal_fast128_t { return min(); }
};

#if !defined(__cpp_inline_variables) || __cpp_inline_variables < 201606L

template <bool b> constexpr bool numeric_limits_impl128f<b>::is_specialized;
template <bool b> constexpr bool numeric_limits_impl128f<b>::is_signed;
template <bool b> constexpr bool numeric_limits_impl128f<b>::is_integer;
template <bool b> constexpr bool numeric_limits_impl128f<b>::is_exact;
template <bool b> constexpr bool numeric_limits_impl128f<b>::has_infinity;
template <bool b> constexpr bool numeric_limits_impl128f<b>::has_quiet_NaN;
template <bool b> constexpr bool numeric_limits_impl128f<b>::has_signaling_NaN;

// These members were deprecated in C++23
#if ((!defined(_MSC_VER) && (__cplusplus <= 202002L)) || (defined(_MSC_VER) && (_MSVC_LANG <= 202002L)))
template <bool b> constexpr std::float_denorm_style numeric_limits_impl128f<b>::has_denorm;
template <bool b> constexpr bool numeric_limits_impl128f<b>::has_denorm_loss;
#endif

template <bool b> constexpr std::float_round_style numeric_limits_impl128f<b>::round_style;
template <bool b> constexpr bool numeric_limits_impl128f<b>::is_iec559;
template <bool b> constexpr bool numeric_limits_impl128f<b>::is_bounded;
template <bool b> constexpr bool numeric_limits_impl128f<b>::is_modulo;
template <bool b> constexpr int numeric_limits_impl128f<b>::digits;
template <bool b> constexpr int numeric_limits_impl128f<b>::digits10;
template <bool b> constexpr int numeric_limits_impl128f<b>::max_digits10;
template <bool b> constexpr int numeric_limits_impl128f<b>::radix;
template <bool b> constexpr int numeric_limits_impl128f<b>::min_exponent;
template <bool b> constexpr int numeric_limits_impl128f<b>::min_exponent10;
template <bool b> constexpr int numeric_limits_impl128f<b>::max_exponent;
template <bool b> constexpr int numeric_limits_impl128f<b>::max_exponent10;
template <bool b> constexpr bool numeric_limits_impl128f<b>::traps;
template <bool b> constexpr bool numeric_limits_impl128f<b>::tinyness_before;

#endif // !defined(__cpp_inline_variables) || __cpp_inline_variables < 201606L

} // namespace detail

} // namespace decimal
} // namespace boost

namespace std {

#ifdef __clang__
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wmismatched-tags"
#endif

template <>
class numeric_limits<boost::decimal::decimal_fast128_t> :
public boost::decimal::detail::numeric_limits_impl128f<true> {};

#ifdef __clang__
# pragma clang diagnostic pop
#endif

} // namespace std

#include <boost/decimal/charconv.hpp>
Expand Down
Loading