Subversion Repositories Kolibri OS

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
3362 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
FUNCTION
15
        <>, <>---arc cosine
16
17
 
18
	acos
19
INDEX
20
	acosf
21
22
 
23
        #include 
24
        double acos(double <[x]>);
25
        float acosf(float <[x]>);
26
27
 
28
        #include 
29
        double acos(<[x]>)
30
        double <[x]>;
31
32
 
33
        float <[x]>;
34
35
 
36
 
37
 
38
39
 
40
	Arguments to <> must be in the range @minus{}1 to 1.
41
42
 
43
	its calculations on <>.
44
45
 
46
	@ifnottex
47
	<> and <> return values in radians, in the range of 0 to pi.
48
	@end ifnottex
49
	@tex
50
	<> and <> return values in radians, in the range of <<0>> to $\pi$.
51
	@end tex
52
53
 
54
	(not a number) the global variable <> is set to <>, and a
55
	<> message is sent as standard error output.
56
57
 
58
59
 
60
 
61
 acos	 y,y,y,m
62
 acosf   n,n,n,m
63
64
 
65
 acos, [-1,1], acos(arg),,,
66
 acos, NAN,    arg,DOMAIN,EDOM
67
68
 
69
 acosf, [-1,1], acosf(arg),,,
70
 acosf, NAN,    argf,DOMAIN,EDOM
71
72
 
73
74
 
75
 * wrap_acos(x)
76
 */
77
78
 
79
#include 
80
81
 
82
83
 
84
	double acos(double x)		/* wrapper acos */
85
#else
86
	double acos(x)			/* wrapper acos */
87
	double x;
88
#endif
89
{
90
#ifdef _IEEE_LIBM
91
	return __ieee754_acos(x);
92
#else
93
	double z;
94
       	struct exception exc;
95
       	z = __ieee754_acos(x);
96
	if(_LIB_VERSION == _IEEE_ || isnan(x)) return z;
97
	if(fabs(x)>1.0) {
98
	    /* acos(|x|>1) */
99
	    exc.type = DOMAIN;
100
	    exc.name = "acos";
101
	    exc.err = 0;
102
	    exc.arg1 = exc.arg2 = x;
103
	    exc.retval = nan("");
104
	    if (_LIB_VERSION == _POSIX_)
105
	       errno = EDOM;
106
	    else if (!matherr(&exc)) {
107
	       errno = EDOM;
108
            }
109
            if (exc.err != 0)
110
	       errno = exc.err;
111
	    return exc.retval;
112
	} else
113
	    return z;
114
#endif
115
}
116
117
 
118