\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}\;{\left(\frac{2 \cdot \ell}{Om}\right)}^{2} \leq 3.543223448247394 \cdot 10^{+157}:\\
\;\;\;\;\sqrt{0.5 \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)}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{0.5 + \frac{0.5}{1 + 2 \cdot \left(\frac{\ell \cdot \ell}{Om} \cdot \left(\frac{ky \cdot ky}{Om} + \sin kx \cdot \frac{\sin kx}{Om}\right)\right)}}\\
\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 (/ (* 2.0 l) Om) 2.0) 3.543223448247394e+157)
(sqrt
(*
0.5
(+
1.0
(/
1.0
(sqrt
(+
1.0
(*
(pow (/ (* 2.0 l) Om) 2.0)
(+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))))))))
(sqrt
(+
0.5
(/
0.5
(+
1.0
(*
2.0
(*
(/ (* l l) Om)
(+ (/ (* ky ky) Om) (* (sin kx) (/ (sin kx) Om)))))))))))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(((2.0 * l) / Om), 2.0) <= 3.543223448247394e+157) {
tmp = sqrt(0.5 * (1.0 + (1.0 / sqrt(1.0 + (pow(((2.0 * l) / Om), 2.0) * (pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))))));
} else {
tmp = sqrt(0.5 + (0.5 / (1.0 + (2.0 * (((l * l) / Om) * (((ky * ky) / Om) + (sin(kx) * (sin(kx) / Om))))))));
}
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) < 3.5432234482473943e157Initial program 0.0
if 3.5432234482473943e157 < (pow.f64 (/.f64 (*.f64 2 l) Om) 2) Initial program 2.9
Simplified2.9
Taylor expanded around 0 24.3
Simplified3.9
rmApplied *-un-lft-identity_binary643.9
Applied add-sqr-sqrt_binary6433.7
Applied unpow-prod-down_binary6433.7
Applied times-frac_binary6433.0
Simplified33.0
Simplified2.6
Taylor expanded around 0 2.7
Simplified2.7
Final simplification1.0
herbie shell --seed 2021118
(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))))))))))