itoa'd you so?
Dave Smith
dave at thesmithfam.org
Fri Sep 21 16:12:27 MDT 2007
Levi Pearson wrote:
> 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.
>
Yup, so in other words abs(INT_MIN) returns INT_MIN because it wraps
around. :)
Nice work Levi, and a good explanation.
--Dave
More information about the PLUG
mailing list