\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th\begin{array}{l}
\mathbf{if}\;\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \leq 0.998611566993125:\\
\;\;\;\;\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\
\end{array}(FPCore (kx ky th) :precision binary64 (* (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) (sin th)))
(FPCore (kx ky th)
:precision binary64
(if (<=
(*
(/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))
(sin th))
0.998611566993125)
(* (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) (sin th))
(* (sin ky) (/ (sin th) (sin kx)))))double code(double kx, double ky, double th) {
return (sin(ky) / sqrt(pow(sin(kx), 2.0) + pow(sin(ky), 2.0))) * sin(th);
}
double code(double kx, double ky, double th) {
double tmp;
if (((sin(ky) / sqrt(pow(sin(kx), 2.0) + pow(sin(ky), 2.0))) * sin(th)) <= 0.998611566993125) {
tmp = (sin(ky) / sqrt(pow(sin(kx), 2.0) + pow(sin(ky), 2.0))) * sin(th);
} else {
tmp = sin(ky) * (sin(th) / sin(kx));
}
return tmp;
}



Bits error versus kx



Bits error versus ky



Bits error versus th
Results
if (*.f64 (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) 2) (pow.f64 (sin.f64 ky) 2)))) (sin.f64 th)) < 0.99861156699312503Initial program 2.2
if 0.99861156699312503 < (*.f64 (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) 2) (pow.f64 (sin.f64 ky) 2)))) (sin.f64 th)) Initial program 58.3
rmApplied div-inv_binary64_7558.3
Applied associate-*l*_binary64_1958.3
Simplified58.3
Taylor expanded around 0 46.5
Final simplification3.6
herbie shell --seed 2021013
(FPCore (kx ky th)
:name "Toniolo and Linder, Equation (3b), real"
:precision binary64
(* (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) (sin th)))