Average Error: 31.5 → 0.0
Time: 9.8s
Precision: 64
\[\log \left(x + \sqrt{x \cdot x - 1}\right)\]
\[\log \left(e^{\log \left(\mathsf{fma}\left(\sqrt{x - \sqrt{1}}, \sqrt{x + \sqrt{1}}, x\right)\right)}\right)\]
\log \left(x + \sqrt{x \cdot x - 1}\right)
\log \left(e^{\log \left(\mathsf{fma}\left(\sqrt{x - \sqrt{1}}, \sqrt{x + \sqrt{1}}, x\right)\right)}\right)
double f(double x) {
        double r76945 = x;
        double r76946 = r76945 * r76945;
        double r76947 = 1.0;
        double r76948 = r76946 - r76947;
        double r76949 = sqrt(r76948);
        double r76950 = r76945 + r76949;
        double r76951 = log(r76950);
        return r76951;
}

double f(double x) {
        double r76952 = x;
        double r76953 = 1.0;
        double r76954 = sqrt(r76953);
        double r76955 = r76952 - r76954;
        double r76956 = sqrt(r76955);
        double r76957 = r76952 + r76954;
        double r76958 = sqrt(r76957);
        double r76959 = fma(r76956, r76958, r76952);
        double r76960 = log(r76959);
        double r76961 = exp(r76960);
        double r76962 = log(r76961);
        return r76962;
}

Error

Bits error versus x

Derivation

  1. Initial program 31.5

    \[\log \left(x + \sqrt{x \cdot x - 1}\right)\]
  2. Using strategy rm
  3. Applied add-sqr-sqrt31.5

    \[\leadsto \log \left(x + \sqrt{x \cdot x - \color{blue}{\sqrt{1} \cdot \sqrt{1}}}\right)\]
  4. Applied difference-of-squares31.5

    \[\leadsto \log \left(x + \sqrt{\color{blue}{\left(x + \sqrt{1}\right) \cdot \left(x - \sqrt{1}\right)}}\right)\]
  5. Applied sqrt-prod0.0

    \[\leadsto \log \left(x + \color{blue}{\sqrt{x + \sqrt{1}} \cdot \sqrt{x - \sqrt{1}}}\right)\]
  6. Simplified0.0

    \[\leadsto \log \left(x + \color{blue}{\sqrt{\sqrt{1} + x}} \cdot \sqrt{x - \sqrt{1}}\right)\]
  7. Using strategy rm
  8. Applied add-exp-log0.0

    \[\leadsto \log \color{blue}{\left(e^{\log \left(x + \sqrt{\sqrt{1} + x} \cdot \sqrt{x - \sqrt{1}}\right)}\right)}\]
  9. Simplified0.0

    \[\leadsto \log \left(e^{\color{blue}{\log \left(\mathsf{fma}\left(\sqrt{x - \sqrt{1}}, \sqrt{x + \sqrt{1}}, x\right)\right)}}\right)\]
  10. Final simplification0.0

    \[\leadsto \log \left(e^{\log \left(\mathsf{fma}\left(\sqrt{x - \sqrt{1}}, \sqrt{x + \sqrt{1}}, x\right)\right)}\right)\]

Reproduce

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