summaryrefslogtreecommitdiffhomepage
path: root/src/numeric.c
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2021-04-24 10:23:40 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2021-04-24 10:23:40 +0900
commit90a59efbec5b3f80ac94ca42de1939e25b290314 (patch)
treeb8c8ee73287b7d5a72241614def6595ce7b00b08 /src/numeric.c
parent39dc7b79014413f4f45f30fc977366b58814ab02 (diff)
downloadmruby-90a59efbec5b3f80ac94ca42de1939e25b290314.tar.gz
mruby-90a59efbec5b3f80ac94ca42de1939e25b290314.zip
numeric.c: fix errors from `MRB_NO_FLOAT`; close #5421
Diffstat (limited to 'src/numeric.c')
-rw-r--r--src/numeric.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/numeric.c b/src/numeric.c
index dfd5e14eb..e3e2fcfe9 100644
--- a/src/numeric.c
+++ b/src/numeric.c
@@ -76,12 +76,13 @@ int_zerodiv(mrb_state *mrb)
static mrb_value
int_pow(mrb_state *mrb, mrb_value x)
{
- mrb_value y = mrb_get_arg1(mrb);
mrb_int base = mrb_integer(x);
mrb_int result = 1;
mrb_int exp;
#ifndef MRB_NO_FLOAT
+ mrb_value y = mrb_get_arg1(mrb);
+
if (mrb_float_p(y)) {
return mrb_float_value(mrb, pow((double)base, mrb_float(y)));
}
@@ -136,7 +137,9 @@ mrb_div_int(mrb_state *mrb, mrb_int x, mrb_int y)
return 0;
}
+#ifndef MRB_NO_FLOAT
mrb_float mrb_div_flo(mrb_float x, mrb_float y);
+#endif
/* 15.2.8.3.4 */
/* 15.2.9.3.4 */
@@ -1607,12 +1610,12 @@ cmpnum(mrb_state *mrb, mrb_value v1, mrb_value v2)
case MRB_TT_FLOAT:
y = mrb_float(v2);
break;
-#endif
#ifdef MRB_USE_RATIONAL
case MRB_TT_RATIONAL:
y = mrb_to_flo(mrb, v2);
break;
#endif
+#endif
default:
return -2;
}