remove trailing zeros from float string representation

This commit is contained in:
Yukihiro "Matz" Matsumoto
2014-02-17 10:11:51 +09:00
parent a740b28b52
commit eacdcc13d8
+6
View File
@@ -181,6 +181,12 @@ mrb_flo_to_str(mrb_state *mrb, mrb_value flo)
*(c++) = '.';
}
}
if (c[-1] == '0') {
while (&s[0] < c && c[-1] == '0') {
c--;
}
c++;
}
if (e) {
*(c++) = 'e';