summaryrefslogtreecommitdiff
path: root/tests/tsin.c
diff options
context:
space:
mode:
authorpelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4>2004-01-14 12:42:22 +0000
committerpelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4>2004-01-14 12:42:22 +0000
commit0a40b14f2ae6f51268df552f999845f23de4a321 (patch)
tree15f35161f8ad2eee60846eb7af6d23be3e4df5fd /tests/tsin.c
parent21249c6b35c1ef09485172cb22598a1c78a2d151 (diff)
downloadmpfr-0a40b14f2ae6f51268df552f999845f23de4a321.tar.gz
Continue to port tests so that they don't use double.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@2621 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests/tsin.c')
-rw-r--r--tests/tsin.c37
1 files changed, 19 insertions, 18 deletions
diff --git a/tests/tsin.c b/tests/tsin.c
index 7a181a46d..604dbb245 100644
--- a/tests/tsin.c
+++ b/tests/tsin.c
@@ -1,6 +1,6 @@
/* Test file for mpfr_sin.
-Copyright 2001, 2002, 2003 Free Software Foundation, Inc.
+Copyright 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
This file is part of the MPFR Library.
@@ -25,20 +25,21 @@ MA 02111-1307, USA. */
#include "mpfr-test.h"
static void
-check53 (double x, double sin_x, mp_rnd_t rnd_mode)
+check53 (const char *xs, const char *sin_xs, mp_rnd_t rnd_mode)
{
mpfr_t xx, s;
mpfr_init2 (xx, 53);
mpfr_init2 (s, 53);
- mpfr_set_d (xx, x, rnd_mode); /* should be exact */
+ mpfr_set_str1 (xx, xs); /* should be exact */
mpfr_sin (s, xx, rnd_mode);
- if (mpfr_get_d1 (s) != sin_x && !(Isnan(sin_x) && mpfr_nan_p(s)))
+ if (mpfr_cmp_str1 (s, sin_xs))
{
- printf ("mpfr_sin failed for x=%1.20e, rnd=%s\n",
- x, mpfr_print_rnd_mode (rnd_mode));
- printf ("mpfr_sin gives sin(x)=%1.20e, expected %1.20e\n",
- mpfr_get_d1 (s), sin_x);
+ printf ("mpfr_sin failed for x=%s, rnd=%s\n",
+ xs, mpfr_print_rnd_mode (rnd_mode));
+ printf ("mpfr_sin gives sin(x)=");
+ mpfr_out_str(stdout, 10, 0, s, GMP_RNDN);
+ printf(", expected %s\n", sin_xs);
exit(1);
}
mpfr_clear (xx);
@@ -135,16 +136,16 @@ main (int argc, char *argv[])
check_nans ();
/* worst case from PhD thesis of Vincent Lefe`vre: x=8980155785351021/2^54 */
- check53 (4.984987858808754279e-1, 4.781075595393330379e-1, GMP_RNDN);
- check53 (4.984987858808754279e-1, 4.781075595393329824e-1, GMP_RNDD);
- check53 (4.984987858808754279e-1, 4.781075595393329824e-1, GMP_RNDZ);
- check53 (4.984987858808754279e-1, 4.781075595393330379e-1, GMP_RNDU);
- check53 (1.00031274099908640274, 8.416399183372403892e-1, GMP_RNDN);
- check53 (1.00229256850978698523, 8.427074524447979442e-1, GMP_RNDZ);
- check53 (1.00288304857059840103, 8.430252033025980029e-1, GMP_RNDZ);
- check53 (1.00591265847407274059, 8.446508805292128885e-1, GMP_RNDN);
-
- check53 (1.00591265847407274059, 8.446508805292128885e-1, GMP_RNDN);
+ check53 ("4.984987858808754279e-1", "4.781075595393330379e-1", GMP_RNDN);
+ check53 ("4.984987858808754279e-1", "4.781075595393329824e-1", GMP_RNDD);
+ check53 ("4.984987858808754279e-1", "4.781075595393329824e-1", GMP_RNDZ);
+ check53 ("4.984987858808754279e-1", "4.781075595393330379e-1", GMP_RNDU);
+ check53 ("1.00031274099908640274", "8.416399183372403892e-1", GMP_RNDN);
+ check53 ("1.00229256850978698523", "8.427074524447979442e-1", GMP_RNDZ);
+ check53 ("1.00288304857059840103", "8.430252033025980029e-1", GMP_RNDZ);
+ check53 ("1.00591265847407274059", "8.446508805292128885e-1", GMP_RNDN);
+
+ check53 ("1.00591265847407274059", "8.446508805292128885e-1", GMP_RNDN);
mpfr_init2 (x, 2);