FORTRAN Reference Manual

Intrinsic Functions
FORTRAN Reference Manual528615-001
8-27
SIGN Function
Considerations
For an argument of real type, REAL (x) returns x.
For an argument of integer or double precision type, REAL (x) has as much
precision of the significant part of x as a real datum can contain.
For an argument of complex type, REAL (x) returns the value of the real part of x.
That is,
REAL(CMPLX(x, y))
returns X.
For an integer argument, FLOAT (x) returns the same value as REAL (x).
Example of the REAL Function
total = FLOAT (number) * 2.50
SIGN Function
The SIGN function returns a value after transferring a sign.
The table below shows the argument and function type for the SIGN generic function
and its associated specific functions.
Considerations
The result of the SIGN function is of the same type as the arguments. Both
arguments must be of the same type.
The value of SIGN (x, y) is defined as:
|x| if y 0
-|x| if y < 0
Syntax Argument Type Function Type
SIGN (x, y)
SIGN (x, y)Real Real
ISIGN (x, y) Integer Integer
ISIGN4 (x, y) Integer*4 Integer*4
ISIGN8 (x, y) Integer*8 Integer*8
DSIGN (x, y) Double Precision Double Precision
x and y are arithmetic expressions.