Piotr Caban : msvcrt: Match native cosf results in -Pi/4 - Pi/4 range.
Alexandre Julliard
julliard at winehq.org
Mon Jun 21 16:14:56 CDT 2021
Module: wine
Branch: master
Commit: 9008cd2f2437650ad41ce8a8924ed1828ca21889
URL: https://source.winehq.org/git/wine.git/?a=commit;h=9008cd2f2437650ad41ce8a8924ed1828ca21889
Author: Piotr Caban <piotr at codeweavers.com>
Date: Mon Jun 21 16:37:44 2021 +0200
msvcrt: Match native cosf results in -Pi/4 - Pi/4 range.
Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/msvcrt/math.c | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/dlls/msvcrt/math.c b/dlls/msvcrt/math.c
index 949bf12d66b..ecf5fdce4d8 100644
--- a/dlls/msvcrt/math.c
+++ b/dlls/msvcrt/math.c
@@ -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[] = {
More information about the wine-cvs
mailing list