msvcr120: Add fallback implementation of erf function.

Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Piotr Caban 2017-07-12 18:04:59 +02:00 committed by Alexandre Julliard
parent ddff85a361
commit e495e25af7
1 changed files with 9 additions and 2 deletions

View File

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