math: neg? needs to be defined for all reals
parent
a97a9ede15
commit
90f34d092c
|
@ -8,8 +8,6 @@ IN: math.integers.private
|
|||
: fixnum-min ( x y -- z ) [ fixnum< ] most ; foldable
|
||||
: fixnum-max ( x y -- z ) [ fixnum> ] most ; foldable
|
||||
|
||||
M: integer neg? 0 < ; inline
|
||||
|
||||
M: integer numerator ; inline
|
||||
M: integer denominator drop 1 ; inline
|
||||
|
||||
|
|
|
@ -67,4 +67,15 @@ IN: math.tests
|
|||
[ f ] [ -1/0. 0/0. >= ] unit-test
|
||||
[ f ] [ 1/0. 0/0. >= ] unit-test
|
||||
|
||||
[ f ] [ 0 neg? ] unit-test
|
||||
[ f ] [ 1/2 neg? ] unit-test
|
||||
[ f ] [ 1 neg? ] unit-test
|
||||
[ t ] [ -1/2 neg? ] unit-test
|
||||
[ t ] [ -1 neg? ] unit-test
|
||||
|
||||
[ f ] [ 0.0 neg? ] unit-test
|
||||
[ f ] [ 1.0 neg? ] unit-test
|
||||
[ f ] [ 1/0. neg? ] unit-test
|
||||
[ t ] [ -0.0 neg? ] unit-test
|
||||
[ t ] [ -1.0 neg? ] unit-test
|
||||
[ t ] [ -1/0. neg? ] unit-test
|
||||
|
|
|
@ -88,6 +88,8 @@ TUPLE: ratio { numerator integer read-only } { denominator integer read-only } ;
|
|||
|
||||
UNION: rational integer ratio ;
|
||||
|
||||
M: rational neg? 0 < ; inline
|
||||
|
||||
UNION: real rational float ;
|
||||
|
||||
TUPLE: complex { real real read-only } { imaginary real read-only } ;
|
||||
|
|
Loading…
Reference in New Issue