Average Error: 32.1 → 0.3
Time: 8.1s
Precision: 64
\[\log \left(x + \sqrt{x \cdot x - 1}\right)\]
\[\log \left(x + \left(\left(x - \frac{0.5}{x}\right) - \frac{0.125}{{x}^{3}}\right)\right)\]
\log \left(x + \sqrt{x \cdot x - 1}\right)
\log \left(x + \left(\left(x - \frac{0.5}{x}\right) - \frac{0.125}{{x}^{3}}\right)\right)
double f(double x) {
        double r49101 = x;
        double r49102 = r49101 * r49101;
        double r49103 = 1.0;
        double r49104 = r49102 - r49103;
        double r49105 = sqrt(r49104);
        double r49106 = r49101 + r49105;
        double r49107 = log(r49106);
        return r49107;
}

double f(double x) {
        double r49108 = x;
        double r49109 = 0.5;
        double r49110 = r49109 / r49108;
        double r49111 = r49108 - r49110;
        double r49112 = 0.125;
        double r49113 = 3.0;
        double r49114 = pow(r49108, r49113);
        double r49115 = r49112 / r49114;
        double r49116 = r49111 - r49115;
        double r49117 = r49108 + r49116;
        double r49118 = log(r49117);
        return r49118;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 32.1

    \[\log \left(x + \sqrt{x \cdot x - 1}\right)\]
  2. Taylor expanded around inf 0.3

    \[\leadsto \log \left(x + \color{blue}{\left(x - \left(0.5 \cdot \frac{1}{x} + 0.125 \cdot \frac{1}{{x}^{3}}\right)\right)}\right)\]
  3. Simplified0.3

    \[\leadsto \log \left(x + \color{blue}{\left(\left(x - \frac{0.5}{x}\right) - \frac{0.125}{{x}^{3}}\right)}\right)\]
  4. Final simplification0.3

    \[\leadsto \log \left(x + \left(\left(x - \frac{0.5}{x}\right) - \frac{0.125}{{x}^{3}}\right)\right)\]

Reproduce

herbie shell --seed 2019199 +o rules:numerics
(FPCore (x)
  :name "Hyperbolic arc-cosine"
  (log (+ x (sqrt (- (* x x) 1.0)))))