2 Copyright 1988-2022 Free Software Foundation, Inc.
3 This is part of the GCC manual.
4 For copying conditions, see the copyright.rst file.
14 .. index:: sign copying
16 SIGN --- Sign copying function
17 ******************************
19 .. function:: SIGN(A,B)
21 ``SIGN(A,B)`` returns the value of :samp:`{A}` with the sign of :samp:`{B}`.
24 Shall be of type ``INTEGER`` or ``REAL``
27 Shall be of the same type and kind as :samp:`{A}`.
30 The kind of the return value is that of :samp:`{A}` and :samp:`{B}`.
31 If B \ge 0 then the result is ``ABS(A)``, else
41 .. code-block:: fortran
46 .. code-block:: fortran
53 print *, sign(-12.,1.)
54 print *, sign(-12.,0.)
55 print *, sign(-12.,-1.)
70 - Fortran 77 and later
74 - Fortran 77 and later
78 - Fortran 77 and later