Opened 7 years ago
Last modified 5 years ago
#28280 closed Bug
numberformat.format does not handle scientific notation correctly — at Initial Version
Reported by: | Wil Tan | Owned by: | nobody |
---|---|---|---|
Component: | Utilities | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
For floats with values larger than 1e16 or smaller than 1e-5, their string representation uses scientific notation in Python, which causes numberformat.format
to return an erroneous output.
>>> format(0.0000000000000000009, '.', 2) '9e-19.00' >>> format(1e16, '.', 2, thousand_sep=',', grouping=3, force_grouping=True) '1e,+16.00'
This is similar to #23935 but that was only fixed for Decimal types.
Note:
See TracTickets
for help on using tickets.