Skip to content

Modern Math ISqrt

Paul Squires edited this page Oct 19, 2026 · 5 revisions

Home › Math Library › Math Library › ISqrt

ISqrt

Returns the exact whole-number square root, rounded down.

Syntax

ISqrt( n )

Notes

  • exact floor of the true root

Examples

#import "std/numeric"
using numeric

'' The EXACT floor of the true square root -- integer arithmetic
'' throughout, so it cannot be off by one the way clng( sqr( n ) ) can
dim as uint64 n = 26
print ISqrt( n )             '' 5

dim as uint64 sq = 25
print ISqrt( sq )            '' 5

'' At sizes where a double runs out of significand, sqr( ) starts
'' rounding to the wrong integer; this never does

Library: Math Library
Category: Math Library
Documented under: Nothing Becomes A Keyword

Clone this wiki locally