From 472280389100a8a2c1cbcfa3fde6f9db2946b302 Mon Sep 17 00:00:00 2001 From: Epagris Date: Fri, 10 Jan 2025 20:50:56 +0100 Subject: [PATCH] - the recurring floating point bug has been tackled again --- embformat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/embformat.c b/embformat.c index 821ced0..11c61f8 100644 --- a/embformat.c +++ b/embformat.c @@ -312,7 +312,7 @@ static int pfn_double(va_list *va, FmtWord *fmt, char *outbuf, size_t free_space uint64_t frac_part = round_to_base((uint64_t)frac_extended, 10) / 10; // if rounding results a new integer digit - uint32_t additional_integer = frac_part / 10; + uint32_t additional_integer = frac_part / power(10, fmt->precision); frac_part -= additional_integer * 10; int_part += additional_integer;