Average Error: 0.0 → 0.0
Time: 1.9s
Precision: binary64
\[\log \left(\frac{1}{x} + \frac{\sqrt{1 - x \cdot x}}{x}\right) \]
\[\log \left(\frac{e^{\mathsf{log1p}\left(\sqrt{1 - x \cdot x}\right)}}{x}\right) \]
\log \left(\frac{1}{x} + \frac{\sqrt{1 - x \cdot x}}{x}\right)
\log \left(\frac{e^{\mathsf{log1p}\left(\sqrt{1 - x \cdot x}\right)}}{x}\right)
(FPCore (x)
 :precision binary64
 (log (+ (/ 1.0 x) (/ (sqrt (- 1.0 (* x x))) x))))
(FPCore (x)
 :precision binary64
 (log (/ (exp (log1p (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(exp(log1p(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.0

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

    \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\log \left(\frac{1}{x} + \frac{\sqrt{1 - x \cdot x}}{x}\right)\right)\right)} \]
  3. Simplified1.1

    \[\leadsto \mathsf{expm1}\left(\color{blue}{\mathsf{log1p}\left(\mathsf{log1p}\left(\sqrt{1 - x \cdot x}\right) + \left(-\log x\right)\right)}\right) \]
  4. Applied add-log-exp_binary641.1

    \[\leadsto \color{blue}{\log \left(e^{\mathsf{expm1}\left(\mathsf{log1p}\left(\mathsf{log1p}\left(\sqrt{1 - x \cdot x}\right) + \left(-\log x\right)\right)\right)}\right)} \]
  5. Simplified0.0

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

    \[\leadsto \log \left(\frac{e^{\mathsf{log1p}\left(\sqrt{1 - x \cdot x}\right)}}{x}\right) \]

Reproduce

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