mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-07-29 18:27:37 +02:00
Fixed double formatting issue
This commit is contained in:
@ -19,7 +19,7 @@ size_t Print::print(const char s[]) {
|
|||||||
|
|
||||||
size_t Print::print(double value, int digits) {
|
size_t Print::print(double value, int digits) {
|
||||||
char tmp[32];
|
char tmp[32];
|
||||||
sprintf(tmp, "%.*g", digits + 1, value);
|
sprintf(tmp, "%.*f", digits, value);
|
||||||
return print(tmp);
|
return print(tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,9 +117,9 @@ void JsonParser::parseNumberTo(JsonValue &destination) {
|
|||||||
|
|
||||||
if (*endOfLong == '.') {
|
if (*endOfLong == '.') {
|
||||||
// stopped on a decimal separator
|
// stopped on a decimal separator
|
||||||
double douleValue = strtod(_ptr, &_ptr);
|
double doubleValue = strtod(_ptr, &_ptr);
|
||||||
int decimals = _ptr - endOfLong - 1;
|
int decimals = _ptr - endOfLong - 1;
|
||||||
destination.set(douleValue, decimals);
|
destination.set(doubleValue, decimals);
|
||||||
} else {
|
} else {
|
||||||
_ptr = endOfLong;
|
_ptr = endOfLong;
|
||||||
destination = longValue;
|
destination = longValue;
|
||||||
|
Reference in New Issue
Block a user