- Zero-based numbering
Zero-based numbering is numbering in which the initial element of a sequence is assigned the index 0, rather than the index 1 as is typical in everyday circumstances. Under zero-based numbering, the initial element is sometimes termed the zeroth element, rather than the first element; zeroth is a coined ordinal number corresponding to the 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 not wide agreement regarding the correctness of using zero as an ordinal (nor regarding 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, in particular in combinatorics. In computer science, array indices also often start at 0, 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 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.
In computer programming
This usage follows from design choices embedded in many influential programming languages, including C, Java, and 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 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.
Referencing memory by an address and an offset is represented directly in 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 languages, and as such they had to have a correspondence to the usual ordinal numbers. Some recent languages, such as Lua, have adopted the same convention for the same reason.
Zero is the lowest unsigned integer value, one of the most fundamental types in programming and hardware design. In computer science, 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.
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 K&R. In recent years this trait has also been observed among many pure mathematicians, where many constructions are defined to be numbered from 0.
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.
One advantage of this convention is in the use of modular arithmetic as implemented in modern computers. Usually, the modulo function maps any integer modulo N to one of the numbers 0, 1, 2, ..., N − 1, where 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 at zero.
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. In this fairly typical scenario, it is quite common to want the address of the desired element. If the index numbers count from 1, the desired address is computed by this expression:
where s is the size of each element. In contrast, if the index numbers count from 0, the expression becomes this:
This simpler expression can be more efficient to compute in certain situations.
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:
Hence, the efficiency benefit of zero-based indexing is not inherent, but is an artifact of the decision to represent an array by the address of its first element.
A third advantage is that ranges are more elegantly expressed as the half-open interval, [0,n), as opposed to the closed interval, [1,n], because empty ranges often occur as input to algorithms (which would be tricky to express with the closed interval without resorting to obtuse conventions like [1,0]). On the other hand, closed intervals occur in mathematics because it is often necessary to calculate the terminating condition (which would be impossible in some cases because the half-open interval isn't always a closed set) which would have a subtraction by 1 everywhere.
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 n – 1 and referred to the nth element. For this reason, the first element is often referred to as the zeroth element to avoid confusion.
In mathematics, many sequences of numbers or of polynomials are indexed by nonnegative integers, for example the Bernoulli numbers and the Bell numbers.
The zeroth law of thermodynamics was formulated after the first, second, and third laws, but considered more fundamental, hence 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. 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.
In biological or medical experiments, initial measurements made before any experimental time has passed are said to be on the 0 day of the experiment.
In other 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 BC is followed by 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:2004 (where it coincides with the Gregorian year 1 BC) as well as in all Buddhist and Hindu calendars.
Some buildings in the British English speaking world refer to the ground floor as floor 0. This makes a consistent set with underground floors marked with negative numbers. Notice that, for buildings with subterranean stories, this labeling scheme is asymmetric. The asymmetry is apparent when the building has the same number of stories both above and below the street surface.
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 in D minor, even though it was actually written after Symphony No. 1 in C minor. There is an even earlier Symphony in F minor of Bruckner's that is sometimes called No. 00. The Russian composer Alfred Schnittke also wrote a Symphony No. 0.
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).
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."
Note also the use of 00 hours in the 24-hour clock as beginning of the day.
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.
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.
A chronological prequel of a series may be numbered as 0, such as Ring 0: Birthday or Zork Zero.
- Orders of approximation for "Zeroth-order approximation".
- This article was originally based on material from the Free On-line Dictionary of Computing, which is licensed under the GFDL.
- ^ Byrne, Richard W.. "The Thinking Ape: Evolutionary Origins of Intelligence.". http://www.drmillslmu.com/Evolpsyc/FALL2001/Panel5.htm. Retrieved 2010-05-18.
- ^ Dunbar, Robin. "The Human Story - A new history of mankind's Evolution". http://www.uboeschenstein.ch/texte/dunbar43.html. Retrieved 2010-05-18.
- Dijkstra, Edsger Wybe (May 2, 2008). "Why numbering should start at zero (EWD 831)". E. W. Dijkstra Archive. University of Texas at Austin. http://www.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/EWD831.html. Retrieved 2011-03-16.
Wikimedia Foundation. 2010.
Look at other dictionaries:
House numbering — [ Central European house number.] House numbering is the system of giving a unique number to each building in a street or area, with the intention of making it easier to locate a particular building. The house number is often part of a postal… … Wikipedia
Telephone numbering plan — Area Code redirects here. For the song by Ludacris, see Area Codes (song). A telephone numbering plan is a type of numbering scheme used in telecommunications to allocate telephone numbers to subscribers and to route telephone calls in a… … Wikipedia
Astronomical year numbering — is based on AD (Anno Domini)/CE (Common Era) year numbering, but follows normal decimal integer numbering more strictly. Thus, it has a year 0 and the years before that are designated with a minus sign − . The era designations BC (Before… … Wikipedia
North American Numbering Plan — NANPA redirects here. For other uses, see Nanpa (disambiguation). This article is about the numbering plan. For a list of area codes under the plan, see List of North American Numbering Plan area codes. The North American Numbering Plan (NANP) is … Wikipedia
0 (number) — Zero redirects here. For other uses, see Zero (disambiguation). 0 −1 0 1 2 3 4 5 6 7 8 … Wikipedia
Zeroth — The zeroth item is the initial item of a zero based sequence (that is, a sequence which is numbered beginning from zero rather than one), such as the non negative integers (see natural number).This kind of numbering is common in array references… … Wikipedia
Exit number — On a road with distance based exit numbering, the exit number (shown here on a gore sign) matches a nearby mile or kilometer marker … Wikipedia
National identification number — A national identification number, national identity number, or national insurance number is used by the governments of many countries as a means of tracking their citizens, permanent residents, and temporary residents for the purposes of work,… … Wikipedia
Array — In computer science an array [Paul E. Black, array , in Dictionary of Algorithms and Data Structures , Paul E. Black, ed., U.S. National Institute of Standards and Technology. 26 August 2008 (accessed 10 September 2008).… … Wikipedia
Array data type — Not to be confused with Array data structure. In computer science, an array type is a data type that is meant to describe a collection of elements (values or variables), each selected by one or more indices that can be computed at run time by the … Wikipedia