Exact division and mpf

Torbjorn Granlund tege at swox.com
Mon Nov 21 17:07:42 CET 2005

Torbjorn Granlund <tege at swox.com> writes:

  Let me add that it also requires that that exact quotient fits
  into the declared mantissa precision.  When dividing 6 by 3, you
  will always get 2, but dividing 6000000000 by 3 needs 31 bits,
  which will not be the case if the quotient variable was
  initialized using mpfr_init2(q,30);
As Paul pointed out in private mail, it is enough with 23 bits to
get the exact result in this case.


More information about the gmp-discuss mailing list