---
title: fastcos
product: Unity Editor
version: '7000.0'
latest_version: '7000.0'
status: This page documents version 7000.0. The latest version is 7000.0.
canonical: https://docs.unity.com/en-us/engine/7000.0/script-reference/unity/mathematics/math/fastcos
latest_url: https://docs.unity.com/en-us/engine/7000.0/script-reference/unity/mathematics/math/fastcos.md
last_updated: 2026-11-20
generated_at: 2026-11-25T22:12:36.445Z
locale: en-us
---

# fastcos

> Returns a fast approximation of the cosine of a float value.

## Definition

* **Type:** Method
* **Namespace:** [Unity.Mathematics](/engine/7000.0/script-reference/unity/mathematics.md)
* **Assembly:** UnityEngine.MathematicsModule

## fastcos(float)

Returns a fast approximation of the cosine of a float value.

```csharp
public static float fastcos(float x)
```

### Parameters

**** (\[float]\(https\://learn.microsoft.com/dotnet/api/system.single)): Input angle in radians.

### Returns

| Type                                                          | Description                          |
| ------------------------------------------------------------- | ------------------------------------ |
| [float](https://learn.microsoft.com/dotnet/api/system.single) | The approximate cosine of the input. |

### Remarks

Uses a polynomial approximation that is faster than [math.cos](/engine/7000.0/script-reference/unity/mathematics/math/cos.md) 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.

```csharp
public static float2 fastcos(float2 x)
```

### Parameters

**** (\[float2]\(/engine/7000.0/script-reference/unity/mathematics/float2)): Input angles in radians.

### Returns

| Type                                                                  | Description                                        |
| --------------------------------------------------------------------- | -------------------------------------------------- |
| [float2](/engine/7000.0/script-reference/unity/mathematics/float2.md) | The componentwise approximate cosine of the input. |

### Remarks

Uses a polynomial approximation that is faster than [math.cos](/engine/7000.0/script-reference/unity/mathematics/math/cos.md) 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.

```csharp
public static float3 fastcos(float3 x)
```

### Parameters

**** (\[float3]\(/engine/7000.0/script-reference/unity/mathematics/float3)): Input angles in radians.

### Returns

| Type                                                                  | Description                                        |
| --------------------------------------------------------------------- | -------------------------------------------------- |
| [float3](/engine/7000.0/script-reference/unity/mathematics/float3.md) | The componentwise approximate cosine of the input. |

### Remarks

Uses a polynomial approximation that is faster than [math.cos](/engine/7000.0/script-reference/unity/mathematics/math/cos.md) 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.

```csharp
public static float4 fastcos(float4 x)
```

### Parameters

**** (\[float4]\(/engine/7000.0/script-reference/unity/mathematics/float4)): Input angles in radians.

### Returns

| Type                                                                  | Description                                        |
| --------------------------------------------------------------------- | -------------------------------------------------- |
| [float4](/engine/7000.0/script-reference/unity/mathematics/float4.md) | The componentwise approximate cosine of the input. |

### Remarks

Uses a polynomial approximation that is faster than [math.cos](/engine/7000.0/script-reference/unity/mathematics/math/cos.md) 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.
