diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2019-03-28 14:01:18 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2019-03-28 23:22:32 +0900 |
| commit | a26856f88313679c24ec7f9f098082e0949f9d44 (patch) | |
| tree | 16862a18ea1a0031b919d95411a8bcde7ca3f5b4 /mrbgems/mruby-math | |
| parent | 6023180848fb08a5f5582a532a59c084261a0258 (diff) | |
| download | mruby-a26856f88313679c24ec7f9f098082e0949f9d44.tar.gz mruby-a26856f88313679c24ec7f9f098082e0949f9d44.zip | |
Use `DBL_EPSILON` instead of `1E-12`; ref #4345
Diffstat (limited to 'mrbgems/mruby-math')
| -rw-r--r-- | mrbgems/mruby-math/src/math.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/mrbgems/mruby-math/src/math.c b/mrbgems/mruby-math/src/math.c index c29ba6808..39fed6cd3 100644 --- a/mrbgems/mruby-math/src/math.c +++ b/mrbgems/mruby-math/src/math.c @@ -23,8 +23,6 @@ domain_error(mrb_state *mrb, const char *func) #include <float.h> -#define MATH_TOLERANCE 1E-12 - double asinh(double x) { @@ -122,7 +120,7 @@ erf(double x) term *= xsqr/j; sum += term/(2*j+1); ++j; - } while (fabs(term/sum) > MATH_TOLERANCE); + } while (fabs(term/sum) > DBL_EPSILON); return two_sqrtpi*sum; } @@ -155,7 +153,7 @@ erfc(double x) n += 0.5; q1 = q2; q2 = b/d; - } while (fabs(q1-q2)/q2 > MATH_TOLERANCE); + } while (fabs(q1-q2)/q2 > DBL_EPSILON); return one_sqrtpi*exp(-x*x)*q2; } |
