projects
/
ghc-base.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add tests from testsuite/tests/h98
[ghc-base.git]
/
GHC
/
Real.lhs
diff --git
a/GHC/Real.lhs
b/GHC/Real.lhs
index
68e3784
..
17d0452
100644
(file)
--- a/
GHC/Real.lhs
+++ b/
GHC/Real.lhs
@@
-1,5
+1,5
@@
\begin{code}
\begin{code}
-{-# OPTIONS_GHC -XNoImplicitPrelude #-}
+{-# LANGUAGE CPP, NoImplicitPrelude, MagicHash, UnboxedTuples #-}
{-# OPTIONS_HADDOCK hide #-}
-----------------------------------------------------------------------------
-- |
{-# OPTIONS_HADDOCK hide #-}
-----------------------------------------------------------------------------
-- |
@@
-245,32
+245,38
@@
instance Integral Int where
a `quot` b
| b == 0 = divZeroError
a `quot` b
| b == 0 = divZeroError
- | a == minBound && b == (-1) = overflowError
+ | b == (-1) && a == minBound = overflowError -- Note [Order of tests]
+ -- in GHC.Int
| otherwise = a `quotInt` b
a `rem` b
| b == 0 = divZeroError
| otherwise = a `quotInt` b
a `rem` b
| b == 0 = divZeroError
- | a == minBound && b == (-1) = overflowError
+ | b == (-1) && a == minBound = overflowError -- Note [Order of tests]
+ -- in GHC.Int
| otherwise = a `remInt` b
a `div` b
| b == 0 = divZeroError
| otherwise = a `remInt` b
a `div` b
| b == 0 = divZeroError
- | a == minBound && b == (-1) = overflowError
+ | b == (-1) && a == minBound = overflowError -- Note [Order of tests]
+ -- in GHC.Int
| otherwise = a `divInt` b
a `mod` b
| b == 0 = divZeroError
| otherwise = a `divInt` b
a `mod` b
| b == 0 = divZeroError
- | a == minBound && b == (-1) = overflowError
+ | b == (-1) && a == minBound = overflowError -- Note [Order of tests]
+ -- in GHC.Int
| otherwise = a `modInt` b
a `quotRem` b
| b == 0 = divZeroError
| otherwise = a `modInt` b
a `quotRem` b
| b == 0 = divZeroError
- | a == minBound && b == (-1) = overflowError
+ | b == (-1) && a == minBound = overflowError -- Note [Order of tests]
+ -- in GHC.Int
| otherwise = a `quotRemInt` b
a `divMod` b
| b == 0 = divZeroError
| otherwise = a `quotRemInt` b
a `divMod` b
| b == 0 = divZeroError
- | a == minBound && b == (-1) = overflowError
+ | b == (-1) && a == minBound = overflowError -- Note [Order of tests]
+ -- in GHC.Int
| otherwise = a `divModInt` b
\end{code}
| otherwise = a `divModInt` b
\end{code}