Skip to content

Conversation

@lukstei
Copy link

@lukstei lukstei commented Dec 16, 2025

Changes the hash of Decimal to not include the control block, see #59.

let normalized = self.reduce();
normalized.digits.hash(state);
normalized.cb.hash(state);
normalized.fractional_digits_count().hash(state);
Copy link
Author

Choose a reason for hiding this comment

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

We need to include the fractional_digits_count, otherwise 10 and 100 would have the same hash after .reduce()

(SIGNED, $dec: ident, $D: ident) => {
#[rstest(::trace)]
#[case($dec!(0.00), $dec!(-0.000))]
#[case($dec!(-0.00), $dec!(0.000))]
Copy link
Author

@lukstei lukstei Dec 16, 2025

Choose a reason for hiding this comment

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

these cases should have the same hash because they are also equal

@lukstei lukstei marked this pull request as ready for review December 16, 2025 09:30
@lukstei
Copy link
Author

lukstei commented Dec 28, 2025

@neogenie Could you have a look please

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.

1 participant