genericopenlibs/openenvcore/libm/src/s_copysign.c
changeset 0 e4d67989cc36
equal deleted inserted replaced
-1:000000000000 0:e4d67989cc36
       
     1 /*--------------------------------------------------------------------
       
     2  *© Portions copyright (c) 2006 Nokia Corporation.  All rights reserved.
       
     3  *--------------------------------------------------------------------
       
     4 */
       
     5 /* @(#)s_copysign.c 5.1 93/09/24 */
       
     6 /*
       
     7  * ====================================================
       
     8  * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
       
     9  *
       
    10  * Developed at SunPro, a Sun Microsystems, Inc. business.
       
    11  * Permission to use, copy, modify, and distribute this
       
    12  * software is freely granted, provided that this notice
       
    13  * is preserved.
       
    14  * ====================================================
       
    15  */
       
    16 #ifndef __SYMBIAN32__
       
    17 #ifndef lint
       
    18 static char rcsid[] = "$FreeBSD: src/lib/msun/src/s_copysign.c,v 1.9 2003/07/23 04:53:46 peter Exp $";
       
    19 #endif
       
    20 #endif //__SYMBIAN32__
       
    21 
       
    22 /*
       
    23  * copysign(double x, double y)
       
    24  * copysign(x,y) returns a value with the magnitude of x and
       
    25  * with the sign bit of y.
       
    26  */
       
    27 
       
    28 #include <math.h>
       
    29 #include "math_private.h"
       
    30 
       
    31 EXPORT_C double copysign(double x, double y)
       
    32 {
       
    33 	u_int32_t hx,hy;
       
    34 	GET_HIGH_WORD(hx,x);
       
    35 	GET_HIGH_WORD(hy,y);
       
    36 	SET_HIGH_WORD(x,(hx&0x7fffffff)|(hy&0x80000000));
       
    37         return x;
       
    38 }