Skip to content

Commit 9889a09

Browse files
committed
[dtostrf] Fix missing leading zeros in decimal part
Fix #427 Signed-off-by: Frederic Pillon <[email protected]>
1 parent 0048ffd commit 9889a09

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

cores/arduino/avr/dtostrf.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ char *dtostrf (double val, signed char width, unsigned char prec, char *sout) {
5959
remainder *= decade;
6060
dec_part = (int)remainder;
6161

62-
sprintf(sout, "%ld.%ld", int_part, dec_part);
62+
sprintf(sout, "%ld.%0*ld", int_part, prec, dec_part);
6363

6464
// Handle minimum field width of the output string
6565
// width is signed value, negative for left adjustment.

0 commit comments

Comments
 (0)