summaryrefslogtreecommitdiff
path: root/tests/tstrtofr.c
diff options
context:
space:
mode:
authorzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2018-04-06 16:19:29 +0000
committerzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2018-04-06 16:19:29 +0000
commit326c0d1529d86c28a2559533e739d2be509f7500 (patch)
tree5c873d38f1c233d7c5514b1c39a79904b8fd919f /tests/tstrtofr.c
parent58573c834cb2a8ef3ca1d440f92f8fe25aa57f1d (diff)
downloadmpfr-326c0d1529d86c28a2559533e739d2be509f7500.tar.gz
[src/strtofr.c] added comment
[tests/tstrtofr.c] improve coverage git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@12566 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests/tstrtofr.c')
-rw-r--r--tests/tstrtofr.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/tstrtofr.c b/tests/tstrtofr.c
index 1e0e1e169..d6d1d1e83 100644
--- a/tests/tstrtofr.c
+++ b/tests/tstrtofr.c
@@ -938,6 +938,20 @@ check_overflow (void)
mpfr_dump (x);
exit (1);
}
+ mpfr_strtofr (x, "1@2305843009213693951", &s, 16, MPFR_RNDN);
+ if (s[0] != 0 || !MPFR_IS_INF (x) || !MPFR_IS_POS (x))
+ {
+ printf ("Check overflow failed (8) with:\n s=%s\n x=", s);
+ mpfr_dump (x);
+ exit (1);
+ }
+ mpfr_strtofr (x, "1@2305843009213693951", &s, 17, MPFR_RNDN);
+ if (s[0] != 0 || !MPFR_IS_INF (x) || !MPFR_IS_POS (x))
+ {
+ printf ("Check overflow failed (9) with:\n s=%s\n x=", s);
+ mpfr_dump (x);
+ exit (1);
+ }
/* Check underflow */
mpfr_strtofr (x, "123456789E-2147483646", &s, 0, MPFR_RNDN);
@@ -969,6 +983,13 @@ check_overflow (void)
mpfr_dump (x);
exit (1);
}
+ mpfr_strtofr (x, "1@-2305843009213693952", &s, 16, MPFR_RNDN);
+ if (s[0] != 0 || !MPFR_IS_ZERO (x) || !MPFR_IS_POS (x) )
+ {
+ printf ("Check underflow failed (8) with:\n s='%s'\n x=", s);
+ mpfr_dump (x);
+ exit (1);
+ }
mpfr_clear (x);
}