#3065: Reorder tests in quot to improve code
--------------------------------------+-------------------------------------
Reporter: simonpj | Owner:
Type: bug | Status: new
Priority: normal | Milestone: 6.12 branch
Component: libraries/base | Version: 6.10.1
Resolution: | Keywords:
Difficulty: Unknown | Os: Unknown/Multiple
Testcase: | Architecture: Unknown/Multiple
Failure: Runtime performance bug |
--------------------------------------+-------------------------------------
Comment (by rl):
Bumping this ticket as using any kind of integer division in an inner loop
tends to create unnecessary join points and thus interferes with array
fusion. I don't understand why there is an overflow test at all. I
certainly wouldn't expect there to be one as `Int` arithmetic is usually
unchecked. The report says in 6.4.2:
The quot, rem, div, and mod class methods satisfy these laws if y is
non-zero:
{{{
(x `quot` y)*y + (x `rem` y) == x
(x `div` y)*y + (x `mod` y) == x
}}}
This seems to imply that {{{minBound `quot` (-1)}}} should overflow
instead of raising an exception. Doesn't the current behaviour violate the
language definition?
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3065#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs