\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 0.999481613597028029:\\
\;\;\;\;\frac{\sin ky}{\sqrt{{\left(\sin kx\right)}^{2} + {\left(\sin ky\right)}^{2}}} \cdot \sin th\\
\mathbf{else}:\\
\;\;\;\;\left(1 - \frac{1}{6} \cdot {kx}^{2}\right) \cdot \sin th\\
\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)))))))) <= 0.999481613597028)) {
VAR = ((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))));
} else {
VAR = ((double) (((double) (1.0 - ((double) (0.16666666666666666 * ((double) pow(kx, 2.0)))))) * ((double) sin(th))));
}
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)))) < 0.999481613597028029Initial program 2.5
if 0.999481613597028029 < (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) Initial program 9.1
Taylor expanded around inf 9.5
Taylor expanded around 0 5.3
Final simplification3.0
herbie shell --seed 2020149
(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)))