Math FPCore C Fortran 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 -1 \cdot 10^{+58} \lor \neg \left(t_1 \leq 0\right):\\
\;\;\;\;t_0 \cdot \left(t_1 \cdot J\right) + U\\
\mathbf{else}:\\
\;\;\;\;U + t_0 \cdot \left(J \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 (cos (/ K 2.0))) (t_1 (- (exp l) (exp (- l)))))
(if (or (<= t_1 -1e+58) (not (<= t_1 0.0)))
(+ (* t_0 (* t_1 J)) U)
(+ U (* t_0 (* J (* 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 <= -1e+58) || !(t_1 <= 0.0)) {
tmp = (t_0 * (t_1 * J)) + U;
} else {
tmp = U + (t_0 * (J * (l * 2.0)));
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = ((j * (exp(l) - exp(-l))) * cos((k / 2.0d0))) + u
end function
↓
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = cos((k / 2.0d0))
t_1 = exp(l) - exp(-l)
if ((t_1 <= (-1d+58)) .or. (.not. (t_1 <= 0.0d0))) then
tmp = (t_0 * (t_1 * j)) + u
else
tmp = u + (t_0 * (j * (l * 2.0d0)))
end if
code = tmp
end function
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 <= -1e+58) || !(t_1 <= 0.0)) {
tmp = (t_0 * (t_1 * J)) + U;
} else {
tmp = U + (t_0 * (J * (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 <= -1e+58) or not (t_1 <= 0.0):
tmp = (t_0 * (t_1 * J)) + U
else:
tmp = U + (t_0 * (J * (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 <= -1e+58) || !(t_1 <= 0.0))
tmp = Float64(Float64(t_0 * Float64(t_1 * J)) + U);
else
tmp = Float64(U + Float64(t_0 * Float64(J * 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 <= -1e+58) || ~((t_1 <= 0.0)))
tmp = (t_0 * (t_1 * J)) + U;
else
tmp = U + (t_0 * (J * (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, -1e+58], N[Not[LessEqual[t$95$1, 0.0]], $MachinePrecision]], N[(N[(t$95$0 * N[(t$95$1 * J), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], N[(U + N[(t$95$0 * N[(J * 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 := \cos \left(\frac{K}{2}\right)\\
t_1 := e^{\ell} - e^{-\ell}\\
\mathbf{if}\;t_1 \leq -1 \cdot 10^{+58} \lor \neg \left(t_1 \leq 0\right):\\
\;\;\;\;t_0 \cdot \left(t_1 \cdot J\right) + U\\
\mathbf{else}:\\
\;\;\;\;U + t_0 \cdot \left(J \cdot \left(\ell \cdot 2\right)\right)\\
\end{array}
Alternatives Alternative 1 Accuracy 86.5% Cost 39560
\[\begin{array}{l}
t_0 := e^{\ell} - e^{-\ell}\\
t_1 := t_0 \cdot J\\
\mathbf{if}\;t_0 \leq -1 \cdot 10^{+58}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t_0 \leq 0:\\
\;\;\;\;U + \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(\ell \cdot 2\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + t_1\\
\end{array}
\]
Alternative 2 Accuracy 86.7% Cost 39433
\[\begin{array}{l}
t_0 := e^{\ell} - e^{-\ell}\\
\mathbf{if}\;t_0 \leq -1 \cdot 10^{+58} \lor \neg \left(t_0 \leq 2\right):\\
\;\;\;\;t_0 \cdot J\\
\mathbf{else}:\\
\;\;\;\;U + \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(\ell \cdot 2\right)\right)\\
\end{array}
\]
Alternative 3 Accuracy 72.4% Cost 14152
\[\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;t_0 \leq -0.92:\\
\;\;\;\;\cos \left(K \cdot 0.5\right) \cdot \left(J \cdot \left(\ell + \ell\right)\right)\\
\mathbf{elif}\;t_0 \leq -0.05:\\
\;\;\;\;U + \left(\ell \cdot J\right) \cdot \left(2 + \left(K \cdot K\right) \cdot -0.25\right)\\
\mathbf{else}:\\
\;\;\;\;U + \left(\ell \cdot J\right) \cdot \left(2 + 0.3333333333333333 \cdot \left(\ell \cdot \ell\right)\right)\\
\end{array}
\]
Alternative 4 Accuracy 78.6% Cost 13828
\[\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;t_0 \leq 0.265:\\
\;\;\;\;U + t_0 \cdot \left(J \cdot \left(\ell \cdot 2\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(\ell \cdot 2 + 0.3333333333333333 \cdot {\ell}^{3}\right)\\
\end{array}
\]
Alternative 5 Accuracy 76.5% Cost 13764
\[\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq 0.265:\\
\;\;\;\;U + 2 \cdot \left(\ell \cdot \left(J \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + \left(\ell \cdot J\right) \cdot \left(2 + 0.3333333333333333 \cdot \left(\ell \cdot \ell\right)\right)\\
\end{array}
\]
Alternative 6 Accuracy 76.5% Cost 13764
\[\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;t_0 \leq 0.265:\\
\;\;\;\;U + t_0 \cdot \left(J \cdot \left(\ell \cdot 2\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + \left(\ell \cdot J\right) \cdot \left(2 + 0.3333333333333333 \cdot \left(\ell \cdot \ell\right)\right)\\
\end{array}
\]
Alternative 7 Accuracy 70.0% Cost 7241
\[\begin{array}{l}
\mathbf{if}\;J \leq -2.3 \cdot 10^{+229} \lor \neg \left(J \leq 1.3 \cdot 10^{+142}\right):\\
\;\;\;\;J \cdot \left(\cos \left(K \cdot 0.5\right) \cdot \left(\ell + \ell\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + \left(\ell \cdot J\right) \cdot \left(2 + 0.3333333333333333 \cdot \left(\ell \cdot \ell\right)\right)\\
\end{array}
\]
Alternative 8 Accuracy 69.6% Cost 969
\[\begin{array}{l}
\mathbf{if}\;\ell \leq -1.3 \cdot 10^{-13} \lor \neg \left(\ell \leq 0.36\right):\\
\;\;\;\;U + \left(\ell \cdot J\right) \cdot \left(0.3333333333333333 \cdot \left(\ell \cdot \ell\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(\ell \cdot 2\right)\\
\end{array}
\]
Alternative 9 Accuracy 69.8% Cost 832
\[U + \left(\ell \cdot J\right) \cdot \left(2 + 0.3333333333333333 \cdot \left(\ell \cdot \ell\right)\right)
\]
Alternative 10 Accuracy 42.6% Cost 456
\[\begin{array}{l}
\mathbf{if}\;\ell \leq -810:\\
\;\;\;\;U \cdot U\\
\mathbf{elif}\;\ell \leq 8.8 \cdot 10^{+29}:\\
\;\;\;\;U\\
\mathbf{else}:\\
\;\;\;\;U \cdot U\\
\end{array}
\]
Alternative 11 Accuracy 53.7% Cost 448
\[U + J \cdot \left(\ell \cdot 2\right)
\]
Alternative 12 Accuracy 2.7% Cost 64
\[1
\]
Alternative 13 Accuracy 36.6% Cost 64
\[U
\]