From 57ba56dfc8a3ef3b807e4274a1cb2a3be7beb374 Mon Sep 17 00:00:00 2001 From: vlefevre Date: Thu, 22 Nov 2018 15:36:13 +0000 Subject: MPFR manual: corrected/completed the mpfr_get_str description in order to follow the historical behavior and GMP's mpf_get_str function. (Discussion in the Trier meeting.) (merged changeset r13283 from the trunk, with a correction in NEWS) git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/branches/4.0@13284 280ebfd0-de03-0410-8827-d642c229c3f4 --- NEWS | 4 +++- doc/mpfr.texi | 17 +++++++++++++---- src/get_str.c | 1 + 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/NEWS b/NEWS index ae590b37d..4f171d842 100644 --- a/NEWS +++ b/NEWS @@ -22,7 +22,9 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., Changes from version 4.0.1 to version 4.0.2: - Corrected minimal GMP version in the INSTALL file and the MPFR manual. -- Improved MPFR manual. +- Improved MPFR manual. In particular, corrected/completed the + mpfr_get_str description in order to follow the historical behavior + and GMP's mpf_get_str function. - Bug fixes (see ChangeLog file). Changes from version 4.0.0 to version 4.0.1: diff --git a/doc/mpfr.texi b/doc/mpfr.texi index c8e7e9217..3b890efbb 100644 --- a/doc/mpfr.texi +++ b/doc/mpfr.texi @@ -1661,12 +1661,21 @@ than in MPFR, so that an overflow or underflow is not possible. @end deftypefun @deftypefun {char *} mpfr_get_str (char *@var{str}, mpfr_exp_t *@var{expptr}, int @var{b}, size_t @var{n}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd}) -Convert @var{op} to a string of digits in base @var{b}, with rounding in -the direction @var{rnd}, where @var{n} is either zero (see below) or the -number of significant digits output in the string. -The base may vary from 2 to 62; +Convert @var{op} to a string of digits in base @GMPabs{@var{b}}, with +rounding in the direction @var{rnd}, where @var{n} is either zero +(see below) or the number of significant digits output in the string. +The argument @var{b} may vary from 2 to 62 or from @minus{}2 to @minus{}36; otherwise the function does nothing and immediately returns a null pointer. +For @var{b} in the range 2 to 36, digits and lower-case letters are used; +for @minus{}2 to @minus{}36, digits and upper-case letters are used; for +37 to 62, digits, upper-case letters, and lower-case letters, in that +significance order, are used. Warning! This implies that for +@math{@var{b} > 10}, the successor of the digit 9 depends on @var{b}. +This choice has been done for compatibility with GMP's @code{mpf_get_str} +function. Users who wish a more consistent behavior should write a simple +wrapper. + If the input is NaN, then the returned string is @samp{@@NaN@@} and the NaN flag is set. If the input is +Inf (resp.@: @minus{}Inf), then the returned string is @samp{@@Inf@@} (resp.@: @samp{-@@Inf@@}). diff --git a/src/get_str.c b/src/get_str.c index 8494d213d..82143c84f 100644 --- a/src/get_str.c +++ b/src/get_str.c @@ -2233,6 +2233,7 @@ mpfr_ceil_mul (mpfr_exp_t e, int beta, int i) exponent in e. x is rounded with direction rnd, m is the number of digits of the mantissa, |b| is the given base (2 <= b <= 62 or -36 <= b <= -2). + This follows GMP's mpf_get_str specification. Return value: if s=NULL, allocates a string to store the mantissa, with -- cgit v1.2.1