On February 19, 2009 18:20:33 Krasimir Angelov wrote: > Oh. I looked at the primops.txt.pp for something suspicious but I > didn't checked the actual implementation of quot. I thought that quot > calls quotInt# directly. When I use quotInt in the code I can get the > real idiv assembly instruction. Still the code generated by GHC is > strange it doesn't throw any exception actually. It just evaluates the > same expression but with the constant maxBound. > > On Thu, Feb 19, 2009 at 11:19 PM, Max Bolingbroke > > a `quot` b > > > > | b == 0 = divZeroError > > | a == minBound && b == (-1) = overflowError > > | otherwise = a `quotInt` b
I checked the quot one like you said. Kind of strange all right. It looks like it is performing the a == minBound check (where a = maxBound-x) despite the b == (-1) check (where b = 10) being optimized away. Cheers! -Tyson
Description: This is a digitally signed message part.
_______________________________________________ Glasgow-haskell-users mailing list Glasgowfirstname.lastname@example.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users