1 
2 /* @(#)s_fabs.c 5.1 93/09/24 */
3 /*
4  * ====================================================
5  * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
6  *
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  * ====================================================
12  */
13 
14 /*
15 FUNCTION
16        <<fabs>>, <<fabsf>>---absolute value (magnitude)
17 INDEX
18 	fabs
19 INDEX
20 	fabsf
21 
22 SYNOPSIS
23 	#include <math.h>
24        double fabs(double <[x]>);
25        float fabsf(float <[x]>);
26 
27 DESCRIPTION
28 <<fabs>> and <<fabsf>> calculate
29 @tex
30 $|x|$,
31 @end tex
32 the absolute value (magnitude) of the argument <[x]>, by direct
33 manipulation of the bit representation of <[x]>.
34 
35 RETURNS
36 The calculated value is returned.  No errors are detected.
37 
38 PORTABILITY
39 <<fabs>> is ANSI.
40 <<fabsf>> is an extension.
41 
42 */
43 
44 /*
45  * fabs(x) returns the absolute value of x.
46  */
47 
48 #include "fdlibm.h"
49 
50 #ifdef _NEED_FLOAT64
51 
52 __float64
fabs64(__float64 x)53 fabs64(__float64 x)
54 {
55     __uint32_t high;
56     GET_HIGH_WORD(high, x);
57     SET_HIGH_WORD(x, high & 0x7fffffff);
58     return x;
59 }
60 
61 _MATH_ALIAS_d_d(fabs)
62 
63 #endif /* _NEED_FLOAT64 */
64