Average Error: 32.4 → 0.2
Time: 8.9s
Precision: 64
\[\log \left(x + \sqrt{x \cdot x - 1}\right)\]
\[\log \left(\mathsf{fma}\left(2, x, -\mathsf{fma}\left(0.5, \frac{1}{x}, 0.125 \cdot \frac{1}{{x}^{3}}\right)\right)\right)\]
\log \left(x + \sqrt{x \cdot x - 1}\right)
\log \left(\mathsf{fma}\left(2, x, -\mathsf{fma}\left(0.5, \frac{1}{x}, 0.125 \cdot \frac{1}{{x}^{3}}\right)\right)\right)
double f(double x) {
        double r88689 = x;
        double r88690 = r88689 * r88689;
        double r88691 = 1.0;
        double r88692 = r88690 - r88691;
        double r88693 = sqrt(r88692);
        double r88694 = r88689 + r88693;
        double r88695 = log(r88694);
        return r88695;
}

double f(double x) {
        double r88696 = 2.0;
        double r88697 = x;
        double r88698 = 0.5;
        double r88699 = 1.0;
        double r88700 = r88699 / r88697;
        double r88701 = 0.125;
        double r88702 = 3.0;
        double r88703 = pow(r88697, r88702);
        double r88704 = r88699 / r88703;
        double r88705 = r88701 * r88704;
        double r88706 = fma(r88698, r88700, r88705);
        double r88707 = -r88706;
        double r88708 = fma(r88696, r88697, r88707);
        double r88709 = log(r88708);
        return r88709;
}

Error

Bits error versus x

Derivation

  1. Initial program 32.4

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

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

    \[\leadsto \log \color{blue}{\left(\mathsf{fma}\left(2, x, -\mathsf{fma}\left(0.5, \frac{1}{x}, 0.125 \cdot \frac{1}{{x}^{3}}\right)\right)\right)}\]
  4. Final simplification0.2

    \[\leadsto \log \left(\mathsf{fma}\left(2, x, -\mathsf{fma}\left(0.5, \frac{1}{x}, 0.125 \cdot \frac{1}{{x}^{3}}\right)\right)\right)\]

Reproduce

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