summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--include/mruby.h7
-rw-r--r--mrbgems/mruby-range-ext/src/range.c2
2 files changed, 8 insertions, 1 deletions
diff --git a/include/mruby.h b/include/mruby.h
index d40dce6d9..bc6800e29 100644
--- a/include/mruby.h
+++ b/include/mruby.h
@@ -64,6 +64,13 @@
#endif
#include "mrbconf.h"
+
+#ifdef MRB_USE_FLOAT
+#define MRB_FLOAT_EPSILON FLT_EPSILON
+#else
+#define MRB_FLOAT_EPSILON DBL_EPSILON
+#endif
+
#include "mruby/common.h"
#include <mruby/value.h>
#include <mruby/gc.h>
diff --git a/mrbgems/mruby-range-ext/src/range.c b/mrbgems/mruby-range-ext/src/range.c
index 32222a594..ccb5a9e45 100644
--- a/mrbgems/mruby-range-ext/src/range.c
+++ b/mrbgems/mruby-range-ext/src/range.c
@@ -140,7 +140,7 @@ mrb_range_size(mrb_state *mrb, mrb_value range)
}
if (num_p) {
mrb_float n = end_f - beg_f;
- mrb_float err = (fabs(beg_f) + fabs(end_f) + fabs(end_f-beg_f)) * DBL_EPSILON;
+ mrb_float err = (fabs(beg_f) + fabs(end_f) + fabs(end_f-beg_f)) * MRB_FLOAT_EPSILON;
if (err>0.5) err=0.5;
if (excl) {