[Haskell-cafe] abs minBound < (0 :: Int) && negate minBound == (minBound :: Int)

Ketil Malde ketil at malde.org
Tue Aug 20 18:41:48 CEST 2013

Richard A. O'Keefe <ok at cs.otago.ac.nz> writes:

>> I think a better argument for twos complement is that you're just
>> doing all of your computations modulo 2^n (where n is 32 or 64 or
>> whatever), and addition and multiplication work as expected modulo
>> anything.

> To me, that's not a better argument.  It isn't even a _good_ argument.
> It amounts to saying "if you do things wrong, you can justify it by
> saying you're really doing something else right, and it's the programmer's
> fault for wanting the wrong thing."

Not only that, but in Haskell, you don't really know 'n', it is only
specified to be at least 23, or something like that.  Which basically
means that any code that relies on this behaviour without rigorously
checking it basically is wrong.

If I haven't seen further, it is by standing in the footprints of giants

More information about the Haskell-Cafe mailing list