
Why counting should start at “zeroth” - cousin_it
We just had yet another big discussion of Dijkstra&#x27;s &quot;Why numbering should start at zero&quot;: https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=13186225<p>The mathematical arguments for zero-based indexing made sense to me as always, but I still couldn&#x27;t get over the fact that a[2] refers to the third element of the array. If truth is beauty, and beauty truth, then why does the mathematically beautiful idea disagree with common sense counting of fingers?<p>I thought about it for a while, and had a radical realization: Common sense counting is wrong. It should start with &quot;zeroth&quot; instead of &quot;first&quot;. It&#x27;s not just about programming, but even everyday things like &quot;my zeroth cigarette&quot;. The real world has tons of off-by-one errors that trip people up, that would go away if we consistently used &quot;zeroth&quot; to refer to the starting element of a sequence.<p>Here&#x27;s a powerful example:<p><i></i>&quot;The first year of the third millennium begins at 2001&#x2F;01&#x2F;01 00:00:00.&quot;<i></i><p>It&#x27;s confusing in so many ways!<p>* The year 2001 is in the third millennium?<p>* But the year 2000 isn&#x27;t?<p>* Hours start from 0, but days start from 1?<p>* Mommy, was there a zeroth year? When was Jesus born?<p>Now let&#x27;s see what would happen if we consistently counted everything from &quot;zeroth&quot;, from seconds to millennia:<p><i></i>&quot;The zeroth year of the second millennium begins at 2000&#x2F;00&#x2F;00 00:00:00.&quot;<i></i><p>Music to my mind.<p>Actually, when you think about it, one-based counting isn&#x27;t even consistent with itself! If you have a bunch of pigs with two-digit labels painted on their sides, then the first pig among the first ten pigs will be labeled 01, so the word &quot;first&quot; means simultaneously 0 and 1. With zero-based counting, the zeroth pig among the zeroth ten pigs would be labeled 00, and all would be right with the world. Not to mention easier to program.<p>What do you think, HN? Am I on to something here?
======
baldfat
Zero = nothing. 00:00 is midnight and is neither PM nor AM.

The only reason we have stupid 0 based indexing in programming is for looping.
Nothing important hangs on the things you are concerned about. Which
millennium doesn't really matter if it is confusing it is consistent.

