IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /docs/manual/basics.md). For the complete Mojo documentation index, see llms.txt.
Skip to main content
Version: 1.0.0b1
For the complete Mojo documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /docs/manual/basics.md).

min

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

Gets the minimum of two integers.

Args:

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

Returns:

Int: Minimum of x and y.

min[dtype: DType, //](x: SIMD[dtype], y: SIMD[dtype, x.size], /) -> SIMD[dtype, x.size]

Gets the elementwise minimum of x and y.

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

Constraints:

The type of the inputs must be numeric or boolean.

Parameters:

  • dtype (DType): The data type of the SIMD vector.

Args:

Returns:

SIMD[dtype, x.size]: A SIMD vector containing the elementwise minimum of x and y.

min[T: Copyable & Comparable](x: T, *ys: T) -> T

Gets the minimum value from a sequence of values.

Parameters:

  • T (Copyable & Comparable): A type that is both copyable and comparable with less than.

Args:

  • x (T): The first value to compare.
  • *ys (T): Zero or more additional values to compare.

Returns:

T: The minimum value from the input sequence.