Math FPCore C Java Python Julia MATLAB Wolfram TeX \[\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U
\]
↓
\[\begin{array}{l}
t_0 := e^{\ell} - e^{-\ell}\\
\mathbf{if}\;t_0 \leq -\infty \lor \neg \left(t_0 \leq 0\right):\\
\;\;\;\;\cos \left(\frac{K}{2}\right) \cdot \left(t_0 \cdot J\right) + U\\
\mathbf{else}:\\
\;\;\;\;U + \left({\ell}^{3} \cdot \left(J \cdot 0.3333333333333333\right) + \left(J \cdot \cos \left(K \cdot 0.5\right)\right) \cdot \left(\ell \cdot 2\right)\right)\\
\end{array}
\]
(FPCore (J l K U)
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U)) ↓
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (- (exp l) (exp (- l)))))
(if (or (<= t_0 (- INFINITY)) (not (<= t_0 0.0)))
(+ (* (cos (/ K 2.0)) (* t_0 J)) U)
(+
U
(+
(* (pow l 3.0) (* J 0.3333333333333333))
(* (* J (cos (* K 0.5))) (* l 2.0))))))) double code(double J, double l, double K, double U) {
return ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U;
}
↓
double code(double J, double l, double K, double U) {
double t_0 = exp(l) - exp(-l);
double tmp;
if ((t_0 <= -((double) INFINITY)) || !(t_0 <= 0.0)) {
tmp = (cos((K / 2.0)) * (t_0 * J)) + U;
} else {
tmp = U + ((pow(l, 3.0) * (J * 0.3333333333333333)) + ((J * cos((K * 0.5))) * (l * 2.0)));
}
return tmp;
}
public static double code(double J, double l, double K, double U) {
return ((J * (Math.exp(l) - Math.exp(-l))) * Math.cos((K / 2.0))) + U;
}
↓
public static double code(double J, double l, double K, double U) {
double t_0 = Math.exp(l) - Math.exp(-l);
double tmp;
if ((t_0 <= -Double.POSITIVE_INFINITY) || !(t_0 <= 0.0)) {
tmp = (Math.cos((K / 2.0)) * (t_0 * J)) + U;
} else {
tmp = U + ((Math.pow(l, 3.0) * (J * 0.3333333333333333)) + ((J * Math.cos((K * 0.5))) * (l * 2.0)));
}
return tmp;
}
def code(J, l, K, U):
return ((J * (math.exp(l) - math.exp(-l))) * math.cos((K / 2.0))) + U
↓
def code(J, l, K, U):
t_0 = math.exp(l) - math.exp(-l)
tmp = 0
if (t_0 <= -math.inf) or not (t_0 <= 0.0):
tmp = (math.cos((K / 2.0)) * (t_0 * J)) + U
else:
tmp = U + ((math.pow(l, 3.0) * (J * 0.3333333333333333)) + ((J * math.cos((K * 0.5))) * (l * 2.0)))
return tmp
function code(J, l, K, U)
return Float64(Float64(Float64(J * Float64(exp(l) - exp(Float64(-l)))) * cos(Float64(K / 2.0))) + U)
end
↓
function code(J, l, K, U)
t_0 = Float64(exp(l) - exp(Float64(-l)))
tmp = 0.0
if ((t_0 <= Float64(-Inf)) || !(t_0 <= 0.0))
tmp = Float64(Float64(cos(Float64(K / 2.0)) * Float64(t_0 * J)) + U);
else
tmp = Float64(U + Float64(Float64((l ^ 3.0) * Float64(J * 0.3333333333333333)) + Float64(Float64(J * cos(Float64(K * 0.5))) * Float64(l * 2.0))));
end
return tmp
end
function tmp = code(J, l, K, U)
tmp = ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U;
end
↓
function tmp_2 = code(J, l, K, U)
t_0 = exp(l) - exp(-l);
tmp = 0.0;
if ((t_0 <= -Inf) || ~((t_0 <= 0.0)))
tmp = (cos((K / 2.0)) * (t_0 * J)) + U;
else
tmp = U + (((l ^ 3.0) * (J * 0.3333333333333333)) + ((J * cos((K * 0.5))) * (l * 2.0)));
end
tmp_2 = tmp;
end
code[J_, l_, K_, U_] := N[(N[(N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]
↓
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, (-Infinity)], N[Not[LessEqual[t$95$0, 0.0]], $MachinePrecision]], N[(N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(t$95$0 * J), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], N[(U + N[(N[(N[Power[l, 3.0], $MachinePrecision] * N[(J * 0.3333333333333333), $MachinePrecision]), $MachinePrecision] + N[(N[(J * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U
↓
\begin{array}{l}
t_0 := e^{\ell} - e^{-\ell}\\
\mathbf{if}\;t_0 \leq -\infty \lor \neg \left(t_0 \leq 0\right):\\
\;\;\;\;\cos \left(\frac{K}{2}\right) \cdot \left(t_0 \cdot J\right) + U\\
\mathbf{else}:\\
\;\;\;\;U + \left({\ell}^{3} \cdot \left(J \cdot 0.3333333333333333\right) + \left(J \cdot \cos \left(K \cdot 0.5\right)\right) \cdot \left(\ell \cdot 2\right)\right)\\
\end{array}
Alternatives Alternative 1 Accuracy 93.8% Cost 14348
\[\begin{array}{l}
t_0 := \cos \left(K \cdot 0.5\right)\\
t_1 := U + \left(0.3333333333333333 \cdot t_0\right) \cdot \left(J \cdot {\ell}^{3}\right)\\
t_2 := U + \left(e^{\ell} - e^{-\ell}\right) \cdot J\\
\mathbf{if}\;\ell \leq -9.8 \cdot 10^{+86}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\ell \leq -0.013:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\ell \leq 1.1 \cdot 10^{-45}:\\
\;\;\;\;U + \left({\ell}^{3} \cdot \left(J \cdot 0.3333333333333333\right) + \left(J \cdot t_0\right) \cdot \left(\ell \cdot 2\right)\right)\\
\mathbf{elif}\;\ell \leq 1.05 \cdot 10^{+83}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
Alternative 2 Accuracy 93.8% Cost 14096
\[\begin{array}{l}
t_0 := \cos \left(K \cdot 0.5\right)\\
t_1 := U + \left(0.3333333333333333 \cdot t_0\right) \cdot \left(J \cdot {\ell}^{3}\right)\\
t_2 := U + \left(e^{\ell} - e^{-\ell}\right) \cdot J\\
\mathbf{if}\;\ell \leq -9.8 \cdot 10^{+86}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\ell \leq -0.00028:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\ell \leq 1.1 \cdot 10^{-45}:\\
\;\;\;\;U + J \cdot \left(t_0 \cdot \left(\ell \cdot 2\right)\right)\\
\mathbf{elif}\;\ell \leq 1.15 \cdot 10^{+84}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
Alternative 3 Accuracy 78.7% Cost 13828
\[\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq 0.05:\\
\;\;\;\;U + J \cdot \left(\cos \left(K \cdot 0.5\right) \cdot \left(\ell \cdot 2\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left({\ell}^{3} \cdot 0.3333333333333333 + \ell \cdot 2\right)\\
\end{array}
\]
Alternative 4 Accuracy 81.7% Cost 13648
\[\begin{array}{l}
t_0 := \mathsf{log1p}\left(\mathsf{expm1}\left(\frac{-8}{U} - U\right)\right)\\
t_1 := U + J \cdot \left({\ell}^{3} \cdot 0.3333333333333333 + \ell \cdot 2\right)\\
\mathbf{if}\;\ell \leq -1.42 \cdot 10^{+54}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\ell \leq -490:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq 1.1 \cdot 10^{+19}:\\
\;\;\;\;U + J \cdot \left(\cos \left(K \cdot 0.5\right) \cdot \left(\ell \cdot 2\right)\right)\\
\mathbf{elif}\;\ell \leq 1.15 \cdot 10^{+84}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
Alternative 5 Accuracy 86.1% Cost 13577
\[\begin{array}{l}
\mathbf{if}\;\ell \leq -0.015 \lor \neg \left(\ell \leq 1.1 \cdot 10^{-45}\right):\\
\;\;\;\;U + \left(e^{\ell} - e^{-\ell}\right) \cdot J\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(\cos \left(K \cdot 0.5\right) \cdot \left(\ell \cdot 2\right)\right)\\
\end{array}
\]
Alternative 6 Accuracy 65.7% Cost 7633
\[\begin{array}{l}
t_0 := U + J \cdot \left(\cos \left(K \cdot 0.5\right) \cdot \left(\ell \cdot 2\right)\right)\\
\mathbf{if}\;\ell \leq -2.26 \cdot 10^{+164}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq -620:\\
\;\;\;\;\frac{\frac{64}{U \cdot U} - U \cdot U}{U + \frac{-8}{U}}\\
\mathbf{elif}\;\ell \leq 2.65 \cdot 10^{+17} \lor \neg \left(\ell \leq 2.45 \cdot 10^{+201}\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;{U}^{-8}\\
\end{array}
\]
Alternative 7 Accuracy 47.0% Cost 6792
\[\begin{array}{l}
\mathbf{if}\;\ell \leq -2.4 \cdot 10^{-13}:\\
\;\;\;\;\frac{\frac{64}{U \cdot U} - U \cdot U}{U + \frac{-8}{U}}\\
\mathbf{elif}\;\ell \leq 2.65 \cdot 10^{+17}:\\
\;\;\;\;U\\
\mathbf{else}:\\
\;\;\;\;{U}^{-8}\\
\end{array}
\]
Alternative 8 Accuracy 47.9% Cost 1225
\[\begin{array}{l}
\mathbf{if}\;\ell \leq -2.4 \cdot 10^{-13} \lor \neg \left(\ell \leq 1.1 \cdot 10^{+19}\right):\\
\;\;\;\;\frac{\frac{64}{U \cdot U} - U \cdot U}{U + \frac{-8}{U}}\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\]
Alternative 9 Accuracy 43.9% Cost 969
\[\begin{array}{l}
\mathbf{if}\;\ell \leq -1.46 \cdot 10^{-30} \lor \neg \left(\ell \leq 1.95 \cdot 10^{+19}\right):\\
\;\;\;\;U + J \cdot \left(-0.5 + \left(K \cdot K\right) \cdot 0.0625\right)\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\]
Alternative 10 Accuracy 39.3% Cost 324
\[\begin{array}{l}
\mathbf{if}\;\ell \leq -2.4 \cdot 10^{-13}:\\
\;\;\;\;U \cdot U\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\]
Alternative 11 Accuracy 2.7% Cost 64
\[1
\]
Alternative 12 Accuracy 37.3% Cost 64
\[U
\]