(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 (hypot (sin kx) (sin ky))))
(if (<= (pow (/ (* 2.0 l) Om) 2.0) 7.806038052058949e+237)
(sqrt
(+
0.5
(sqrt (/ 0.25 (fma (* 4.0 (pow (/ l Om) 2.0)) (pow t_0 2.0) 1.0)))))
(sqrt
(+
0.5
(/
0.5
(fma
0.5
(*
Om
(sqrt
(/ 0.25 (* (* l l) (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))))
(/ (sqrt (* 4.0 (exp (log (pow (* l t_0) 2.0))))) 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 t_0 = hypot(sin(kx), sin(ky));
double tmp;
if (pow(((2.0 * l) / Om), 2.0) <= 7.806038052058949e+237) {
tmp = sqrt((0.5 + sqrt((0.25 / fma((4.0 * pow((l / Om), 2.0)), pow(t_0, 2.0), 1.0)))));
} else {
tmp = sqrt((0.5 + (0.5 / fma(0.5, (Om * sqrt((0.25 / ((l * l) * (pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))))), (sqrt((4.0 * exp(log(pow((l * t_0), 2.0))))) / Om)))));
}
return tmp;
}
function code(l, Om, kx, ky) return sqrt(Float64(Float64(1.0 / 2.0) * Float64(1.0 + Float64(1.0 / sqrt(Float64(1.0 + Float64((Float64(Float64(2.0 * l) / Om) ^ 2.0) * Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0))))))))) end
function code(l, Om, kx, ky) t_0 = hypot(sin(kx), sin(ky)) tmp = 0.0 if ((Float64(Float64(2.0 * l) / Om) ^ 2.0) <= 7.806038052058949e+237) tmp = sqrt(Float64(0.5 + sqrt(Float64(0.25 / fma(Float64(4.0 * (Float64(l / Om) ^ 2.0)), (t_0 ^ 2.0), 1.0))))); else tmp = sqrt(Float64(0.5 + Float64(0.5 / fma(0.5, Float64(Om * sqrt(Float64(0.25 / Float64(Float64(l * l) * Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))))), Float64(sqrt(Float64(4.0 * exp(log((Float64(l * t_0) ^ 2.0))))) / Om))))); end return tmp end
code[l_, Om_, kx_, ky_] := N[Sqrt[N[(N[(1.0 / 2.0), $MachinePrecision] * N[(1.0 + N[(1.0 / N[Sqrt[N[(1.0 + N[(N[Power[N[(N[(2.0 * l), $MachinePrecision] / Om), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
code[l_, Om_, kx_, ky_] := Block[{t$95$0 = N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision]}, If[LessEqual[N[Power[N[(N[(2.0 * l), $MachinePrecision] / Om), $MachinePrecision], 2.0], $MachinePrecision], 7.806038052058949e+237], N[Sqrt[N[(0.5 + N[Sqrt[N[(0.25 / N[(N[(4.0 * N[Power[N[(l / Om), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[Power[t$95$0, 2.0], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Sqrt[N[(0.5 + N[(0.5 / N[(0.5 * N[(Om * N[Sqrt[N[(0.25 / N[(N[(l * l), $MachinePrecision] * N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(4.0 * N[Exp[N[Log[N[Power[N[(l * t$95$0), $MachinePrecision], 2.0], $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Om), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\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 := \mathsf{hypot}\left(\sin kx, \sin ky\right)\\
\mathbf{if}\;{\left(\frac{2 \cdot \ell}{Om}\right)}^{2} \leq 7.806038052058949 \cdot 10^{+237}:\\
\;\;\;\;\sqrt{0.5 + \sqrt{\frac{0.25}{\mathsf{fma}\left(4 \cdot {\left(\frac{\ell}{Om}\right)}^{2}, {t_0}^{2}, 1\right)}}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{0.5 + \frac{0.5}{\mathsf{fma}\left(0.5, Om \cdot \sqrt{\frac{0.25}{\left(\ell \cdot \ell\right) \cdot \left({\sin kx}^{2} + {\sin ky}^{2}\right)}}, \frac{\sqrt{4 \cdot e^{\log \left({\left(\ell \cdot t_0\right)}^{2}\right)}}}{Om}\right)}}\\
\end{array}



Bits error versus l



Bits error versus Om



Bits error versus kx



Bits error versus ky
if (pow.f64 (/.f64 (*.f64 2 l) Om) 2) < 7.8060380520589492e237Initial program 0.0
Simplified0.0
Applied egg-rr0.0
if 7.8060380520589492e237 < (pow.f64 (/.f64 (*.f64 2 l) Om) 2) Initial program 3.0
Simplified3.0
Taylor expanded in Om around 0 14.5
Simplified2.5
Applied egg-rr2.5
Final simplification0.8
herbie shell --seed 2022150
(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))))))))))