\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}:\\
\;\;\;\;\frac{\sin ky}{\left(ky + \frac{1}{12} \cdot \left({kx}^{2} \cdot ky\right)\right) - \frac{1}{6} \cdot {ky}^{3}} \cdot \sin th\\
\end{array}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 VAR;
if (((sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) <= 1.0)) {
VAR = (sin(ky) * (sin(th) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))));
} else {
VAR = ((sin(ky) / ((ky + (0.08333333333333333 * (pow(kx, 2.0) * ky))) - (0.16666666666666666 * pow(ky, 3.0)))) * 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)))) < 1.0Initial program 2.3
rmApplied div-inv2.4
Applied associate-*l*2.5
Simplified2.4
if 1.0 < (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) Initial program 63.4
Taylor expanded around 0 30.0
Final simplification3.2
herbie shell --seed 2020102
(FPCore (kx ky th)
:name "Toniolo and Linder, Equation (3b), real"
:precision binary64
(* (/ (sin ky) (sqrt (+ (pow (sin kx) 2) (pow (sin ky) 2)))) (sin th)))