Average Error: 58.6 → 0.7
Time: 5.7s
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 r84705 = 1.0;
        double r84706 = 2.0;
        double r84707 = r84705 / r84706;
        double r84708 = x;
        double r84709 = r84705 + r84708;
        double r84710 = r84705 - r84708;
        double r84711 = r84709 / r84710;
        double r84712 = log(r84711);
        double r84713 = r84707 * r84712;
        return r84713;
}

double f(double x) {
        double r84714 = 1.0;
        double r84715 = 2.0;
        double r84716 = r84714 / r84715;
        double r84717 = x;
        double r84718 = 2.0;
        double r84719 = pow(r84717, r84718);
        double r84720 = r84719 + r84717;
        double r84721 = r84715 * r84720;
        double r84722 = log(r84714);
        double r84723 = pow(r84714, r84718);
        double r84724 = r84719 / r84723;
        double r84725 = r84715 * r84724;
        double r84726 = r84722 - r84725;
        double r84727 = r84721 + r84726;
        double r84728 = r84716 * r84727;
        return r84728;
}

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