\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}}} \leq 1:\\
\;\;\;\;\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\left(ky + 0.08333333333333333 \cdot \left(ky \cdot \left(kx \cdot kx\right)\right)\right) - 0.16666666666666666 \cdot {ky}^{3}}\\
\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)))) 1.0)
(* (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) (sin th))
(*
(sin th)
(/
(sin ky)
(-
(+ ky (* 0.08333333333333333 (* ky (* kx kx))))
(* 0.16666666666666666 (pow ky 3.0)))))))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))) <= 1.0) {
tmp = (sin(ky) / sqrt(pow(sin(kx), 2.0) + pow(sin(ky), 2.0))) * sin(th);
} else {
tmp = sin(th) * (sin(ky) / ((ky + (0.08333333333333333 * (ky * (kx * kx)))) - (0.16666666666666666 * pow(ky, 3.0))));
}
return tmp;
}






Bits error versus kx






Bits error versus ky






Bits error versus th
Results
| Alternative 1 | |
|---|---|
| Accuracy | 3.8 |
| Cost | 1024 |
| Alternative 2 | |
|---|---|
| Accuracy | 4.4 |
| Cost | 1472 |
| Alternative 3 | |
|---|---|
| Accuracy | 33.7 |
| Cost | 2048 |
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) 2) (pow.f64 (sin.f64 ky) 2)))) < 1Initial program 2.0
rmApplied *-un-lft-identity_binary64_782.0
Applied sqrt-prod_binary64_942.0
Applied *-un-lft-identity_binary64_782.0
Applied times-frac_binary64_842.0
Applied associate-*l*_binary64_192.0
rmApplied pow1_binary64_1392.0
if 1 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) 2) (pow.f64 (sin.f64 ky) 2)))) Initial program 63.7
rmApplied *-un-lft-identity_binary64_7863.7
Applied sqrt-prod_binary64_9463.7
Applied *-un-lft-identity_binary64_7863.7
Applied times-frac_binary64_8463.7
Applied associate-*l*_binary64_1963.7
Taylor expanded around 0 32.7
Simplified32.7
Final simplification2.9
herbie shell --seed 2020322
(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)))