What's -0?

Sep 3, 2010 at 10:14pm
I thought about this a few days ago, but i only just got around to asking. If the first bit of a signed integer is used to indicate the sign (on for -, off for +), then what's -0, i.e., the negative bit is on, but everything else is off?
Sep 3, 2010 at 10:22pm
Depends, using two's complement -0 = 0 = 00000000 00000000 00000000 00000000
using one's complement 0 = ( all zeros ), -0 = ( all ones )

( Usually it's two's complement )
Last edited on Sep 3, 2010 at 10:24pm
Sep 3, 2010 at 10:37pm
Its more complicated than simply having one bit on or off to determine sign. Numbers are generally stored in a format called "two's complement" as Bazzy says:

http://en.wikipedia.org/wiki/Two's_complement
Sep 4, 2010 at 12:23am
Oh, I see. I think it would've been cooler if there where a -0, though =P
Sep 4, 2010 at 12:57am
cooler? maybe.

Less functional? Definitely.
Sep 4, 2010 at 3:22pm
Floating point format has -0 and +0 ;-)
Topic archived. No new replies allowed.