Average Error: 58.5 → 0.7
Time: 6.6s
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 r73243 = 1.0;
        double r73244 = 2.0;
        double r73245 = r73243 / r73244;
        double r73246 = x;
        double r73247 = r73243 + r73246;
        double r73248 = r73243 - r73246;
        double r73249 = r73247 / r73248;
        double r73250 = log(r73249);
        double r73251 = r73245 * r73250;
        return r73251;
}

double f(double x) {
        double r73252 = 1.0;
        double r73253 = 2.0;
        double r73254 = r73252 / r73253;
        double r73255 = x;
        double r73256 = 2.0;
        double r73257 = pow(r73255, r73256);
        double r73258 = r73257 + r73255;
        double r73259 = r73253 * r73258;
        double r73260 = log(r73252);
        double r73261 = pow(r73252, r73256);
        double r73262 = r73257 / r73261;
        double r73263 = r73253 * r73262;
        double r73264 = r73260 - r73263;
        double r73265 = r73259 + r73264;
        double r73266 = r73254 * r73265;
        return r73266;
}

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