\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}}} \leq 0.9999999999926855:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\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))))
0.9999999999926855)
(* (sin ky) (/ (sin th) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))))
(sin th)))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))) <= 0.9999999999926855) {
tmp = sin(ky) * (sin(th) / sqrt(pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
} else {
tmp = sin(th);
}
return tmp;
}



Bits error versus kx



Bits error versus ky



Bits error versus th
Results
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) 2) (pow.f64 (sin.f64 ky) 2)))) < 0.999999999992685518Initial program 2.6
rmApplied div-inv_binary64_752.7
Applied associate-*l*_binary64_192.7
Simplified2.6
if 0.999999999992685518 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) 2) (pow.f64 (sin.f64 ky) 2)))) Initial program 9.3
Taylor expanded around 0 4.3
Final simplification3.0
herbie shell --seed 2021058
(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)))