Skip to content

Fix intword's decillion-to-googol gap and carry-over rounding - #364

Closed
mmaxjr wants to merge 2 commits into
python-humanize:mainfrom
mmaxjr:fix/intword-decillion-googol-gap
Closed

mmaxjr wants to merge 2 commits into
python-humanize:mainfrom
mmaxjr:fix/intword-decillion-googol-gap

Conversation

@mmaxjr

@mmaxjr mmaxjr commented Jul 30, 2026

Copy link
Copy Markdown

Fixes #356

Problem

intword()'s powers table jumps straight from decillion (10**33) to googol (10**100), with no unit in between. Any value in [10**36, 10**100) got chopped into a decillion count that grows arbitrarily large:

>>> intword(10**50)
'100000000000000000.0 decillion'
>>> intword(10**100 - 10**93)
'9999999000000000610151082626636586748864734715312950532670947852288.0 decillion'

@hugovk hugovk changed the title fix(intword): correct decillion-to-googol gap and carry-over rounding Fix intword's decillion-to-googol gap and carry-over rounding Aug 4, 2026
@hugovk hugovk added the changelog: Fixed For any bug fixes label Aug 4, 2026
@codecov

codecov Bot commented Aug 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.69%. Comparing base (f971127) to head (7189a64).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #364   +/-   ##
=======================================
  Coverage   99.69%   99.69%           
=======================================
  Files          12       12           
  Lines         983      993   +10     
=======================================
+ Hits          980      990   +10     
  Misses          3        3           
Flag Coverage Δ
macos-latest 97.58% <100.00%> (+0.02%) ⬆️
ubuntu-latest 97.58% <100.00%> (+0.02%) ⬆️
windows-latest 93.25% <100.00%> (+0.06%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@codspeed

codspeed Bot commented Aug 4, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 15 untouched benchmarks


Comparing mmaxjr:fix/intword-decillion-googol-gap (7189a64) with main (f971127)

Open in CodSpeed

@mmaxjr

mmaxjr commented Aug 6, 2026

Copy link
Copy Markdown
Author

Status update on 2026-08-06: the latest commit (702e631) keeps the English fallback for unnamed magnitudes while preserving translated local-scale units such as French quintilliard(s).\n\nCurrent GitHub Actions runs for this fork update are in �ction_required, so the full matrix needs maintainer approval to run. The external checks currently visible on the PR are green:\n\n- docs/readthedocs.org:humanize -> success\n- pre-commit.ci - pr -> success

mmaxjr and others added 2 commits September 16, 2026 20:17
`powers` jumps from decillion (10**33) directly to googol (10**100),
so any value in [10**36, 10**100) was chopped into a decillion count
that grew arbitrarily large (e.g. 10**50 -> "100000000000000000.0
decillion"), and values that should round up into googol (e.g.
10**100 - 10**93) never carried over.

Only advance to the next named unit when the value actually rounds
up to it; otherwise there is no unit for that magnitude, so fall
back to the plain integer, mirroring how intword() already falls
back to a plain value below the smallest unit.

Fixes python-humanize#356

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@hugovk
hugovk force-pushed the fix/intword-decillion-googol-gap branch from 702e631 to 7189a64 Compare September 16, 2026 17:17
@hugovk

hugovk commented Sep 16, 2026

Copy link
Copy Markdown
Member

Closing in favour of #346.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog: Fixed For any bug fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

intword: values between 10^36 and a googol format as huge decillion counts, and rounding to the next unit does not carry

2 participants