FORTRAN Reference Manual
Intrinsic Functions
FORTRAN Reference Manual—528615-001
8-20
LEN Function
Considerations
•
For an argument of integer type, INT (x) returns x.
•
For an argument of real or double precision type:
For example,
INT (-3.8) returns -3.
•
For an argument of complex type, INT (x) is the same as INT (REAL (x)).
Example of the INT Function
y = INT (x / 3)
p = x + IFIX4 (s * r)
LEN Function
The LEN function returns the declared length of a character item.
The table below shows the argument and function type of the generic LEN function and 
its associated specific functions:
Considerations
If the argument to LEN is a character variable, LEN returns the declared length of the 
variable, not the length of a string that you assigned to the variable. In the following 
example, LEN returns 20, the length of NAME, not 7, the length of the string assigned 
to NAME:
CHARACTER * 20 name
INTEGER name_len
name = 'Amadeus'
name_len = LEN(name)
if | x| < 1.0  INT (x) returns 0.
if | x| ≥ 1.0 INT (x)  r e t u r n s  th e  in t e g e r  w h o s e  m a g ni t ud e  is  t h e  l a r g e s t       
integer that does not exceed the magnitude of x and          
whose sign is the same as that of x.
Syntax Argument Type Function Type
LEN (string) Character Integer
LEN4 (string) Character Integer*4
LEN8 (string) Character Integer*8
String is a character expression.










