Fix/decimal ord eq contract - #126
Merged
Merged
Conversation
Implemented a single canonical decimal comparator so two decimals compare equal if and only if Ord returns Equal. This keeps finite ordering, equality, and hashing consistent with each value having its own precision, including canonical zero and trailing-zero handling, and preserves ordered and hashed collection behaviour.
Added permanent Criterion cases for decimal comparison: integer early exit, canonical equal pair, same exact value across precision, negative canonical zero handling, and long common-prefix workloads at p1, p16, and p255. This keeps comparison behaviour visible in regressions without changing normal arithmetic semantics.
Documented decimal ordering and equality in terms of each value precision and the zero-trimming convention used before comparison so trailing zeroes do not affect equality. README and changelog now also describe Ord, PartialOrd, Eq and Hash behaviour and clarify ordered and hashed collection compatibility.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.