Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Integer square root
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==In programming languages== Some [[programming language]]s dedicate an explicit operation to the integer square root calculation in addition to the general case or can be extended by libraries to this end. {| class="wikitable" ! Programming language !! Example use !! Version introduced |- | [[Chapel (programming language)|Chapel]] || <code>BigInteger.sqrt(result, n);</code><ref>{{cite web | url = https://chapel-lang.org/docs/modules/standard/BigInteger.html#BigInteger.sqrt | title = BigInteger - Chapel Documentation 2.1 | website = Chapel Documentation - Chapel Documentation 2.1}}</ref><br><code>BigInteger.sqrtRem(result, remainder, n);</code> || Unknown |- | [[Common Lisp]] || <code>(isqrt n)</code><ref>{{cite web | url = http://www.lispworks.com/documentation/lw50/CLHS/Body/f_sqrt_.htm | title = CLHS: Function SQRT, ISQRT | website = Common Lisp HyperSpec (TM)}}</ref> || Unknown |- | [[Crystal (programming language)|Crystal]] || <code>Math.isqrt(n)</code><ref>{{cite web | url = https://crystal-lang.org/api/1.13.2/Math.html#isqrt%28value%3AInt%3A%3APrimitive%29-instance-method | title = Math - Crystal 1.13.2 | website = The Crystal Programming Language API docs}}</ref> || 1.2 |- | [[Java (programming language)|Java]] || <code>n.sqrt()</code><ref>{{cite web | url = https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/math/BigInteger.html#sqrt() | title = BigInteger (Java SE 21 & JDK 21) | website = JDK 21 Documentation}}</ref> (<code>BigInteger</code> only) || 9 |- | [[Julia (programming language)|Julia]] || <code>isqrt(n)</code><ref>{{cite web | url = https://docs.julialang.org/en/v1/base/math/#Base.isqrt | title = Mathematics - The Julia Language | website = Julia Documentation - The Julia Language}}</ref> || 0.3 |- | [[Maple (software)|Maple]] || <code>isqrt(n)</code><ref>{{cite web | url = https://www.maplesoft.com/support/help/maple/view.aspx?path=isqrt | title = iroot- Maple Help | website = Help - Maplesoft}}</ref> || Unknown |- | [[PARI/GP]] || <code>sqrtint(n)</code><ref>{{cite web | url = https://pari.math.u-bordeaux.fr/dochtml/html-stable/Arithmetic_functions.html#sqrtint | title = Catalogue of GP/PARI Functions: Arithmetic functions | website = PARI/GP Development Headquarters}}</ref> || 1.35a<ref>{{cite web | url = http://library.snls.org.sz/archive/science/math/multiplePrecision/pari/ | title = Index of /archive/science/math/multiplePrecision/pari/ | website = PSG Digital Resources | archive-url = https://web.archive.org/web/20241106111659/http://library.snls.org.sz/archive/science/math/multiplePrecision/pari/ | archive-date = 2024-11-06}}</ref> (as <code>isqrt</code>) or before |- | [[Python (programming language)|Python]] || <code>math.isqrt(n)</code><ref>{{cite web | url = https://docs.python.org/3/library/math.html#math.isqrt | title = Mathematical functions | website = Python Standard Library documentation}}</ref> || 3.8 |- | [[Racket (programming language)|Racket]] || <code>(integer-sqrt n)</code><ref>{{cite web | url = https://docs.racket-lang.org/reference/generic-numbers.html#%28def._%28%28quote._~23~25kernel%29._integer-sqrt%29%29 | title = 4.3.2 Generic Numerics | website = Racket Documentation}}</ref><br><code>(integer-sqrt/remainder n)</code> || Unknown |- | [[Ruby (programming language)|Ruby]] || <code>Integer.sqrt(n)</code><ref>{{cite web | url = https://docs.ruby-lang.org/en/master/Integer.html#method-c-sqrt | title = class Integer - RDoc Documentation | website = RDoc Documentation}}</ref> || 2.5.0 |- | [[Rust (programming language)|Rust]] || <code>n.isqrt()</code><ref>{{cite web | url = https://doc.rust-lang.org/std/primitive.i32.html#method.isqrt | title = i32 - Rust | website = std - Rust }}</ref><br><code>n.checked_isqrt()</code><ref>{{cite web | url = https://doc.rust-lang.org/std/primitive.i32.html#method.checked_isqrt | title = i32 - Rust | website = std - Rust }}</ref> || 1.84.0 |- | [[SageMath]] || <code>isqrt(n)</code><ref>{{cite web | url = https://doc.sagemath.org/html/en/reference/rings_standard/sage/rings/integer.html#sage.rings.integer.Integer.isqrt | title = Elements of the ring β€ of integers - Standard Commutative Rings | website = SageMath Documentation}}</ref> || Unknown |- | [[Scheme (programming language)|Scheme]] || <code>(exact-integer-sqrt n)</code><ref>{{cite web | url = https://standards.scheme.org/corrected-r7rs/r7rs-Z-H-8.html#TAG:__tex2page_index_470 | title = Revised<sup>7</sup> Report on the Algorithmic Language Scheme | website = Scheme Standards}}</ref> || R<sup>6</sup>RS |- | [[Tcl]] || <code>isqrt($n)</code><ref>{{cite web | url = https://www.tcl.tk/man/tcl/TclCmd/mathfunc.htm#M22 | title = mathfunc manual page - Tcl Mathematical Functions | website = Tcl/Tk 8.6 Manual}}</ref> || 8.5 |- | [[Zig (programming language)|Zig]] || <code>std.math.sqrt(n)</code><ref>{{cite web | url = https://ziglang.org/documentation/master/std/#std.math.sqrt.sqrt | title = std.math.sqrt.sqrt - Zig Documentation | website = Home ⚡ Zig Programming Language }}</ref> || Unknown |}
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)