Average Error: 0.1 → 0.1
Time: 13.0s
Precision: 64
\[\log \left(\frac{1}{x} + \frac{\sqrt{1 - x \cdot x}}{x}\right)\]
\[\log \left(\mathsf{fma}\left(\frac{1}{\sqrt{x}}, \frac{1}{\sqrt{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(\frac{1}{\sqrt{x}}, \frac{1}{\sqrt{x}}, \frac{\sqrt{1 - x \cdot x}}{x}\right)\right)
double f(double x) {
        double r1184781 = 1.0;
        double r1184782 = x;
        double r1184783 = r1184781 / r1184782;
        double r1184784 = r1184782 * r1184782;
        double r1184785 = r1184781 - r1184784;
        double r1184786 = sqrt(r1184785);
        double r1184787 = r1184786 / r1184782;
        double r1184788 = r1184783 + r1184787;
        double r1184789 = log(r1184788);
        return r1184789;
}

double f(double x) {
        double r1184790 = 1.0;
        double r1184791 = x;
        double r1184792 = sqrt(r1184791);
        double r1184793 = r1184790 / r1184792;
        double r1184794 = r1184791 * r1184791;
        double r1184795 = r1184790 - r1184794;
        double r1184796 = sqrt(r1184795);
        double r1184797 = r1184796 / r1184791;
        double r1184798 = fma(r1184793, r1184793, r1184797);
        double r1184799 = log(r1184798);
        return r1184799;
}

Error

Bits error versus x

Derivation

  1. Initial program 0.1

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

    \[\leadsto \log \left(\frac{1}{\color{blue}{\sqrt{x} \cdot \sqrt{x}}} + \frac{\sqrt{1 - x \cdot x}}{x}\right)\]
  4. Applied *-un-lft-identity0.1

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

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

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

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

Reproduce

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