Skip to content

Keep three digits when metric rounds into quetta - #424

Open
SashaMIT wants to merge 1 commit into
python-humanize:mainfrom
SashaMIT:metric-quetta-digits
Open

SashaMIT wants to merge 1 commit into
python-humanize:mainfrom
SashaMIT:metric-quetta-digits

Conversation

@SashaMIT

@SashaMIT SashaMIT commented Oct 1, 2026 •

Copy link
Copy Markdown

Fixes #423

Changes proposed in this pull request:

  • metric(9.996e30) returned 10.00 Q. 9999 is already 10.0 k, not 10.00 k. This is now 10.0 Q.
  • metric(9.996e31) returned 100.0 Q. It is now 100 Q.
  • metric(9.996e32) returned 1000 Q. There is no prefix past quetta, so this is now 1.00 x 10³³.
  • 2.596e32 is still 260 QF. A negative value keeps its sign.

pytest tests/test_number.py (248 passed).

The carry that keeps three digits stopped at exponent 30, so 9.996e30 printed 10.00 Q.
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.

metric() adds a digit when a value rounds into quetta

1 participant