Skip to content

Commit

Permalink
dtostrf_p doesn't handle advertised range (#2879)
Browse files Browse the repository at this point in the history
Code indicates range of +/- 4294967040.0 but that isn't achievable using `ltoa` (signed) call.
  • Loading branch information
mikee47 authored Aug 31, 2024
1 parent 3378a0c commit 4fff8a8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Sming/System/stringconversion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ char *dtostrf_p(double floatVar, int minStringWidthIncDecimalPoint, int numDigit
int_part = (unsigned long) floatVar;

//print the int part into num
char* s = ltoa(int_part, buf, 10);
char* s = ultoa(int_part, buf, 10);

//adjust end pointer
buf += strlen(s); //go to end of string
Expand All @@ -171,7 +171,7 @@ char *dtostrf_p(double floatVar, int minStringWidthIncDecimalPoint, int numDigit
*buf++ = '.'; // print the decimal point

//print the fraction part into temp
s = ltoa( ((floatVar - int_part) * mult), temp, 10);
s = ultoa( ((floatVar - int_part) * mult), temp, 10);

i = processedFracLen - strlen(s) + 1;

Expand Down

0 comments on commit 4fff8a8

Please sign in to comment.