MicrOS
copysign.c File Reference
#include "../math.h"

Functions

double copysign (double x, double y)
 Copy sign. More...
 

Function Documentation

◆ copysign()

double copysign ( double  x,
double  y 
)

Copy sign.

The copysign functions produce a value with the magnitude of x and the sign of y. They produce a NaN (with the sign of y) if x is a NaN. On implementations that represent a signed zero but do not treat negative zero consistently in arithmetic operations, the copysign functions regard the sign of zero as positive.

Parameters
xValue with the magnitude of the resulting value.
yValue with the sign of the resulting value.
Returns
The copysign functions return a value with the magnitude of x and the sign of y.