jaraco / inflect

Correctly generate plurals, ordinals, indefinite articles; convert numbers to words
https://pypi.org/project/inflect
MIT License
957 stars 107 forks source link

Broken ordinal cases #192

Open jaraco opened 1 year ago

jaraco commented 1 year ago

Currently, there are two cases that are uncovered by the tests and produce potentially surprising results:

float that's also an integer

>>> ordinal(1.0)
'1.0st'

That's surprising because other float values produce the suffix based on the last digit of the float (e.g. "1.0th").

float with no decimal digits

>>> ordinal('1.')
'1.st'

Does "1.st" even make sense? The code does attempt to support this case, but I'm not at all confident it should.