Skip to content

Use 17 digits of precision with Double.ToString#2823

Open
oleks wants to merge 2 commits intoJamesNK:masterfrom
oleks:oleks-fix-double-conversion-precision
Open

Use 17 digits of precision with Double.ToString#2823
oleks wants to merge 2 commits intoJamesNK:masterfrom
oleks:oleks-fix-double-conversion-precision

Conversation

@oleks
Copy link
Copy Markdown

@oleks oleks commented Feb 22, 2023

Using 15 digits ("R") leads to failure of roundtrip serialization/deserialization.

See also https://learn.microsoft.com/en-us/dotnet/api/system.double.tostring

Another example is 0.6822871999174

Using 15 digits ("R") leads to failure of roundtrip
serialization/deserialization.

See also https://learn.microsoft.com/en-us/dotnet/api/system.double.tostring

Another example is 0.6822871999174
@oleks oleks force-pushed the oleks-fix-double-conversion-precision branch from e954f70 to 0796691 Compare February 22, 2023 17:38
@oleks
Copy link
Copy Markdown
Author

oleks commented Feb 23, 2023

I suppose one could make the argument that it is better to parameterize the library by the format that it should use for Double.ToString, since G17 is also broken, just in a different way.

Serialize(Deserialize<float>("1.1")) != "1.1"

Hence, it is probably best to let the users choose their poison.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[]()

1 participant