From 856b8d961015d67eb7b4958eb974bbfabbc1066a Mon Sep 17 00:00:00 2001 From: KOBAYASHI Shuji Date: Thu, 10 Jan 2019 23:22:23 +0900 Subject: Remove duplicate code in numeric.c --- src/numeric.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'src/numeric.c') diff --git a/src/numeric.c b/src/numeric.c index 311bb4a38..089cc744d 100644 --- a/src/numeric.c +++ b/src/numeric.c @@ -1150,7 +1150,7 @@ fix_to_f(mrb_state *mrb, mrb_value num) * (in particular infinite or NaN) * to numerical classes which don't support them. * - * Float::INFINITY.to_r + * Float::INFINITY.to_i * * raises the exception: * @@ -1169,12 +1169,7 @@ mrb_flo_to_fixnum(mrb_state *mrb, mrb_value x) else { mrb_float d = mrb_float(x); - if (isinf(d)) { - mrb_raise(mrb, E_FLOATDOMAIN_ERROR, d < 0 ? "-Infinity" : "Infinity"); - } - if (isnan(d)) { - mrb_raise(mrb, E_FLOATDOMAIN_ERROR, "NaN"); - } + mrb_check_num_exact(mrb, d); if (FIXABLE_FLOAT(d)) { z = (mrb_int)d; } -- cgit v1.2.3