[bug] Incorrect results for floating point numbers. `p.number_to_words(0.000001) != 'one hundred and six'`
Open
bug
- Dominant language
- Python
- Stars
- 1.1k
- Forks
- 127
- PR merge metrics
- No merged PRs in 30d
Description
When converting numbers like 0.000001 to strings, python prints it as 1e-06, leading to problems with the result. For example:
```py
>>> import inflect
>>> p = inflect.engine()
>>> p.number_to_words(0.000001)
'one hundred and six'
>>> p.number_to_words('0.000001')
'zero point zero zero zero zero zero one'
>>> 0.000001
1e-06
```
One approach is to use string formatting for floating point numbers:
```py
>>> num = 0.000001
>>> str(num)
'1e-06'
>>> f'{num:f}'
'0.000001'
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.