Skip to content

Expand scientific notation floats in number_to_words#253

Open
gaoflow wants to merge 1 commit into
jaraco:mainfrom
gaoflow:fix-226-expand-scientific-floats
Open

Expand scientific notation floats in number_to_words#253
gaoflow wants to merge 1 commit into
jaraco:mainfrom
gaoflow:fix-226-expand-scientific-floats

Conversation

@gaoflow

@gaoflow gaoflow commented Jun 25, 2026

Copy link
Copy Markdown

Summary

  • expand numeric inputs rendered by Python in scientific notation before number_to_words() parses them
  • add regression coverage for small and large floats that previously produced digit-grouped words

Closes #226

Tests

  • PYTHONPATH=. uv run --python 3.11 --with '.[test]' pytest tests/test_numwords.py -q
  • PYTHONPATH=. uv run --python 3.11 --with '.[test]' pytest -q
  • PYTHONPATH=. uv run --python 3.11 --with '.[test,check]' ruff check --select I inflect/__init__.py tests/test_numwords.py
  • PYTHONPATH=. uv run --python 3.13 --with '.[test]' pytest tests/test_numwords.py -q

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