diff options
author | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2012-04-26 16:05:56 +0000 |
---|---|---|
committer | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2012-04-26 16:05:56 +0000 |
commit | 8089e0094529397c5c37b74800f0bcc44c423aa3 (patch) | |
tree | 86f93be6737b7121e5b3a86734b78382ea07a597 /tests/tgamma.c | |
parent | 855453a2b0dbf387cbee56a119b3873c837f5e8b (diff) | |
download | mpfr-8089e0094529397c5c37b74800f0bcc44c423aa3.tar.gz |
[src/gamma.c] fixed bug found by Giridhar Tammana
https://sympa.inria.fr/sympa/arc/mpfr/2012-04/msg00013.html
Note (VL): this fix triggers an infinite loop on 32-bit machines
(or with -m32) in test20100709 from tgamma.c and this is partly
the opposite of changeset r6996.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@8159 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests/tgamma.c')
-rw-r--r-- | tests/tgamma.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/tgamma.c b/tests/tgamma.c index 2e79dc0df..7dd20bb61 100644 --- a/tests/tgamma.c +++ b/tests/tgamma.c @@ -475,6 +475,36 @@ test20100709 (void) mpfr_clear (x); } +/* bug found by Giridhar Tammana */ +static void +test20120426 (void) +{ + mpfr_t xa, xb; + int i; + mpfr_exp_t emin; + + mpfr_init2 (xa, 53); + mpfr_init2 (xb, 53); + mpfr_set_d (xb, -168.5, MPFR_RNDN); + emin = mpfr_get_emin (); + mpfr_set_emin (-1073); + i = mpfr_gamma (xa, xb, MPFR_RNDN); + i = mpfr_subnormalize (xa, i, MPFR_RNDN); /* new ternary value */ + mpfr_set_str (xb, "-9.5737343987585366746184749943e-304", 10, MPFR_RNDN); + if (!((i > 0) && (mpfr_cmp (xa, xb) == 0))) + { + printf ("Error in test20120426, i=%d\n", i); + printf ("expected "); + mpfr_print_binary (xb); putchar ('\n'); + printf ("got "); + mpfr_print_binary (xa); putchar ('\n'); + exit (1); + } + mpfr_set_emin (emin); + mpfr_clear (xa); + mpfr_clear (xb); +} + static void exprange (void) { @@ -818,6 +848,7 @@ main (int argc, char *argv[]) gamma_integer (); test20071231 (); test20100709 (); + test20120426 (); data_check ("data/gamma", mpfr_gamma, "mpfr_gamma"); |