Cg 3.1 Toolkit Documentation Cg / Standard Library / asin

## Name

asin - returns arcsine of scalars and vectors.

## Synopsis

```float  asin(float a);
float1 asin(float1 a);
float2 asin(float2 a);
float3 asin(float3 a);
float4 asin(float4 a);

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

fixed  asin(fixed a);
fixed1 asin(fixed1 a);
fixed2 asin(fixed2 a);
fixed3 asin(fixed3 a);
fixed4 asin(fixed4 a);
```

## Parameters

a
Vector or scalar of which to determine the arcsine.

## Description

Returns the arcsine of a in the range [-pi/2,+pi/2], expecting a to be in the range [-1,+1].

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

## Reference Implementation

asin for a float scalar could be implemented like this.

```// Handbook of Mathematical Functions
// M. Abramowitz and I.A. Stegun, Ed.

float asin(float x) {
float negate = float(x < 0);
x = abs(x);
float ret = -0.0187293;
ret *= x;
ret += 0.0742610;
ret *= x;
ret -= 0.2121144;
ret *= x;
ret += 1.5707288;
ret = 3.14159265358979*0.5 - sqrt(1.0 - x)*ret;
return ret - 2 * negate * ret;
}
```

## Profile Support

asin is supported in all profiles.

Support in the fp20 is limited.