math: moving >fraction to math.
parent
5f8426cfbe
commit
89e3cc511e
|
@ -4,12 +4,6 @@ USING: math kernel math.constants math.private math.bits
|
|||
math.libm combinators fry math.order sequences ;
|
||||
IN: math.functions
|
||||
|
||||
GENERIC: >fraction ( a/b -- a b )
|
||||
|
||||
M: integer >fraction 1 ; inline
|
||||
|
||||
M: ratio >fraction [ numerator ] [ denominator ] bi ; inline
|
||||
|
||||
: rect> ( x y -- z )
|
||||
! Note: an imaginary 0.0 should still create a complex
|
||||
dup 0 = [ drop ] [ complex boa ] if ; inline
|
||||
|
|
|
@ -63,6 +63,7 @@ M: ratio >float >fraction /f ;
|
|||
|
||||
M: ratio numerator numerator>> ; inline
|
||||
M: ratio denominator denominator>> ; inline
|
||||
M: ratio >fraction [ numerator ] [ denominator ] bi ; inline
|
||||
|
||||
M: ratio < scale < ;
|
||||
M: ratio <= scale <= ;
|
||||
|
|
|
@ -12,6 +12,7 @@ IN: math.integers
|
|||
|
||||
M: integer numerator ; inline
|
||||
M: integer denominator drop 1 ; inline
|
||||
M: integer >fraction 1 ; inline
|
||||
|
||||
M: fixnum >fixnum ; inline
|
||||
M: fixnum >bignum fixnum>bignum ; inline
|
||||
|
|
|
@ -84,6 +84,7 @@ GENERIC: integer>fixnum-strict ( x -- y ) foldable
|
|||
|
||||
GENERIC: numerator ( a/b -- a )
|
||||
GENERIC: denominator ( a/b -- b )
|
||||
GENERIC: >fraction ( a/b -- a b )
|
||||
|
||||
GENERIC: real-part ( z -- x )
|
||||
GENERIC: imaginary-part ( z -- y )
|
||||
|
|
Loading…
Reference in New Issue