Hi,
>> div 1 (-2)
Jurek> -1
>> div 1 2
Jurek> 0
this is no contradiction since integer division
is not symmetric for positive and negative numbers.
I did the following check (in ghci):
Prelude> let check a b = (a`div`b,a == (a`div`b)*b+(a`mod`b) && ((a`mod`b)>=0) &&
((a`mod`b)<b))
Prelude> check 1 2
(0,True)
Prelude> check (-1) 2
(-1,True)
Thus, for positive divisors it seems OK.
However the result for negative divisors I don't understand:
Prelude> check 1 (-2)
(-1,False)
Prelude> check (-1) (-2)
(0,False)
Cheers
--
Christoph
_______________________________________________
Hugs-Bugs mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/hugs-bugs