From a8520fe5953c453cf773e0c4a41ead6cbcb0234b Mon Sep 17 00:00:00 2001 From: "Sunrin SHIMURA (keen)" <3han5chou7@gmail.com> Date: Mon, 11 May 2015 16:26:55 +0900 Subject: [PATCH] number->string: remove trailing 0s --- extlib/benz/number.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/extlib/benz/number.c b/extlib/benz/number.c index 98ad0ff2..c3ec4dcf 100644 --- a/extlib/benz/number.c +++ b/extlib/benz/number.c @@ -549,7 +549,12 @@ pic_number_number_to_string(pic_state *pic) buf = pic_malloc(pic, s); + snprintf(buf, s, "%f", f); + + while(buf[s - 2] == '0') + s -= 1; + } str = pic_make_str(pic, buf, s - 1);