# max

> Returns the maximum of two int values.

## Definition

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

## max(int, int)

Returns the maximum of two int values.

```csharp
public static int max(int x, int y)
```

### Parameters

**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The first input value.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The second input value.

### Returns

| Type                                                       | Description                          |
| ---------------------------------------------------------- | ------------------------------------ |
| [int](https://learn.microsoft.com/dotnet/api/system.int32) | The maximum of the two input values. |

## max(int2, int2)

Returns the componentwise maximum of two int2 vectors.

```csharp
public static int2 max(int2 x, int2 y)
```

### Parameters

**** (\[int2]\(/engine/6000.6/script-reference/unity/mathematics/int2)): The first input value.**** (\[int2]\(/engine/6000.6/script-reference/unity/mathematics/int2)): The second input value.

### Returns

| Type                                                              | Description                                        |
| ----------------------------------------------------------------- | -------------------------------------------------- |
| [int2](/engine/6000.6/script-reference/unity/mathematics/int2.md) | The componentwise maximum of the two input values. |

## max(int3, int3)

Returns the componentwise maximum of two int3 vectors.

```csharp
public static int3 max(int3 x, int3 y)
```

### Parameters

**** (\[int3]\(/engine/6000.6/script-reference/unity/mathematics/int3)): The first input value.**** (\[int3]\(/engine/6000.6/script-reference/unity/mathematics/int3)): The second input value.

### Returns

| Type                                                              | Description                                        |
| ----------------------------------------------------------------- | -------------------------------------------------- |
| [int3](/engine/6000.6/script-reference/unity/mathematics/int3.md) | The componentwise maximum of the two input values. |

## max(int4, int4)

Returns the componentwise maximum of two int4 vectors.

```csharp
public static int4 max(int4 x, int4 y)
```

### Parameters

**** (\[int4]\(/engine/6000.6/script-reference/unity/mathematics/int4)): The first input value.**** (\[int4]\(/engine/6000.6/script-reference/unity/mathematics/int4)): The second input value.

### Returns

| Type                                                              | Description                                        |
| ----------------------------------------------------------------- | -------------------------------------------------- |
| [int4](/engine/6000.6/script-reference/unity/mathematics/int4.md) | The componentwise maximum of the two input values. |

## max(uint, uint)

Returns the maximum of two uint values.

```csharp
public static uint max(uint x, uint y)
```

### Parameters

**** (\[uint]\(https\://learn.microsoft.com/dotnet/api/system.uint32)): The first input value.**** (\[uint]\(https\://learn.microsoft.com/dotnet/api/system.uint32)): The second input value.

### Returns

| Type                                                         | Description                          |
| ------------------------------------------------------------ | ------------------------------------ |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) | The maximum of the two input values. |

## max(uint2, uint2)

Returns the componentwise maximum of two uint2 vectors.

```csharp
public static uint2 max(uint2 x, uint2 y)
```

### Parameters

**** (\[uint2]\(/engine/6000.6/script-reference/unity/mathematics/uint2)): The first input value.**** (\[uint2]\(/engine/6000.6/script-reference/unity/mathematics/uint2)): The second input value.

### Returns

| Type                                                                | Description                                        |
| ------------------------------------------------------------------- | -------------------------------------------------- |
| [uint2](/engine/6000.6/script-reference/unity/mathematics/uint2.md) | The componentwise maximum of the two input values. |

## max(uint3, uint3)

Returns the componentwise maximum of two uint3 vectors.

```csharp
public static uint3 max(uint3 x, uint3 y)
```

### Parameters

**** (\[uint3]\(/engine/6000.6/script-reference/unity/mathematics/uint3)): The first input value.**** (\[uint3]\(/engine/6000.6/script-reference/unity/mathematics/uint3)): The second input value.

### Returns

| Type                                                                | Description                                        |
| ------------------------------------------------------------------- | -------------------------------------------------- |
| [uint3](/engine/6000.6/script-reference/unity/mathematics/uint3.md) | The componentwise maximum of the two input values. |

## max(uint4, uint4)

Returns the componentwise maximum of two uint4 vectors.

```csharp
public static uint4 max(uint4 x, uint4 y)
```

### Parameters

**** (\[uint4]\(/engine/6000.6/script-reference/unity/mathematics/uint4)): The first input value.**** (\[uint4]\(/engine/6000.6/script-reference/unity/mathematics/uint4)): The second input value.

### Returns

| Type                                                                | Description                                        |
| ------------------------------------------------------------------- | -------------------------------------------------- |
| [uint4](/engine/6000.6/script-reference/unity/mathematics/uint4.md) | The componentwise maximum of the two input values. |

## max(long, long)

Returns the maximum of two long values.

```csharp
public static long max(long x, long y)
```

### Parameters

**** (\[long]\(https\://learn.microsoft.com/dotnet/api/system.int64)): The first input value.**** (\[long]\(https\://learn.microsoft.com/dotnet/api/system.int64)): The second input value.

### Returns

| Type                                                        | Description                          |
| ----------------------------------------------------------- | ------------------------------------ |
| [long](https://learn.microsoft.com/dotnet/api/system.int64) | The maximum of the two input values. |

## max(ulong, ulong)

Returns the maximum of two ulong values.

```csharp
public static ulong max(ulong x, ulong y)
```

### Parameters

**** (\[ulong]\(https\://learn.microsoft.com/dotnet/api/system.uint64)): The first input value.**** (\[ulong]\(https\://learn.microsoft.com/dotnet/api/system.uint64)): The second input value.

### Returns

| Type                                                          | Description                          |
| ------------------------------------------------------------- | ------------------------------------ |
| [ulong](https://learn.microsoft.com/dotnet/api/system.uint64) | The maximum of the two input values. |

## max(float, float)

Returns the maximum of two float values.

```csharp
public static float max(float x, float y)
```

### Parameters

**** (\[float]\(https\://learn.microsoft.com/dotnet/api/system.single)): The first input value.**** (\[float]\(https\://learn.microsoft.com/dotnet/api/system.single)): The second input value.

### Returns

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

## max(float2, float2)

Returns the componentwise maximum of two float2 vectors.

```csharp
public static float2 max(float2 x, float2 y)
```

### Parameters

**** (\[float2]\(/engine/6000.6/script-reference/unity/mathematics/float2)): The first input value.**** (\[float2]\(/engine/6000.6/script-reference/unity/mathematics/float2)): The second input value.

### Returns

| Type                                                                  | Description                                        |
| --------------------------------------------------------------------- | -------------------------------------------------- |
| [float2](/engine/6000.6/script-reference/unity/mathematics/float2.md) | The componentwise maximum of the two input values. |

## max(float3, float3)

Returns the componentwise maximum of two float3 vectors.

```csharp
public static float3 max(float3 x, float3 y)
```

### Parameters

**** (\[float3]\(/engine/6000.6/script-reference/unity/mathematics/float3)): The first input value.**** (\[float3]\(/engine/6000.6/script-reference/unity/mathematics/float3)): The second input value.

### Returns

| Type                                                                  | Description                                        |
| --------------------------------------------------------------------- | -------------------------------------------------- |
| [float3](/engine/6000.6/script-reference/unity/mathematics/float3.md) | The componentwise maximum of the two input values. |

## max(float4, float4)

Returns the componentwise maximum of two float4 vectors.

```csharp
public static float4 max(float4 x, float4 y)
```

### Parameters

**** (\[float4]\(/engine/6000.6/script-reference/unity/mathematics/float4)): The first input value.**** (\[float4]\(/engine/6000.6/script-reference/unity/mathematics/float4)): The second input value.

### Returns

| Type                                                                  | Description                                        |
| --------------------------------------------------------------------- | -------------------------------------------------- |
| [float4](/engine/6000.6/script-reference/unity/mathematics/float4.md) | The componentwise maximum of the two input values. |

## max(double, double)

Returns the maximum of two double values.

```csharp
public static double max(double x, double y)
```

### Parameters

**** (\[double]\(https\://learn.microsoft.com/dotnet/api/system.double)): The first input value.**** (\[double]\(https\://learn.microsoft.com/dotnet/api/system.double)): The second input value.

### Returns

| Type                                                           | Description                          |
| -------------------------------------------------------------- | ------------------------------------ |
| [double](https://learn.microsoft.com/dotnet/api/system.double) | The maximum of the two input values. |

## max(double2, double2)

Returns the componentwise maximum of two double2 vectors.

```csharp
public static double2 max(double2 x, double2 y)
```

### Parameters

**** (\[double2]\(/engine/6000.6/script-reference/unity/mathematics/double2)): The first input value.**** (\[double2]\(/engine/6000.6/script-reference/unity/mathematics/double2)): The second input value.

### Returns

| Type                                                                    | Description                                        |
| ----------------------------------------------------------------------- | -------------------------------------------------- |
| [double2](/engine/6000.6/script-reference/unity/mathematics/double2.md) | The componentwise maximum of the two input values. |

## max(double3, double3)

Returns the componentwise maximum of two double3 vectors.

```csharp
public static double3 max(double3 x, double3 y)
```

### Parameters

**** (\[double3]\(/engine/6000.6/script-reference/unity/mathematics/double3)): The first input value.**** (\[double3]\(/engine/6000.6/script-reference/unity/mathematics/double3)): The second input value.

### Returns

| Type                                                                    | Description                                        |
| ----------------------------------------------------------------------- | -------------------------------------------------- |
| [double3](/engine/6000.6/script-reference/unity/mathematics/double3.md) | The componentwise maximum of the two input values. |

## max(double4, double4)

Returns the componentwise maximum of two double4 vectors.

```csharp
public static double4 max(double4 x, double4 y)
```

### Parameters

**** (\[double4]\(/engine/6000.6/script-reference/unity/mathematics/double4)): The first input value.**** (\[double4]\(/engine/6000.6/script-reference/unity/mathematics/double4)): The second input value.

### Returns

| Type                                                                    | Description                                        |
| ----------------------------------------------------------------------- | -------------------------------------------------- |
| [double4](/engine/6000.6/script-reference/unity/mathematics/double4.md) | The componentwise maximum of the two input values. |
