Skip to content

Expand scientific notation floats in number_to_words#250

Open
gaoflow wants to merge 1 commit into
jaraco:mainfrom
gaoflow:fix-226-small-float-number-to-words
Open

Expand scientific notation floats in number_to_words#250
gaoflow wants to merge 1 commit into
jaraco:mainfrom
gaoflow:fix-226-small-float-number-to-words

Conversation

@gaoflow

@gaoflow gaoflow commented Jun 22, 2026

Copy link
Copy Markdown

Summary

  • expand float inputs rendered by Python in scientific notation before parsing digits
  • keep string inputs on the existing string parsing path
  • add regression coverage for small float values such as 0.000001

Fixes #226

Verification

  • python -m pytest tests/test_pwd.py -k numwords -q
  • python -m pytest -q
  • python -m compileall inflect tests
  • python -m ruff format --check inflect/init.py tests/test_pwd.py
  • git diff --check upstream/main...HEAD

Note: python -m ruff check inflect/init.py tests/test_pwd.py still reports pre-existing UP006/UP007/UP035 typing modernization diagnostics across inflect/init.py that are unrelated to this change.

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.

[bug] Incorrect results for floating point numbers. p.number_to_words(0.000001) != 'one hundred and six'

1 participant