math.isqrt

Full name
math.isqrt
Library
math
Syntax

math.isqrt(number)

Description

The math.isqrt (integer square root) function returns the integer part of the square root of the number passed as an argument.

Parameters
  • number: Integer to evaluate. It must be an integer equal to or greater than zero.
Result

The math.isqrt function returns an integer.

Examples

The square root of the number 16 is 4, so the math.isqrt function returns 4:

math.isqrt(16)

4

However, the square root of 15 is 3.87:

math.sqrt(15)

3.872983346207417

...so the math.isqrt function returns 3:

math.isqrt(15)

3

Submitted by admin on Thu, 01/21/2021 - 20:29