Average Error: 58.5 → 0.7
Time: 5.5s
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 r72923 = 1.0;
        double r72924 = 2.0;
        double r72925 = r72923 / r72924;
        double r72926 = x;
        double r72927 = r72923 + r72926;
        double r72928 = r72923 - r72926;
        double r72929 = r72927 / r72928;
        double r72930 = log(r72929);
        double r72931 = r72925 * r72930;
        return r72931;
}

double f(double x) {
        double r72932 = 1.0;
        double r72933 = 2.0;
        double r72934 = r72932 / r72933;
        double r72935 = x;
        double r72936 = 2.0;
        double r72937 = pow(r72935, r72936);
        double r72938 = r72937 + r72935;
        double r72939 = r72933 * r72938;
        double r72940 = log(r72932);
        double r72941 = pow(r72932, r72936);
        double r72942 = r72937 / r72941;
        double r72943 = r72933 * r72942;
        double r72944 = r72940 - r72943;
        double r72945 = r72939 + r72944;
        double r72946 = r72934 * r72945;
        return r72946;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 58.5

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

Reproduce

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