s_erf.c (268588) | s_erf.c (268593) |
---|---|
1/* @(#)s_erf.c 5.1 93/09/24 */ 2/* 3 * ==================================================== 4 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. 5 * 6 * Developed at SunPro, a Sun Microsystems, Inc. business. 7 * Permission to use, copy, modify, and distribute this 8 * software is freely granted, provided that this notice 9 * is preserved. 10 * ==================================================== 11 */ 12 13#include <sys/cdefs.h> | 1/* @(#)s_erf.c 5.1 93/09/24 */ 2/* 3 * ==================================================== 4 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. 5 * 6 * Developed at SunPro, a Sun Microsystems, Inc. business. 7 * Permission to use, copy, modify, and distribute this 8 * software is freely granted, provided that this notice 9 * is preserved. 10 * ==================================================== 11 */ 12 13#include <sys/cdefs.h> |
14__FBSDID("$FreeBSD: head/lib/msun/src/s_erf.c 268588 2014-07-13 15:45:45Z kargl $"); | 14__FBSDID("$FreeBSD: head/lib/msun/src/s_erf.c 268593 2014-07-13 17:05:03Z kargl $"); |
15 16/* double erf(double x) 17 * double erfc(double x) 18 * x 19 * 2 |\ 20 * erf(x) = --------- | exp(-t*t)dt 21 * sqrt(pi) \| 22 * 0 --- 214 unchanged lines hidden (view full) --- 237 S=one+s*(sb1+s*(sb2+s*(sb3+s*(sb4+s*(sb5+s*(sb6+s*sb7)))))); 238 } 239 z = x; 240 SET_LOW_WORD(z,0); 241 r = __ieee754_exp(-z*z-0.5625)*__ieee754_exp((z-x)*(z+x)+R/S); 242 if(hx>=0) return one-r/x; else return r/x-one; 243} 244 | 15 16/* double erf(double x) 17 * double erfc(double x) 18 * x 19 * 2 |\ 20 * erf(x) = --------- | exp(-t*t)dt 21 * sqrt(pi) \| 22 * 0 --- 214 unchanged lines hidden (view full) --- 237 S=one+s*(sb1+s*(sb2+s*(sb3+s*(sb4+s*(sb5+s*(sb6+s*sb7)))))); 238 } 239 z = x; 240 SET_LOW_WORD(z,0); 241 r = __ieee754_exp(-z*z-0.5625)*__ieee754_exp((z-x)*(z+x)+R/S); 242 if(hx>=0) return one-r/x; else return r/x-one; 243} 244 |
245#if (LDBL_MANT_DIG == 53) 246__weak_reference(erf, erfl); 247#endif 248 |
|
245double 246erfc(double x) 247{ 248 int32_t hx,ix; 249 double R,S,P,Q,s,y,z,r; 250 GET_HIGH_WORD(hx,x); 251 ix = hx&0x7fffffff; 252 if(ix>=0x7ff00000) { /* erfc(nan)=nan */ --- 41 unchanged lines hidden (view full) --- 294 z = x; 295 SET_LOW_WORD(z,0); 296 r = __ieee754_exp(-z*z-0.5625)*__ieee754_exp((z-x)*(z+x)+R/S); 297 if(hx>0) return r/x; else return two-r/x; 298 } else { 299 if(hx>0) return tiny*tiny; else return two-tiny; 300 } 301} | 249double 250erfc(double x) 251{ 252 int32_t hx,ix; 253 double R,S,P,Q,s,y,z,r; 254 GET_HIGH_WORD(hx,x); 255 ix = hx&0x7fffffff; 256 if(ix>=0x7ff00000) { /* erfc(nan)=nan */ --- 41 unchanged lines hidden (view full) --- 298 z = x; 299 SET_LOW_WORD(z,0); 300 r = __ieee754_exp(-z*z-0.5625)*__ieee754_exp((z-x)*(z+x)+R/S); 301 if(hx>0) return r/x; else return two-r/x; 302 } else { 303 if(hx>0) return tiny*tiny; else return two-tiny; 304 } 305} |
306 307#if (LDBL_MANT_DIG == 53) 308__weak_reference(erfc, erfcl); 309#endif |
|