Re:Show HN: Convert a number to an approximated text expression
by benibela on Sunday April 26, 2020 @07:45AM
(#22986430)
I also wrote a function in Pascal to convert integers to natural language exactly. E.g. here is the output for 100000! https://gist.github.com/benibela/f0163b02562f647e4d2f
[ Parent
| on HN ]
Re:Show HN: Convert a number to an approximated text expression
by jagged-chisel on Sunday April 26, 2020 @09:32AM
(#22987014)
It's 8.8MB of plaintext English output describing the ridiculously long number, for those on mobile (who can't see the full file), or who don't want to click through the 'file is truncated...' link
Re:Show HN: Convert a number to an approximated text expression
by benibela on Sunday April 26, 2020 @09:58AM
(#22987174)
As an approximation, one could just say three duoquinquagintacentillinonagintacentillion
Re:Show HN: Convert a number to an approximated text expression
by pbhjpbhj on Sunday April 26, 2020 @09:59AM
(#22987178)
Isn't "one hundred thousand factorial" a more useful conversion? Would your conversion ever find utility?
Aside, this is why French style punctuation with a space before ? or ! is superior.
Re:Show HN: Convert a number to an approximated text expression
by benibela on Sunday April 26, 2020 @11:41AM
(#22987912)
I did not write it to be useful. I just wanted to say it can handle large integers.
I am implementing the XPath standard. The standard says there need to be a function to convert integers to English, but it does not specify an upper limit on the integers
Re:Show HN: Convert a number to an approximated text expression
by pbhjpbhj on Sunday April 26, 2020 @12:07PM
(#22988100)
Cool, IMO that makes it potentially useful (but being useful isn't required of course).
Out of curiosity, what part of the spec does that implement? Is it to do with fn:format-integer.
Re:Show HN: Convert a number to an approximated text expression
by benibela on Sunday April 26, 2020 @04:11PM
(#22989814)
Here is the function standard: https://www.w3.org/TR/xpath-functions-31/#func-format-intege...
Number formatting is really complicated