Average Error: 0.0 → 0.2
Time: 6.3s
Precision: binary64
\[\log \left(\frac{1}{x} + \frac{\sqrt{1 - x \cdot x}}{x}\right)\]
\[\log \left(1 + \sqrt{1 - x \cdot x}\right) - \log x\]
\log \left(\frac{1}{x} + \frac{\sqrt{1 - x \cdot x}}{x}\right)
\log \left(1 + \sqrt{1 - x \cdot x}\right) - \log x
(FPCore (x)
 :precision binary64
 (log (+ (/ 1.0 x) (/ (sqrt (- 1.0 (* x x))) x))))
(FPCore (x)
 :precision binary64
 (- (log (+ 1.0 (sqrt (- 1.0 (* x x))))) (log x)))
double code(double x) {
	return log((1.0 / x) + (sqrt(1.0 - (x * x)) / x));
}
double code(double x) {
	return log(1.0 + sqrt(1.0 - (x * x))) - log(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 div-inv_binary64_31440.0

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

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

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

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

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

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

Reproduce

herbie shell --seed 2021050 
(FPCore (x)
  :name "Hyperbolic arc-(co)secant"
  :precision binary64
  (log (+ (/ 1.0 x) (/ (sqrt (- 1.0 (* x x))) x))))