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 r73621 = 1.0;
        double r73622 = 2.0;
        double r73623 = r73621 / r73622;
        double r73624 = x;
        double r73625 = r73621 + r73624;
        double r73626 = r73621 - r73624;
        double r73627 = r73625 / r73626;
        double r73628 = log(r73627);
        double r73629 = r73623 * r73628;
        return r73629;
}

double f(double x) {
        double r73630 = 1.0;
        double r73631 = 2.0;
        double r73632 = r73630 / r73631;
        double r73633 = x;
        double r73634 = 2.0;
        double r73635 = pow(r73633, r73634);
        double r73636 = r73635 + r73633;
        double r73637 = r73631 * r73636;
        double r73638 = log(r73630);
        double r73639 = pow(r73630, r73634);
        double r73640 = r73635 / r73639;
        double r73641 = r73631 * r73640;
        double r73642 = r73638 - r73641;
        double r73643 = r73637 + r73642;
        double r73644 = r73632 * r73643;
        return r73644;
}

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