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[dtype: DType, simd_width: Int, //](x: SIMD[dtype, simd_width]) -> SIMD[dtype, simd_width]

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

Constraints:

The type must be an arithmetic or boolean type.

Parameters:

  • dtype (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[dtype, simd_width]): SIMD vector to perform square root on.

Returns:

The elementwise square root of x.