xref: /inferno-os/libmath/fdlibm/s_copysign.c (revision d0e1d143ef6f03c75c008c7ec648859dd260cbab)
1 /* derived from /netlib/fdlibm */
2 
3 /* @(#)s_copysign.c 1.3 95/01/18 */
4 /*
5  * ====================================================
6  * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
7  *
8  * Developed at SunSoft, a Sun Microsystems, Inc. business.
9  * Permission to use, copy, modify, and distribute this
10  * software is freely granted, provided that this notice
11  * is preserved.
12  * ====================================================
13  */
14 
15 /*
16  * copysign(double x, double y)
17  * copysign(x,y) returns a value with the magnitude of x and
18  * with the sign bit of y.
19  */
20 
21 #include "fdlibm.h"
22 
23 	double copysign(double x, double y)
24 {
25 	__HI(x) = (__HI(x)&0x7fffffff)|(__HI(y)&0x80000000);
26         return x;
27 }
28