# to the nth power
Dan Webb
dan at b11.ingr.com
Sun Nov 4 13:30:16 AEST 1990
In article <ENAG.90Nov3145415 at hild.ifi.uio.no>, enag at ifi.uio.no (Erik Naggum) writes:
> For all positive integers, you can prove that odd integers have the
> least significant bit equal to one, and even integers have the least
> significant bit equal to zero, when represented in binary. Hint: odd,
> positive integers have a remainder of 1 when divided by 2.
>
> For a ones-complement architectures, this even holds for negative
> integers. Twos-complement architectures will return "odd" for an even
> negative number in this simple test. Was that what you were thinking
> of?
I think you've got that backwards. In 2's complement, -1 has all bits set,
and it's certainly an odd number.
I think the bottom line is that in 2's complement notation, the LSBit means
an odd number. Period.
----------------------
Dan Webb
Intergraph Corp.
...!uunet!ingr!b11!dan
More information about the Comp.lang.c
mailing list