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 := \cos \left(\frac{K}{2}\right)\\
t_1 := e^{\ell} - e^{-\ell}\\
\mathbf{if}\;t_1 \leq -\infty \lor \neg \left(t_1 \leq 4 \cdot 10^{-5}\right):\\
\;\;\;\;\left(t_1 \cdot J\right) \cdot t_0 + U\\
\mathbf{else}:\\
\;\;\;\;U + t_0 \cdot \left(J \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + \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 (cos (/ K 2.0))) (t_1 (- (exp l) (exp (- l)))))
(if (or (<= t_1 (- INFINITY)) (not (<= t_1 4e-5)))
(+ (* (* t_1 J) t_0) U)
(+ U (* t_0 (* J (+ (* 0.3333333333333333 (pow l 3.0)) (* 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 = cos((K / 2.0));
double t_1 = exp(l) - exp(-l);
double tmp;
if ((t_1 <= -((double) INFINITY)) || !(t_1 <= 4e-5)) {
tmp = ((t_1 * J) * t_0) + U;
} else {
tmp = U + (t_0 * (J * ((0.3333333333333333 * pow(l, 3.0)) + (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.cos((K / 2.0));
double t_1 = Math.exp(l) - Math.exp(-l);
double tmp;
if ((t_1 <= -Double.POSITIVE_INFINITY) || !(t_1 <= 4e-5)) {
tmp = ((t_1 * J) * t_0) + U;
} else {
tmp = U + (t_0 * (J * ((0.3333333333333333 * Math.pow(l, 3.0)) + (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.cos((K / 2.0))
t_1 = math.exp(l) - math.exp(-l)
tmp = 0
if (t_1 <= -math.inf) or not (t_1 <= 4e-5):
tmp = ((t_1 * J) * t_0) + U
else:
tmp = U + (t_0 * (J * ((0.3333333333333333 * math.pow(l, 3.0)) + (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 = cos(Float64(K / 2.0))
t_1 = Float64(exp(l) - exp(Float64(-l)))
tmp = 0.0
if ((t_1 <= Float64(-Inf)) || !(t_1 <= 4e-5))
tmp = Float64(Float64(Float64(t_1 * J) * t_0) + U);
else
tmp = Float64(U + Float64(t_0 * Float64(J * Float64(Float64(0.3333333333333333 * (l ^ 3.0)) + 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 = cos((K / 2.0));
t_1 = exp(l) - exp(-l);
tmp = 0.0;
if ((t_1 <= -Inf) || ~((t_1 <= 4e-5)))
tmp = ((t_1 * J) * t_0) + U;
else
tmp = U + (t_0 * (J * ((0.3333333333333333 * (l ^ 3.0)) + (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[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, (-Infinity)], N[Not[LessEqual[t$95$1, 4e-5]], $MachinePrecision]], N[(N[(N[(t$95$1 * J), $MachinePrecision] * t$95$0), $MachinePrecision] + U), $MachinePrecision], N[(U + N[(t$95$0 * N[(J * N[(N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision] + N[(l * 2.0), $MachinePrecision]), $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 := \cos \left(\frac{K}{2}\right)\\
t_1 := e^{\ell} - e^{-\ell}\\
\mathbf{if}\;t_1 \leq -\infty \lor \neg \left(t_1 \leq 4 \cdot 10^{-5}\right):\\
\;\;\;\;\left(t_1 \cdot J\right) \cdot t_0 + U\\
\mathbf{else}:\\
\;\;\;\;U + t_0 \cdot \left(J \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right)\right)\\
\end{array}
Alternatives Alternative 1 Accuracy 99.7% Cost 46217
\[\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
t_1 := e^{\ell} - e^{-\ell}\\
\mathbf{if}\;t_1 \leq -\infty \lor \neg \left(t_1 \leq 4 \cdot 10^{-5}\right):\\
\;\;\;\;\left(t_1 \cdot J\right) \cdot t_0 + U\\
\mathbf{else}:\\
\;\;\;\;U + t_0 \cdot \left(J \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right)\right)\\
\end{array}
\]
Alternative 2 Accuracy 88.2% Cost 20484
\[\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;t_0 \leq 1:\\
\;\;\;\;U + t_0 \cdot \left(J \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + \sinh \ell \cdot \left(J \cdot 2\right)\\
\end{array}
\]
Alternative 3 Accuracy 88.5% Cost 13764
\[\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.003:\\
\;\;\;\;U + 2 \cdot \left(\ell \cdot \left(J \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + \sinh \ell \cdot \left(J \cdot 2\right)\\
\end{array}
\]
Alternative 4 Accuracy 88.5% Cost 13764
\[\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.003:\\
\;\;\;\;U + \left(J \cdot 2\right) \cdot \left(\ell \cdot \cos \left(K \cdot 0.5\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + \sinh \ell \cdot \left(J \cdot 2\right)\\
\end{array}
\]
Alternative 5 Accuracy 85.5% Cost 13508
\[\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.005:\\
\;\;\;\;U - J \cdot \left(\ell \cdot \left(K \cdot \left(K \cdot 0.25\right) + -2\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + \sinh \ell \cdot \left(J \cdot 2\right)\\
\end{array}
\]
Alternative 6 Accuracy 57.9% Cost 6792
\[\begin{array}{l}
t_0 := U + 2 \cdot \left(\ell \cdot J\right)\\
\mathbf{if}\;\ell \leq -1.6 \cdot 10^{+241}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq -760:\\
\;\;\;\;{U}^{-8}\\
\mathbf{elif}\;\ell \leq 1.1 \cdot 10^{-17}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;U - J \cdot \left(\ell \cdot \left(K \cdot \left(K \cdot 0.25\right) + -2\right)\right)\\
\end{array}
\]
Alternative 7 Accuracy 58.6% Cost 1097
\[\begin{array}{l}
\mathbf{if}\;\ell \leq -3.2 \cdot 10^{+23} \lor \neg \left(\ell \leq 1.1 \cdot 10^{-17}\right):\\
\;\;\;\;U + \left(\ell \cdot J\right) \cdot \left(2 + \left(K \cdot K\right) \cdot -0.25\right)\\
\mathbf{else}:\\
\;\;\;\;U + 2 \cdot \left(\ell \cdot J\right)\\
\end{array}
\]
Alternative 8 Accuracy 59.4% Cost 1097
\[\begin{array}{l}
\mathbf{if}\;\ell \leq -3.2 \cdot 10^{+23} \lor \neg \left(\ell \leq 1.1 \cdot 10^{-17}\right):\\
\;\;\;\;U - J \cdot \left(\ell \cdot \left(K \cdot \left(K \cdot 0.25\right) + -2\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + 2 \cdot \left(\ell \cdot J\right)\\
\end{array}
\]
Alternative 9 Accuracy 42.9% Cost 585
\[\begin{array}{l}
\mathbf{if}\;\ell \leq -230000000000 \lor \neg \left(\ell \leq 1.45 \cdot 10^{+51}\right):\\
\;\;\;\;U \cdot \left(U - -8\right)\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\]
Alternative 10 Accuracy 42.9% Cost 456
\[\begin{array}{l}
\mathbf{if}\;\ell \leq -570:\\
\;\;\;\;U \cdot U\\
\mathbf{elif}\;\ell \leq 3.5 \cdot 10^{+51}:\\
\;\;\;\;U\\
\mathbf{else}:\\
\;\;\;\;U \cdot U\\
\end{array}
\]
Alternative 11 Accuracy 54.3% Cost 448
\[U + 2 \cdot \left(\ell \cdot J\right)
\]
Alternative 12 Accuracy 2.8% Cost 64
\[1
\]
Alternative 13 Accuracy 37.4% Cost 64
\[U
\]