copysign.3m (2010 09)
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);
HP Integrity Server 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.
Integrity Server 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 Integrity servers)
copysignw()or copysignq(), compile
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")
HP-UX 11i Version 3: September 2010 − 1 − Hewlett-Packard Company 1