Average Error: 58.7 → 0.3
Time: 9.4s
Precision: 64
\[\frac{1}{2} \cdot \log \left(\frac{1 + x}{1 - x}\right)\]
\[\frac{1}{2} \cdot \mathsf{fma}\left(2, x, \mathsf{fma}\left(0.66666666666666652, {x}^{3}, 2 \cdot \log 1\right)\right)\]
\frac{1}{2} \cdot \log \left(\frac{1 + x}{1 - x}\right)
\frac{1}{2} \cdot \mathsf{fma}\left(2, x, \mathsf{fma}\left(0.66666666666666652, {x}^{3}, 2 \cdot \log 1\right)\right)
double f(double x) {
        double r62362 = 1.0;
        double r62363 = 2.0;
        double r62364 = r62362 / r62363;
        double r62365 = x;
        double r62366 = r62362 + r62365;
        double r62367 = r62362 - r62365;
        double r62368 = r62366 / r62367;
        double r62369 = log(r62368);
        double r62370 = r62364 * r62369;
        return r62370;
}

double f(double x) {
        double r62371 = 1.0;
        double r62372 = 2.0;
        double r62373 = r62371 / r62372;
        double r62374 = x;
        double r62375 = 0.6666666666666665;
        double r62376 = 3.0;
        double r62377 = pow(r62374, r62376);
        double r62378 = 2.0;
        double r62379 = log(r62371);
        double r62380 = r62378 * r62379;
        double r62381 = fma(r62375, r62377, r62380);
        double r62382 = fma(r62372, r62374, r62381);
        double r62383 = r62373 * r62382;
        return r62383;
}

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(\log \left(\frac{1 + x}{{1}^{3} - {x}^{3}}\right) + \color{blue}{\log \left(\mathsf{fma}\left(1, 1, x \cdot \left(1 + x\right)\right)\right)}\right)\]
  7. Taylor expanded around 0 0.3

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

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

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

    \[\leadsto \frac{1}{2} \cdot \color{blue}{\mathsf{fma}\left(2, x, \mathsf{fma}\left(0.66666666666666652, {x}^{3}, 2 \cdot \log 1\right)\right)}\]
  11. Final simplification0.3

    \[\leadsto \frac{1}{2} \cdot \mathsf{fma}\left(2, x, \mathsf{fma}\left(0.66666666666666652, {x}^{3}, 2 \cdot \log 1\right)\right)\]

Reproduce

herbie shell --seed 2020043 +o rules:numerics
(FPCore (x)
  :name "Hyperbolic arc-(co)tangent"
  :precision binary64
  (* (/ 1 2) (log (/ (+ 1 x) (- 1 x)))))