Next: , Previous: , Up: Scalars   [Contents][Index]


6.2.2.2 Integer Numbers

Integer numbers can be specified in three bases, as follows:

base 8 (octal).

A set of octal digits followed by o or o specifies a number in base 8. For example, 17o is equal to 1*8+7 = 15 in base 10.

base 10 (decimal).

A set of decimal digits (0-9) specifies a number in base 10.

base 16 (hexadecimal).

A set of hexadecimal digits (0-9, a-f, A-F) preceded by 0x or 0X, specifies a number in base 16. For example, 0x3a, and 0X3A all specify the same number in base 16, which is equal to 3*16+10 = 58 in base 10.

By default, an integer number is assumed to have data type long (see Numerical Data Types). A non-hexadecimal number can be specified to be byte by appending a b or B to the number. A number in any base is specified to be of type word by appending a w or W. Data type long can be specified explicitly by appending an l or L. Data type INT64 is selected by appending a q or Q. For example, 17 and 17L have data type long, 17b is byte, and 17w is word.

The data type specification, if any, follows the base specification, if any. The bB specifier is disallowed for hexadecimal numbers to prevent confusion between a final hexadecimal digit B and the byte type specifier.

NOTE: With LUX version 3.1.86, the principle has been adopted that the legality of a character as part of a number specification must be determinable from that character and perhaps the directly following character, but not more. This means that the method of identifying hexadecimal numbers by appending an X is now disallowed.

Also, use of the B data type specifier on hexadecimal numbers was disallowed starting with LUX version 3.1.86.


Next: , Previous: , Up: Scalars   [Contents][Index]