Commit ae6a7e5a authored by Yukihiro Matz Matsumoto's avatar Yukihiro Matz Matsumoto

Merge branch 'master' of github.com:mruby/mruby

parents 76f0e755 8894cbe0
...@@ -1400,6 +1400,7 @@ mrb_init_class(mrb_state *mrb) ...@@ -1400,6 +1400,7 @@ mrb_init_class(mrb_state *mrb)
make_metaclass(mrb, cls); make_metaclass(mrb, cls);
/* name basic classes */ /* name basic classes */
mrb_define_const(mrb, bob, "BasicObject", mrb_obj_value(bob));
mrb_define_const(mrb, obj, "BasicObject", mrb_obj_value(bob)); mrb_define_const(mrb, obj, "BasicObject", mrb_obj_value(bob));
mrb_define_const(mrb, obj, "Object", mrb_obj_value(obj)); mrb_define_const(mrb, obj, "Object", mrb_obj_value(obj));
mrb_define_const(mrb, obj, "Module", mrb_obj_value(mod)); mrb_define_const(mrb, obj, "Module", mrb_obj_value(mod));
......
...@@ -51,7 +51,7 @@ erf(double x) ...@@ -51,7 +51,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) > MATH_TOLERANCE);
return two_sqrtpi*sum; return two_sqrtpi*sum;
} }
...@@ -64,7 +64,8 @@ erfc(double x) ...@@ -64,7 +64,8 @@ erfc(double x)
double b = x; double b = x;
double c = x; double c = x;
double d = x*x+0.5; double d = x*x+0.5;
double q1, q2; double q1;
double q2 = b/d;
double n = 1.0; double n = 1.0;
double t; double t;
if (fabs(x) < 2.2) { if (fabs(x) < 2.2) {
......
...@@ -113,5 +113,13 @@ if Object.const_defined?(:Math) ...@@ -113,5 +113,13 @@ if Object.const_defined?(:Math)
assert('Math.erfc 1') do assert('Math.erfc 1') do
check_float(Math.erfc(1), 0.157299207050285) check_float(Math.erfc(1), 0.157299207050285)
end end
assert('Math.erf -1') do
check_float(Math.erf(-1), -0.8427007929497148)
end
assert('Math.erfc -1') do
check_float(Math.erfc(-1), 1.8427007929497148)
end
end end
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