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/] [w_asin.c] - Diff between revs 148 and 158

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

Rev 148 Rev 158
 
 
/* @(#)w_asin.c 5.1 93/09/24 */
/* @(#)w_asin.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
        <<asin>>, <<asinf>>---arc sine
        <<asin>>, <<asinf>>---arc sine
 
 
INDEX
INDEX
   asin
   asin
INDEX
INDEX
   asinf
   asinf
 
 
ANSI_SYNOPSIS
ANSI_SYNOPSIS
        #include <math.h>
        #include <math.h>
        double asin(double <[x]>);
        double asin(double <[x]>);
        float asinf(float <[x]>);
        float asinf(float <[x]>);
 
 
TRAD_SYNOPSIS
TRAD_SYNOPSIS
        #include <math.h>
        #include <math.h>
        double asin(<[x]>)
        double asin(<[x]>)
        double <[x]>;
        double <[x]>;
 
 
        float asinf(<[x]>)
        float asinf(<[x]>)
        float <[x]>;
        float <[x]>;
 
 
 
 
DESCRIPTION
DESCRIPTION
 
 
<<asin>> computes the inverse sine (arc sine) of the argument <[x]>.
<<asin>> computes the inverse sine (arc sine) of the argument <[x]>.
Arguments to <<asin>> must be in the range @minus{}1 to 1.
Arguments to <<asin>> must be in the range @minus{}1 to 1.
 
 
<<asinf>> is identical to <<asin>>, other than taking and
<<asinf>> is identical to <<asin>>, other than taking and
returning floats.
returning floats.
 
 
You can modify error handling for these routines using <<matherr>>.
You can modify error handling for these routines using <<matherr>>.
 
 
RETURNS
RETURNS
@ifnottex
@ifnottex
<<asin>> returns values in radians, in the range of -pi/2 to pi/2.
<<asin>> returns values in radians, in the range of -pi/2 to pi/2.
@end ifnottex
@end ifnottex
@tex
@tex
<<asin>> returns values in radians, in the range of $-\pi/2$ to $\pi/2$.
<<asin>> returns values in radians, in the range of $-\pi/2$ to $\pi/2$.
@end tex
@end tex
 
 
If <[x]> is not in the range @minus{}1 to 1, <<asin>> and <<asinf>>
If <[x]> is not in the range @minus{}1 to 1, <<asin>> and <<asinf>>
return NaN (not a number), set the global variable <<errno>> to
return NaN (not a number), set the global variable <<errno>> to
<<EDOM>>, and issue a <<DOMAIN error>> message.
<<EDOM>>, and issue a <<DOMAIN error>> message.
 
 
You can change this error treatment using <<matherr>>.
You can change this error treatment using <<matherr>>.
 
 
QUICKREF ANSI SVID POSIX RENTRANT
QUICKREF ANSI SVID POSIX RENTRANT
 asin    y,y,y,m
 asin    y,y,y,m
 asinf   n,n,n,m
 asinf   n,n,n,m
 
 
MATHREF
MATHREF
 asin,  -1<=arg<=1, asin(arg),,,
 asin,  -1<=arg<=1, asin(arg),,,
 asin,  NAN,  arg,EDOM, DOMAIN
 asin,  NAN,  arg,EDOM, DOMAIN
 
 
MATHREF
MATHREF
 asinf,  -1<=arg<=1, asin(arg),,,
 asinf,  -1<=arg<=1, asin(arg),,,
 asinf,  NAN,  arg,EDOM, DOMAIN
 asinf,  NAN,  arg,EDOM, DOMAIN
 
 
 
 
*/
*/
 
 
/*
/*
 * wrapper asin(x)
 * wrapper asin(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 asin(double x)           /* wrapper asin */
        double asin(double x)           /* wrapper asin */
#else
#else
        double asin(x)                  /* wrapper asin */
        double asin(x)                  /* wrapper asin */
        double x;
        double x;
#endif
#endif
{
{
#ifdef _IEEE_LIBM
#ifdef _IEEE_LIBM
        return __ieee754_asin(x);
        return __ieee754_asin(x);
#else
#else
        double z;
        double z;
        struct exception exc;
        struct exception exc;
        z = __ieee754_asin(x);
        z = __ieee754_asin(x);
        if(_LIB_VERSION == _IEEE_ || isnan(x)) return z;
        if(_LIB_VERSION == _IEEE_ || isnan(x)) return z;
        if(fabs(x)>1.0) {
        if(fabs(x)>1.0) {
            /* asin(|x|>1) */
            /* asin(|x|>1) */
            exc.type = DOMAIN;
            exc.type = DOMAIN;
            exc.name = "asin";
            exc.name = "asin";
            exc.err = 0;
            exc.err = 0;
            exc.arg1 = exc.arg2 = x;
            exc.arg1 = exc.arg2 = x;
            exc.retval = nan("");
            exc.retval = nan("");
            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.