Average Error: 58.6 → 0.6
Time: 8.0s
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 r93219 = 1.0;
        double r93220 = 2.0;
        double r93221 = r93219 / r93220;
        double r93222 = x;
        double r93223 = r93219 + r93222;
        double r93224 = r93219 - r93222;
        double r93225 = r93223 / r93224;
        double r93226 = log(r93225);
        double r93227 = r93221 * r93226;
        return r93227;
}

double f(double x) {
        double r93228 = 1.0;
        double r93229 = 2.0;
        double r93230 = r93228 / r93229;
        double r93231 = x;
        double r93232 = 2.0;
        double r93233 = pow(r93231, r93232);
        double r93234 = r93233 + r93231;
        double r93235 = r93229 * r93234;
        double r93236 = log(r93228);
        double r93237 = pow(r93228, r93232);
        double r93238 = r93233 / r93237;
        double r93239 = r93229 * r93238;
        double r93240 = r93236 - r93239;
        double r93241 = r93235 + r93240;
        double r93242 = r93230 * r93241;
        return r93242;
}

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