Average Error: 31.1 → 0.3
Time: 41.6s
Precision: 64
\[\log \left(x + \sqrt{x \cdot x - 1}\right)\]
\[\mathsf{fma}\left(\frac{1}{4}, \left(\frac{-1}{x \cdot x}\right), \left(\log 2 - \left(\frac{\frac{3}{32}}{\left(x \cdot x\right) \cdot \left(x \cdot x\right)} - \log x\right)\right)\right)\]
\log \left(x + \sqrt{x \cdot x - 1}\right)
\mathsf{fma}\left(\frac{1}{4}, \left(\frac{-1}{x \cdot x}\right), \left(\log 2 - \left(\frac{\frac{3}{32}}{\left(x \cdot x\right) \cdot \left(x \cdot x\right)} - \log x\right)\right)\right)
double f(double x) {
        double r11522748 = x;
        double r11522749 = r11522748 * r11522748;
        double r11522750 = 1.0;
        double r11522751 = r11522749 - r11522750;
        double r11522752 = sqrt(r11522751);
        double r11522753 = r11522748 + r11522752;
        double r11522754 = log(r11522753);
        return r11522754;
}

double f(double x) {
        double r11522755 = 0.25;
        double r11522756 = -1.0;
        double r11522757 = x;
        double r11522758 = r11522757 * r11522757;
        double r11522759 = r11522756 / r11522758;
        double r11522760 = 2.0;
        double r11522761 = log(r11522760);
        double r11522762 = 0.09375;
        double r11522763 = r11522758 * r11522758;
        double r11522764 = r11522762 / r11522763;
        double r11522765 = log(r11522757);
        double r11522766 = r11522764 - r11522765;
        double r11522767 = r11522761 - r11522766;
        double r11522768 = fma(r11522755, r11522759, r11522767);
        return r11522768;
}

Error

Bits error versus x

Derivation

  1. Initial program 31.1

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

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

    \[\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.3

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

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

Reproduce

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