+-------------------------------IBM Extension--------------------------------+
Converts a real or integer value into a two byte integer.
INT2 cannot be passed as an actual argument of another function call.
Class
Elemental function
Result Type and Attributes
INTEGER(2) scalar
Result Value
If A is of type integer, INT2(A) = A.
If A is of type real, there are two possibilities:
In both cases, truncation may occur.
Examples
The following is an example of the INT2 function.
REAL*4 :: R4 REAL*8 :: R8 INTEGER*4 :: I4 INTEGER*8 :: I8 R4 = 8.8; R8 = 18.9 I4 = 4; I8 = 8 PRINT *, INT2(R4), INT2(R8), INT2(I4), INT2(I8) PRINT *, INT2(2.3), INT2(6) PRINT *, INT2(65535.78), INT2(65536.89) END
The following is sample output generated by the program above:
8 18 4 8 2 6 -1 0 ! The results indicate that truncation has occurred, since only the last ! two bytes were saved.
+----------------------------End of IBM Extension----------------------------+