Skip to content

Conversation

@batconjurer
Copy link
Collaborator

Fixes #1762

@batconjurer batconjurer requested a review from brentstone July 25, 2023 22:45
brentstone
brentstone previously approved these changes Jul 26, 2023
Copy link
Collaborator

@brentstone brentstone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! LGTM

Fraccaman added a commit that referenced this pull request Jul 26, 2023
* origin/bat/fix/dec-ord:
  added changelog
  [fix]: Fixed ordering for Dec and I256 types
@Fraccaman Fraccaman mentioned this pull request Jul 26, 2023
Copy link
Contributor

@bengtlofgren bengtlofgren left a 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

Comment on lines +617 to +622
#[test]
fn test_ordering() {
let smaller = Dec::from_str("6483947304.195066085701").unwrap();
let larger = Dec::from_str("32418116583.390243854642").unwrap();
assert!(smaller < larger);
}
Copy link
Collaborator

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?

Copy link
Collaborator Author

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.

@Fraccaman Fraccaman merged commit a1fd70f into main Jul 26, 2023
@Fraccaman Fraccaman deleted the bat/fix/dec-ord branch July 26, 2023 19:43
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.

Ordering for Dec type is buggy

6 participants