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



Bits error versus kx



Bits error versus ky



Bits error versus th
Results
if (*.f64 (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) 2) (pow.f64 (sin.f64 ky) 2)))) (sin.f64 th)) < -inf.0Initial program 64.0
rmApplied *-un-lft-identity_binary6464.0
Applied associate-*l*_binary6464.0
Simplified64.0
Taylor expanded around 0 40.8
if -inf.0 < (*.f64 (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) 2) (pow.f64 (sin.f64 ky) 2)))) (sin.f64 th)) Initial program 2.2
rmApplied *-un-lft-identity_binary642.2
Final simplification3.3
herbie shell --seed 2021175
(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)))