mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Use Mrbtest::FLOAT_TOLERANCE instead of Math::TORELANCE; ref #4345
This commit is contained in:
@@ -741,12 +741,6 @@ mrb_mruby_math_gem_init(mrb_state* mrb)
|
||||
mrb_define_const(mrb, mrb_math, "E", mrb_float_value(mrb, exp(1.0)));
|
||||
#endif
|
||||
|
||||
#ifdef MRB_USE_FLOAT
|
||||
mrb_define_const(mrb, mrb_math, "TOLERANCE", mrb_float_value(mrb, 1e-5));
|
||||
#else
|
||||
mrb_define_const(mrb, mrb_math, "TOLERANCE", mrb_float_value(mrb, 1e-12));
|
||||
#endif
|
||||
|
||||
mrb_define_module_function(mrb, mrb_math, "sin", math_sin, MRB_ARGS_REQ(1));
|
||||
mrb_define_module_function(mrb, mrb_math, "cos", math_cos, MRB_ARGS_REQ(1));
|
||||
mrb_define_module_function(mrb, mrb_math, "tan", math_tan, MRB_ARGS_REQ(1));
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
|
||||
##
|
||||
# Performs fuzzy check for equality on methods returning floats
|
||||
# on the basis of the Math::TOLERANCE constant.
|
||||
# on the basis of the Mrbtest::FLOAT_TOLERANCE constant.
|
||||
def check_float(a, b)
|
||||
tolerance = Math::TOLERANCE
|
||||
tolerance = Mrbtest::FLOAT_TOLERANCE
|
||||
a = a.to_f
|
||||
b = b.to_f
|
||||
if a.finite? and b.finite?
|
||||
|
||||
Reference in New Issue
Block a user