diff options
author | Ian Lynagh <ian@well-typed.com> | 2012-10-21 18:03:17 +0100 |
---|---|---|
committer | Ian Lynagh <ian@well-typed.com> | 2012-10-21 18:10:08 +0100 |
commit | 6bb741b12cf0829dd00fe9b16abc2941610cd155 (patch) | |
tree | ff9c4beedb0048d5706473d62c5aaaa8adc73262 | |
parent | 771d376bb6d2ab524741c6d0732718ac2613d2a1 (diff) | |
download | haskell-6bb741b12cf0829dd00fe9b16abc2941610cd155.tar.gz |
Use fromRational when pre-computing fromRational literals
This makes it easier to be confident that the optimisation gives the
right answer.
-rw-r--r-- | compiler/prelude/PrelRules.lhs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/prelude/PrelRules.lhs b/compiler/prelude/PrelRules.lhs index 2f4d62f0e3..72cb8780a7 100644 --- a/compiler/prelude/PrelRules.lhs +++ b/compiler/prelude/PrelRules.lhs @@ -50,6 +50,7 @@ import Util import Control.Monad import Data.Bits as Bits import Data.Int +import Data.Ratio import Data.Word \end{code} @@ -1177,7 +1178,7 @@ match_rationalTo mkLit _ _ id_unf [xl, yl] | Just (LitInteger x _) <- exprIsLiteral_maybe id_unf xl , Just (LitInteger y _) <- exprIsLiteral_maybe id_unf yl , y /= 0 - = Just (mkLit (fromInteger x/fromInteger y)) + = Just (mkLit (fromRational (x % y))) match_rationalTo _ _ _ _ _ = Nothing match_decodeDouble :: DynFlags |