1 
2 /* @(#)w_atan2.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 
15 /*
16 FUNCTION
17         <<atan2>>, <<atan2f>>---arc tangent of y/x
18 
19 INDEX
20    atan2
21 INDEX
22    atan2f
23 
24 ANSI_SYNOPSIS
25         #include <math.h>
26         double atan2(double <[y]>,double <[x]>);
27         float atan2f(float <[y]>,float <[x]>);
28 
29 TRAD_SYNOPSIS
30         #include <math.h>
31         double atan2(<[y]>,<[x]>);
32         double <[y]>;
33         double <[x]>;
34 
35         float atan2f(<[y]>,<[x]>);
36         float <[y]>;
37         float <[x]>;
38 
39 DESCRIPTION
40 
41 <<atan2>> computes the inverse tangent (arc tangent) of <[y]>/<[x]>.
42 <<atan2>> produces the correct result even for angles near
43 @ifnottex
44 pi/2 or -pi/2
45 @end ifnottex
46 @tex
47 $\pi/2$ or $-\pi/2$
48 @end tex
49 (that is, when <[x]> is near 0).
50 
51 <<atan2f>> is identical to <<atan2>>, save that it takes and returns
52 <<float>>.
53 
54 RETURNS
55 <<atan2>> and <<atan2f>> return a value in radians, in the range of
56 @ifnottex
57 -pi to pi.
58 @end ifnottex
59 @tex
60 $-\pi$ to $\pi$.
61 @end tex
62 
63 You can modify error handling for these functions using <<matherr>>.
64 
65 PORTABILITY
66 <<atan2>> is ANSI C.  <<atan2f>> is an extension.
67 
68 
69 */
70 
71 /*
72  * wrapper atan2(y,x)
73  */
74 
75 #include "fdlibm.h"
76 #include <errno.h>
77 
78 #ifndef _DOUBLE_IS_32BITS
79 
80 #ifdef __STDC__
atan2(double y,double x)81 	double atan2(double y, double x)	/* wrapper atan2 */
82 #else
83 	double atan2(y,x)			/* wrapper atan2 */
84 	double y,x;
85 #endif
86 {
87 	return __ieee754_atan2(y,x);
88 }
89 
90 #endif /* defined(_DOUBLE_IS_32BITS) */
91