mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
fdigit may be negative due to error if mrb_float is 32bit (e.g. 10**36 on 32bit arch); ref #1713 #1714
This commit is contained in:
@@ -159,6 +159,8 @@ mrb_flo_to_str(mrb_state *mrb, mrb_value flo, int max_digit)
|
||||
while (max_digit >= 0) {
|
||||
mrb_float weight = pow(10.0, m);
|
||||
mrb_float fdigit = n / weight;
|
||||
|
||||
if (fdigit < 0) fdigit = n = 0;
|
||||
if (m < -1 && fdigit < FLT_EPSILON) {
|
||||
if (e || exp > 0 || m <= -abs(exp)) {
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user