Documentation

Unity Engine

Download Unity

Unity Engine

fastcos

Returns a fast approximation of the cosine of a float value.
Read time 2 minutesLast updated 5 days ago

Definition

fastcos(float)

Returns a fast approximation of the cosine of a float value.
public static float fastcos(float x)

Parameters

Input angle in radians.

Returns

Type

Description

floatThe approximate cosine of the input.

Remarks

Uses a polynomial approximation that is faster than math.cos 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.

fastcos(float2)

Returns a fast componentwise approximation of the cosine of a float2 vector.
public static float2 fastcos(float2 x)

Parameters

Input angles in radians.

Returns

Type

Description

float2The componentwise approximate cosine of the input.

Remarks

Uses a polynomial approximation that is faster than math.cos 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.

fastcos(float3)

Returns a fast componentwise approximation of the cosine of a float3 vector.
public static float3 fastcos(float3 x)

Parameters

Input angles in radians.

Returns

Type

Description

float3The componentwise approximate cosine of the input.

Remarks

Uses a polynomial approximation that is faster than math.cos 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.

fastcos(float4)

Returns a fast componentwise approximation of the cosine of a float4 vector.
public static float4 fastcos(float4 x)

Parameters

Input angles in radians.

Returns

Type

Description

float4The componentwise approximate cosine of the input.

Remarks

Uses a polynomial approximation that is faster than math.cos 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.