-
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
Don't throw InexactError for comparisons between FDs of different types and/or Integers #88
Conversation
Note that this PR doesn't address InexactError caused by promotion during arithmetic, e.g.: julia> FixedDecimal{Int8,2}(1) + 2 # Same here: 2 is promoted to FD{Int8,2}(2)
ERROR: InexactError: convert(FixedDecimal{Int8, 2}, 2) I think that's okay for now. If we fixed it, this would either throw an OverflowError anyway if you used checked arithmetic, or it would wrap, using the new semantics. We should probably add support for this, but at least at RAI we're using checked arithmetic for everything so this is going to throw either way and so it seems less urgent to fix it to me. |
Thanks for the quick review! Ready for another round 😊 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️ thank you!! Can you just make sure we have full test coverage before merging?
8369395
to
7621196
Compare
Thanks Mary. 100% diff coverage now. (That's a really helpful tool.) Here I go! :) I'm gonna also mark this as a patch version bump, since it's a strict improvement. |
Fixes #82.
Before:
After, these all return true. :)
The idea in this PR is to check whether the values would fit in eachother's types, and if not, that's your answer, rather than throwing an InexactError if they fail to promote.