Average Error: 0.0 → 0.0
Time: 5.4s
Precision: 64
\[\log \left(\frac{1}{x} + \frac{\sqrt{1 - x \cdot x}}{x}\right)\]
\[\log \left(\frac{1}{x} \cdot \left(1 + \sqrt{1 - x \cdot x}\right)\right)\]
\log \left(\frac{1}{x} + \frac{\sqrt{1 - x \cdot x}}{x}\right)
\log \left(\frac{1}{x} \cdot \left(1 + \sqrt{1 - x \cdot x}\right)\right)
double f(double x) {
        double r91695 = 1.0;
        double r91696 = x;
        double r91697 = r91695 / r91696;
        double r91698 = r91696 * r91696;
        double r91699 = r91695 - r91698;
        double r91700 = sqrt(r91699);
        double r91701 = r91700 / r91696;
        double r91702 = r91697 + r91701;
        double r91703 = log(r91702);
        return r91703;
}

double f(double x) {
        double r91704 = 1.0;
        double r91705 = x;
        double r91706 = r91704 / r91705;
        double r91707 = 1.0;
        double r91708 = r91705 * r91705;
        double r91709 = r91707 - r91708;
        double r91710 = sqrt(r91709);
        double r91711 = r91707 + r91710;
        double r91712 = r91706 * r91711;
        double r91713 = log(r91712);
        return r91713;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

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 div-inv0.0

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

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

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

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

Reproduce

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