Isqrt (integer square root) of X: Difference between revisions

m
→‎{{header|Phix}}: crash->assert
m (→‎{{header|Phix}}: oops, 10, 20 divide by 5!)
m (→‎{{header|Phix}}: crash->assert)
Line 489:
end while
while mpz_cmp_si(q,1)>0 do
if assert(mpz_fdiv_q_ui(q, q, 4)!=0 then crash("uh") end if
mpz_sub(t,z,r)
mpz_sub(t,t,q)
if assert(mpz_fdiv_q_ui(r, r, 2)!=0 then crash("uh") end if
if mpz_cmp_si(t,0) >= 0 then
mpz_set(z,t)
7,806

edits