In Computer Science
The most common practice throughout human history has been to start counting at one, and this is the practice in early classic computer science programming languages such as Fortran and COBOL. However, in the late 1950s LISP introduced zero-based numbering for arrays while Algol 58 introduced completely flexible basing for array subscripts (allowing any positive, negative, or zero integer as base for array subscripts), and most subsequent programming languages adopted one or other of these positions. For example, the elements of an array are numbered starting from 0 in C, so that for an array of n items the sequence of array indices runs from 0 to n−1. This permits an array element's location to be calculated by adding the index directly to address of the array, whereas 1 based languages precalculate the array's base address to be the position one element before the first.
There can be confusion between 0 and 1 based indexing, for example Java's JDBC indexes parameters from 1 although Java itself uses 0-based indexing.
In databases, it is possible for a field not to have a value. It is then said to have a null value. For numeric fields it is not the value zero. For text fields this is not blank nor the empty string. The presence of null values leads to three-valued logic. No longer is a condition either true or false, but it can be undetermined. Any computation including a null value delivers a null result. Asking for all records with value 0 or value not equal 0 will not yield all records, since the records with value null are excluded.
A null pointer is a pointer in a computer program that does not point to any object or function. In C, the integer constant 0 is converted into the null pointer at compile time when it appears in a pointer context, and so 0 is a standard way to refer to the null pointer in code. However, the internal representation of the null pointer may be any bit pattern (possibly different values for different data types).
In mathematics, both −0 and +0 represent exactly the same number, i.e., there is no "negative zero" distinct from zero. In some signed number representations (but not the two's complement representation used to represent integers in most computers today) and most floating point number representations, zero has two distinct representations, one grouping it with the positive numbers and one with the negatives; this latter representation is known as negative zero.
Read more about this topic: 0 (number)
Famous quotes containing the words computer and/or science:
“The archetype of all humans, their ideal image, is the computer, once it has liberated itself from its creator, man. The computer is the essence of the human being. In the computer, man reaches his completion.”
—Friedrich Dürrenmatt (19211990)
“... my one aim and concentrated purpose shall be and is to show that women can learn, can reason, can compete with men in the grand fields of literature and science ... that a woman can be a woman and a true one without having all her time engrossed by dress and society.”
—M. Carey Thomas (18571935)