Export (0) Print
Expand All
and
div
eof
not
or
xor
Expand Minimize

copysign, copysignf, copysignl, _copysign, _copysignf, _copysignl

Returns a value that has the magnitude of one argument and the sign of another.

double copysign( 
   double x,
   double y 
);
float copysign( 
   float x,
   float y 
); // C++ only
long double copysign( 
   long double x,
   long double y 
); // C++ only
float copysignf( 
   float x,
   float y 
); // C++ only
long double copysignl( 
   long double x,
   long double y 
); // C++ only
double _copysign( 
   double x,
   double y 
);
long double _copysignl( 
   long double x,
   long double y 
);

x

The floating-point value that's returned as the magnitude of the result.

y

The floating-point value that's returned as the sign of the result.

Floating-Point Support Routines

The copysign functions return a floating-point value that combines the magnitude of x and the sign of y. There is no error return.

Because C++ allows overloading, you can call overloads of copysign that take and return float or long double values. In a C program, copysign always takes and returns a double.

Routine

Required header

_copysign

<float.h>

copysign, copysignf, copysignl, _copysignf _copysignl

<math.h>

For more compatibility information, see Compatibility.

Not applicable. To call the standard C function, use PInvoke. For more information, see Platform Invoke Examples.

Show:
© 2014 Microsoft