4747#include < __type_traits/invoke.h>
4848#include < __type_traits/is_assignable.h>
4949#include < __type_traits/is_enum.h>
50- #include < __type_traits/is_floating_point.h>
5150#include < __type_traits/is_integral.h>
5251#include < __type_traits/is_unsigned.h>
5352#include < __type_traits/make_unsigned.h>
@@ -350,9 +349,9 @@ _LIBCPP_HIDE_FROM_ABI constexpr auto __to_ordered_integral(_Integral __n) {
350349 return __n;
351350}
352351
353- // An overload for floating-point numbers
352+ // An overload for IEEE 754 floating-point numbers
354353
355- // From the IEEE 754 standard, we know that:
354+ // For the floats conforming to IEEE 754 (IEC 559) standard, we know that:
356355// 1. The bit representation of positive floats directly reflects their order:
357356// When comparing floats by magnitude, the number with the larger exponent is greater, and if the exponents are
358357// equal, the one with the larger mantissa is greater.
@@ -369,7 +368,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr auto __to_ordered_integral(_Integral __n) {
369368
370369// Thus, in final integral representation, we have reversed the order for negative floats and made all negative floats
371370// smaller than all positive numbers (by inverting the sign bit).
372- template <class _Floating , enable_if_t < is_floating_point <_Floating>::value , int > = 0 >
371+ template <class _Floating , enable_if_t < numeric_limits <_Floating>::is_iec559 , int > = 0 >
373372_LIBCPP_HIDE_FROM_ABI constexpr auto __to_ordered_integral (_Floating __f) {
374373 using __integral_type = __unsigned_representation_for_t <_Floating>;
375374 constexpr auto __bit_count = std::numeric_limits<__integral_type>::digits;
0 commit comments