Average Error: 58.6 → 0.6
Time: 6.6s
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 r52828 = 1.0;
        double r52829 = 2.0;
        double r52830 = r52828 / r52829;
        double r52831 = x;
        double r52832 = r52828 + r52831;
        double r52833 = r52828 - r52831;
        double r52834 = r52832 / r52833;
        double r52835 = log(r52834);
        double r52836 = r52830 * r52835;
        return r52836;
}

double f(double x) {
        double r52837 = 1.0;
        double r52838 = 2.0;
        double r52839 = r52837 / r52838;
        double r52840 = x;
        double r52841 = 2.0;
        double r52842 = pow(r52840, r52841);
        double r52843 = r52842 + r52840;
        double r52844 = r52838 * r52843;
        double r52845 = log(r52837);
        double r52846 = pow(r52837, r52841);
        double r52847 = r52842 / r52846;
        double r52848 = r52838 * r52847;
        double r52849 = r52845 - r52848;
        double r52850 = r52844 + r52849;
        double r52851 = r52839 * r52850;
        return r52851;
}

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