	  
	  real function erf(x)
	  ! # MS Fortran
	  ! Error function from Numerical Recipes.
	  ! erf(x) = 1 - erfc(x)

	  implicit none

      real dumerfc, x
      real t, z


      z = abs(x)
      t = 1.0 / ( 1.0 + 0.5 * z )

      dumerfc =       t * exp(-z * z - 1.26551223 + t *	    &
	         ( 1.00002368 + t * ( 0.37409196 + t *		&
             ( 0.09678418 + t * (-0.18628806 + t *		&
			 ( 0.27886807 + t * (-1.13520398 + t *		&
             ( 1.48851587 + t * (-0.82215223 + t * 0.17087277 )))))))))

      if ( x.lt.0.0 ) dumerfc = 2.0 - dumerfc
     
	  erf = 1.0 - dumerfc

	  end function erf
     

