-
Notifications
You must be signed in to change notification settings - Fork 22
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
exact comparisons with binary values/directed conversions #79
Comments
Those comparisons won't be exact though. Although it might be slower, if you want accurate results you might do better making a grisu like conversion of the binary floating point value, and then do the comparison using those values. That technique would work for any binary floating point numbers, including |
why wouldn't they be exact? |
e.g.
correctly returns false |
If you have to do rounding, how can they be exact? |
Because we can control the direction of rounding. It is similar to the way that we compare floats to |
For the comparison
the
Note
That is exactly 1e100, not just approximately 1e100 rounded for printing. Edit: My original explanation of how the conversion is done was incorrect, but what remains above is true. |
|
Currently
which might seem reasonable, except that
Since the library doesn't appear to offer comparisons, the one option would be to do it via directed conversions, e.g.
Is it possible to do this without touching the global rounding mode?
The text was updated successfully, but these errors were encountered: