man.bsd.lv manual page server

Manual Page Search Parameters

COPYSIGN(3) Library Functions Manual COPYSIGN(3)

copysign, copysignf, copysignlfunctions to manipulate signs

library “libm”

#include <math.h>

double
copysign(double x, double y);

float
copysignf(float x, float y);

long double
copysignl(long double x, long double y);

#include <tgmath.h>

real-floating
copysign(real-floating x, real-floating y);

The (), (), and () functions return a value whose absolute value matches x, but whose sign bit is taken from y.

Upon successful completion, all three functions return a value with the magnitude of x and the sign of y. If x is NaN , the functions return a NaN with the sign of y.

math(3), signbit(3)

The described functions conform to ISO/IEC 9899:1999 (“ISO C99”).

Note that on implementations that represent a signed zero but do not treat negative zero consistently in arithmetic operations, these functions may regard the sign of zero as positive.

September 28, 2017 NetBSD-9.2