diff options
author | thevenyp <thevenyp@280ebfd0-de03-0410-8827-d642c229c3f4> | 2009-07-08 09:46:52 +0000 |
---|---|---|
committer | thevenyp <thevenyp@280ebfd0-de03-0410-8827-d642c229c3f4> | 2009-07-08 09:46:52 +0000 |
commit | 95f8d03abbfefb0a3d54b71e19c75165be332f97 (patch) | |
tree | 120a0b09e4f3580f120021b805c407abdd3b3136 /vasprintf.c | |
parent | 175ad3827b6973de1d2c3979829fc6b70867c647 (diff) | |
download | mpfr-95f8d03abbfefb0a3d54b71e19c75165be332f97.tar.gz |
vasprintf.c: Fix bug in precision 0 with format %.0Rf (0.5 rounds to 0).
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@6325 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'vasprintf.c')
-rw-r--r-- | vasprintf.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/vasprintf.c b/vasprintf.c index 219d1ec3d..fa6f16940 100644 --- a/vasprintf.c +++ b/vasprintf.c @@ -1322,8 +1322,9 @@ regular_fg (struct number_parts *np, mpfr_srcptr p, if ((spec.rnd_mode == MPFR_RNDD && MPFR_IS_NEG (p)) || (spec.rnd_mode == MPFR_RNDU && MPFR_IS_POS (p)) - || (spec.rnd_mode == MPFR_RNDN && mpfr_cmp_d (y, 0.5) >= 0)) - /* rounded up to 1: one digit '1' in integral part */ + || (spec.rnd_mode == MPFR_RNDN && mpfr_cmp_d (y, 0.5) > 0)) + /* rounded up to 1: one digit '1' in integral part. + note that 0.5 is rounded to 0 with RNDN (round ties to even) */ np->ip_ptr[0] = '1'; } else |