3

I noticed recently that both PHP and Qalculate! (a calculator) accept numbers like 00 or 00000 as meaning 0 (zero). I was curious if these are mathematically valid representations of zero or whether these programs are just sanitzing the input. The Wikipedia entry on zero was no help.

SpliFF
  • 133
  • 3
  • These are mathematically valid. Consider that any particular representation of $0$ is still zero: $$0+0=0\cdot 10^n+0\cdot 10^{n-1}+\dots+0\cdot 10^2+0\cdot 10+0=0$$ and this holds for any base other than ten as well. – abiessu Nov 22 '13 at 02:15
  • 1
    Simular as $2.5 = 2.50 = 2.5000....0000$, which is more common in real-life and math situations – Stefan4024 Nov 22 '13 at 02:20
  • Multiple $0s$ are mathematical valid representation for zero. However, in a lot of programming languages, numeric string begins with zero will be interpreted as an octal number, i.e. a number written in a base of $8$. e.g. $011$ means the decimal number $9$. – achille hui Nov 22 '13 at 03:18
  • Confirmed, PHP also interpret number string begins with zero as an octal. – achille hui Nov 22 '13 at 03:23

1 Answers1

0

Yes, in most contexts we would consider $00$, $000$, $0000$, etc. to be valid representations of $0$. We could even write $0$ as $$ \ldots 000 $$ with infinitely many $0$s to the left.

To see why this is OK, consider the question: what is the $1000$s digit of $3$? The answer is not that it does not exist. The answer is that the $1000$s digit is $0$. We just usually don't write the $1000$s digit, because it is more concise to leave off the leading $0$s. Similarly, the $1$s digit, the $10$s digit, the $100$s digit, and the $1000$s digit of $0$, and so on, are all equal to the digit $0$.