Average Error: 0.0 → 0.0
Time: 19.2s
Precision: 64
\[\log \left(\frac{1.0}{x} + \frac{\sqrt{1.0 - x \cdot x}}{x}\right)\]
\[\log \left(\mathsf{fma}\left(\frac{\sqrt{1.0}}{\sqrt{x}}, \frac{\sqrt{1.0}}{\sqrt{x}}, \frac{\sqrt{1.0 - x \cdot x}}{x}\right)\right)\]
\log \left(\frac{1.0}{x} + \frac{\sqrt{1.0 - x \cdot x}}{x}\right)
\log \left(\mathsf{fma}\left(\frac{\sqrt{1.0}}{\sqrt{x}}, \frac{\sqrt{1.0}}{\sqrt{x}}, \frac{\sqrt{1.0 - x \cdot x}}{x}\right)\right)
double f(double x) {
        double r2531702 = 1.0;
        double r2531703 = x;
        double r2531704 = r2531702 / r2531703;
        double r2531705 = r2531703 * r2531703;
        double r2531706 = r2531702 - r2531705;
        double r2531707 = sqrt(r2531706);
        double r2531708 = r2531707 / r2531703;
        double r2531709 = r2531704 + r2531708;
        double r2531710 = log(r2531709);
        return r2531710;
}

double f(double x) {
        double r2531711 = 1.0;
        double r2531712 = sqrt(r2531711);
        double r2531713 = x;
        double r2531714 = sqrt(r2531713);
        double r2531715 = r2531712 / r2531714;
        double r2531716 = r2531713 * r2531713;
        double r2531717 = r2531711 - r2531716;
        double r2531718 = sqrt(r2531717);
        double r2531719 = r2531718 / r2531713;
        double r2531720 = fma(r2531715, r2531715, r2531719);
        double r2531721 = log(r2531720);
        return r2531721;
}

Error

Bits error versus x

Derivation

  1. Initial program 0.0

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

    \[\leadsto \log \left(\frac{1.0}{\color{blue}{\sqrt{x} \cdot \sqrt{x}}} + \frac{\sqrt{1.0 - x \cdot x}}{x}\right)\]
  4. Applied add-sqr-sqrt0.0

    \[\leadsto \log \left(\frac{\color{blue}{\sqrt{1.0} \cdot \sqrt{1.0}}}{\sqrt{x} \cdot \sqrt{x}} + \frac{\sqrt{1.0 - x \cdot x}}{x}\right)\]
  5. Applied times-frac0.0

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

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

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

Reproduce

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