5
$\begingroup$

Why is there a $0$ and a $-0$? I thought zero meant nothing, so how can we have negative nothing?

$\endgroup$
3
  • $\begingroup$ math.stackexchange.com/questions/26705/… $\endgroup$
    – Stahl
    Commented Mar 21, 2013 at 21:43
  • 1
    $\begingroup$ @Stahl how is this relevant? $\endgroup$
    – gt6989b
    Commented Mar 21, 2013 at 21:44
  • 3
    $\begingroup$ The idea of $0$ being positive or negative might have to do with the confusion between $0$ and $-0$. The first answer and others state that typically $0$ is unsigned, and thus would give another reason that $0 = -0$. Since that's not the answer I was going to post, I just thought it might provide another perspective on "$0$" vs. "$-0$." $\endgroup$
    – Stahl
    Commented Mar 21, 2013 at 21:49

6 Answers 6

14
$\begingroup$

People often have an unspoken assumption, that, basically

$$\text{If it looks different, it is different}$$

until they learn otherwise, and this is just one of many cases where that isn't true. $0=-0$. And $1=1.0$. And $1/2=2/4=3/6$. And $0.999...=1$. There are plenty of cases where there are multiple ways of writing the same thing down. Writing the negative in $-0$ is perfectly possible, but redundant, because it's just $0$ anyway. So in a sense you can have "negative nothing", but it's just the same as good old regular "nothing".

N.B. In some computer systems this isn't technically the case. If you represent negative numbers with one's complement then you do in fact have two zeroes, and it is sensible to call one of them $-0$. Mathematically we still have $0=-0$ (i.e. they still behave the same way under various operations), but they're stored as two distinct numbers. This is kind of inconvenient, and so we normally use two's complement instead, where there's only one zero.

$\endgroup$
3
  • 4
    $\begingroup$ Floating point numbers also have multiple representations for zero, since in the encoding there is one bit that represents the sign of the number. Interestingly, the two different representations for zero in floating-point arithmetic actually behave differently in many implementations: 1/0 will return Infinity, whereas 1/-0 will return -Infinity. $\endgroup$ Commented Mar 22, 2013 at 0:59
  • $\begingroup$ @PeterOlson I seem to believe that this is required by IEEE 754. $\endgroup$
    – Kaz
    Commented Mar 22, 2013 at 19:54
  • $\begingroup$ @Kaz Yes, I think it is. I said "many implementations" just because there are probably some non-conformant languages, as well as some languages that always throw an exception on division by zero. $\endgroup$ Commented Mar 22, 2013 at 20:01
13
$\begingroup$

For a number $x$, $-x$ denotes the unique $y$ such that $x+y=0$. In the case for $x=0$ we have that $-x=0$ as well.

$\endgroup$
7
$\begingroup$

Normally, given a number $a$, the number $-a$ is the additive inverse of $a$: i.e., $-a$ is the number that satisfies $a + (-a) = e$, where $e$ is the additive identity. Since $e + e = e$ by definition of an additive identity, we see that $e = -e$. In the case of $\Bbb{Z}$, $\Bbb{Q}$, $\Bbb{R}$, $\Bbb{C}$, and related objects, $0$ is the additive identity, so $0 = -0$.

$\endgroup$
1
$\begingroup$

Aha, computer science question!

This shows that a sign-magnitude (or one's complement) representation is being used, leading to two zeros with a different sign bit.

(I'm ducking under the desk now to avoid being struck by projectile office supplies).

$\endgroup$
1
$\begingroup$

In floating point arithmetic $0$ and $-0$ are different. If you take a positive number $x$ you will get $x/0=\infty$ and $x/(-0)=-\infty$.

$\endgroup$
1
$\begingroup$

To take the question (possibly a little too) literally, the difference between two numbers, $x$ and $y$ is given by $|x-y|$. Letting $x=0, y=-0$:

$$\begin{align*} |x-y| &= |0-(-0)| \\ &= |0+0| \\ &= |0| \\ &= 0 \end{align*}$$

So there's no difference between them at all :)

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .