mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
powered num may be infinite in float-string conversion
This commit is contained in:
@@ -148,6 +148,14 @@ mrb_flo_to_str(mrb_state *mrb, mrb_value flo)
|
||||
/* exponent representation */
|
||||
e = TRUE;
|
||||
n = n / pow(10.0, exp);
|
||||
if (isinf(n)) {
|
||||
if (s[0] == '-') {
|
||||
return mrb_str_new_lit(mrb, "-0.0");
|
||||
}
|
||||
else {
|
||||
return mrb_str_new_lit(mrb, "0.0");
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* un-exponent (normal) representation */
|
||||
|
||||
Reference in New Issue
Block a user