Average Error: 58.7 → 0.6
Time: 6.9s
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 r56480 = 1.0;
        double r56481 = 2.0;
        double r56482 = r56480 / r56481;
        double r56483 = x;
        double r56484 = r56480 + r56483;
        double r56485 = r56480 - r56483;
        double r56486 = r56484 / r56485;
        double r56487 = log(r56486);
        double r56488 = r56482 * r56487;
        return r56488;
}

double f(double x) {
        double r56489 = 1.0;
        double r56490 = 2.0;
        double r56491 = r56489 / r56490;
        double r56492 = x;
        double r56493 = 2.0;
        double r56494 = pow(r56492, r56493);
        double r56495 = r56494 + r56492;
        double r56496 = r56490 * r56495;
        double r56497 = log(r56489);
        double r56498 = pow(r56489, r56493);
        double r56499 = r56494 / r56498;
        double r56500 = r56490 * r56499;
        double r56501 = r56497 - r56500;
        double r56502 = r56496 + r56501;
        double r56503 = r56491 * r56502;
        return r56503;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 58.7

    \[\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 2020060 
(FPCore (x)
  :name "Hyperbolic arc-(co)tangent"
  :precision binary64
  (* (/ 1 2) (log (/ (+ 1 x) (- 1 x)))))