scale-numbers ( n -- str )


Vocabulary
math.text.english.private

Inputs
nan object


Outputs
stran object


Definition


: scale-numbers ( n -- str )
{
{
[ dup 41 < ]
[
{
f
"thousand"
"million"
"billion"
"trillion"
"quadrillion"
"quintillion"
"sextillion"
"septillion"
"octillion"
"nonillion"
"decillion"
"undecillion"
"duodecillion"
"tredecillion"
"quattuordecillion"
"quindecillion"
"sexdecillion"
"septendecillion"
"octodecillion"
"novemdecillion"
"vigintillion"
"unvigintillion"
"duovigintillion"
"tresvigintillion"
"quattuorvigintillion"
"quinvigintillion"
"sesvigintillion"
"septemvigintillion"
"octovigintillion"
"novemvigintillion"
"trigintillion"
"untrigintillion"
"duotrigintillion"
"trestrigintillion"
"quattuortrigintillion"
"quintrigintillion"
"sestrigintillion"
"septentrigintillion"
"octotrigintillion"
"noventrigintillion"
} nth
]
}
{
[ dup 311 < ]
[
41 - 10 /mod [
{
"quadragintillion"
"quinquagintillion"
"sexagintillion"
"septuagintillion"
"octogintillion"
"nonagintillion"
"centillion"
"decicentillion"
"viginticentillion"
"trigintacentillion"
"quadragintacentillion"
"quinquagintacentillion"
"sexagintacentillion"
"septuagintacentillion"
"octogintacentillion"
"nonagintacentillion"
"ducentillion"
} nth
] [
{
f
"un"
"duo"
"tre"
"quattuor"
"quinqua"
"se"
"septe"
"octo"
"nove"
} nth
] bi* swap "" append-as
]
}
} cond ;