Everything

copysign / copysignf / copysignl


Generates a value consisting of the absolute value of d1 and the sign of d2.

[Format]

#include <math.h>

double copysign(double d1, double d2);

float copysignf(float d1, float d2);

long double copysignl(long double d1, long double d2);

[Parameters]

d1 Value of which absolute value is to be used in the generated value

d2 Value of which sign is to be used in the generated value

[Return values]

Normal: Value consisting of absolute value of d1 and sign of d2

Abnormal: Range error: Returns an undetermined value.

[Remarks]

When d1 is a not-a-number, the copysign function group generates a not-a-number with the sign bit of d2.