> Lennart Augustsson wrote:
> 
> > Simon Marlow wrote:
> >
> > >
> > > Int arithmetic on GHC and Hugs is modulo 2^32, i.e. maxBound + 1.
> > >
> >
> > Actually, if we are in nit-picking mode, arithmetic is 
> modulo (maxBound+1)*2.
> 
> PS. I.e., if we interpret "modulo" in the right way since the 
> result is interpreted
> as a signed number.  Int arithmetic in all Haskell 
> implementations I know of
> operate in the same way as C usually does.  It has the 
> advantage that you have
> the ring properties of + and *, which arithmetic with 
> exceptions would not give you.

On a similar note, is there any demand for an overflow-checking Int type in
GHC?  I don't want to make the default Int type checked, but it would be
quite feasible and not too much work to provide a new Int type with overflow
checking, say CheckedInt.

Cheers,
        Simon

Reply via email to