Skip to main content
Log in

Mojo function

max

max(x: Int, y: Int, /) -> Int

Gets the maximum of two integers.

Args:

  • x (Int): Integer input to max.
  • y (Int): Integer input to max.

Returns:

Maximum of x and y.

max(x: UInt, y: UInt, /) -> UInt

Gets the maximum of two integers.

Args:

  • x (UInt): Integer input to max.
  • y (UInt): Integer input to max.

Returns:

Maximum of x and y.

max(x: SIMD[type, size], y: SIMD[type, size], /) -> SIMD[type, size]

Performs elementwise maximum of x and y.

An element of the result SIMD vector will be the maximum of the corresponding elements in x and y.

Constraints:

The type of the inputs must be numeric or boolean.

Args:

  • x (SIMD[type, size]): First SIMD vector.
  • y (SIMD[type, size]): Second SIMD vector.

Returns:

A SIMD vector containing the elementwise maximum of x and y.