13a8617a8SJordan K. Hubbard /*
23a8617a8SJordan K. Hubbard * ====================================================
33a8617a8SJordan K. Hubbard * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
43a8617a8SJordan K. Hubbard *
53a8617a8SJordan K. Hubbard * Developed at SunPro, a Sun Microsystems, Inc. business.
63a8617a8SJordan K. Hubbard * Permission to use, copy, modify, and distribute this
73a8617a8SJordan K. Hubbard * software is freely granted, provided that this notice
83a8617a8SJordan K. Hubbard * is preserved.
93a8617a8SJordan K. Hubbard * ====================================================
103a8617a8SJordan K. Hubbard */
113a8617a8SJordan K. Hubbard
123a8617a8SJordan K. Hubbard /*
133a8617a8SJordan K. Hubbard * copysign(double x, double y)
143a8617a8SJordan K. Hubbard * copysign(x,y) returns a value with the magnitude of x and
153a8617a8SJordan K. Hubbard * with the sign bit of y.
163a8617a8SJordan K. Hubbard */
173a8617a8SJordan K. Hubbard
183a8617a8SJordan K. Hubbard #include "math.h"
193a8617a8SJordan K. Hubbard #include "math_private.h"
203a8617a8SJordan K. Hubbard
2159b19ff1SAlfred Perlstein double
copysign(double x,double y)223819e840SPeter Wemm copysign(double x, double y)
233a8617a8SJordan K. Hubbard {
243a8617a8SJordan K. Hubbard u_int32_t hx,hy;
253a8617a8SJordan K. Hubbard GET_HIGH_WORD(hx,x);
263a8617a8SJordan K. Hubbard GET_HIGH_WORD(hy,y);
273a8617a8SJordan K. Hubbard SET_HIGH_WORD(x,(hx&0x7fffffff)|(hy&0x80000000));
283a8617a8SJordan K. Hubbard return x;
293a8617a8SJordan K. Hubbard }
30