1*627f7eb2Smrg /* s_copysignl.c -- long double version of s_copysign.c.
2*627f7eb2Smrg * Conversion to long double by Jakub Jelinek, jj@ultra.linux.cz.
3*627f7eb2Smrg */
4*627f7eb2Smrg
5*627f7eb2Smrg /*
6*627f7eb2Smrg * ====================================================
7*627f7eb2Smrg * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
8*627f7eb2Smrg *
9*627f7eb2Smrg * Developed at SunPro, a Sun Microsystems, Inc. business.
10*627f7eb2Smrg * Permission to use, copy, modify, and distribute this
11*627f7eb2Smrg * software is freely granted, provided that this notice
12*627f7eb2Smrg * is preserved.
13*627f7eb2Smrg * ====================================================
14*627f7eb2Smrg */
15*627f7eb2Smrg
16*627f7eb2Smrg #if defined(LIBM_SCCS) && !defined(lint)
17*627f7eb2Smrg static char rcsid[] = "NetBSD: ";
18*627f7eb2Smrg #endif
19*627f7eb2Smrg
20*627f7eb2Smrg /*
21*627f7eb2Smrg * copysignq(long double x, long double y)
22*627f7eb2Smrg * copysignq(x,y) returns a value with the magnitude of x and
23*627f7eb2Smrg * with the sign bit of y.
24*627f7eb2Smrg */
25*627f7eb2Smrg
26*627f7eb2Smrg #define NO_MATH_REDIRECT
27*627f7eb2Smrg
28*627f7eb2Smrg #include "quadmath-imp.h"
29*627f7eb2Smrg
copysignq(__float128 x,__float128 y)30*627f7eb2Smrg __float128 copysignq(__float128 x, __float128 y)
31*627f7eb2Smrg {
32*627f7eb2Smrg uint64_t hx,hy;
33*627f7eb2Smrg GET_FLT128_MSW64(hx,x);
34*627f7eb2Smrg GET_FLT128_MSW64(hy,y);
35*627f7eb2Smrg SET_FLT128_MSW64(x,(hx&0x7fffffffffffffffULL)
36*627f7eb2Smrg |(hy&0x8000000000000000ULL));
37*627f7eb2Smrg return x;
38*627f7eb2Smrg }
39