Anonymous user
Number names: Difference between revisions
Updated to compile with Nim 1.4. Other minor changes.
Thundergnat (talk | contribs) m (Regularize non-standard header markup) |
(Updated to compile with Nim 1.4. Other minor changes.) |
||
Line 3,727:
"decillion"]
# Forward reference.
proc spellInteger(n: int64): string
proc nonzero(c: string
if n == 0: "" else: connect & c & spellInteger(n)
proc lastAnd(num: string): string =
if "
result =
else:
proc big(e, n: int64): string =
if e == 0:
spellInteger(n)
Line 3,752 ⟶ 3,751:
spellInteger(n) & " " & huge[e]
iterator base1000Rev(n: int64):
var n = n
while n != 0:
Line 3,776 ⟶ 3,775:
var e = 0
for x in base1000Rev(n):
if x > 0: sq.add big(e, x)
inc e
reverse sq
Line 3,789 ⟶ 3,787:
echo align($n, 14)," -> ",spellInteger(n)
n = n div -10</lang>
{{out}}
<pre> 0 -> zero
-3 -> minus three
|