summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2021-05-16 17:30:12 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2021-05-16 17:30:12 +0000
commit9511751e0ced73283a415b42efd9855d52d0cd91 (patch)
tree78c75e97f883667617b3a79957f8001ca19269c3
parent818dd9abc7174960ede0a08bd1619d9b1a7c9cca (diff)
downloadmpfr-9511751e0ced73283a415b42efd9855d52d0cd91.tar.gz
[doc/mpfr.texi] Formatted output functions (mpfr_*printf): completed
the specification concerning the precision (this was needed because the conversion specifier 'b' does not exist in C). git-svn-id: https://scm.gforge.inria.fr/anonscm/svn/mpfr/trunk@14517 280ebfd0-de03-0410-8827-d642c229c3f4
-rw-r--r--doc/mpfr.texi23
1 files changed, 17 insertions, 6 deletions
diff --git a/doc/mpfr.texi b/doc/mpfr.texi
index b7e97425e..631e55ee8 100644
--- a/doc/mpfr.texi
+++ b/doc/mpfr.texi
@@ -2894,8 +2894,13 @@ for @samp{a}, @samp{b}, @samp{e}, @samp{f}, and @samp{g} specifiers and
The @code{mpfr_t} number is rounded to the given precision in the direction
specified by the rounding mode (see below if the precision is missing).
+Similarly to the native C types, the precision is the number of digits
+output after the decimal point, except for the @samp{g} and @samp{G}
+conversion specifiers, where it is the number of significant digits
+(but trailing zeros of the fractional part are not output by default),
+or 1 if the precision is zero.
If the precision is zero with rounding to nearest mode and one of the
-following @samp{conv} specifiers: @samp{a}, @samp{A}, @samp{b}, @samp{e},
+following conversion specifiers: @samp{a}, @samp{A}, @samp{b}, @samp{e},
@samp{E}, tie case is rounded to even when it lies between two consecutive
values at the
wanted precision which have the same exponent, otherwise, it is rounded away
@@ -2907,9 +2912,14 @@ uses the @samp{e} (resp.@: @samp{E}) style.
If the precision is set to a value greater than the maximum value for an
@code{int}, it will be silently reduced down to @code{INT_MAX}.
-If the precision is missing with @samp{conv} specifier @samp{e} and @samp{E}
-(as in @code{%Re}), the chosen precision (i.e., the number of digits to be
-displayed after the initial digit and the decimal point) is
+If the precision is missing, it is chosen as follows, depending on the
+conversion specifier.
+@itemize @bullet
+@item With @samp{a}, @samp{A}, and @samp{b}, it is chosen to have
+an exact representation with no trailing zeros.
+@c Avoid saying "minimum" as this could be confusing with the different
+@c possible choices for a/A.
+@item With @samp{e} and @samp{E}, it is
@ifnottex
ceil(@var{p}*log(2)/log(@var{10})),
@end ifnottex
@@ -2920,8 +2930,9 @@ where @var{p} is the precision of the input variable, matching the choice
done for @code{mpfr_get_str}; thus, if rounding to nearest is used,
outputting the value with a missing precision and reading it back will
yield the original value.
-The chosen precision for a missing precision with @samp{conv}
-specifiers @samp{f}, @samp{F}, @samp{g}, and @samp{G} is 6.
+@item With @samp{f}, @samp{F}, @samp{g}, and @samp{G}, it is 6.
+@end itemize
+
@c For the record, concerning the choice for 'e'/'E':
@c https://sympa.inria.fr/sympa/arc/mpfr/2019-12/msg00000.html
@c https://sympa.inria.fr/sympa/arc/mpfr/2020-01/msg00000.html