Open
Description
Most programming languages that include the integer square root use the name isqrt
instead of sqrt
. Some of them do use sqrt
for integer square roots.
isqrt
in generic namespace: Common Lisp, Crystal, Julia, Maple, PARI/GP*, Python, Racket*, SageMath, Scheme*, Tclisqrt
in integer namespace/class: Rustsqrt
in integer namespace/class: Chapel, Java, Ruby, Zig
(Languages marked with * spell out isqrt
using words like integer-sqrt
.)
Notably, if we name the BigInt root functions BigInt.isqrt
/icbrt
instead of BigInt.sqrt
/cbrt
, then this would point towards also including a Math.isqrt
/icbrt
for numbers.
- Should we name the BigInt root functions
BigInt.sqrt
/cbrt
vs.BigInt.isqrt
/icbrt
? - If we do go with
BigInt.isqrt
/icbrt
, then, in a future proposal (not this one), should we considerMath.isqrt
/icbrt
for numbers?
I would personally like integer square roots to consistently be isqrt
across both bigints (BigInt.isqrt
) and numbers (Number.isqrt
). If integer square roots are useful on bigints, then they'd be useful on integer numbers too.
CC: @bakkot, @waldemarhorwat, @ljharb