ieee_copy_sign(3I)
IEEE_COPY_SIGN - Returns x with the sign of y
As shipped in IRIX 6.5.30. Last changed in IRIX 6.5.19.
NAME IEEE_COPY_SIGN - Returns x with the sign of y SYNOPSIS IEEE_COPY_SIGN ([X=]x, [Y=]y) STANDARDS Fortran extension 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 95 standard SIGN(3I) 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. 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 xi but the sign of yi. 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(3I)