2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / libjava / java / lang / s_fabs.c
blobdfee33fecdbeca76b936b0515010ea6a0ff47dbc
2 /* @(#)s_fabs.c 5.1 93/09/24 */
3 /*
4 * ====================================================
5 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
7 * Developed at SunPro, a Sun Microsystems, Inc. business.
8 * Permission to use, copy, modify, and distribute this
9 * software is freely granted, provided that this notice
10 * is preserved.
11 * ====================================================
15 FUNCTION
16 <<fabs>>, <<fabsf>>---absolute value (magnitude)
17 INDEX
18 fabs
19 INDEX
20 fabsf
22 ANSI_SYNOPSIS
23 #include <math.h>
24 double fabs(double <[x]>);
25 float fabsf(float <[x]>);
27 TRAD_SYNOPSIS
28 #include <math.h>
29 double fabs(<[x]>)
30 double <[x]>;
32 float fabsf(<[x]>)
33 float <[x]>;
35 DESCRIPTION
36 <<fabs>> and <<fabsf>> calculate
37 @tex
38 $|x|$,
39 @end tex
40 the absolute value (magnitude) of the argument <[x]>, by direct
41 manipulation of the bit representation of <[x]>.
43 RETURNS
44 The calculated value is returned. No errors are detected.
46 PORTABILITY
47 <<fabs>> is ANSI.
48 <<fabsf>> is an extension.
53 * fabs(x) returns the absolute value of x.
56 #include "fdlibm.h"
58 #ifndef _DOUBLE_IS_32BITS
60 #ifdef __STDC__
61 double fabs(double x)
62 #else
63 double fabs(x)
64 double x;
65 #endif
67 uint32_t high;
68 GET_HIGH_WORD(high,x);
69 SET_HIGH_WORD(x,high&0x7fffffff);
70 return x;
73 #endif /* _DOUBLE_IS_32BITS */