INT(A, KIND)
Purpose
Convert to integer type.
Class
Elemental function
Argument type and attributes
- A
- An
INTENT(IN)INTEGER,REAL,COMPLEX, or boz-literalCONSTANT - KIND (optional)
- An
INTENT(IN)INTEGERscalar. The actual argument corresponding to KIND must be a constant expression.
Result type and attributes
- Integer.
- If KIND is present, the kind type parameter is that specified by KIND; otherwise, the kind type parameter is that of the default integer type.
Result value
- Case (i): If A is of type integer, INT (A) = A.
- Case (ii): If A is of type real, there are two cases: if |A| < 1, INT (A) has the value 0; if |A| ≥ 1, INT (A) is the integer whose magnitude is the largest integer that does not exceed the magnitude of A and whose sign is the same as the sign of A.
- Case (iii): If A is of type complex, INT (A) is the value obtained by applying the case (ii) rule to the real part of A.
- Case (iv): If A is a boz-literal constant, it is treated as an integer with a kind-param that specifies the representation method with the largest decimal exponent range supported by the processor. If -qxlf2003=nobozlitargs is specified the boz-literal is treated as a real.
- The result is undefined if it cannot be represented in the specified integer type.
Examples
INT (-3.7) has the value -3.
| Specific Name | Argument Type | Result Type | Pass As Arg? |
|---|---|---|---|
| INT | default real | default integer | no |
| IDINT | double precision real | default integer | no |
| IFIX | default real | default integer | no |
| IQINT 1 | REAL(16) | default integer | no |
|
Note:
|
|||
Related information
For information on alternative behavior for INT when porting programs to IBM® Open XL Fortran, see the -qport compiler option in the IBM Open XL Fortran Compiler Reference.