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}}==
 
{{Incorrect|APL| <br><br> The method used by this APL program is '''not''' the method that this task requires, &nbsp; namely: <br><br> quadratic residue. <br><br>}}
 
Works in [[Dyalog APL]]
<lang APL>i←⌊.5*⍨⊢</lang> i←{x←⍵
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>