Fortran Library Reference

short: Convert a Long Integer to a Short Integer

The function is:

INTEGER*2 short

call ExpecShort( short(int4) )

int4

INTEGER*4

Input  

Return value 

INTEGER*2

Output  

Example (fragment): long() and short():


    integer*4 int4/8/, long 
    integer*2 int2/8/, short 
    call ExpecLong( long(int2) ) 
    call ExpecShort( short(int4) ) 
    ... 
    end 

ExpecLong is some subroutine called by the user program that expects a long (INTEGER*4) integer argument. Similarly, ExpecShort expects a short (INTEGER*2) integer argument.

long is useful if constants are used in calls to library routines and the code is compiled with the -i2 option.

short is useful in similar context when an otherwise long object must be passed as a short integer. Passing an integer to short that is too large in magnitude does not cause an error, but will result in unexpected behavior.