Module: wine Branch: master Commit: e495e25af75df8caa9afbfb070fe8feee327b674 URL: http://source.winehq.org/git/wine.git/?a=commit;h=e495e25af75df8caa9afbfb070...
Author: Piotr Caban piotr@codeweavers.com Date: Wed Jul 12 18:04:59 2017 +0200
msvcr120: Add fallback implementation of erf function.
Signed-off-by: Piotr Caban piotr@codeweavers.com Signed-off-by: Alexandre Julliard julliard@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 }