Skip to content

Fix intword for 1,000 decillion#87

Merged
hugovk merged 1 commit intopython-humanize:mainfrom
hugovk:fix-intword-thousand-decillion
Jan 28, 2023
Merged

Fix intword for 1,000 decillion#87
hugovk merged 1 commit intopython-humanize:mainfrom
hugovk:fix-intword-thousand-decillion

Conversation

@hugovk
Copy link
Member

@hugovk hugovk commented Jan 4, 2023

Fixes #86.

Changes proposed in this pull request:

  • When deciding what power to use, it assumed the next one was always 1,000 (=10**3) times bigger
  • That's the case for most, but the final step from decillion to googol is much bigger:
powers = [10**x for x in (3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 100)]
human_powers = (
    NS_("thousand", "thousand"),
    NS_("million", "million"),
    NS_("billion", "billion"),
    NS_("trillion", "trillion"),
    NS_("quadrillion", "quadrillion"),
    NS_("quintillion", "quintillion"),
    NS_("sextillion", "sextillion"),
    NS_("septillion", "septillion"),
    NS_("octillion", "octillion"),
    NS_("nonillion", "nonillion"),
    NS_("decillion", "decillion"),
    NS_("googol", "googol"),
)
  • Instead of comparing the gap to 10**3, compare to the actual gap: powers[ordinal_] / powers[ordinal_ - 1]

@hugovk hugovk added the changelog: Fixed For any bug fixes label Jan 4, 2023
@hugovk hugovk mentioned this pull request Jan 4, 2023
@hugovk hugovk changed the title Fix intword for 1000 decillion Fix intword for 1,000 decillion Jan 14, 2023
@NavisGames
Copy link
Contributor

bump for merging pull reqeuest, when does the new update with the fixes drop? Until then i have edited my local humanize files 😅

@hugovk
Copy link
Member Author

hugovk commented Jan 26, 2023

Thanks for the bump, was waiting to see if anyone had any feedback/approvals :)

We're due a release, I'll do one within the next week, maybe on the weekend.

@hugovk hugovk merged commit 4304f46 into python-humanize:main Jan 28, 2023
@hugovk hugovk deleted the fix-intword-thousand-decillion branch January 28, 2023 09:39
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.

Failing for 1000 decillion

2 participants