Reimplemented from Ring.
Definition at line 317 of file ZZ.cpp.
320{
323 int gsign = mpz_sgn(g.
get_mpz());
324 mpz_t gg, ghalf;
325 mpz_init(gg);
326 mpz_init(ghalf);
328 mpz_fdiv_qr(q, r, f.
get_mpz(), gg);
329 mpz_tdiv_q_2exp(ghalf, gg, 1);
330 if (mpz_cmp(r, ghalf) > 0)
331 {
332 mpz_sub(r, r, gg);
333 mpz_add_ui(q, q, 1);
334 }
335 if (gsign < 0) mpz_neg(q, q);
336
337 mpz_clear(gg);
338 mpz_clear(ghalf);
341 quot = ring_elem(q);
342 return ring_elem(r);
343}
void mpz_reallocate_limbs(mpz_ptr _z)
mpz_srcptr get_mpz() const
References ring_elem::get_mpz(), mpz_reallocate_limbs(), and new_elem().
Referenced by quotient(), and remainder().