Skip to content
Browse files
Fixed float tolerance in tests when MRB_USE_FLOAT is set
  • Loading branch information
dabroz committed Nov 24, 2016
1 parent 0c924b9 commit a8b8abbd826b60b6313baef5635acd41e6d8f716
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
@@ -94,6 +94,12 @@ mrb_init_test_driver(mrb_state *mrb, mrb_bool verbose)
mrb_define_const(mrb, mrbtest, "FIXNUM_MIN", mrb_fixnum_value(MRB_INT_MIN));
mrb_define_const(mrb, mrbtest, "FIXNUM_BIT", mrb_fixnum_value(MRB_INT_BIT));

mrb_define_const(mrb, mrbtest, "FLOAT_TOLERANCE", mrb_float_value(mrb, 1e-6));
mrb_define_const(mrb, mrbtest, "FLOAT_TOLERANCE", mrb_float_value(mrb, 1e-12));

if (verbose) {
mrb_gv_set(mrb, mrb_intern_lit(mrb, "$mrbtest_verbose"), mrb_true_value());
@@ -232,7 +232,7 @@ def report()
# Performs fuzzy check for equality on methods returning floats
def check_float(a, b)
tolerance = 1e-12
tolerance = Mrbtest::FLOAT_TOLERANCE
a = a.to_f
b = b.to_f
if a.finite? and b.finite?

0 comments on commit a8b8abb

Please sign in to comment.