summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2016-06-03 13:55:12 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2016-06-03 13:55:12 +0000
commitd993492fda1077050b36937e9e2dd73172f38e62 (patch)
tree30efea5710ad580dbf5bf9f28ae65f693aec7620
parent7309f2c16032efafedaaa22dbf2b6a0a396d0876 (diff)
parentf6dbed4cf4440e04021c89f0ffa1a01a031ed6aa (diff)
downloadmpfr-d993492fda1077050b36937e9e2dd73172f38e62.tar.gz
Merged the latest changes from the trunk (C++ compatibility).
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/branches/ubf@10425 280ebfd0-de03-0410-8827-d642c229c3f4
-rw-r--r--TODO7
-rw-r--r--tests/tlog.c2
-rw-r--r--tests/tset_float128.c42
3 files changed, 29 insertions, 22 deletions
diff --git a/TODO b/TODO
index 700cc5875..ce692f9f3 100644
--- a/TODO
+++ b/TODO
@@ -234,6 +234,13 @@ Table of contents:
+ Lambert W Functions, W(x) are defined to be solutions of the equation:
W(x) \exp(W(x)) = x.
This function has multiple branches for x < 0 (2 funcs W0(x) and Wm1(x))
+ From Fredrik Johansson:
+ See https://cs.uwaterloo.ca/research/tr/1993/03/W.pdf, in particular
+ formulas 5.2 and 5.3 for the error bound: one first computes an
+ approximation w, and then evaluates the residual w e^w - x. There is an
+ expression for the error in terms of the residual and the derivative W'(t),
+ where the derivative can be bounded by piecewise simple functions,
+ something like min(1, 1/t) when t >= 0.
+ Trigamma Function psi'(x).
and Polygamma Function: psi^{(m)}(x) for m >= 0, x > 0.
- functions from ISO/IEC 24747:2009 (Extensions to the C Library,
diff --git a/tests/tlog.c b/tests/tlog.c
index 21d2933c6..191b0876d 100644
--- a/tests/tlog.c
+++ b/tests/tlog.c
@@ -275,7 +275,7 @@ main (int argc, char *argv[])
if (argc == 3 || argc == 4)
{ /* tlog x prec rnd */
check3 (argv[1], strtoul (argv[2], NULL, 10),
- (argc == 4) ? atoi (argv[3]) : MPFR_RNDN);
+ (argc == 4) ? (mpfr_rnd_t) atoi (argv[3]) : MPFR_RNDN);
goto done;
}
diff --git a/tests/tset_float128.c b/tests/tset_float128.c
index 653563ca5..ad50bf820 100644
--- a/tests/tset_float128.c
+++ b/tests/tset_float128.c
@@ -125,7 +125,7 @@ check_large (void)
__float128 f, e;
int i;
mpfr_t x, y;
- mpfr_rnd_t r;
+ int r;
mpfr_init2 (x, 113);
mpfr_init2 (y, 113);
@@ -139,22 +139,22 @@ check_large (void)
mpfr_sub_ui (y, y, 1, MPFR_RNDN);
for (i = 113; i < 16384; i++)
{
- for (r = 0; r < MPFR_RND_MAX; r++)
+ RND_LOOP (r)
{
- mpfr_set_float128 (x, f, r);
+ mpfr_set_float128 (x, f, (mpfr_rnd_t) r);
if (! mpfr_equal_p (x, y))
{
printf ("mpfr_set_float128 failed for 2^%d*(1-2^(-113)) rnd=%s\n",
- i, mpfr_print_rnd_mode (r));
+ i, mpfr_print_rnd_mode ((mpfr_rnd_t) r));
printf ("got ");
mpfr_dump (x);
exit (1);
}
- e = mpfr_get_float128 (x, r);
+ e = mpfr_get_float128 (x, (mpfr_rnd_t) r);
if (e != f)
{
printf ("mpfr_get_float128 failed for 2^%d*(1-2^(-113)) rnd=%s\n",
- i, mpfr_print_rnd_mode (r));
+ i, mpfr_print_rnd_mode ((mpfr_rnd_t) r));
exit (1);
}
}
@@ -162,22 +162,22 @@ check_large (void)
/* check with opposite number */
f = -f;
mpfr_neg (y, y, MPFR_RNDN);
- for (r = 0; r < MPFR_RND_MAX; r++)
+ RND_LOOP (r)
{
- mpfr_set_float128 (x, f, r);
+ mpfr_set_float128 (x, f, (mpfr_rnd_t) r);
if (! mpfr_equal_p (x, y))
{
printf ("mpfr_set_float128 failed for -2^%d*(1-2^(-113)) rnd=%s\n",
- i, mpfr_print_rnd_mode (r));
+ i, mpfr_print_rnd_mode ((mpfr_rnd_t) r));
printf ("got ");
mpfr_dump (x);
exit (1);
}
- e = mpfr_get_float128 (x, r);
+ e = mpfr_get_float128 (x, (mpfr_rnd_t) r);
if (e != f)
{
printf ("mpfr_get_float128 failed for -2^%d*(1-2^(-113)) rnd=%s\n",
- i, mpfr_print_rnd_mode (r));
+ i, mpfr_print_rnd_mode ((mpfr_rnd_t) r));
exit (1);
}
}
@@ -198,7 +198,7 @@ check_small (void)
__float128 f, e;
int i;
mpfr_t x, y;
- mpfr_rnd_t r;
+ int r;
mpfr_init2 (x, 113);
mpfr_init2 (y, 113);
@@ -208,32 +208,32 @@ check_small (void)
mpfr_set_ui (y, 1, MPFR_RNDN);
for (i = 0; f != 0.0; i--)
{
- for (r = 0; r < MPFR_RND_MAX; r++)
+ RND_LOOP (r)
{
- mpfr_set_float128 (x, f, r);
+ mpfr_set_float128 (x, f, (mpfr_rnd_t) r);
if (! mpfr_equal_p (x, y))
{
printf ("mpfr_set_float128 failed for 2^%d rnd=%s\n", i,
- mpfr_print_rnd_mode (r));
+ mpfr_print_rnd_mode ((mpfr_rnd_t) r));
printf ("got ");
mpfr_dump (x);
exit (1);
}
- e = mpfr_get_float128 (x, r);
+ e = mpfr_get_float128 (x, (mpfr_rnd_t) r);
if (e != f)
{
printf ("mpfr_get_float128 failed for 2^%d rnd=%s\n",
- i, mpfr_print_rnd_mode (r));
+ i, mpfr_print_rnd_mode ((mpfr_rnd_t) r));
exit (1);
}
/* check with opposite number */
- mpfr_set_float128 (x, -f, r);
+ mpfr_set_float128 (x, -f, (mpfr_rnd_t) r);
mpfr_neg (y, y, MPFR_RNDN);
if (! mpfr_equal_p (x, y))
{
printf ("mpfr_set_float128 failed for -2^%d rnd=%s\n", i,
- mpfr_print_rnd_mode (r));
+ mpfr_print_rnd_mode ((mpfr_rnd_t) r));
printf ("got ");
mpfr_dump (x);
exit (1);
@@ -241,11 +241,11 @@ check_small (void)
if (e != f)
{
printf ("mpfr_get_float128 failed for -2^%d rnd=%s\n",
- i, mpfr_print_rnd_mode (r));
+ i, mpfr_print_rnd_mode ((mpfr_rnd_t) r));
exit (1);
}
- mpfr_neg (y, y, MPFR_RNDN);
+ mpfr_neg (y, y, MPFR_RNDN);
}
f = 0.5 * f;
mpfr_div_2exp (y, y, 1, MPFR_RNDN);