]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - lib/msun/src/s_copysign.c
zfs: merge openzfs/zfs@39be46f43
[FreeBSD/FreeBSD.git] / lib / msun / src / s_copysign.c
1 /*
2  * ====================================================
3  * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
4  *
5  * Developed at SunPro, a Sun Microsystems, Inc. business.
6  * Permission to use, copy, modify, and distribute this
7  * software is freely granted, provided that this notice
8  * is preserved.
9  * ====================================================
10  */
11
12 /*
13  * copysign(double x, double y)
14  * copysign(x,y) returns a value with the magnitude of x and
15  * with the sign bit of y.
16  */
17
18 #include "math.h"
19 #include "math_private.h"
20
21 double
22 copysign(double x, double y)
23 {
24         u_int32_t hx,hy;
25         GET_HIGH_WORD(hx,x);
26         GET_HIGH_WORD(hy,y);
27         SET_HIGH_WORD(x,(hx&0x7fffffff)|(hy&0x80000000));
28         return x;
29 }