summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/numeric.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/numeric.c b/src/numeric.c
index 5526e6034..18dd1e5bf 100644
--- a/src/numeric.c
+++ b/src/numeric.c
@@ -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';