sl@0
|
1 |
/* S_FABS.C
|
sl@0
|
2 |
*
|
sl@0
|
3 |
* Portions Copyright (c) 1993-2005 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
4 |
* All rights reserved.
|
sl@0
|
5 |
*/
|
sl@0
|
6 |
|
sl@0
|
7 |
|
sl@0
|
8 |
/* @(#)s_fabs.c 5.1 93/09/24 */
|
sl@0
|
9 |
/*
|
sl@0
|
10 |
* ====================================================
|
sl@0
|
11 |
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
|
sl@0
|
12 |
*
|
sl@0
|
13 |
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
sl@0
|
14 |
* Permission to use, copy, modify, and distribute this
|
sl@0
|
15 |
* software is freely granted, provided that this notice
|
sl@0
|
16 |
* is preserved.
|
sl@0
|
17 |
* ====================================================
|
sl@0
|
18 |
*/
|
sl@0
|
19 |
|
sl@0
|
20 |
/*
|
sl@0
|
21 |
FUNCTION
|
sl@0
|
22 |
<<fabs>>, <<fabsf>>---absolute value (magnitude)
|
sl@0
|
23 |
INDEX
|
sl@0
|
24 |
fabs
|
sl@0
|
25 |
INDEX
|
sl@0
|
26 |
fabsf
|
sl@0
|
27 |
|
sl@0
|
28 |
ANSI_SYNOPSIS
|
sl@0
|
29 |
#include <math.h>
|
sl@0
|
30 |
double fabs(double <[x]>);
|
sl@0
|
31 |
float fabsf(float <[x]>);
|
sl@0
|
32 |
|
sl@0
|
33 |
TRAD_SYNOPSIS
|
sl@0
|
34 |
#include <math.h>
|
sl@0
|
35 |
double fabs(<[x]>)
|
sl@0
|
36 |
double <[x]>;
|
sl@0
|
37 |
|
sl@0
|
38 |
float fabsf(<[x]>)
|
sl@0
|
39 |
float <[x]>;
|
sl@0
|
40 |
|
sl@0
|
41 |
DESCRIPTION
|
sl@0
|
42 |
<<fabs>> and <<fabsf>> calculate
|
sl@0
|
43 |
@tex
|
sl@0
|
44 |
$|x|$,
|
sl@0
|
45 |
@end tex
|
sl@0
|
46 |
the absolute value (magnitude) of the argument <[x]>, by direct
|
sl@0
|
47 |
manipulation of the bit representation of <[x]>.
|
sl@0
|
48 |
|
sl@0
|
49 |
RETURNS
|
sl@0
|
50 |
The calculated value is returned. No errors are detected.
|
sl@0
|
51 |
|
sl@0
|
52 |
PORTABILITY
|
sl@0
|
53 |
<<fabs>> is ANSI.
|
sl@0
|
54 |
<<fabsf>> is an extension.
|
sl@0
|
55 |
|
sl@0
|
56 |
*/
|
sl@0
|
57 |
|
sl@0
|
58 |
/*
|
sl@0
|
59 |
* fabs(x) returns the absolute value of x.
|
sl@0
|
60 |
*/
|
sl@0
|
61 |
|
sl@0
|
62 |
#include "FDLIBM.H"
|
sl@0
|
63 |
|
sl@0
|
64 |
/**
|
sl@0
|
65 |
Return absolute value of floating-point.
|
sl@0
|
66 |
Returns the absoulte value of parameter x. /x/
|
sl@0
|
67 |
@return Absoulte value of x.
|
sl@0
|
68 |
@param x Floating point value.
|
sl@0
|
69 |
*/
|
sl@0
|
70 |
EXPORT_C double fabs(double x) __SOFTFP
|
sl@0
|
71 |
{
|
sl@0
|
72 |
__uint32_t high;
|
sl@0
|
73 |
GET_HIGH_WORD(high,x);
|
sl@0
|
74 |
SET_HIGH_WORD(x,high&0x7fffffff);
|
sl@0
|
75 |
return x;
|
sl@0
|
76 |
}
|