math.parser: fix "most-negative-fixnum number>string string>number fixnum?".
parent
154ebac5af
commit
866b40271d
|
@ -1,4 +1,5 @@
|
|||
USING: kernel literals math math.parser sequences tools.test ;
|
||||
USING: kernel layouts literals math math.parser sequences
|
||||
tools.test ;
|
||||
IN: math.parser.tests
|
||||
|
||||
{ f }
|
||||
|
@ -359,3 +360,6 @@ unit-test
|
|||
{ f } [ "0b0" bin> ] unit-test
|
||||
{ f } [ "0o0" bin> ] unit-test
|
||||
{ f } [ "0x0" bin> ] unit-test
|
||||
|
||||
{ t } [ most-positive-fixnum number>string string>number fixnum? ] unit-test
|
||||
{ t } [ most-negative-fixnum number>string string>number fixnum? ] unit-test
|
||||
|
|
|
@ -98,7 +98,12 @@ TUPLE: float-parse
|
|||
} cond ;
|
||||
|
||||
: ?neg ( n/f -- -n/f )
|
||||
[ neg ] [ f ] if* ; inline
|
||||
[
|
||||
dup bignum? [
|
||||
dup first-bignum bignum=
|
||||
[ drop most-negative-fixnum ] [ neg ] if
|
||||
] [ neg ] if
|
||||
] [ f ] if* ; inline
|
||||
|
||||
: ?add-ratio ( m n/f -- m+n/f )
|
||||
dup ratio? [ + ] [ 2drop f ] if ; inline
|
||||
|
|
Loading…
Reference in New Issue