Average Error: 58.6 → 0.6
Time: 16.1s
Precision: 64
\[\frac{1}{2} \cdot \log \left(\frac{1 + x}{1 - x}\right)\]
\[\frac{1}{2} \cdot \left(2 \cdot \left(x \cdot \left(x + 1\right)\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 \left(x + 1\right)\right) + \left(\log 1 - 2 \cdot \frac{{x}^{2}}{{1}^{2}}\right)\right)
double f(double x) {
        double r51766 = 1.0;
        double r51767 = 2.0;
        double r51768 = r51766 / r51767;
        double r51769 = x;
        double r51770 = r51766 + r51769;
        double r51771 = r51766 - r51769;
        double r51772 = r51770 / r51771;
        double r51773 = log(r51772);
        double r51774 = r51768 * r51773;
        return r51774;
}

double f(double x) {
        double r51775 = 1.0;
        double r51776 = 2.0;
        double r51777 = r51775 / r51776;
        double r51778 = x;
        double r51779 = 1.0;
        double r51780 = r51778 + r51779;
        double r51781 = r51778 * r51780;
        double r51782 = r51776 * r51781;
        double r51783 = log(r51775);
        double r51784 = 2.0;
        double r51785 = pow(r51778, r51784);
        double r51786 = pow(r51775, r51784);
        double r51787 = r51785 / r51786;
        double r51788 = r51776 * r51787;
        double r51789 = r51783 - r51788;
        double r51790 = r51782 + r51789;
        double r51791 = r51777 * r51790;
        return r51791;
}

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. Using strategy rm
  5. Applied *-un-lft-identity0.6

    \[\leadsto \frac{1}{2} \cdot \left(2 \cdot \left(x \cdot x + \color{blue}{1 \cdot x}\right) + \left(\log 1 - 2 \cdot \frac{{x}^{2}}{{1}^{2}}\right)\right)\]
  6. Applied distribute-rgt-out0.6

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

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

Reproduce

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