Average Error: 0.0 → 0.0
Time: 10.4s
Precision: 64
\[\log \left(\frac{1}{x} + \frac{\sqrt{1 - x \cdot x}}{x}\right)\]
\[\log \left(\mathsf{fma}\left(\sqrt{\frac{1}{x}}, \sqrt{\frac{1}{x}}, \frac{\sqrt{1 - x \cdot x}}{x}\right)\right)\]
\log \left(\frac{1}{x} + \frac{\sqrt{1 - x \cdot x}}{x}\right)
\log \left(\mathsf{fma}\left(\sqrt{\frac{1}{x}}, \sqrt{\frac{1}{x}}, \frac{\sqrt{1 - x \cdot x}}{x}\right)\right)
double f(double x) {
        double r2293053 = 1.0;
        double r2293054 = x;
        double r2293055 = r2293053 / r2293054;
        double r2293056 = r2293054 * r2293054;
        double r2293057 = r2293053 - r2293056;
        double r2293058 = sqrt(r2293057);
        double r2293059 = r2293058 / r2293054;
        double r2293060 = r2293055 + r2293059;
        double r2293061 = log(r2293060);
        return r2293061;
}

double f(double x) {
        double r2293062 = 1.0;
        double r2293063 = x;
        double r2293064 = r2293062 / r2293063;
        double r2293065 = sqrt(r2293064);
        double r2293066 = r2293063 * r2293063;
        double r2293067 = r2293062 - r2293066;
        double r2293068 = sqrt(r2293067);
        double r2293069 = r2293068 / r2293063;
        double r2293070 = fma(r2293065, r2293065, r2293069);
        double r2293071 = log(r2293070);
        return r2293071;
}

Error

Bits error versus x

Derivation

  1. Initial program 0.0

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

    \[\leadsto \log \left(\color{blue}{\sqrt{\frac{1}{x}} \cdot \sqrt{\frac{1}{x}}} + \frac{\sqrt{1 - x \cdot x}}{x}\right)\]
  4. Applied fma-def0.0

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

    \[\leadsto \log \left(\mathsf{fma}\left(\sqrt{\frac{1}{x}}, \sqrt{\frac{1}{x}}, \frac{\sqrt{1 - x \cdot x}}{x}\right)\right)\]

Reproduce

herbie shell --seed 2019169 +o rules:numerics
(FPCore (x)
  :name "Hyperbolic arc-(co)secant"
  (log (+ (/ 1.0 x) (/ (sqrt (- 1.0 (* x x))) x))))