acos.3Cg

Langue: en

Version: 347255 (ubuntu - 24/10/10)

Section: 3 (Bibliothèques de fonctions)

NAME

acos - returns arccosine of scalars and vectors.

SYNOPSIS

   float  acos(float a);
   float1 acos(float1 a);
   float2 acos(float2 a);
   float3 acos(float3 a);
   float4 acos(float4 a);
 
 
 
   half   acos(half a);
   half1  acos(half1 a);
   half2  acos(half2 a);
   half3  acos(half3 a);
   half4  acos(half4 a);
 
 
 
   fixed  acos(fixed a);
   fixed1 acos(fixed1 a);
   fixed2 acos(fixed2 a);
   fixed3 acos(fixed3 a);
   fixed4 acos(fixed4 a);
 
 
 

PARAMETERS


a
Vector or scalar of which to determine the arccosine.

DESCRIPTION

Returns the arccosine of a in the range [0,pi], expecting a to be in the range [-1,+1].

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

REFERENCE IMPLEMENTATION

acos for a float scalar could be implemented like this.
   // Handbook of Mathematical Functions
   // M. Abramowitz and I.A. Stegun, Ed.
 
 
 
   // Absolute error <= 6.7e-5
   float acos(float x) {
     float negate = float(x < 0);
     x = abs(x);
     float ret = -0.0187293;
     ret = ret * x;
     ret = ret + 0.0742610;
     ret = ret * x;
     ret = ret - 0.2121144;
     ret = ret * x;
     ret = ret + 1.5707288;
     ret = ret * sqrt(1.0-x);
     ret = ret - 2 * negate * ret;
     return negate * 3.14159265358979 + ret;
   }
 
 
 

PROFILE SUPPORT

acos is supported in all profiles.

Support in the fp20 is limited.

SEE ALSO

abs, asin, cos, sqrt