\[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th
\]
↓
\[\frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)} \cdot \sin th
\]
(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
(* (/ (sin ky) (hypot (sin ky) (sin kx))) (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) {
return (sin(ky) / hypot(sin(ky), sin(kx))) * sin(th);
}
public static double code(double kx, double ky, double th) {
return (Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) * Math.sin(th);
}
↓
public static double code(double kx, double ky, double th) {
return (Math.sin(ky) / Math.hypot(Math.sin(ky), Math.sin(kx))) * Math.sin(th);
}
def code(kx, ky, th):
return (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) * math.sin(th)
↓
def code(kx, ky, th):
return (math.sin(ky) / math.hypot(math.sin(ky), math.sin(kx))) * math.sin(th)
function code(kx, ky, th)
return Float64(Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th))
end
↓
function code(kx, ky, th)
return Float64(Float64(sin(ky) / hypot(sin(ky), sin(kx))) * sin(th))
end
function tmp = code(kx, ky, th)
tmp = (sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th);
end
↓
function tmp = code(kx, ky, th)
tmp = (sin(ky) / hypot(sin(ky), sin(kx))) * sin(th);
end
code[kx_, ky_, th_] := N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
↓
code[kx_, ky_, th_] := N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th
↓
\frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)} \cdot \sin th
Alternatives
| Alternative 1 |
|---|
| Error | 34.88% |
|---|
| Cost | 52048 |
|---|
\[\begin{array}{l}
\mathbf{if}\;\sin th \leq -0.174:\\
\;\;\;\;\left|\frac{\sin th}{\frac{\sin kx}{\sin ky}}\right|\\
\mathbf{elif}\;\sin th \leq 0.02:\\
\;\;\;\;\frac{\sin ky}{\frac{\mathsf{hypot}\left(\sin kx, \sin ky\right)}{th}}\\
\mathbf{elif}\;\sin th \leq 0.73:\\
\;\;\;\;\sin ky \cdot \left|\frac{\sin th}{\sin kx}\right|\\
\mathbf{elif}\;\sin th \leq 0.8:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin ky}{\left|\frac{\sin kx}{\sin th}\right|}\\
\end{array}
\]
| Alternative 2 |
|---|
| Error | 24.02% |
|---|
| Cost | 45580 |
|---|
\[\begin{array}{l}
t_1 := \frac{\sin ky}{\frac{\mathsf{hypot}\left(\sin kx, \sin ky\right)}{th}}\\
\mathbf{if}\;\sin ky \leq -0.01:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-12}:\\
\;\;\;\;\frac{\sin th}{\frac{\mathsf{hypot}\left(\sin ky, \sin kx\right)}{ky}}\\
\mathbf{elif}\;\sin ky \leq 0.98:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
| Alternative 3 |
|---|
| Error | 24% |
|---|
| Cost | 45580 |
|---|
\[\begin{array}{l}
t_1 := \mathsf{hypot}\left(\sin ky, \sin kx\right)\\
\mathbf{if}\;\sin ky \leq -0.01:\\
\;\;\;\;\frac{\sin ky \cdot th}{t_1}\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-12}:\\
\;\;\;\;\frac{\sin th}{\frac{t_1}{ky}}\\
\mathbf{elif}\;\sin ky \leq 0.98:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin ky}{\frac{\mathsf{hypot}\left(\sin kx, \sin ky\right)}{th}}\\
\end{array}
\]
| Alternative 4 |
|---|
| Error | 23.97% |
|---|
| Cost | 45580 |
|---|
\[\begin{array}{l}
t_1 := \mathsf{hypot}\left(\sin ky, \sin kx\right)\\
\mathbf{if}\;\sin ky \leq -0.01:\\
\;\;\;\;\frac{\sin ky \cdot th}{t_1}\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-12}:\\
\;\;\;\;\frac{\frac{\sin th}{t_1}}{ky \cdot 0.16666666666666666 + \frac{1}{ky}}\\
\mathbf{elif}\;\sin ky \leq 0.98:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin ky}{\frac{\mathsf{hypot}\left(\sin kx, \sin ky\right)}{th}}\\
\end{array}
\]
| Alternative 5 |
|---|
| Error | 52.94% |
|---|
| Cost | 45516 |
|---|
\[\begin{array}{l}
\mathbf{if}\;\sin ky \leq -1 \cdot 10^{-7}:\\
\;\;\;\;\left|\frac{\sin th}{\frac{\sin kx}{\sin ky}}\right|\\
\mathbf{elif}\;\sin ky \leq -1 \cdot 10^{-295}:\\
\;\;\;\;\frac{ky}{\left|\frac{\sin kx}{\sin th}\right|}\\
\mathbf{elif}\;\sin ky \leq 0.01:\\
\;\;\;\;\sin th \cdot \left|\frac{\sin ky}{\sin kx}\right|\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\]
| Alternative 6 |
|---|
| Error | 52.94% |
|---|
| Cost | 45516 |
|---|
\[\begin{array}{l}
\mathbf{if}\;\sin ky \leq -1 \cdot 10^{-7}:\\
\;\;\;\;\left|\frac{\sin th}{\frac{\sin kx}{\sin ky}}\right|\\
\mathbf{elif}\;\sin ky \leq -1 \cdot 10^{-295}:\\
\;\;\;\;\sin ky \cdot \left|\frac{\sin th}{\sin kx}\right|\\
\mathbf{elif}\;\sin ky \leq 0.01:\\
\;\;\;\;\sin th \cdot \left|\frac{\sin ky}{\sin kx}\right|\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\]
| Alternative 7 |
|---|
| Error | 53.45% |
|---|
| Cost | 39116 |
|---|
\[\begin{array}{l}
\mathbf{if}\;\sin ky \leq -1 \cdot 10^{-7}:\\
\;\;\;\;\left|\frac{\sin ky}{\frac{\sin kx}{th}}\right|\\
\mathbf{elif}\;\sin ky \leq -1 \cdot 10^{-295}:\\
\;\;\;\;\frac{ky}{\left|\frac{\sin kx}{\sin th}\right|}\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-15}:\\
\;\;\;\;\sin th \cdot \left|\frac{ky}{\sin kx}\right|\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\]
| Alternative 8 |
|---|
| Error | 52.79% |
|---|
| Cost | 39116 |
|---|
\[\begin{array}{l}
\mathbf{if}\;\sin ky \leq -1 \cdot 10^{-7}:\\
\;\;\;\;\left|\sin th \cdot \frac{\sin ky}{\sin kx}\right|\\
\mathbf{elif}\;\sin ky \leq -1 \cdot 10^{-295}:\\
\;\;\;\;\frac{ky}{\left|\frac{\sin kx}{\sin th}\right|}\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-15}:\\
\;\;\;\;\sin th \cdot \left|\frac{ky}{\sin kx}\right|\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\]
| Alternative 9 |
|---|
| Error | 52.79% |
|---|
| Cost | 39116 |
|---|
\[\begin{array}{l}
\mathbf{if}\;\sin ky \leq -1 \cdot 10^{-7}:\\
\;\;\;\;\left|\frac{\sin th}{\frac{\sin kx}{\sin ky}}\right|\\
\mathbf{elif}\;\sin ky \leq -1 \cdot 10^{-295}:\\
\;\;\;\;\frac{ky}{\left|\frac{\sin kx}{\sin th}\right|}\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-15}:\\
\;\;\;\;\sin th \cdot \left|\frac{ky}{\sin kx}\right|\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\]
| Alternative 10 |
|---|
| Error | 53.74% |
|---|
| Cost | 32584 |
|---|
\[\begin{array}{l}
\mathbf{if}\;\sin ky \leq -1 \cdot 10^{-295}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-15}:\\
\;\;\;\;\sin th \cdot \left|\frac{ky}{\sin kx}\right|\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\]
| Alternative 11 |
|---|
| Error | 52.49% |
|---|
| Cost | 32584 |
|---|
\[\begin{array}{l}
\mathbf{if}\;\sin ky \leq -1 \cdot 10^{-295}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-15}:\\
\;\;\;\;\sin th \cdot \left|\frac{ky}{\sin kx}\right|\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\]
| Alternative 12 |
|---|
| Error | 69.33% |
|---|
| Cost | 26316 |
|---|
\[\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.02:\\
\;\;\;\;ky \cdot \frac{\sin th}{kx}\\
\mathbf{elif}\;\sin kx \leq 5 \cdot 10^{-168}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;\sin kx \leq 0.34:\\
\;\;\;\;\frac{ky}{\frac{kx}{\sin th}}\\
\mathbf{else}:\\
\;\;\;\;\frac{ky \cdot th}{\sin kx}\\
\end{array}
\]
| Alternative 13 |
|---|
| Error | 58.71% |
|---|
| Cost | 26312 |
|---|
\[\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.005:\\
\;\;\;\;\left|\sin th \cdot \frac{ky}{\sin kx}\right|\\
\mathbf{elif}\;\sin kx \leq 5 \cdot 10^{-168}:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\sin th}{\sin kx}}{\frac{1}{ky}}\\
\end{array}
\]
| Alternative 14 |
|---|
| Error | 59% |
|---|
| Cost | 19780 |
|---|
\[\begin{array}{l}
\mathbf{if}\;\sin ky \leq 4 \cdot 10^{-78}:\\
\;\;\;\;\frac{\frac{\sin th}{\sin kx}}{\frac{1}{ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\]
| Alternative 15 |
|---|
| Error | 59.02% |
|---|
| Cost | 19652 |
|---|
\[\begin{array}{l}
\mathbf{if}\;\sin ky \leq 4 \cdot 10^{-78}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\]
| Alternative 16 |
|---|
| Error | 58.98% |
|---|
| Cost | 19652 |
|---|
\[\begin{array}{l}
\mathbf{if}\;\sin ky \leq 4 \cdot 10^{-78}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\]
| Alternative 17 |
|---|
| Error | 66.54% |
|---|
| Cost | 6984 |
|---|
\[\begin{array}{l}
\mathbf{if}\;ky \leq -270000:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq 2.3 \cdot 10^{-78}:\\
\;\;\;\;\sin th \cdot \frac{ky}{kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\]
| Alternative 18 |
|---|
| Error | 66.54% |
|---|
| Cost | 6984 |
|---|
\[\begin{array}{l}
\mathbf{if}\;ky \leq -270000:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq 2.3 \cdot 10^{-78}:\\
\;\;\;\;ky \cdot \frac{\sin th}{kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\]
| Alternative 19 |
|---|
| Error | 66.54% |
|---|
| Cost | 6984 |
|---|
\[\begin{array}{l}
\mathbf{if}\;ky \leq -270000:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq 2.3 \cdot 10^{-78}:\\
\;\;\;\;\frac{ky}{\frac{kx}{\sin th}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\]
| Alternative 20 |
|---|
| Error | 68.55% |
|---|
| Cost | 6728 |
|---|
\[\begin{array}{l}
\mathbf{if}\;ky \leq -0.0048:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq 2.8 \cdot 10^{-166}:\\
\;\;\;\;\frac{th}{\frac{kx}{ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\]
| Alternative 21 |
|---|
| Error | 86.41% |
|---|
| Cost | 320 |
|---|
\[th \cdot \frac{ky}{kx}
\]
| Alternative 22 |
|---|
| Error | 86.39% |
|---|
| Cost | 320 |
|---|
\[\frac{th}{\frac{kx}{ky}}
\]