Guardian Native C Library Calls Reference Manual (G06.28+, H06.04+)

copysign(3) Guardian Native C Library Calls Reference Manual
NAME
copysign - Returns x with the sign of y
LIBRARY
For G-series Guardian native processes: $SYSTEM.SYSnn.ZCRTLSRL
For G-series OSS native processes: /G/system/sysnn/zcrtlsrl
For H-series Guardian native processes: $SYSTEM.ZDLLnnn.ZCRTLDLL
For H-series OSS processes: /G/system/zdllnnn/zcrtldll
SYNOPSIS
#include <math.h>
double copysign(
double x,
double y
);
PARAMETERS
x Species a double-precision oating-point value.
y Species a double-precision oating-point value.
DESCRIPTION
The copysign() function clears the sign bit (the most signicant 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 oating-point arithmetic.
The copysign() function can be called only by native processes.
NOTES
This function supports both IEEE Std 754-1985 oating-point and Tandem oating-point values.
IEEE values can include NaN and innity, 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 oating-point formats. Refer to the Guar-
dian Programmers Guide for a discussion of oating-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: oor(3), fp_class(3).
STANDARDS CONFORMANCE
This function is an IEEE extension to the XPG4 Version 2 specication.
138 Hewlett-Packard Company 527192-005