Average Error: 58.6 → 0.6
Time: 17.5s
Precision: 64
\[\frac{1}{2} \cdot \log \left(\frac{1 + x}{1 - x}\right)\]
\[\frac{1}{2} \cdot \left(x \cdot \left(2 \cdot x + 2\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(x \cdot \left(2 \cdot x + 2\right) + \left(\log 1 - 2 \cdot \frac{{x}^{2}}{{1}^{2}}\right)\right)
double f(double x) {
        double r58961 = 1.0;
        double r58962 = 2.0;
        double r58963 = r58961 / r58962;
        double r58964 = x;
        double r58965 = r58961 + r58964;
        double r58966 = r58961 - r58964;
        double r58967 = r58965 / r58966;
        double r58968 = log(r58967);
        double r58969 = r58963 * r58968;
        return r58969;
}

double f(double x) {
        double r58970 = 1.0;
        double r58971 = 2.0;
        double r58972 = r58970 / r58971;
        double r58973 = x;
        double r58974 = r58971 * r58973;
        double r58975 = r58974 + r58971;
        double r58976 = r58973 * r58975;
        double r58977 = log(r58970);
        double r58978 = 2.0;
        double r58979 = pow(r58973, r58978);
        double r58980 = pow(r58970, r58978);
        double r58981 = r58979 / r58980;
        double r58982 = r58971 * r58981;
        double r58983 = r58977 - r58982;
        double r58984 = r58976 + r58983;
        double r58985 = r58972 * r58984;
        return r58985;
}

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

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

Reproduce

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