diff options
author | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2017-02-07 16:35:29 +0000 |
---|---|---|
committer | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2017-02-07 16:35:29 +0000 |
commit | 3a8ae11cb261aba272814572acf3cb0230ad9872 (patch) | |
tree | 590cfe5a3c7f8222b6d2be4c8f200051d5a6bf12 /src/vasprintf.c | |
parent | 79641686edaffa16abb182ab4e6760831d7dd03a (diff) | |
download | mpfr-3a8ae11cb261aba272814572acf3cb0230ad9872.tar.gz |
[src/vasprintf.c] improved also %a and %e
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@11270 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'src/vasprintf.c')
-rw-r--r-- | src/vasprintf.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/vasprintf.c b/src/vasprintf.c index 8f099b488..4926522dc 100644 --- a/src/vasprintf.c +++ b/src/vasprintf.c @@ -910,7 +910,7 @@ regular_ab (struct number_parts *np, mpfr_srcptr p, - if a non-zero precision is specified, then one digit before decimal point plus SPEC.PREC after it. */ nsd = spec.prec < 0 ? 0 : spec.prec + np->ip_size; - str = mpfr_get_str (NULL, &exp, base, nsd, p, spec.rnd_mode); + str = mpfr_get_str_aux (&exp, base, nsd, p, spec); register_string (np->sl, str); np->ip_ptr = MPFR_IS_NEG (p) ? ++str : str; /* skip sign if any */ @@ -1081,7 +1081,7 @@ regular_ab (struct number_parts *np, mpfr_srcptr p, /* Determine the different parts of the string representation of the regular number P when spec.spec is 'e', 'E', 'g', or 'G'. - DEC_INFO contains the previously computed exponent and string or is NULL. + dec_info contains the previously computed exponent and string or is NULL. return -1 if some field > INT_MAX */ static int @@ -1115,7 +1115,7 @@ regular_eg (struct number_parts *np, mpfr_srcptr p, We use the fact here that mpfr_get_str allows us to ask for only one significant digit when the base is not a power of 2. */ nsd = (spec.prec < 0) ? 0 : spec.prec + np->ip_size; - str = mpfr_get_str (NULL, &exp, 10, nsd, p, spec.rnd_mode); + str = mpfr_get_str_aux (&exp, 10, nsd, p, spec); register_string (np->sl, str); } else @@ -1659,6 +1659,8 @@ partition_number (struct number_parts *np, mpfr_srcptr p, struct decimal_info dec_info; threshold = (spec.prec < 0) ? 6 : (spec.prec == 0) ? 1 : spec.prec; + /* here we cannot call mpfr_get_str_aux since we need the full + significand in dec_info.str */ dec_info.str = mpfr_get_str (NULL, &dec_info.exp, 10, threshold, p, spec.rnd_mode); register_string (np->sl, dec_info.str); |