\[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th
\]
↓
\[\sin ky \cdot \frac{\sin th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}
\]
(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) (/ (sin th) (hypot (sin ky) (sin kx)))))
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) * (sin(th) / hypot(sin(ky), sin(kx)));
}
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.sin(th) / Math.hypot(Math.sin(ky), Math.sin(kx)));
}
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.sin(th) / math.hypot(math.sin(ky), math.sin(kx)))
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(sin(ky) * Float64(sin(th) / hypot(sin(ky), sin(kx))))
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) * (sin(th) / hypot(sin(ky), sin(kx)));
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[Sin[ky], $MachinePrecision] * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th
↓
\sin ky \cdot \frac{\sin th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}
Alternatives
| Alternative 1 |
|---|
| Error | 36.9 |
|---|
| Cost | 52308 |
|---|
\[\begin{array}{l}
t_1 := \sin th \cdot \sin ky\\
t_2 := \frac{t_1}{\sin ky}\\
\mathbf{if}\;\sin kx \leq -0.01:\\
\;\;\;\;\frac{th \cdot ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{elif}\;\sin kx \leq -1 \cdot 10^{-66}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\sin kx \leq -5 \cdot 10^{-86}:\\
\;\;\;\;\frac{\left|t_1\right|}{kx}\\
\mathbf{elif}\;\sin kx \leq 10^{-251}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;\sin kx \leq 0.005:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \left(\sin ky \cdot \frac{1}{\sin kx}\right)\\
\end{array}
\]
| Alternative 2 |
|---|
| Error | 36.9 |
|---|
| Cost | 52180 |
|---|
\[\begin{array}{l}
t_1 := \sin th \cdot \sin ky\\
t_2 := \frac{t_1}{\sin ky}\\
\mathbf{if}\;\sin kx \leq -0.01:\\
\;\;\;\;\frac{th \cdot ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{elif}\;\sin kx \leq -1 \cdot 10^{-66}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\sin kx \leq -5 \cdot 10^{-86}:\\
\;\;\;\;\frac{\left|t_1\right|}{kx}\\
\mathbf{elif}\;\sin kx \leq 10^{-251}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;\sin kx \leq 0.005:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\
\end{array}
\]
| Alternative 3 |
|---|
| Error | 17.2 |
|---|
| Cost | 39048 |
|---|
\[\begin{array}{l}
t_1 := \mathsf{hypot}\left(\sin ky, \sin kx\right)\\
\mathbf{if}\;\sin ky \leq -0.02:\\
\;\;\;\;th \cdot \frac{\sin ky}{t_1}\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-11}:\\
\;\;\;\;\frac{\sin th \cdot ky}{t_1}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\]
| Alternative 4 |
|---|
| Error | 17.2 |
|---|
| Cost | 39048 |
|---|
\[\begin{array}{l}
t_1 := \mathsf{hypot}\left(\sin ky, \sin kx\right)\\
\mathbf{if}\;\sin ky \leq -0.02:\\
\;\;\;\;\frac{\sin ky}{t_1 \cdot \left(\frac{1}{th} + th \cdot 0.16666666666666666\right)}\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-11}:\\
\;\;\;\;\frac{\sin th \cdot ky}{t_1}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\]
| Alternative 5 |
|---|
| Error | 38.4 |
|---|
| Cost | 32716 |
|---|
\[\begin{array}{l}
t_1 := \frac{\sin th}{\sin kx}\\
\mathbf{if}\;\sin ky \leq 5 \cdot 10^{-128}:\\
\;\;\;\;\frac{t_1}{ky \cdot 0.16666666666666666 + \frac{1}{ky}}\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-68}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-11}:\\
\;\;\;\;ky \cdot t_1\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\]
| Alternative 6 |
|---|
| Error | 37.9 |
|---|
| Cost | 32716 |
|---|
\[\begin{array}{l}
\mathbf{if}\;\sin ky \leq 5 \cdot 10^{-128}:\\
\;\;\;\;\sin th \cdot \frac{\sin ky}{\sin kx}\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-68}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-11}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\]
| Alternative 7 |
|---|
| Error | 0.2 |
|---|
| Cost | 32384 |
|---|
\[\sin th \cdot \frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}
\]
| Alternative 8 |
|---|
| Error | 34.5 |
|---|
| Cost | 26845 |
|---|
\[\begin{array}{l}
t_1 := \frac{\sin ky}{\sin kx}\\
\mathbf{if}\;ky \leq -45000:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq -1 \cdot 10^{-82}:\\
\;\;\;\;\frac{th \cdot ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{elif}\;ky \leq -2.2 \cdot 10^{-137}:\\
\;\;\;\;\left|\sin th \cdot t_1\right|\\
\mathbf{elif}\;ky \leq -1.3 \cdot 10^{-283}:\\
\;\;\;\;\frac{\sin th \cdot ky}{\sin kx}\\
\mathbf{elif}\;ky \leq 5.4 \cdot 10^{-90} \lor \neg \left(ky \leq 2.4 \cdot 10^{-68}\right) \land ky \leq 1.65 \cdot 10^{-7}:\\
\;\;\;\;\sin th \cdot \left|t_1\right|\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\]
| Alternative 9 |
|---|
| Error | 24.8 |
|---|
| Cost | 26248 |
|---|
\[\begin{array}{l}
\mathbf{if}\;th \leq -2400000:\\
\;\;\;\;\sin th \cdot \left|\frac{\sin ky}{\sin kx}\right|\\
\mathbf{elif}\;th \leq 0.000375:\\
\;\;\;\;\sin ky \cdot \frac{th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{elif}\;th \leq 3.7 \cdot 10^{+131}:\\
\;\;\;\;\frac{\sin ky}{\frac{\sin ky}{\sin th}}\\
\mathbf{elif}\;th \leq 7 \cdot 10^{+281}:\\
\;\;\;\;\sin th \cdot \left(\sin ky \cdot \frac{1}{\sin kx}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\]
| Alternative 10 |
|---|
| Error | 39.4 |
|---|
| Cost | 21024 |
|---|
\[\begin{array}{l}
t_1 := \frac{\sin th \cdot ky}{\sin kx}\\
t_2 := \frac{th \cdot ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{if}\;ky \leq -45000:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq -1.48 \cdot 10^{-83}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;ky \leq -2 \cdot 10^{-171}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;ky \leq -3.6 \cdot 10^{-274}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;ky \leq 1.1 \cdot 10^{-216}:\\
\;\;\;\;\sin th \cdot \left|\frac{\sin ky}{kx}\right|\\
\mathbf{elif}\;ky \leq 7.6 \cdot 10^{-157}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;ky \leq 4.6 \cdot 10^{-145}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;ky \leq 1.05 \cdot 10^{-61}:\\
\;\;\;\;\frac{\sin th}{1 + \frac{0.5 \cdot \left(kx \cdot kx\right)}{{\sin ky}^{2}}}\\
\mathbf{elif}\;ky \leq 1.5 \cdot 10^{-11}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\]
| Alternative 11 |
|---|
| Error | 44.2 |
|---|
| Cost | 19912 |
|---|
\[\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.002:\\
\;\;\;\;th \cdot \left|\frac{ky}{\sin kx}\right|\\
\mathbf{elif}\;\sin kx \leq 0.08:\\
\;\;\;\;\sin th\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{\sin kx}{th \cdot ky}}\\
\end{array}
\]
| Alternative 12 |
|---|
| Error | 38.7 |
|---|
| Cost | 13649 |
|---|
\[\begin{array}{l}
\mathbf{if}\;ky \leq -9 \cdot 10^{-5}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq 2.8 \cdot 10^{-125} \lor \neg \left(ky \leq 2 \cdot 10^{-67}\right) \land ky \leq 1.2 \cdot 10^{-10}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\]
| Alternative 13 |
|---|
| Error | 44.7 |
|---|
| Cost | 13648 |
|---|
\[\begin{array}{l}
\mathbf{if}\;ky \leq -1 \cdot 10^{-6}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq 1.12 \cdot 10^{-213}:\\
\;\;\;\;\frac{1}{\frac{\sin kx}{th \cdot ky}}\\
\mathbf{elif}\;ky \leq 1.2 \cdot 10^{-60}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq 1.5 \cdot 10^{-11}:\\
\;\;\;\;\left|\frac{th \cdot ky}{\sin kx}\right|\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\]
| Alternative 14 |
|---|
| Error | 38.6 |
|---|
| Cost | 13648 |
|---|
\[\begin{array}{l}
\mathbf{if}\;ky \leq -9 \cdot 10^{-5}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq 1.85 \cdot 10^{-125}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{elif}\;ky \leq 5.3 \cdot 10^{-61}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq 3.4 \cdot 10^{-9}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\]
| Alternative 15 |
|---|
| Error | 44.8 |
|---|
| Cost | 7377 |
|---|
\[\begin{array}{l}
\mathbf{if}\;ky \leq -1 \cdot 10^{-6}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq 10^{-213} \lor \neg \left(ky \leq 1.3 \cdot 10^{-60}\right) \land ky \leq 1.5 \cdot 10^{-11}:\\
\;\;\;\;\frac{1}{\frac{\sin kx}{th \cdot ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\]
| Alternative 16 |
|---|
| Error | 44.3 |
|---|
| Cost | 7249 |
|---|
\[\begin{array}{l}
\mathbf{if}\;ky \leq -1 \cdot 10^{-6}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq 5.1 \cdot 10^{-214} \lor \neg \left(ky \leq 1.25 \cdot 10^{-60}\right) \land ky \leq 1.5 \cdot 10^{-11}:\\
\;\;\;\;th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\]
| Alternative 17 |
|---|
| Error | 44.7 |
|---|
| Cost | 7249 |
|---|
\[\begin{array}{l}
\mathbf{if}\;ky \leq -1 \cdot 10^{-6}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq 1.12 \cdot 10^{-213} \lor \neg \left(ky \leq 4.4 \cdot 10^{-61}\right) \land ky \leq 1.7 \cdot 10^{-10}:\\
\;\;\;\;\frac{th \cdot ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\]
| Alternative 18 |
|---|
| Error | 44.3 |
|---|
| Cost | 7248 |
|---|
\[\begin{array}{l}
\mathbf{if}\;ky \leq -1 \cdot 10^{-6}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq 1.12 \cdot 10^{-213}:\\
\;\;\;\;th \cdot \frac{ky}{\sin kx}\\
\mathbf{elif}\;ky \leq 1.15 \cdot 10^{-64}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq 1.5 \cdot 10^{-11}:\\
\;\;\;\;\frac{th}{\frac{\sin kx}{ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\]
| Alternative 19 |
|---|
| Error | 42.8 |
|---|
| Cost | 6984 |
|---|
\[\begin{array}{l}
\mathbf{if}\;ky \leq -9 \cdot 10^{-5}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq 1.12 \cdot 10^{-213}:\\
\;\;\;\;\sin th \cdot \frac{ky}{kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\]
| Alternative 20 |
|---|
| Error | 44.7 |
|---|
| Cost | 6728 |
|---|
\[\begin{array}{l}
\mathbf{if}\;ky \leq -1 \cdot 10^{-6}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq 4.6 \cdot 10^{-224}:\\
\;\;\;\;\frac{1}{\frac{kx}{th \cdot ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\]
| Alternative 21 |
|---|
| Error | 50.2 |
|---|
| Cost | 584 |
|---|
\[\begin{array}{l}
\mathbf{if}\;ky \leq -1 \cdot 10^{-6}:\\
\;\;\;\;th\\
\mathbf{elif}\;ky \leq 1.75 \cdot 10^{-124}:\\
\;\;\;\;th \cdot \frac{ky}{kx}\\
\mathbf{else}:\\
\;\;\;\;th\\
\end{array}
\]
| Alternative 22 |
|---|
| Error | 55.2 |
|---|
| Cost | 64 |
|---|
\[th
\]