Average Error: 0.0 → 0.0
Time: 3.1s
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 r84795 = 1.0;
        double r84796 = x;
        double r84797 = r84795 / r84796;
        double r84798 = r84796 * r84796;
        double r84799 = r84795 - r84798;
        double r84800 = sqrt(r84799);
        double r84801 = r84800 / r84796;
        double r84802 = r84797 + r84801;
        double r84803 = log(r84802);
        return r84803;
}

double f(double x) {
        double r84804 = 1.0;
        double r84805 = x;
        double r84806 = r84804 / r84805;
        double r84807 = sqrt(r84806);
        double r84808 = r84805 * r84805;
        double r84809 = r84804 - r84808;
        double r84810 = sqrt(r84809);
        double r84811 = r84810 / r84805;
        double r84812 = fma(r84807, r84807, r84811);
        double r84813 = log(r84812);
        return r84813;
}

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 2020020 +o rules:numerics
(FPCore (x)
  :name "Hyperbolic arc-(co)secant"
  :precision binary64
  (log (+ (/ 1 x) (/ (sqrt (- 1 (* x x))) x))))