\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th
\begin{array}{l}
t_1 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
\mathbf{if}\;t_1 \leq 0.9987692522295748:\\
\;\;\;\;t_1 \cdot \sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin ky + 0.5 \cdot \frac{kx \cdot kx}{\sin ky}}\\
\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
(let* ((t_1 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))))
(if (<= t_1 0.9987692522295748)
(* t_1 (sin th))
(* (sin th) (/ (sin ky) (+ (sin ky) (* 0.5 (/ (* kx kx) (sin ky)))))))))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 t_1 = sin(ky) / sqrt(pow(sin(kx), 2.0) + pow(sin(ky), 2.0));
double tmp;
if (t_1 <= 0.9987692522295748) {
tmp = t_1 * sin(th);
} else {
tmp = sin(th) * (sin(ky) / (sin(ky) + (0.5 * ((kx * kx) / sin(ky)))));
}
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.9987692522295748Initial program 2.9
rmApplied add-cube-cbrt_binary643.3
Applied unpow-prod-down_binary643.3
Simplified3.3
rmApplied *-un-lft-identity_binary643.3
Applied sqrt-prod_binary643.3
Simplified3.3
Simplified2.9
if 0.9987692522295748 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) 2) (pow.f64 (sin.f64 ky) 2)))) Initial program 8.5
Taylor expanded around 0 4.6
Simplified4.6
Final simplification3.2
herbie shell --seed 2021198
(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)))