gmp 4.1 documentation improvement suggestions

Torbjorn Granlund
09 Dec 2002 20:15:09 +0100

Vincent Lefevre <> writes:

  > Page 8: "int mpfr_round_prec() Rounds x according to rnd with precision
  > prec, which may be different from that of x. ... In both cases, the
  > precision of x is changed to prec. The returned value is zero when the
  > result is exact, positive when it is greater than the original value of
  > x ..."
  > Here I read "result is exact" to mean "the object x knew how many digits
  > it had, and we have guessed it correctly". But of course this refers
  > only to the value of precision stored in x, that may have little to do
  > with the actual achieved precision of the approximation of some real
  > number.

  One should probably say "... when the result is equal to the original
  value of x...".

Perhaps the docs should say something along these lines:

The return value of mpfr_round_prec is zero if changing the precision
of x didn't actually require any rounding, that is, the value of x
before and after the mpfr_round_prec are equal.  Otherwise, the return
value is non-zero.

Note that as all results in mpfr are typically rounded, calling
mpfr_round_prec on a variable whose value is not to be ignored, will
imply that the variable is rounded twice.  Such double rounding
typically leads to slightly less accurate results.