`<xlocmon>`: "drop 10 zeros" logic is imprecise
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 11.1k
- Forks
- 1.7k
- Avg merge
- 4d 15h
- Merged PRs (30d)
- 22
Description
money_put::do_put contains:
https://github.com/microsoft/STL/blob/f0f0b55d57e2c9b9da5206b7dbdd71f17e7a0ee3/stl/inc/xlocmon#L676-L678
Like almost all of our pre-charconv floating-point formatting, I believe that this is incorrect - dividing by a power of 10 isn't an exact operation.
This probably isn't a significant issue in practice (as few people have more than 10^35 units of money, although one can dream).
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 with money_put::do_put in stl/inc/xlocmon at the linked lines and trace how the formatting path handles large monetary values. Determine how the current "drop 10 zeros" step affects precision; done means the imprecision is addressed and the relevant behavior is verified by the library's monetary-formatting tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100