os/ossrv/genericopenlibs/cstdlib/LMATH/S_FABS.C
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/ossrv/genericopenlibs/cstdlib/LMATH/S_FABS.C	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,76 @@
     1.4 +/* S_FABS.C
     1.5 + * 
     1.6 + * Portions Copyright (c) 1993-2005 Nokia Corporation and/or its subsidiary(-ies).
     1.7 + * All rights reserved.
     1.8 + */
     1.9 +
    1.10 +
    1.11 +/* @(#)s_fabs.c 5.1 93/09/24 */
    1.12 +/*
    1.13 + * ====================================================
    1.14 + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
    1.15 + *
    1.16 + * Developed at SunPro, a Sun Microsystems, Inc. business.
    1.17 + * Permission to use, copy, modify, and distribute this
    1.18 + * software is freely granted, provided that this notice 
    1.19 + * is preserved.
    1.20 + * ====================================================
    1.21 + */
    1.22 +
    1.23 +/*
    1.24 +FUNCTION
    1.25 +       <<fabs>>, <<fabsf>>---absolute value (magnitude)
    1.26 +INDEX
    1.27 +	fabs
    1.28 +INDEX
    1.29 +	fabsf
    1.30 +
    1.31 +ANSI_SYNOPSIS
    1.32 +	#include <math.h>
    1.33 +       double fabs(double <[x]>);
    1.34 +       float fabsf(float <[x]>);
    1.35 +
    1.36 +TRAD_SYNOPSIS
    1.37 +	#include <math.h>
    1.38 +       double fabs(<[x]>) 
    1.39 +       double <[x]>;
    1.40 +
    1.41 +       float fabsf(<[x]>)
    1.42 +       float <[x]>;
    1.43 +
    1.44 +DESCRIPTION
    1.45 +<<fabs>> and <<fabsf>> calculate 
    1.46 +@tex
    1.47 +$|x|$, 
    1.48 +@end tex
    1.49 +the absolute value (magnitude) of the argument <[x]>, by direct
    1.50 +manipulation of the bit representation of <[x]>.
    1.51 +
    1.52 +RETURNS
    1.53 +The calculated value is returned.  No errors are detected.
    1.54 +
    1.55 +PORTABILITY
    1.56 +<<fabs>> is ANSI.
    1.57 +<<fabsf>> is an extension.
    1.58 +
    1.59 +*/
    1.60 +
    1.61 +/*
    1.62 + * fabs(x) returns the absolute value of x.
    1.63 + */
    1.64 +
    1.65 +#include "FDLIBM.H"
    1.66 +
    1.67 +/**
    1.68 +Return absolute value of floating-point.
    1.69 +Returns the absoulte value of parameter x. /x/ 
    1.70 +@return Absoulte value of x.
    1.71 +@param x Floating point value.
    1.72 +*/
    1.73 +EXPORT_C double fabs(double x) __SOFTFP
    1.74 +{
    1.75 +	__uint32_t high;
    1.76 +	GET_HIGH_WORD(high,x);
    1.77 +	SET_HIGH_WORD(x,high&0x7fffffff);
    1.78 +        return x;
    1.79 +}