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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [newlib-1.10.0/] [newlib/] [libm/] [math/] [w_acosh.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_acosh.c 5.1 93/09/24 */
/* @(#)w_acosh.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
<<acosh>>, <<acoshf>>---inverse hyperbolic cosine
<<acosh>>, <<acoshf>>---inverse hyperbolic cosine
 
 
INDEX
INDEX
acosh
acosh
INDEX
INDEX
acoshf
acoshf
 
 
ANSI_SYNOPSIS
ANSI_SYNOPSIS
        #include <math.h>
        #include <math.h>
        double acosh(double <[x]>);
        double acosh(double <[x]>);
        float acoshf(float <[x]>);
        float acoshf(float <[x]>);
 
 
TRAD_SYNOPSIS
TRAD_SYNOPSIS
        #include <math.h>
        #include <math.h>
        double acosh(<[x]>)
        double acosh(<[x]>)
        double <[x]>;
        double <[x]>;
 
 
        float acoshf(<[x]>)
        float acoshf(<[x]>)
        float <[x]>;
        float <[x]>;
 
 
DESCRIPTION
DESCRIPTION
<<acosh>> calculates the inverse hyperbolic cosine of <[x]>.
<<acosh>> calculates the inverse hyperbolic cosine of <[x]>.
<<acosh>> is defined as
<<acosh>> is defined as
@ifinfo
@ifinfo
. log(<[x]> + sqrt(<[x]>*<[x]>-1))
. log(<[x]> + sqrt(<[x]>*<[x]>-1))
@end ifinfo
@end ifinfo
@tex
@tex
$$ln\Bigl(x + \sqrt{x^2-1}\Bigr)$$
$$ln\Bigl(x + \sqrt{x^2-1}\Bigr)$$
@end tex
@end tex
 
 
<[x]> must be a number greater than or equal to 1.
<[x]> must be a number greater than or equal to 1.
 
 
<<acoshf>> is identical, other than taking and returning floats.
<<acoshf>> is identical, other than taking and returning floats.
 
 
RETURNS
RETURNS
<<acosh>> and <<acoshf>> return the calculated value.  If <[x]>
<<acosh>> and <<acoshf>> return the calculated value.  If <[x]>
less than 1, the return value is NaN and <<errno>> is set to <<EDOM>>.
less than 1, the return value is NaN and <<errno>> is set to <<EDOM>>.
 
 
You can change the error-handling behavior with the non-ANSI
You can change the error-handling behavior with the non-ANSI
<<matherr>> function.
<<matherr>> function.
 
 
PORTABILITY
PORTABILITY
Neither <<acosh>> nor <<acoshf>> are ANSI C.  They are not recommended
Neither <<acosh>> nor <<acoshf>> are ANSI C.  They are not recommended
for portable programs.
for portable programs.
 
 
 
 
QUICKREF ANSI SVID POSIX RENTRANT
QUICKREF ANSI SVID POSIX RENTRANT
 acos    n,n,n,m
 acos    n,n,n,m
 acosf   n,n,n,m
 acosf   n,n,n,m
 
 
MATHREF
MATHREF
 acosh, NAN,   arg,DOMAIN,EDOM
 acosh, NAN,   arg,DOMAIN,EDOM
 acosh, < 1.0, NAN,DOMAIN,EDOM
 acosh, < 1.0, NAN,DOMAIN,EDOM
 acosh, >=1.0, acosh(arg),,,
 acosh, >=1.0, acosh(arg),,,
 
 
MATHREF
MATHREF
 acoshf, NAN,   arg,DOMAIN,EDOM
 acoshf, NAN,   arg,DOMAIN,EDOM
 acoshf, < 1.0, NAN,DOMAIN,EDOM
 acoshf, < 1.0, NAN,DOMAIN,EDOM
 acoshf, >=1.0, acosh(arg),,,
 acoshf, >=1.0, acosh(arg),,,
 
 
*/
*/
 
 
/*
/*
 * wrapper acosh(x)
 * wrapper acosh(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 acosh(double x)          /* wrapper acosh */
        double acosh(double x)          /* wrapper acosh */
#else
#else
        double acosh(x)                 /* wrapper acosh */
        double acosh(x)                 /* wrapper acosh */
        double x;
        double x;
#endif
#endif
{
{
#ifdef _IEEE_LIBM
#ifdef _IEEE_LIBM
        return __ieee754_acosh(x);
        return __ieee754_acosh(x);
#else
#else
        double z;
        double z;
        struct exception exc;
        struct exception exc;
        z = __ieee754_acosh(x);
        z = __ieee754_acosh(x);
        if(_LIB_VERSION == _IEEE_ || isnan(x)) return z;
        if(_LIB_VERSION == _IEEE_ || isnan(x)) return z;
        if(x<1.0) {
        if(x<1.0) {
            /* acosh(x<1) */
            /* acosh(x<1) */
            exc.type = DOMAIN;
            exc.type = DOMAIN;
            exc.name = "acosh";
            exc.name = "acosh";
            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;
            }
            }
            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.