Average Error: 0.1 → 0.1
Time: 2.2s
Precision: binary64
\[\log \left(\frac{1}{x} + \frac{\sqrt{1 - x \cdot x}}{x}\right) \]
\[\log \left(\frac{1 + \sqrt{1 - x \cdot x}}{x}\right) \]
\log \left(\frac{1}{x} + \frac{\sqrt{1 - x \cdot x}}{x}\right)
\log \left(\frac{1 + \sqrt{1 - x \cdot x}}{x}\right)
(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)))) 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))) / 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.1

    \[\log \left(\frac{1}{x} + \frac{\sqrt{1 - x \cdot x}}{x}\right) \]
  2. Applied div-inv_binary640.1

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

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

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

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

Reproduce

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