diff --git a/src/numeric.c b/src/numeric.c index 60250ea32..e55ee591b 100644 --- a/src/numeric.c +++ b/src/numeric.c @@ -85,7 +85,11 @@ mrb_int_pow(mrb_state *mrb, mrb_value x) for (;;) { if (exp & 1) { if (mrb_int_mul_overflow(result, base, &result)) { +#ifdef MRB_USE_BIGINT + return mrb_bint_pow(mrb, mrb_bint_new_int(mrb, mrb_integer(x)), y); +#else mrb_int_overflow(mrb, "power"); +#endif } } exp >>= 1;