Average Error: 58.5 → 0.3
Time: 16.1s
Precision: 64
\[\frac{1}{2} \cdot \log \left(\frac{1 + x}{1 - x}\right)\]
\[\frac{1}{2} \cdot \left(\mathsf{fma}\left({\left(\frac{x}{1}\right)}^{3}, 2.666666666666666518636930049979127943516, 2 \cdot \left(\left({x}^{3} + \mathsf{fma}\left(\frac{x}{1}, \frac{x}{1}, x\right)\right) - x \cdot x\right)\right) - 4 \cdot \frac{{x}^{3}}{{1}^{2}}\right)\]
\frac{1}{2} \cdot \log \left(\frac{1 + x}{1 - x}\right)
\frac{1}{2} \cdot \left(\mathsf{fma}\left({\left(\frac{x}{1}\right)}^{3}, 2.666666666666666518636930049979127943516, 2 \cdot \left(\left({x}^{3} + \mathsf{fma}\left(\frac{x}{1}, \frac{x}{1}, x\right)\right) - x \cdot x\right)\right) - 4 \cdot \frac{{x}^{3}}{{1}^{2}}\right)
double f(double x) {
        double r51302 = 1.0;
        double r51303 = 2.0;
        double r51304 = r51302 / r51303;
        double r51305 = x;
        double r51306 = r51302 + r51305;
        double r51307 = r51302 - r51305;
        double r51308 = r51306 / r51307;
        double r51309 = log(r51308);
        double r51310 = r51304 * r51309;
        return r51310;
}

double f(double x) {
        double r51311 = 1.0;
        double r51312 = 2.0;
        double r51313 = r51311 / r51312;
        double r51314 = x;
        double r51315 = r51314 / r51311;
        double r51316 = 3.0;
        double r51317 = pow(r51315, r51316);
        double r51318 = 2.6666666666666665;
        double r51319 = pow(r51314, r51316);
        double r51320 = fma(r51315, r51315, r51314);
        double r51321 = r51319 + r51320;
        double r51322 = r51314 * r51314;
        double r51323 = r51321 - r51322;
        double r51324 = r51312 * r51323;
        double r51325 = fma(r51317, r51318, r51324);
        double r51326 = 4.0;
        double r51327 = 2.0;
        double r51328 = pow(r51311, r51327);
        double r51329 = r51319 / r51328;
        double r51330 = r51326 * r51329;
        double r51331 = r51325 - r51330;
        double r51332 = r51313 * r51331;
        return r51332;
}

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 div-inv58.5

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

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

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

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

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

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

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

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

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

Reproduce

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