Go to the first, previous, next, last section, table of contents.

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).



Go to the first, previous, next, last section, table of contents.