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[dtype: DType, //](x: SIMD[dtype, size], y: SIMD[dtype, size], /) -> SIMD[dtype, 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.
Parameters:
- dtype (
DType
): The data type of the SIMD vector.
Args:
- x (
SIMD[dtype, size]
): First SIMD vector. - y (
SIMD[dtype, size]
): Second SIMD vector.
Returns:
A SIMD vector containing the elementwise maximum of x and y.
max[T: _CopyableGreaterThanComparable](x: T, *ys: T) -> T
Gets the maximum value from a sequence of values.
Parameters:
- T (
_CopyableGreaterThanComparable
): A type that is both copyable and comparable with greater than.
Args:
- x (
T
): The first value to compare. - *ys (
T
): Zero or more additional values to compare.
Returns:
The maximum value from the input sequence.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!