Namespaces
Variants
Views
Actions

Difference between revisions of "cpp/numeric/math/copysign"

From cppreference.com
< cpp‎ | numeric‎ | math
m (Update links.)
m (Use since= and until= params of {{dcl}} template.)
Line 3: Line 3:
 
{{dcl begin}}
 
{{dcl begin}}
 
{{dcl header | cmath}}
 
{{dcl header | cmath}}
{{dcl | notes={{mark since c++11}} | num = 1|
+
{{dcl | since=c++11 | num = 1|
 
float      copysign( float x, float y );
 
float      copysign( float x, float y );
 
}}
 
}}
{{dcl | notes={{mark since c++11}} | num = 2|
+
{{dcl | since=c++11 | num = 2|
 
double      copysign( double x, double y );
 
double      copysign( double x, double y );
 
}}
 
}}
{{dcl | notes={{mark since c++11}} | num = 3|
+
{{dcl | since=c++11 | num = 3|
 
long double copysign( long double x, long double y );
 
long double copysign( long double x, long double y );
 
}}
 
}}
{{dcl | notes={{mark since c++11}} | num = 4|
+
{{dcl | since=c++11 | num = 4|
 
Promoted    copysign( Arithmetic x, Arithmetic y );
 
Promoted    copysign( Arithmetic x, Arithmetic y );
 
}}
 
}}

Revision as of 15:42, 1 July 2013

 
 
 
 
Defined in header <cmath>
float       copysign( float x, float y );
(1) (since C++11)
double      copysign( double x, double y );
(2) (since C++11)
long double copysign( long double x, long double y );
(3) (since C++11)
Promoted    copysign( Arithmetic x, Arithmetic y );
(4) (since C++11)

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

4) If any argument has integral type, it is cast to double. If any other argument is long double, then the return type is long double, otherwise it is double.

Parameters

x, y - floating point values

Return value

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

See also

absolute value of a floating point value (|x|)
(function) [edit]
(C++11)
checks if the given number is negative
(function) [edit]