Average Error: 58.6 → 0.6
Time: 10.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 r61057 = 1.0;
        double r61058 = 2.0;
        double r61059 = r61057 / r61058;
        double r61060 = x;
        double r61061 = r61057 + r61060;
        double r61062 = r61057 - r61060;
        double r61063 = r61061 / r61062;
        double r61064 = log(r61063);
        double r61065 = r61059 * r61064;
        return r61065;
}

double f(double x) {
        double r61066 = 1.0;
        double r61067 = 2.0;
        double r61068 = r61066 / r61067;
        double r61069 = x;
        double r61070 = r61069 * r61069;
        double r61071 = r61070 + r61069;
        double r61072 = r61067 * r61071;
        double r61073 = log(r61066);
        double r61074 = 2.0;
        double r61075 = pow(r61069, r61074);
        double r61076 = pow(r61066, r61074);
        double r61077 = r61075 / r61076;
        double r61078 = r61067 * r61077;
        double r61079 = r61073 - r61078;
        double r61080 = r61072 + r61079;
        double r61081 = r61068 * r61080;
        return r61081;
}

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. Final simplification0.6

    \[\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 2020047 
(FPCore (x)
  :name "Hyperbolic arc-(co)tangent"
  :precision binary64
  (* (/ 1 2) (log (/ (+ 1 x) (- 1 x)))))