xref: /haiku/src/system/libroot/posix/musl/math/copysign.c (revision f504f61099b010fbfa94b1cc63d2e9072c7f7185)
1*f504f610SAugustin Cavalier #include "libm.h"
2*f504f610SAugustin Cavalier 
copysign(double x,double y)3*f504f610SAugustin Cavalier double copysign(double x, double y) {
4*f504f610SAugustin Cavalier 	union {double f; uint64_t i;} ux={x}, uy={y};
5*f504f610SAugustin Cavalier 	ux.i &= -1ULL/2;
6*f504f610SAugustin Cavalier 	ux.i |= uy.i & 1ULL<<63;
7*f504f610SAugustin Cavalier 	return ux.f;
8*f504f610SAugustin Cavalier }
9