-/* @(#)s_erf.c 5.1 93/09/24 */
/*
* ====================================================
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
* ====================================================
*/
-#if defined(LIBM_SCCS) && !defined(lint)
-static char rcsid[] = "$NetBSD: s_erf.c,v 1.8 1995/05/10 20:47:05 jtc Exp $";
-#endif
-
/* double erf(double x)
* double erfc(double x)
* x
* erfc/erf(NaN) is NaN
*/
-
#include "math.h"
#include "math_private.h"
-#ifdef __STDC__
static const double
-#else
-static double
-#endif
tiny = 1e-300,
half= 5.00000000000000000000e-01, /* 0x3FE00000, 0x00000000 */
one = 1.00000000000000000000e+00, /* 0x3FF00000, 0x00000000 */
sb6 = 4.74528541206955367215e+02, /* 0x407DA874, 0xE79FE763 */
sb7 = -2.24409524465858183362e+01; /* 0xC03670E2, 0x42712D62 */
-#ifdef __STDC__
- double erf(double x)
-#else
- double erf(x)
- double x;
-#endif
+double erf(double x)
{
int32_t hx,ix,i;
double R,S,P,Q,s,y,z,r;
r = __ieee754_exp(-z*z-0.5625)*__ieee754_exp((z-x)*(z+x)+R/S);
if(hx>=0) return one-r/x; else return r/x-one;
}
+libm_hidden_def(erf)
-#ifdef __STDC__
- double erfc(double x)
-#else
- double erfc(x)
- double x;
-#endif
+double erfc(double x)
{
int32_t hx,ix;
double R,S,P,Q,s,y,z,r;
if(hx>0) return tiny*tiny; else return two-tiny;
}
}
+libm_hidden_def(erfc)