diff options
author | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2018-04-19 15:51:55 +0000 |
---|---|---|
committer | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2018-04-19 15:51:55 +0000 |
commit | 4ec86410d6774ba9c22dd8dbee3ee7378609f6a3 (patch) | |
tree | 8a2fe7eb2186caa8f2c97d551e562143e825a36b /doc | |
parent | 46ead58b10497e9e112d1edd6a1f140becd217ee (diff) | |
download | mpfr-4ec86410d6774ba9c22dd8dbee3ee7378609f6a3.tar.gz |
Fixed an issue with mpfr_get_str: The number 1 of significant digits
output in the string is now fully supported, i.e.
* the value 1 can be provided for n (4th argument);
* if n = 0, then the number of significant digits in the output string
can now be 1, as already implied by the documentation (but the code
was increasing it to 2).
Changes:
* doc/mpfr.texi: updated mpfr_get_str description to accept n = 1.
* src/get_str.c: fixed the code as explained above (for n = 0,
removed the increase to 2, and removed an MPFR_ASSERTN).
* tests/tget_str.c: added tests.
(merged changesets from the trunk: r12430 on tests/tget_str.c only;
r12432,12434,12440)
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/branches/4.0@12642 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'doc')
-rw-r--r-- | doc/mpfr.texi | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/doc/mpfr.texi b/doc/mpfr.texi index 009087db0..54156445c 100644 --- a/doc/mpfr.texi +++ b/doc/mpfr.texi @@ -1655,8 +1655,8 @@ than in MPFR, so that an overflow or underflow is not possible. @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; in the latter case, -@var{n} must be greater or equal to 2. The base may vary from 2 to 62; +number of significant digits output in the string. +The base may vary from 2 to 62; otherwise the function does nothing and immediately returns a null pointer. If the input is NaN, then the returned string is @samp{@@NaN@@} and the @@ -1699,8 +1699,7 @@ with @var{p} replaced by @var{p}@minus{}1 if @var{b} is a power of 2, but in some very rare cases, it might be @math{m+1} (the smallest case for bases up to 62 is when @var{p} equals 186564318007 for bases 7 and 49). -@c In the source src/get_str.c, this is due to the approximate mpfr_ceil_mul, -@c but also m = 1 is changed to 2. +@c In the source src/get_str.c, this is due to the approximate mpfr_ceil_mul. If @var{str} is a null pointer, space for the significand is allocated using the allocation function (@pxref{Memory Handling}) and a pointer to the string |