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: Nightly
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).

sqrt

def sqrt(x: Int) -> Int

Performs square root on an integer.

Args:

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

Returns:

Int: The square root of x.

def sqrt[dtype: DType, width: SIMDSize, //](x: SIMD[dtype, width]) -> SIMD[dtype, width]

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

Parameters:

  • dtype (DType): The dtype of the input and output SIMD vector.
  • width (SIMDSize): The width of the input and output SIMD vector.

Args:

Returns:

SIMD[dtype, width]: The elementwise square root of x.