summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2017-09-13 14:11:35 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2017-09-13 14:11:35 +0000
commit95b9a3348f1f10b6f68940a3f6cdc8196924e476 (patch)
tree17ca374659ba1471defabf773870da7305f6c982
parent2eead9cf9db5a4345a1cefdfddd4602afe20da00 (diff)
downloadmpfr-95b9a3348f1f10b6f68940a3f6cdc8196924e476.tar.gz
[tests/troot.c] Really check the sign of the result 0 (the old test
was always false, thus useless!). git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@11743 280ebfd0-de03-0410-8827-d642c229c3f4
-rw-r--r--tests/troot.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/tests/troot.c b/tests/troot.c
index b8c86587f..e84254535 100644
--- a/tests/troot.c
+++ b/tests/troot.c
@@ -20,7 +20,10 @@ along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
-#ifndef TF
+#ifdef TF
+# define TF_IS_MPFR_ROOT 0
+#else
+# define TF_IS_MPFR_ROOT 1
# define TF mpfr_root
#endif
@@ -95,16 +98,18 @@ special (void)
/* root(+/-0, k) = +/-0 for k > 0 */
mpfr_set_ui (x, 0, MPFR_RNDN);
TF (y, x, 17, MPFR_RNDN);
- if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) < 0)
+ if (MPFR_NOTZERO (y) || MPFR_IS_NEG (y))
{
printf ("Error: root(+0,17) <> +0\n");
exit (1);
}
mpfr_neg (x, x, MPFR_RNDN);
TF (y, x, 42, MPFR_RNDN);
- if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) > 0)
+ if (MPFR_NOTZERO (y) ||
+ (TF_IS_MPFR_ROOT ? MPFR_IS_POS (y) : MPFR_IS_NEG (y)))
{
- printf ("Error: root(-0,42) <> -0\n");
+ printf ("Error: root(-0,42) <> %c0\n",
+ TF_IS_MPFR_ROOT ? '-' : '+');
exit (1);
}