summaryrefslogtreecommitdiff
path: root/tests/tget_str.c
diff options
context:
space:
mode:
authorzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2002-07-16 15:33:31 +0000
committerzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2002-07-16 15:33:31 +0000
commitc02cbf711b9836c46016d55e8ddc0288b13db7e1 (patch)
tree4fce780d711630106c108a977f85f4a30b43a9f6 /tests/tget_str.c
parent0184fd088cd0e3288fda0ba17d736787dee7c19e (diff)
downloadmpfr-c02cbf711b9836c46016d55e8ddc0288b13db7e1.tar.gz
added function check_large
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@1972 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests/tget_str.c')
-rw-r--r--tests/tget_str.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/tests/tget_str.c b/tests/tget_str.c
index ed5acd68e..479998cfe 100644
--- a/tests/tget_str.c
+++ b/tests/tget_str.c
@@ -31,6 +31,7 @@ MA 02111-1307, USA. */
void check _PROTO((double, mp_rnd_t));
void check3 _PROTO((double, mp_rnd_t, char *));
void check_small _PROTO((void));
+void check_large _PROTO((void));
void
check (double d, mp_rnd_t rnd)
@@ -100,6 +101,27 @@ check_small (void)
mpfr_clear(x);
}
+/* bugs found by Alain Delplanque */
+void
+check_large (void)
+{
+ mpfr_t x;
+ char *s;
+ mp_exp_t e;
+
+ mpfr_init2 (x, 3322);
+ mpfr_set_str (x, "1191329373584454902963446991955720175286125252740279117456759314255666164381287629208894396284118106237638151734612401308413932016367151750198408279132283416239620735553421709762103354760976935178688281437433241547811421242765954526730340691899980570938762461672035935889779270816874853084356516609798927268594581372938379179977284655733836697143371494124951472644806260698117993938473190235354211767432206599326712003738743333323828631552259337062810367696590666369938765453594007585414315766344508757501018473199271112399659232815512649664511600328487149681659834297019266913593296230601165179075868421038664499758175796688586740720299441958650674273232702130590391453727085546110092041664691328503389878595591936541740247297124581446185876972120895955381254307651782007674810632305250114384523950982647480117154909223816904645463873617234552025814930741687826251074736645666685135716209232607981620388028775931067573127720041282084050501933636962829753889114577560279721743036737227562312131426923", 10, GMP_RNDN);
+ mpfr_div_2exp (x, x, 4343, GMP_RNDN);
+ s = mpfr_get_str (NULL, &e, 10, 1000, x, GMP_RNDN);
+ if (s[999] != '1') /* s must be 5.04383...689071e-309 */
+ {
+ fprintf (stderr, "Error in check_large: expected '689071', got '%s'\n",
+ s + 994);
+ exit (1);
+ }
+ mpfr_clear (x);
+}
+
int
main (int argc, char *argv[])
{
@@ -117,7 +139,8 @@ main (int argc, char *argv[])
}
}
#endif
- check_small();
+ check_small ();
+ check_large ();
check3(4.059650008e-83, GMP_RNDN, "40597");
check3(-6.606499965302424244461355e233, GMP_RNDN, "-66065");
check3(-7.4, GMP_RNDN, "-74000");