powered num may be infinite in float-string conversion

parent 6b6c590f
......@@ -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 */
......
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