Average Error: 58.6 → 0.6
Time: 13.4s
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 r96503 = 1.0;
        double r96504 = 2.0;
        double r96505 = r96503 / r96504;
        double r96506 = x;
        double r96507 = r96503 + r96506;
        double r96508 = r96503 - r96506;
        double r96509 = r96507 / r96508;
        double r96510 = log(r96509);
        double r96511 = r96505 * r96510;
        return r96511;
}

double f(double x) {
        double r96512 = 1.0;
        double r96513 = 2.0;
        double r96514 = r96512 / r96513;
        double r96515 = x;
        double r96516 = r96515 * r96515;
        double r96517 = r96516 + r96515;
        double r96518 = r96513 * r96517;
        double r96519 = log(r96512);
        double r96520 = 2.0;
        double r96521 = pow(r96515, r96520);
        double r96522 = pow(r96512, r96520);
        double r96523 = r96521 / r96522;
        double r96524 = r96513 * r96523;
        double r96525 = r96519 - r96524;
        double r96526 = r96518 + r96525;
        double r96527 = r96514 * r96526;
        return r96527;
}

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