summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2018-09-03 13:17:45 +0000
committerzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2018-09-03 13:17:45 +0000
commit5fad30fdb6b057a737c53bcac51f5b51ef84c9b9 (patch)
tree80e3d07a0ed25d942561e184a73e3a93b8ec0f96
parentfaf938d3cbc2fb37fa9af3c9a0b1625a89f7a5d7 (diff)
downloadmpfr-5fad30fdb6b057a737c53bcac51f5b51ef84c9b9.tar.gz
[tests/tgeneric.c] revert 13107 (abort might lose some data in open files)
[src/mul_ui.c] fixed for 16-bit limb and reduced exponent range git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@13108 280ebfd0-de03-0410-8827-d642c229c3f4
-rw-r--r--src/mul_ui.c5
-rw-r--r--tests/tgeneric.c6
2 files changed, 8 insertions, 3 deletions
diff --git a/src/mul_ui.c b/src/mul_ui.c
index 00f7b9f85..bf9bf3977 100644
--- a/src/mul_ui.c
+++ b/src/mul_ui.c
@@ -118,11 +118,16 @@ mpfr_mul_ui (mpfr_ptr y, mpfr_srcptr x, unsigned long int u, mpfr_rnd_t rnd_mode
#else
{
mpfr_t uu;
+ MPFR_SAVE_EXPO_DECL (expo);
mpfr_init2 (uu, sizeof (unsigned long) * CHAR_BIT);
+ /* Warning: u might be outside the current exponent range! */
+ MPFR_SAVE_EXPO_MARK (expo);
mpfr_set_ui (uu, u, MPFR_RNDZ);
inexact = mpfr_mul (y, x, uu, rnd_mode);
mpfr_clear (uu);
+ MPFR_SAVE_EXPO_FREE (expo);
+ return mpfr_check_range (y, inexact, rnd_mode);
}
#endif /* MPFR_LONG_WITHIN_LIMB */
diff --git a/tests/tgeneric.c b/tests/tgeneric.c
index 4105084b5..942987498 100644
--- a/tests/tgeneric.c
+++ b/tests/tgeneric.c
@@ -488,7 +488,7 @@ test_generic (mpfr_prec_t p0, mpfr_prec_t p1, unsigned int nmax)
flags_out (flags);
printf ("inex = %d, w = ", inexact);
mpfr_dump (w);
- abort ();
+ exit (1);
}
test_of--;
}
@@ -551,7 +551,7 @@ test_generic (mpfr_prec_t p0, mpfr_prec_t p1, unsigned int nmax)
flags_out (flags);
printf ("inex = %d, w = ", inexact);
mpfr_dump (w);
- abort ();
+ exit (1);
}
test_uf--;
}
@@ -622,7 +622,7 @@ test_generic (mpfr_prec_t p0, mpfr_prec_t p1, unsigned int nmax)
mpfr_dump (w);
printf (" inex = %d, flags =", inexact);
flags_out (flags);
- abort ();
+ exit (1);
}
}