SIGN — Sign copying function#
-
SIGN(A, B)#
SIGN(A,B)returns the value ofAwith the sign ofB.- Parameters
A – Shall be of type
INTEGERorREALB – Shall be of the same type and kind as
A.
- Returns
The kind of the return value is that of
AandB. If B ge 0 then the result isABS(A), else it is-ABS(A).
- Standard:
Fortran 77 and later
- Class:
Elemental function
- Syntax:
RESULT = SIGN(A, B)
- Example:
program test_sign print *, sign(-12,1) print *, sign(-12,0) print *, sign(-12,-1) print *, sign(-12.,1.) print *, sign(-12.,0.) print *, sign(-12.,-1.) end program test_sign
- Specific names:
Name
Arguments
Return type
Standard
SIGN(A,B)REAL(4) A, BREAL(4)Fortran 77 and later
ISIGN(A,B)INTEGER(4) A, BINTEGER(4)Fortran 77 and later
DSIGN(A,B)REAL(8) A, BREAL(8)Fortran 77 and later