Average Error: 58.5 → 0.3
Time: 14.3s
Precision: 64
\[\frac{1}{2} \cdot \log \left(\frac{1 + x}{1 - x}\right)\]
\[\frac{\mathsf{fma}\left(\log 1, 2, \mathsf{fma}\left(x, 2, 0.6666666666666665186369300499791279435158 \cdot {x}^{3}\right)\right)}{\frac{2}{1}}\]
\frac{1}{2} \cdot \log \left(\frac{1 + x}{1 - x}\right)
\frac{\mathsf{fma}\left(\log 1, 2, \mathsf{fma}\left(x, 2, 0.6666666666666665186369300499791279435158 \cdot {x}^{3}\right)\right)}{\frac{2}{1}}
double f(double x) {
        double r100385 = 1.0;
        double r100386 = 2.0;
        double r100387 = r100385 / r100386;
        double r100388 = x;
        double r100389 = r100385 + r100388;
        double r100390 = r100385 - r100388;
        double r100391 = r100389 / r100390;
        double r100392 = log(r100391);
        double r100393 = r100387 * r100392;
        return r100393;
}

double f(double x) {
        double r100394 = 1.0;
        double r100395 = log(r100394);
        double r100396 = 2.0;
        double r100397 = x;
        double r100398 = 2.0;
        double r100399 = 0.6666666666666665;
        double r100400 = 3.0;
        double r100401 = pow(r100397, r100400);
        double r100402 = r100399 * r100401;
        double r100403 = fma(r100397, r100398, r100402);
        double r100404 = fma(r100395, r100396, r100403);
        double r100405 = r100398 / r100394;
        double r100406 = r100404 / r100405;
        return r100406;
}

Error

Bits error versus x

Derivation

  1. Initial program 58.5

    \[\frac{1}{2} \cdot \log \left(\frac{1 + x}{1 - x}\right)\]
  2. Simplified58.5

    \[\leadsto \color{blue}{\frac{\log \left(\frac{x + 1}{1 - x}\right)}{\frac{2}{1}}}\]
  3. Using strategy rm
  4. Applied flip3--58.5

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

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

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

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

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

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

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

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

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

Reproduce

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