Skip to content

Commit

Permalink
dtostrf fix for remainder leading zeros
Browse files Browse the repository at this point in the history
Fix remainder to display leading zeros
  • Loading branch information
Makuna committed May 14, 2015
1 parent 8b1caeb commit f968805
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,10 @@ char * dtostrf(double number, signed char width, unsigned char prec, char *s) {
++out;
}

while(prec-- > 0) {
for (unsigned char decShift = prec; decShift > 0; decShift--) {
remainder *= 10.0;
}
sprintf(out, "%d", (int) remainder);
sprintf(out, "%0*d", prec, (int)remainder);

return s;
}
Expand Down

0 comments on commit f968805

Please sign in to comment.