
(FPCore (J l K U) :precision binary64 (+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))
double code(double J, double l, double K, double U) {
return ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U;
}
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
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;
}
def code(J, l, K, U): return ((J * (math.exp(l) - math.exp(-l))) * math.cos((K / 2.0))) + U
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 tmp = code(J, l, K, U) tmp = ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U; 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]
\begin{array}{l}
\\
\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (J l K U) :precision binary64 (+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))
double code(double J, double l, double K, double U) {
return ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U;
}
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
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;
}
def code(J, l, K, U): return ((J * (math.exp(l) - math.exp(-l))) * math.cos((K / 2.0))) + U
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 tmp = code(J, l, K, U) tmp = ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U; 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]
\begin{array}{l}
\\
\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U
\end{array}
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (* K 0.5))) (t_1 (- (exp l) (exp (- l)))))
(if (or (<= t_1 (- INFINITY)) (not (<= t_1 2e-6)))
(+ (* (* t_1 J) (cos (/ K 2.0))) U)
(+
U
(+
(* 0.3333333333333333 (* J (* (pow l 3.0) t_0)))
(* 2.0 (* J (* l t_0))))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K * 0.5));
double t_1 = exp(l) - exp(-l);
double tmp;
if ((t_1 <= -((double) INFINITY)) || !(t_1 <= 2e-6)) {
tmp = ((t_1 * J) * cos((K / 2.0))) + U;
} else {
tmp = U + ((0.3333333333333333 * (J * (pow(l, 3.0) * t_0))) + (2.0 * (J * (l * t_0))));
}
return tmp;
}
public static double code(double J, double l, double K, double U) {
double t_0 = Math.cos((K * 0.5));
double t_1 = Math.exp(l) - Math.exp(-l);
double tmp;
if ((t_1 <= -Double.POSITIVE_INFINITY) || !(t_1 <= 2e-6)) {
tmp = ((t_1 * J) * Math.cos((K / 2.0))) + U;
} else {
tmp = U + ((0.3333333333333333 * (J * (Math.pow(l, 3.0) * t_0))) + (2.0 * (J * (l * t_0))));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K * 0.5)) t_1 = math.exp(l) - math.exp(-l) tmp = 0 if (t_1 <= -math.inf) or not (t_1 <= 2e-6): tmp = ((t_1 * J) * math.cos((K / 2.0))) + U else: tmp = U + ((0.3333333333333333 * (J * (math.pow(l, 3.0) * t_0))) + (2.0 * (J * (l * t_0)))) return tmp
function code(J, l, K, U) t_0 = cos(Float64(K * 0.5)) t_1 = Float64(exp(l) - exp(Float64(-l))) tmp = 0.0 if ((t_1 <= Float64(-Inf)) || !(t_1 <= 2e-6)) tmp = Float64(Float64(Float64(t_1 * J) * cos(Float64(K / 2.0))) + U); else tmp = Float64(U + Float64(Float64(0.3333333333333333 * Float64(J * Float64((l ^ 3.0) * t_0))) + Float64(2.0 * Float64(J * Float64(l * t_0))))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = cos((K * 0.5)); t_1 = exp(l) - exp(-l); tmp = 0.0; if ((t_1 <= -Inf) || ~((t_1 <= 2e-6))) tmp = ((t_1 * J) * cos((K / 2.0))) + U; else tmp = U + ((0.3333333333333333 * (J * ((l ^ 3.0) * t_0))) + (2.0 * (J * (l * t_0)))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K * 0.5), $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, 2e-6]], $MachinePrecision]], N[(N[(N[(t$95$1 * J), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], N[(U + N[(N[(0.3333333333333333 * N[(J * N[(N[Power[l, 3.0], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(2.0 * N[(J * N[(l * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(K \cdot 0.5\right)\\
t_1 := e^{\ell} - e^{-\ell}\\
\mathbf{if}\;t_1 \leq -\infty \lor \neg \left(t_1 \leq 2 \cdot 10^{-6}\right):\\
\;\;\;\;\left(t_1 \cdot J\right) \cdot \cos \left(\frac{K}{2}\right) + U\\
\mathbf{else}:\\
\;\;\;\;U + \left(0.3333333333333333 \cdot \left(J \cdot \left({\ell}^{3} \cdot t_0\right)\right) + 2 \cdot \left(J \cdot \left(\ell \cdot t_0\right)\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -inf.0 or 1.99999999999999991e-6 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 100.0%
if -inf.0 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 1.99999999999999991e-6Initial program 73.8%
Taylor expanded in l around 0 99.9%
Final simplification100.0%
(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 2e-6)))
(+ (* (* 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) {
double t_0 = cos((K / 2.0));
double t_1 = exp(l) - exp(-l);
double tmp;
if ((t_1 <= -((double) INFINITY)) || !(t_1 <= 2e-6)) {
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) {
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 <= 2e-6)) {
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): 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 <= 2e-6): 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) 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 <= 2e-6)) 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_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 <= 2e-6))) 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_] := 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, 2e-6]], $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]]]]
\begin{array}{l}
\\
\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 2 \cdot 10^{-6}\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}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -inf.0 or 1.99999999999999991e-6 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 100.0%
if -inf.0 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 1.99999999999999991e-6Initial program 73.8%
Taylor expanded in l around 0 99.9%
Final simplification100.0%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= t_0 0.3739)
(+ U (* t_0 (* J (+ (* 0.3333333333333333 (pow l 3.0)) (* l 2.0)))))
(fma (* J 2.0) (sinh l) U))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double tmp;
if (t_0 <= 0.3739) {
tmp = U + (t_0 * (J * ((0.3333333333333333 * pow(l, 3.0)) + (l * 2.0))));
} else {
tmp = fma((J * 2.0), sinh(l), U);
}
return tmp;
}
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) tmp = 0.0 if (t_0 <= 0.3739) tmp = Float64(U + Float64(t_0 * Float64(J * Float64(Float64(0.3333333333333333 * (l ^ 3.0)) + Float64(l * 2.0))))); else tmp = fma(Float64(J * 2.0), sinh(l), U); end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, 0.3739], 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], N[(N[(J * 2.0), $MachinePrecision] * N[Sinh[l], $MachinePrecision] + U), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;t_0 \leq 0.3739:\\
\;\;\;\;U + t_0 \cdot \left(J \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(J \cdot 2, \sinh \ell, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K 2)) < 0.37390000000000001Initial program 86.3%
Taylor expanded in l around 0 88.4%
if 0.37390000000000001 < (cos.f64 (/.f64 K 2)) Initial program 86.5%
Taylor expanded in K around 0 86.2%
expm1-log1p-u44.0%
expm1-udef31.4%
fma-def31.4%
sinh-undef33.7%
Applied egg-rr33.7%
expm1-def50.0%
expm1-log1p96.6%
fma-udef96.6%
associate-*r*96.6%
fma-def96.6%
Simplified96.6%
Final simplification93.9%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) 0.19) (+ U (* (* l 2.0) (* J (cos (* K 0.5))))) (fma (* J 2.0) (sinh l) U)))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= 0.19) {
tmp = U + ((l * 2.0) * (J * cos((K * 0.5))));
} else {
tmp = fma((J * 2.0), sinh(l), U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= 0.19) tmp = Float64(U + Float64(Float64(l * 2.0) * Float64(J * cos(Float64(K * 0.5))))); else tmp = fma(Float64(J * 2.0), sinh(l), U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], 0.19], N[(U + N[(N[(l * 2.0), $MachinePrecision] * N[(J * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(J * 2.0), $MachinePrecision] * N[Sinh[l], $MachinePrecision] + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq 0.19:\\
\;\;\;\;U + \left(\ell \cdot 2\right) \cdot \left(J \cdot \cos \left(K \cdot 0.5\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(J \cdot 2, \sinh \ell, U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K 2)) < 0.19Initial program 88.0%
Taylor expanded in l around 0 70.7%
*-commutative70.7%
associate-*l*70.7%
*-commutative70.7%
associate-*r*70.7%
Simplified70.7%
if 0.19 < (cos.f64 (/.f64 K 2)) Initial program 85.8%
Taylor expanded in K around 0 85.5%
expm1-log1p-u42.6%
expm1-udef30.7%
fma-def30.7%
sinh-undef32.8%
Applied egg-rr32.8%
expm1-def48.3%
expm1-log1p95.5%
fma-udef95.5%
associate-*r*95.5%
fma-def95.5%
Simplified95.5%
Final simplification88.5%
(FPCore (J l K U)
:precision binary64
(let* ((t_0
(+ U (* (cos (/ K 2.0)) (* (pow l 3.0) (* J 0.3333333333333333)))))
(t_1 (fma (* J 2.0) (sinh l) U)))
(if (<= l -3.7e+93)
t_0
(if (<= l -0.009)
t_1
(if (<= l 9.2e+17)
(+ U (* (* l 2.0) (* J (cos (* K 0.5)))))
(if (<= l 3e+73) t_1 t_0))))))
double code(double J, double l, double K, double U) {
double t_0 = U + (cos((K / 2.0)) * (pow(l, 3.0) * (J * 0.3333333333333333)));
double t_1 = fma((J * 2.0), sinh(l), U);
double tmp;
if (l <= -3.7e+93) {
tmp = t_0;
} else if (l <= -0.009) {
tmp = t_1;
} else if (l <= 9.2e+17) {
tmp = U + ((l * 2.0) * (J * cos((K * 0.5))));
} else if (l <= 3e+73) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
function code(J, l, K, U) t_0 = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64((l ^ 3.0) * Float64(J * 0.3333333333333333)))) t_1 = fma(Float64(J * 2.0), sinh(l), U) tmp = 0.0 if (l <= -3.7e+93) tmp = t_0; elseif (l <= -0.009) tmp = t_1; elseif (l <= 9.2e+17) tmp = Float64(U + Float64(Float64(l * 2.0) * Float64(J * cos(Float64(K * 0.5))))); elseif (l <= 3e+73) tmp = t_1; else tmp = t_0; end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(N[Power[l, 3.0], $MachinePrecision] * N[(J * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(J * 2.0), $MachinePrecision] * N[Sinh[l], $MachinePrecision] + U), $MachinePrecision]}, If[LessEqual[l, -3.7e+93], t$95$0, If[LessEqual[l, -0.009], t$95$1, If[LessEqual[l, 9.2e+17], N[(U + N[(N[(l * 2.0), $MachinePrecision] * N[(J * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 3e+73], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + \cos \left(\frac{K}{2}\right) \cdot \left({\ell}^{3} \cdot \left(J \cdot 0.3333333333333333\right)\right)\\
t_1 := \mathsf{fma}\left(J \cdot 2, \sinh \ell, U\right)\\
\mathbf{if}\;\ell \leq -3.7 \cdot 10^{+93}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq -0.009:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\ell \leq 9.2 \cdot 10^{+17}:\\
\;\;\;\;U + \left(\ell \cdot 2\right) \cdot \left(J \cdot \cos \left(K \cdot 0.5\right)\right)\\
\mathbf{elif}\;\ell \leq 3 \cdot 10^{+73}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if l < -3.69999999999999987e93 or 3.00000000000000011e73 < l Initial program 100.0%
Taylor expanded in l around 0 96.7%
Taylor expanded in l around inf 96.7%
associate-*r*96.7%
*-commutative96.7%
Simplified96.7%
if -3.69999999999999987e93 < l < -0.00899999999999999932 or 9.2e17 < l < 3.00000000000000011e73Initial program 100.0%
Taylor expanded in K around 0 84.2%
expm1-log1p-u34.2%
expm1-udef34.2%
fma-def34.2%
sinh-undef34.2%
Applied egg-rr34.2%
expm1-def34.2%
expm1-log1p84.2%
fma-udef84.2%
associate-*r*84.2%
fma-def84.2%
Simplified84.2%
if -0.00899999999999999932 < l < 9.2e17Initial program 74.0%
Taylor expanded in l around 0 99.1%
*-commutative99.1%
associate-*l*99.2%
*-commutative99.2%
associate-*r*99.2%
Simplified99.2%
Final simplification96.1%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) 0.54) (+ U (* (* l 2.0) (* J (cos (* K 0.5))))) (+ U (* J (+ (* 0.3333333333333333 (pow l 3.0)) (* l 2.0))))))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= 0.54) {
tmp = U + ((l * 2.0) * (J * cos((K * 0.5))));
} else {
tmp = U + (J * ((0.3333333333333333 * pow(l, 3.0)) + (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
real(8) :: tmp
if (cos((k / 2.0d0)) <= 0.54d0) then
tmp = u + ((l * 2.0d0) * (j * cos((k * 0.5d0))))
else
tmp = u + (j * ((0.3333333333333333d0 * (l ** 3.0d0)) + (l * 2.0d0)))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (Math.cos((K / 2.0)) <= 0.54) {
tmp = U + ((l * 2.0) * (J * Math.cos((K * 0.5))));
} else {
tmp = U + (J * ((0.3333333333333333 * Math.pow(l, 3.0)) + (l * 2.0)));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if math.cos((K / 2.0)) <= 0.54: tmp = U + ((l * 2.0) * (J * math.cos((K * 0.5)))) else: tmp = U + (J * ((0.3333333333333333 * math.pow(l, 3.0)) + (l * 2.0))) return tmp
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= 0.54) tmp = Float64(U + Float64(Float64(l * 2.0) * Float64(J * cos(Float64(K * 0.5))))); else tmp = Float64(U + Float64(J * Float64(Float64(0.3333333333333333 * (l ^ 3.0)) + Float64(l * 2.0)))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (cos((K / 2.0)) <= 0.54) tmp = U + ((l * 2.0) * (J * cos((K * 0.5)))); else tmp = U + (J * ((0.3333333333333333 * (l ^ 3.0)) + (l * 2.0))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], 0.54], N[(U + N[(N[(l * 2.0), $MachinePrecision] * N[(J * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * N[(N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision] + N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq 0.54:\\
\;\;\;\;U + \left(\ell \cdot 2\right) \cdot \left(J \cdot \cos \left(K \cdot 0.5\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K 2)) < 0.54000000000000004Initial program 86.2%
Taylor expanded in l around 0 66.4%
*-commutative66.4%
associate-*l*66.4%
*-commutative66.4%
associate-*r*66.4%
Simplified66.4%
if 0.54000000000000004 < (cos.f64 (/.f64 K 2)) Initial program 86.5%
Taylor expanded in l around 0 87.0%
Taylor expanded in K around 0 84.4%
Final simplification78.0%
(FPCore (J l K U)
:precision binary64
(if (<= l -1.2e+42)
(* 0.3333333333333333 (* J (pow l 3.0)))
(if (<= l 4e+31)
(+ U (* 2.0 (* J (* l (cos (* K 0.5))))))
(* J (+ (* 0.3333333333333333 (pow l 3.0)) (* l 2.0))))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -1.2e+42) {
tmp = 0.3333333333333333 * (J * pow(l, 3.0));
} else if (l <= 4e+31) {
tmp = U + (2.0 * (J * (l * cos((K * 0.5)))));
} else {
tmp = J * ((0.3333333333333333 * pow(l, 3.0)) + (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
real(8) :: tmp
if (l <= (-1.2d+42)) then
tmp = 0.3333333333333333d0 * (j * (l ** 3.0d0))
else if (l <= 4d+31) then
tmp = u + (2.0d0 * (j * (l * cos((k * 0.5d0)))))
else
tmp = j * ((0.3333333333333333d0 * (l ** 3.0d0)) + (l * 2.0d0))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (l <= -1.2e+42) {
tmp = 0.3333333333333333 * (J * Math.pow(l, 3.0));
} else if (l <= 4e+31) {
tmp = U + (2.0 * (J * (l * Math.cos((K * 0.5)))));
} else {
tmp = J * ((0.3333333333333333 * Math.pow(l, 3.0)) + (l * 2.0));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -1.2e+42: tmp = 0.3333333333333333 * (J * math.pow(l, 3.0)) elif l <= 4e+31: tmp = U + (2.0 * (J * (l * math.cos((K * 0.5))))) else: tmp = J * ((0.3333333333333333 * math.pow(l, 3.0)) + (l * 2.0)) return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -1.2e+42) tmp = Float64(0.3333333333333333 * Float64(J * (l ^ 3.0))); elseif (l <= 4e+31) tmp = Float64(U + Float64(2.0 * Float64(J * Float64(l * cos(Float64(K * 0.5)))))); else tmp = Float64(J * Float64(Float64(0.3333333333333333 * (l ^ 3.0)) + Float64(l * 2.0))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -1.2e+42) tmp = 0.3333333333333333 * (J * (l ^ 3.0)); elseif (l <= 4e+31) tmp = U + (2.0 * (J * (l * cos((K * 0.5))))); else tmp = J * ((0.3333333333333333 * (l ^ 3.0)) + (l * 2.0)); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -1.2e+42], N[(0.3333333333333333 * N[(J * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 4e+31], N[(U + N[(2.0 * N[(J * N[(l * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(J * N[(N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision] + N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.2 \cdot 10^{+42}:\\
\;\;\;\;0.3333333333333333 \cdot \left(J \cdot {\ell}^{3}\right)\\
\mathbf{elif}\;\ell \leq 4 \cdot 10^{+31}:\\
\;\;\;\;U + 2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;J \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right)\\
\end{array}
\end{array}
if l < -1.1999999999999999e42Initial program 100.0%
Taylor expanded in l around 0 88.0%
Taylor expanded in K around 0 59.4%
Taylor expanded in l around inf 59.5%
if -1.1999999999999999e42 < l < 3.9999999999999999e31Initial program 76.9%
Taylor expanded in l around 0 88.9%
if 3.9999999999999999e31 < l Initial program 100.0%
Taylor expanded in l around 0 76.3%
Taylor expanded in K around 0 61.9%
Taylor expanded in J around inf 62.2%
Final simplification77.4%
(FPCore (J l K U)
:precision binary64
(if (<= l -1.9e+45)
(* 0.3333333333333333 (* J (pow l 3.0)))
(if (<= l 1.5e+29)
(+ U (* (* l 2.0) (* J (cos (* K 0.5)))))
(* J (+ (* 0.3333333333333333 (pow l 3.0)) (* l 2.0))))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -1.9e+45) {
tmp = 0.3333333333333333 * (J * pow(l, 3.0));
} else if (l <= 1.5e+29) {
tmp = U + ((l * 2.0) * (J * cos((K * 0.5))));
} else {
tmp = J * ((0.3333333333333333 * pow(l, 3.0)) + (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
real(8) :: tmp
if (l <= (-1.9d+45)) then
tmp = 0.3333333333333333d0 * (j * (l ** 3.0d0))
else if (l <= 1.5d+29) then
tmp = u + ((l * 2.0d0) * (j * cos((k * 0.5d0))))
else
tmp = j * ((0.3333333333333333d0 * (l ** 3.0d0)) + (l * 2.0d0))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (l <= -1.9e+45) {
tmp = 0.3333333333333333 * (J * Math.pow(l, 3.0));
} else if (l <= 1.5e+29) {
tmp = U + ((l * 2.0) * (J * Math.cos((K * 0.5))));
} else {
tmp = J * ((0.3333333333333333 * Math.pow(l, 3.0)) + (l * 2.0));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -1.9e+45: tmp = 0.3333333333333333 * (J * math.pow(l, 3.0)) elif l <= 1.5e+29: tmp = U + ((l * 2.0) * (J * math.cos((K * 0.5)))) else: tmp = J * ((0.3333333333333333 * math.pow(l, 3.0)) + (l * 2.0)) return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -1.9e+45) tmp = Float64(0.3333333333333333 * Float64(J * (l ^ 3.0))); elseif (l <= 1.5e+29) tmp = Float64(U + Float64(Float64(l * 2.0) * Float64(J * cos(Float64(K * 0.5))))); else tmp = Float64(J * Float64(Float64(0.3333333333333333 * (l ^ 3.0)) + Float64(l * 2.0))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -1.9e+45) tmp = 0.3333333333333333 * (J * (l ^ 3.0)); elseif (l <= 1.5e+29) tmp = U + ((l * 2.0) * (J * cos((K * 0.5)))); else tmp = J * ((0.3333333333333333 * (l ^ 3.0)) + (l * 2.0)); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -1.9e+45], N[(0.3333333333333333 * N[(J * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.5e+29], N[(U + N[(N[(l * 2.0), $MachinePrecision] * N[(J * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(J * N[(N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision] + N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.9 \cdot 10^{+45}:\\
\;\;\;\;0.3333333333333333 \cdot \left(J \cdot {\ell}^{3}\right)\\
\mathbf{elif}\;\ell \leq 1.5 \cdot 10^{+29}:\\
\;\;\;\;U + \left(\ell \cdot 2\right) \cdot \left(J \cdot \cos \left(K \cdot 0.5\right)\right)\\
\mathbf{else}:\\
\;\;\;\;J \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right)\\
\end{array}
\end{array}
if l < -1.9000000000000001e45Initial program 100.0%
Taylor expanded in l around 0 88.0%
Taylor expanded in K around 0 59.4%
Taylor expanded in l around inf 59.5%
if -1.9000000000000001e45 < l < 1.5e29Initial program 76.9%
Taylor expanded in l around 0 88.9%
*-commutative88.9%
associate-*l*89.0%
*-commutative89.0%
associate-*r*89.0%
Simplified89.0%
if 1.5e29 < l Initial program 100.0%
Taylor expanded in l around 0 76.3%
Taylor expanded in K around 0 61.9%
Taylor expanded in J around inf 62.2%
Final simplification77.4%
(FPCore (J l K U)
:precision binary64
(if (<= l -50000.0)
(* 0.3333333333333333 (* J (pow l 3.0)))
(if (<= l 3.7e+29)
(+ U (* J (* l 2.0)))
(* J (+ (* 0.3333333333333333 (pow l 3.0)) (* l 2.0))))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -50000.0) {
tmp = 0.3333333333333333 * (J * pow(l, 3.0));
} else if (l <= 3.7e+29) {
tmp = U + (J * (l * 2.0));
} else {
tmp = J * ((0.3333333333333333 * pow(l, 3.0)) + (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
real(8) :: tmp
if (l <= (-50000.0d0)) then
tmp = 0.3333333333333333d0 * (j * (l ** 3.0d0))
else if (l <= 3.7d+29) then
tmp = u + (j * (l * 2.0d0))
else
tmp = j * ((0.3333333333333333d0 * (l ** 3.0d0)) + (l * 2.0d0))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (l <= -50000.0) {
tmp = 0.3333333333333333 * (J * Math.pow(l, 3.0));
} else if (l <= 3.7e+29) {
tmp = U + (J * (l * 2.0));
} else {
tmp = J * ((0.3333333333333333 * Math.pow(l, 3.0)) + (l * 2.0));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -50000.0: tmp = 0.3333333333333333 * (J * math.pow(l, 3.0)) elif l <= 3.7e+29: tmp = U + (J * (l * 2.0)) else: tmp = J * ((0.3333333333333333 * math.pow(l, 3.0)) + (l * 2.0)) return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -50000.0) tmp = Float64(0.3333333333333333 * Float64(J * (l ^ 3.0))); elseif (l <= 3.7e+29) tmp = Float64(U + Float64(J * Float64(l * 2.0))); else tmp = Float64(J * Float64(Float64(0.3333333333333333 * (l ^ 3.0)) + Float64(l * 2.0))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -50000.0) tmp = 0.3333333333333333 * (J * (l ^ 3.0)); elseif (l <= 3.7e+29) tmp = U + (J * (l * 2.0)); else tmp = J * ((0.3333333333333333 * (l ^ 3.0)) + (l * 2.0)); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -50000.0], N[(0.3333333333333333 * N[(J * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 3.7e+29], N[(U + N[(J * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(J * N[(N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision] + N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -50000:\\
\;\;\;\;0.3333333333333333 \cdot \left(J \cdot {\ell}^{3}\right)\\
\mathbf{elif}\;\ell \leq 3.7 \cdot 10^{+29}:\\
\;\;\;\;U + J \cdot \left(\ell \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;J \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right)\\
\end{array}
\end{array}
if l < -5e4Initial program 100.0%
Taylor expanded in l around 0 74.4%
Taylor expanded in K around 0 49.4%
Taylor expanded in l around inf 49.5%
if -5e4 < l < 3.69999999999999974e29Initial program 74.9%
Taylor expanded in l around 0 95.7%
*-commutative95.7%
associate-*l*95.7%
*-commutative95.7%
associate-*r*95.7%
Simplified95.7%
Taylor expanded in K around 0 83.8%
if 3.69999999999999974e29 < l Initial program 100.0%
Taylor expanded in l around 0 76.3%
Taylor expanded in K around 0 61.9%
Taylor expanded in J around inf 62.2%
Final simplification70.5%
(FPCore (J l K U) :precision binary64 (if (or (<= l -116000.0) (not (<= l 1.35e+29))) (* 0.3333333333333333 (* J (pow l 3.0))) (+ U (* J (* l 2.0)))))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -116000.0) || !(l <= 1.35e+29)) {
tmp = 0.3333333333333333 * (J * pow(l, 3.0));
} else {
tmp = U + (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
real(8) :: tmp
if ((l <= (-116000.0d0)) .or. (.not. (l <= 1.35d+29))) then
tmp = 0.3333333333333333d0 * (j * (l ** 3.0d0))
else
tmp = u + (j * (l * 2.0d0))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -116000.0) || !(l <= 1.35e+29)) {
tmp = 0.3333333333333333 * (J * Math.pow(l, 3.0));
} else {
tmp = U + (J * (l * 2.0));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -116000.0) or not (l <= 1.35e+29): tmp = 0.3333333333333333 * (J * math.pow(l, 3.0)) else: tmp = U + (J * (l * 2.0)) return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -116000.0) || !(l <= 1.35e+29)) tmp = Float64(0.3333333333333333 * Float64(J * (l ^ 3.0))); else tmp = Float64(U + Float64(J * Float64(l * 2.0))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -116000.0) || ~((l <= 1.35e+29))) tmp = 0.3333333333333333 * (J * (l ^ 3.0)); else tmp = U + (J * (l * 2.0)); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -116000.0], N[Not[LessEqual[l, 1.35e+29]], $MachinePrecision]], N[(0.3333333333333333 * N[(J * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -116000 \lor \neg \left(\ell \leq 1.35 \cdot 10^{+29}\right):\\
\;\;\;\;0.3333333333333333 \cdot \left(J \cdot {\ell}^{3}\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(\ell \cdot 2\right)\\
\end{array}
\end{array}
if l < -116000 or 1.35e29 < l Initial program 100.0%
Taylor expanded in l around 0 75.2%
Taylor expanded in K around 0 54.6%
Taylor expanded in l around inf 54.8%
if -116000 < l < 1.35e29Initial program 74.9%
Taylor expanded in l around 0 95.7%
*-commutative95.7%
associate-*l*95.7%
*-commutative95.7%
associate-*r*95.7%
Simplified95.7%
Taylor expanded in K around 0 83.8%
Final simplification70.5%
(FPCore (J l K U) :precision binary64 (if (or (<= l -1.2e+35) (not (<= l 320.0))) (+ U (* J (* l (+ 2.0 (* -0.25 (* K K)))))) (+ U (* J (* l 2.0)))))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -1.2e+35) || !(l <= 320.0)) {
tmp = U + (J * (l * (2.0 + (-0.25 * (K * K)))));
} else {
tmp = U + (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
real(8) :: tmp
if ((l <= (-1.2d+35)) .or. (.not. (l <= 320.0d0))) then
tmp = u + (j * (l * (2.0d0 + ((-0.25d0) * (k * k)))))
else
tmp = u + (j * (l * 2.0d0))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -1.2e+35) || !(l <= 320.0)) {
tmp = U + (J * (l * (2.0 + (-0.25 * (K * K)))));
} else {
tmp = U + (J * (l * 2.0));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -1.2e+35) or not (l <= 320.0): tmp = U + (J * (l * (2.0 + (-0.25 * (K * K))))) else: tmp = U + (J * (l * 2.0)) return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -1.2e+35) || !(l <= 320.0)) tmp = Float64(U + Float64(J * Float64(l * Float64(2.0 + Float64(-0.25 * Float64(K * K)))))); else tmp = Float64(U + Float64(J * Float64(l * 2.0))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -1.2e+35) || ~((l <= 320.0))) tmp = U + (J * (l * (2.0 + (-0.25 * (K * K))))); else tmp = U + (J * (l * 2.0)); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -1.2e+35], N[Not[LessEqual[l, 320.0]], $MachinePrecision]], N[(U + N[(J * N[(l * N[(2.0 + N[(-0.25 * N[(K * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.2 \cdot 10^{+35} \lor \neg \left(\ell \leq 320\right):\\
\;\;\;\;U + J \cdot \left(\ell \cdot \left(2 + -0.25 \cdot \left(K \cdot K\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(\ell \cdot 2\right)\\
\end{array}
\end{array}
if l < -1.20000000000000007e35 or 320 < l Initial program 100.0%
Taylor expanded in l around 0 34.2%
*-commutative34.2%
associate-*l*34.2%
*-commutative34.2%
associate-*r*34.2%
Simplified34.2%
Taylor expanded in K around 0 28.3%
+-commutative28.3%
fma-def28.3%
*-commutative28.3%
*-commutative28.3%
associate-*l*28.3%
*-commutative28.3%
unpow228.3%
Simplified28.3%
Taylor expanded in J around 0 40.6%
unpow240.6%
associate-*r*40.6%
distribute-rgt-out40.6%
Simplified40.6%
if -1.20000000000000007e35 < l < 320Initial program 75.6%
Taylor expanded in l around 0 93.0%
*-commutative93.0%
associate-*l*93.0%
*-commutative93.0%
associate-*r*93.0%
Simplified93.0%
Taylor expanded in K around 0 81.5%
Final simplification63.5%
(FPCore (J l K U) :precision binary64 (if (or (<= l -750.0) (not (<= l 2.55e-79))) (* J (* l 2.0)) U))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -750.0) || !(l <= 2.55e-79)) {
tmp = J * (l * 2.0);
} else {
tmp = U;
}
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
real(8) :: tmp
if ((l <= (-750.0d0)) .or. (.not. (l <= 2.55d-79))) then
tmp = j * (l * 2.0d0)
else
tmp = u
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -750.0) || !(l <= 2.55e-79)) {
tmp = J * (l * 2.0);
} else {
tmp = U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -750.0) or not (l <= 2.55e-79): tmp = J * (l * 2.0) else: tmp = U return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -750.0) || !(l <= 2.55e-79)) tmp = Float64(J * Float64(l * 2.0)); else tmp = U; end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -750.0) || ~((l <= 2.55e-79))) tmp = J * (l * 2.0); else tmp = U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -750.0], N[Not[LessEqual[l, 2.55e-79]], $MachinePrecision]], N[(J * N[(l * 2.0), $MachinePrecision]), $MachinePrecision], U]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -750 \lor \neg \left(\ell \leq 2.55 \cdot 10^{-79}\right):\\
\;\;\;\;J \cdot \left(\ell \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\end{array}
if l < -750 or 2.55e-79 < l Initial program 93.8%
Taylor expanded in l around 0 38.9%
*-commutative38.9%
associate-*l*38.9%
*-commutative38.9%
associate-*r*38.9%
Simplified38.9%
Taylor expanded in K around 0 27.4%
Taylor expanded in l around inf 23.4%
*-commutative23.4%
associate-*r*23.4%
Simplified23.4%
if -750 < l < 2.55e-79Initial program 77.7%
Applied egg-rr59.6%
Taylor expanded in J around 0 77.7%
Final simplification48.4%
(FPCore (J l K U) :precision binary64 (+ U (* J (* l 2.0))))
double code(double J, double l, double K, double U) {
return U + (J * (l * 2.0));
}
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 = u + (j * (l * 2.0d0))
end function
public static double code(double J, double l, double K, double U) {
return U + (J * (l * 2.0));
}
def code(J, l, K, U): return U + (J * (l * 2.0))
function code(J, l, K, U) return Float64(U + Float64(J * Float64(l * 2.0))) end
function tmp = code(J, l, K, U) tmp = U + (J * (l * 2.0)); end
code[J_, l_, K_, U_] := N[(U + N[(J * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + J \cdot \left(\ell \cdot 2\right)
\end{array}
Initial program 86.4%
Taylor expanded in l around 0 67.0%
*-commutative67.0%
associate-*l*67.1%
*-commutative67.1%
associate-*r*67.1%
Simplified67.1%
Taylor expanded in K around 0 55.7%
Final simplification55.7%
(FPCore (J l K U) :precision binary64 U)
double code(double J, double l, double K, double U) {
return U;
}
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 = u
end function
public static double code(double J, double l, double K, double U) {
return U;
}
def code(J, l, K, U): return U
function code(J, l, K, U) return U end
function tmp = code(J, l, K, U) tmp = U; end
code[J_, l_, K_, U_] := U
\begin{array}{l}
\\
U
\end{array}
Initial program 86.4%
Applied egg-rr31.0%
Taylor expanded in J around 0 39.2%
Final simplification39.2%
herbie shell --seed 2023287
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))