# length

> Returns the length of a float value. Equivalent to the absolute value.

## Definition

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

## length(float)

Returns the length of a float value. Equivalent to the absolute value.

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

### Parameters

**** (\[float]\(https\://learn.microsoft.com/dotnet/api/system.single)): Value to use when computing length.

### Returns

| Type                                                          | Description  |
| ------------------------------------------------------------- | ------------ |
| [float](https://learn.microsoft.com/dotnet/api/system.single) | Length of x. |

## length(float2)

Returns the length of a float2 vector.

```csharp
public static float length(float2 x)
```

### Parameters

**** (\[float2]\(/engine/6000.6/script-reference/unity/mathematics/float2)): Vector to use when computing length.

### Returns

| Type                                                          | Description         |
| ------------------------------------------------------------- | ------------------- |
| [float](https://learn.microsoft.com/dotnet/api/system.single) | Length of vector x. |

## length(float3)

Returns the length of a float3 vector.

```csharp
public static float length(float3 x)
```

### Parameters

**** (\[float3]\(/engine/6000.6/script-reference/unity/mathematics/float3)): Vector to use when computing length.

### Returns

| Type                                                          | Description         |
| ------------------------------------------------------------- | ------------------- |
| [float](https://learn.microsoft.com/dotnet/api/system.single) | Length of vector x. |

## length(float4)

Returns the length of a float4 vector.

```csharp
public static float length(float4 x)
```

### Parameters

**** (\[float4]\(/engine/6000.6/script-reference/unity/mathematics/float4)): Vector to use when computing length.

### Returns

| Type                                                          | Description         |
| ------------------------------------------------------------- | ------------------- |
| [float](https://learn.microsoft.com/dotnet/api/system.single) | Length of vector x. |

## length(double)

Returns the length of a double value. Equivalent to the absolute value.

```csharp
public static double length(double x)
```

### Parameters

**** (\[double]\(https\://learn.microsoft.com/dotnet/api/system.double)): Value to use when computing squared length.

### Returns

| Type                                                           | Description          |
| -------------------------------------------------------------- | -------------------- |
| [double](https://learn.microsoft.com/dotnet/api/system.double) | Squared length of x. |

## length(double2)

Returns the length of a double2 vector.

```csharp
public static double length(double2 x)
```

### Parameters

**** (\[double2]\(/engine/6000.6/script-reference/unity/mathematics/double2)): Vector to use when computing squared length.

### Returns

| Type                                                           | Description                 |
| -------------------------------------------------------------- | --------------------------- |
| [double](https://learn.microsoft.com/dotnet/api/system.double) | Squared length of vector x. |

## length(double3)

Returns the length of a double3 vector.

```csharp
public static double length(double3 x)
```

### Parameters

**** (\[double3]\(/engine/6000.6/script-reference/unity/mathematics/double3)): Vector to use when computing squared length.

### Returns

| Type                                                           | Description                 |
| -------------------------------------------------------------- | --------------------------- |
| [double](https://learn.microsoft.com/dotnet/api/system.double) | Squared length of vector x. |

## length(double4)

Returns the length of a double4 vector.

```csharp
public static double length(double4 x)
```

### Parameters

**** (\[double4]\(/engine/6000.6/script-reference/unity/mathematics/double4)): Vector to use when computing squared length.

### Returns

| Type                                                           | Description                 |
| -------------------------------------------------------------- | --------------------------- |
| [double](https://learn.microsoft.com/dotnet/api/system.double) | Squared length of vector x. |

## length(quaternion)

Returns the length of a quaternion.

```csharp
public static float length(quaternion q)
```

### Parameters

**** (\[quaternion]\(/engine/6000.6/script-reference/unity/mathematics/quaternion)): The input quaternion.

### Returns

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