8000 Issue when serializing double · Issue #202 · USCiLab/cereal · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Issue when serializing double #202
Open
@henrywoo

Description

@henrywoo

For example x is a double and equal to 3545.45, but after serialization, it become 3545.4500000000007. This makes trouble when I use the serialized data(xml/json) in other places.

"x": 3545.4500000000007

I found this is a 52C9 common issue for all double. Is there any way to avoid this?

I want the result is exactly like:

"x": 3545.45

Or I can control the format like printf. If I want to three decimals, it is like:

"x": 3545.450

Thanks in advance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0