\frac{\sin ky}{\sqrt{{\left(\sin kx\right)}^{2} + {\left(\sin ky\right)}^{2}}} \cdot \sin th\begin{array}{l}
\mathbf{if}\;\frac{\sin ky}{\sqrt{{\left(\sin kx\right)}^{2} + {\left(\sin ky\right)}^{2}}} \le 1:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sqrt{{\left(\sin kx\right)}^{2} + {\left(\sin ky\right)}^{2}}}\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{ky + \left(kx \cdot \left(kx \cdot \left(ky \cdot \frac{1}{12}\right)\right) + {ky}^{3} \cdot \frac{-1}{6}\right)}\\
\end{array}double code(double kx, double ky, double th) {
return ((double) (((double) (((double) sin(ky)) / ((double) sqrt(((double) (((double) pow(((double) sin(kx)), 2.0)) + ((double) pow(((double) sin(ky)), 2.0)))))))) * ((double) sin(th))));
}
double code(double kx, double ky, double th) {
double VAR;
if ((((double) (((double) sin(ky)) / ((double) sqrt(((double) (((double) pow(((double) sin(kx)), 2.0)) + ((double) pow(((double) sin(ky)), 2.0)))))))) <= 1.0)) {
VAR = ((double) (((double) sin(ky)) * ((double) (((double) sin(th)) / ((double) sqrt(((double) (((double) pow(((double) sin(kx)), 2.0)) + ((double) pow(((double) sin(ky)), 2.0))))))))));
} else {
VAR = ((double) (((double) sin(th)) * ((double) (((double) sin(ky)) / ((double) (ky + ((double) (((double) (kx * ((double) (kx * ((double) (ky * 0.08333333333333333)))))) + ((double) (((double) pow(ky, 3.0)) * -0.16666666666666666))))))))));
}
return VAR;
}



Bits error versus kx



Bits error versus ky



Bits error versus th
Results
if (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) < 1Initial program 2.2
Simplified2.3
if 1 < (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) Initial program 63.3
Taylor expanded around 0 30.8
Simplified30.8
Final simplification3.1
herbie shell --seed 2020184
(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)))