28 #if !defined(_SPANDSP_ARCTAN2_H_)
29 #define _SPANDSP_ARCTAN2_H_
41 #if defined(__cplusplus)
47 static __inline__ int32_t arctan2(
float y,
float x)
52 if (x == 0.0f || y == 0.0f)
59 angle = 3.0f - (x + abs_y)/(abs_y - x);
61 angle = 1.0f - (x - abs_y)/(abs_y + x);
62 angle *= 536870912.0f;
68 return (int32_t) angle;
74 static __inline__
float arctan2f(
float y,
float x)
80 if (x == 0.0f || y == 0.0f)
87 angle = 3.1415926f/2.0f - fx*fy/(y*y + 0.28125f*x*x);
89 angle = fy*fx/(x*x + 0.28125f*y*y);
93 angle = 3.1415926f - angle;
101 #if defined(__cplusplus)