Back to index

glibc  2.9
s_copysignl.c
Go to the documentation of this file.
00001 /* s_copysignl.c -- long double version of s_copysign.c.
00002  * Conversion to long double by Ulrich Drepper,
00003  * Cygnus Support, drepper@cygnus.com.
00004  */
00005 
00006 /*
00007  * ====================================================
00008  * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
00009  *
00010  * Developed at SunPro, a Sun Microsystems, Inc. business.
00011  * Permission to use, copy, modify, and distribute this
00012  * software is freely granted, provided that this notice
00013  * is preserved.
00014  * ====================================================
00015  */
00016 
00017 #if defined(LIBM_SCCS) && !defined(lint)
00018 static char rcsid[] = "$NetBSD: $";
00019 #endif
00020 
00021 /*
00022  * copysignl(long double x, long double y)
00023  * copysignl(x,y) returns a value with the magnitude of x and
00024  * with the sign bit of y.
00025  */
00026 
00027 #include "math.h"
00028 #include "math_private.h"
00029 
00030 #ifdef __STDC__
00031        long double __copysignl(long double x, long double y)
00032 #else
00033        long double __copysignl(x,y)
00034        long double x,y;
00035 #endif
00036 {
00037        u_int32_t es1,es2;
00038        GET_LDOUBLE_EXP(es1,x);
00039        GET_LDOUBLE_EXP(es2,y);
00040        SET_LDOUBLE_EXP(x,(es1&0x7fff)|(es2&0x8000));
00041         return x;
00042 }
00043 weak_alias (__copysignl, copysignl)