Average Error: 58.4 → 0.7
Time: 5.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 r59036 = 1.0;
        double r59037 = 2.0;
        double r59038 = r59036 / r59037;
        double r59039 = x;
        double r59040 = r59036 + r59039;
        double r59041 = r59036 - r59039;
        double r59042 = r59040 / r59041;
        double r59043 = log(r59042);
        double r59044 = r59038 * r59043;
        return r59044;
}

double f(double x) {
        double r59045 = 1.0;
        double r59046 = 2.0;
        double r59047 = r59045 / r59046;
        double r59048 = x;
        double r59049 = 2.0;
        double r59050 = pow(r59048, r59049);
        double r59051 = r59050 + r59048;
        double r59052 = r59046 * r59051;
        double r59053 = log(r59045);
        double r59054 = pow(r59045, r59049);
        double r59055 = r59050 / r59054;
        double r59056 = r59046 * r59055;
        double r59057 = r59053 - r59056;
        double r59058 = r59052 + r59057;
        double r59059 = r59047 * r59058;
        return r59059;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 58.4

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