summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorXuejie Xiao <[email protected]>2012-11-19 15:13:18 -0500
committerXuejie Xiao <[email protected]>2012-11-19 15:13:18 -0500
commitf7dd27a92827af91aa52c78bfbf96d5f7e73c4bd (patch)
tree9fb33b27e50d076860a5db72331034ccf0d7bed7 /src
parent1b2257c8ff212d1069b00e11a6b91672c9636ecb (diff)
downloadmruby-f7dd27a92827af91aa52c78bfbf96d5f7e73c4bd.tar.gz
mruby-f7dd27a92827af91aa52c78bfbf96d5f7e73c4bd.zip
Fix provided implementation of erf and erfc functions.
Diffstat (limited to 'src')
-rw-r--r--src/math.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/math.c b/src/math.c
index 9aae87acd..3e4550946 100644
--- a/src/math.c
+++ b/src/math.c
@@ -51,7 +51,7 @@ erf(double x)
term *= xsqr/j;
sum += term/(2*j+1);
++j;
- } while (fabs(term)/sum > MATH_TOLERANCE);
+ } while (fabs(term/sum) > MATH_TOLERANCE);
return two_sqrtpi*sum;
}
@@ -64,7 +64,8 @@ erfc(double x)
double b = x;
double c = x;
double d = x*x+0.5;
- double q1, q2;
+ double q1;
+ double q2 = b/d;
double n = 1.0;
double t;
if (fabs(x) < 2.2) {