int(3f) - [FORTRAN:INTRINSIC:NUMERIC] Convert to integer type
Syntax
Description
Arguments
Return Value
Example
Standard
Class
result = int(a [, kind))
Convert to integer type
A - Shall be of type INTEGER, REAL, or COMPLEX. KIND - (Optional) An INTEGER initialization expression indicating the kind parameter of the result.
These functions return a INTEGER variable or array under the following rules:
1. If A is of type INTEGER, int(a) = a 2. If A is of type REAL and |a| < 1, int(a) equals 0. If |a| >= 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. 3. If A is of type COMPLEX, rule 2 is applied to the real part of A.
Sample program:
program demo_int integer :: i = 42 complex :: z = (-3.7, 1.0) print *, int(i) print *, int(z), int(z,8) end program demo_int
[[FORTRAN 77]] and later
[[Elemental procedure|Elemental function]]
int (3) | March 18, 2019 |