itoa'd you so?

Levi Pearson levi at
Fri Sep 21 15:18:59 MDT 2007

Dave Smith <dave at> writes:

> I did, however, find another special case (in addition to zero), and
> that is INT_MIN. If you can figure out why INT_MIN is a special case,
> you get bonus Plug Karma points. The answer lies in the result of the
> following C expression:
>    abs( INT_MIN ); // What does this return? :)
>    (Note: you'll need to include <limits.h> and <stdlib.h>)

The answer lies in 2's complement binary representation of integers.
There aren't the same number of integers to the left and to the right
of 0; there's one more to the left.  So, the absolute value of the
smallest representable integer isn't representable in the same number
of bits.


More information about the PLUG mailing list