(unsigned) -1 yields all 1s
Rick Genter
rgenter at j.bbn.com
Wed Dec 17 01:16:17 AEST 1986
> Actually, I think (unsigned) -1 does have to give you a bit pattern of
> all 1's. I can not find an explicit reason, but I can deduce this from the
> following:
> [...]
> 3. The value in the range 0 to 2^n-1 (inclusive) congruent mod 2^n
> to -1 is 2^n-1. In straight binary notation this value is repre-
> sented as all 1's.
This assumes your machine is in straight binary notation. If your machine
uses one's complement notation (CDC Cyber?), -0 is represented as all ones.
- Rick
--------
Rick Genter BBN Laboratories Inc.
(617) 497-3848 10 Moulton St. 6/512
rgenter at bbn.COM (Internet new) Cambridge, MA 02238
rgenter at bbnj.ARPA (Internet old) seismo!bbn.com!rgenter (UUCP)
More information about the Comp.lang.c
mailing list