Isqrt (integer square root) of X: Difference between revisions
Content deleted Content added
Not a robot (talk | contribs) →{{header|MAD}}: Change this to use the quadratic residue method |
Not a robot (talk | contribs) →{{header|APL}}: Change this to use the quadratic residue method |
||
Line 516:
=={{header|APL}}==
Works in [[Dyalog APL]]
<lang APL>
q←(×∘4)⍣{⍺>x}⊢1
⊃{ r z q←⍵
q←⌊q÷4
t←(z-r)-q
r←⌊r÷2
z←z t[1+t≥0]
r←r+q×t≥0
r z q
}⍣{ r z q←⍺
q≤1
}⊢0 x q
}</lang>
{{output}}
<pre>
|