std::copysign

From Cppreference

Jump to: navigation, search
Defined in header <cmath>

float       copysign( float x, float y );
(C++11 feature)
double      copysign( double x, double y );
(C++11 feature)
long double copysign( long double x, long double y );
(C++11 feature)

Composes a floating point value with the magnitude of x and the sign of y.

[edit] Parameters

x, y - floating point values

[edit] Return value

floating point value with the magnitude of x and the sign of y

[edit] See also

abs(float)
fabs
absolute value of an absolute value of an floating point value (|x|)
(function)
signbit (C++11)
checks if the given number is negative
(function)