Average Error: 58.5 → 0.7
Time: 6.2s
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 r72292 = 1.0;
        double r72293 = 2.0;
        double r72294 = r72292 / r72293;
        double r72295 = x;
        double r72296 = r72292 + r72295;
        double r72297 = r72292 - r72295;
        double r72298 = r72296 / r72297;
        double r72299 = log(r72298);
        double r72300 = r72294 * r72299;
        return r72300;
}

double f(double x) {
        double r72301 = 1.0;
        double r72302 = 2.0;
        double r72303 = r72301 / r72302;
        double r72304 = x;
        double r72305 = 2.0;
        double r72306 = pow(r72304, r72305);
        double r72307 = r72306 + r72304;
        double r72308 = r72302 * r72307;
        double r72309 = log(r72301);
        double r72310 = pow(r72301, r72305);
        double r72311 = r72306 / r72310;
        double r72312 = r72302 * r72311;
        double r72313 = r72309 - r72312;
        double r72314 = r72308 + r72313;
        double r72315 = r72303 * r72314;
        return r72315;
}

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