ieee_copy_sign(3I)

IEEE_COPY_SIGN - Returns x with the sign of y

As shipped in IRIX 6.5. First release of IRIX 6.5.

NAME
     IEEE_COPY_SIGN - Returns x with the sign of y

SYNOPSIS
     IEEE_COPY_SIGN ([X=]x, [Y=]y)

IMPLEMENTATION
     UNICOS/mk and IRIX systems

     CRAY T90 systems that support IEEE floating-point arithmetic

STANDARDS
     CF90 and MIPSpro 7 Fortran 90 compiler extension to Fortran 90

     IEEE Standard for Binary Floating-point Arithmetic

DESCRIPTION
     The IEEE_COPY_SIGN intrinsic function returns x with the sign of y.
     For example,
     ABS(x) = IEEE_COPY_SIGN(x, 1.0) even if x is a NaN.

     The Fortran 90 standard SIGN(3M) intrinsic function produces the same
     result as IEEE_COPY_SIGN on systems that support IEEE floating-point
     arithmetic.

     This function accepts the following arguments:

     x         Must be of type real.

     y         Must be of type real.  If x is a scalar, y must be a scalar.
               If x is an array, y can be scalar or an array of the same
               shape as x.

     IEEE_COPY_SIGN is an elemental function.  The name of this intrinsic
     cannot be passed as an argument.

NOTES
     The IEEE intrinsic procedures use the named constants contained in a
     system module, so you must include one of the following statements in
     your program:

     * On UNICOS and UNICOS/mk systems:  USE CRI_IEEE_DEFINITIONS

     * On UNICOS, UNICOS/mk, and IRIX systems:  USE FTN_IEEE_DEFINITIONS

     The CRI_IEEE_DEFINITIONS module is obsolescent.  It will be removed
     for the CF90 4.0 release.

RETURN VALUES
     The return value is of the same type and type parameter as x.  If x is
     an array, the result is an array of the same shape as x.

     If x is scalar, the result is a scalar that has the same value as x
     but with the sign of y.

     If x is an array and y is scalar, the result is an array in which each
     element has the value of the corresponding element of x and the sign
     of y.

     If x is an array and y is an array, the result is an array in which
     each element has the value of x  but the sign of y .
                                    i                  i
EXAMPLES
     Example 1.  Each element of x now has its original value but with the
     sign of each corresponding element of y:

          REAL   x(10), y(10)
          ...                 ! Compute X and Y.
          x = IEEE_COPY_SIGN(x, y)

     Example 2.  The following PRINT statement is executed on a system that
     supports the IEEE standard for floating-point arithmetic:

          PRINT *, 'IEEE_COPY_SIGN(5.0,-0.0)

     The output of the preceding PRINT statement is -5.0.

SEE ALSO
     SIGN(3M)

     Intrinsic Procedures Reference Manual, publication SR-2138, for the
     printed version of this man page.