fastsin
Returns a fast approximation of the sine of a float value.
Read time 2 minutesLast updated 5 days ago
Definition
- Type: Method
- Namespace: Unity.Mathematics
- Assembly: UnityEngine.MathematicsModule
fastsin(float)
Returns a fast approximation of the sine of a float value.
public static float fastsin(float x)
Parameters
Input angle in radians.
Returns
Type | Description |
|---|---|
| float | The approximate sine of the input. |
Remarks
Uses a polynomial approximation that is faster than math.sin in Burst-compiled code, but less accurate. The maximum absolute error is below 1e-5 for inputs with a magnitude up to 10 * PI, and grows with the magnitude of the input.
fastsin(float2)
Returns a fast componentwise approximation of the sine of a float2 vector.
public static float2 fastsin(float2 x)
Parameters
Input angles in radians.
Returns
Type | Description |
|---|---|
| float2 | The componentwise approximate sine of the input. |
Remarks
Uses a polynomial approximation that is faster than math.sin in Burst-compiled code, but less accurate. The maximum absolute error is below 1e-5 for inputs with a magnitude up to 10 * PI, and grows with the magnitude of the input.
fastsin(float3)
Returns a fast componentwise approximation of the sine of a float3 vector.
public static float3 fastsin(float3 x)
Parameters
Input angles in radians.
Returns
Type | Description |
|---|---|
| float3 | The componentwise approximate sine of the input. |
Remarks
Uses a polynomial approximation that is faster than math.sin in Burst-compiled code, but less accurate. The maximum absolute error is below 1e-5 for inputs with a magnitude up to 10 * PI, and grows with the magnitude of the input.
fastsin(float4)
Returns a fast componentwise approximation of the sine of a float4 vector.
public static float4 fastsin(float4 x)
Parameters
Input angles in radians.
Returns
Type | Description |
|---|---|
| float4 | The componentwise approximate sine of the input. |
Remarks
Uses a polynomial approximation that is faster than math.sin in Burst-compiled code, but less accurate. The maximum absolute error is below 1e-5 for inputs with a magnitude up to 10 * PI, and grows with the magnitude of the input.