uc-sdk
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
s_copysign.c
Go to the documentation of this file.
1 
2 /* @(#)s_copysign.c 1.3 95/01/18 */
3 /*
4  * ====================================================
5  * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
6  *
7  * Developed at SunSoft, a Sun Microsystems, Inc. business.
8  * Permission to use, copy, modify, and distribute this
9  * software is freely granted, provided that this notice
10  * is preserved.
11  * ====================================================
12  */
13 
14 /*
15  * copysign(double x, double y)
16  * copysign(x,y) returns a value with the magnitude of x and
17  * with the sign bit of y.
18  */
19 
20 #include "fdlibm.h"
21 
22 #ifdef __STDC__
23  double copysign(double x, double y)
24 #else
25  double copysign(x,y)
26  double x,y;
27 #endif
28 {
29  __HI(x) = (__HI(x)&0x7fffffff)|(__HI(y)&0x80000000);
30  return x;
31 }