Average Error: 0.0 → 0.2
Time: 3.5s
Precision: 64
\[\log \left(\frac{1}{x} + \frac{\sqrt{1 - x \cdot x}}{x}\right)\]
\[\log \left(\frac{1}{\sqrt{x}}\right) + \log \left(\frac{1}{\sqrt{x}} + \frac{\sqrt{1 - x \cdot x}}{\sqrt{x}}\right)\]
\log \left(\frac{1}{x} + \frac{\sqrt{1 - x \cdot x}}{x}\right)
\log \left(\frac{1}{\sqrt{x}}\right) + \log \left(\frac{1}{\sqrt{x}} + \frac{\sqrt{1 - x \cdot x}}{\sqrt{x}}\right)
double code(double x) {
	return log(((1.0 / x) + (sqrt((1.0 - (x * x))) / x)));
}
double code(double x) {
	return (log((1.0 / sqrt(x))) + log(((1.0 / sqrt(x)) + (sqrt((1.0 - (x * x))) / sqrt(x)))));
}

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 add-sqr-sqrt0.0

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

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

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

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

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

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

    \[\leadsto \log \color{blue}{\left(\frac{1}{\sqrt{x}} \cdot \left(\frac{1}{\sqrt{x}} + \frac{\sqrt{1 - x \cdot x}}{\sqrt{x}}\right)\right)}\]
  10. Applied log-prod0.2

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

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

Reproduce

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