]> gitweb.factorcode.org Git - factor.git/commitdiff
math.ratios: slight fix to M\ ratio recip for negative ratios.
authorJohn Benediktsson <mrjbq7@gmail.com>
Sun, 2 Sep 2012 17:08:00 +0000 (10:08 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Sun, 2 Sep 2012 17:08:00 +0000 (10:08 -0700)
basis/math/ratios/ratios.factor

index bf572ac352f523f6909e23ab4a0cff972c7beb9d..b71d28f7da46faecb28467307b3658c538700071 100644 (file)
@@ -41,7 +41,7 @@ M: integer recip
     ] if-zero ;
 
 M: ratio recip
-    >fraction swap fraction> ;
+    >fraction swap dup 0 < [ [ neg ] bi@ ] when fraction> ;
 
 M: ratio hashcode*
     nip >fraction [ hashcode ] bi@ bitxor ;