Leading zero

From Wikipedia, the free encyclopedia

A leading zero is any zero that leads a number string with a non-zero value. For example, James Bond's famous identifier, 007, has two leading zeros. Often, leading zeros are found on non-electronic and LED digital displays that contain fixed sets of digits, such as the manual counter, the stopwatch, the odometer, and the digital clock. 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. They can also be used to prevent fraud by filling in character positions that might normally be empty.

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.

A prefix 0 is used in the C programming language to specify octal numbers (and 0x means hexadecimal).

Languages