msvcrt: Fix Pi constants while computing acosf.

Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Piotr Caban 2022-01-19 16:20:12 +01:00 committed by Alexandre Julliard
parent 64c6deda5d
commit 80eec636ee
1 changed files with 3 additions and 2 deletions

View File

@ -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;