Average Error: 58.4 → 0.7
Time: 17.5s
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 r45809 = 1.0;
        double r45810 = 2.0;
        double r45811 = r45809 / r45810;
        double r45812 = x;
        double r45813 = r45809 + r45812;
        double r45814 = r45809 - r45812;
        double r45815 = r45813 / r45814;
        double r45816 = log(r45815);
        double r45817 = r45811 * r45816;
        return r45817;
}

double f(double x) {
        double r45818 = 1.0;
        double r45819 = 2.0;
        double r45820 = r45818 / r45819;
        double r45821 = x;
        double r45822 = r45821 * r45821;
        double r45823 = r45822 + r45821;
        double r45824 = r45819 * r45823;
        double r45825 = log(r45818);
        double r45826 = 2.0;
        double r45827 = pow(r45821, r45826);
        double r45828 = pow(r45818, r45826);
        double r45829 = r45827 / r45828;
        double r45830 = r45819 * r45829;
        double r45831 = r45825 - r45830;
        double r45832 = r45824 + r45831;
        double r45833 = r45820 * r45832;
        return r45833;
}

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 \cdot x + 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 \cdot x + x\right) + \left(\log 1 - 2 \cdot \frac{{x}^{2}}{{1}^{2}}\right)\right)\]

Reproduce

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