Subversion Repositories Kolibri OS

Rev

Rev 4872 | Details | Compare with Previous | Last modification | View Log | RSS feed

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