Zero-based numbering: Difference between revisions

Content deleted Content added
Add missing comma
Computer programming: Add anchor in header
 
(233 intermediate revisions by more than 100 users not shown)
Line 1:
{{Short description|Counting from "0" instead of "1" first}}
{{Refimprove|date=March 2010}}
{{Use American English|date=January 2019}}
 
'''Zero-based numbering''' is a way of [[numbering]] in which the initial element of a [[sequence]] is assigned the index[[Indexed family|index]]&nbsp;0, rather than the index &nbsp;1 as is typical in everyday non-mathematical or non-programming circumstances. Under zero-based numbering, the initial element is sometimes termed the ''[[0th0|''zeroth'']]'' element,<ref>{{cite book |last1=M. Seed |first1=Graham |title=An Introduction to Object-Oriented Programming in C++ with Applications in Computer Graphics |date=1965 |publisher=Springer |___location=British Library |isbn=1852334509 |page=391 |edition=2nd |url=https://books.google.com/books?id=_lqj98AsnGAC&q=zeroth+element&pg=PA391 |access-date=11 February 2020}}</ref> rather than the ''first'' element; ''zeroth'' is a [[word coinage|coined]] word for the [[ordinal number (linguistics)|ordinal number]] corresponding to the number [[0 (number)|zero]]. In some cases, an object or value that does not (originally) belong to a given sequence, but which could be naturally placed before its initial element, may be termed the zeroth element. There is notno wide agreement regarding the correctness of using zero as an ordinal (nor regarding the use of the term ''zeroth''), as it creates ambiguity for all subsequent elements of the sequence when lacking context.
 
Numbering sequences starting at 0 is quite common in mathematics notation, in particular in [[combinatorics]], though programming languages for mathematics usually index from&nbsp;1.<ref>{{cite web |url=https://www.mathworks.com/company/newsletters/articles/matrix-indexing-in-matlab.html |title=Matrix Indexing in MATLAB |access-date=23 February 2021 |author=Steve Eddins and Loren Shure}}</ref><ref>{{cite web |url=https://reference.wolfram.com/language/howto/GetElementsOfLists.html |title=How to : Get Elements of Lists |access-date=23 February 2021 |publisher=Wolfram}}</ref><ref>{{cite web |url=https://www.maplesoft.com/support/help/maple/view.aspx?path=rtable_indexing |title=Indexing Arrays, Matrices, and Vectors |access-date=23 February 2021 |publisher=Maplesoft}}</ref> In [[computer science]], [[Array data structure|array]] indices also oftenusually start at 0 in modern programming languages, so computer programmers might use ''zeroth'' in situations where others might use ''first'', and so forth. In some mathematical contexts, zero-based numbering can be used without confusion, when ordinal forms have well established meaning with an obvious candidate to come before ''first''; for instance, a ''zeroth derivative'' of a function is the function itself, obtained by [[derivative|differentiating]] zero times. Such usage corresponds to naming an element not properly belonging to the sequence but preceding it: the zeroth derivative is not really a derivative at all. However, just as the ''first derivative'' precedes the ''second derivative'', so also does the ''zeroth derivative'' (or the original function itself) precede the ''first derivative''.
 
== Computer programming <span class="anchor" id="ASCII"></span> <span class="anchor" id="Computer programming"></span> ==
== In computer programming ==
 
=== Origin ===
This usage follows from design choices embedded in many influential [[programming language]]s, including [[C (programming language)|C]], [[Java (programming language)|Java]], and [[Lisp programming language|Lisp]]. In these three, sequence types (C arrays, Java arrays and lists, and Lisp lists and vectors) are indexed beginning with the zero subscript. Particularly in C, where arrays are closely tied to [[pointer (computer programming)|pointer]] arithmetic, this makes for a simpler implementation: the subscript refers to an offset from the starting position of an array, so the first element has an offset of zero.
[[Martin Richards (computer scientist)|Martin Richards]], creator of the [[BCPL]] language (a precursor of [[C (programming language)|C]]), designed arrays initiating at 0 as the natural position to start accessing the array contents in the language, since the value of a [[pointer (computer programming)|pointer]] ''p'' used as an address accesses the position {{nowrap|''p'' + 0}} in memory.<ref>{{cite book |url=http://cm.bell-labs.com/cm/cs/who/dmr/bcpl.pdf |title=The BCPL Reference Manual |publisher=Massachusetts Institute of Technology |author=Martin Richards |year=1967 |page=11 |archive-date=2013-01-20 |access-date=2014-01-28 |archive-url=https://web.archive.org/web/20130120134910/http://cm.bell-labs.com/cm/cs/who/dmr/bcpl.pdf |url-status=dead }}</ref><ref name="mikehoye">{{cite web |url=http://exple.tive.org/blarg/2013/10/22/ |title=Cita{{not a typo|tion Nee}}ded |access-date=28 January 2014 |author=Mike Hoye}}</ref> BCPL was first compiled for the [[IBM&nbsp;7094]]; the language introduced no [[Run time (program lifecycle phase)|run-time]] [[indirection lookup]]s, so the indirection optimization provided by these arrays was done at compile time.<ref name="mikehoye"/> The optimization was nevertheless important.<ref name="mikehoye"/><ref>{{cite web |url=https://www.multicians.org/thvv/7094.html |title=The IBM 7094 and CTSS |date=1995 |access-date=28 January 2014 |author=Tom Van Vleck}}</ref>
 
In 1982 [[Edsger W. Dijkstra]] in his pertinent note ''Why numbering should start at zero''<ref name="dijkstra"/> argued that arrays subscripts should start at zero as the latter being the most [[natural number]]. Discussing possible designs of array ranges by enclosing them in a chained inequality, combining sharp and standard inequalities to four possibilities, demonstrating that to his conviction zero-based arrays are best represented by non-overlapping index ranges, which start at zero, alluding to [[Interval (mathematics)#Definitions|open, half-open and closed intervals]] as with the real numbers. Dijkstra's criteria for preferring this convention are in detail that it represents empty sequences in a more natural way {{nowrap|(''a'' ≤ ''i'' < ''a'' ?)}} than closed "intervals" ({{nowrap|''a'' ≤ ''i'' ≤ (''a'' − 1) ?}}), and that with half-open "intervals" of naturals, the length of a sub-sequence equals the upper minus the lower bound ({{nowrap|''a'' ≤ ''i'' < ''b''}} gives {{nowrap|(''b'' − ''a'')}} possible values for ''i'', with ''a'', ''b'', ''i'' all integers).
Referencing memory by an address and an offset is represented directly in [[computer hardware]] on virtually all computer architectures, so this design detail in C makes compilation easier, at the cost of some human factors. In this context using "zeroth" as an ordinal is not strictly correct, but professional shorthand. Older programming languages, such as [[Fortran]] or [[COBOL]] have array subscripts starting with one, because they were meant as [[high-level programming language]]s, and as such they had to have a correspondence to the usual [[ordinal number (linguistics)|ordinal numbers]]. Some recent languages, such as [[Lua (programming language)|Lua]], have adopted the same convention for the same reason.
 
=== {{Anchor|OFFSET}}Usage in programming languages ===
Zero is the lowest unsigned integer value, one of the most fundamental types in programming and hardware design. In computer science, [[0 (number)|zero]] is thus often used as the base case for many kinds of numerical [[recursion]]. Proofs and other sorts of mathematical reasoning in computer science often begin with zero. For these reasons, in computer science it is not unusual to number from zero rather than one.
 
{{See also|Comparison of programming languages (array)#Array dimensions}}
Hackers and computer scientists often like to call the first chapter of a publication "Chapter 0", especially if it is of an introductory nature. One of the classic instances was in the First Edition of [[The C Programming Language (book)|K&amp;R]]. In recent years this trait has also been observed among many [[pure mathematics|pure mathematicians]], where many constructions are defined to be numbered from 0.
 
This usage follows from design choices embedded in many influential [[programming language]]s, including [[C (programming language)|C]], [[Java (programming language)|Java]], and [[Lisp programming language|Lisp]]. In these three, sequence types (C arrays, Java arrays and lists, and Lisp lists and vectors) are indexed beginning with the zero subscript. Particularly in C, where arrays are closely tied to [[pointer (computer programming)|pointer]] arithmetic, this makes for a simpler implementation: the subscript refers to an offset from the starting position of an array, so the first element has an offset of zero.
If an array is used to represent a cycle, it is convenient to obtain the index with a [[modulo operator]], which can result in zero.
 
Referencing memory by an address and an offset is represented directly in [[computer hardware]] on virtually all computer architectures, so this design detail in C makes compilation easier, at the cost of some human factors. In this context using "zeroth" as an ordinal is not strictly correct, but a widespread habit in this profession. Some programming languages, such as [[Fortran]] or [[COBOL]], have array subscripts starting with one, because they were meant as [[high-level programming language]]s, and as such they had to have a correspondence to the usual [[ordinal number (linguistics)|ordinal numbers]] which predate the [[0|invention of the zero]] by a long time. And some programming languages, e.g., [[Ada (programming language)|Ada]], [[ALGOL 60]], [[PL/I]], allow an arbitrary lower bound for each index.
===Advantages===
Zero-based indexing may have an advantage to one-based indexing in reducing [[Off-by-one error|off-by-one]] or [[fencepost error]]s.<ref>{{cite web|url=http://www.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/EWD831.html|title=Why numbering should start at zero (EWD 831)|last=Dijkstra|first=Edsger Wybe|date=May 2, 2008|work=E. W. Dijkstra Archive|publisher=[[University of Texas at Austin]]|accessdate=2011-03-16}}</ref>
 
[[Pascal (programming language)|Pascal]] allows the range of an array to be of any ordinal type (including enumerated types) and Ada allows any discrete subtype. [[APL (programming language)|APL]] allows setting the index origin to 0 or 1 during runtime programmatically.<ref>{{cite journal |last1=Brown |first1=Jim |title=In Defense of Index Origin 0 |journal=ACM SIGAPL APL Quote Quad |date=December 1978 |volume=9 |issue=2 |page=7 |doi=10.1145/586050.586053 |s2cid=40187000}}</ref><ref>{{cite web |last1=Hui |first1=Roger |title=Is Index Origin 0 a Hindrance? |url=https://www.jsoftware.com/papers/indexorigin.htm |website=jsoftware.com |publisher=JSoftware |access-date=19 January 2015}}</ref> Some recent languages, such as [[Lua (programming language)|Lua]] and [[Visual Basic]], have adopted the same convention for the same reason.
Another advantage of this convention is in the use of [[modular arithmetic]] as implemented in modern computers. Usually, the [[modulo operation|modulo function]] maps any integer modulo ''N'' to one of the numbers 0, 1, 2, ..., {{nowrap|''N'' − 1}}, where {{nowrap|''N'' ≥ 1}}. Because of this, many formulas in algorithms (such as that for calculating hash table indices) can be elegantly expressed in code using the modulo operation when array indices start at zero.
 
Zero is the lowest unsigned integer value, one of the most fundamental types in programming and hardware design. In computer science, [[0 (number)|zero]] is thus often used as the base case for many kinds of numerical [[recursion]]. Proofs and other sorts of mathematical reasoning in computer science often begin with zero. For these reasons, in computer science it is not unusual to number from zero rather than one.
A second advantage of zero-based array indexes is that this can improve efficiency under certain circumstances. To illustrate, suppose ''a'' is the [[memory address]] of the first element of an array, and ''i'' is the index of the desired element. To compute the address of the desired element, if the index numbers count from 1, the desired address is computed by this expression:
 
If an array is used to represent a cycle, it is convenient to obtain the index with a [[modulo operator|modulo function]], which can result in zero.
:''a'' + ''s'' × (''i'' − 1)
 
=== Numerical properties ===
where ''s'' is the size of each element. In contrast, if the index numbers count from 0, the expression becomes:
With zero-based numbering, a range can be expressed as the half-open [[Interval (mathematics)|interval]], {{math|[0, ''n'')}}, as opposed to the closed interval, {{math|[1, ''n'']}}. Empty ranges, which often occur in algorithms, are tricky to express with a closed interval without resorting to obtuse conventions like {{math|[1, 0]}}. Because of this property, zero-based indexing potentially reduces [[Off-by-one error|off-by-one]] and [[fencepost error]]s.<ref name="dijkstra">{{cite web |url=https://www.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/EWD831.html |title=Why numbering should start at zero (EWD 831) |last=Dijkstra |first=Edsger Wybe |author-link=Edsger W. Dijkstra |date=May 2, 2008 |work=E. W. Dijkstra Archive |publisher=[[University of Texas at Austin]] |access-date=2011-03-16}}</ref> On the other hand, the repeat count {{mvar|n}} is calculated in advance, making the use of counting from 0 to {{math|''n'' − 1}} (inclusive) less intuitive. Some authors prefer one-based indexing, as it corresponds more closely to how entities are indexed in other contexts.<ref>Programming Microsoft® Visual C# 2005 by Donis Marshall.</ref>
 
Another property of this convention is in the use of [[modular arithmetic]] as implemented in modern computers. Usually, the [[modulo operation|modulo function]] maps any integer modulo {{mvar|N}} to one of the numbers {{math|0, 1, 2, ..., ''N'' − 1}}, where {{math|''N'' ≥ 1}}. Because of this, many formulas in algorithms (such as that for calculating hash table indices) can be elegantly expressed in code using the modulo operation when array indices start at zero.
:''a'' + ''s'' × ''i''
 
Pointer operations can also be expressed more elegantly on a zero-based index due to the underlying address/offset logic mentioned above. To illustrate, suppose {{mvar|a}} is the [[memory address]] of the first element of an array, and {{mvar|i}} is the index of the desired element. To compute the address of the desired element, if the index numbers count from 1, the desired address is computed by this expression:
This simpler expression is more efficient to compute at [[run time (program lifecycle phase)|run time]] in a simple context.
 
: <math>a + s \times (i-1),</math>
Note, however, that a language wishing to index arrays from 1 could simply adopt the convention that every "array address" is represented by ''a''′ = ''a'' – ''s''; that is, rather than using the address of the first array element, such a language would use the address of an "imaginary" element located immediately before the first actual element. The indexing expression for a 1-based index would be the following:
 
where {{mvar|s}} is the size of each element. In contrast, if the index numbers count from 0, the expression becomes
:''a''′ + ''s'' × ''i''
 
: <math>a + s \times i.</math>
Hence, the efficiency benefit at run time of zero-based indexing is not inherent, but is an artifact of the decision to represent an array with the address of its first element rather than the address of the "imaginary" element preceding the array. However, the address of that "imaginary" element located immediately before the first actual element of the array could very well be the address of some other item in memory not related to the array.
 
This simpler expression is more efficient to compute at [[run time (program lifecycle phase)|run time]].
A third property is that a range is more elegantly expressed as the half-open [[Interval (mathematics)|interval]], [0,''n''), as opposed to the closed interval, [1,''n'']. Empty ranges, which often occur in algorithms, are tricky to express with a closed interval without resorting to obtuse conventions like [1,0]. This half-open convention may avoid [[off-by-one error]]s or [[fencepost error]]s. On the other hand, often the repeat count ''n'' is calculated in advance, making the use of counting from 0 to ''n''−1 (inclusive) less intuitive.
 
However, a language wishing to index arrays from 1 could adopt the convention that every array address is represented by {{math|1=''a''′ = ''a'' – ''s''}}; that is, rather than using the address of the first array element, such a language would use the address of a fictitious element located immediately before the first actual element. The indexing expression for a 1-based index would then be
This situation can lead to some confusion in terminology. In a zero-based indexing scheme, the first element is "element number zero"; likewise, the twelfth element is "element number eleven". Therefore, an analogy from the ordinal numbers to the quantity of objects numbered appears; the highest index of ''n'' objects will be {{nowrap|''n'' − 1}} and referred to the ''n''th element. For this reason, the first element is often referred to as the ''[[zeroth]]'' element to avoid confusion.
 
: <math>a' + s \times i.</math>
===Disadvantages===
Some believe{{weasel word|date=November 2013}} that zero-based indexing actually causes more off-by-one errors than it eliminates, especially among new programmers. <ref>Programming Microsoft® Visual C#® 2005 by Donis Marshall</ref>
 
Hence, the efficiency benefit at run time of zero-based indexing is not inherent, but is an artifact of the decision to represent an array with the address of its first element rather than the address of the fictitious zeroth element. However, the address of that fictitious element could very well be the address of some other item in memory not related to the array.
== In science ==
 
Superficially, the fictitious element doesn't scale well to multidimensional arrays. Indexing multidimensional arrays from zero makes a naive (contiguous) conversion to a linear address space (systematically varying one index after the other) look simpler than when indexing from one. For instance, when mapping the three-dimensional array {{math|A[''P''][''N''][''M'']}} to a linear array {{math|L[''M⋅N⋅P'']}}, both with {{mvar|M ⋅ N ⋅ P}} elements, the index {{mvar|r}} in the linear array to access a specific element with {{math|L[''r''] {{=}} A[''z''][''y''][''x'']}} in zero-based indexing, i.e. {{math|[0 ≤ ''x'' < ''P'']}}, {{math|[0 ≤ ''y'' < ''N'']}}, {{math|[0 ≤ ''z'' < ''M'']}}, and {{math|[0 ≤ ''r'' < ''M ⋅ N ⋅ P'']}}, is calculated by
In [[mathematics]], many sequences of numbers or of [[polynomials]] are indexed by nonnegative integers, for example the [[Bernoulli numbers]] and the [[Bell numbers]].
:<math>r = z \cdot M \cdot N + y \cdot M + x.</math>
Organizing all arrays with 1-based indices ({{math|[1 ≤ ''x′'' ≤ ''P'']}}, {{math|[1 ≤ ''y′'' ≤ ''N'']}}, {{math|[1 ≤ ''z′'' ≤ ''M'']}}, {{math|[1 ≤ ''r′'' ≤ ''M ⋅ N ⋅ P'']}}), and assuming an analogous arrangement of the elements, gives
:<math>r' = (z'-1) \cdot M \cdot N + (y'-1) \cdot M + (x'-0)</math>
to access the same element, which arguably looks more complicated. Of course, {{math|''r''′ {{=}} ''r'' + 1,}} since {{math|[''z'' {{=}} ''z''′ – 1],}} {{math|[''y'' {{=}} ''y''′ – 1],}} and {{math|[''x'' {{=}} ''x''′ – 1].}} A simple and everyday-life example is [[positional notation]], which the invention of the zero made possible. In positional notation, tens, hundreds, thousands and all other digits start with zero, only units start at one.<ref>{{cite AV media | url=https://www.khanacademy.org/math/cc-1st-grade-math/cc-1st-place-value | title= Math 1st Grade / Place Value / Number grid | quote=Youtube title: Number grid / Counting / Early Math / Khan Academy | publisher=Khan Academy | author = Sal Khan | access-date = July 28, 2018}}.</ref>
 
<div><ul>
<li style="display: inline-table;">
{| class="wikitable"
|+ ''Zero''-based indices
|-
! {{diagonal split header|{{mvar|y}} | {{mvar|x}}}} !! 0 !! 1 !! 2 !! .. !! {{tmath|1=x = x' - 1}} !! .. !! 8 !! 9
|-
! scope="row" | 0
| {{gray|0}}0 || {{gray|0}}1 || {{gray|0}}2 || || || || {{gray|0}}8 || {{gray|0}}9
|-
! scope="row" | 1
| 10 || 11 || 12 || || || || 18 || 19
|-
! scope="row" | 2
| 20 || 21 || 22 || || || || 28 || 29
|-
! scope="row" | ..
| || || || || || || ||
|-
! scope="row" | {{tmath|1=y = y' - 1}}
| || || || || {{tmath|1=y \cdot M + x}} || || ||
|-
! scope="row" | ..
| || || || || || || ||
|-
! scope="row" | 8
| 80 || 81 || 82 || || || || 88 || 89
|-
! scope="row" | 9
| 90 || 91 || 92 || || || || 98 || 99
|-
| colspan="9" style="text-align: center;"| The table content represents the index {{mvar|r}}.
|} </li>&emsp;
<li style="display: inline-table;">
{| class="wikitable"|
|+ ''One''-based indices
|-
! {{diagonal split header|{{mvar|y'}} | {{mvar|x'}}}} !! 1 !! 2 !! 3 !! .. !! {{tmath|1=x' = x + 1}} !! .. !! 9 !! 10
|-
! scope="row" | 1
| {{gray|0}}1 || {{gray|0}}2 || {{gray|0}}3 || || || || {{gray|0}}9 || 10
|-
! scope="row" | 2
| 11 || 12 || 13 || || || || 19 || 20
|-
! scope="row" | 3
| 21 || 22 || 23 || || || || 29 || 30
|-
! scope="row" | ..
| || || || || || || ||
|-
! scope="row" | {{tmath|1=y' = y + 1}}
| || || || || {{tmath|1=(y'-1) \cdot M + x'}} || || ||
|-
! scope="row" | ..
| || || || || || || ||
|-
! scope="row" | 9
| 81 || 82 || 83 || || || || 89 || 90
|-
! scope="row" | 10
| 91 || 92 || 93 || || || || 99 || 100
|-
| colspan="9" style="text-align: center;"| The table content represents the index {{mvar|r′}}.
|}</li>
</ul></div>
 
This situation can lead to some confusion in terminology. In a zero-based indexing scheme, the first element is "element number zero"; likewise, the twelfth element is "element number eleven". Therefore, an analogy from the ordinal numbers to the quantity of objects numbered appears; the highest index of {{mvar|n}} objects will be {{math|''n'' − 1}}, and it refers to the {{mvar|n}}th element. For this reason, the first element is sometimes referred to as the [[array data structure|zeroth]] element, in an attempt to avoid confusion.
 
== Science ==
In [[mathematics]], many sequences of numbers or of [[polynomials]] are indexed by nonnegative integers, for example, the [[Bernoulli numbers]] and the [[Bell numbers]].
 
In both [[mechanics]] and [[statistics]], the zeroth [[moment (mathematics)|moment]] is defined, representing total mass in the case of physical [[density]], or total probability, i.e. one, for a [[probability distribution]].
 
The ''[[zeroth law of thermodynamics]]'' was formulated after the first, second, and third laws, but considered more fundamental, thus its name.
 
In biology, an organism is said to have zero -order intentionality if it shows "no intention of anything at all". This would include a situation where the organism's genetically predetermined phenotype results in a fitness benefit to itself, because it did not "intend" to express its genes.<ref name="Byrne, Richard W.">{{cite web |url=httphttps://www.drmillslmu.com/Evolpsyc/FALL2001/Panel5.htm |title=The Thinking Ape: Evolutionary Origins of Intelligence. |accessdateaccess-date=2010-05-18 |author=Byrne, Richard W.}}</ref> In the similar sense, a computer may be considered from this perspective a zero -order intentional entity, as it does not "intend" to express the code of the programs it runs.<ref name="Dunbar, Robin">{{cite web |url=httphttps://www.uboeschenstein.ch/texte/dunbar43.html |title=The Human Story - A new history of mankind's Evolution |accessdateaccess-date=2010-05-18 |author=Dunbar, Robin |archive-date=2010-08-27 |archive-url=https://web.archive.org/web/20100827171311/http://www.uboeschenstein.ch/texte/dunbar43.html |url-status=dead }}</ref>
 
In biological or medical experiments, initialthe measurementsfirst madeday beforeof anyan experimentalexperiment timeis hasoften passednumbered areas said to be on theday 0.<ref>{{cite daybook|title=Modern ofBiology|first=Albert|last=Towle|publisher=Holt the experiment.McDougal|year=1989|isbn=9780030139277|page=35}}</ref>
 
Patient zero (or [[index case]]) is the initial [[patient]] in the [[sample (statistics)|population sample]] of an [[epidemiology|epidemiological]] investigation.
 
== In otherOther fields ==
The [[year zero]] does not exist in the widely used [[Gregorian calendar]] or in its predecessor, the [[Julian calendar]]. Under those systems, the year [[1&nbsp;BC]] is followed by [[AD&nbsp;1]]. However, there is a year zero in [[astronomical year numbering]] (where it coincides with the Julian year 1&nbsp;BC) and in [[ISO 8601|ISO&nbsp;8601:2004]] (where it coincides with the Gregorian year 1&nbsp;BC), as well as in all [[Buddhist calendar|Buddhist]] and [[Hindu calendar]]s.
In the realm of fiction, [[Isaac Asimov]] eventually added a Zeroth Law to his [[Three Laws of Robotics]], essentially making them four laws.
 
In many countries, the [[Storey#European scheme 2|ground floor]] in buildings is considered as floor number&nbsp;0 rather than as the "1st&nbsp;floor", the naming convention usually found in the United States of America. This makes a consistent set with underground floors marked with negative numbers.
The [[year zero]] does not exist in the widely used [[Gregorian calendar]] or in its predecessor, the [[Julian calendar]]. Under those systems, the year [[1 BC]] is followed by [[1|AD 1]]. However, there is a year zero in [[astronomical year numbering]] (where it coincides with the Julian year 1 BC) and in [[ISO 8601|ISO 8601:2004]] (where it coincides with the Gregorian year 1 BC) as well as in all [[Buddhist calendar|Buddhist]] and [[Hindu calendar]]s.
 
While the ordinal of 0 mostly finds use in communities directly connected to mathematics, physics, and computer science, there are also instances in classical music. The composer [[Anton Bruckner]] regarded his early ''Symphony in D minor'' to be unworthy of including in the canon of his works, and he wrote {{lang|de|gilt nicht}} ("doesn't count") on the score and a circle with a crossbar, intending it to mean "invalid". But posthumously, this work came to be known as [[Symphony No. 0 (Bruckner)|''Symphony No.&nbsp;0 in D minor'']], even though it was actually written after [[Symphony No. 1 (Bruckner)|''Symphony No.&nbsp;1 in C minor'']]. There is an even earlier ''Symphony in F minor'' of Bruckner's, which is sometimes called [[Symphony No. 00 (Bruckner)|''No.&nbsp;00'']]. The Russian composer [[Alfred Schnittke]] also wrote a [[Symphony No. 0 (Schnittke)|Symphony No.&nbsp;0]].
In many European countries the "1st floor" is not at ground level but at the [[Storey#Numbering|next level above it]]. In countries that use this system, the floor at ground level is usually referred to by a [[Storey#European_scheme|special name]], usually translating as "Ground Floor" or equivalent. Some buildings even refer to the [[Storey#European scheme 2|ground floor]] as floor number 0. This makes a consistent set with underground floors marked with negative numbers. Notice that, for buildings with subterranean [[storeys|stories]], this labeling scheme can be seen as asymmetric. The asymmetry is apparent when the building has the same number of stories both above and below the street surface; it can be resolved by viewing the index as the number of flights of stairs which must be traversed to reach that floor from ground level.
 
In some universities, including Oxford and Cambridge, "week&nbsp;0" or occasionally "noughth week" refers to the week before the first week of lectures in a term. In Australia, some universities refer to this as "O&nbsp;week", which serves as a pun on "[[orientation week]]". As a parallel, the introductory weeks at university educations in [[Sweden]] are generally called {{lang|sv|nollning}} (zeroing).
While the ordinal of 0 is rarely used outside of communities closely connected to mathematics, physics, and computer science, there are a few instances in classical music. The composer [[Anton Bruckner]] regarded his early ''Symphony in D minor'' to be unworthy of including in the canon of his works, and he wrote 'gilt nicht' on the score and a circle with a crossbar, intending it to mean "invalid". But posthumously, this work came to be known as [[Symphony No. 0 (Bruckner)|''Symphony No. 0 in D minor'']], even though it was actually written after [[Symphony No. 1 (Bruckner)|''Symphony No. 1 in C minor'']]. There is an even earlier ''Symphony in F minor'' of Bruckner's that is sometimes called [[Symphony No. 00 (Bruckner)|''No. 00'']]. The Russian composer [[Alfred Schnittke]] also wrote a Symphony No. 0.
 
The [[United States Air Force]] starts basic training each Wednesday, and the first week (of eight) is considered to begin with the following Sunday. The four days before that Sunday are often referred to as "zero week".
In some universities, including Oxford and Cambridge, "week 0" or occasionally "noughth week" refers to the week before the first week of lectures in a term. In Australia, some universities refer to this as "O Week", which serves as a pun on "[[orientation week]]". As a parallel, the introductory weeks at university educations in [[Sweden]] are generally called "nollning" (zeroing).
 
[[24-hour clock]]s and the international standard [[ISO&nbsp;8601]] use 0 to denote the first (zeroth) hour of the day, consistent with using the 0 to denote the first (zeroth) minute of the hour and the first (zeroth) second of the minute. Also, the [[12-hour clock]]s used in [[Date and time notation in Japan|Japan]] use 0 to denote the hour immediately after midnight and noon in contrast to 12 used elsewhere, in order to avoid confusion [[12-hour clock#Confusion at noon and midnight|whether 12&nbsp;a.m. and 12&nbsp;p.m. represent noon or midnight]].
The [[United States Air Force]] starts basic training each Wednesday, and the first week (of eight) is considered to begin with the following Sunday. The four days before that Sunday are often referred to as "Zero Week."
 
[[Robert Crumb]]'s drawings for the first issue of ''[[Zap Comix]]'' were stolen, so he drew a whole new issue, which was published as issue&nbsp;1. Later he re-inked his photocopies of the stolen artwork and published it as issue&nbsp;0.
Note also the use of 00 hours in the 24-hour clock as beginning of the day.
 
The [[Brussels ring]] road in Belgium is numbered R0. It was built after the ring road around [[Antwerp]], but Brussels (being the capital city) was deemed deserving of a more basic number. Similarly the (unfinished) orbital motorway around [[Budapest]] in Hungary is called [[M0 motorway|M0]].
In [[King's Cross Station|London King's Cross]], [[Uppsala]], [[Yonago]], [[Haymarket railway station|Edinburgh Haymarket]], [[Stockport railway station|Stockport]] and [[Cardiff Central station|Cardiff]] the train stations have a [[Railway platform|platform]] 0.
 
Zero is sometimes used [[House numbering|in street addresses]], especially in schemes where even numbers are one side of the street and odd numbers on the other. A case in point is [[Christ Church (Cambridge, Massachusetts)|Christ Church]] on [[Harvard Square]], whose address is 0&nbsp;Garden Street.
[[Robert Crumb]]'s drawings for the first issue of ''[[Zap Comix]]'' were stolen, so he drew a whole new issue which was published as issue 1. Later he re-inked his photocopies of the stolen artwork and published it as issue 0.
 
Formerly in [[Formula One]], when a defending world champion did not compete in the following season, the number&nbsp;1 was not assigned to any driver, but one driver of the world champion team would carry the number&nbsp;0, and the other, number&nbsp;2. This did happen both in 1993 and 1994 with [[Damon Hill]] carrying the number 0 in both seasons, as defending champion [[Nigel Mansell]] quit after 1992, and defending champion [[Alain Prost]] quit after 1993. However, in 2014 the series moved to drivers carrying career-long personalised numbers, instead of team-allocated numbers, other than the defending champion still having the option to carry number 1. Therefore 0 is no longer used in this scenario. It is not clear if it is available as a driver's chosen number, or whether they must be between 2 and 99, but it has not been used to date under this system.
The [[ring road]] around [[Brussels]] is called R0. It was built after the ring road around [[Antwerp]], but Brussels (being the capital city) was deemed deserving of a more basic number.
 
Some team sports allow 0 to be chosen as a player's [[uniform number]] (in addition to the typical range of 1-99). The NFL voted to allow this from 2023 onwards.
 
A chronological prequel of a series may be numbered as 0, such as ''[[Ring&nbsp;0: Birthday]]'' or ''[[Zork Zero]]''.
 
The [[Swiss Federal Railways]] number certain classes of rolling stock from zero, for example, [[SBB-CFF-FFS Re 460|Re&nbsp;460]] 000 to 118.
 
In the realm of fiction, [[Isaac Asimov]] eventually added a Zeroth Law to his [[Three Laws of Robotics]], essentially making them four laws.
 
A standard [[roulette]] wheel contains the number 0 as well as 1-36. It appears in green, so is classed as neither a "red" nor "black" number for betting purposes. The card game [[Uno (card game)|Uno]] has number cards running from 0 to 9 along with special cards, within each coloured suit.
In Formula One, when a defending world champion does not compete in the following season, the number 1 is not assigned to any driver, but one driver of the world champion team will carry the number 0, and the other, number 2. This did happen both in 1993 and 1994 with Damon Hill carrying the number 0 in both seasons, as defending champion Nigel Mansell quit after 1992, and defending champion Alain Prost quit after 1993.
 
The [[Free_software#Definition|Four Essential Freedoms of Free Software]] are numbered starting from zero. This is for historical reasons: the list originally had only three freedoms, and when the fourth was added it was placed in the zeroth position as it was considered more basic.
A chronological prequel of a series may be numbered as 0, such as ''[[Ring 0: Birthday]]'' or ''[[Zork Zero]]''.
 
== See also ==
The [[Swiss Federal Railways]] number certain classes of rolling stock from zero, for example [[SBB-CFF-FFS Re 460|Re 460]] 000 to 118.
* [[Zeroth-order approximation]]
* [[Off-by-one error]]
 
==See alsoReferences ==
=== Citations ===
*[[Zeroth order approximation]]
{{Reflist}}
 
==References= Sources ===
:{{FOLDOCrefbegin}}
* This article incorporates material taken from [http://foldoc.org/zeroth zeroth] at the [[Free On-line Dictionary of Computing]] prior to 1 November 2008 and incorporated under the "relicensing" terms of the [[GNU Free Documentation License|GFDL]], version 1.3 or later.
{{reflist}}
{{refend}}
 
[[Category:Ordinal numbers]]
[[Category:Zero0 (number)]]