static double copysign

static double copysign(double __x, double __y)

The copysign() function returns __x but with the sign of __y. They work even if __x or __y are NaN or zero.