Skip to content

Possible to limit precision of number types? #284

Closed
@richardeakin

Description

@richardeakin

I have a json-based config where I write some parameters, and when my application closes it uses the Json::StyledWriter to save the latest state of my root Json::Value object. I understand that round trip floating point precision isn't guaranteed to be exact, but is there a way to avoid numbers such as 0.15 being saved as 0.14999999999999999? This makes the config file difficult to read.

One solution I was wondering about is whether I could limit the precision of floating point numbers, I rarely in this case want more than 4 significant decimals and that would at least improve the use case.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions