X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=GHC%2FReal.lhs;h=4c2ed45e3dcd4796f5f326cde5c8e33a215d4c13;hb=b2f76d1e62488565e470ffc24551090c83f66ee5;hp=971f2767b655b14f94255486a520f1b5a65f3106;hpb=d71ca65be98abb12afa1dfc2815e6e157799ffdc;p=ghc-base.git diff --git a/GHC/Real.lhs b/GHC/Real.lhs index 971f276..4c2ed45 100644 --- a/GHC/Real.lhs +++ b/GHC/Real.lhs @@ -331,7 +331,10 @@ instance (Integral a) => Num (Ratio a) where instance (Integral a) => Fractional (Ratio a) where {-# SPECIALIZE instance Fractional Rational #-} (x:%y) / (x':%y') = (x*y') % (y*x') - recip (x:%y) = y % x + recip (0:%_) = error "Ratio.%: zero denominator" + recip (x:%y) + | x < 0 = negate y :% negate x + | otherwise = y :% x fromRational (x:%y) = fromInteger x :% fromInteger y instance (Integral a) => Real (Ratio a) where