Calculating the error function by using the incomplete gamma function requires considerable time. If performance is an issue you may consider to use a Chebyshev approximation which is accurate to approx. 10-7. The function ErfApprox returns the approximated error function.
Hint:
The complementary error function (often denoted as erfc) can be easily calculated from Erf: erfc(x) = 1-Erf(x).