blob: c61698c0ef66e27526321f89f524a7e318a7dbe4 [file] [log] [blame]
The Android Open Source Projectb07e1d92009-03-03 19:29:30 -08001
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 * ieee_copysign(double x, double y)
16 * ieee_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 ieee_copysign(double x, double y)
24#else
25 double ieee_copysign(x,y)
26 double x,y;
27#endif
28{
29 __HI(x) = (__HI(x)&0x7fffffff)|(__HI(y)&0x80000000);
30 return x;
31}