From a6a8d04b99b2171fc9bacddd2c3fdfe43a198a7e Mon Sep 17 00:00:00 2001 From: gambas Date: Fri, 10 Aug 2018 11:49:12 +0200 Subject: [PATCH] Format$ now prints the expected number of decimal digits when using exponential format. [INTERPRETER] * BUG: Format$ now prints the expected number of decimal digits when using exponential format. --- main/gbx/gbx_local.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/main/gbx/gbx_local.c b/main/gbx/gbx_local.c index 06e9da7b5..f3cea44f4 100644 --- a/main/gbx/gbx_local.c +++ b/main/gbx/gbx_local.c @@ -1015,7 +1015,12 @@ _FORMAT: { number_mant = frexp10(fabs(number), &number_exp); ndigit = after; - if (!exposant) ndigit += number_exp; + + if (!exposant) + ndigit += number_exp; + else + ndigit++; + ndigit = MinMax(ndigit, 0, MAX_FLOAT_DIGIT); //fprintf(stderr, "number_mant = %.24g number_exp = %d ndigit = %d\n", number_mant, number_exp, ndigit);