Average Error: 30.9 → 0.4
Time: 12.8s
Precision: 64
\[\log \left(x + \sqrt{x \cdot x - 1}\right)\]
\[\left(\left(\log 2 + \log x\right) - \frac{\frac{1}{4}}{x \cdot x}\right) - \frac{\frac{3}{32}}{\left(x \cdot x\right) \cdot \left(x \cdot x\right)}\]
\log \left(x + \sqrt{x \cdot x - 1}\right)
\left(\left(\log 2 + \log x\right) - \frac{\frac{1}{4}}{x \cdot x}\right) - \frac{\frac{3}{32}}{\left(x \cdot x\right) \cdot \left(x \cdot x\right)}
double f(double x) {
        double r1622409 = x;
        double r1622410 = r1622409 * r1622409;
        double r1622411 = 1.0;
        double r1622412 = r1622410 - r1622411;
        double r1622413 = sqrt(r1622412);
        double r1622414 = r1622409 + r1622413;
        double r1622415 = log(r1622414);
        return r1622415;
}

double f(double x) {
        double r1622416 = 2.0;
        double r1622417 = log(r1622416);
        double r1622418 = x;
        double r1622419 = log(r1622418);
        double r1622420 = r1622417 + r1622419;
        double r1622421 = 0.25;
        double r1622422 = r1622418 * r1622418;
        double r1622423 = r1622421 / r1622422;
        double r1622424 = r1622420 - r1622423;
        double r1622425 = 0.09375;
        double r1622426 = r1622422 * r1622422;
        double r1622427 = r1622425 / r1622426;
        double r1622428 = r1622424 - r1622427;
        return r1622428;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 30.9

    \[\log \left(x + \sqrt{x \cdot x - 1}\right)\]
  2. Simplified30.9

    \[\leadsto \color{blue}{\log \left(x + \sqrt{\mathsf{fma}\left(x, x, -1\right)}\right)}\]
  3. Taylor expanded around inf 0.4

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

    \[\leadsto \color{blue}{\left(\left(\log 2 + \log x\right) - \frac{\frac{1}{4}}{x \cdot x}\right) - \frac{\frac{3}{32}}{\left(x \cdot x\right) \cdot \left(x \cdot x\right)}}\]
  5. Final simplification0.4

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

Reproduce

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