summaryrefslogtreecommitdiff
path: root/tests/tsqrt_ui.c
diff options
context:
space:
mode:
authorpelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4>2004-01-09 16:00:54 +0000
committerpelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4>2004-01-09 16:00:54 +0000
commit21249c6b35c1ef09485172cb22598a1c78a2d151 (patch)
treec130d87f19bfd8807b624a985c6bf34a45499835 /tests/tsqrt_ui.c
parent0f61bc59c3dedca12d28706db41b52d5da474edb (diff)
downloadmpfr-21249c6b35c1ef09485172cb22598a1c78a2d151.tar.gz
Update the tests to reduce the use of floats.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@2620 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests/tsqrt_ui.c')
-rw-r--r--tests/tsqrt_ui.c21
1 files changed, 6 insertions, 15 deletions
diff --git a/tests/tsqrt_ui.c b/tests/tsqrt_ui.c
index d3ae201a4..30ef866a7 100644
--- a/tests/tsqrt_ui.c
+++ b/tests/tsqrt_ui.c
@@ -21,43 +21,34 @@ MA 02111-1307, USA. */
#include <stdio.h>
#include <stdlib.h>
-#include <time.h>
#include "mpfr-test.h"
-int maxulp=0;
-
static void
-check (unsigned long a, mp_rnd_t rnd_mode, double Q)
+check (unsigned long a, mp_rnd_t rnd_mode, const char *qs)
{
mpfr_t q;
- double Q2;
- int u;
mpfr_init2 (q, 53);
mpfr_sqrt_ui (q, a, rnd_mode);
- Q2 = mpfr_get_d1 (q);
- if (Q != Q2 && !(Isnan(Q) && Isnan(Q2)))
+ if (mpfr_cmp_str1 (q, qs))
{
- u = ulp (Q2,Q);
printf ("mpfr_sqrt_ui failed for a=%lu, rnd_mode=%s\n",
a, mpfr_print_rnd_mode (rnd_mode));
- printf ("sqrt gives %1.20e, mpfr_sqrt_ui gives %1.20e (%d ulp)\n",
- Q, Q2, u);
+ printf ("sqrt gives %s, mpfr_sqrt_ui gives ", qs);
+ mpfr_out_str(stdout, 10, 0, q, GMP_RNDN);
exit (1);
}
mpfr_clear (q);
}
-double five = 5.0;
-
int
main (void)
{
tests_start_mpfr ();
- check (0, GMP_RNDN, 0.0);
- check (2116118, GMP_RNDU, 1.45468828276026215e3);
+ check (0, GMP_RNDN, "0.0");
+ check (2116118, GMP_RNDU, "1.45468828276026215e3");
tests_end_mpfr ();
return 0;