Last change
on this file since 567 was
444,
checked in by satin@…, 6 years ago
|
add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc
|
File size:
1.4 KB
|
Line | |
---|
1 | |
---|
2 | /* @(#)z_atan2.c 1.0 98/08/13 */ |
---|
3 | |
---|
4 | /* |
---|
5 | FUNCTION |
---|
6 | <<atan2>>, <<atan2f>>---arc tangent of y/x |
---|
7 | |
---|
8 | INDEX |
---|
9 | atan2 |
---|
10 | INDEX |
---|
11 | atan2f |
---|
12 | |
---|
13 | SYNOPSIS |
---|
14 | #include <math.h> |
---|
15 | double atan2(double <[y]>,double <[x]>); |
---|
16 | float atan2f(float <[y]>,float <[x]>); |
---|
17 | |
---|
18 | DESCRIPTION |
---|
19 | |
---|
20 | <<atan2>> computes the inverse tangent (arc tangent) of <[y]>/<[x]>. |
---|
21 | <<atan2>> produces the correct result even for angles near |
---|
22 | @ifnottex |
---|
23 | pi/2 or -pi/2 |
---|
24 | @end ifnottex |
---|
25 | @tex |
---|
26 | $\pi/2$ or $-\pi/2$ |
---|
27 | @end tex |
---|
28 | (that is, when <[x]> is near 0). |
---|
29 | |
---|
30 | <<atan2f>> is identical to <<atan2>>, save that it takes and returns |
---|
31 | <<float>>. |
---|
32 | |
---|
33 | RETURNS |
---|
34 | <<atan2>> and <<atan2f>> return a value in radians, in the range of |
---|
35 | @ifnottex |
---|
36 | -pi to pi. |
---|
37 | @end ifnottex |
---|
38 | @tex |
---|
39 | $-\pi$ to $\pi$. |
---|
40 | @end tex |
---|
41 | |
---|
42 | If both <[x]> and <[y]> are 0.0, <<atan2>> causes a <<DOMAIN>> error. |
---|
43 | |
---|
44 | You can modify error handling for these functions using <<matherr>>. |
---|
45 | |
---|
46 | PORTABILITY |
---|
47 | <<atan2>> is ANSI C. <<atan2f>> is an extension. |
---|
48 | |
---|
49 | |
---|
50 | */ |
---|
51 | |
---|
52 | /****************************************************************** |
---|
53 | * Arctangent2 |
---|
54 | * |
---|
55 | * Input: |
---|
56 | * v, u - floating point values |
---|
57 | * |
---|
58 | * Output: |
---|
59 | * arctan2 of v / u |
---|
60 | * |
---|
61 | * Description: |
---|
62 | * This routine returns the arctan2 of v / u. |
---|
63 | * |
---|
64 | *****************************************************************/ |
---|
65 | |
---|
66 | #include "fdlibm.h" |
---|
67 | #include "zmath.h" |
---|
68 | |
---|
69 | #ifndef _DOUBLE_IS_32BITS |
---|
70 | |
---|
71 | double |
---|
72 | atan2 (double v, |
---|
73 | double u) |
---|
74 | { |
---|
75 | return (atangent (0.0, v, u, 1)); |
---|
76 | } |
---|
77 | |
---|
78 | #endif /* _DOUBLE_IS_32BITS */ |
---|
Note: See
TracBrowser
for help on using the repository browser.