COPYSIGN(3)

NAME
copysign, copysignf, copysignl - functions to manipulate signs

LIBRARY
libm

SYNOPSIS
#include <math.h>
double
copysign(double x, double y);
float
copysignf(float x, float y);
long double
copysignl(long double x, long double y);
#include <tgmath.h>
real-floating
copysign(real-floating x, real-floating y);

DESCRIPTION
The copysign(), copysignf(), and copysignl() functions return a value whose absolute value matches x, but whose sign bit is taken from y.

RETURN VALUES
Upon successful completion, all three functions return a value with the magnitude of x and the sign of y. If x is , the functions return a with the sign of y.

SEE ALSO
math(3), signbit(3)

STANDARDS
The described functions conform to isoC-99.

CAVEATS
Note that on implementations that represent a signed zero but do not treat negative zero consistently in arithmetic operations, these functions may regard the sign of zero as positive.