Add fabsf function
This commit is contained in:
parent
d1fd04e72a
commit
17b10f1bf3
3 changed files with 26 additions and 0 deletions
|
@ -24,6 +24,7 @@ _PROTOTYPE( double cos, (double _x) );
|
|||
_PROTOTYPE( double cosh, (double _x) );
|
||||
_PROTOTYPE( double exp, (double _x) );
|
||||
_PROTOTYPE( double fabs, (double _x) );
|
||||
_PROTOTYPE( double fabsf, (float _x) );
|
||||
_PROTOTYPE( double floor, (double _x) );
|
||||
_PROTOTYPE( double fmod, (double _x, double _y) );
|
||||
_PROTOTYPE( double frexp, (double _x, int *_exp) );
|
||||
|
|
|
@ -6,8 +6,15 @@
|
|||
*/
|
||||
/* $Header$ */
|
||||
|
||||
float
|
||||
fabsf(float x)
|
||||
{
|
||||
return x < 0 ? -x : x;
|
||||
}
|
||||
|
||||
double
|
||||
fabs(double x)
|
||||
{
|
||||
return x < 0 ? -x : x;
|
||||
}
|
||||
|
||||
|
|
18
man/man3/fabs.3
Normal file
18
man/man3/fabs.3
Normal file
|
@ -0,0 +1,18 @@
|
|||
.TH FABS 3 "January 7, 2009"
|
||||
.UC 4
|
||||
.SH NAME
|
||||
fabs, fabsf \- compute absolute value
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
.ft B
|
||||
#include <math.h>
|
||||
|
||||
double fabs(double \fIx\fP);
|
||||
float fabsf(float \fIx\fP);
|
||||
.fi
|
||||
.SH DESCRIPTION
|
||||
\fBfabs\fP and \fBfabsf\fP return the absolute value of their argument.
|
||||
.SH "RETURN VALUE
|
||||
The return value is a number with the same magnitude as the argument and with
|
||||
a positive sign.
|
||||
|
Loading…
Reference in a new issue