mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-07-29 02:07:32 +02:00
JsonDeserializer: use float
when the value has few digits
This commit is contained in:
@ -60,10 +60,15 @@ TEST_CASE("parseNumber<float>()") {
|
||||
|
||||
SECTION("VeryLong") {
|
||||
checkFloat("0.00000000000000000000000000000001", 1e-32f);
|
||||
checkFloat("100000000000000000000000000000000.0", 1e+32f);
|
||||
checkFloat(
|
||||
"100000000000000000000000000000000.00000000000000000000000000000",
|
||||
1e+32f);
|
||||
|
||||
// The following don't work because they have many digits so parseNumber()
|
||||
// treats them as double. But it's not an issue because JsonVariant will use
|
||||
// a float to store them.
|
||||
//
|
||||
// checkFloat("100000000000000000000000000000000.0", 1e+32f);
|
||||
// checkFloat(
|
||||
// "100000000000000000000000000000000.00000000000000000000000000000",
|
||||
// 1e+32f);
|
||||
}
|
||||
|
||||
SECTION("NaN") {
|
||||
|
Reference in New Issue
Block a user