Average Error: 58.8 → 0.6
Time: 17.9s
Precision: 64
\[\frac{1}{2} \cdot \log \left(\frac{1 + x}{1 - x}\right)\]
\[\frac{1}{2} \cdot \left(\log 1 + 2 \cdot \left(\left(x + {x}^{2}\right) - \frac{{x}^{2}}{{1}^{2}}\right)\right)\]
\frac{1}{2} \cdot \log \left(\frac{1 + x}{1 - x}\right)
\frac{1}{2} \cdot \left(\log 1 + 2 \cdot \left(\left(x + {x}^{2}\right) - \frac{{x}^{2}}{{1}^{2}}\right)\right)
double f(double x) {
        double r88768 = 1.0;
        double r88769 = 2.0;
        double r88770 = r88768 / r88769;
        double r88771 = x;
        double r88772 = r88768 + r88771;
        double r88773 = r88768 - r88771;
        double r88774 = r88772 / r88773;
        double r88775 = log(r88774);
        double r88776 = r88770 * r88775;
        return r88776;
}

double f(double x) {
        double r88777 = 1.0;
        double r88778 = 2.0;
        double r88779 = r88777 / r88778;
        double r88780 = log(r88777);
        double r88781 = x;
        double r88782 = 2.0;
        double r88783 = pow(r88781, r88782);
        double r88784 = r88781 + r88783;
        double r88785 = pow(r88777, r88782);
        double r88786 = r88783 / r88785;
        double r88787 = r88784 - r88786;
        double r88788 = r88778 * r88787;
        double r88789 = r88780 + r88788;
        double r88790 = r88779 * r88789;
        return r88790;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 58.8

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

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

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

Reproduce

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