Average Error: 0.1 → 0.1
Time: 9.3s
Precision: 64
\[\log \left(\frac{1}{x} + \frac{\sqrt{1 - x \cdot x}}{x}\right)\]
\[\log \left(\left(1 + \sqrt{1 - x \cdot x}\right) \cdot \frac{1}{x}\right)\]
\log \left(\frac{1}{x} + \frac{\sqrt{1 - x \cdot x}}{x}\right)
\log \left(\left(1 + \sqrt{1 - x \cdot x}\right) \cdot \frac{1}{x}\right)
double f(double x) {
        double r1560396 = 1.0;
        double r1560397 = x;
        double r1560398 = r1560396 / r1560397;
        double r1560399 = r1560397 * r1560397;
        double r1560400 = r1560396 - r1560399;
        double r1560401 = sqrt(r1560400);
        double r1560402 = r1560401 / r1560397;
        double r1560403 = r1560398 + r1560402;
        double r1560404 = log(r1560403);
        return r1560404;
}

double f(double x) {
        double r1560405 = 1.0;
        double r1560406 = x;
        double r1560407 = r1560406 * r1560406;
        double r1560408 = r1560405 - r1560407;
        double r1560409 = sqrt(r1560408);
        double r1560410 = r1560405 + r1560409;
        double r1560411 = r1560405 / r1560406;
        double r1560412 = r1560410 * r1560411;
        double r1560413 = log(r1560412);
        return r1560413;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

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

    \[\leadsto \log \left(\frac{1}{x} + \color{blue}{\sqrt{1 - x \cdot x} \cdot \frac{1}{x}}\right)\]
  4. Applied distribute-rgt1-in0.1

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

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

Reproduce

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