Python Forum
limiting number of digits as words in a function - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: General (https://python-forum.io/forum-1.html)
+--- Forum: News and Discussions (https://python-forum.io/forum-31.html)
+--- Thread: limiting number of digits as words in a function (/thread-35122.html)



limiting number of digits as words in a function - Skaperen - Oct-01-2021

i am revising my code that converts numbers to works (1609 -> "sixteen hundred nine"). it's a command, now, and i am making it into a function that includes a command. i want to add limited support for fractions (maybe more advanced, later). for now it will just be like "point three seven five" added on. what i am getting for float is a very long number of digits. so i am working out ways to limit this. should i just provide a way to restrict the number of digits and an option to round or truncate? my plan for decimal.Decimal is to just use the number's own precision since that can be controlled. but float is more commonly used and its binary fractions have a lot of digits when converted to decimal.

i'm also thinking about multiple language support.

and i wonder how the Romans spoke their numbers. did they just say the Latin equivalent of "ecks vee iaee iaee" (names for letters) for 17? maybe they did have special names for some numbers like many languages have for twenty ("vingt", "zwanzig", "dvacet", "vint", "fichead", "двадцять", etc), or did they just say "viginti" when reading "XX".