sign(3f) - [FORTRAN:INTRINSIC:NUMERIC] Sign copying function
Syntax
Description
Arguments
Return Value
Example
Standard
Class
result = sign(a, b)
sign(a,b) returns the value of A with the sign of B.
A - Shall be of type INTEGER or REAL B - Shall be of the same type and kind as A
The kind of the return value is that of A and B. If B >= 0 then the result is abs(a), else it is -abs(a).
Sample program:
program demo_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 demo_sign
[[FORTRAN 77]] and later
[[Elemental procedure|Elemental function]]
sign (3) | March 19, 2019 |