Hi,

Is anyone mathematically inclined enough to inform me how I achieve the inverse tangent function (arctan/atan/tan^-1) from within the device. I know the CUDA library provides Sine/Cosine/Tangent functions but not their complements. I scrapped google for two hours last night and came up with nothing.

A bit of reverse engineering came up with this which could be implemented as a function accessible from the kernel:

```
/* ATAN.C
* Calculates arctan(x)
* Range: -infinite <= x <= infinite (Output -pi/2 to +pi/2)
* Precision: +/- .000,000,04
* Header: math.h
* Author: Max R. D^Arsteler 9/15/83
*/
double atan(double x)
{
double xi, q, q2, y;
int sign;
xi = (x < 0. ? -x : x);
q = (xi - 1.0) / (xi + 1.0); q2 = q * q;
y = ((((((( - .0040540580 * q2
+ .0218612286) * q2
- .0559098861) * q2
+ .0964200441) * q2
- .1390853351) * q2
+ .1994653599) * q2
- .3332985605) * q2
+ .9999993329) * q + 0.785398163397;
return(x < 0. ? -y: y);
}
```

Please tell me if I need not go to the extent of using the inverse tangent function to work out angles…

Cheers in advance