source: soft/giet_vm/giet_libs/math/s_copysign.c @ 747

Last change on this file since 747 was 581, checked in by laurent, 10 years ago

Adding ocean application, some mathematics functions and distributed locks

File size: 790 bytes
Line 
1/*
2 * ====================================================
3 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
4 *
5 * Developed at SunPro, a Sun Microsystems, Inc. business.
6 * Permission to use, copy, modify, and distribute this
7 * software is freely granted, provided that this notice
8 * is preserved.
9 * ====================================================
10 */
11
12/* Modified for GIET-VM static OS at UPMC, France 2015.
13 */
14
15/*
16 * copysign(double x, double y)
17 * copysign(x,y) returns a value with the magnitude of x and
18 * with the sign bit of y.
19 */
20
21#include "../math.h"
22#include "math_private.h"
23
24double copysign(double x, double y)
25{
26        u_int32_t hx,hy;
27        GET_HIGH_WORD(hx,x);
28        GET_HIGH_WORD(hy,y);
29        SET_HIGH_WORD(x,(hx&0x7fffffff)|(hy&0x80000000));
30        return x;
31}
32
Note: See TracBrowser for help on using the repository browser.