Average Error: 58.5 → 0.3
Time: 18.5s
Precision: 64
\[\frac{1}{2} \cdot \log \left(\frac{1 + x}{1 - x}\right)\]
\[\frac{1}{2} \cdot \mathsf{fma}\left(2, \frac{x \cdot x}{1 \cdot 1}, \mathsf{fma}\left(\frac{2.666666666666666518636930049979127943516}{1}, \frac{\left(x \cdot x\right) \cdot x}{1 \cdot 1}, 2 \cdot x - 2 \cdot \left(\frac{\left(x \cdot x\right) \cdot x}{1 \cdot 1} + x \cdot x\right)\right)\right)\]
\frac{1}{2} \cdot \log \left(\frac{1 + x}{1 - x}\right)
\frac{1}{2} \cdot \mathsf{fma}\left(2, \frac{x \cdot x}{1 \cdot 1}, \mathsf{fma}\left(\frac{2.666666666666666518636930049979127943516}{1}, \frac{\left(x \cdot x\right) \cdot x}{1 \cdot 1}, 2 \cdot x - 2 \cdot \left(\frac{\left(x \cdot x\right) \cdot x}{1 \cdot 1} + x \cdot x\right)\right)\right)
double f(double x) {
        double r6453783 = 1.0;
        double r6453784 = 2.0;
        double r6453785 = r6453783 / r6453784;
        double r6453786 = x;
        double r6453787 = r6453783 + r6453786;
        double r6453788 = r6453783 - r6453786;
        double r6453789 = r6453787 / r6453788;
        double r6453790 = log(r6453789);
        double r6453791 = r6453785 * r6453790;
        return r6453791;
}

double f(double x) {
        double r6453792 = 1.0;
        double r6453793 = 2.0;
        double r6453794 = r6453792 / r6453793;
        double r6453795 = x;
        double r6453796 = r6453795 * r6453795;
        double r6453797 = r6453792 * r6453792;
        double r6453798 = r6453796 / r6453797;
        double r6453799 = 2.6666666666666665;
        double r6453800 = r6453799 / r6453792;
        double r6453801 = r6453796 * r6453795;
        double r6453802 = r6453801 / r6453797;
        double r6453803 = r6453793 * r6453795;
        double r6453804 = r6453802 + r6453796;
        double r6453805 = r6453793 * r6453804;
        double r6453806 = r6453803 - r6453805;
        double r6453807 = fma(r6453800, r6453802, r6453806);
        double r6453808 = fma(r6453793, r6453798, r6453807);
        double r6453809 = r6453794 * r6453808;
        return r6453809;
}

Error

Bits error versus x

Derivation

  1. Initial program 58.5

    \[\frac{1}{2} \cdot \log \left(\frac{1 + x}{1 - x}\right)\]
  2. Using strategy rm
  3. Applied flip-+58.6

    \[\leadsto \frac{1}{2} \cdot \log \left(\frac{\color{blue}{\frac{1 \cdot 1 - x \cdot x}{1 - x}}}{1 - x}\right)\]
  4. Applied associate-/l/58.5

    \[\leadsto \frac{1}{2} \cdot \log \color{blue}{\left(\frac{1 \cdot 1 - x \cdot x}{\left(1 - x\right) \cdot \left(1 - x\right)}\right)}\]
  5. Using strategy rm
  6. Applied log-div58.5

    \[\leadsto \frac{1}{2} \cdot \color{blue}{\left(\log \left(1 \cdot 1 - x \cdot x\right) - \log \left(\left(1 - x\right) \cdot \left(1 - x\right)\right)\right)}\]
  7. Taylor expanded around 0 0.3

    \[\leadsto \frac{1}{2} \cdot \color{blue}{\left(\left(2 \cdot \frac{{x}^{2}}{{1}^{2}} + \left(2.666666666666666518636930049979127943516 \cdot \frac{{x}^{3}}{{1}^{3}} + 2 \cdot x\right)\right) - \left(2 \cdot \frac{{x}^{3}}{{1}^{2}} + 2 \cdot {x}^{2}\right)\right)}\]
  8. Simplified0.3

    \[\leadsto \frac{1}{2} \cdot \color{blue}{\mathsf{fma}\left(2, \frac{x \cdot x}{1 \cdot 1}, \mathsf{fma}\left(\frac{2.666666666666666518636930049979127943516}{1}, \frac{\left(x \cdot x\right) \cdot x}{1 \cdot 1}, 2 \cdot x - 2 \cdot \left(\frac{\left(x \cdot x\right) \cdot x}{1 \cdot 1} + x \cdot x\right)\right)\right)}\]
  9. Final simplification0.3

    \[\leadsto \frac{1}{2} \cdot \mathsf{fma}\left(2, \frac{x \cdot x}{1 \cdot 1}, \mathsf{fma}\left(\frac{2.666666666666666518636930049979127943516}{1}, \frac{\left(x \cdot x\right) \cdot x}{1 \cdot 1}, 2 \cdot x - 2 \cdot \left(\frac{\left(x \cdot x\right) \cdot x}{1 \cdot 1} + x \cdot x\right)\right)\right)\]

Reproduce

herbie shell --seed 2019173 +o rules:numerics
(FPCore (x)
  :name "Hyperbolic arc-(co)tangent"
  (* (/ 1.0 2.0) (log (/ (+ 1.0 x) (- 1.0 x)))))