summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2020-03-11 13:23:28 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2020-03-11 13:23:28 +0000
commit202fe9f7c78bbf6a05eea64a3bebbeab6fe4f102 (patch)
tree08143791c00df40368e91834fbeed6b703f860bd
parent16c43530d3b444a6ff2dbcda13a2c61efe69a097 (diff)
downloadmpfr-202fe9f7c78bbf6a05eea64a3bebbeab6fe4f102.tar.gz
[tests/tcbrt.c] Test the ternary value on special cases.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@13773 280ebfd0-de03-0410-8827-d642c229c3f4
-rw-r--r--tests/tcbrt.c38
1 files changed, 32 insertions, 6 deletions
diff --git a/tests/tcbrt.c b/tests/tcbrt.c
index 005ccc781..c030991ad 100644
--- a/tests/tcbrt.c
+++ b/tests/tcbrt.c
@@ -26,52 +26,78 @@ static void
special (void)
{
mpfr_t x, y;
+ int inex;
mpfr_init (x);
mpfr_init (y);
/* cbrt(NaN) = NaN */
mpfr_set_nan (x);
- mpfr_cbrt (y, x, MPFR_RNDN);
+ inex = mpfr_cbrt (y, x, MPFR_RNDN);
if (!mpfr_nan_p (y))
{
- printf ("Error: cbrt(NaN) <> NaN\n");
+ printf ("Error: cbrt(NaN) is not NaN\n");
+ exit (1);
+ }
+ if (inex != 0)
+ {
+ printf ("Error: cbrt(NaN): incorrect ternary value %d\n", inex);
exit (1);
}
/* cbrt(+Inf) = +Inf */
mpfr_set_inf (x, 1);
- mpfr_cbrt (y, x, MPFR_RNDN);
+ inex = mpfr_cbrt (y, x, MPFR_RNDN);
if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0)
{
printf ("Error: cbrt(+Inf) <> +Inf\n");
exit (1);
}
+ if (inex != 0)
+ {
+ printf ("Error: cbrt(+Inf): incorrect ternary value %d\n", inex);
+ exit (1);
+ }
/* cbrt(-Inf) = -Inf */
mpfr_set_inf (x, -1);
- mpfr_cbrt (y, x, MPFR_RNDN);
+ inex = mpfr_cbrt (y, x, MPFR_RNDN);
if (!mpfr_inf_p (y) || mpfr_sgn (y) > 0)
{
printf ("Error: cbrt(-Inf) <> -Inf\n");
exit (1);
}
+ if (inex != 0)
+ {
+ printf ("Error: cbrt(-Inf): incorrect ternary value %d\n", inex);
+ exit (1);
+ }
/* cbrt(+/-0) = +/-0 */
mpfr_set_ui (x, 0, MPFR_RNDN);
- mpfr_cbrt (y, x, MPFR_RNDN);
+ inex = mpfr_cbrt (y, x, MPFR_RNDN);
if (MPFR_NOTZERO (y) || MPFR_IS_NEG (y))
{
printf ("Error: cbrt(+0) <> +0\n");
exit (1);
}
+ if (inex != 0)
+ {
+ printf ("Error: cbrt(+0): incorrect ternary value %d\n", inex);
+ exit (1);
+ }
mpfr_neg (x, x, MPFR_RNDN);
- mpfr_cbrt (y, x, MPFR_RNDN);
+ inex = mpfr_cbrt (y, x, MPFR_RNDN);
if (MPFR_NOTZERO (y) || MPFR_IS_POS (y))
{
printf ("Error: cbrt(-0) <> -0\n");
exit (1);
}
+ if (inex != 0)
+ {
+ printf ("Error: cbrt(-0): incorrect ternary value %d\n", inex);
+ exit (1);
+ }
mpfr_set_prec (x, 53);
mpfr_set_str (x, "8.39005285514734966412e-01", 10, MPFR_RNDN);