floating
Return to Introduction  Previous page  Next page IOMax Homepage
floating-point-constant

Syntax
floating-point-constant:
    fractional-constant exponent-partopt floating-suffixopt
    digit-sequence exponent-part floating-suffixopt

fractional-constant:
    digit-sequenceopt.
  digit-sequence
    digit-sequence .
 

exponent-part:
    e
  signopt digit-sequence
    E
  signopt digit-sequence

sign: one of
    + –
 

digit-sequence
    digit
    digit-sequence digit

floating-suffix: one of
    f l F L
 

Description:
Floating-point constants specify values that must have a fractional part. These values contain decimal points (.) and can contain exponents.

Floating-point constants have a "mantissa," which specifies the value of the number, an "exponent," which specifies the magnitude of the number, and an optional suffix that specifies the constant's type. The mantissa is specified as a sequence of digits followed by a period, followed by an optional sequence of digits representing the fractional part of the number. For example:
18.46
38.

The exponent, if present, specifies the magnitude of the number as a power of 10, as shown in the following example:
18.46e0      // 18.46
18.46e1
      // 184.6
If an exponent is present, the trailing decimal point is unnecessary in whole numbers such as 18E0.