OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [newlib-1.17.0/] [newlib/] [libm/] [math/] [s_fabs.c] - Diff between revs 148 and 158

Only display areas with differences | Details | Blame | View Log

Rev 148 Rev 158
 
 
/* @(#)s_fabs.c 5.1 93/09/24 */
/* @(#)s_fabs.c 5.1 93/09/24 */
/*
/*
 * ====================================================
 * ====================================================
 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
 *
 *
 * Developed at SunPro, a Sun Microsystems, Inc. business.
 * Developed at SunPro, a Sun Microsystems, Inc. business.
 * Permission to use, copy, modify, and distribute this
 * Permission to use, copy, modify, and distribute this
 * software is freely granted, provided that this notice
 * software is freely granted, provided that this notice
 * is preserved.
 * is preserved.
 * ====================================================
 * ====================================================
 */
 */
 
 
/*
/*
FUNCTION
FUNCTION
       <<fabs>>, <<fabsf>>---absolute value (magnitude)
       <<fabs>>, <<fabsf>>---absolute value (magnitude)
INDEX
INDEX
        fabs
        fabs
INDEX
INDEX
        fabsf
        fabsf
 
 
ANSI_SYNOPSIS
ANSI_SYNOPSIS
        #include <math.h>
        #include <math.h>
       double fabs(double <[x]>);
       double fabs(double <[x]>);
       float fabsf(float <[x]>);
       float fabsf(float <[x]>);
 
 
TRAD_SYNOPSIS
TRAD_SYNOPSIS
        #include <math.h>
        #include <math.h>
       double fabs(<[x]>)
       double fabs(<[x]>)
       double <[x]>;
       double <[x]>;
 
 
       float fabsf(<[x]>)
       float fabsf(<[x]>)
       float <[x]>;
       float <[x]>;
 
 
DESCRIPTION
DESCRIPTION
<<fabs>> and <<fabsf>> calculate
<<fabs>> and <<fabsf>> calculate
@tex
@tex
$|x|$,
$|x|$,
@end tex
@end tex
the absolute value (magnitude) of the argument <[x]>, by direct
the absolute value (magnitude) of the argument <[x]>, by direct
manipulation of the bit representation of <[x]>.
manipulation of the bit representation of <[x]>.
 
 
RETURNS
RETURNS
The calculated value is returned.  No errors are detected.
The calculated value is returned.  No errors are detected.
 
 
PORTABILITY
PORTABILITY
<<fabs>> is ANSI.
<<fabs>> is ANSI.
<<fabsf>> is an extension.
<<fabsf>> is an extension.
 
 
*/
*/
 
 
/*
/*
 * fabs(x) returns the absolute value of x.
 * fabs(x) returns the absolute value of x.
 */
 */
 
 
#include "fdlibm.h"
#include "fdlibm.h"
 
 
#ifndef _DOUBLE_IS_32BITS
#ifndef _DOUBLE_IS_32BITS
 
 
#ifdef __STDC__
#ifdef __STDC__
        double fabs(double x)
        double fabs(double x)
#else
#else
        double fabs(x)
        double fabs(x)
        double x;
        double x;
#endif
#endif
{
{
        __uint32_t high;
        __uint32_t high;
        GET_HIGH_WORD(high,x);
        GET_HIGH_WORD(high,x);
        SET_HIGH_WORD(x,high&0x7fffffff);
        SET_HIGH_WORD(x,high&0x7fffffff);
        return x;
        return x;
}
}
 
 
#endif /* _DOUBLE_IS_32BITS */
#endif /* _DOUBLE_IS_32BITS */
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.