Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Round-trip floats in diagnostic messages #637

Merged
merged 2 commits into from
Jul 8, 2018
Merged

Conversation

stakx
Copy link
Contributor

@stakx stakx commented Jul 8, 2018

Single.ToString() and Double.ToString() use the "G" format specifier by default, which does not include all significant digits in the produced output.

Change the diagnostic formatting code so that it uses a round tripping representation for floating point numbers (like e.g. the Visual Studio debugger does, too). Instead of the somewhat unreliable "R" specifier, use "G9" (for singles) and "G17" (for doubles) as documented on Standard Numeric Format Strings: The General ("G") Format Specifier.

This closes #636.

stakx added 2 commits July 8, 2018 10:04
`Single.ToString()` and `Double.ToString()` use the "G" format specif-
ier by default, which does not include all significant digits in the
produced output.

Change the diagnostic formatting code so that it uses a round tripping
representation for floating point numbers (like e.g. the Visual Studio
debugger does, too). Instead of the somewhat unreliable "R" specifier,
use "G9" (for singles) and "G17" (for doubles) as documented on:

 https://docs.microsoft.com/en-us/dotnet/standard/base-types/
 standard-numeric-format-strings#the-general-g-format-specifier
@stakx stakx merged commit 9747eff into devlooped:master Jul 8, 2018
@stakx stakx deleted the issue-636 branch July 8, 2018 09:01
@stakx stakx added this to the v4.9.0 milestone Jul 13, 2018
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.

Write exact values into exception messages
1 participant