#jsDisabledContent { display:none; } My Account | Register | Help

Article Id: WHEBN0001868210
Reproduction Date:

 Title: Leading zero Author: World Heritage Encyclopedia Language: English Subject: Collection: Publisher: World Heritage Encyclopedia Publication Date:

A leading zero is any 0 digit that comes before the first nonzero digit in a number string in positional notation.[1] For example, James Bond's famous identifier, 007, has two leading zeros.[2] When leading zeros occupy the most significant digits of an integer, they could be left blank or omitted for the same numeric value.[3] Therefore, the usual decimal notation of integers does not use leading zeros except for the zero itself, which would be denoted as an empty string otherwise.[4] However, in decimal fractions strictly between −1 and 1, the leading zeros digits between the decimal point and the first nonzero digit are necessary for conveying the magnitude of a number and cannot be omitted.[1]

## Contents

• Occurrence 1
• 0 as a prefix 3
• References 5

## Occurrence

Often, leading zeros are found on non-electronic digital displays or on such electronic ones as seven-segment displays, that contain fixed sets of digits. These devices include manual counters, stopwatches,[5] odometers,[6] and digital clocks.[5] Leading zeros are also generated by many older computer programs when creating values to assign to new records, accounts and other files, and as such are likely to be used by utility billing systems, human resources information systems and government databases. Many digital cameras and other electronic media recording devices use leading zeros when creating and saving new files to make names of the equal length.

Leading zeros also present whenever the number of digits is technically fixed (such as in a memory register), but the stored value is not large enough to result in a non-zero most significant digit.[7] The count leading zeros operation efficiently determines the number of leading zero bits in a machine word.[8]

A leading zero appears in roulette in the United States, where "00" is distinct from "0" (a wager on "0" will not win if the ball lands in "00", and vice versa). Sports where competitors are numbered follow this as well; a stock car numbered "07" would be considered distinct from one numbered "7". Benito Santiago, a Major League Baseball catcher who wore the number 09 for several years, is the only major professional sports league player to use a jersey number with a leading zero, not counting several who have worn the number 00. This is most common with single-digit numbers.

Leading zeros are used to make ascending order of numbers correspond with alphabetical order: e.g., 11 comes alphabetically before 2, but after 02. (See, e.g., ISO 8601.) This does not work with negative numbers, though, whether leading zeroes are used or not: −23 comes alphabetically after −01, −1, and −22, although it is less than all of them.

Leading zeros can also be used to prevent fraud by filling in character positions that might normally be empty. For example, adding leading zeros to the amount of a check (or similar financial document) makes it more difficult for fraudsters to alter the amount of the check before presenting it for payment.

Leading zeros in a sentence also make it less likely that a careless reader will overlook the decimal point.

## 0 as a prefix

A prefix `0` is used in C to specify string representations of octal numbers, as required by the ANSI C standard for the "strtol" function (the string to long integer converter) in the "stdlib.h" library. Many other programming languages, such as Python 2, Perl, Ruby, and the Unix shell bash also follow this specification for converting strings to numbers. As an example, "`0020`" does not represent 2010 (2×101 + 0×100), but rather 208 = 1610 (2×81 + 0×80 = 1×101 + 6×100). Decimal numbers written with leading zeros will be interpreted as octal by languages that follow this convention and will generate errors (not just unexpected results) if they contain "8" or "9", since these digits do not exist in octal. This behavior can be quite a nuisance when working with sequences of strings with embedded, zero-padded decimal numbers (typically file names) to facilitate alphabetical sorting (see above) or when validating inputs from users who would not know that adding a leading zero triggers this base conversion.

## References

1. ^ a b Miller, Jane E. (2008), The Chicago Guide to Writing about Numbers, University of Chicago Press, p. 276, .
2. ^ Lafore, Robert W. (1987), Microsoft C: programming for the IBM, H.W. Sams, p. 294, .
3. ^ Zegarelli, Mark (2014), Basic Math and Pre-Algebra Workbook For Dummies (2nd ed.), John Wiley & Sons, p. 8, .
4. ^ Flynt, Clif (2012), Tcl/Tk: A Developer's Guide, Elsevier, pp. 752–753, .
5. ^ a b Greene, Jennifer; Stellman, Andrew (2013), Head First C#, O'Reilly Media, Inc., p. 770, .
6. ^ Dueck, Robert; Reid, Ken (2011), Digital Electronics, Cengage Learning, p. 48, .
7. ^ Kuc, Roman (1999), The digital information age: an introduction to electrical engineering, PWS Pub. Co., p. 67, .
8. ^ Dandamudi, Sivarama P. (2005), Guide to RISC Processors: for Programmers and Engineers, Springer, p. 139, .
This article was sourced from Creative Commons Attribution-ShareAlike License; additional terms may apply. World Heritage Encyclopedia content is assembled from numerous content providers, Open Access Publishing, and in compliance with The Fair Access to Science and Technology Research Act (FASTR), Wikimedia Foundation, Inc., Public Library of Science, The Encyclopedia of Life, Open Book Publishers (OBP), PubMed, U.S. National Library of Medicine, National Center for Biotechnology Information, U.S. National Library of Medicine, National Institutes of Health (NIH), U.S. Department of Health & Human Services, and USA.gov, which sources content from all federal, state, local, tribal, and territorial government publication portals (.gov, .mil, .edu). Funding for USA.gov and content contributors is made possible from the U.S. Congress, E-Government Act of 2002.

Crowd sourced content that is contributed to World Heritage Encyclopedia is peer reviewed and edited by our editorial staff to ensure quality scholarly research articles.