Average Error: 58.6 → 0.7
Time: 6.8s
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 r92290 = 1.0;
        double r92291 = 2.0;
        double r92292 = r92290 / r92291;
        double r92293 = x;
        double r92294 = r92290 + r92293;
        double r92295 = r92290 - r92293;
        double r92296 = r92294 / r92295;
        double r92297 = log(r92296);
        double r92298 = r92292 * r92297;
        return r92298;
}

double f(double x) {
        double r92299 = 1.0;
        double r92300 = 2.0;
        double r92301 = r92299 / r92300;
        double r92302 = x;
        double r92303 = 2.0;
        double r92304 = pow(r92302, r92303);
        double r92305 = r92304 + r92302;
        double r92306 = r92300 * r92305;
        double r92307 = log(r92299);
        double r92308 = pow(r92299, r92303);
        double r92309 = r92304 / r92308;
        double r92310 = r92300 * r92309;
        double r92311 = r92307 - r92310;
        double r92312 = r92306 + r92311;
        double r92313 = r92301 * r92312;
        return r92313;
}

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