A <numeric literal> is any number in one of two categories: the exact numeric integers and decimal numbers, and the approximate numeric floating point numbers.

<exact numeric literal>:

An <exact numeric literal> is either an integer or a decimal number and its <data type> is exact numeric DECIMAL, though it is compatible with the INTEGER, SMALLINT, DECIMAL, NUMERIC, REAL, FLOAT and DOUBLE PRECISION <data type>s. The <literal>'s precision is the number of digits it contains and its scale is the number of digits to the right of its decimal point. A valid integer <literal> is a signed or unsigned decimal integer with an implicit scale of zero, e.g.: -65 or 476.

A valid decimal <literal> is a signed or unsigned decimal integer with an explicit scale (that can nevertheless default to zero), e.g.: 65 or -819.3 or .67 or -.02.

<approximate numeric literal>:

An <approximate numeric literal> is a floating point number and its <data type> is approximate numeric FLOAT, though it is compatible with the INTEGER, SMALLINT, DECIMAL, NUMERIC, REAL, FLOAT and DOUBLE PRECISION <data type>s. The <literal>'s precision is the precision of its mantissa and its numeric value is the product of its mantissa raised to the power of its exponent. A valid <approximate numeric literal> is a floating point number consisting of a possibly signed decimal number (the mantissa) and a signed integer (the exponent), separated by the upper case letter "E", e.g.: -1.27982E+5 or .465E-7.

Here are some equivalent <literal>s in "exact" and in "exponential" notation:

ExactREALDOUBLE PRECISION
.0000000000000001 1.0000000E-15 1.00000000000000E-015
-0.1-1.0000000E-01-1.00000000000000E-001
1 1.0000000E+00 1.00000000000000E+000
+10 1.0000000E+01 1.00000000000000E+001
1000000000000000 1.0000000E+15 1.00000000000000E+015

In this example, we've shown the real and double precision numbers in a normalized form -- with one digit before the decimal point. This is not mandatory, but strongly recommended. We also show a fixed number of digits after the decimal point so that maximum sizes will be apparent; in fact leading zeroes and signs, as well as post-decimal zeros are all optional. The one thing that is not optional is the letter "E" -- always upper-case.

Note:

Portions of the text in this entry are Copyright © 1999 by Ocelot Computer Services Incorporated. Used by permission.

Comments

Comments loading...