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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [newlib-1.18.0/] [newlib/] [libm/] [math/] [w_asin.c] - Blame information for rev 862

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 207 jeremybenn
 
2
/* @(#)w_asin.c 5.1 93/09/24 */
3
/*
4
 * ====================================================
5
 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
6
 *
7
 * Developed at SunPro, a Sun Microsystems, Inc. business.
8
 * Permission to use, copy, modify, and distribute this
9
 * software is freely granted, provided that this notice
10
 * is preserved.
11
 * ====================================================
12
 *
13
 */
14
 
15
/*
16
FUNCTION
17
        <<asin>>, <<asinf>>---arc sine
18
 
19
INDEX
20
   asin
21
INDEX
22
   asinf
23
 
24
ANSI_SYNOPSIS
25
        #include <math.h>
26
        double asin(double <[x]>);
27
        float asinf(float <[x]>);
28
 
29
TRAD_SYNOPSIS
30
        #include <math.h>
31
        double asin(<[x]>)
32
        double <[x]>;
33
 
34
        float asinf(<[x]>)
35
        float <[x]>;
36
 
37
 
38
DESCRIPTION
39
 
40
<<asin>> computes the inverse sine (arc sine) of the argument <[x]>.
41
Arguments to <<asin>> must be in the range @minus{}1 to 1.
42
 
43
<<asinf>> is identical to <<asin>>, other than taking and
44
returning floats.
45
 
46
You can modify error handling for these routines using <<matherr>>.
47
 
48
RETURNS
49
@ifnottex
50
<<asin>> returns values in radians, in the range of -pi/2 to pi/2.
51
@end ifnottex
52
@tex
53
<<asin>> returns values in radians, in the range of $-\pi/2$ to $\pi/2$.
54
@end tex
55
 
56
If <[x]> is not in the range @minus{}1 to 1, <<asin>> and <<asinf>>
57
return NaN (not a number), set the global variable <<errno>> to
58
<<EDOM>>, and issue a <<DOMAIN error>> message.
59
 
60
You can change this error treatment using <<matherr>>.
61
 
62
QUICKREF ANSI SVID POSIX RENTRANT
63
 asin    y,y,y,m
64
 asinf   n,n,n,m
65
 
66
MATHREF
67
 asin,  -1<=arg<=1, asin(arg),,,
68
 asin,  NAN,  arg,EDOM, DOMAIN
69
 
70
MATHREF
71
 asinf,  -1<=arg<=1, asin(arg),,,
72
 asinf,  NAN,  arg,EDOM, DOMAIN
73
 
74
 
75
*/
76
 
77
/*
78
 * wrapper asin(x)
79
 */
80
 
81
 
82
#include "fdlibm.h"
83
#include <errno.h>
84
 
85
#ifndef _DOUBLE_IS_32BITS
86
 
87
#ifdef __STDC__
88
        double asin(double x)           /* wrapper asin */
89
#else
90
        double asin(x)                  /* wrapper asin */
91
        double x;
92
#endif
93
{
94
#ifdef _IEEE_LIBM
95
        return __ieee754_asin(x);
96
#else
97
        double z;
98
        struct exception exc;
99
        z = __ieee754_asin(x);
100
        if(_LIB_VERSION == _IEEE_ || isnan(x)) return z;
101
        if(fabs(x)>1.0) {
102
            /* asin(|x|>1) */
103
            exc.type = DOMAIN;
104
            exc.name = "asin";
105
            exc.err = 0;
106
            exc.arg1 = exc.arg2 = x;
107
            exc.retval = nan("");
108
            if(_LIB_VERSION == _POSIX_)
109
              errno = EDOM;
110
            else if (!matherr(&exc)) {
111
              errno = EDOM;
112
            }
113
            if (exc.err != 0)
114
              errno = exc.err;
115
            return exc.retval;
116
        } else
117
            return z;
118
#endif
119
}
120
 
121
#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.