math.text: make it only work with integers.

db4
John Benediktsson 2013-04-26 16:08:11 -07:00
parent 1b66b12b8a
commit 4712eff3c5
2 changed files with 8 additions and 4 deletions

View File

@ -91,6 +91,8 @@ SYMBOL: and-needed?
PRIVATE>
: number>text ( n -- str )
dup zero? [ small-numbers ] [ [ (number>text) ] with-scope ] if ;
GENERIC: number>text ( n -- str )
M: integer number>text
[ "zero" ] [ [ (number>text) ] with-scope ] if-zero ;

View File

@ -90,5 +90,7 @@ MEMO: units ( -- seq ) ! up to 10^99
PRIVATE>
: number>text ( n -- str )
dup abs 10 102 ^ >= [ number>string ] [ basic ] if ;
GENERIC: number>text ( n -- str )
M: integer number>text
dup abs 102 10^ >= [ number>string ] [ basic ] if ;