Compiler Library/XL Reference Manual (32650-90029)

3-: 6
Table 3-2. Values of kind and Associated Formats
---------------------------------------------------------------------------------------------
| | | |
| Value of kind | Format | Example |
| | | |
---------------------------------------------------------------------------------------------
| | | |
| 3 | G
w.d
| See "Comments" for more details. |
| | | |
| 2 | D
w.d
| 0.12345D+04 |
| | | |
| 1 | E
w.d
| 0.12345E+04 |
| | | |
| 0 | I
w
| 1234 |
| | | |
| -1 | N
w.d
| 1,234.5 |
| | | |
| -2 | M
w.d
| $1,234.5 |
| | | |
| -3 | F
w.d
| 1234.5 |
| | | |
---------------------------------------------------------------------------------------------
scale = The scale factor (see "Comments" for
more details).
Parameters charstring = Pointer to the first byte array for
(Output): the ASCII string output. The result
occupies the first fieldwidth
characters (bytes) in this array.
error = Is -1 if fieldwidth is too small for
the result in the specified kind. If
decplaces < zero, or if fieldwidth <=
zero, the byte array is filled with
asterisks (*). The error parameter is
zero if the result is valid.
Results: See "Parameters (Output)" above for details.
HP FORTRAN 77/XL: Use the $ALIAS directive to call INEXT' ; use
the system intrinsic statement to call
HPINEXT.
Errors: See "Parameters (Output)" above for details.
Comments
1. The result charstring is an array of ASCII digits; charstring can
also include the sign character (-), a decimal point, and an
exponent field for kind = 1 (for the E
w.d
format) or kind = 2 (for
the D
w.d
format). Generally, the exponent field includes the
letter E or D followed by a signed two-digit integer. If the
absolute value of the exponent is greater than 99, the exponent
field appears as a signed three-digit integer (without a preceding
E). Alternatively, charstring can include a sign character (-), a
dollar sign for kind = -2 (for the M
w.d
format) and/or commas for
kind = -2 or -3 (for the M
w.d
or N
w.d
formats). (
w
equals the
parameter fieldwidth and
d
equals the parameter decplaces.)
2. To use kind = 3 (G
w.d
format), set decplaces to the number of
significant digits and set fieldwidth to decplaces+6 to allow for
special characters. Then, kind = 3 is used as kind = -3 or 1
(F
w.d
or E
w.d
format), according to the absolute value of the
internal representation of value intlvalue, as shown in Table 3-3.