summaryrefslogtreecommitdiff
path: root/tests/tasinh.c
diff options
context:
space:
mode:
authorzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2001-10-25 13:53:19 +0000
committerzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2001-10-25 13:53:19 +0000
commitb113bfaf8421393d35666db154f19fd69a8694ac (patch)
tree1861dcba2e90aa382c4b55f855d0f6a1f78ec6e1 /tests/tasinh.c
parent519719be8306c2cfbdf7128ae62828641da84615 (diff)
downloadmpfr-b113bfaf8421393d35666db154f19fd69a8694ac.tar.gz
now use tgeneric.c
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@1362 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests/tasinh.c')
-rw-r--r--tests/tasinh.c50
1 files changed, 3 insertions, 47 deletions
diff --git a/tests/tasinh.c b/tests/tasinh.c
index b456c34ae..43018f3a1 100644
--- a/tests/tasinh.c
+++ b/tests/tasinh.c
@@ -26,69 +26,25 @@ MA 02111-1307, USA. */
#include <mpfr.h>
#define TEST_FUNCTION mpfr_asinh
+#include "tgeneric.c"
int
main (int argc, char *argv[])
{
- unsigned int prec, err, yprec, n, p0 = 1, p1 = 100, N = 100;
- mp_rnd_t rnd;
- mpfr_t x, y, z, t;
+ mpfr_t x, y;
mpfr_init (x);
mpfr_init (y);
- mpfr_init (z);
- mpfr_init (t);
mpfr_set_prec (x, 33);
mpfr_set_prec (y, 43);
mpfr_set_str_raw (x, "0.111001101100000110011001010000101");
mpfr_asinh (y, x, GMP_RNDZ);
- for (prec = p0; prec <= p1; prec++)
- {
- mpfr_set_prec (x, prec);
- mpfr_set_prec (z, prec);
- mpfr_set_prec (t, prec);
- yprec = prec + 10;
-
- for (n=0; n<N; n++)
- {
- mpfr_random (x);
- if (random() % 2)
- mpfr_neg (x, x, GMP_RNDN);
- rnd = random () % 4;
- mpfr_set_prec (y, yprec);
- TEST_FUNCTION (y, x, rnd);
- err = (rnd == GMP_RNDN) ? yprec + 1 : yprec;
- if (mpfr_can_round (y, err, rnd, rnd, prec))
- {
- mpfr_set (t, y, rnd);
- TEST_FUNCTION (z, x, rnd);
- if (mpfr_cmp (t, z))
- {
- printf ("results differ for x=");
- mpfr_out_str (stdout, 2, prec, x, GMP_RNDN);
- printf (" prec=%u rnd_mode=%s\n", prec,
- mpfr_print_rnd_mode (rnd));
- printf (" got ");
- mpfr_out_str (stdout, 2, prec, z, GMP_RNDN);
- putchar ('\n');
- printf (" expected ");
- mpfr_out_str (stdout, 2, prec, t, GMP_RNDN);
- putchar ('\n');
- printf (" approximation was ");
- mpfr_print_raw (y);
- putchar ('\n');
- exit (1);
- }
- }
- }
- }
+ test_generic (1, 100, 25);
mpfr_clear (x);
mpfr_clear (y);
- mpfr_clear (z);
- mpfr_clear (t);
return 0;
}