msvcrt: Match native cosf results in -Pi/4 - Pi/4 range.

Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Piotr Caban 2021-06-21 16:37:44 +02:00 committed by Alexandre Julliard
parent ee7b5ebc3a
commit 9008cd2f24

View file

@ -680,16 +680,17 @@ static float __sindf(double x)
/* Copied from musl: src/math/__cosdf.c */
static float __cosdf(double x)
{
static const double C0 = -0x1ffffffd0c5e81.0p-54,
C1 = 0x155553e1053a42.0p-57,
C2 = -0x16c087e80f1e27.0p-62,
C3 = 0x199342e0ee5069.0p-68;
double r, w, z;
static const double C0 = -0x1.0000000000000p-1,
C1 = 0x1.5555555555555p-5,
C2 = -0x1.6c16c16c16c17p-10,
C3 = 0x1.a01a01a01a01ap-16,
C4 = -0x1.27e4fb7789f5cp-22;
double z;
z = x * x;
w = z * z;
r = C2 + z * C3;
return ((1.0 + z * C0) + w * C1) + (w * z) * r;
if (x > -7.8163146972656250e-03 && x < 7.8163146972656250e-03)
return 1 + C0 * z;
return 1.0 + z * (C0 + z * (C1 + z * (C2 + z * (C3 + z * C4))));
}
static const UINT64 exp2f_T[] = {