Numeric Literals

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

Integer Literals

You must use the integer notation to specify an integer whenever an integer appears in expressions, conditions, Sybase functions, and CCL statements described elsewhere.

The syntax of an integer literal is as follows:

[+|-]
integer

where integer refers to any whole number 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

To ensure that an expression is evaluated as LONG rather than as INTEGER, make sure that the first constant is followed by an L, even if that specific value fits within the range of INTEGER data types.

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 is described as type FLOAT elsewhere in this documentation.

The syntax of a float literal is as follows:

[+|-]
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 approximately 16 or 17 significant digits.