Skip to content

Commit fd98fd6

Browse files
lemiretoughengineer
authored andcommitted
specialize for std::float32_t and std::float64_t explicitly
credit: @lemire
1 parent 197c0ff commit fd98fd6

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

include/fast_float/float_common.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1170,6 +1170,9 @@ static_assert(std::is_same<equiv_uint_t<std::float64_t>, uint64_t>::value,
11701170
static_assert(
11711171
std::numeric_limits<std::float64_t>::is_iec559,
11721172
"std::float64_t must fulfill the requirements of IEC 559 (IEEE 754)");
1173+
1174+
template <>
1175+
struct binary_format<std::float64_t> : public binary_format<double> {};
11731176
#endif // __STDCPP_FLOAT64_T__
11741177

11751178
#ifdef __STDCPP_FLOAT32_T__
@@ -1178,6 +1181,9 @@ static_assert(std::is_same<equiv_uint_t<std::float32_t>, uint32_t>::value,
11781181
static_assert(
11791182
std::numeric_limits<std::float32_t>::is_iec559,
11801183
"std::float32_t must fulfill the requirements of IEC 559 (IEEE 754)");
1184+
1185+
template <>
1186+
struct binary_format<std::float32_t> : public binary_format<float> {};
11811187
#endif // __STDCPP_FLOAT32_T__
11821188

11831189
#ifdef __STDCPP_FLOAT16_T__
@@ -1249,7 +1255,6 @@ constexpr chars_format adjust_for_feature_macros(chars_format fmt) {
12491255
;
12501256
}
12511257
} // namespace detail
1252-
12531258
} // namespace fast_float
12541259

12551260
#endif

0 commit comments

Comments
 (0)