Commit d6865a9c authored by Simon Génier's avatar Simon Génier

Avoid a narrowing cast in flo_round under MRB_INT64.

parent 1c2fc94c
...@@ -436,7 +436,7 @@ flo_round(mrb_state *mrb, mrb_value num) ...@@ -436,7 +436,7 @@ flo_round(mrb_state *mrb, mrb_value num)
{ {
double number, f; double number, f;
mrb_int ndigits = 0; mrb_int ndigits = 0;
int i; mrb_int i;
mrb_get_args(mrb, "|i", &ndigits); mrb_get_args(mrb, "|i", &ndigits);
number = mrb_float(num); number = mrb_float(num);
...@@ -451,7 +451,7 @@ flo_round(mrb_state *mrb, mrb_value num) ...@@ -451,7 +451,7 @@ flo_round(mrb_state *mrb, mrb_value num)
} }
f = 1.0; f = 1.0;
i = abs(ndigits); i = ndigits >= 0 ? ndigits : -ndigits;
while (--i >= 0) while (--i >= 0)
f = f*10.0; f = f*10.0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment