Use `DBL_EPSILON` instead of `1E-12`; ref #4345

parent 60231808
...@@ -23,8 +23,6 @@ domain_error(mrb_state *mrb, const char *func) ...@@ -23,8 +23,6 @@ domain_error(mrb_state *mrb, const char *func)
#include <float.h> #include <float.h>
#define MATH_TOLERANCE 1E-12
double double
asinh(double x) asinh(double x)
{ {
...@@ -122,7 +120,7 @@ erf(double x) ...@@ -122,7 +120,7 @@ erf(double x)
term *= xsqr/j; term *= xsqr/j;
sum += term/(2*j+1); sum += term/(2*j+1);
++j; ++j;
} while (fabs(term/sum) > MATH_TOLERANCE); } while (fabs(term/sum) > DBL_EPSILON);
return two_sqrtpi*sum; return two_sqrtpi*sum;
} }
...@@ -155,7 +153,7 @@ erfc(double x) ...@@ -155,7 +153,7 @@ erfc(double x)
n += 0.5; n += 0.5;
q1 = q2; q1 = q2;
q2 = b/d; q2 = b/d;
} while (fabs(q1-q2)/q2 > MATH_TOLERANCE); } while (fabs(q1-q2)/q2 > DBL_EPSILON);
return one_sqrtpi*exp(-x*x)*q2; return one_sqrtpi*exp(-x*x)*q2;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment