math.parser: simplify error types.

db4
John Benediktsson 2012-06-08 07:32:01 -07:00
parent 437b1f8785
commit bec49ff840
2 changed files with 5 additions and 7 deletions

View File

@ -191,8 +191,8 @@ unit-test
[ 1 0 >base ] must-fail
[ 1 -1 >base ] must-fail
[ 2+1/2 -1 >base ] [ invalid-radix? ] must-fail-with
[ 123.456 8 >base ] [ invalid-base? ] must-fail-with
[ 123.456 2 >base ] [ invalid-base? ] must-fail-with
[ 123.456 8 >base ] [ invalid-radix? ] must-fail-with
[ 123.456 2 >base ] [ invalid-radix? ] must-fail-with
[ "0/0." ] [ 0.0 0.0 / number>string ] unit-test

View File

@ -13,11 +13,9 @@ IN: math.parser
ERROR: invalid-radix radix ;
ERROR: invalid-base n base ;
<PRIVATE
TUPLE: number-parse
TUPLE: number-parse
{ str read-only }
{ length fixnum read-only }
{ radix fixnum read-only } ;
@ -409,11 +407,11 @@ M: ratio >base
dup [ 0 = ] find drop head >string
fix-float ;
: float>base ( n base -- str )
: float>base ( n radix -- str )
{
{ 16 [ float>hex ] }
{ 10 [ "%.16g" format-float ] }
[ invalid-base ]
[ invalid-radix ]
} case ; inline
PRIVATE>