source: Sophya/trunk/SophyaExt/XephemAstroLib/actan.c@ 1681

Last change on this file since 1681 was 1457, checked in by cmv, 24 years ago

import de la partie libastro de Xephem cmv+rz 10/4/2001

File size: 2.0 KB
Line 
1#include <math.h>
2
3/* @(#) $Id: actan.c,v 1.1.1.1 2001-04-10 14:40:45 cmv Exp $ */
4
5double
6actan(double sinx, double cosx)
7{
8 double ret;
9
10 ret = 0.0;
11 if(cosx < 0.0) {
12 ret = M_PI;
13 } else if(cosx == 0.0) {
14 if(sinx < 0.0) {
15 return 3.0 * M_PI_2;
16 } else if(sinx == 0.0) {
17 return ret;
18 } else /* sinx > 0.0 */ {
19 return M_PI_2;
20 }
21 } else /* cosx > 0.0 */ {
22 if(sinx < 0.0) {
23 ret = 2.0 * M_PI;
24 } else if(sinx == 0.0) {
25 return ret;
26 }
27 }
28
29 return ret + atan(sinx / cosx);
30}
31
32
33#if 0
34
35#define D(X) (180.0 * (X) / M_PI)
36
37void main() {
38 double a, b;
39
40 a = 0.0; b = 2.0; printf("actan(%f, %f) = %f\n", a, b, D(actan(a, b)));
41 a = 1.0; b = 2.0; printf("actan(%f, %f) = %f\n", a, b, D(actan(a, b)));
42 a = 2.0; b = 2.0; printf("actan(%f, %f) = %f\n", a, b, D(actan(a, b)));
43 a = 2.0; b = 1.0; printf("actan(%f, %f) = %f\n", a, b, D(actan(a, b)));
44 a = 2.0; b = 0.0; printf("actan(%f, %f) = %f\n", a, b, D(actan(a, b)));
45 a = 2.0; b = -1.0; printf("actan(%f, %f) = %f\n", a, b, D(actan(a, b)));
46 a = 2.0; b = -2.0; printf("actan(%f, %f) = %f\n", a, b, D(actan(a, b)));
47 a = 1.0; b = -2.0; printf("actan(%f, %f) = %f\n", a, b, D(actan(a, b)));
48 a = 0.0; b = -2.0; printf("actan(%f, %f) = %f\n", a, b, D(actan(a, b)));
49 a = -1.0; b = -2.0; printf("actan(%f, %f) = %f\n", a, b, D(actan(a, b)));
50 a = -2.0; b = -2.0; printf("actan(%f, %f) = %f\n", a, b, D(actan(a, b)));
51 a = -2.0; b = -1.0; printf("actan(%f, %f) = %f\n", a, b, D(actan(a, b)));
52 a = -2.0; b = 0.0; printf("actan(%f, %f) = %f\n", a, b, D(actan(a, b)));
53 a = -2.0; b = 1.0; printf("actan(%f, %f) = %f\n", a, b, D(actan(a, b)));
54 a = -2.0; b = 2.0; printf("actan(%f, %f) = %f\n", a, b, D(actan(a, b)));
55 a = -1.0; b = 2.0; printf("actan(%f, %f) = %f\n", a, b, D(actan(a, b)));
56}
57
58#endif /* 0 */
59
60/* For RCS Only -- Do Not Edit */
61static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: actan.c,v $ $Date: 2001-04-10 14:40:45 $ $Revision: 1.1.1.1 $ $Name: not supported by cvs2svn $"};
Note: See TracBrowser for help on using the repository browser.