Skip to main content
Log in

Mojo function

sqrt

sqrt(x: Int) -> Int

Performs square root on an integer.

Args:

  • ​x (Int): The integer value to perform square root on.

Returns:

The square root of x.

sqrt[type: DType, simd_width: Int, //](x: SIMD[type, simd_width]) -> SIMD[$0, $1]

Performs elementwise square root on the elements of a SIMD vector.

Constraints:

The type must be an arithmetic or boolean type.

Parameters:

  • ​type (DType): The dtype of the input and output SIMD vector.
  • ​simd_width (Int): The width of the input and output SIMD vector.

Args:

  • ​x (SIMD[type, simd_width]): SIMD vector to perform square root on.

Returns:

The elementwise square root of x.

Was this page helpful?