8.126 INT — Convert to integer type
- Description:
- Convert to integer type
- Standard:
- Fortran 77 and later
- Class:
- Elemental function
- Syntax:
-
RESULT = INT(A [, KIND)) - Arguments:
-
A Shall be of type INTEGER,REAL, orCOMPLEX.KIND (Optional) An INTEGERinitialization expression indicating the kind parameter of the result. - Return value:
- These functions return a
INTEGERvariable or array under the following rules:- (A)
- If A is of type
INTEGER,INT(A) = A - (B)
- If A is of type
REALand |A| < 1,INT(A)equals0. If |A| \geq 1, thenINT(A)equals the largest integer that does not exceed the range of A and whose sign is the same as the sign of A. - (C)
- If A is of type
COMPLEX, rule B is applied to the real part of A.
- Example:
-
program test_int integer :: i = 42 complex :: z = (-3.7, 1.0) print *, int(i) print *, int(z), int(z,8) end program
- Specific names:
-
Name Argument Return type Standard INT(A)REAL(4) AINTEGERFortran 77 and later IFIX(A)REAL(4) AINTEGERFortran 77 and later IDINT(A)REAL(8) AINTEGERFortran 77 and later
© Free Software Foundation
Licensed under the GNU Free Documentation License, Version 1.3.
https://gcc.gnu.org/onlinedocs/gcc-4.9.3/gfortran/INT.html