# libm.info: copysign

**Go forward to cosh**

**Go backward to cbrt**

**Go up to Math**

**Go to the top op libm**

# `copysign', `copysignf'--sign of Y, magnitude of X

*Synopsis*
#include <math.h>
double copysign (double X, double Y);
float copysignf (float X, float Y);
*Description*
`copysign' constructs a number with the magnitude (absolute value) of
its first argument, X, and the sign of its second argument, Y.

`copysignf' does the same thing; the two functions differ only in
the type of their arguments and result.

*Returns*
`copysign' returns a `double' with the magnitude of X and the sign of Y.
`copysignf' returns a `float' with the magnitude of X and the sign of Y.

*Portability*
`copysign' is not required by either ANSI C or the System V Interface
Definition (Issue 2).

Created Mon Nov 8 17:42:56 2004 on tillpc with info_to_html version 0.9.6.