summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rational.c27
1 files changed, 15 insertions, 12 deletions
@@ -2440,24 +2440,27 @@ parse_rat(const char *s, const char *const e, int strict, int raise)
if (nexp != ZERO) {
if (INT_NEGATIVE_P(nexp)) {
VALUE mul;
- if (!FIXNUM_P(nexp)) {
- overflow:
- return sign == '-' ? DBL2NUM(-HUGE_VAL) : DBL2NUM(HUGE_VAL);
}
- mul = f_expt10(LONG2NUM(-FIX2LONG(nexp)));
- if (RB_FLOAT_TYPE_P(mul)) goto overflow;
- num = rb_int_mul(num, mul);
}
else {
VALUE div;
- if (!FIXNUM_P(nexp)) {
- underflow:
- return sign == '-' ? DBL2NUM(-0.0) : DBL2NUM(+0.0);
}
- div = f_expt10(nexp);
- if (RB_FLOAT_TYPE_P(div)) goto underflow;
- den = rb_int_mul(den, div);
}
nurat_reduce(&num, &den);
}