Math FPCore C Java Python Julia Wolfram TeX \[\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th
\]
↓
\[\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\right)\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
(* (log1p (expm1 (/ (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 log1p(expm1((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.log1p(Math.expm1((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.log1p(math.expm1((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(log1p(expm1(Float64(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[Log[1 + N[(Exp[N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th
↓
\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\right)\right) \cdot \sin th
Alternatives Alternative 1 Accuracy 61.5% Cost 39049
\[\begin{array}{l}
\mathbf{if}\;\sin th \leq -0.04 \lor \neg \left(\sin th \leq 10^{-5}\right):\\
\;\;\;\;\sin ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)} \cdot th\\
\end{array}
\]
Alternative 2 Accuracy 73.3% Cost 39048
\[\begin{array}{l}
t_1 := \mathsf{hypot}\left(\sin ky, \sin kx\right)\\
\mathbf{if}\;\sin ky \leq -0.0004:\\
\;\;\;\;\frac{\sin ky}{t_1} \cdot th\\
\mathbf{elif}\;\sin ky \leq 2 \cdot 10^{-9}:\\
\;\;\;\;\frac{ky \cdot \sin th}{t_1}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\]
Alternative 3 Accuracy 44.9% Cost 32584
\[\begin{array}{l}
\mathbf{if}\;\sin ky \leq -2 \cdot 10^{-66}:\\
\;\;\;\;\sqrt{{\sin th}^{2}}\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-115}:\\
\;\;\;\;\frac{\sin ky \cdot \sin th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\]
Alternative 4 Accuracy 44.9% Cost 32584
\[\begin{array}{l}
t_1 := \sin ky \cdot \sin th\\
\mathbf{if}\;\sin ky \leq -2 \cdot 10^{-66}:\\
\;\;\;\;\sqrt{{\sin th}^{2}}\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-115}:\\
\;\;\;\;\frac{t_1}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\frac{t_1}{\sin ky}\\
\end{array}
\]
Alternative 5 Accuracy 99.6% Cost 32384
\[\sin ky \cdot \frac{\sin th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}
\]
Alternative 6 Accuracy 99.7% Cost 32384
\[\frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)} \cdot \sin th
\]
Alternative 7 Accuracy 44.9% Cost 26184
\[\begin{array}{l}
\mathbf{if}\;\sin ky \leq -2 \cdot 10^{-66}:\\
\;\;\;\;\sqrt{{\sin th}^{2}}\\
\mathbf{elif}\;\sin ky \leq 5 \cdot 10^{-115}:\\
\;\;\;\;\frac{ky \cdot \sin th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\]
Alternative 8 Accuracy 33.7% Cost 19784
\[\begin{array}{l}
\mathbf{if}\;\sin ky \leq -1 \cdot 10^{-218}:\\
\;\;\;\;\frac{ky \cdot th}{\sin kx}\\
\mathbf{elif}\;\sin ky \leq 10^{-132}:\\
\;\;\;\;\frac{ky \cdot \sin th}{kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\]
Alternative 9 Accuracy 34.6% Cost 19784
\[\begin{array}{l}
\mathbf{if}\;\sin ky \leq -1 \cdot 10^{-218}:\\
\;\;\;\;\sin ky \cdot \frac{th}{\sin kx}\\
\mathbf{elif}\;\sin ky \leq 10^{-132}:\\
\;\;\;\;\frac{ky \cdot \sin th}{kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\]
Alternative 10 Accuracy 40.7% Cost 19652
\[\begin{array}{l}
\mathbf{if}\;\sin ky \leq 5 \cdot 10^{-115}:\\
\;\;\;\;\sin th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\]
Alternative 11 Accuracy 40.7% Cost 19652
\[\begin{array}{l}
\mathbf{if}\;\sin ky \leq 5 \cdot 10^{-115}:\\
\;\;\;\;ky \cdot \frac{\sin th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\]
Alternative 12 Accuracy 39.9% Cost 19652
\[\begin{array}{l}
\mathbf{if}\;\sin ky \leq 5 \cdot 10^{-115}:\\
\;\;\;\;\frac{ky \cdot \sin th}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\]
Alternative 13 Accuracy 34.6% Cost 7116
\[\begin{array}{l}
\mathbf{if}\;ky \leq -1.32:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq -9.2 \cdot 10^{-219}:\\
\;\;\;\;th \cdot \frac{ky}{\sin kx}\\
\mathbf{elif}\;ky \leq 6.5 \cdot 10^{-133}:\\
\;\;\;\;\frac{ky}{\frac{kx}{\sin th}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\]
Alternative 14 Accuracy 34.3% Cost 7116
\[\begin{array}{l}
\mathbf{if}\;ky \leq -1.32:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq -1.5 \cdot 10^{-218}:\\
\;\;\;\;\frac{ky \cdot th}{\sin kx}\\
\mathbf{elif}\;ky \leq 7.5 \cdot 10^{-125}:\\
\;\;\;\;\frac{ky}{\frac{kx}{\sin th}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\]
Alternative 15 Accuracy 32.5% Cost 6984
\[\begin{array}{l}
\mathbf{if}\;ky \leq -1.32:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq 2.05 \cdot 10^{-219}:\\
\;\;\;\;th \cdot \frac{ky}{\sin kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\]
Alternative 16 Accuracy 30.3% Cost 6728
\[\begin{array}{l}
\mathbf{if}\;ky \leq -1.32:\\
\;\;\;\;\sin th\\
\mathbf{elif}\;ky \leq 7.8 \cdot 10^{-209}:\\
\;\;\;\;\frac{ky \cdot th}{kx}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\]
Alternative 17 Accuracy 21.6% Cost 584
\[\begin{array}{l}
\mathbf{if}\;ky \leq -4 \cdot 10^{-11}:\\
\;\;\;\;th\\
\mathbf{elif}\;ky \leq 9.5 \cdot 10^{-209}:\\
\;\;\;\;th \cdot \frac{ky}{kx}\\
\mathbf{else}:\\
\;\;\;\;th\\
\end{array}
\]
Alternative 18 Accuracy 20.8% Cost 584
\[\begin{array}{l}
\mathbf{if}\;ky \leq -3.4 \cdot 10^{-13}:\\
\;\;\;\;th\\
\mathbf{elif}\;ky \leq 9.5 \cdot 10^{-209}:\\
\;\;\;\;\frac{ky \cdot th}{kx}\\
\mathbf{else}:\\
\;\;\;\;th\\
\end{array}
\]
Alternative 19 Accuracy 14.0% Cost 64
\[th
\]