 | 0 number: Encyclopedia II - 0 number - In computer science
0 number - In computer science
0 number - Numbering from 1 or 0?
Human beings usually number things starting from one, not zero. Yet in computer science zero has become the popular indication for a starting point. For example, in almost all old programming languages, an array starts from 1 by default, which is natural for humans. As programming languages have developed, it has become more common that an array starts from zero by default (zeroth, or zero-based).
In particular, the popularity of the programming language "C" in the 80s has made this approach common.
One reason for this convention is that modular arithmetic normally describes a set of N numbers as containing 0,1,2,...N-1 in order to contain the additive identity. Because of this, many arithmetic concepts (such as hash tables) are less elegant to express in code unless the array starts at zero.
Another reason to use zero-based array indices is that it 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.
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". For this reason, the first element is often referred to as the zeroth element to eliminate any possible doubt (though, strictly speaking, this is unnecessary and arguably incorrect, since the meanings of the ordinal numbers are not ambiguous).
0 number - Null value
In databases a field can have a null value. This is equivalent to the field not having a 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.
0 number - Null pointer
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), and has no particular association with zero.
0 number - Negative zero
Main article: -0
In some signed number representations (but not the two's complement representation predominant 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. Representations with negative zero can be troublesome, because the two zeroes will compare equal but may be treated differently by some operations.
Other related archives>>, -0, -1, 1, 10, 11th century, 130, 2, 20, 3, 30, 300 BC, 3rd century BC, 4, 40, 40 BC, 400BC, 4th century BC, 5, 50, 525, 5th, 6, 60, 628, 6th century, 7, 70, 700 BC, 725, 8, 80, 9, 90, 9th century, ASR-33 Teletype, Al-Khwarizmi, Algorimus, Algorithm, Ancient Greeks, Andalusia, Arabic numerals, Babylonian numeral system, Babylonian system, Bede, Brahmagupta, Brahmasphutasiddhanta, Braille, Burroughs, Byzantine, C, Cambodia, China, DVDs, Dionysius Exiguus, Division by zero, Easter, Europe, Fibonacci, Gerbert of Aurillac, German plates, Greek letter, Greek numerals, Hellenistic zero, Hindu-Arabic numeral system, Hipparchus, History of the Hindu-Arabic numeral system, IBM 3270, India, Indian mathematician, Integers, Islamic, J, Julian calendars, Kish, L'Hopital's rule, List of numbers, Maya numerals, Mexico, Middle Ages, Morse code, Möbius function, Negative and non-negative numbers, Nothing, Null, Nullar number, Number theory, O, Olmec, Pingala, Ptolemy, Q, Roman numerals, Sacrobosco, Sanskrit, Scandinavian languages, Scandinavians, Slashed zero, Theta, Unisys, United Kingdom, Year Zero, Zeno of Elea, Zephyrus, addition, additive group, al-Khwarizmi, almost nowhere, analytic geometry, array, astrolabe, astronomers, astronomy, by default, cardinality, cars, category theory, celsius, cipher, compile time, complex number, computer science, computists, constant function, decibels, decimal without a zero, defined, dimension, empty set, first, floating point number, freezing point, geometry, historians, humans, identity element, indeterminate form, infinitesimal, integer, kelvin, mathematics, measure theory, memory address, modular arithmetic, natural number, negative zero, non-negative, nonstandard analysis, null, null pointer, null set, number, numeral, numeral systems, omicron, one, ordinal numbers, origin, paradoxes, philosophical, phons, placeholder, point, positional notation, prime, printers, probability, programming languages, proleptic Gregorian, ring, roots, second millennium BC, set theory, seven-segment displays, sexagesimal, signed number representations, slashed zero, text figures, the product of 0 numbers is 1, trigonometry, two's complement, ultrafilter, undefined, vacuum, void, year zero, zero (complex analysis), zero morphism, zeroth, Ø
 Adapted from the Wikipedia article "In computer science", under the G.N U Free Docmentation License. Please also see http://en.wikipedia.org/wiki |