numeric_constants.htm

Navigation: Language Reference > 10 - Expressions > Constants >====== Numeric Constants ====== | |

Numeric constants are fixed numeric values. They may occur in data declarations, in expressions, and as parameters of procedures or attributes. A numeric constant may be represented in decimal (base 10–the default), binary (base 2), octal (base 8), hexadecimal (base 16), or scientific notation formats. Formatting characters, such as dollar signs and commas, are not permitted in numeric constants; only leading plus or minus signs and the decimal point are allowed.

Decimal (base ten) numeric constants may contain an optional leading minus sign (hyphen character), an integer, and an optional decimal with a fractional component. Binary (base two) numeric constants may contain an optional leading minus sign, the digits 0 and 1, and a terminating B or b character. Octal (base eight) numeric constants contain an optional leading minus sign, the digits 0 through 7, and a terminating O or o character. Hexadecimal (base sixteen) numeric constants contain an optional leading minus sign, the digits 0 through 9, alphabet characters A through F (representing the numbers 10 through 15) and a terminating H or h character. If the left-most character is a letter A through F, a leading zero must be used.

**Example:**

** -924 !Decimal constants**

** 76.346**

** +76.346**

** 1011b !Binary constants**

** -1000110B**

** 3403o !Octal constants**

** -7041312O**

** -1FFBh !Hexadecimal constants**

** 0CD1F74FH**

numeric_constants.htm.txt · Last modified: 2021/04/15 15:57 (external edit)