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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [newlib-1.10.0/] [newlib/] [libm/] [math/] [w_atanh.c] - Diff between revs 1010 and 1765

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 1010 Rev 1765
 
 
/* @(#)w_atanh.c 5.1 93/09/24 */
/* @(#)w_atanh.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
        <<atanh>>, <<atanhf>>---inverse hyperbolic tangent
        <<atanh>>, <<atanhf>>---inverse hyperbolic tangent
 
 
INDEX
INDEX
        atanh
        atanh
INDEX
INDEX
        atanhf
        atanhf
 
 
ANSI_SYNOPSIS
ANSI_SYNOPSIS
        #include <math.h>
        #include <math.h>
        double atanh(double <[x]>);
        double atanh(double <[x]>);
        float atanhf(float <[x]>);
        float atanhf(float <[x]>);
 
 
TRAD_SYNOPSIS
TRAD_SYNOPSIS
        #include <math.h>
        #include <math.h>
        double atanh(<[x]>)
        double atanh(<[x]>)
        double <[x]>;
        double <[x]>;
 
 
        float atanhf(<[x]>)
        float atanhf(<[x]>)
        float <[x]>;
        float <[x]>;
 
 
DESCRIPTION
DESCRIPTION
        <<atanh>> calculates the inverse hyperbolic tangent of <[x]>.
        <<atanh>> calculates the inverse hyperbolic tangent of <[x]>.
 
 
        <<atanhf>> is identical, other than taking and returning
        <<atanhf>> is identical, other than taking and returning
        <<float>> values.
        <<float>> values.
 
 
RETURNS
RETURNS
        <<atanh>> and <<atanhf>> return the calculated value.
        <<atanh>> and <<atanhf>> return the calculated value.
 
 
        If
        If
        @ifinfo
        @ifinfo
        |<[x]>|
        |<[x]>|
        @end ifinfo
        @end ifinfo
        @tex
        @tex
        $|x|$
        $|x|$
        @end tex
        @end tex
        is greater than 1, the global <<errno>> is set to <<EDOM>> and
        is greater than 1, the global <<errno>> is set to <<EDOM>> and
        the result is a NaN.  A <<DOMAIN error>> is reported.
        the result is a NaN.  A <<DOMAIN error>> is reported.
 
 
        If
        If
        @ifinfo
        @ifinfo
        |<[x]>|
        |<[x]>|
        @end ifinfo
        @end ifinfo
        @tex
        @tex
        $|x|$
        $|x|$
        @end tex
        @end tex
        is 1, the global <<errno>> is set to <<EDOM>>; and the result is
        is 1, the global <<errno>> is set to <<EDOM>>; and the result is
        infinity with the same sign as <<x>>.  A <<SING error>> is reported.
        infinity with the same sign as <<x>>.  A <<SING error>> is reported.
 
 
        You can modify the error handling for these routines using
        You can modify the error handling for these routines using
        <<matherr>>.
        <<matherr>>.
 
 
PORTABILITY
PORTABILITY
        Neither <<atanh>> nor <<atanhf>> are ANSI C.
        Neither <<atanh>> nor <<atanhf>> are ANSI C.
 
 
QUICKREF
QUICKREF
        atanh - pure
        atanh - pure
        atanhf - pure
        atanhf - pure
 
 
 
 
*/
*/
 
 
/*
/*
 * wrapper atanh(x)
 * wrapper atanh(x)
 */
 */
 
 
#include "fdlibm.h"
#include "fdlibm.h"
#include <errno.h>
#include <errno.h>
 
 
#ifndef _DOUBLE_IS_32BITS
#ifndef _DOUBLE_IS_32BITS
 
 
#ifdef __STDC__
#ifdef __STDC__
        double atanh(double x)          /* wrapper atanh */
        double atanh(double x)          /* wrapper atanh */
#else
#else
        double atanh(x)                 /* wrapper atanh */
        double atanh(x)                 /* wrapper atanh */
        double x;
        double x;
#endif
#endif
{
{
#ifdef _IEEE_LIBM
#ifdef _IEEE_LIBM
        return __ieee754_atanh(x);
        return __ieee754_atanh(x);
#else
#else
        double z,y;
        double z,y;
        struct exception exc;
        struct exception exc;
        z = __ieee754_atanh(x);
        z = __ieee754_atanh(x);
        if(_LIB_VERSION == _IEEE_ || isnan(x)) return z;
        if(_LIB_VERSION == _IEEE_ || isnan(x)) return z;
        y = fabs(x);
        y = fabs(x);
        if(y>=1.0) {
        if(y>=1.0) {
            if(y>1.0) {
            if(y>1.0) {
                /* atanh(|x|>1) */
                /* atanh(|x|>1) */
                exc.type = DOMAIN;
                exc.type = DOMAIN;
                exc.name = "atanh";
                exc.name = "atanh";
                exc.err = 0;
                exc.err = 0;
                exc.arg1 = exc.arg2 = x;
                exc.arg1 = exc.arg2 = x;
                exc.retval = 0.0/0.0;
                exc.retval = 0.0/0.0;
                if (_LIB_VERSION == _POSIX_)
                if (_LIB_VERSION == _POSIX_)
                  errno = EDOM;
                  errno = EDOM;
                else if (!matherr(&exc)) {
                else if (!matherr(&exc)) {
                  errno = EDOM;
                  errno = EDOM;
                }
                }
            } else {
            } else {
                /* atanh(|x|=1) */
                /* atanh(|x|=1) */
                exc.type = SING;
                exc.type = SING;
                exc.name = "atanh";
                exc.name = "atanh";
                exc.err = 0;
                exc.err = 0;
                exc.arg1 = exc.arg2 = x;
                exc.arg1 = exc.arg2 = x;
                exc.retval = x/0.0;     /* sign(x)*inf */
                exc.retval = x/0.0;     /* sign(x)*inf */
                if (_LIB_VERSION == _POSIX_)
                if (_LIB_VERSION == _POSIX_)
                  errno = EDOM;
                  errno = EDOM;
                else if (!matherr(&exc)) {
                else if (!matherr(&exc)) {
                  errno = EDOM;
                  errno = EDOM;
                }
                }
            }
            }
            if (exc.err != 0)
            if (exc.err != 0)
              errno = exc.err;
              errno = exc.err;
            return exc.retval;
            return exc.retval;
        } else
        } else
            return z;
            return z;
#endif
#endif
}
}
 
 
#endif /* defined(_DOUBLE_IS_32BITS) */
#endif /* defined(_DOUBLE_IS_32BITS) */
 
 
 
 
 
 
 
 
 
 

powered by: WebSVN 2.1.0

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