TITLE: Why does $\text{arctanh}(2^{-k})$ approach powers of $2$?
QUESTION [5 upvotes]: This is from a piece of verilog code I generated for $\text{arctanh}(2^{-k})$:
localparam bit [31:0][47:0] arctanhTable = {
        48'b100011001001111101010011110101010110100000011000,
        48'b010000010110001010111011111010100000010001010001,
        48'b001000000010101100010010001110010011110101011101,
        48'b000100000000010101011000100010101101001101110101,
        48'b000010000000000010101010110001000100100011010111,
        48'b000001000000000000010101010101100010001000101011,
        48'b000000100000000000000010101010101011000100010001,
        48'b000000010000000000000000010101010101010110001000,
        48'b000000001000000000000000000010101010101010101100,
        48'b000000000100000000000000000000010101010101010101,
        48'b000000000010000000000000000000000010101010101010,
        48'b000000000001000000000000000000000000010101010101,
        48'b000000000000100000000000000000000000000010101010,
        48'b000000000000010000000000000000000000000000010101,
        48'b000000000000001000000000000000000000000000000010,
        48'b000000000000000100000000000000000000000000000000,
        48'b000000000000000010000000000000000000000000000000,
        48'b000000000000000001000000000000000000000000000000,
        48'b000000000000000000100000000000000000000000000000,
        48'b000000000000000000010000000000000000000000000000,
        48'b000000000000000000001000000000000000000000000000,
        48'b000000000000000000000100000000000000000000000000,
        48'b000000000000000000000010000000000000000000000000,
        48'b000000000000000000000001000000000000000000000000,
        48'b000000000000000000000000100000000000000000000000,
        48'b000000000000000000000000010000000000000000000000,
        48'b000000000000000000000000001000000000000000000000,
        48'b000000000000000000000000000100000000000000000000,
        48'b000000000000000000000000000010000000000000000000,
        48'b000000000000000000000000000001000000000000000000,
        48'b000000000000000000000000000000100000000000000000
    };

The $\text{arctanh}(2^{-k})$ values start converging to successive powers of $2$.  It's apparent that the number of zeroes between the first $1$ and the second $1$ keeps increasing, so the form $\text{arctanh}(2^{-k}) = 2^{-1} + q(k)$ for values of $q(k)$ decreasing much more quickly than values of $2^{-k}$.  Wolfram Alpha tells me $q(k) = -2^{-k} - \dfrac{\ln(1-2^{-k}) + \ln(1+2^{-k})}{2}$
Why does this divergence happen?  I don't think I can leverage this to cheaply calculate $\text{arctanh}$, although it does give me an interesting way to compress the table by storing a floating-point $q(k)$, not that that's actually useful either.

REPLY [8 votes]: We know that
$$ \DeclareMathOperator{\arctanh}{artanh}
   \arctanh(x) = \frac12\left(\log(1 + x) - \log(1 - x)\right). \tag1$$
The Taylor series for $\log(1+x)$ centered at $x=0$ is
$$ \log(1 + x) = x - \frac12 x^2 + r_1(x) $$
where $r_1(x)$ is $\mathcal O(x^3)$ as $x \to 0$.
Similarly, the Taylor series for $\log(1 - x)$ centered at $x=0$ is
$$ \log(1 - x) = -x - \frac12 x^2 - r_2(x) $$
where $r_2(x)$ is $\mathcal O(x^3)$ as $x \to 0$.
Substituting these two Taylor series into Equation $(1)$ gives
\begin{align}
 \arctanh(x)
&= \frac12\left(\left(x - \frac12 x^2 + r_1(x)\right)
                 - \left(-x - \frac12 x^2 + r_2(x)\right)\right) \\
&= x + r_1(x) + r_2(x) \\
&\subseteq x + \mathcal O(x^3), \quad x \to 0. \\
\end{align}
Let $x = 2^{-k}$ for a positive integer $k$ and you have
$$ \arctanh(2^{-k}) \subseteq 2^{-k} + \mathcal O(2^{-3k}), \quad k \to \infty. $$
In other words, $q(k)$ is a function of order $2^{-3k}.$
So its first non-zero digit is about three times as many places to the right as the $1$ digit of $2^{-k}$, leaving about $2k$ zeros between the digits.
For example, consider the following two rows of your table.
        48'b000000000100000000000000000000010101010101010101,
        48'b000000000010000000000000000000000010101010101010,

The first of these two rows has nine zeros followed by a $1$,
which is the $2^{-k}$ digit of $\arctanh(2^{-k})$,
then we have $21$ zeros followed by some non-zero digits;
if this is the row for $k = 10$ then indeed we have about $2k$ zeros
($2k+1$ to be exact) between the non-zero digits.
In the next row the $2^{-k}$ digit has moved one place to the right,
but the rest of the digits have moved three places, adding two zeros to the gap between non-zero digits.
And we will just keep on adding two more zeros on every row,
which is a simple consequence of the fact that $q(k)$ is of order
$2^{-3k},$ or in other words, when $k$ is large,
$q(k)$ is approximately $\lambda 2^{-3k}$ for some constant $\lambda$.