Average Error: 30.9 → 0.4
Time: 15.0s
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 r1213006 = x;
        double r1213007 = r1213006 * r1213006;
        double r1213008 = 1.0;
        double r1213009 = r1213007 - r1213008;
        double r1213010 = sqrt(r1213009);
        double r1213011 = r1213006 + r1213010;
        double r1213012 = log(r1213011);
        return r1213012;
}

double f(double x) {
        double r1213013 = 2.0;
        double r1213014 = log(r1213013);
        double r1213015 = x;
        double r1213016 = log(r1213015);
        double r1213017 = r1213014 + r1213016;
        double r1213018 = 0.25;
        double r1213019 = r1213015 * r1213015;
        double r1213020 = r1213018 / r1213019;
        double r1213021 = r1213017 - r1213020;
        double r1213022 = 0.09375;
        double r1213023 = r1213019 * r1213019;
        double r1213024 = r1213022 / r1213023;
        double r1213025 = r1213021 - r1213024;
        return r1213025;
}

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)))))