mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Avoid a narrowing cast in flo_round under MRB_INT64.
This commit is contained in:
+2
-2
@@ -436,7 +436,7 @@ flo_round(mrb_state *mrb, mrb_value num)
|
||||
{
|
||||
double number, f;
|
||||
mrb_int ndigits = 0;
|
||||
int i;
|
||||
mrb_int i;
|
||||
|
||||
mrb_get_args(mrb, "|i", &ndigits);
|
||||
number = mrb_float(num);
|
||||
@@ -451,7 +451,7 @@ flo_round(mrb_state *mrb, mrb_value num)
|
||||
}
|
||||
|
||||
f = 1.0;
|
||||
i = abs(ndigits);
|
||||
i = ndigits >= 0 ? ndigits : -ndigits;
|
||||
while (--i >= 0)
|
||||
f = f*10.0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user