A real constant approximates the value of a mathematical real number. The value of the constant can be positive, zero, or negative. VSI Fortran provides three kind type parameters for data of type real: REAL(KIND=4) (or REAL*4), REAL(KIND=8) (or REAL*8), and REAL(KIND=16) (or REAL*16). REAL(KIND=8) is DOUBLE PRECISION. If DOUBLE PRECISION is used, a kind type parameter must not be specified for the constant. The type specifier for the real (single-precision) type is REAL; the type specifier for the double precision type is DOUBLE PRECISION. If a kind type parameter is specified, the real constant has the kind specified. If a kind type parameter is not specified, the kind is default real. The following is the general form of a real constant with no exponent part: [s]n[n...][_k] A real constant with an exponent part has one of the following forms: [s]n[n...]E[s]nn...[_k] [s]n[n...]D[s]nn... [s]n[n...]Q[s]nn... s Is a sign; required if negative (-), optional if positive (+). n Is a decimal digit (0 through 9). A decimal point must appear if the real constant has no exponent part. k Is an optional kind type parameter (4 for REAL(KIND=4), 8 for REAL(KIND=8), or 16 for REAL(KIND=16)). It must be preceded by an underscore (_). Leading zeros (zeros to the left of the first nonzero digit) are ignored in counting significant digits. For example, in the constant 0.00001234567, all of the nonzero digits, and none of the zeros, are significant. (See the following sections for the number of significant digits each kind type parameter typically has). The exponent represents a power of 10 by which the preceding real or integer constant is to be multiplied (for example, 1.0E6 represents the value 1.0 * 10**6). A real constant with no exponent part is (by default) a single-precision (REAL(KIND=4)) constant. You can change this default behavior by specifying the compiler option /ASSUME=FPCONSTANT. If the real constant has no exponent part, a decimal point must appear in the string (anywhere before the optional kind type parameter). If there is an exponent part, a decimal point is optional in the string preceding the exponent part; the exponent part must not contain a decimal point. The exponent letter E denotes a single-precision real (REAL(KIND=4) or REAL*4) constant, unless the optional kind type parameter specifies otherwise. For example, -9.E2_8 is a double-precision constant (which can also be written as -9.D2). The exponent letter D denotes a double-precision real (REAL(KIND=8) or REAL*8) constant. The exponent letter Q denotes a quad-precision real (REAL(KIND=16) or REAL*16) constant. A minus sign must appear before a negative real constant; a plus sign is optional before a positive constant. Similarly, a minus sign must appear between the exponent letter (E, D, or Q) and a negative exponent, whereas a plus sign is optional between the exponent letter and a positive exponent. If the real constant includes an exponent letter, the exponent field cannot be omitted, but it can be zero. To specify a real constant using both an exponent letter and a kind type parameter, the exponent letter must be E, and the kind type parameter must follow the exponent part.
1 – DOUBLE_PRECISION
See DATA CONSTANTS REAL REAL_8 in this Help file.
2 – REAL_4
REAL(KIND=4) or REAL*4 A single-precision REAL constant occupies four bytes of memory. The number of digits is unlimited, but typically only the leftmost seven digits are significant. Either VAX F_floating or IEEE S_floating format is used, depending on the compiler option specified.
3 – REAL_8
DOUBLE PRECISION (REAL(KIND=8) or REAL*8) A DOUBLE PRECISION constant has more than twice the accuracy of a REAL number, and greater range. A DOUBLE PRECISION constant occupies eight bytes of memory. The number of digits that precede the exponent is unlimited, but typically only the leftmost 15 digits are significant. Either VAX D_floating, G_floating, or IEEE T_floating format is used, depending on the compiler option specified.
4 – REAL_16
REAL(KIND=16) or REAL*16 A REAL(KIND=16) constant has more than four times the accuracy of a REAL number, and a greater range. A REAL(KIND=16) constant occupies 16 bytes of memory. The number of digits that precede the exponent is unlimited, but typically only the leftmost 33 digits are significant.