Average Error: 58.7 → 0.6
Time: 18.3s
Precision: 64
\[\frac{1}{2} \cdot \log \left(\frac{1 + x}{1 - x}\right)\]
\[\frac{1}{2} \cdot \left(2 \cdot \left(x \cdot x + 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 \cdot x + x\right) + \left(\log 1 - 2 \cdot \frac{{x}^{2}}{{1}^{2}}\right)\right)
double f(double x) {
        double r61082 = 1.0;
        double r61083 = 2.0;
        double r61084 = r61082 / r61083;
        double r61085 = x;
        double r61086 = r61082 + r61085;
        double r61087 = r61082 - r61085;
        double r61088 = r61086 / r61087;
        double r61089 = log(r61088);
        double r61090 = r61084 * r61089;
        return r61090;
}

double f(double x) {
        double r61091 = 1.0;
        double r61092 = 2.0;
        double r61093 = r61091 / r61092;
        double r61094 = x;
        double r61095 = r61094 * r61094;
        double r61096 = r61095 + r61094;
        double r61097 = r61092 * r61096;
        double r61098 = log(r61091);
        double r61099 = 2.0;
        double r61100 = pow(r61094, r61099);
        double r61101 = pow(r61091, r61099);
        double r61102 = r61100 / r61101;
        double r61103 = r61092 * r61102;
        double r61104 = r61098 - r61103;
        double r61105 = r61097 + r61104;
        double r61106 = r61093 * r61105;
        return r61106;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 58.7

    \[\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 \cdot x + 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 \cdot x + x\right) + \left(\log 1 - 2 \cdot \frac{{x}^{2}}{{1}^{2}}\right)\right)\]

Reproduce

herbie shell --seed 2019305 
(FPCore (x)
  :name "Hyperbolic arc-(co)tangent"
  :precision binary64
  (* (/ 1 2) (log (/ (+ 1 x) (- 1 x)))))