]> gitweb.factorcode.org Git - factor.git/commitdiff
math: moving >fraction to math.
authorJohn Benediktsson <mrjbq7@gmail.com>
Sun, 19 Jul 2015 22:59:40 +0000 (15:59 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Sun, 19 Jul 2015 23:57:45 +0000 (16:57 -0700)
basis/math/functions/functions.factor
basis/math/ratios/ratios.factor
core/math/integers/integers.factor
core/math/math.factor

index dd1f797074d8b30f4599399e6612829c69eecb29..6b1382fa1a2c086f252f499d767ea0857ce8f53e 100644 (file)
@@ -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
index 70969cad43d28dba2fa17e79310d3e419ea804d4..5d693ec5e779568e25664c366f50d9cdb797e9ad 100644 (file)
@@ -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 <= ;
index 7cc3b3448fc01a8d04b0a681a8f2bcb9e5b93a61..bee5cf6325f46eaf92f6857923474101acf5fd8f 100644 (file)
@@ -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
index 600c1d7efcd64b37367b0a0b09139d3a113d0a97..5a0ba2fd4666b102b5be6d49565a79cfc592e190 100644 (file)
@@ -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 )