\log \left(\frac{1}{x} + \frac{\sqrt{1 - x \cdot x}}{x}\right)
\log \left(\frac{1}{x} + \left(\frac{1}{x} - x \cdot 0.5\right)\right)
(FPCore (x) :precision binary64 (log (+ (/ 1.0 x) (/ (sqrt (- 1.0 (* x x))) x))))
(FPCore (x) :precision binary64 (log (+ (/ 1.0 x) (- (/ 1.0 x) (* x 0.5)))))
double code(double x) {
return log((1.0 / x) + (sqrt(1.0 - (x * x)) / x));
}
double code(double x) {
return log((1.0 / x) + ((1.0 / x) - (x * 0.5)));
}



Bits error versus x
Results
Initial program 0.0
Taylor expanded around 0 0.4
Simplified0.4
Final simplification0.4
herbie shell --seed 2021196
(FPCore (x)
:name "Hyperbolic arc-(co)secant"
:precision binary64
(log (+ (/ 1.0 x) (/ (sqrt (- 1.0 (* x x))) x))))