Fix erg's ratio bug

db4
Slava Pestov 2008-09-30 18:28:11 -05:00
parent e438fe2a80
commit 21c621d464
2 changed files with 5 additions and 2 deletions

View File

@ -108,3 +108,6 @@ unit-test
[ -1.0/0.0 ] [ "-1/0." string>number ] unit-test
[ "-0.0" ] [ -0.0 number>string ] unit-test
[ "-3/4" ] [ -3/4 number>string ] unit-test
[ "-1-1/4" ] [ -5/4 number>string ] unit-test

View File

@ -105,7 +105,7 @@ GENERIC# >base 1 ( n radix -- str )
<PRIVATE
: (>base) ( n -- str ) radix get >base ;
: (>base) ( n -- str ) radix get positive>base ;
PRIVATE>
@ -123,7 +123,7 @@ M: integer >base
M: ratio >base
[
dup 0 < negative? set
1 /mod
abs 1 /mod
[ dup zero? [ drop "" ] [ (>base) sign append ] if ]
[
[ numerator (>base) ]