Average Error: 58.5 → 0.6
Time: 5.7s
Precision: 64
\[\frac{1}{2} \cdot \log \left(\frac{1 + x}{1 - x}\right)\]
\[\frac{1}{2} \cdot \left(2 \cdot \left({x}^{2} + x\right) + \left(\log 1 - 2 \cdot \frac{{x}^{2}}{{1}^{2}}\right)\right)\]
\frac{1}{2} \cdot \log \left(\frac{1 + x}{1 - x}\right)
\frac{1}{2} \cdot \left(2 \cdot \left({x}^{2} + x\right) + \left(\log 1 - 2 \cdot \frac{{x}^{2}}{{1}^{2}}\right)\right)
double f(double x) {
        double r67456 = 1.0;
        double r67457 = 2.0;
        double r67458 = r67456 / r67457;
        double r67459 = x;
        double r67460 = r67456 + r67459;
        double r67461 = r67456 - r67459;
        double r67462 = r67460 / r67461;
        double r67463 = log(r67462);
        double r67464 = r67458 * r67463;
        return r67464;
}

double f(double x) {
        double r67465 = 1.0;
        double r67466 = 2.0;
        double r67467 = r67465 / r67466;
        double r67468 = x;
        double r67469 = 2.0;
        double r67470 = pow(r67468, r67469);
        double r67471 = r67470 + r67468;
        double r67472 = r67466 * r67471;
        double r67473 = log(r67465);
        double r67474 = pow(r67465, r67469);
        double r67475 = r67470 / r67474;
        double r67476 = r67466 * r67475;
        double r67477 = r67473 - r67476;
        double r67478 = r67472 + r67477;
        double r67479 = r67467 * r67478;
        return r67479;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 58.5

    \[\frac{1}{2} \cdot \log \left(\frac{1 + x}{1 - x}\right)\]
  2. Taylor expanded around 0 0.6

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

    \[\leadsto \frac{1}{2} \cdot \color{blue}{\left(2 \cdot \left({x}^{2} + x\right) + \left(\log 1 - 2 \cdot \frac{{x}^{2}}{{1}^{2}}\right)\right)}\]
  4. Final simplification0.6

    \[\leadsto \frac{1}{2} \cdot \left(2 \cdot \left({x}^{2} + x\right) + \left(\log 1 - 2 \cdot \frac{{x}^{2}}{{1}^{2}}\right)\right)\]

Reproduce

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