Skip to content

Commit

Permalink
Suppress -Wfloat-equal
Browse files Browse the repository at this point in the history
  • Loading branch information
vitaut committed Apr 1, 2022
1 parent 288c3b9 commit ef54f9a
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions include/fmt/format.h
Original file line number Diff line number Diff line change
Expand Up @@ -2293,21 +2293,21 @@ FMT_CONSTEXPR20 auto write_float(OutputIt out, const DecimalFP& fp,
}
}

template <typename T> constexpr bool isnan(T value) {
return !(value >= value); // std::isnan doesn't support __float128.
}

template <typename T, FMT_ENABLE_IF(std::is_floating_point<T>::value &&
!is_float128<T>::value)>
FMT_CONSTEXPR20 bool isfinite(T value) {
if (is_constant_evaluated()) return value - value == 0;
if (is_constant_evaluated()) return !isnan(value - value);
return std::isfinite(value);
}
template <typename T, FMT_ENABLE_IF(is_float128<T>::value)>
constexpr bool isfinite(T value) {
return value - value == 0; // std::isfinite doesn't support __float128.
}

template <typename T> constexpr bool isnan(T value) {
return value != value; // std::isnan doesn't support __float128.
}

template <typename T, FMT_ENABLE_IF(is_floating_point<T>::value)>
FMT_INLINE FMT_CONSTEXPR bool signbit(T value) {
if (is_constant_evaluated()) {
Expand Down

0 comments on commit ef54f9a

Please sign in to comment.