Average Error: 58.7 → 0.3
Time: 19.1s
Precision: 64
\[\frac{1}{2} \cdot \log \left(\frac{1 + x}{1 - x}\right)\]
\[\frac{1}{2} \cdot \left(\mathsf{fma}\left(x \cdot \left(x \cdot x\right), 1.666666666666666518636930049979127943516, \mathsf{fma}\left(x, 2, \log 1 + \log 1\right)\right) - \frac{\left(x \cdot \left(x \cdot x\right)\right) \cdot 1}{1 \cdot 1}\right)\]
\frac{1}{2} \cdot \log \left(\frac{1 + x}{1 - x}\right)
\frac{1}{2} \cdot \left(\mathsf{fma}\left(x \cdot \left(x \cdot x\right), 1.666666666666666518636930049979127943516, \mathsf{fma}\left(x, 2, \log 1 + \log 1\right)\right) - \frac{\left(x \cdot \left(x \cdot x\right)\right) \cdot 1}{1 \cdot 1}\right)
double f(double x) {
        double r1868534 = 1.0;
        double r1868535 = 2.0;
        double r1868536 = r1868534 / r1868535;
        double r1868537 = x;
        double r1868538 = r1868534 + r1868537;
        double r1868539 = r1868534 - r1868537;
        double r1868540 = r1868538 / r1868539;
        double r1868541 = log(r1868540);
        double r1868542 = r1868536 * r1868541;
        return r1868542;
}

double f(double x) {
        double r1868543 = 1.0;
        double r1868544 = 2.0;
        double r1868545 = r1868543 / r1868544;
        double r1868546 = x;
        double r1868547 = r1868546 * r1868546;
        double r1868548 = r1868546 * r1868547;
        double r1868549 = 1.6666666666666665;
        double r1868550 = log(r1868543);
        double r1868551 = r1868550 + r1868550;
        double r1868552 = fma(r1868546, r1868544, r1868551);
        double r1868553 = fma(r1868548, r1868549, r1868552);
        double r1868554 = r1868548 * r1868543;
        double r1868555 = r1868543 * r1868543;
        double r1868556 = r1868554 / r1868555;
        double r1868557 = r1868553 - r1868556;
        double r1868558 = r1868545 * r1868557;
        return r1868558;
}

Error

Bits error versus x

Derivation

  1. Initial program 58.7

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

    \[\leadsto \frac{1}{2} \cdot \log \left(\frac{1 + x}{\color{blue}{\frac{{1}^{3} - {x}^{3}}{1 \cdot 1 + \left(x \cdot x + 1 \cdot x\right)}}}\right)\]
  4. Applied associate-/r/58.7

    \[\leadsto \frac{1}{2} \cdot \log \color{blue}{\left(\frac{1 + x}{{1}^{3} - {x}^{3}} \cdot \left(1 \cdot 1 + \left(x \cdot x + 1 \cdot x\right)\right)\right)}\]
  5. Applied log-prod58.7

    \[\leadsto \frac{1}{2} \cdot \color{blue}{\left(\log \left(\frac{1 + x}{{1}^{3} - {x}^{3}}\right) + \log \left(1 \cdot 1 + \left(x \cdot x + 1 \cdot x\right)\right)\right)}\]
  6. Simplified58.7

    \[\leadsto \frac{1}{2} \cdot \left(\color{blue}{\log \left(\frac{x + 1}{\left(1 \cdot 1\right) \cdot 1 - \left(x \cdot x\right) \cdot x}\right)} + \log \left(1 \cdot 1 + \left(x \cdot x + 1 \cdot x\right)\right)\right)\]
  7. Simplified58.7

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

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

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

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

Reproduce

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