# HG changeset patch # User Rik # Date 1340125501 25200 # Node ID e190f6da40f6939c7762252ac27a99361295dcad # Parent 1d83d1539b2b696388367ba15da6d4dc8a2e1b70 maint: Correct comments and use Octave spacing conventions for erfinv. lo-specfun.cc (do_erfinv): Correct comment about Halley's 3rd order method. Use space between function call and open parenthesis. diff -r 1d83d1539b2b -r e190f6da40f6 liboctave/lo-specfun.cc --- a/liboctave/lo-specfun.cc Mon Jun 18 19:54:03 2012 -0400 +++ b/liboctave/lo-specfun.cc Tue Jun 19 10:05:01 2012 -0700 @@ -3152,7 +3152,7 @@ // This algorithm is due to P. J. Acklam. // See http://home.online.no/~pjacklam/notes/invnorm/ // The rational approximation has relative accuracy 1.15e-9 in the whole region. -// For doubles, it is refined by a single step of Higham's 3rd order method. +// For doubles, it is refined by a single step of Halley's 3rd order method. // For single precision, the accuracy is already OK, so we skip it to get // faster evaluation. @@ -3175,7 +3175,7 @@ { 7.784695709041462e-03, 3.224671290700398e-01, 2.445134137142996e+00, 3.754408661907416e+00 }; - static const double spi2 = 8.862269254527579e-01; // sqrt(pi)/2. + static const double spi2 = 8.862269254527579e-01; // sqrt(pi)/2. static const double pbreak = 0.95150; double ax = fabs (x), y; @@ -3204,7 +3204,7 @@ if (refine) { // One iteration of Halley's method gives full precision. - double u = (erf(y) - x) * spi2 * exp (y*y); + double u = (erf (y) - x) * spi2 * exp (y*y); y -= u / (1 + y*u); }