Back to index

glibc  2.9
s_copysignf.c
Go to the documentation of this file.
00001 /* s_copysignf.c -- float version of s_copysign.c.
00002  * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
00003  */
00004 
00005 /*
00006  * ====================================================
00007  * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
00008  *
00009  * Developed at SunPro, a Sun Microsystems, Inc. business.
00010  * Permission to use, copy, modify, and distribute this
00011  * software is freely granted, provided that this notice 
00012  * is preserved.
00013  * ====================================================
00014  */
00015 
00016 #if defined(LIBM_SCCS) && !defined(lint)
00017 static char rcsid[] = "$NetBSD: s_copysignf.c,v 1.4 1995/05/10 20:46:59 jtc Exp $";
00018 #endif
00019 
00020 /*
00021  * copysignf(float x, float y)
00022  * copysignf(x,y) returns a value with the magnitude of x and
00023  * with the sign bit of y.
00024  */
00025 
00026 #include "math.h"
00027 #include "math_private.h"
00028 
00029 #ifdef __STDC__
00030        float __copysignf(float x, float y)
00031 #else
00032        float __copysignf(x,y)
00033        float x,y;
00034 #endif
00035 {
00036        u_int32_t ix,iy;
00037        GET_FLOAT_WORD(ix,x);
00038        GET_FLOAT_WORD(iy,y);
00039        SET_FLOAT_WORD(x,(ix&0x7fffffff)|(iy&0x80000000));
00040         return x;
00041 }
00042 weak_alias (__copysignf, copysignf)