HP-UX Reference (11i v2 04/09) - 3 Library Functions A-M (vol 6)
c
copysign(3M) copysign(3M)
NAME
copysign( ), copysignf( ), copysignl( ), copysignw( ), copysignq() - copysign functions
SYNOPSIS
#include <math.h>
double copysign(double x, double y);
float copysignf(float x, float y);
Itanium(R)-based System Only
long double copysignl(long double x, long double y);
extended copysignw(extended x, extended y);
quad copysignq(quad x, quad y);
DESCRIPTION
The copysign() function returns x with its sign changed to the sign of y.
copysignf() is a float version of copysign()
; it takes float arguments and returns a float
result.
Itanium-based System Only
copysignl() is a long double version of copysign(); it takes long double arguments and
returns a long double result.
copysignw() is an extended version of copysign(); it takes extended arguments and returns
an extended result.
copysignq() is equivalent to copysignl() on HP-UX systems.
USAGE
To use these functions, compile either with the default
-Ae option or with the
-Aa and
-D_HPUX_SOURCE options. To use (for Itanium-based systems)
copysignw()or copysignq(), com-
pile with the
-fpwidetypes option. Make sure your program includes <math.h>. Link in the math
library by specifying -lm on the compiler or linker command line.
RETURN VALUE
The
copysign() function returns a value with the magnitude of x and the sign of y.
These functions raise no exceptions.
ERRORS
No errors are defined.
SEE ALSO
fabs(3M), fpclassify(3M), remainder(3M), scalbn(3M), signbit(3M), math(5).
STANDARDS CONFORMANCE
copysign(), copysignf(), copysignl() : ISO/IEC C99 (including Annex F, "IEC 60559 floating-
point arithmetic")
Section 3−−122 Hewlett-Packard Company − 1 − HP-UX 11i Version 2: September 2004