ntos float support

This commit is contained in:
Daniella / Tove 2022-02-05 22:16:59 +01:00
parent cd313f4526
commit 9f1ab0231a

View file

@ -112,12 +112,20 @@ func ntos {
"" =s "" =s
=n =n
n 0 lt dup if { n neg =n 1 =negative } =negative
n type =thetype n type =thetype
while n 0 eq not { while n 1 lt not {
n (n 10 % dup =x) - =n n (n 10 % dup =x) - =n
s (n '0' + _char) strconcat =s s (n '0' + _char) strconcat =s
} }
1 =steps
while n 0 eq not {
n (n (1 (steps dup 10 * =steps) /) % dup =x) - =n
s (x '0' + _char) strconcat =s
}
negative if { "-" s strconcat =s }
s s
} }