To: John Carter Cc: djgpp AT sun DOT soe DOT clarkson DOT edu Subject: Re: erf, and the *rand48 functions Date: Mon, 20 Mar 1995 10:15:30 EST From: David Goldschmidt >>>>> "John" == John Carter writes: >> The linker complains about these functions with an "unresolved >> externals" message. >> >> If they're unimplemented, can you tell me where I can get online >> sources for them? (My Abramowitz & Stegun is in storage... John> I couldn't find them either, except as headers in the .h file, so John> here is something I created/took from A&S... John> #include double erf( double x) { const double a1 = John> 0.3480242, a2=-0.0958798, a3=0.7478556, p=0.47047; double t; John> if( x < 0.0) return -erf( -x); t = 1.0 / ( 1.0 + p * x); return John> 1.0 - t * (a1 + t * (a2 + a3 * t)) * exp( -x * x); } John> Hope it helps... Numerical recipes has a very accurate approximation, which I think they call erfcc. It's only a few lines -- you can type it in from the book.