Skip to content

Commit 7d0656e

Browse files
committed
Omit hypot float16 check when targets do not have float16.
1 parent e718582 commit 7d0656e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

libc/src/__support/FPUtil/Hypot.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,15 +135,16 @@ LIBC_INLINE T hypot(T x, T y) {
135135
uint16_t b_exp = b_bits.get_biased_exponent();
136136

137137
if ((a_exp - b_exp >= FPBits_t::FRACTION_LEN + 2) || (x == 0) || (y == 0)) {
138+
#ifdef LIBC_TYPES_HAS_FLOAT16
138139
if constexpr (cpp::is_same_v<T, float16>) {
139140
// Compiler runtime for basic operations of float16 might not be correctly
140141
// rounded for all rounding modes.
141142
float af = fputil::cast<float>(x_abs.get_val());
142143
float bf = fputil::cast<float>(y_abs.get_val());
143144
return fputil::cast<float16>(af + bf);
144-
} else {
145+
} else
146+
#endif // LIBC_TYPES_HAS_FLOAT16
145147
return x_abs.get_val() + y_abs.get_val();
146-
}
147148
}
148149

149150
uint64_t out_exp = a_exp;

0 commit comments

Comments
 (0)