Average Error: 58.5 → 0.7
Time: 6.4s
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 r73687 = 1.0;
        double r73688 = 2.0;
        double r73689 = r73687 / r73688;
        double r73690 = x;
        double r73691 = r73687 + r73690;
        double r73692 = r73687 - r73690;
        double r73693 = r73691 / r73692;
        double r73694 = log(r73693);
        double r73695 = r73689 * r73694;
        return r73695;
}

double f(double x) {
        double r73696 = 1.0;
        double r73697 = 2.0;
        double r73698 = r73696 / r73697;
        double r73699 = x;
        double r73700 = 2.0;
        double r73701 = pow(r73699, r73700);
        double r73702 = r73701 + r73699;
        double r73703 = r73697 * r73702;
        double r73704 = log(r73696);
        double r73705 = pow(r73696, r73700);
        double r73706 = r73701 / r73705;
        double r73707 = r73697 * r73706;
        double r73708 = r73704 - r73707;
        double r73709 = r73703 + r73708;
        double r73710 = r73698 * r73709;
        return r73710;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 58.5

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

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

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

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