INT
— Convert to integer typeRESULT = INT(A [, KIND))
A | Shall be of type INTEGER ,
REAL , or COMPLEX .
|
KIND | (Optional) An INTEGER initialization
expression indicating the kind parameter of the result.
|
INTEGER
variable or array under
the following rules:
INTEGER
, INT(A) = A
REAL
and |A| < 1, INT(A)
equals 0
.
If |A| \geq 1, then INT(A)
equals the largest integer that does not exceed
the range of A and whose sign is the same as the sign of A.
COMPLEX
, rule B is applied to the real part of A.
program test_int integer :: i = 42 complex :: z = (-3.7, 1.0) print *, int(i) print *, int(z), int(z,8) end program
Name | Argument | Return type | Standard
|
INT(A) | REAL(4) A | INTEGER | Fortran 77 and later
|
IFIX(A) | REAL(4) A | INTEGER | Fortran 77 and later
|
IDINT(A) | REAL(8) A | INTEGER | Fortran 77 and later
|