\[\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 | 37.6 |
|---|
| Cost | 52180 |
|---|
\[\begin{array}{l}
t_1 := \frac{\sin ky \cdot \sin th}{\sin ky}\\
t_2 := \frac{ky \cdot th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
\mathbf{if}\;\sin kx \leq -0.605:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\sin kx \leq -3 \cdot 10^{-169}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\sin kx \leq -1 \cdot 10^{-192}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\sin kx \leq -3 \cdot 10^{-281}:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;\sin kx \leq 10^{-157}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin ky}{\frac{\sin kx}{\sin th}}\\
\end{array}
\]
| Alternative 2 |
|---|
| Error | 16.0 |
|---|
| Cost | 45580 |
|---|
\[\begin{array}{l}
t_1 := \mathsf{hypot}\left(\sin ky, \sin kx\right)\\
t_2 := \frac{\sin ky \cdot th}{t_1}\\
\mathbf{if}\;\sin ky \leq -1 \cdot 10^{-8}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\sin ky \leq 0.05:\\
\;\;\;\;\frac{\sin th}{\frac{t_1}{ky}}\\
\mathbf{elif}\;\sin ky \leq 0.54:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\]
| Alternative 3 |
|---|
| Error | 22.5 |
|---|
| Cost | 32516 |
|---|
\[\begin{array}{l}
\mathbf{if}\;\sin ky \leq 2 \cdot 10^{-8}:\\
\;\;\;\;\frac{\sin th}{\frac{\mathsf{hypot}\left(\sin ky, \sin kx\right)}{ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\]
| Alternative 4 |
|---|
| Error | 0.3 |
|---|
| Cost | 32384 |
|---|
\[\frac{\sin ky}{\frac{\mathsf{hypot}\left(\sin ky, \sin kx\right)}{\sin th}}
\]
| Alternative 5 |
|---|
| Error | 37.6 |
|---|
| Cost | 26052 |
|---|
\[\begin{array}{l}
\mathbf{if}\;\sin ky \leq 10^{-76}:\\
\;\;\;\;\frac{\sin ky \cdot \sin th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\]
| Alternative 6 |
|---|
| Error | 37.1 |
|---|
| Cost | 26052 |
|---|
\[\begin{array}{l}
\mathbf{if}\;\sin ky \leq 10^{-76}:\\
\;\;\;\;\frac{\sin th}{\frac{\sin kx}{\sin ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\]
| Alternative 7 |
|---|
| Error | 37.1 |
|---|
| Cost | 26052 |
|---|
\[\begin{array}{l}
\mathbf{if}\;\sin ky \leq 10^{-76}:\\
\;\;\;\;\frac{\sin ky}{\frac{\sin kx}{\sin th}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\]
| Alternative 8 |
|---|
| Error | 38.5 |
|---|
| Cost | 13384 |
|---|
\[\begin{array}{l}
\mathbf{if}\;ky \leq -71684.1162285722:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq 5.307659785243442 \cdot 10^{-77}:\\
\;\;\;\;\frac{ky \cdot \sin th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\]
| Alternative 9 |
|---|
| Error | 38.0 |
|---|
| Cost | 13384 |
|---|
\[\begin{array}{l}
\mathbf{if}\;ky \leq -71684.1162285722:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq 5.307659785243442 \cdot 10^{-77}:\\
\;\;\;\;\frac{\sin th}{\frac{\sin kx}{ky}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\]
| Alternative 10 |
|---|
| Error | 38.0 |
|---|
| Cost | 13384 |
|---|
\[\begin{array}{l}
\mathbf{if}\;ky \leq -71684.1162285722:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq 5.307659785243442 \cdot 10^{-77}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\]
| Alternative 11 |
|---|
| Error | 38.0 |
|---|
| Cost | 13384 |
|---|
\[\begin{array}{l}
\mathbf{if}\;ky \leq -71684.1162285722:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq 5.307659785243442 \cdot 10^{-77}:\\
\;\;\;\;\frac{ky}{\frac{\sin kx}{\sin th}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\]
| Alternative 12 |
|---|
| Error | 48.7 |
|---|
| Cost | 6464 |
|---|
\[\sin th
\]
| Alternative 13 |
|---|
| Error | 55.0 |
|---|
| Cost | 64 |
|---|
\[th
\]