Skip to content

Fix intword decillion–googol gap (fixes #356) - #407

Closed
lethevinh wants to merge 1 commit into
python-humanize:mainfrom
osalks:fix/issue-356-intword-gap
Closed

lethevinh wants to merge 1 commit into
python-humanize:mainfrom
osalks:fix/issue-356-intword-gap

Conversation

@lethevinh

Copy link
Copy Markdown

Fixes #356.

intword() currently formats values between 10^36 and a googol as huge decillion counts (e.g. intword(10**50)'100000000000000000.0 decillion'), and the integer-ratio rounding carry does not fire across the final ×10 step.

This change adds the standard short-scale names for 10^36–10^99 (undecillion … duotrigintillion) to powers/human_powers, so:

  • intword(10**50)'100.0 quindecillion'
  • intword(10**99)'1.0 duotrigintillion'
  • intword(10**100 - 10**93)'1.0 googol' (the existing carry now fires across the final step)

The existing test that pinned the gap ("The documented decillion..googol gap must be left untouched") is updated, since the issue explicitly asks for the gap to be fixed.

Tests: python -m pytest → 749 passed, 110 skipped (baseline on main @ 392aef7: 746 passed).

Pre-existing, unchanged by this PR (noted for honesty, out of scope): intword(10**400) raises OverflowError ("int too large to convert to float") — reproduced on the unmodified baseline.

…on gap)

Values between 10**36 and a googol used to render as enormous decillion
counts (e.g. intword(10**50) -> '100000000000000000.0 decillion'), and a
value just below a googol never carried to '1.0 googol'. Extending
powers/human_powers with the standard short-scale names for 10**36-10**99
(undecillion through duotrigintillion) gives every magnitude a unit and
lets the existing integer-ratio carry fire across the final 10**99 ->
10**100 step as well.

Upstream issue: python-humanize#356
@lethevinh lethevinh closed this Sep 21, 2026
@lethevinh
lethevinh deleted the fix/issue-356-intword-gap branch September 21, 2026 08:26
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.

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

1 participant