s_copysignf.c revision 8870
12116Sjkh/* s_copysignf.c -- float version of s_copysign.c.
22116Sjkh * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
32116Sjkh */
42116Sjkh
52116Sjkh/*
62116Sjkh * ====================================================
72116Sjkh * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
82116Sjkh *
92116Sjkh * Developed at SunPro, a Sun Microsystems, Inc. business.
102116Sjkh * Permission to use, copy, modify, and distribute this
118870Srgrimes * software is freely granted, provided that this notice
122116Sjkh * is preserved.
132116Sjkh * ====================================================
142116Sjkh */
152116Sjkh
162116Sjkh#ifndef lint
178870Srgrimesstatic char rcsid[] = "$Id: s_copysignf.c,v 1.1.1.1 1994/08/19 09:39:57 jkh Exp $";
182116Sjkh#endif
192116Sjkh
202116Sjkh/*
212116Sjkh * copysignf(float x, float y)
222116Sjkh * copysignf(x,y) returns a value with the magnitude of x and
232116Sjkh * with the sign bit of y.
242116Sjkh */
252116Sjkh
262116Sjkh#include "math.h"
272116Sjkh#include "math_private.h"
282116Sjkh
292116Sjkh#ifdef __STDC__
302116Sjkh	float copysignf(float x, float y)
312116Sjkh#else
322116Sjkh	float copysignf(x,y)
332116Sjkh	float x,y;
342116Sjkh#endif
352116Sjkh{
362116Sjkh	u_int32_t ix,iy;
372116Sjkh	GET_FLOAT_WORD(ix,x);
382116Sjkh	GET_FLOAT_WORD(iy,y);
392116Sjkh	SET_FLOAT_WORD(x,(ix&0x7fffffff)|(iy&0x80000000));
402116Sjkh        return x;
412116Sjkh}
42