Average Error: 58.9 → 0.5
Time: 23.2s
Precision: 64
\[\frac{1}{2} \cdot \log \left(\frac{1 + x}{1 - x}\right)\]
\[\frac{1}{2} \cdot \left(2 \cdot \left(x \cdot x + 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 \cdot x + x\right) + \left(\log 1 - 2 \cdot \frac{{x}^{2}}{{1}^{2}}\right)\right)
double f(double x) {
        double r79470 = 1.0;
        double r79471 = 2.0;
        double r79472 = r79470 / r79471;
        double r79473 = x;
        double r79474 = r79470 + r79473;
        double r79475 = r79470 - r79473;
        double r79476 = r79474 / r79475;
        double r79477 = log(r79476);
        double r79478 = r79472 * r79477;
        return r79478;
}

double f(double x) {
        double r79479 = 1.0;
        double r79480 = 2.0;
        double r79481 = r79479 / r79480;
        double r79482 = x;
        double r79483 = r79482 * r79482;
        double r79484 = r79483 + r79482;
        double r79485 = r79480 * r79484;
        double r79486 = log(r79479);
        double r79487 = 2.0;
        double r79488 = pow(r79482, r79487);
        double r79489 = pow(r79479, r79487);
        double r79490 = r79488 / r79489;
        double r79491 = r79480 * r79490;
        double r79492 = r79486 - r79491;
        double r79493 = r79485 + r79492;
        double r79494 = r79481 * r79493;
        return r79494;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 58.9

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

    \[\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.5

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

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

Reproduce

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