Average Error: 58.8 → 0.6
Time: 5.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 r72051 = 1.0;
        double r72052 = 2.0;
        double r72053 = r72051 / r72052;
        double r72054 = x;
        double r72055 = r72051 + r72054;
        double r72056 = r72051 - r72054;
        double r72057 = r72055 / r72056;
        double r72058 = log(r72057);
        double r72059 = r72053 * r72058;
        return r72059;
}

double f(double x) {
        double r72060 = 1.0;
        double r72061 = 2.0;
        double r72062 = r72060 / r72061;
        double r72063 = x;
        double r72064 = 2.0;
        double r72065 = pow(r72063, r72064);
        double r72066 = r72065 + r72063;
        double r72067 = r72061 * r72066;
        double r72068 = log(r72060);
        double r72069 = pow(r72060, r72064);
        double r72070 = r72065 / r72069;
        double r72071 = r72061 * r72070;
        double r72072 = r72068 - r72071;
        double r72073 = r72067 + r72072;
        double r72074 = r72062 * r72073;
        return r72074;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 58.8

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