Guardian Native C Library Calls Reference Manual (G06.29+, H06.08+, J06.03+)

Guardian Native C Library Calls (a - e) copysign(3)
NAME
copysign - Returns x with the sign of y
LIBRARY
G-series Guardian native processes: $SYSTEM.SYSnn.ZCRTLSRL
G-series OSS native processes: /G/system/sysnn/zcrtlsrl
H-series and J-series Guardian native processes: $SYSTEM.ZDLLnnn.ZCRTLDLL
32-bit H-series and J-series OSS processes: /G/system/zdllnnn/zcrtldll
64-bit H-series and J-series OSS processes: /G/system/zdllnnn/ycrtldll
SYNOPSIS
#include <math.h>
double copysign(
double x,
double y
);
PARAMETERS
x Species a double-precision floating-point value.
y Species a double-precision floating-point value.
DESCRIPTION
The copysign() function clears the sign bit (the most significant bit) of x and ORs in the sign bit
of y. The result is x with the sign of y.
This function is recommended by the IEEE Std 754-1985 for floating-point arithmetic.
The copysign() function can be called only by native processes.
NOTES
This function supports both IEEE Std 754-1985 floating-point and Tandem floating-point values.
IEEE values can include NaN and infinity, and the sign of 0 (zero) can be either positive or nega-
tive. Refer to the fp_class(3) reference page for a description of IEEE value classes.
Guardian functions are available to convert between floating-point formats. Refer to the Guar-
dian Programmers Guide for a discussion of floating-point conversions.
IEEE Std 754-1985 requires that copysign(x,NaN) = ±x but says nothing else about the sign of a
return value that is a NaN.
RETURN VALUES
The copysign() function returns x with the sign of y.
ERRORS
No errors can be returned. This function does not set errno.
RELATED INFORMATION
Functions: floor(3), fp_class(3).
STANDARDS CONFORMANCE
This function is an IEEE extension to the XPG4 Version 2 specification.
527192-018 Hewlett-Packard Company 1117