\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}
\mathbf{if}\;{\sin kx}^{2} + {\sin ky}^{2} \leq 1.976262583365 \cdot 10^{-323}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\sqrt{0.5 + \sqrt{0.5} \cdot \frac{\sqrt{0.5}}{\sqrt{1 + \left({\sin kx}^{2} + {\sin ky}^{2}\right) \cdot {\left(\frac{2 \cdot \ell}{Om}\right)}^{2}}}}\\
\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
(if (<= (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)) 1.976262583365e-323)
1.0
(sqrt
(+
0.5
(*
(sqrt 0.5)
(/
(sqrt 0.5)
(sqrt
(+
1.0
(*
(+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))
(pow (/ (* 2.0 l) Om) 2.0))))))))))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 tmp;
if ((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)) <= 1.976262583365e-323) {
tmp = 1.0;
} else {
tmp = sqrt(0.5 + (sqrt(0.5) * (sqrt(0.5) / sqrt(1.0 + ((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)) * pow(((2.0 * l) / Om), 2.0))))));
}
return tmp;
}



Bits error versus l



Bits error versus Om



Bits error versus kx



Bits error versus ky
Results
if (+.f64 (pow.f64 (sin.f64 kx) 2) (pow.f64 (sin.f64 ky) 2)) < 1.97626e-323Initial program 18.5
Simplified18.5
Taylor expanded around 0 12.6
if 1.97626e-323 < (+.f64 (pow.f64 (sin.f64 kx) 2) (pow.f64 (sin.f64 ky) 2)) Initial program 0.0
Simplified0.0
rmApplied *-un-lft-identity_binary640.0
Applied sqrt-prod_binary640.0
Applied add-sqr-sqrt_binary640.0
Applied times-frac_binary640.0
Simplified0.0
Final simplification0.7
herbie shell --seed 2020253
(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))))))))))