# lengthsq

> Returns the squared length of a float value. Equivalent to squaring the value.

## Definition

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

## lengthsq(float)

Returns the squared length of a float value. Equivalent to squaring the value.

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

### Parameters

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

### Returns

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

## lengthsq(float2)

Returns the squared length of a float2 vector.

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

### Parameters

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

### Returns

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

## lengthsq(float3)

Returns the squared length of a float3 vector.

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

### Parameters

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

### Returns

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

## lengthsq(float4)

Returns the squared length of a float4 vector.

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

### Parameters

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

### Returns

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

## lengthsq(double)

Returns the squared length of a double value. Equivalent to squaring the value.

```csharp
public static double lengthsq(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. |

## lengthsq(double2)

Returns the squared length of a double2 vector.

```csharp
public static double lengthsq(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. |

## lengthsq(double3)

Returns the squared length of a double3 vector.

```csharp
public static double lengthsq(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. |

## lengthsq(double4)

Returns the squared length of a double4 vector.

```csharp
public static double lengthsq(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. |

## lengthsq(quaternion)

Returns the squared length of a quaternion.

```csharp
public static float lengthsq(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 squared of the input quaternion. |
