mirror of
https://github.com/fastfloat/fast_float.git
synced 2025-12-06 16:56:57 +08:00
check for IEEE 754 compliance
This commit is contained in:
parent
f23ced2e4e
commit
2a6c2604b5
@ -1258,30 +1258,46 @@ fastfloat_really_inline constexpr uint64_t min_safe_u64(int base) {
|
|||||||
|
|
||||||
static_assert(std::is_same<equiv_uint_t<double>, uint64_t>::value,
|
static_assert(std::is_same<equiv_uint_t<double>, uint64_t>::value,
|
||||||
"equiv_uint should be uint64_t for double");
|
"equiv_uint should be uint64_t for double");
|
||||||
|
static_assert(std::numeric_limits<double>::is_iec559,
|
||||||
|
"double must fulfill the requirements of IEC 559 (IEEE 754)");
|
||||||
|
|
||||||
static_assert(std::is_same<equiv_uint_t<float>, uint32_t>::value,
|
static_assert(std::is_same<equiv_uint_t<float>, uint32_t>::value,
|
||||||
"equiv_uint should be uint32_t for float");
|
"equiv_uint should be uint32_t for float");
|
||||||
|
static_assert(std::numeric_limits<float>::is_iec559,
|
||||||
|
"float must fulfill the requirements of IEC 559 (IEEE 754)");
|
||||||
|
|
||||||
#ifdef __STDCPP_FLOAT64_T__
|
#ifdef __STDCPP_FLOAT64_T__
|
||||||
static_assert(std::is_same<equiv_uint_t<std::float64_t>, uint64_t>::value,
|
static_assert(std::is_same<equiv_uint_t<std::float64_t>, uint64_t>::value,
|
||||||
"equiv_uint should be uint64_t for std::float64_t");
|
"equiv_uint should be uint64_t for std::float64_t");
|
||||||
|
static_assert(
|
||||||
|
std::numeric_limits<std::float64_t>::is_iec559,
|
||||||
|
"std::float64_t must fulfill the requirements of IEC 559 (IEEE 754)");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __STDCPP_FLOAT32_T__
|
#ifdef __STDCPP_FLOAT32_T__
|
||||||
static_assert(std::is_same<equiv_uint_t<std::float32_t>, uint32_t>::value,
|
static_assert(std::is_same<equiv_uint_t<std::float32_t>, uint32_t>::value,
|
||||||
"equiv_uint should be uint32_t for std::float32_t");
|
"equiv_uint should be uint32_t for std::float32_t");
|
||||||
|
static_assert(
|
||||||
|
std::numeric_limits<std::float32_t>::is_iec559,
|
||||||
|
"std::float32_t must fulfill the requirements of IEC 559 (IEEE 754)");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __STDCPP_FLOAT16_T__
|
#ifdef __STDCPP_FLOAT16_T__
|
||||||
static_assert(
|
static_assert(
|
||||||
std::is_same<binary_format<std::float16_t>::equiv_uint, uint16_t>::value,
|
std::is_same<binary_format<std::float16_t>::equiv_uint, uint16_t>::value,
|
||||||
"equiv_uint should be uint16_t for std::float16_t");
|
"equiv_uint should be uint16_t for std::float16_t");
|
||||||
|
static_assert(
|
||||||
|
std::numeric_limits<std::float16_t>::is_iec559,
|
||||||
|
"std::float16_t must fulfill the requirements of IEC 559 (IEEE 754)");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __STDCPP_BFLOAT16_T__
|
#ifdef __STDCPP_BFLOAT16_T__
|
||||||
static_assert(
|
static_assert(
|
||||||
std::is_same<binary_format<std::bfloat16_t>::equiv_uint, uint16_t>::value,
|
std::is_same<binary_format<std::bfloat16_t>::equiv_uint, uint16_t>::value,
|
||||||
"equiv_uint should be uint16_t for std::bfloat16_t");
|
"equiv_uint should be uint16_t for std::bfloat16_t");
|
||||||
|
static_assert(
|
||||||
|
std::numeric_limits<std::bfloat16_t>::is_iec559,
|
||||||
|
"std::bfloat16_t must fulfill the requirements of IEC 559 (IEEE 754)");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
constexpr chars_format operator~(chars_format rhs) noexcept {
|
constexpr chars_format operator~(chars_format rhs) noexcept {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user