Title: intword fails to parse numbers >= 1 Googol · Issue #134 · python-humanize/humanize · GitHub
Open Graph Title: intword fails to parse numbers >= 1 Googol · Issue #134 · python-humanize/humanize
X Title: intword fails to parse numbers >= 1 Googol · Issue #134 · python-humanize/humanize
Description: What did you do? I tried to use humanize to convert 10_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000 (1 Googol) to the text output “1 googol” by callin...
Open Graph Description: What did you do? I tried to use humanize to convert 10_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000 (1 Googol)...
X Description: What did you do? I tried to use humanize to convert 10_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000 (1 Googol)...
Opengraph URL: https://github.com/python-humanize/humanize/issues/134
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"intword fails to parse numbers \u003e= 1 Googol","articleBody":"### What did you do?\r\nI tried to use humanize to convert `10_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000` (1 Googol) to the text output “1 googol” by calling `humanize.intword()` with the number.\r\n\r\n### What did you expect to happen?\r\nI expected the text output to be “1 googol” as the [documentation for intword](https://humanize.readthedocs.io/en/latest/number/#humanize.number.intword) claims the library can handle numbers of this size.\r\n\r\n### What actually happened?\r\nThe output was just the number as a string, without any word at all: `'10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'`\r\n\r\nThis is also the case for numbers larger than 1 Googol.\r\n### What versions are you using?\r\n\r\n* OS: Windows 11 Pro 22H2 22621.1992\r\n* Python: Python 3.11.4 (also tried 3.10.11, 3.9.13, 3.8.10, and 3.7.9)\r\n* Humanize: 4.7.0 (4.6.0 for Python 3.7.9)\r\n\r\nPlease include **code** that reproduces the issue.\r\n\r\nThe [best reproductions](https://stackoverflow.com/help/minimal-reproducible-example) are [self-contained scripts](https://ericlippert.com/2014/03/05/how-to-debug-small-programs/) with minimal dependencies.\r\n\r\n```python\r\n\u003e\u003e\u003e import humanize\r\n# 1 Googol:\r\n\u003e\u003e\u003e GOOGOL = 10_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000\r\n\u003e\u003e\u003e humanize.intword(GOOGOL)\r\n'10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'\r\n\r\n# 1 Googol minus 1:\r\n\u003e\u003e\u003e humanize.intword(GOOGOL - 1)\r\n'10000000000000001323945434466030186557813051577054744406252071157760.0 decillion'\r\n\r\n# 1000 Googol:\r\n\u003e\u003e\u003e humanize.intword(GOOGOL * 1000)\r\n'10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'\r\n```\r\n\r\nThe fact that it doesn't seem to work in any Python versions going all the way back to 3.8 in humanize v4.7.0 (and Python 3.7 with v4.6.0) seems odd to me. It leads me to believe that either I am misunderstanding the documentation, I am using the library wrongly, or something is wrong with how humanize handles a Googol.\r\nIf humanize is not supposed to parse a googol to the string “1 googol”, the docs should be updated to reflect that. Currently, they state:\r\n\u003e Supports up to decillion (33 digits) and googol (100 digits).\r\nWhich I understood meaning “Can parse and display a googol”.\r\n\r\nMy apologies if the problem turns out to be me misunderstanding/-using.","author":{"url":"https://github.com/MajorTanya","@type":"Person","name":"MajorTanya"},"datePublished":"2023-07-26T03:10:49.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/134/humanize/issues/134"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:bd60b74a-0790-3327-2dbe-b306a9852f09 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C9B6:1702DA:90ADF8:D1AC60:6A561BF5 |
| html-safe-nonce | eba528a8a220fe872e1d4e013572d0149fb39ee3d9f6e4cac7d11359db9fb9b2 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDOUI2OjE3MDJEQTo5MEFERjg6RDFBQzYwOjZBNTYxQkY1IiwidmlzaXRvcl9pZCI6IjU0NzY4OTE0NDA5MzU0NzYyMTMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 2b72c1620c4e87f3d57c9f16ae5e261b32a0b271c6186877f772db11a84baf0d |
| hovercard-subject-tag | issue:1821498996 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python-humanize/humanize/134/issue_layout |
| twitter:image | https://opengraph.githubassets.com/622491e942650da7984ee4313974d6f3ea759249fe096bebe0a91db8547cdc99/python-humanize/humanize/issues/134 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/622491e942650da7984ee4313974d6f3ea759249fe096bebe0a91db8547cdc99/python-humanize/humanize/issues/134 |
| og:image:alt | What did you do? I tried to use humanize to convert 10_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000 (1 Googol)... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | MajorTanya |
| hostname | github.com |
| expected-hostname | github.com |
| None | f4368738fc918fecd9b3958f6b49218bbe60d4185f38e72e3954e11f1ad0213a |
| turbo-cache-control | no-preview |
| go-import | github.com/python-humanize/humanize git https://github.com/python-humanize/humanize.git |
| octolytics-dimension-user_id | 62149795 |
| octolytics-dimension-user_login | python-humanize |
| octolytics-dimension-repository_id | 466683324 |
| octolytics-dimension-repository_nwo | python-humanize/humanize |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 466683324 |
| octolytics-dimension-repository_network_root_nwo | python-humanize/humanize |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | b76b9cc70d30da50674184c9c66c56423fd0b93c |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width