Semantics of comparison between BigDecimal and Number
Nobody has claimed this yet.
- Dominant language
- HTML
- Stars
- 638
- Forks
- 20
- PR merge metrics
- No merged PRs in 30d
Description
Fabrice Bellard wrote,
How to define the comparison between a bigdecimal and a number ?
(1) Convert the number to a bigdecimal with Number.prototype.toString() and do the comparison
(2) Do the mathematically correct comparison (i.e. by converting the number to bigdecimal with infinite precision).
I [...] selected (1) which is a lot simpler to implement and consistent with [option (1) of #40]. It still gives a total ordering among numeric values which is an important point when sorting an array with different types of numeric values.
My intuition here was definitely (2).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading this issue and the referenced option (1) of issue #40. Compare the proposed Number.prototype.toString() conversion with mathematically exact comparison, then look for agreement in the existing discussion. Done means the comparison semantics are clearly decided and documented for the proposal.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100