sl@0: /* S_FABS.C sl@0: * sl@0: * Portions Copyright (c) 1993-2005 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: */ sl@0: sl@0: sl@0: /* @(#)s_fabs.c 5.1 93/09/24 */ sl@0: /* sl@0: * ==================================================== sl@0: * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. sl@0: * sl@0: * Developed at SunPro, a Sun Microsystems, Inc. business. sl@0: * Permission to use, copy, modify, and distribute this sl@0: * software is freely granted, provided that this notice sl@0: * is preserved. sl@0: * ==================================================== sl@0: */ sl@0: sl@0: /* sl@0: FUNCTION sl@0: <>, <>---absolute value (magnitude) sl@0: INDEX sl@0: fabs sl@0: INDEX sl@0: fabsf sl@0: sl@0: ANSI_SYNOPSIS sl@0: #include sl@0: double fabs(double <[x]>); sl@0: float fabsf(float <[x]>); sl@0: sl@0: TRAD_SYNOPSIS sl@0: #include sl@0: double fabs(<[x]>) sl@0: double <[x]>; sl@0: sl@0: float fabsf(<[x]>) sl@0: float <[x]>; sl@0: sl@0: DESCRIPTION sl@0: <> and <> calculate sl@0: @tex sl@0: $|x|$, sl@0: @end tex sl@0: the absolute value (magnitude) of the argument <[x]>, by direct sl@0: manipulation of the bit representation of <[x]>. sl@0: sl@0: RETURNS sl@0: The calculated value is returned. No errors are detected. sl@0: sl@0: PORTABILITY sl@0: <> is ANSI. sl@0: <> is an extension. sl@0: sl@0: */ sl@0: sl@0: /* sl@0: * fabs(x) returns the absolute value of x. sl@0: */ sl@0: sl@0: #include "FDLIBM.H" sl@0: sl@0: /** sl@0: Return absolute value of floating-point. sl@0: Returns the absoulte value of parameter x. /x/ sl@0: @return Absoulte value of x. sl@0: @param x Floating point value. sl@0: */ sl@0: EXPORT_C double fabs(double x) __SOFTFP sl@0: { sl@0: __uint32_t high; sl@0: GET_HIGH_WORD(high,x); sl@0: SET_HIGH_WORD(x,high&0x7fffffff); sl@0: return x; sl@0: }