Skip to content

Commit

Permalink
[libc] Prevent constant propagation for atanf(+-Inf) in gcc. (#85733)
Browse files Browse the repository at this point in the history
  • Loading branch information
lntue committed Mar 19, 2024
1 parent d1e2305 commit a1fb514
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions libc/src/math/generic/atanf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@ LLVM_LIBC_FUNCTION(float, atanf, (float x)) {
double const_term = 0.0;
if (LIBC_UNLIKELY(x_abs >= 0x4180'0000)) {
// atan(+-Inf) = +-pi/2.
if (x_bits.is_inf())
return static_cast<float>(SIGNED_PI_OVER_2[sign.is_neg()]);
if (x_bits.is_inf()) {
volatile double sign_pi_over_2 = SIGNED_PI_OVER_2[sign.is_neg()];
return static_cast<float>(sign_pi_over_2);
}
if (x_bits.is_nan())
return x;
// x >= 16
Expand Down

0 comments on commit a1fb514

Please sign in to comment.