Next: , Previous: , Up: Scalars   [Contents][Index] Floating-Point Numbers

Floating-point numbers can be specified in single or double precision (Numerical Data Types), and also in sexagesimal format (see below). The following specification of a single-precision floating-point number (of data type float) is of the most general type available: 6.4e-3. An upper-case E may be used instead of the lower-case e. The number following the e or E is the exponent, and the number before the e or E is the mantissa. The exponent indicates by what power of ten the mantissa is to be multiplied. The current example involves the number 6.4 divided by 1,000.

The following specifications, which lack parts of the general format, are also legal for single-precision floating-point numbers: 0.023, .5, 11., 7E+3, 17e. The first three examples lack an exponent, but are still float because a decimal point was specified. The third example lacks a decimal point, but is still float because an exponent is present. Note that a plus sign is allowed (but not necessary) in the exponent. The fourth example lacks both a decimal point and an exponent, but is still float because the e marker is present.

Double-precision floating-point numbers (data type double) are specified like single-precision numbers, except that the e or E marker is replaced by a d or D marker, and this marker must be present in any explicit specification of a double-precision number.

A floating-point number can be specified in restricted sexagesimal notation, for instance 23s33:32:11.3. The s flags sexagesimal interpretation; a decimal number precedes it, and zero or more colon-separated decimal numbers and an optional final floating-point number may follow. The first number counts units of 1, and each next number counts units that are 1/60th as large as the previous one. The final number must not have an exponent, though one character from dDeE may follow to indicate float (eE) or double (dD) data type. Besides s, also S, h or H may be used to indicate sexagesimal notation. The S is equivalent to s, and the h and H indicate that the result must be multiplied by 15, transforming hours to degrees, so that 24h is equivalent to 360.

NOTE: The use of the s and h specifiers for sexagesimal numbers is new, starting with LUX version 3.1.89. Before, colons were used instead of sS, and no hH transformation was available.

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