Skip to content

Commit

Permalink
Fix dtostrf_internal
Browse files Browse the repository at this point in the history
  • Loading branch information
vshymanskyy committed Sep 17, 2018
1 parent 17ea7d5 commit 55814b9
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/utility/utility.cpp
Expand Up @@ -44,18 +44,20 @@ char* dtostrf_internal(double number, signed char BLYNK_UNUSED width, unsigned c

// Print the decimal point, but only if there are digits beyond
if(prec > 0) {
*out = '.';
++out;
*out++ = '.';
}

while(prec-- > 0) {
remainder *= 10.0;
if((int)remainder == 0) {
*out = '0';
++out;
*out++ = '0';
}
}
sprintf(out, "%d", (int) remainder);
if((int)remainder != 0) {
sprintf(out, "%d", (int)remainder);
} else {
*out++ = '\0';
}

return s;
}
Expand Down

0 comments on commit 55814b9

Please sign in to comment.