Name
copysign, copysignf, copysignl,
- copy sign of a number
Library
libm.lib
Synopsis
|
double
copysign (double x, double y);
|
|
float
copysignf (float x, float y);
|
|
long double
copysignl (long double x, long double y);
|
Detailed description
The
copysign,
copysignf,
and
copysignl
functions
return
x
with its sign changed to
y ’s.
Examples
#include <math.h>
void main( void )
{
double x1 = 0, x2 = -4, y;
y = copysign( x1, x2 );
printf( "copysign(%f , %f) = %f\n", x1, x2, y );
y = copysignf( x1, x2 );
printf( "copysignf(%f , %f) = %f\n", x1, x2, y );
y = copysignl( x1, x2 );
printf( "copysignl(%f , %f) = %f\n", x1, x2, y );
}
Output
copysign ( 0, -4 ) = -0.0
copysignf( 0, -4 ) = -0.0
copysignl( 0, -4 ) = -0.0
See also
fabs,
fdim,
ieee,
math
Feedback
For additional information or queries on this page send feedback
© 2005-2007 Nokia
|
|