# efficient and accurate approximation of error function

I am looking for the numerical approximation of error function, which must be efficient and accurate. Thanks in advance $$\mathrm{erf}(z)=\frac2{\sqrt\pi}\int_0^z e^{-t^2} \,\mathrm dt$$

-
Wiki suggests an approximation en.wikipedia.org/wiki/… – user17762 Jun 3 '11 at 2:37
possible duplicate of Definite integral of Normal Distribution – user17762 Jun 3 '11 at 2:43
– cardinal Jun 3 '11 at 8:30
possible duplicate of How to accurately calculate erf(x) with a computer? – J. M. Jul 23 '11 at 15:26

## 2 Answers

"Efficient and accurate" is probably contradictory... Have you tried the one listed in http://en.wikipedia.org/wiki/Error_function#Approximation_with_elementary_functions ?

-
 yes, I have tried this. Its accuracy is up to 2 decimal places. Do we have more than this? – shaikh Jun 3 '11 at 2:40 @shaikh, C99 has an erf function, which should be quite accurate. – lhf Jun 3 '11 at 2:42 where can I find the derivation of C99 erf...? – shaikh Jun 3 '11 at 2:45 @shaikh, oh, you have to read the code. See for instance the cephes library. – lhf Jun 3 '11 at 2:48 @shaikh: Or boost's implementation – ziyuang Jun 3 '11 at 2:51
-
 I will try this. thx – shaikh Jun 3 '11 at 2:42