
(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 16 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 (- (exp l) (exp (- l)))))
(if (or (<= t_0 -0.05) (not (<= t_0 0.005)))
(+ (* J (* t_0 (cos (* 0.5 K)))) U)
(+
U
(*
(*
J
(*
l
(+
2.0
(*
(* l l)
(+ 0.3333333333333333 (* (* l l) 0.016666666666666666))))))
(cos (/ K 2.0)))))))
double code(double J, double l, double K, double U) {
double t_0 = exp(l) - exp(-l);
double tmp;
if ((t_0 <= -0.05) || !(t_0 <= 0.005)) {
tmp = (J * (t_0 * cos((0.5 * K)))) + U;
} else {
tmp = U + ((J * (l * (2.0 + ((l * l) * (0.3333333333333333 + ((l * l) * 0.016666666666666666)))))) * cos((K / 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) :: t_0
real(8) :: tmp
t_0 = exp(l) - exp(-l)
if ((t_0 <= (-0.05d0)) .or. (.not. (t_0 <= 0.005d0))) then
tmp = (j * (t_0 * cos((0.5d0 * k)))) + u
else
tmp = u + ((j * (l * (2.0d0 + ((l * l) * (0.3333333333333333d0 + ((l * l) * 0.016666666666666666d0)))))) * cos((k / 2.0d0)))
end if
code = tmp
end function
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 <= -0.05) || !(t_0 <= 0.005)) {
tmp = (J * (t_0 * Math.cos((0.5 * K)))) + U;
} else {
tmp = U + ((J * (l * (2.0 + ((l * l) * (0.3333333333333333 + ((l * l) * 0.016666666666666666)))))) * Math.cos((K / 2.0)));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.exp(l) - math.exp(-l) tmp = 0 if (t_0 <= -0.05) or not (t_0 <= 0.005): tmp = (J * (t_0 * math.cos((0.5 * K)))) + U else: tmp = U + ((J * (l * (2.0 + ((l * l) * (0.3333333333333333 + ((l * l) * 0.016666666666666666)))))) * math.cos((K / 2.0))) return tmp
function code(J, l, K, U) t_0 = Float64(exp(l) - exp(Float64(-l))) tmp = 0.0 if ((t_0 <= -0.05) || !(t_0 <= 0.005)) tmp = Float64(Float64(J * Float64(t_0 * cos(Float64(0.5 * K)))) + U); else tmp = Float64(U + Float64(Float64(J * Float64(l * Float64(2.0 + Float64(Float64(l * l) * Float64(0.3333333333333333 + Float64(Float64(l * l) * 0.016666666666666666)))))) * cos(Float64(K / 2.0)))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = exp(l) - exp(-l); tmp = 0.0; if ((t_0 <= -0.05) || ~((t_0 <= 0.005))) tmp = (J * (t_0 * cos((0.5 * K)))) + U; else tmp = U + ((J * (l * (2.0 + ((l * l) * (0.3333333333333333 + ((l * l) * 0.016666666666666666)))))) * cos((K / 2.0))); end tmp_2 = tmp; end
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, -0.05], N[Not[LessEqual[t$95$0, 0.005]], $MachinePrecision]], N[(N[(J * N[(t$95$0 * N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], N[(U + N[(N[(J * N[(l * N[(2.0 + N[(N[(l * l), $MachinePrecision] * N[(0.3333333333333333 + N[(N[(l * l), $MachinePrecision] * 0.016666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{\ell} - e^{-\ell}\\
\mathbf{if}\;t\_0 \leq -0.05 \lor \neg \left(t\_0 \leq 0.005\right):\\
\;\;\;\;J \cdot \left(t\_0 \cdot \cos \left(0.5 \cdot K\right)\right) + U\\
\mathbf{else}:\\
\;\;\;\;U + \left(J \cdot \left(\ell \cdot \left(2 + \left(\ell \cdot \ell\right) \cdot \left(0.3333333333333333 + \left(\ell \cdot \ell\right) \cdot 0.016666666666666666\right)\right)\right)\right) \cdot \cos \left(\frac{K}{2}\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -0.050000000000000003 or 0.0050000000000000001 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 100.0%
Taylor expanded in J around 0 100.0%
if -0.050000000000000003 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 0.0050000000000000001Initial program 69.7%
Taylor expanded in l around 0 99.9%
*-commutative99.9%
Simplified99.9%
unpow299.9%
Applied egg-rr99.9%
unpow299.9%
Applied egg-rr99.9%
Final simplification100.0%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))) (t_1 (exp (- l))))
(if (<= (- (exp l) t_1) (- INFINITY))
(+ U (* t_0 (* J (- 27.0 t_1))))
(+
U
(*
(*
J
(*
l
(+
2.0
(*
(* l l)
(+ 0.3333333333333333 (* (* l l) 0.016666666666666666))))))
t_0)))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double t_1 = exp(-l);
double tmp;
if ((exp(l) - t_1) <= -((double) INFINITY)) {
tmp = U + (t_0 * (J * (27.0 - t_1)));
} else {
tmp = U + ((J * (l * (2.0 + ((l * l) * (0.3333333333333333 + ((l * l) * 0.016666666666666666)))))) * t_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);
double tmp;
if ((Math.exp(l) - t_1) <= -Double.POSITIVE_INFINITY) {
tmp = U + (t_0 * (J * (27.0 - t_1)));
} else {
tmp = U + ((J * (l * (2.0 + ((l * l) * (0.3333333333333333 + ((l * l) * 0.016666666666666666)))))) * t_0);
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K / 2.0)) t_1 = math.exp(-l) tmp = 0 if (math.exp(l) - t_1) <= -math.inf: tmp = U + (t_0 * (J * (27.0 - t_1))) else: tmp = U + ((J * (l * (2.0 + ((l * l) * (0.3333333333333333 + ((l * l) * 0.016666666666666666)))))) * t_0) return tmp
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) t_1 = exp(Float64(-l)) tmp = 0.0 if (Float64(exp(l) - t_1) <= Float64(-Inf)) tmp = Float64(U + Float64(t_0 * Float64(J * Float64(27.0 - t_1)))); else tmp = Float64(U + Float64(Float64(J * Float64(l * Float64(2.0 + Float64(Float64(l * l) * Float64(0.3333333333333333 + Float64(Float64(l * l) * 0.016666666666666666)))))) * t_0)); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = cos((K / 2.0)); t_1 = exp(-l); tmp = 0.0; if ((exp(l) - t_1) <= -Inf) tmp = U + (t_0 * (J * (27.0 - t_1))); else tmp = U + ((J * (l * (2.0 + ((l * l) * (0.3333333333333333 + ((l * l) * 0.016666666666666666)))))) * t_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[Exp[(-l)], $MachinePrecision]}, If[LessEqual[N[(N[Exp[l], $MachinePrecision] - t$95$1), $MachinePrecision], (-Infinity)], N[(U + N[(t$95$0 * N[(J * N[(27.0 - t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(N[(J * N[(l * N[(2.0 + N[(N[(l * l), $MachinePrecision] * N[(0.3333333333333333 + N[(N[(l * l), $MachinePrecision] * 0.016666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
t_1 := e^{-\ell}\\
\mathbf{if}\;e^{\ell} - t\_1 \leq -\infty:\\
\;\;\;\;U + t\_0 \cdot \left(J \cdot \left(27 - t\_1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + \left(J \cdot \left(\ell \cdot \left(2 + \left(\ell \cdot \ell\right) \cdot \left(0.3333333333333333 + \left(\ell \cdot \ell\right) \cdot 0.016666666666666666\right)\right)\right)\right) \cdot t\_0\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -inf.0Initial program 100.0%
Applied egg-rr100.0%
if -inf.0 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 80.8%
Taylor expanded in l around 0 92.4%
*-commutative92.4%
Simplified92.4%
unpow292.4%
Applied egg-rr92.4%
unpow292.4%
Applied egg-rr92.4%
Final simplification94.6%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0)))
(t_1
(+
U
(*
t_0
(*
J
(+ 26.0 (* l (+ 1.0 (* l (- (* l 0.16666666666666666) 0.5))))))))))
(if (<= l -1.95e+138)
t_1
(if (<= l -5.2)
(+ U (* J (- 27.0 (exp (- l)))))
(if (<= l 4.2e-58)
(+ U (* t_0 (* J (* l 2.0))))
(if (<= l 5.6e+101)
(+
U
(*
(*
J
(*
l
(+
2.0
(*
(* l l)
(+ 0.3333333333333333 (* (* l l) 0.016666666666666666))))))
(cos (* K -4.0))))
t_1))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double t_1 = U + (t_0 * (J * (26.0 + (l * (1.0 + (l * ((l * 0.16666666666666666) - 0.5)))))));
double tmp;
if (l <= -1.95e+138) {
tmp = t_1;
} else if (l <= -5.2) {
tmp = U + (J * (27.0 - exp(-l)));
} else if (l <= 4.2e-58) {
tmp = U + (t_0 * (J * (l * 2.0)));
} else if (l <= 5.6e+101) {
tmp = U + ((J * (l * (2.0 + ((l * l) * (0.3333333333333333 + ((l * l) * 0.016666666666666666)))))) * cos((K * -4.0)));
} else {
tmp = t_1;
}
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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = cos((k / 2.0d0))
t_1 = u + (t_0 * (j * (26.0d0 + (l * (1.0d0 + (l * ((l * 0.16666666666666666d0) - 0.5d0)))))))
if (l <= (-1.95d+138)) then
tmp = t_1
else if (l <= (-5.2d0)) then
tmp = u + (j * (27.0d0 - exp(-l)))
else if (l <= 4.2d-58) then
tmp = u + (t_0 * (j * (l * 2.0d0)))
else if (l <= 5.6d+101) then
tmp = u + ((j * (l * (2.0d0 + ((l * l) * (0.3333333333333333d0 + ((l * l) * 0.016666666666666666d0)))))) * cos((k * (-4.0d0))))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = Math.cos((K / 2.0));
double t_1 = U + (t_0 * (J * (26.0 + (l * (1.0 + (l * ((l * 0.16666666666666666) - 0.5)))))));
double tmp;
if (l <= -1.95e+138) {
tmp = t_1;
} else if (l <= -5.2) {
tmp = U + (J * (27.0 - Math.exp(-l)));
} else if (l <= 4.2e-58) {
tmp = U + (t_0 * (J * (l * 2.0)));
} else if (l <= 5.6e+101) {
tmp = U + ((J * (l * (2.0 + ((l * l) * (0.3333333333333333 + ((l * l) * 0.016666666666666666)))))) * Math.cos((K * -4.0)));
} else {
tmp = t_1;
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K / 2.0)) t_1 = U + (t_0 * (J * (26.0 + (l * (1.0 + (l * ((l * 0.16666666666666666) - 0.5))))))) tmp = 0 if l <= -1.95e+138: tmp = t_1 elif l <= -5.2: tmp = U + (J * (27.0 - math.exp(-l))) elif l <= 4.2e-58: tmp = U + (t_0 * (J * (l * 2.0))) elif l <= 5.6e+101: tmp = U + ((J * (l * (2.0 + ((l * l) * (0.3333333333333333 + ((l * l) * 0.016666666666666666)))))) * math.cos((K * -4.0))) else: tmp = t_1 return tmp
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) t_1 = Float64(U + Float64(t_0 * Float64(J * Float64(26.0 + Float64(l * Float64(1.0 + Float64(l * Float64(Float64(l * 0.16666666666666666) - 0.5)))))))) tmp = 0.0 if (l <= -1.95e+138) tmp = t_1; elseif (l <= -5.2) tmp = Float64(U + Float64(J * Float64(27.0 - exp(Float64(-l))))); elseif (l <= 4.2e-58) tmp = Float64(U + Float64(t_0 * Float64(J * Float64(l * 2.0)))); elseif (l <= 5.6e+101) tmp = Float64(U + Float64(Float64(J * Float64(l * Float64(2.0 + Float64(Float64(l * l) * Float64(0.3333333333333333 + Float64(Float64(l * l) * 0.016666666666666666)))))) * cos(Float64(K * -4.0)))); else tmp = t_1; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = cos((K / 2.0)); t_1 = U + (t_0 * (J * (26.0 + (l * (1.0 + (l * ((l * 0.16666666666666666) - 0.5))))))); tmp = 0.0; if (l <= -1.95e+138) tmp = t_1; elseif (l <= -5.2) tmp = U + (J * (27.0 - exp(-l))); elseif (l <= 4.2e-58) tmp = U + (t_0 * (J * (l * 2.0))); elseif (l <= 5.6e+101) tmp = U + ((J * (l * (2.0 + ((l * l) * (0.3333333333333333 + ((l * l) * 0.016666666666666666)))))) * cos((K * -4.0))); else tmp = t_1; 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[(U + N[(t$95$0 * N[(J * N[(26.0 + N[(l * N[(1.0 + N[(l * N[(N[(l * 0.16666666666666666), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -1.95e+138], t$95$1, If[LessEqual[l, -5.2], N[(U + N[(J * N[(27.0 - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 4.2e-58], N[(U + N[(t$95$0 * N[(J * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 5.6e+101], N[(U + N[(N[(J * N[(l * N[(2.0 + N[(N[(l * l), $MachinePrecision] * N[(0.3333333333333333 + N[(N[(l * l), $MachinePrecision] * 0.016666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K * -4.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
t_1 := U + t\_0 \cdot \left(J \cdot \left(26 + \ell \cdot \left(1 + \ell \cdot \left(\ell \cdot 0.16666666666666666 - 0.5\right)\right)\right)\right)\\
\mathbf{if}\;\ell \leq -1.95 \cdot 10^{+138}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\ell \leq -5.2:\\
\;\;\;\;U + J \cdot \left(27 - e^{-\ell}\right)\\
\mathbf{elif}\;\ell \leq 4.2 \cdot 10^{-58}:\\
\;\;\;\;U + t\_0 \cdot \left(J \cdot \left(\ell \cdot 2\right)\right)\\
\mathbf{elif}\;\ell \leq 5.6 \cdot 10^{+101}:\\
\;\;\;\;U + \left(J \cdot \left(\ell \cdot \left(2 + \left(\ell \cdot \ell\right) \cdot \left(0.3333333333333333 + \left(\ell \cdot \ell\right) \cdot 0.016666666666666666\right)\right)\right)\right) \cdot \cos \left(K \cdot -4\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if l < -1.9499999999999999e138 or 5.59999999999999962e101 < l Initial program 100.0%
Applied egg-rr56.0%
Taylor expanded in l around 0 100.0%
if -1.9499999999999999e138 < l < -5.20000000000000018Initial program 100.0%
Applied egg-rr100.0%
Taylor expanded in K around 0 78.1%
if -5.20000000000000018 < l < 4.19999999999999975e-58Initial program 70.6%
Taylor expanded in l around 0 99.3%
*-commutative99.3%
associate-*l*99.3%
Simplified99.3%
if 4.19999999999999975e-58 < l < 5.59999999999999962e101Initial program 90.0%
Taylor expanded in l around 0 63.6%
*-commutative63.6%
Simplified63.6%
unpow263.6%
Applied egg-rr63.6%
unpow263.6%
Applied egg-rr63.6%
Applied egg-rr53.4%
rem-log-exp53.4%
*-commutative53.4%
Simplified53.4%
Final simplification90.2%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0)))
(t_1
(+
U
(*
t_0
(*
J
(+ 26.0 (* l (+ 1.0 (* l (- (* l 0.16666666666666666) 0.5))))))))))
(if (<= l -1.95e+138)
t_1
(if (<= l -5.8)
(+ U (* J (- 27.0 (exp (- l)))))
(if (<= l 2.5) (+ U (* t_0 (* J (* l 2.0)))) t_1)))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double t_1 = U + (t_0 * (J * (26.0 + (l * (1.0 + (l * ((l * 0.16666666666666666) - 0.5)))))));
double tmp;
if (l <= -1.95e+138) {
tmp = t_1;
} else if (l <= -5.8) {
tmp = U + (J * (27.0 - exp(-l)));
} else if (l <= 2.5) {
tmp = U + (t_0 * (J * (l * 2.0)));
} else {
tmp = t_1;
}
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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = cos((k / 2.0d0))
t_1 = u + (t_0 * (j * (26.0d0 + (l * (1.0d0 + (l * ((l * 0.16666666666666666d0) - 0.5d0)))))))
if (l <= (-1.95d+138)) then
tmp = t_1
else if (l <= (-5.8d0)) then
tmp = u + (j * (27.0d0 - exp(-l)))
else if (l <= 2.5d0) then
tmp = u + (t_0 * (j * (l * 2.0d0)))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = Math.cos((K / 2.0));
double t_1 = U + (t_0 * (J * (26.0 + (l * (1.0 + (l * ((l * 0.16666666666666666) - 0.5)))))));
double tmp;
if (l <= -1.95e+138) {
tmp = t_1;
} else if (l <= -5.8) {
tmp = U + (J * (27.0 - Math.exp(-l)));
} else if (l <= 2.5) {
tmp = U + (t_0 * (J * (l * 2.0)));
} else {
tmp = t_1;
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K / 2.0)) t_1 = U + (t_0 * (J * (26.0 + (l * (1.0 + (l * ((l * 0.16666666666666666) - 0.5))))))) tmp = 0 if l <= -1.95e+138: tmp = t_1 elif l <= -5.8: tmp = U + (J * (27.0 - math.exp(-l))) elif l <= 2.5: tmp = U + (t_0 * (J * (l * 2.0))) else: tmp = t_1 return tmp
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) t_1 = Float64(U + Float64(t_0 * Float64(J * Float64(26.0 + Float64(l * Float64(1.0 + Float64(l * Float64(Float64(l * 0.16666666666666666) - 0.5)))))))) tmp = 0.0 if (l <= -1.95e+138) tmp = t_1; elseif (l <= -5.8) tmp = Float64(U + Float64(J * Float64(27.0 - exp(Float64(-l))))); elseif (l <= 2.5) tmp = Float64(U + Float64(t_0 * Float64(J * Float64(l * 2.0)))); else tmp = t_1; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = cos((K / 2.0)); t_1 = U + (t_0 * (J * (26.0 + (l * (1.0 + (l * ((l * 0.16666666666666666) - 0.5))))))); tmp = 0.0; if (l <= -1.95e+138) tmp = t_1; elseif (l <= -5.8) tmp = U + (J * (27.0 - exp(-l))); elseif (l <= 2.5) tmp = U + (t_0 * (J * (l * 2.0))); else tmp = t_1; 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[(U + N[(t$95$0 * N[(J * N[(26.0 + N[(l * N[(1.0 + N[(l * N[(N[(l * 0.16666666666666666), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -1.95e+138], t$95$1, If[LessEqual[l, -5.8], N[(U + N[(J * N[(27.0 - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.5], N[(U + N[(t$95$0 * N[(J * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
t_1 := U + t\_0 \cdot \left(J \cdot \left(26 + \ell \cdot \left(1 + \ell \cdot \left(\ell \cdot 0.16666666666666666 - 0.5\right)\right)\right)\right)\\
\mathbf{if}\;\ell \leq -1.95 \cdot 10^{+138}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\ell \leq -5.8:\\
\;\;\;\;U + J \cdot \left(27 - e^{-\ell}\right)\\
\mathbf{elif}\;\ell \leq 2.5:\\
\;\;\;\;U + t\_0 \cdot \left(J \cdot \left(\ell \cdot 2\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if l < -1.9499999999999999e138 or 2.5 < l Initial program 100.0%
Applied egg-rr43.5%
Taylor expanded in l around 0 78.7%
if -1.9499999999999999e138 < l < -5.79999999999999982Initial program 100.0%
Applied egg-rr100.0%
Taylor expanded in K around 0 78.1%
if -5.79999999999999982 < l < 2.5Initial program 70.2%
Taylor expanded in l around 0 98.3%
*-commutative98.3%
associate-*l*98.3%
Simplified98.3%
Final simplification87.6%
(FPCore (J l K U)
:precision binary64
(if (<= l -5.8)
(+ U (* J (- 27.0 (exp (- l)))))
(if (<= l 1000.0)
(+ U (* (cos (/ K 2.0)) (* J (* l 2.0))))
(if (<= l 1.25e+244)
(+ U (* l (+ (* -0.25 (* J (pow K 2.0))) (* J 2.0))))
(+ U (* J (* (cos (* 0.5 K)) (* l 2.0))))))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -5.8) {
tmp = U + (J * (27.0 - exp(-l)));
} else if (l <= 1000.0) {
tmp = U + (cos((K / 2.0)) * (J * (l * 2.0)));
} else if (l <= 1.25e+244) {
tmp = U + (l * ((-0.25 * (J * pow(K, 2.0))) + (J * 2.0)));
} else {
tmp = U + (J * (cos((0.5 * K)) * (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 <= (-5.8d0)) then
tmp = u + (j * (27.0d0 - exp(-l)))
else if (l <= 1000.0d0) then
tmp = u + (cos((k / 2.0d0)) * (j * (l * 2.0d0)))
else if (l <= 1.25d+244) then
tmp = u + (l * (((-0.25d0) * (j * (k ** 2.0d0))) + (j * 2.0d0)))
else
tmp = u + (j * (cos((0.5d0 * k)) * (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 <= -5.8) {
tmp = U + (J * (27.0 - Math.exp(-l)));
} else if (l <= 1000.0) {
tmp = U + (Math.cos((K / 2.0)) * (J * (l * 2.0)));
} else if (l <= 1.25e+244) {
tmp = U + (l * ((-0.25 * (J * Math.pow(K, 2.0))) + (J * 2.0)));
} else {
tmp = U + (J * (Math.cos((0.5 * K)) * (l * 2.0)));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -5.8: tmp = U + (J * (27.0 - math.exp(-l))) elif l <= 1000.0: tmp = U + (math.cos((K / 2.0)) * (J * (l * 2.0))) elif l <= 1.25e+244: tmp = U + (l * ((-0.25 * (J * math.pow(K, 2.0))) + (J * 2.0))) else: tmp = U + (J * (math.cos((0.5 * K)) * (l * 2.0))) return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -5.8) tmp = Float64(U + Float64(J * Float64(27.0 - exp(Float64(-l))))); elseif (l <= 1000.0) tmp = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(J * Float64(l * 2.0)))); elseif (l <= 1.25e+244) tmp = Float64(U + Float64(l * Float64(Float64(-0.25 * Float64(J * (K ^ 2.0))) + Float64(J * 2.0)))); else tmp = Float64(U + Float64(J * Float64(cos(Float64(0.5 * K)) * Float64(l * 2.0)))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -5.8) tmp = U + (J * (27.0 - exp(-l))); elseif (l <= 1000.0) tmp = U + (cos((K / 2.0)) * (J * (l * 2.0))); elseif (l <= 1.25e+244) tmp = U + (l * ((-0.25 * (J * (K ^ 2.0))) + (J * 2.0))); else tmp = U + (J * (cos((0.5 * K)) * (l * 2.0))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -5.8], N[(U + N[(J * N[(27.0 - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1000.0], N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(J * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.25e+244], N[(U + N[(l * N[(N[(-0.25 * N[(J * N[Power[K, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * N[(N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision] * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -5.8:\\
\;\;\;\;U + J \cdot \left(27 - e^{-\ell}\right)\\
\mathbf{elif}\;\ell \leq 1000:\\
\;\;\;\;U + \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(\ell \cdot 2\right)\right)\\
\mathbf{elif}\;\ell \leq 1.25 \cdot 10^{+244}:\\
\;\;\;\;U + \ell \cdot \left(-0.25 \cdot \left(J \cdot {K}^{2}\right) + J \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(\cos \left(0.5 \cdot K\right) \cdot \left(\ell \cdot 2\right)\right)\\
\end{array}
\end{array}
if l < -5.79999999999999982Initial program 100.0%
Applied egg-rr100.0%
Taylor expanded in K around 0 76.0%
if -5.79999999999999982 < l < 1e3Initial program 70.7%
Taylor expanded in l around 0 96.9%
*-commutative96.9%
associate-*l*96.9%
Simplified96.9%
if 1e3 < l < 1.25000000000000006e244Initial program 100.0%
Taylor expanded in l around 0 76.9%
*-commutative76.9%
Simplified76.9%
Taylor expanded in l around 0 12.3%
*-commutative12.3%
associate-*r*12.3%
associate-*l*12.3%
*-commutative12.3%
associate-*r*12.3%
Simplified12.3%
Taylor expanded in K around 0 34.2%
if 1.25000000000000006e244 < l Initial program 100.0%
Taylor expanded in l around 0 70.6%
*-commutative70.6%
associate-*l*70.6%
*-commutative70.6%
associate-*l*70.6%
Simplified70.6%
Final simplification77.4%
(FPCore (J l K U)
:precision binary64
(if (<= l -5.8)
(+ U (* J (- 27.0 (exp (- l)))))
(if (or (<= l 250.0) (not (<= l 1.85e+202)))
(+ U (* J (* (cos (* 0.5 K)) (* l 2.0))))
(+ U (* (* l J) (* -0.25 (pow K 2.0)))))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -5.8) {
tmp = U + (J * (27.0 - exp(-l)));
} else if ((l <= 250.0) || !(l <= 1.85e+202)) {
tmp = U + (J * (cos((0.5 * K)) * (l * 2.0)));
} else {
tmp = U + ((l * J) * (-0.25 * pow(K, 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 <= (-5.8d0)) then
tmp = u + (j * (27.0d0 - exp(-l)))
else if ((l <= 250.0d0) .or. (.not. (l <= 1.85d+202))) then
tmp = u + (j * (cos((0.5d0 * k)) * (l * 2.0d0)))
else
tmp = u + ((l * j) * ((-0.25d0) * (k ** 2.0d0)))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (l <= -5.8) {
tmp = U + (J * (27.0 - Math.exp(-l)));
} else if ((l <= 250.0) || !(l <= 1.85e+202)) {
tmp = U + (J * (Math.cos((0.5 * K)) * (l * 2.0)));
} else {
tmp = U + ((l * J) * (-0.25 * Math.pow(K, 2.0)));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -5.8: tmp = U + (J * (27.0 - math.exp(-l))) elif (l <= 250.0) or not (l <= 1.85e+202): tmp = U + (J * (math.cos((0.5 * K)) * (l * 2.0))) else: tmp = U + ((l * J) * (-0.25 * math.pow(K, 2.0))) return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -5.8) tmp = Float64(U + Float64(J * Float64(27.0 - exp(Float64(-l))))); elseif ((l <= 250.0) || !(l <= 1.85e+202)) tmp = Float64(U + Float64(J * Float64(cos(Float64(0.5 * K)) * Float64(l * 2.0)))); else tmp = Float64(U + Float64(Float64(l * J) * Float64(-0.25 * (K ^ 2.0)))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -5.8) tmp = U + (J * (27.0 - exp(-l))); elseif ((l <= 250.0) || ~((l <= 1.85e+202))) tmp = U + (J * (cos((0.5 * K)) * (l * 2.0))); else tmp = U + ((l * J) * (-0.25 * (K ^ 2.0))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -5.8], N[(U + N[(J * N[(27.0 - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[l, 250.0], N[Not[LessEqual[l, 1.85e+202]], $MachinePrecision]], N[(U + N[(J * N[(N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision] * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(N[(l * J), $MachinePrecision] * N[(-0.25 * N[Power[K, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -5.8:\\
\;\;\;\;U + J \cdot \left(27 - e^{-\ell}\right)\\
\mathbf{elif}\;\ell \leq 250 \lor \neg \left(\ell \leq 1.85 \cdot 10^{+202}\right):\\
\;\;\;\;U + J \cdot \left(\cos \left(0.5 \cdot K\right) \cdot \left(\ell \cdot 2\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + \left(\ell \cdot J\right) \cdot \left(-0.25 \cdot {K}^{2}\right)\\
\end{array}
\end{array}
if l < -5.79999999999999982Initial program 100.0%
Applied egg-rr100.0%
Taylor expanded in K around 0 76.0%
if -5.79999999999999982 < l < 250 or 1.8499999999999999e202 < l Initial program 74.4%
Taylor expanded in l around 0 92.4%
*-commutative92.4%
associate-*l*92.4%
*-commutative92.4%
associate-*l*92.4%
Simplified92.4%
if 250 < l < 1.8499999999999999e202Initial program 100.0%
Taylor expanded in l around 0 72.9%
*-commutative72.9%
Simplified72.9%
Taylor expanded in l around 0 10.8%
*-commutative10.8%
associate-*r*10.8%
associate-*l*10.8%
*-commutative10.8%
associate-*r*10.8%
Simplified10.8%
Taylor expanded in K around 0 28.2%
Taylor expanded in K around inf 32.1%
*-commutative32.1%
associate-*r*32.2%
associate-*r*32.2%
*-commutative32.2%
associate-*l*32.2%
*-commutative32.2%
Simplified32.2%
Final simplification77.0%
(FPCore (J l K U)
:precision binary64
(if (<= l -4.5)
(+ U (* J (- 27.0 (exp (- l)))))
(if (<= l 300.0)
(+ U (* (cos (/ K 2.0)) (* J (* l 2.0))))
(if (<= l 4.6e+199)
(+ U (* (* l J) (* -0.25 (pow K 2.0))))
(+ U (* J (* (cos (* 0.5 K)) (* l 2.0))))))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -4.5) {
tmp = U + (J * (27.0 - exp(-l)));
} else if (l <= 300.0) {
tmp = U + (cos((K / 2.0)) * (J * (l * 2.0)));
} else if (l <= 4.6e+199) {
tmp = U + ((l * J) * (-0.25 * pow(K, 2.0)));
} else {
tmp = U + (J * (cos((0.5 * K)) * (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 <= (-4.5d0)) then
tmp = u + (j * (27.0d0 - exp(-l)))
else if (l <= 300.0d0) then
tmp = u + (cos((k / 2.0d0)) * (j * (l * 2.0d0)))
else if (l <= 4.6d+199) then
tmp = u + ((l * j) * ((-0.25d0) * (k ** 2.0d0)))
else
tmp = u + (j * (cos((0.5d0 * k)) * (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 <= -4.5) {
tmp = U + (J * (27.0 - Math.exp(-l)));
} else if (l <= 300.0) {
tmp = U + (Math.cos((K / 2.0)) * (J * (l * 2.0)));
} else if (l <= 4.6e+199) {
tmp = U + ((l * J) * (-0.25 * Math.pow(K, 2.0)));
} else {
tmp = U + (J * (Math.cos((0.5 * K)) * (l * 2.0)));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -4.5: tmp = U + (J * (27.0 - math.exp(-l))) elif l <= 300.0: tmp = U + (math.cos((K / 2.0)) * (J * (l * 2.0))) elif l <= 4.6e+199: tmp = U + ((l * J) * (-0.25 * math.pow(K, 2.0))) else: tmp = U + (J * (math.cos((0.5 * K)) * (l * 2.0))) return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -4.5) tmp = Float64(U + Float64(J * Float64(27.0 - exp(Float64(-l))))); elseif (l <= 300.0) tmp = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(J * Float64(l * 2.0)))); elseif (l <= 4.6e+199) tmp = Float64(U + Float64(Float64(l * J) * Float64(-0.25 * (K ^ 2.0)))); else tmp = Float64(U + Float64(J * Float64(cos(Float64(0.5 * K)) * Float64(l * 2.0)))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -4.5) tmp = U + (J * (27.0 - exp(-l))); elseif (l <= 300.0) tmp = U + (cos((K / 2.0)) * (J * (l * 2.0))); elseif (l <= 4.6e+199) tmp = U + ((l * J) * (-0.25 * (K ^ 2.0))); else tmp = U + (J * (cos((0.5 * K)) * (l * 2.0))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -4.5], N[(U + N[(J * N[(27.0 - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 300.0], N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(J * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 4.6e+199], N[(U + N[(N[(l * J), $MachinePrecision] * N[(-0.25 * N[Power[K, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * N[(N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision] * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -4.5:\\
\;\;\;\;U + J \cdot \left(27 - e^{-\ell}\right)\\
\mathbf{elif}\;\ell \leq 300:\\
\;\;\;\;U + \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(\ell \cdot 2\right)\right)\\
\mathbf{elif}\;\ell \leq 4.6 \cdot 10^{+199}:\\
\;\;\;\;U + \left(\ell \cdot J\right) \cdot \left(-0.25 \cdot {K}^{2}\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(\cos \left(0.5 \cdot K\right) \cdot \left(\ell \cdot 2\right)\right)\\
\end{array}
\end{array}
if l < -4.5Initial program 100.0%
Applied egg-rr100.0%
Taylor expanded in K around 0 76.0%
if -4.5 < l < 300Initial program 70.5%
Taylor expanded in l around 0 97.6%
*-commutative97.6%
associate-*l*97.6%
Simplified97.6%
if 300 < l < 4.59999999999999989e199Initial program 100.0%
Taylor expanded in l around 0 72.9%
*-commutative72.9%
Simplified72.9%
Taylor expanded in l around 0 10.8%
*-commutative10.8%
associate-*r*10.8%
associate-*l*10.8%
*-commutative10.8%
associate-*r*10.8%
Simplified10.8%
Taylor expanded in K around 0 28.2%
Taylor expanded in K around inf 32.1%
*-commutative32.1%
associate-*r*32.2%
associate-*r*32.2%
*-commutative32.2%
associate-*l*32.2%
*-commutative32.2%
Simplified32.2%
if 4.59999999999999989e199 < l Initial program 100.0%
Taylor expanded in l around 0 57.9%
*-commutative57.9%
associate-*l*57.9%
*-commutative57.9%
associate-*l*57.9%
Simplified57.9%
Final simplification77.0%
(FPCore (J l K U)
:precision binary64
(if (<= l -3.5)
(+ U (* J (- 27.0 (exp (- l)))))
(if (or (<= l 0.31) (not (<= l 2.2e+247)))
(+ U (* l (* J 2.0)))
(+ U (* (* l J) (* -0.25 (pow K 2.0)))))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -3.5) {
tmp = U + (J * (27.0 - exp(-l)));
} else if ((l <= 0.31) || !(l <= 2.2e+247)) {
tmp = U + (l * (J * 2.0));
} else {
tmp = U + ((l * J) * (-0.25 * pow(K, 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 <= (-3.5d0)) then
tmp = u + (j * (27.0d0 - exp(-l)))
else if ((l <= 0.31d0) .or. (.not. (l <= 2.2d+247))) then
tmp = u + (l * (j * 2.0d0))
else
tmp = u + ((l * j) * ((-0.25d0) * (k ** 2.0d0)))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (l <= -3.5) {
tmp = U + (J * (27.0 - Math.exp(-l)));
} else if ((l <= 0.31) || !(l <= 2.2e+247)) {
tmp = U + (l * (J * 2.0));
} else {
tmp = U + ((l * J) * (-0.25 * Math.pow(K, 2.0)));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -3.5: tmp = U + (J * (27.0 - math.exp(-l))) elif (l <= 0.31) or not (l <= 2.2e+247): tmp = U + (l * (J * 2.0)) else: tmp = U + ((l * J) * (-0.25 * math.pow(K, 2.0))) return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -3.5) tmp = Float64(U + Float64(J * Float64(27.0 - exp(Float64(-l))))); elseif ((l <= 0.31) || !(l <= 2.2e+247)) tmp = Float64(U + Float64(l * Float64(J * 2.0))); else tmp = Float64(U + Float64(Float64(l * J) * Float64(-0.25 * (K ^ 2.0)))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -3.5) tmp = U + (J * (27.0 - exp(-l))); elseif ((l <= 0.31) || ~((l <= 2.2e+247))) tmp = U + (l * (J * 2.0)); else tmp = U + ((l * J) * (-0.25 * (K ^ 2.0))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -3.5], N[(U + N[(J * N[(27.0 - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[l, 0.31], N[Not[LessEqual[l, 2.2e+247]], $MachinePrecision]], N[(U + N[(l * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(N[(l * J), $MachinePrecision] * N[(-0.25 * N[Power[K, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -3.5:\\
\;\;\;\;U + J \cdot \left(27 - e^{-\ell}\right)\\
\mathbf{elif}\;\ell \leq 0.31 \lor \neg \left(\ell \leq 2.2 \cdot 10^{+247}\right):\\
\;\;\;\;U + \ell \cdot \left(J \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;U + \left(\ell \cdot J\right) \cdot \left(-0.25 \cdot {K}^{2}\right)\\
\end{array}
\end{array}
if l < -3.5Initial program 100.0%
Applied egg-rr100.0%
Taylor expanded in K around 0 76.0%
if -3.5 < l < 0.309999999999999998 or 2.20000000000000011e247 < l Initial program 72.8%
Taylor expanded in l around 0 99.7%
*-commutative99.7%
Simplified99.7%
Taylor expanded in l around 0 96.0%
*-commutative96.0%
associate-*r*96.0%
associate-*l*96.0%
*-commutative96.0%
associate-*r*96.0%
Simplified96.0%
Taylor expanded in K around 0 83.6%
associate-*r*83.6%
*-commutative83.6%
Simplified83.6%
if 0.309999999999999998 < l < 2.20000000000000011e247Initial program 100.0%
Taylor expanded in l around 0 74.6%
*-commutative74.6%
Simplified74.6%
Taylor expanded in l around 0 14.2%
*-commutative14.2%
associate-*r*14.2%
associate-*l*14.2%
*-commutative14.2%
associate-*r*14.2%
Simplified14.2%
Taylor expanded in K around 0 28.2%
Taylor expanded in K around inf 31.5%
*-commutative31.5%
associate-*r*31.5%
associate-*r*31.5%
*-commutative31.5%
associate-*l*31.5%
*-commutative31.5%
Simplified31.5%
Final simplification70.6%
(FPCore (J l K U)
:precision binary64
(if (<= l -10.0)
(+ U (* J (- 27.0 (exp (- l)))))
(if (<= l 5e+15)
(+ U (* (cos (/ K 2.0)) (* J (* l 2.0))))
(* U (+ 1.0 (* 2.0 (/ (* J (* l (cos (* 0.5 K)))) U)))))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -10.0) {
tmp = U + (J * (27.0 - exp(-l)));
} else if (l <= 5e+15) {
tmp = U + (cos((K / 2.0)) * (J * (l * 2.0)));
} else {
tmp = U * (1.0 + (2.0 * ((J * (l * cos((0.5 * K)))) / 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 <= (-10.0d0)) then
tmp = u + (j * (27.0d0 - exp(-l)))
else if (l <= 5d+15) then
tmp = u + (cos((k / 2.0d0)) * (j * (l * 2.0d0)))
else
tmp = u * (1.0d0 + (2.0d0 * ((j * (l * cos((0.5d0 * k)))) / u)))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (l <= -10.0) {
tmp = U + (J * (27.0 - Math.exp(-l)));
} else if (l <= 5e+15) {
tmp = U + (Math.cos((K / 2.0)) * (J * (l * 2.0)));
} else {
tmp = U * (1.0 + (2.0 * ((J * (l * Math.cos((0.5 * K)))) / U)));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -10.0: tmp = U + (J * (27.0 - math.exp(-l))) elif l <= 5e+15: tmp = U + (math.cos((K / 2.0)) * (J * (l * 2.0))) else: tmp = U * (1.0 + (2.0 * ((J * (l * math.cos((0.5 * K)))) / U))) return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -10.0) tmp = Float64(U + Float64(J * Float64(27.0 - exp(Float64(-l))))); elseif (l <= 5e+15) tmp = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(J * Float64(l * 2.0)))); else tmp = Float64(U * Float64(1.0 + Float64(2.0 * Float64(Float64(J * Float64(l * cos(Float64(0.5 * K)))) / U)))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -10.0) tmp = U + (J * (27.0 - exp(-l))); elseif (l <= 5e+15) tmp = U + (cos((K / 2.0)) * (J * (l * 2.0))); else tmp = U * (1.0 + (2.0 * ((J * (l * cos((0.5 * K)))) / U))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -10.0], N[(U + N[(J * N[(27.0 - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 5e+15], N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(J * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U * N[(1.0 + N[(2.0 * N[(N[(J * N[(l * N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -10:\\
\;\;\;\;U + J \cdot \left(27 - e^{-\ell}\right)\\
\mathbf{elif}\;\ell \leq 5 \cdot 10^{+15}:\\
\;\;\;\;U + \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(\ell \cdot 2\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U \cdot \left(1 + 2 \cdot \frac{J \cdot \left(\ell \cdot \cos \left(0.5 \cdot K\right)\right)}{U}\right)\\
\end{array}
\end{array}
if l < -10Initial program 100.0%
Applied egg-rr100.0%
Taylor expanded in K around 0 76.0%
if -10 < l < 5e15Initial program 71.2%
Taylor expanded in l around 0 95.3%
*-commutative95.3%
associate-*l*95.3%
Simplified95.3%
if 5e15 < l Initial program 100.0%
Taylor expanded in l around 0 84.4%
*-commutative84.4%
Simplified84.4%
Taylor expanded in l around 0 25.2%
*-commutative25.2%
associate-*r*25.2%
associate-*l*25.2%
*-commutative25.2%
associate-*r*25.2%
Simplified25.2%
Taylor expanded in U around inf 39.3%
Final simplification76.5%
(FPCore (J l K U)
:precision binary64
(+
U
(*
(*
J
(*
l
(+
2.0
(* (* l l) (+ 0.3333333333333333 (* (* l l) 0.016666666666666666))))))
(cos (/ K 2.0)))))
double code(double J, double l, double K, double U) {
return U + ((J * (l * (2.0 + ((l * l) * (0.3333333333333333 + ((l * l) * 0.016666666666666666)))))) * cos((K / 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 + ((l * l) * (0.3333333333333333d0 + ((l * l) * 0.016666666666666666d0)))))) * cos((k / 2.0d0)))
end function
public static double code(double J, double l, double K, double U) {
return U + ((J * (l * (2.0 + ((l * l) * (0.3333333333333333 + ((l * l) * 0.016666666666666666)))))) * Math.cos((K / 2.0)));
}
def code(J, l, K, U): return U + ((J * (l * (2.0 + ((l * l) * (0.3333333333333333 + ((l * l) * 0.016666666666666666)))))) * math.cos((K / 2.0)))
function code(J, l, K, U) return Float64(U + Float64(Float64(J * Float64(l * Float64(2.0 + Float64(Float64(l * l) * Float64(0.3333333333333333 + Float64(Float64(l * l) * 0.016666666666666666)))))) * cos(Float64(K / 2.0)))) end
function tmp = code(J, l, K, U) tmp = U + ((J * (l * (2.0 + ((l * l) * (0.3333333333333333 + ((l * l) * 0.016666666666666666)))))) * cos((K / 2.0))); end
code[J_, l_, K_, U_] := N[(U + N[(N[(J * N[(l * N[(2.0 + N[(N[(l * l), $MachinePrecision] * N[(0.3333333333333333 + N[(N[(l * l), $MachinePrecision] * 0.016666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + \left(J \cdot \left(\ell \cdot \left(2 + \left(\ell \cdot \ell\right) \cdot \left(0.3333333333333333 + \left(\ell \cdot \ell\right) \cdot 0.016666666666666666\right)\right)\right)\right) \cdot \cos \left(\frac{K}{2}\right)
\end{array}
Initial program 86.4%
Taylor expanded in l around 0 91.3%
*-commutative91.3%
Simplified91.3%
unpow291.3%
Applied egg-rr91.3%
unpow291.3%
Applied egg-rr91.3%
Final simplification91.3%
(FPCore (J l K U)
:precision binary64
(if (<= l -3.5)
(+ U (* J (- 27.0 (exp (- l)))))
(if (or (<= l 0.31) (not (<= l 7.3e+244)))
(+ U (* l (* J 2.0)))
(+ U (+ (* -0.25 (* J (* l (* K K)))) (* 2.0 (* l J)))))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -3.5) {
tmp = U + (J * (27.0 - exp(-l)));
} else if ((l <= 0.31) || !(l <= 7.3e+244)) {
tmp = U + (l * (J * 2.0));
} else {
tmp = U + ((-0.25 * (J * (l * (K * K)))) + (2.0 * (l * J)));
}
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 <= (-3.5d0)) then
tmp = u + (j * (27.0d0 - exp(-l)))
else if ((l <= 0.31d0) .or. (.not. (l <= 7.3d+244))) then
tmp = u + (l * (j * 2.0d0))
else
tmp = u + (((-0.25d0) * (j * (l * (k * k)))) + (2.0d0 * (l * j)))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (l <= -3.5) {
tmp = U + (J * (27.0 - Math.exp(-l)));
} else if ((l <= 0.31) || !(l <= 7.3e+244)) {
tmp = U + (l * (J * 2.0));
} else {
tmp = U + ((-0.25 * (J * (l * (K * K)))) + (2.0 * (l * J)));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -3.5: tmp = U + (J * (27.0 - math.exp(-l))) elif (l <= 0.31) or not (l <= 7.3e+244): tmp = U + (l * (J * 2.0)) else: tmp = U + ((-0.25 * (J * (l * (K * K)))) + (2.0 * (l * J))) return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -3.5) tmp = Float64(U + Float64(J * Float64(27.0 - exp(Float64(-l))))); elseif ((l <= 0.31) || !(l <= 7.3e+244)) tmp = Float64(U + Float64(l * Float64(J * 2.0))); else tmp = Float64(U + Float64(Float64(-0.25 * Float64(J * Float64(l * Float64(K * K)))) + Float64(2.0 * Float64(l * J)))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -3.5) tmp = U + (J * (27.0 - exp(-l))); elseif ((l <= 0.31) || ~((l <= 7.3e+244))) tmp = U + (l * (J * 2.0)); else tmp = U + ((-0.25 * (J * (l * (K * K)))) + (2.0 * (l * J))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -3.5], N[(U + N[(J * N[(27.0 - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[l, 0.31], N[Not[LessEqual[l, 7.3e+244]], $MachinePrecision]], N[(U + N[(l * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(N[(-0.25 * N[(J * N[(l * N[(K * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(2.0 * N[(l * J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -3.5:\\
\;\;\;\;U + J \cdot \left(27 - e^{-\ell}\right)\\
\mathbf{elif}\;\ell \leq 0.31 \lor \neg \left(\ell \leq 7.3 \cdot 10^{+244}\right):\\
\;\;\;\;U + \ell \cdot \left(J \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;U + \left(-0.25 \cdot \left(J \cdot \left(\ell \cdot \left(K \cdot K\right)\right)\right) + 2 \cdot \left(\ell \cdot J\right)\right)\\
\end{array}
\end{array}
if l < -3.5Initial program 100.0%
Applied egg-rr100.0%
Taylor expanded in K around 0 76.0%
if -3.5 < l < 0.309999999999999998 or 7.29999999999999956e244 < l Initial program 73.0%
Taylor expanded in l around 0 99.7%
*-commutative99.7%
Simplified99.7%
Taylor expanded in l around 0 96.1%
*-commutative96.1%
associate-*r*96.1%
associate-*l*96.1%
*-commutative96.1%
associate-*r*96.1%
Simplified96.1%
Taylor expanded in K around 0 83.0%
associate-*r*83.0%
*-commutative83.0%
Simplified83.0%
if 0.309999999999999998 < l < 7.29999999999999956e244Initial program 100.0%
Taylor expanded in l around 0 74.1%
*-commutative74.1%
Simplified74.1%
Taylor expanded in l around 0 12.6%
*-commutative12.6%
associate-*r*12.6%
associate-*l*12.6%
*-commutative12.6%
associate-*r*12.6%
Simplified12.6%
Taylor expanded in K around 0 28.8%
unpow228.8%
Applied egg-rr28.8%
Final simplification69.9%
(FPCore (J l K U)
:precision binary64
(if (or (<= l -1.25e+281)
(and (not (<= l -1120000.0)) (or (<= l 0.31) (not (<= l 1.02e+244)))))
(+ U (* l (* J 2.0)))
(+ U (+ (* -0.25 (* J (* l (* K K)))) (* 2.0 (* l J))))))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -1.25e+281) || (!(l <= -1120000.0) && ((l <= 0.31) || !(l <= 1.02e+244)))) {
tmp = U + (l * (J * 2.0));
} else {
tmp = U + ((-0.25 * (J * (l * (K * K)))) + (2.0 * (l * J)));
}
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.25d+281)) .or. (.not. (l <= (-1120000.0d0))) .and. (l <= 0.31d0) .or. (.not. (l <= 1.02d+244))) then
tmp = u + (l * (j * 2.0d0))
else
tmp = u + (((-0.25d0) * (j * (l * (k * k)))) + (2.0d0 * (l * j)))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -1.25e+281) || (!(l <= -1120000.0) && ((l <= 0.31) || !(l <= 1.02e+244)))) {
tmp = U + (l * (J * 2.0));
} else {
tmp = U + ((-0.25 * (J * (l * (K * K)))) + (2.0 * (l * J)));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -1.25e+281) or (not (l <= -1120000.0) and ((l <= 0.31) or not (l <= 1.02e+244))): tmp = U + (l * (J * 2.0)) else: tmp = U + ((-0.25 * (J * (l * (K * K)))) + (2.0 * (l * J))) return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -1.25e+281) || (!(l <= -1120000.0) && ((l <= 0.31) || !(l <= 1.02e+244)))) tmp = Float64(U + Float64(l * Float64(J * 2.0))); else tmp = Float64(U + Float64(Float64(-0.25 * Float64(J * Float64(l * Float64(K * K)))) + Float64(2.0 * Float64(l * J)))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -1.25e+281) || (~((l <= -1120000.0)) && ((l <= 0.31) || ~((l <= 1.02e+244))))) tmp = U + (l * (J * 2.0)); else tmp = U + ((-0.25 * (J * (l * (K * K)))) + (2.0 * (l * J))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -1.25e+281], And[N[Not[LessEqual[l, -1120000.0]], $MachinePrecision], Or[LessEqual[l, 0.31], N[Not[LessEqual[l, 1.02e+244]], $MachinePrecision]]]], N[(U + N[(l * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(N[(-0.25 * N[(J * N[(l * N[(K * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(2.0 * N[(l * J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.25 \cdot 10^{+281} \lor \neg \left(\ell \leq -1120000\right) \land \left(\ell \leq 0.31 \lor \neg \left(\ell \leq 1.02 \cdot 10^{+244}\right)\right):\\
\;\;\;\;U + \ell \cdot \left(J \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;U + \left(-0.25 \cdot \left(J \cdot \left(\ell \cdot \left(K \cdot K\right)\right)\right) + 2 \cdot \left(\ell \cdot J\right)\right)\\
\end{array}
\end{array}
if l < -1.25000000000000004e281 or -1.12e6 < l < 0.309999999999999998 or 1.02e244 < l Initial program 75.3%
Taylor expanded in l around 0 99.1%
*-commutative99.1%
Simplified99.1%
Taylor expanded in l around 0 92.3%
*-commutative92.3%
associate-*r*92.3%
associate-*l*92.3%
*-commutative92.3%
associate-*r*92.3%
Simplified92.3%
Taylor expanded in K around 0 79.6%
associate-*r*79.6%
*-commutative79.6%
Simplified79.6%
if -1.25000000000000004e281 < l < -1.12e6 or 0.309999999999999998 < l < 1.02e244Initial program 100.0%
Taylor expanded in l around 0 81.7%
*-commutative81.7%
Simplified81.7%
Taylor expanded in l around 0 15.5%
*-commutative15.5%
associate-*r*15.5%
associate-*l*15.5%
*-commutative15.5%
associate-*r*15.5%
Simplified15.5%
Taylor expanded in K around 0 29.1%
unpow229.1%
Applied egg-rr29.1%
Final simplification56.9%
(FPCore (J l K U) :precision binary64 (if (or (<= l -4.5e+16) (not (<= l 1050.0))) (* U U) U))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -4.5e+16) || !(l <= 1050.0)) {
tmp = U * U;
} 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 <= (-4.5d+16)) .or. (.not. (l <= 1050.0d0))) then
tmp = u * u
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 <= -4.5e+16) || !(l <= 1050.0)) {
tmp = U * U;
} else {
tmp = U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -4.5e+16) or not (l <= 1050.0): tmp = U * U else: tmp = U return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -4.5e+16) || !(l <= 1050.0)) tmp = Float64(U * U); else tmp = U; end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -4.5e+16) || ~((l <= 1050.0))) tmp = U * U; else tmp = U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -4.5e+16], N[Not[LessEqual[l, 1050.0]], $MachinePrecision]], N[(U * U), $MachinePrecision], U]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -4.5 \cdot 10^{+16} \lor \neg \left(\ell \leq 1050\right):\\
\;\;\;\;U \cdot U\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\end{array}
if l < -4.5e16 or 1050 < l Initial program 100.0%
associate-*l*100.0%
fma-define100.0%
Simplified100.0%
Applied egg-rr17.7%
if -4.5e16 < l < 1050Initial program 71.2%
associate-*l*71.2%
fma-define71.2%
Simplified71.2%
Taylor expanded in J around 0 65.5%
Final simplification40.3%
(FPCore (J l K U) :precision binary64 (+ U (* l (* J 2.0))))
double code(double J, double l, double K, double U) {
return U + (l * (J * 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 + (l * (j * 2.0d0))
end function
public static double code(double J, double l, double K, double U) {
return U + (l * (J * 2.0));
}
def code(J, l, K, U): return U + (l * (J * 2.0))
function code(J, l, K, U) return Float64(U + Float64(l * Float64(J * 2.0))) end
function tmp = code(J, l, K, U) tmp = U + (l * (J * 2.0)); end
code[J_, l_, K_, U_] := N[(U + N[(l * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + \ell \cdot \left(J \cdot 2\right)
\end{array}
Initial program 86.4%
Taylor expanded in l around 0 91.3%
*-commutative91.3%
Simplified91.3%
Taylor expanded in l around 0 57.8%
*-commutative57.8%
associate-*r*57.8%
associate-*l*57.8%
*-commutative57.8%
associate-*r*57.8%
Simplified57.8%
Taylor expanded in K around 0 48.7%
associate-*r*48.7%
*-commutative48.7%
Simplified48.7%
Final simplification48.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%
associate-*l*86.4%
fma-define86.4%
Simplified86.4%
Taylor expanded in J around 0 32.2%
(FPCore (J l K U) :precision binary64 0.25)
double code(double J, double l, double K, double U) {
return 0.25;
}
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 = 0.25d0
end function
public static double code(double J, double l, double K, double U) {
return 0.25;
}
def code(J, l, K, U): return 0.25
function code(J, l, K, U) return 0.25 end
function tmp = code(J, l, K, U) tmp = 0.25; end
code[J_, l_, K_, U_] := 0.25
\begin{array}{l}
\\
0.25
\end{array}
Initial program 86.4%
Applied egg-rr24.3%
Taylor expanded in U around 0 2.7%
herbie shell --seed 2024141
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))