\log \left(\frac{1}{x} + \frac{\sqrt{1 - x \cdot x}}{x}\right)
\mathsf{log1p}\left(\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 (- (log1p (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 log1p(sqrt(1.0 - (x * x))) - log(x);
}



Bits error versus x
Results
Initial program 0.0
Applied div-inv_binary640.0
Applied distribute-rgt1-in_binary640.0
Applied log-prod_binary640.2
Simplified0.2
Simplified0.2
Final simplification0.2
herbie shell --seed 2021224
(FPCore (x)
:name "Hyperbolic arc-(co)secant"
:precision binary64
(log (+ (/ 1.0 x) (/ (sqrt (- 1.0 (* x x))) x))))