source: trunk/gcc/libjava/java/lang/w_acos.c

Last change on this file was 2, checked in by bird, 22 years ago

Initial revision

  • Property cvs2svn:cvs-rev set to 1.1
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 2.4 KB
Line 
1
2/* @(#)w_acos.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/*
15FUNCTION
16 <<acos>>, <<acosf>>---arc cosine
17
18INDEX
19 acos
20INDEX
21 acosf
22
23ANSI_SYNOPSIS
24 #include <math.h>
25 double acos(double <[x]>);
26 float acosf(float <[x]>);
27
28TRAD_SYNOPSIS
29 #include <math.h>
30 double acos(<[x]>)
31 double <[x]>;
32
33 float acosf(<[x]>)
34 float <[x]>;
35
36
37
38DESCRIPTION
39
40 <<acos>> computes the inverse cosine (arc cosine) of the input value.
41 Arguments to <<acos>> must be in the range @minus{}1 to 1.
42
43 <<acosf>> is identical to <<acos>>, except that it performs
44 its calculations on <<floats>>.
45
46RETURNS
47 @ifinfo
48 <<acos>> and <<acosf>> return values in radians, in the range of 0 to pi.
49 @end ifinfo
50 @tex
51 <<acos>> and <<acosf>> return values in radians, in the range of <<0>> to $\pi$.
52 @end tex
53
54 If <[x]> is not between @minus{}1 and 1, the returned value is NaN
55 (not a number) the global variable <<errno>> is set to <<EDOM>>, and a
56 <<DOMAIN error>> message is sent as standard error output.
57
58 You can modify error handling for these functions using <<matherr>>.
59
60
61QUICKREF ANSI SVID POSIX RENTRANT
62 acos y,y,y,m
63 acosf n,n,n,m
64
65MATHREF
66 acos, [-1,1], acos(arg),,,
67 acos, NAN, arg,DOMAIN,EDOM
68
69MATHREF
70 acosf, [-1,1], acosf(arg),,,
71 acosf, NAN, argf,DOMAIN,EDOM
72
73*/
74
75/*
76 * wrap_acos(x)
77 */
78
79#include "fdlibm.h"
80#include <errno.h>
81
82#ifndef _DOUBLE_IS_32BITS
83
84#ifdef __STDC__
85 double acos(double x) /* wrapper acos */
86#else
87 double acos(x) /* wrapper acos */
88 double x;
89#endif
90{
91#ifdef _IEEE_LIBM
92 return __ieee754_acos(x);
93#else
94 double z;
95 struct exception exc;
96 z = __ieee754_acos(x);
97 if(_LIB_VERSION == _IEEE_ || isnan(x)) return z;
98 if(fabs(x)>1.0) {
99 /* acos(|x|>1) */
100 exc.type = DOMAIN;
101 exc.name = "acos";
102 exc.err = 0;
103 exc.arg1 = exc.arg2 = x;
104 exc.retval = 0.0;
105 if (_LIB_VERSION == _POSIX_)
106 errno = EDOM;
107 else if (!matherr(&exc)) {
108 errno = EDOM;
109 }
110 if (exc.err != 0)
111 errno = exc.err;
112 return exc.retval;
113 } else
114 return z;
115#endif
116}
117
118#endif /* defined(_DOUBLE_IS_32BITS) */
Note: See TracBrowser for help on using the repository browser.