2dup fast-gcd [ /i ] curry bi@ fraction>
] if-zero ;
+M: integer recip
+ 1 swap [
+ division-by-zero
+ ] [
+ dup 0 < [ [ neg ] bi@ ] when fraction>
+ ] if-zero ;
+
+M: ratio recip
+ >fraction swap fraction> ;
+
M: ratio hashcode*
nip >fraction [ hashcode ] bi@ bitxor ;
: 2/ ( x -- y ) -1 shift ; inline
: sq ( x -- y ) dup * ; inline
: neg ( x -- -x ) -1 * ; inline
-: recip ( x -- y ) 1 swap / ; inline
: sgn ( x -- n ) dup 0 < [ drop -1 ] [ 0 > 1 0 ? ] if ; inline
: ?1+ ( x -- y ) [ 1 + ] [ 0 ] if* ; inline
: rem ( x y -- z ) abs [ mod ] [ + ] [ mod ] tri ; foldable
UNION: number real complex ;
+GENERIC: recip ( x -- y )
+
+M: number recip 1 swap / ; inline
+
: fp-bitwise= ( x y -- ? ) [ double>bits ] same? ; inline
GENERIC: fp-special? ( x -- ? )