Numeric Literals

Numeric literals are used to specify integers, long, and floating-point numbers.

Integer Literals

Use the integer notation to specify integers in expressions, conditions, functions, and CCL statements.

The syntax of an integer literal is:

[+|-]integer

where integer refers to any whole numbers (including negatives) or zero.

Some valid integers are:

3
-45
+10023

Long Literals

Long literals follow the same rules as integer literals. To force a literal that can be either integer or long into a long data type, add the letter "L" to the end of the literal.

For example, the following are valid long literals:

2147483648L
-2147483649L
-9223372036854775808L
0L

Float Literals

A float literal is a floating-point number, usually used to represent numbers that include a decimal point. Use the float literal syntax whenever an expression requires a floating point number.

The syntax of a float literal is:

[+|-]floating_point_number
[E[+|-]exponent]

where floating_point_number is a number that includes a decimal point. The optional letter e or E indicates that the number is specified in scientific notation. The digits after the E specify the exponent. The exponent can range from approximately -308 to +308.

Some valid float literals are:

1.234
-45.02
+10023.
3.
.024
-7.2e+22

Note that float values are accurate to 16 significant digits.