Average Error: 58.7 → 0.6
Time: 6.3s
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 r53750 = 1.0;
        double r53751 = 2.0;
        double r53752 = r53750 / r53751;
        double r53753 = x;
        double r53754 = r53750 + r53753;
        double r53755 = r53750 - r53753;
        double r53756 = r53754 / r53755;
        double r53757 = log(r53756);
        double r53758 = r53752 * r53757;
        return r53758;
}

double f(double x) {
        double r53759 = 1.0;
        double r53760 = 2.0;
        double r53761 = r53759 / r53760;
        double r53762 = x;
        double r53763 = 2.0;
        double r53764 = pow(r53762, r53763);
        double r53765 = r53764 + r53762;
        double r53766 = r53760 * r53765;
        double r53767 = log(r53759);
        double r53768 = pow(r53759, r53763);
        double r53769 = r53764 / r53768;
        double r53770 = r53760 * r53769;
        double r53771 = r53767 - r53770;
        double r53772 = r53766 + r53771;
        double r53773 = r53761 * r53772;
        return r53773;
}

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)))))