-
Notifications
You must be signed in to change notification settings - Fork 991
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
[fix]: Fixed ordering for Dec and I256 types #1763
Conversation
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.
Thanks! LGTM
* origin/bat/fix/dec-ord: added changelog [fix]: Fixed ordering for Dec and I256 types
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.
Could you just describe what the difference was here? What did the .0 do?
@bengtlofgren adding .0
meant you were comparing the inner uints, and not the signed values. I think this was the source of the issue. here's an example illustrating the issue
#[test] | ||
fn test_ordering() { | ||
let smaller = Dec::from_str("6483947304.195066085701").unwrap(); | ||
let larger = Dec::from_str("32418116583.390243854642").unwrap(); | ||
assert!(smaller < larger); | ||
} |
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.
wouldn't this test have passed before, with the faulty comparisons?
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.
Nope, it needs 2 u64 words to be stored.
Fixes #1762