powered num may be infinite in float-string conversion

This commit is contained in:
Yukihiro "Matz" Matsumoto
2014-02-22 11:06:38 +09:00
parent 6b6c590fe3
commit ac936fc211
+8
View File
@@ -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 */