Average Error: 58.6 → 0.6
Time: 7.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 r91302 = 1.0;
        double r91303 = 2.0;
        double r91304 = r91302 / r91303;
        double r91305 = x;
        double r91306 = r91302 + r91305;
        double r91307 = r91302 - r91305;
        double r91308 = r91306 / r91307;
        double r91309 = log(r91308);
        double r91310 = r91304 * r91309;
        return r91310;
}

double f(double x) {
        double r91311 = 1.0;
        double r91312 = 2.0;
        double r91313 = r91311 / r91312;
        double r91314 = x;
        double r91315 = 2.0;
        double r91316 = pow(r91314, r91315);
        double r91317 = r91316 + r91314;
        double r91318 = r91312 * r91317;
        double r91319 = log(r91311);
        double r91320 = pow(r91311, r91315);
        double r91321 = r91316 / r91320;
        double r91322 = r91312 * r91321;
        double r91323 = r91319 - r91322;
        double r91324 = r91318 + r91323;
        double r91325 = r91313 * r91324;
        return r91325;
}

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