\sqrt{\frac{1}{2} \cdot \left(1 + \frac{1}{\sqrt{1 + {\left(\frac{2 \cdot \ell}{Om}\right)}^{2} \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}}\right)}
\begin{array}{l}
t_0 := {\sin kx}^{2}\\
t_1 := {\sin ky}^{2}\\
t_2 := t_0 + t_1\\
t_3 := {\left(\frac{2 \cdot \ell}{Om}\right)}^{2}\\
\mathbf{if}\;t_3 \leq 2.145001788284356 \cdot 10^{+238}:\\
\;\;\;\;\begin{array}{l}
t_4 := \sqrt[3]{\sqrt{1 + t_3 \cdot t_2}}\\
\sqrt{0.5 + \frac{0.5}{t_4 \cdot \left(t_4 \cdot t_4\right)}}
\end{array}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{0.5 + \frac{0.5}{\ell \cdot \left(-2 \cdot \left(\frac{1}{Om} \cdot \sqrt{t_2}\right)\right) + 0.5 \cdot \frac{\sqrt{\frac{1}{\frac{4}{Om} \cdot \left(\frac{t_1}{Om} + \frac{t_0}{Om}\right)}}}{\ell}}}\\
\end{array}
(FPCore (l Om kx ky)
:precision binary64
(sqrt
(*
(/ 1.0 2.0)
(+
1.0
(/
1.0
(sqrt
(+
1.0
(*
(pow (/ (* 2.0 l) Om) 2.0)
(+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))))))))(FPCore (l Om kx ky)
:precision binary64
(let* ((t_0 (pow (sin kx) 2.0))
(t_1 (pow (sin ky) 2.0))
(t_2 (+ t_0 t_1))
(t_3 (pow (/ (* 2.0 l) Om) 2.0)))
(if (<= t_3 2.145001788284356e+238)
(let* ((t_4 (cbrt (sqrt (+ 1.0 (* t_3 t_2))))))
(sqrt (+ 0.5 (/ 0.5 (* t_4 (* t_4 t_4))))))
(sqrt
(+
0.5
(/
0.5
(+
(* l (* -2.0 (* (/ 1.0 Om) (sqrt t_2))))
(*
0.5
(/ (sqrt (/ 1.0 (* (/ 4.0 Om) (+ (/ t_1 Om) (/ t_0 Om))))) l)))))))))double code(double l, double Om, double kx, double ky) {
return sqrt((1.0 / 2.0) * (1.0 + (1.0 / sqrt(1.0 + (pow(((2.0 * l) / Om), 2.0) * (pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))))));
}
double code(double l, double Om, double kx, double ky) {
double t_0 = pow(sin(kx), 2.0);
double t_1 = pow(sin(ky), 2.0);
double t_2 = t_0 + t_1;
double t_3 = pow(((2.0 * l) / Om), 2.0);
double tmp;
if (t_3 <= 2.145001788284356e+238) {
double t_4_1 = cbrt(sqrt(1.0 + (t_3 * t_2)));
tmp = sqrt(0.5 + (0.5 / (t_4_1 * (t_4_1 * t_4_1))));
} else {
tmp = sqrt(0.5 + (0.5 / ((l * (-2.0 * ((1.0 / Om) * sqrt(t_2)))) + (0.5 * (sqrt(1.0 / ((4.0 / Om) * ((t_1 / Om) + (t_0 / Om)))) / l)))));
}
return tmp;
}



Bits error versus l



Bits error versus Om



Bits error versus kx



Bits error versus ky
Results
if (pow.f64 (/.f64 (*.f64 2 l) Om) 2) < 2.14500178828435595e238Initial program 0.0
Simplified0.0
rmApplied add-cube-cbrt_binary640.0
if 2.14500178828435595e238 < (pow.f64 (/.f64 (*.f64 2 l) Om) 2) Initial program 2.9
Simplified2.9
Taylor expanded around inf 14.6
Simplified1.1
Taylor expanded around -inf 1.1
Final simplification0.4
herbie shell --seed 2021196
(FPCore (l Om kx ky)
:name "Toniolo and Linder, Equation (3a)"
:precision binary64
(sqrt (* (/ 1.0 2.0) (+ 1.0 (/ 1.0 (sqrt (+ 1.0 (* (pow (/ (* 2.0 l) Om) 2.0) (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))))))))