Average Error: 58.6 → 0.6
Time: 12.9s
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 r91499 = 1.0;
        double r91500 = 2.0;
        double r91501 = r91499 / r91500;
        double r91502 = x;
        double r91503 = r91499 + r91502;
        double r91504 = r91499 - r91502;
        double r91505 = r91503 / r91504;
        double r91506 = log(r91505);
        double r91507 = r91501 * r91506;
        return r91507;
}

double f(double x) {
        double r91508 = 1.0;
        double r91509 = 2.0;
        double r91510 = r91508 / r91509;
        double r91511 = x;
        double r91512 = r91511 * r91511;
        double r91513 = r91512 + r91511;
        double r91514 = r91509 * r91513;
        double r91515 = log(r91508);
        double r91516 = 2.0;
        double r91517 = pow(r91511, r91516);
        double r91518 = pow(r91508, r91516);
        double r91519 = r91517 / r91518;
        double r91520 = r91509 * r91519;
        double r91521 = r91515 - r91520;
        double r91522 = r91514 + r91521;
        double r91523 = r91510 * r91522;
        return r91523;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 58.6

    \[\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 \cdot x + 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 \cdot x + x\right) + \left(\log 1 - 2 \cdot \frac{{x}^{2}}{{1}^{2}}\right)\right)\]

Reproduce

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