diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2012-11-19 23:50:49 -0800 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2012-11-19 23:50:49 -0800 |
| commit | 8894cbe00f6202e2088000d2a3e7553fa7730bad (patch) | |
| tree | addcd268de098f5a77de7e18b4410bc7e3b1e098 /src/math.c | |
| parent | 4eee5ff50aa8bb6026fa40c4d5649a5e4b1437b9 (diff) | |
| parent | 358f0cb5d8cb822644e29bad520b44d63c0d5666 (diff) | |
| download | mruby-8894cbe00f6202e2088000d2a3e7553fa7730bad.tar.gz mruby-8894cbe00f6202e2088000d2a3e7553fa7730bad.zip | |
Merge pull request #563 from xxuejie/master
Fix manual implementations of erf and erfc functions
Diffstat (limited to 'src/math.c')
| -rw-r--r-- | src/math.c | 5 |
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) { |
