Skip to content

Commit

Permalink
Fixes atan2_ps(0, 0)
Browse files Browse the repository at this point in the history
  • Loading branch information
crsib committed Oct 4, 2023
1 parent 7283abc commit b4d400f
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ inline __m128 atan2_ps(__m128 y, __m128 x)
pio2_result = _mm_xor_ps(pio2_result, pio2_mask_sign);
pio2_result = _mm_and_ps(pio2_mask, pio2_result);

__m128 pi_mask = _mm_and_ps(y_eq_0, x_le_0);
__m128 pi_mask = _mm_and_ps(y_eq_0, x_lt_0);
__m128 pi = _mm_set1_ps(cephes_PIF);
__m128 pi_result = _mm_and_ps(pi_mask, pi);

Expand All @@ -170,7 +170,7 @@ inline __m128 atan2_ps(__m128 y, __m128 x)
/* select between zero_result, pio2_result and atan_result */

__m128 result = _mm_andnot_ps(zero_mask, pio2_result);
atan_result = _mm_andnot_ps(pio2_mask, atan_result);
atan_result = _mm_andnot_ps(zero_mask, atan_result);
atan_result = _mm_andnot_ps(pio2_mask, atan_result);
result = _mm_or_ps(result, atan_result);
result = _mm_or_ps(result, pi_result);
Expand Down

0 comments on commit b4d400f

Please sign in to comment.