-USING: kernel literals math math.parser sequences tools.test ;
+USING: kernel layouts literals math math.parser sequences
+tools.test ;
IN: math.parser.tests
{ f }
{ 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
} 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