# square

> Computes the square (x * x) of the input argument x.

## Definition

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

## square(float)

Computes the square (x \* x) of the input argument x.

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

### Parameters

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

### Returns

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

## square(float2)

Computes the component-wise square (x \* x) of the input argument x.

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

### Parameters

**** (\[float2]\(/engine/6000.6/script-reference/unity/mathematics/float2)): Value to square.

### Returns

| Type                                                                  | Description                      |
| --------------------------------------------------------------------- | -------------------------------- |
| [float2](/engine/6000.6/script-reference/unity/mathematics/float2.md) | Returns the square of the input. |

## square(float3)

Computes the component-wise square (x \* x) of the input argument x.

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

### Parameters

**** (\[float3]\(/engine/6000.6/script-reference/unity/mathematics/float3)): Value to square.

### Returns

| Type                                                                  | Description                      |
| --------------------------------------------------------------------- | -------------------------------- |
| [float3](/engine/6000.6/script-reference/unity/mathematics/float3.md) | Returns the square of the input. |

## square(float4)

Computes the component-wise square (x \* x) of the input argument x.

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

### Parameters

**** (\[float4]\(/engine/6000.6/script-reference/unity/mathematics/float4)): Value to square.

### Returns

| Type                                                                  | Description                      |
| --------------------------------------------------------------------- | -------------------------------- |
| [float4](/engine/6000.6/script-reference/unity/mathematics/float4.md) | Returns the square of the input. |

## square(double)

Computes the square (x \* x) of the input argument x.

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

### Parameters

**** (\[double]\(https\://learn.microsoft.com/dotnet/api/system.double)): Value to square.

### Returns

| Type                                                           | Description                      |
| -------------------------------------------------------------- | -------------------------------- |
| [double](https://learn.microsoft.com/dotnet/api/system.double) | Returns the square of the input. |

## square(double2)

Computes the component-wise square (x \* x) of the input argument x.

```csharp
public static double2 square(double2 x)
```

### Parameters

**** (\[double2]\(/engine/6000.6/script-reference/unity/mathematics/double2)): Value to square.

### Returns

| Type                                                                    | Description                      |
| ----------------------------------------------------------------------- | -------------------------------- |
| [double2](/engine/6000.6/script-reference/unity/mathematics/double2.md) | Returns the square of the input. |

## square(double3)

Computes the component-wise square (x \* x) of the input argument x.

```csharp
public static double3 square(double3 x)
```

### Parameters

**** (\[double3]\(/engine/6000.6/script-reference/unity/mathematics/double3)): Value to square.

### Returns

| Type                                                                    | Description                      |
| ----------------------------------------------------------------------- | -------------------------------- |
| [double3](/engine/6000.6/script-reference/unity/mathematics/double3.md) | Returns the square of the input. |

## square(double4)

Computes the component-wise square (x \* x) of the input argument x.

```csharp
public static double4 square(double4 x)
```

### Parameters

**** (\[double4]\(/engine/6000.6/script-reference/unity/mathematics/double4)): Value to square.

### Returns

| Type                                                                    | Description                      |
| ----------------------------------------------------------------------- | -------------------------------- |
| [double4](/engine/6000.6/script-reference/unity/mathematics/double4.md) | Returns the square of the input. |

## square(int)

Computes the square (x \* x) of the input argument x.

```csharp
public static int square(int x)
```

### Parameters

**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): Value to square.

### Returns

| Type                                                       | Description                      |
| ---------------------------------------------------------- | -------------------------------- |
| [int](https://learn.microsoft.com/dotnet/api/system.int32) | Returns the square of the input. |

### Remarks

Due to integer overflow, it's not always guaranteed that `square(x)` is positive. For example, `square(46341)` will return `-2147479015`.

## square(int2)

Computes the component-wise square (x \* x) of the input argument x.

```csharp
public static int2 square(int2 x)
```

### Parameters

**** (\[int2]\(/engine/6000.6/script-reference/unity/mathematics/int2)): Value to square.

### Returns

| Type                                                              | Description                      |
| ----------------------------------------------------------------- | -------------------------------- |
| [int2](/engine/6000.6/script-reference/unity/mathematics/int2.md) | Returns the square of the input. |

### Remarks

Due to integer overflow, it's not always guaranteed that `square(x)` is positive. For example, `square(new int2(46341))` will return `new int2(-2147479015)`.

## square(int3)

Computes the component-wise square (x \* x) of the input argument x.

```csharp
public static int3 square(int3 x)
```

### Parameters

**** (\[int3]\(/engine/6000.6/script-reference/unity/mathematics/int3)): Value to square.

### Returns

| Type                                                              | Description                      |
| ----------------------------------------------------------------- | -------------------------------- |
| [int3](/engine/6000.6/script-reference/unity/mathematics/int3.md) | Returns the square of the input. |

### Remarks

Due to integer overflow, it's not always guaranteed that `square(x)` is positive. For example, `square(new int3(46341))` will return `new int3(-2147479015)`.

## square(int4)

Computes the component-wise square (x \* x) of the input argument x.

```csharp
public static int4 square(int4 x)
```

### Parameters

**** (\[int4]\(/engine/6000.6/script-reference/unity/mathematics/int4)): Value to square.

### Returns

| Type                                                              | Description                      |
| ----------------------------------------------------------------- | -------------------------------- |
| [int4](/engine/6000.6/script-reference/unity/mathematics/int4.md) | Returns the square of the input. |

### Remarks

Due to integer overflow, it's not always guaranteed that `square(x)` is positive. For example, `square(new int4(46341))` will return `new int4(-2147479015)`.

## square(uint)

Computes the square (x \* x) of the input argument x.

```csharp
public static uint square(uint x)
```

### Parameters

**** (\[uint]\(https\://learn.microsoft.com/dotnet/api/system.uint32)): Value to square.

### Returns

| Type                                                         | Description                      |
| ------------------------------------------------------------ | -------------------------------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) | Returns the square of the input. |

### Remarks

Due to integer overflow, it's not always guaranteed that `square(x) >= x`. For example, `square(4294967295u)` will return `1u`.

## square(uint2)

Computes the component-wise square (x \* x) of the input argument x.

```csharp
public static uint2 square(uint2 x)
```

### Parameters

**** (\[uint2]\(/engine/6000.6/script-reference/unity/mathematics/uint2)): Value to square.

### Returns

| Type                                                                | Description                      |
| ------------------------------------------------------------------- | -------------------------------- |
| [uint2](/engine/6000.6/script-reference/unity/mathematics/uint2.md) | Returns the square of the input. |

### Remarks

Due to integer overflow, it's not always guaranteed that `square(x) >= x`. For example, `square(new uint2(4294967295u))` will return `new uint2(1u)`.

## square(uint3)

Computes the component-wise square (x \* x) of the input argument x.

```csharp
public static uint3 square(uint3 x)
```

### Parameters

**** (\[uint3]\(/engine/6000.6/script-reference/unity/mathematics/uint3)): Value to square.

### Returns

| Type                                                                | Description                      |
| ------------------------------------------------------------------- | -------------------------------- |
| [uint3](/engine/6000.6/script-reference/unity/mathematics/uint3.md) | Returns the square of the input. |

### Remarks

Due to integer overflow, it's not always guaranteed that `square(x) >= x`. For example, `square(new uint3(4294967295u))` will return `new uint3(1u)`.

## square(uint4)

Computes the component-wise square (x \* x) of the input argument x.

```csharp
public static uint4 square(uint4 x)
```

### Parameters

**** (\[uint4]\(/engine/6000.6/script-reference/unity/mathematics/uint4)): Value to square.

### Returns

| Type                                                                | Description                      |
| ------------------------------------------------------------------- | -------------------------------- |
| [uint4](/engine/6000.6/script-reference/unity/mathematics/uint4.md) | Returns the square of the input. |

### Remarks

Due to integer overflow, it's not always guaranteed that `square(x) >= x`. For example, `square(new uint4(4294967295u))` will return `new uint4(1u)`.
