Skip to content

No control on when float numbers are written with exponent #427

@hagai-shatz

Description

@hagai-shatz

When serialising JSON with float/double values, there is control on how many digits to write after the decimal point, with default of 2.
However, if the number is bigger than 1000 or smaller than 0.001 it will always be serialized with exponent: 1234.5 to 1.23e7

I can track this hard coded behaviour to: https://github.com/bblanchon/ArduinoJson/blob/master/include/ArduinoJson/Serialization/JsonWriter.hpp#L95

This is not in line with Arduino Serial.print that does not add exponent.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions