diff options
author | thevenyp <thevenyp@280ebfd0-de03-0410-8827-d642c229c3f4> | 2008-03-10 10:56:03 +0000 |
---|---|---|
committer | thevenyp <thevenyp@280ebfd0-de03-0410-8827-d642c229c3f4> | 2008-03-10 10:56:03 +0000 |
commit | 2c74ea697383b0580191bb8062e37eec4709ea9c (patch) | |
tree | 89b21c78e030497b8f45f830064f9fdc45edc979 | |
parent | 24419e52d7d5af7355f1bba99f68a5f990233a9d (diff) | |
download | mpfr-2c74ea697383b0580191bb8062e37eec4709ea9c.tar.gz |
vasprintf.c: fix bug of forgotten decimal point with %#.0Rf
tests/tsprintf.c: add test with %#Rf and an integer mpfr_t
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@5338 280ebfd0-de03-0410-8827-d642c229c3f4
-rw-r--r-- | tests/tsprintf.c | 11 | ||||
-rw-r--r-- | vasprintf.c | 2 |
2 files changed, 13 insertions, 0 deletions
diff --git a/tests/tsprintf.c b/tests/tsprintf.c index 53ec08c31..98f3b6c36 100644 --- a/tests/tsprintf.c +++ b/tests/tsprintf.c @@ -498,6 +498,17 @@ locale_da_DK (void) check_sprintf (" 000000018.993.474,61279296875", "%' 030.19RG", x); check_sprintf (" 000000018.993.474,61279296875", "%' 030RF", x); + mpfr_set_ui (x, 50, GMP_RNDN); + mpfr_exp10 (x, x, GMP_RNDN); + check_sprintf ("100000000000000000000000000000000000000000000000000", "%Rf", + x); + check_sprintf + ("100.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000,", + "%'#Rf", x); + check_sprintf + ("100.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000.000,0000", + "%'.4Rf", x); + mpfr_clear (x); return 0; } diff --git a/vasprintf.c b/vasprintf.c index 038f6ae22..61b240480 100644 --- a/vasprintf.c +++ b/vasprintf.c @@ -1294,6 +1294,8 @@ regular_fg (struct number_parts *np, mpfr_srcptr p, { np->ip_trailing_zeros = np->ip_size - str_len; np->ip_size = str_len; + if (spec.alt) + np->point = MPFR_DECIMAL_POINT; } else /* str may contain some digits which are in fractional part */ |