Skip to content

Commit e76e953

Browse files
eriknyquistsys_maker
authored and
sys_maker
committed
stdlib_noniso.cpp: fix dtostrf() handling of integral portion
Checking only for > 10 here (rather than >= 10) means that numbers with a leading '10' in the integral portion generate incorrect strings.
1 parent 5203f82 commit e76e953

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

cores/arduino/stdlib_noniso.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ char *dtostrf(double number, signed char width, unsigned char prec, char *s)
221221

222222
// generate chars for each digit of the integral part
223223
i = before;
224-
while (integer > 10) {
224+
while (integer >= 10) {
225225
digit = integer % 10;
226226
out[(i--) - 1] = ASCII_ZERO + digit;
227227
integer /= 10;

0 commit comments

Comments
 (0)