Module: wine Branch: master Commit: 80eec636ee64e7f59d1b701a9b9e3011343a4677 URL: https://source.winehq.org/git/wine.git/?a=commit;h=80eec636ee64e7f59d1b701a9...
Author: Piotr Caban piotr@codeweavers.com Date: Wed Jan 19 16:20:12 2022 +0100
msvcrt: Fix Pi constants while computing acosf.
Signed-off-by: Piotr Caban piotr@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/msvcrt/math.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/dlls/msvcrt/math.c b/dlls/msvcrt/math.c index 14afad5fb45..9bb3e26570f 100644 --- a/dlls/msvcrt/math.c +++ b/dlls/msvcrt/math.c @@ -798,6 +798,7 @@ static float asinf_R(float z) float CDECL acosf( float x ) { static const double pio2_lo = 6.12323399573676603587e-17; + static const double pio2_hi = 1.57079632679489655800e+00;
float z, w, s, c, df; unsigned int hx, ix; @@ -818,13 +819,13 @@ float CDECL acosf( float x ) if (ix < 0x3f000000) { if (ix <= 0x32800000) /* |x| < 2**-26 */ return M_PI_2; - return M_PI_2 - (x - (pio2_lo - x * asinf_R(x * x))); + return pio2_hi - (x - (pio2_lo - x * asinf_R(x * x))); } /* x < -0.5 */ if (hx >> 31) { z = (1 + x) * 0.5f; s = sqrtf(z); - return M_PI - 2 * (s + ((double)s * asinf_R(z))); + return 2*(pio2_hi - (s + (asinf_R(z) * s - pio2_lo))); } /* x > 0.5 */ z = (1 - x) * 0.5f;