Piotr Caban : msvcr120: Add fallback implementation of erf function.

Alexandre Julliard julliard at winehq.org
Thu Jul 13 14:41:33 CDT 2017


Module: wine
Branch: master
Commit: e495e25af75df8caa9afbfb070fe8feee327b674
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=e495e25af75df8caa9afbfb070fe8feee327b674

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Wed Jul 12 18:04:59 2017 +0200

msvcr120: Add fallback implementation of erf function.

Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/msvcrt/math.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/dlls/msvcrt/math.c b/dlls/msvcrt/math.c
index c5228aa..04f09ac 100644
--- a/dlls/msvcrt/math.c
+++ b/dlls/msvcrt/math.c
@@ -2740,8 +2740,15 @@ double CDECL MSVCR120_erf(double x)
 #ifdef HAVE_ERF
     return erf(x);
 #else
-    FIXME( "not implemented\n" );
-    return 0.0;
+    /* Abramowitz and Stegun approximation, maximum error: 1.5*10^-7 */
+    double t, y;
+    int sign = signbit(x);
+
+    if (sign) x = -x;
+    t = 1 / (1 + 0.3275911 * x);
+    y = ((((1.061405429*t - 1.453152027)*t + 1.421413741)*t - 0.284496736)*t + 0.254829592)*t;
+    y = 1.0 - y*exp(-x*x);
+    return sign ? -y : y;
 #endif
 }
 




More information about the wine-cvs mailing list