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

Last change on this file since 812 was 777, checked in by meunier, 9 years ago
  • Ajout de quelques fonction dans la lib math
  • Déplacement de certaines fonctions de stdlib vers string
File size: 789 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        uint32_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.