\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 := {\left(\frac{2 \cdot \ell}{Om}\right)}^{2}\\
t_1 := {\sin kx}^{2}\\
t_2 := {\sin ky}^{2}\\
t_3 := t_1 + t_2\\
\mathbf{if}\;t_0 \cdot t_3 \leq \infty:\\
\;\;\;\;\sqrt{0.5 + \frac{0.5}{\sqrt[3]{{\left(\sqrt{\mathsf{fma}\left(t_0, t_3, 1\right)}\right)}^{3}}}}\\
\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_4 := \frac{t_2}{Om \cdot Om} + \frac{t_1}{Om \cdot Om}\\
\sqrt{0.5 + \frac{0.5}{\mathsf{fma}\left(\ell, \sqrt{4 \cdot t_4}, 0.5 \cdot \frac{\sqrt{\frac{0.25}{t_4}}}{\ell}\right)}}
\end{array}\\
\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 (/ (* 2.0 l) Om) 2.0))
(t_1 (pow (sin kx) 2.0))
(t_2 (pow (sin ky) 2.0))
(t_3 (+ t_1 t_2)))
(if (<= (* t_0 t_3) INFINITY)
(sqrt (+ 0.5 (/ 0.5 (cbrt (pow (sqrt (fma t_0 t_3 1.0)) 3.0)))))
(let* ((t_4 (+ (/ t_2 (* Om Om)) (/ t_1 (* Om Om)))))
(sqrt
(+
0.5
(/
0.5
(fma l (sqrt (* 4.0 t_4)) (* 0.5 (/ (sqrt (/ 0.25 t_4)) 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(((2.0 * l) / Om), 2.0);
double t_1 = pow(sin(kx), 2.0);
double t_2 = pow(sin(ky), 2.0);
double t_3 = t_1 + t_2;
double tmp;
if ((t_0 * t_3) <= ((double) INFINITY)) {
tmp = sqrt(0.5 + (0.5 / cbrt(pow(sqrt(fma(t_0, t_3, 1.0)), 3.0))));
} else {
double t_4 = (t_2 / (Om * Om)) + (t_1 / (Om * Om));
tmp = sqrt(0.5 + (0.5 / fma(l, sqrt(4.0 * t_4), (0.5 * (sqrt(0.25 / t_4) / l)))));
}
return tmp;
}



Bits error versus l



Bits error versus Om



Bits error versus kx



Bits error versus ky
if (*.f64 (pow.f64 (/.f64 (*.f64 2 l) Om) 2) (+.f64 (pow.f64 (sin.f64 kx) 2) (pow.f64 (sin.f64 ky) 2))) < +inf.0Initial program 0.0
Simplified0.0
Applied add-cbrt-cube_binary640.0
Simplified0.0
if +inf.0 < (*.f64 (pow.f64 (/.f64 (*.f64 2 l) Om) 2) (+.f64 (pow.f64 (sin.f64 kx) 2) (pow.f64 (sin.f64 ky) 2))) Initial program 64.0
Simplified64.0
Taylor expanded in l around inf 40.7
Simplified40.7
Final simplification0.7
herbie shell --seed 2022082
(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))))))))))