Average Error: 58.7 → 0.0
Time: 27.1s
Precision: 64
\[\frac{1}{2} \cdot \log \left(\frac{1 + x}{1 - x}\right)\]
\[\left(\log_* (1 + x) - \log_* (1 + \left(-x\right))\right) \cdot \frac{1}{2}\]
\frac{1}{2} \cdot \log \left(\frac{1 + x}{1 - x}\right)
\left(\log_* (1 + x) - \log_* (1 + \left(-x\right))\right) \cdot \frac{1}{2}
double f(double x) {
        double r6210785 = 1.0;
        double r6210786 = 2.0;
        double r6210787 = r6210785 / r6210786;
        double r6210788 = x;
        double r6210789 = r6210785 + r6210788;
        double r6210790 = r6210785 - r6210788;
        double r6210791 = r6210789 / r6210790;
        double r6210792 = log(r6210791);
        double r6210793 = r6210787 * r6210792;
        return r6210793;
}

double f(double x) {
        double r6210794 = x;
        double r6210795 = log1p(r6210794);
        double r6210796 = -r6210794;
        double r6210797 = log1p(r6210796);
        double r6210798 = r6210795 - r6210797;
        double r6210799 = 0.5;
        double r6210800 = r6210798 * r6210799;
        return r6210800;
}

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. Simplified58.7

    \[\leadsto \color{blue}{\log \left(\frac{x + 1}{1 - x}\right) \cdot \frac{1}{2}}\]
  3. Using strategy rm
  4. Applied add-exp-log58.7

    \[\leadsto \log \left(\frac{x + 1}{\color{blue}{e^{\log \left(1 - x\right)}}}\right) \cdot \frac{1}{2}\]
  5. Applied add-exp-log58.7

    \[\leadsto \log \left(\frac{\color{blue}{e^{\log \left(x + 1\right)}}}{e^{\log \left(1 - x\right)}}\right) \cdot \frac{1}{2}\]
  6. Applied div-exp58.7

    \[\leadsto \log \color{blue}{\left(e^{\log \left(x + 1\right) - \log \left(1 - x\right)}\right)} \cdot \frac{1}{2}\]
  7. Applied rem-log-exp58.7

    \[\leadsto \color{blue}{\left(\log \left(x + 1\right) - \log \left(1 - x\right)\right)} \cdot \frac{1}{2}\]
  8. Simplified50.6

    \[\leadsto \left(\color{blue}{\log_* (1 + x)} - \log \left(1 - x\right)\right) \cdot \frac{1}{2}\]
  9. Using strategy rm
  10. Applied sub-neg50.6

    \[\leadsto \left(\log_* (1 + x) - \log \color{blue}{\left(1 + \left(-x\right)\right)}\right) \cdot \frac{1}{2}\]
  11. Applied log1p-def0.0

    \[\leadsto \left(\log_* (1 + x) - \color{blue}{\log_* (1 + \left(-x\right))}\right) \cdot \frac{1}{2}\]
  12. Final simplification0.0

    \[\leadsto \left(\log_* (1 + x) - \log_* (1 + \left(-x\right))\right) \cdot \frac{1}{2}\]

Reproduce

herbie shell --seed 2019112 +o rules:numerics
(FPCore (x)
  :name "Hyperbolic arc-(co)tangent"
  (* (/ 1 2) (log (/ (+ 1 x) (- 1 x)))))