Leading zero and filling zero

from Wikipedia, the free encyclopedia

A leading zero is a leftmost zero in numerical values ​​that only has a fill function. This means that a leading zero has no bearing on the value of a number . So one does not speak of a leading zero,

Filler zeros are used to bring “too short” digit sequences in codes to a prescribed standard length. Filling zeros can not only appear at the beginning of a character string (as so-called leading zeros ). The zeros in the middle of an international bank account number (IBAN) e.g. B. can be explained by the fact that the former account number on the right is "too short", so that filling zeros have to be inserted behind the sequence of digits that stand for the bank code . A zero can also be adjusted. In the industrial chart of accounts , for example, a zero can be appended to the account type to make it four characters long.

In connection with control characters , a zero as a zero character does not belong to the set of leading zeros or to the set of filler zeros .

Purpose of inserting zeros

Leading zeros

By adding the number zero (e.g. by using the character "09" in place of the character "9"), ISO 8601 should ensure that the number "10" is not between "1" even when a data record is sorted alphabetically. and "2" is sorted, so that data relating to October of a year are not listed directly after data relating to January of the corresponding year, and that the annual balance does not end with the month of September.

It can also be useful to use a leading zero for handwritten texts. This concerns z. B. the grading with the help of a 15-point scheme . The teacher comment “02 points” is z. B. more forgery-proof than the comment “2 points”, since the addition of a “1” by a forger only makes sense in the second variant. The same applies to amounts of money on checks and the like. B. the spelling "0100 €" is recommended.

The addition of a zero in front of a number can also indicate a specific fact. For example, all rooms on the first floor of a house can have numbers that start with a leading zero. "0" then stands for "ground floor". Accordingly, one could pronounce “room 016” (“zero-sixteen”) exactly like “room E 16”.

Filling zeros

Filled zeros increase the number of code numbers that can be assigned, namely by a factor of ten, if the possible number of characters is increased by an additional leading zero, i.e. H. the sequence of digits is extended by one digit. Even if the number of digits in a digit sequence is not increased, the number of possible digit sequences increases if a leading zero is allowed. For example, leading zeros are not permitted in German license plates . Therefore, there are only 900 instead of 999 possible combinations per given combination of letters with the stipulation “three digits at the end of the identifier”. The use of one or two-digit numbers is often not permitted for license plates because they have a different meaning than three digits. For example, B. two digits after the location code "OL" on the district of Oldenburg , three digits in connection with two letters, however, on the city ​​of Oldenburg .

Specific application problems

Dates

The ISO 8601 standard claims to regulate the use of leading zeros in time specifications. According to this international standard, the date format YYYY-MM-DD ( 2009-08-19 ) should also be used in German-speaking countries . However, this notation has not caught on in practice, except for file names.

The following are common in German-speaking countries, e.g. T. traditional purely numeric date formats:

  • dd.mm.yyyy - four-digit year; Day and month information without a leading zero. Examples: July 23, 1926. 1.1.2001
  • DD.MM.YYYY - four-digit year; Day and month with a leading zero. Examples: 03/14/1939. 02/01/2011
  • DD.MM.YY - two-digit year, day and month with a leading zero. Examples: 02.10.10. 02/01/07
  • dd.mM.YY - two-digit year, day and month without a leading zero (single-digit years are avoided). Examples: 1.1.01. , October 2 , 2009

Furthermore, the spelling "day" / "month" is common in internal notes on draft letters, especially in the public service (example: "13/7" for "July 13"). This note indicates the day of subscription .

The claim to validity of the ISO 8601 standard competes with the claim to validity of the official regulation for German spelling : According to § 104 of this regulation, numbers followed by a point in the spelling customary in German-speaking countries are ordinal numbers . This category also includes numbers in front of abbreviated or written month names. Leading zeros are not provided for ordinal numbers. So the spelling “03. February “as a misspelling. Only the spelling “3. February ”, also with the abbreviated name of the month. In the case of purely numerical spellings (i.e. with the month as a number), the "Duden" allows you to dispense with leading zeros, whereas the ISO-compatible standard DIN 5008 prescribes their use.

For the area outside of schools, where the official spelling is binding, it is recommended that individual authors and groups of authors maintain a consistent variant of the spelling of the date and time, i.e. do not vary spellings arbitrarily. So recommends z. B. the "professional association of professional interpreters and translators in Germany" (BdUe) its members to always use the spelling "21.3.2006".

Handling of digits by electronic data processing

A basic problem lies in the fact that texts are in principle formatted left-justified, but for the tabular listing of numbers the principle: "One under one, tens under tens ..." applies, which elementary school students learn in mathematics lessons and which leads to a right-justification of the typeface . However, computers do not “know” (if they do not receive appropriate programming instructions) whether a digit is part of a number or an alphanumeric string. Therefore, when using word processing programs (e.g. for printed out invoices), a decimal tab must be set near the right-hand edge of the sheet , which ensures that numbers are listed right-justified if you do not want to use leading zeros. Accordingly, a distinction must be made between the number mode and the text mode in spreadsheet programs for individual fields, rows and columns if leading zeros are not to "disappear" when working with the program. In the case of numerical values, leading zeros are meaningless in the adic representation because the associated place value is also zero.

Some programming languages ​​like C or Python use a leading zero for octal numbers . The following example in the Python integrated development environment illustrates this:

>>> 42
42
>>> 042
34
>>> 09
SyntaxError: invalid token
>>>

The decimal number 42 (42 10 ) remains unchanged in the above example because the program interprets it as a decimal number due to the missing leading zero. The octal 042 (42 8 ) is identified because the leading zero as such and in the decimal number 34 (34 10 ) is converted (8 1 * 4 + 8 0 * 2 = 10 1 * 3 + 10 0 * 4). Entering the value "09", however, leads to a syntax error message , since 9 is not a valid digit of an octal number. Since the character “0” changes the meaning of what is being designated, it is a leading and not a leading zero.

See also

Individual evidence

  1. WEKA Fachmedien GmbH: leading zero
  2. leading zero on enzyklo.de
  3. ^ Institute for the German Language : Rules and Dictionary. Official regulation . Mannheim. Revised version 2004
  4. DIN 5008 : 2020-03 Writing and design rules for word processing and information processing , Section 11.4 Date information , Subsection 11.4.1 Numerical writing
  5. Annika Lamer: How to correctly write the date and time . 4th January 2013
  6. Professional Association of Professional Interpreters and Translators in Germany (BdUe): Formal requirements for MDÜ authors . July 10, 2006. p. 1