summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TODO1
-rw-r--r--src/atanh.c4
2 files changed, 5 insertions, 0 deletions
diff --git a/TODO b/TODO
index 1701fc765..51b134592 100644
--- a/TODO
+++ b/TODO
@@ -300,6 +300,7 @@ Table of contents:
Also mpfr_div uses the remainder computed by mpn_divrem. A workaround would
be to first try with mpn_div_q, and if we cannot (easily) compute the
rounding, then use the current code with mpn_divrem.
+- improve atanh(x) for small x by using atanh(x) = log1p(2x/(1-x)).
- compute exp by using the series for cosh or sinh, which has half the terms
(see Exercise 4.11 from Modern Computer Arithmetic, version 0.3)
The same method can be used for log, using the series for atanh, i.e.,
diff --git a/src/atanh.c b/src/atanh.c
index 298cb61e3..7b10c5abc 100644
--- a/src/atanh.c
+++ b/src/atanh.c
@@ -25,6 +25,10 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
/* The computation of atanh is done by:
atanh = ln((1+x)/(1-x)) / 2
+ except when x is very small, in which case atanh = x + tiny error.
+ TODO: When x is small (but x + tiny error cannot be used), the above
+ formula is slow due to the large error as (1+x)/(1-x) is close to 1;
+ one should use: log1p(2x/(1-x)).
*/
int