Average Error: 0.0 → 0.0
Time: 2.4s
Precision: binary64
\[\log \left(\frac{1}{x} + \frac{\sqrt{1 - x \cdot x}}{x}\right) \]
\[\begin{array}{l} t_0 := \sqrt{1 - x \cdot x}\\ \log \left(\frac{\sqrt{\mathsf{fma}\left(x, t_0, x\right)}}{x}\right) + \log \left(\sqrt{\frac{1}{x} + \frac{t_0}{x}}\right) \end{array} \]
(FPCore (x)
 :precision binary64
 (log (+ (/ 1.0 x) (/ (sqrt (- 1.0 (* x x))) x))))
(FPCore (x)
 :precision binary64
 (let* ((t_0 (sqrt (- 1.0 (* x x)))))
   (+ (log (/ (sqrt (fma x t_0 x)) x)) (log (sqrt (+ (/ 1.0 x) (/ t_0 x)))))))
double code(double x) {
	return log(((1.0 / x) + (sqrt((1.0 - (x * x))) / x)));
}
double code(double x) {
	double t_0 = sqrt((1.0 - (x * x)));
	return log((sqrt(fma(x, t_0, x)) / x)) + log(sqrt(((1.0 / x) + (t_0 / x))));
}
function code(x)
	return log(Float64(Float64(1.0 / x) + Float64(sqrt(Float64(1.0 - Float64(x * x))) / x)))
end
function code(x)
	t_0 = sqrt(Float64(1.0 - Float64(x * x)))
	return Float64(log(Float64(sqrt(fma(x, t_0, x)) / x)) + log(sqrt(Float64(Float64(1.0 / x) + Float64(t_0 / x)))))
end
code[x_] := N[Log[N[(N[(1.0 / x), $MachinePrecision] + N[(N[Sqrt[N[(1.0 - N[(x * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
code[x_] := Block[{t$95$0 = N[Sqrt[N[(1.0 - N[(x * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, N[(N[Log[N[(N[Sqrt[N[(x * t$95$0 + x), $MachinePrecision]], $MachinePrecision] / x), $MachinePrecision]], $MachinePrecision] + N[Log[N[Sqrt[N[(N[(1.0 / x), $MachinePrecision] + N[(t$95$0 / x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\log \left(\frac{1}{x} + \frac{\sqrt{1 - x \cdot x}}{x}\right)
\begin{array}{l}
t_0 := \sqrt{1 - x \cdot x}\\
\log \left(\frac{\sqrt{\mathsf{fma}\left(x, t_0, x\right)}}{x}\right) + \log \left(\sqrt{\frac{1}{x} + \frac{t_0}{x}}\right)
\end{array}

Error

Bits error versus x

Derivation

  1. Initial program 0.0

    \[\log \left(\frac{1}{x} + \frac{\sqrt{1 - x \cdot x}}{x}\right) \]
  2. Applied add-sqr-sqrt_binary640.0

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

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

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

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

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

    \[\leadsto \log \left(\frac{\sqrt{\mathsf{fma}\left(x, \sqrt{1 - x \cdot x}, x\right)}}{\color{blue}{x}}\right) + \log \left(\sqrt{\frac{1}{x} + \frac{\sqrt{1 - x \cdot x}}{x}}\right) \]
  8. Final simplification0.0

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

Reproduce

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