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 10^{-10}\right):\\
\;\;\;\;t_0 \cdot \left(t_1 \cdot J\right) + U\\
\mathbf{else}:\\
\;\;\;\;U + t_0 \cdot \left(2 \cdot \left(\ell \cdot J\right) + \left(0.3333333333333333 \cdot \left(J \cdot {\ell}^{3}\right) + 0.016666666666666666 \cdot \left(J \cdot {\ell}^{5}\right)\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 1e-10)))
(+ (* t_0 (* t_1 J)) U)
(+
U
(*
t_0
(+
(* 2.0 (* l J))
(+
(* 0.3333333333333333 (* J (pow l 3.0)))
(* 0.016666666666666666 (* J (pow l 5.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 <= 1e-10)) {
tmp = (t_0 * (t_1 * J)) + U;
} else {
tmp = U + (t_0 * ((2.0 * (l * J)) + ((0.3333333333333333 * (J * pow(l, 3.0))) + (0.016666666666666666 * (J * pow(l, 5.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 <= 1e-10)) {
tmp = (t_0 * (t_1 * J)) + U;
} else {
tmp = U + (t_0 * ((2.0 * (l * J)) + ((0.3333333333333333 * (J * Math.pow(l, 3.0))) + (0.016666666666666666 * (J * Math.pow(l, 5.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 <= 1e-10):
tmp = (t_0 * (t_1 * J)) + U
else:
tmp = U + (t_0 * ((2.0 * (l * J)) + ((0.3333333333333333 * (J * math.pow(l, 3.0))) + (0.016666666666666666 * (J * math.pow(l, 5.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 <= 1e-10))
tmp = Float64(Float64(t_0 * Float64(t_1 * J)) + U);
else
tmp = Float64(U + Float64(t_0 * Float64(Float64(2.0 * Float64(l * J)) + Float64(Float64(0.3333333333333333 * Float64(J * (l ^ 3.0))) + Float64(0.016666666666666666 * Float64(J * (l ^ 5.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 <= 1e-10)))
tmp = (t_0 * (t_1 * J)) + U;
else
tmp = U + (t_0 * ((2.0 * (l * J)) + ((0.3333333333333333 * (J * (l ^ 3.0))) + (0.016666666666666666 * (J * (l ^ 5.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, 1e-10]], $MachinePrecision]], N[(N[(t$95$0 * N[(t$95$1 * J), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], N[(U + N[(t$95$0 * N[(N[(2.0 * N[(l * J), $MachinePrecision]), $MachinePrecision] + N[(N[(0.3333333333333333 * N[(J * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.016666666666666666 * N[(J * N[Power[l, 5.0], $MachinePrecision]), $MachinePrecision]), $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 10^{-10}\right):\\
\;\;\;\;t_0 \cdot \left(t_1 \cdot J\right) + U\\
\mathbf{else}:\\
\;\;\;\;U + t_0 \cdot \left(2 \cdot \left(\ell \cdot J\right) + \left(0.3333333333333333 \cdot \left(J \cdot {\ell}^{3}\right) + 0.016666666666666666 \cdot \left(J \cdot {\ell}^{5}\right)\right)\right)\\
\end{array}
Alternatives Alternative 1 Accuracy 99.7% Cost 47049
\[\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 10^{-10}\right):\\
\;\;\;\;t_0 \cdot \left(t_1 \cdot J\right) + U\\
\mathbf{else}:\\
\;\;\;\;U + t_0 \cdot \left(2 \cdot \left(\ell \cdot J\right) + \left(0.3333333333333333 \cdot \left(J \cdot {\ell}^{3}\right) + 0.016666666666666666 \cdot \left(J \cdot {\ell}^{5}\right)\right)\right)\\
\end{array}
\]
Alternative 2 Accuracy 99.7% Cost 46793
\[\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 10^{-10}\right):\\
\;\;\;\;t_0 \cdot \left(t_1 \cdot J\right) + U\\
\mathbf{else}:\\
\;\;\;\;U + t_0 \cdot \left(J \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + \left(0.016666666666666666 \cdot {\ell}^{5} + \ell \cdot 2\right)\right)\right)\\
\end{array}
\]
Alternative 3 Accuracy 99.8% Cost 46345
\[\begin{array}{l}
t_0 := e^{\ell} - e^{-\ell}\\
\mathbf{if}\;t_0 \leq -0.002 \lor \neg \left(t_0 \leq 10^{-10}\right):\\
\;\;\;\;\cos \left(\frac{K}{2}\right) \cdot \left(t_0 \cdot J\right) + U\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(\cos \left(K \cdot 0.5\right) \cdot \mathsf{fma}\left(0.3333333333333333, {\ell}^{3}, \ell \cdot 2\right)\right)\\
\end{array}
\]
Alternative 4 Accuracy 99.8% Cost 46217
\[\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
t_1 := e^{\ell} - e^{-\ell}\\
\mathbf{if}\;t_1 \leq -0.002 \lor \neg \left(t_1 \leq 10^{-10}\right):\\
\;\;\;\;t_0 \cdot \left(t_1 \cdot J\right) + U\\
\mathbf{else}:\\
\;\;\;\;U + t_0 \cdot \left(J \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right)\right)\\
\end{array}
\]
Alternative 5 Accuracy 95.2% Cost 14220
\[\begin{array}{l}
t_0 := U + \left(J \cdot {\ell}^{5}\right) \cdot \left(0.016666666666666666 \cdot \cos \left(K \cdot 0.5\right)\right)\\
\mathbf{if}\;\ell \leq -5:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq 3.3:\\
\;\;\;\;U + \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right)\right)\\
\mathbf{elif}\;\ell \leq 4.2 \cdot 10^{+61}:\\
\;\;\;\;U + \left(-0.125 \cdot \left(K \cdot K\right) + 1\right) \cdot \left(\left(e^{\ell} - e^{-\ell}\right) \cdot J\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
Alternative 6 Accuracy 95.1% Cost 14088
\[\begin{array}{l}
t_0 := U + \left(J \cdot {\ell}^{5}\right) \cdot \left(0.016666666666666666 \cdot \cos \left(K \cdot 0.5\right)\right)\\
\mathbf{if}\;\ell \leq -5:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq 0.21:\\
\;\;\;\;U + \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right)\right)\\
\mathbf{elif}\;\ell \leq 1.65 \cdot 10^{+53}:\\
\;\;\;\;U + \left(e^{\ell} - e^{-\ell}\right) \cdot J\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
Alternative 7 Accuracy 94.9% Cost 13964
\[\begin{array}{l}
t_0 := \cos \left(K \cdot 0.5\right)\\
t_1 := U + \left(J \cdot {\ell}^{5}\right) \cdot \left(0.016666666666666666 \cdot t_0\right)\\
\mathbf{if}\;\ell \leq -3.3:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\ell \leq 0.00039:\\
\;\;\;\;U + J \cdot \left(2 \cdot \left(\ell \cdot t_0\right)\right)\\
\mathbf{elif}\;\ell \leq 1.65 \cdot 10^{+53}:\\
\;\;\;\;U + \left(e^{\ell} - e^{-\ell}\right) \cdot J\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
Alternative 8 Accuracy 78.8% Cost 13828
\[\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq 0.235:\\
\;\;\;\;U + J \cdot \left(2 \cdot \left(\ell \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right)\\
\end{array}
\]
Alternative 9 Accuracy 81.1% Cost 13577
\[\begin{array}{l}
\mathbf{if}\;J \leq -2.2 \cdot 10^{+107} \lor \neg \left(J \leq 3250000\right):\\
\;\;\;\;U + J \cdot \left(2 \cdot \left(\ell \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + \left(e^{\ell} - e^{-\ell}\right) \cdot J\\
\end{array}
\]
Alternative 10 Accuracy 47.3% Cost 7308
\[\begin{array}{l}
t_0 := U + {K}^{4} \cdot \left(J \cdot -0.0013020833333333333\right)\\
\mathbf{if}\;\ell \leq -1.7 \cdot 10^{+271}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq -650:\\
\;\;\;\;{U}^{-8}\\
\mathbf{elif}\;\ell \leq 420:\\
\;\;\;\;U\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
Alternative 11 Accuracy 64.4% Cost 7104
\[U + 2 \cdot \left(\ell \cdot \left(J \cdot \cos \left(K \cdot 0.5\right)\right)\right)
\]
Alternative 12 Accuracy 64.4% Cost 7104
\[U + J \cdot \left(2 \cdot \left(\ell \cdot \cos \left(K \cdot 0.5\right)\right)\right)
\]
Alternative 13 Accuracy 46.0% Cost 6792
\[\begin{array}{l}
t_0 := U + J \cdot \left(\left(K \cdot K\right) \cdot -64 + 512\right)\\
\mathbf{if}\;\ell \leq -1.45 \cdot 10^{+269}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq -510:\\
\;\;\;\;{U}^{-8}\\
\mathbf{elif}\;\ell \leq 7.4 \cdot 10^{-19}:\\
\;\;\;\;U\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
Alternative 14 Accuracy 45.2% Cost 1100
\[\begin{array}{l}
t_0 := U + J \cdot \left(\left(K \cdot K\right) \cdot -64 + 512\right)\\
\mathbf{if}\;\ell \leq -1.3 \cdot 10^{+269}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq -1850000000000:\\
\;\;\;\;U + J \cdot \left(\left(K \cdot K\right) \cdot 0.0625 + -0.5\right)\\
\mathbf{elif}\;\ell \leq 7.4 \cdot 10^{-19}:\\
\;\;\;\;U\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
Alternative 15 Accuracy 44.3% Cost 969
\[\begin{array}{l}
\mathbf{if}\;\ell \leq -120000000 \lor \neg \left(\ell \leq 7.4 \cdot 10^{-19}\right):\\
\;\;\;\;U + J \cdot \left(\left(K \cdot K\right) \cdot -64 + 512\right)\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\]
Alternative 16 Accuracy 42.3% Cost 456
\[\begin{array}{l}
\mathbf{if}\;\ell \leq -135000000:\\
\;\;\;\;U \cdot U\\
\mathbf{elif}\;\ell \leq 2.6 \cdot 10^{-11}:\\
\;\;\;\;U\\
\mathbf{else}:\\
\;\;\;\;U \cdot U\\
\end{array}
\]
Alternative 17 Accuracy 42.2% Cost 456
\[\begin{array}{l}
\mathbf{if}\;\ell \leq -8.6 \cdot 10^{+15}:\\
\;\;\;\;U \cdot \left(U - -8\right)\\
\mathbf{elif}\;\ell \leq 2.6 \cdot 10^{-11}:\\
\;\;\;\;U\\
\mathbf{else}:\\
\;\;\;\;U \cdot U\\
\end{array}
\]
Alternative 18 Accuracy 2.7% Cost 64
\[1
\]
Alternative 19 Accuracy 37.1% Cost 64
\[U
\]