Name

atan - returns arctangent of scalars and vectors.

Synopsis

float  atan(float a);
float1 atan(float1 a);
float2 atan(float2 a);
float3 atan(float3 a);
float4 atan(float4 a);

half   atan(half a);
half1  atan(half1 a);
half2  atan(half2 a);
half3  atan(half3 a);
half4  atan(half4 a);

fixed  atan(fixed a);
fixed1 atan(fixed1 a);
fixed2 atan(fixed2 a);
fixed3 atan(fixed3 a);
fixed4 atan(fixed4 a);

Parameters

a
Vector or scalar of which to determine the arctangent.

Description

Returns the arctangent of x in the range of -pi/2 to pi/2 radians.

For vectors, the returned vector contains the arctangent of each element of the input vector.

Reference Implementation

atan for a float scalar could be implemented like this.

float atan(float x) {
    return atan2(x, float(1));
}

atan2 is typically implemented as an approximation.

Profile Support

atan is supported in all profiles but fp20.

See Also

abs, acos, asin, atan2. sqrt, tan