|
|
#include <math.h>float copysignf(float val, float signval);double copysign(double val, double signval); long double copysignl(long double val, long double signval);
copysign( ), copysignf( ), and copysignl( ) were added by C99.
The copysign( ) family of functions gives val the same sign as the value passed in signval and returns the result. Thus, the value returned has a magnitude equal to val, but with the same sign as that of signval.
A related function is fabs( ).
|
|