
(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 (cos (/ K 2.0))) (t_1 (exp (- l))) (t_2 (- (exp l) t_1)))
(if (<= t_2 (- INFINITY))
(+ (* (* J (- 27.0 t_1)) t_0) U)
(if (<= t_2 1e-10)
(+ U (* t_0 (* J (* l (+ 2.0 (* 0.3333333333333333 (* l l)))))))
(+ U (* t_0 (* t_2 J)))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double t_1 = exp(-l);
double t_2 = exp(l) - t_1;
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = ((J * (27.0 - t_1)) * t_0) + U;
} else if (t_2 <= 1e-10) {
tmp = U + (t_0 * (J * (l * (2.0 + (0.3333333333333333 * (l * l))))));
} else {
tmp = U + (t_0 * (t_2 * J));
}
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 t_2 = Math.exp(l) - t_1;
double tmp;
if (t_2 <= -Double.POSITIVE_INFINITY) {
tmp = ((J * (27.0 - t_1)) * t_0) + U;
} else if (t_2 <= 1e-10) {
tmp = U + (t_0 * (J * (l * (2.0 + (0.3333333333333333 * (l * l))))));
} else {
tmp = U + (t_0 * (t_2 * J));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K / 2.0)) t_1 = math.exp(-l) t_2 = math.exp(l) - t_1 tmp = 0 if t_2 <= -math.inf: tmp = ((J * (27.0 - t_1)) * t_0) + U elif t_2 <= 1e-10: tmp = U + (t_0 * (J * (l * (2.0 + (0.3333333333333333 * (l * l)))))) else: tmp = U + (t_0 * (t_2 * J)) return tmp
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) t_1 = exp(Float64(-l)) t_2 = Float64(exp(l) - t_1) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = Float64(Float64(Float64(J * Float64(27.0 - t_1)) * t_0) + U); elseif (t_2 <= 1e-10) tmp = Float64(U + Float64(t_0 * Float64(J * Float64(l * Float64(2.0 + Float64(0.3333333333333333 * Float64(l * l))))))); else tmp = Float64(U + Float64(t_0 * Float64(t_2 * J))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = cos((K / 2.0)); t_1 = exp(-l); t_2 = exp(l) - t_1; tmp = 0.0; if (t_2 <= -Inf) tmp = ((J * (27.0 - t_1)) * t_0) + U; elseif (t_2 <= 1e-10) tmp = U + (t_0 * (J * (l * (2.0 + (0.3333333333333333 * (l * l)))))); else tmp = U + (t_0 * (t_2 * J)); 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]}, Block[{t$95$2 = N[(N[Exp[l], $MachinePrecision] - t$95$1), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], N[(N[(N[(J * N[(27.0 - t$95$1), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] + U), $MachinePrecision], If[LessEqual[t$95$2, 1e-10], N[(U + N[(t$95$0 * N[(J * N[(l * N[(2.0 + N[(0.3333333333333333 * N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(t$95$0 * N[(t$95$2 * J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
t_1 := e^{-\ell}\\
t_2 := e^{\ell} - t\_1\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;\left(J \cdot \left(27 - t\_1\right)\right) \cdot t\_0 + U\\
\mathbf{elif}\;t\_2 \leq 10^{-10}:\\
\;\;\;\;U + t\_0 \cdot \left(J \cdot \left(\ell \cdot \left(2 + 0.3333333333333333 \cdot \left(\ell \cdot \ell\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + t\_0 \cdot \left(t\_2 \cdot J\right)\\
\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))) < 1.00000000000000004e-10Initial program 73.6%
Taylor expanded in l around 0 99.9%
unpow299.9%
Applied egg-rr99.9%
if 1.00000000000000004e-10 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 100.0%
Final simplification100.0%
(FPCore (J l K U)
:precision binary64
(let* ((t_0
(+
U
(*
(cos (/ K 2.0))
(* J (* l (+ 2.0 (* 0.3333333333333333 (* l l))))))))
(t_1 (exp (- l))))
(if (<= l -4.6e+104)
t_0
(if (<= l -7800.0)
(+ U (* J (- 3.0 t_1)))
(if (or (<= l 0.038) (not (<= l 1.3e+92)))
t_0
(+ U (* (- (exp l) t_1) J)))))))
double code(double J, double l, double K, double U) {
double t_0 = U + (cos((K / 2.0)) * (J * (l * (2.0 + (0.3333333333333333 * (l * l))))));
double t_1 = exp(-l);
double tmp;
if (l <= -4.6e+104) {
tmp = t_0;
} else if (l <= -7800.0) {
tmp = U + (J * (3.0 - t_1));
} else if ((l <= 0.038) || !(l <= 1.3e+92)) {
tmp = t_0;
} else {
tmp = U + ((exp(l) - t_1) * 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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = u + (cos((k / 2.0d0)) * (j * (l * (2.0d0 + (0.3333333333333333d0 * (l * l))))))
t_1 = exp(-l)
if (l <= (-4.6d+104)) then
tmp = t_0
else if (l <= (-7800.0d0)) then
tmp = u + (j * (3.0d0 - t_1))
else if ((l <= 0.038d0) .or. (.not. (l <= 1.3d+92))) then
tmp = t_0
else
tmp = u + ((exp(l) - t_1) * j)
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = U + (Math.cos((K / 2.0)) * (J * (l * (2.0 + (0.3333333333333333 * (l * l))))));
double t_1 = Math.exp(-l);
double tmp;
if (l <= -4.6e+104) {
tmp = t_0;
} else if (l <= -7800.0) {
tmp = U + (J * (3.0 - t_1));
} else if ((l <= 0.038) || !(l <= 1.3e+92)) {
tmp = t_0;
} else {
tmp = U + ((Math.exp(l) - t_1) * J);
}
return tmp;
}
def code(J, l, K, U): t_0 = U + (math.cos((K / 2.0)) * (J * (l * (2.0 + (0.3333333333333333 * (l * l)))))) t_1 = math.exp(-l) tmp = 0 if l <= -4.6e+104: tmp = t_0 elif l <= -7800.0: tmp = U + (J * (3.0 - t_1)) elif (l <= 0.038) or not (l <= 1.3e+92): tmp = t_0 else: tmp = U + ((math.exp(l) - t_1) * J) return tmp
function code(J, l, K, U) t_0 = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(J * Float64(l * Float64(2.0 + Float64(0.3333333333333333 * Float64(l * l))))))) t_1 = exp(Float64(-l)) tmp = 0.0 if (l <= -4.6e+104) tmp = t_0; elseif (l <= -7800.0) tmp = Float64(U + Float64(J * Float64(3.0 - t_1))); elseif ((l <= 0.038) || !(l <= 1.3e+92)) tmp = t_0; else tmp = Float64(U + Float64(Float64(exp(l) - t_1) * J)); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = U + (cos((K / 2.0)) * (J * (l * (2.0 + (0.3333333333333333 * (l * l)))))); t_1 = exp(-l); tmp = 0.0; if (l <= -4.6e+104) tmp = t_0; elseif (l <= -7800.0) tmp = U + (J * (3.0 - t_1)); elseif ((l <= 0.038) || ~((l <= 1.3e+92))) tmp = t_0; else tmp = U + ((exp(l) - t_1) * J); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(J * N[(l * N[(2.0 + N[(0.3333333333333333 * N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Exp[(-l)], $MachinePrecision]}, If[LessEqual[l, -4.6e+104], t$95$0, If[LessEqual[l, -7800.0], N[(U + N[(J * N[(3.0 - t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[l, 0.038], N[Not[LessEqual[l, 1.3e+92]], $MachinePrecision]], t$95$0, N[(U + N[(N[(N[Exp[l], $MachinePrecision] - t$95$1), $MachinePrecision] * J), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(\ell \cdot \left(2 + 0.3333333333333333 \cdot \left(\ell \cdot \ell\right)\right)\right)\right)\\
t_1 := e^{-\ell}\\
\mathbf{if}\;\ell \leq -4.6 \cdot 10^{+104}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq -7800:\\
\;\;\;\;U + J \cdot \left(3 - t\_1\right)\\
\mathbf{elif}\;\ell \leq 0.038 \lor \neg \left(\ell \leq 1.3 \cdot 10^{+92}\right):\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;U + \left(e^{\ell} - t\_1\right) \cdot J\\
\end{array}
\end{array}
if l < -4.59999999999999969e104 or -7800 < l < 0.0379999999999999991 or 1.2999999999999999e92 < l Initial program 84.5%
Taylor expanded in l around 0 99.5%
unpow299.5%
Applied egg-rr99.5%
if -4.59999999999999969e104 < l < -7800Initial program 100.0%
Taylor expanded in K around 0 90.0%
Applied egg-rr90.0%
if 0.0379999999999999991 < l < 1.2999999999999999e92Initial program 100.0%
Taylor expanded in K around 0 94.1%
Final simplification98.4%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))) (t_1 (exp (- l))))
(if (<= l -4.0)
(+ (* (* J (- 27.0 t_1)) t_0) U)
(if (or (<= l 0.185) (not (<= l 1.65e+92)))
(+ U (* t_0 (* J (* l (+ 2.0 (* 0.3333333333333333 (* l l)))))))
(+ U (* (- (exp l) t_1) J))))))
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 (l <= -4.0) {
tmp = ((J * (27.0 - t_1)) * t_0) + U;
} else if ((l <= 0.185) || !(l <= 1.65e+92)) {
tmp = U + (t_0 * (J * (l * (2.0 + (0.3333333333333333 * (l * l))))));
} else {
tmp = U + ((exp(l) - t_1) * 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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = cos((k / 2.0d0))
t_1 = exp(-l)
if (l <= (-4.0d0)) then
tmp = ((j * (27.0d0 - t_1)) * t_0) + u
else if ((l <= 0.185d0) .or. (.not. (l <= 1.65d+92))) then
tmp = u + (t_0 * (j * (l * (2.0d0 + (0.3333333333333333d0 * (l * l))))))
else
tmp = u + ((exp(l) - t_1) * j)
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 = Math.exp(-l);
double tmp;
if (l <= -4.0) {
tmp = ((J * (27.0 - t_1)) * t_0) + U;
} else if ((l <= 0.185) || !(l <= 1.65e+92)) {
tmp = U + (t_0 * (J * (l * (2.0 + (0.3333333333333333 * (l * l))))));
} else {
tmp = U + ((Math.exp(l) - t_1) * J);
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K / 2.0)) t_1 = math.exp(-l) tmp = 0 if l <= -4.0: tmp = ((J * (27.0 - t_1)) * t_0) + U elif (l <= 0.185) or not (l <= 1.65e+92): tmp = U + (t_0 * (J * (l * (2.0 + (0.3333333333333333 * (l * l)))))) else: tmp = U + ((math.exp(l) - t_1) * J) return tmp
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) t_1 = exp(Float64(-l)) tmp = 0.0 if (l <= -4.0) tmp = Float64(Float64(Float64(J * Float64(27.0 - t_1)) * t_0) + U); elseif ((l <= 0.185) || !(l <= 1.65e+92)) tmp = Float64(U + Float64(t_0 * Float64(J * Float64(l * Float64(2.0 + Float64(0.3333333333333333 * Float64(l * l))))))); else tmp = Float64(U + Float64(Float64(exp(l) - t_1) * J)); 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 (l <= -4.0) tmp = ((J * (27.0 - t_1)) * t_0) + U; elseif ((l <= 0.185) || ~((l <= 1.65e+92))) tmp = U + (t_0 * (J * (l * (2.0 + (0.3333333333333333 * (l * l)))))); else tmp = U + ((exp(l) - t_1) * J); 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[l, -4.0], N[(N[(N[(J * N[(27.0 - t$95$1), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] + U), $MachinePrecision], If[Or[LessEqual[l, 0.185], N[Not[LessEqual[l, 1.65e+92]], $MachinePrecision]], N[(U + N[(t$95$0 * N[(J * N[(l * N[(2.0 + N[(0.3333333333333333 * N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(N[(N[Exp[l], $MachinePrecision] - t$95$1), $MachinePrecision] * J), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
t_1 := e^{-\ell}\\
\mathbf{if}\;\ell \leq -4:\\
\;\;\;\;\left(J \cdot \left(27 - t\_1\right)\right) \cdot t\_0 + U\\
\mathbf{elif}\;\ell \leq 0.185 \lor \neg \left(\ell \leq 1.65 \cdot 10^{+92}\right):\\
\;\;\;\;U + t\_0 \cdot \left(J \cdot \left(\ell \cdot \left(2 + 0.3333333333333333 \cdot \left(\ell \cdot \ell\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + \left(e^{\ell} - t\_1\right) \cdot J\\
\end{array}
\end{array}
if l < -4Initial program 100.0%
Applied egg-rr100.0%
if -4 < l < 0.185 or 1.64999999999999987e92 < l Initial program 81.5%
Taylor expanded in l around 0 99.9%
unpow299.9%
Applied egg-rr99.9%
if 0.185 < l < 1.64999999999999987e92Initial program 100.0%
Taylor expanded in K around 0 94.1%
Final simplification99.6%
(FPCore (J l K U)
:precision binary64
(let* ((t_0
(+
U
(*
(cos (/ K 2.0))
(* J (* l (+ 2.0 (* 0.3333333333333333 (* l l)))))))))
(if (<= l -4.6e+104)
t_0
(if (<= l -7800.0)
(+ U (* J (- 3.0 (exp (- l)))))
(if (or (<= l 0.76) (not (<= l 1.65e+92)))
t_0
(+ U (* J (+ (exp l) -1.0))))))))
double code(double J, double l, double K, double U) {
double t_0 = U + (cos((K / 2.0)) * (J * (l * (2.0 + (0.3333333333333333 * (l * l))))));
double tmp;
if (l <= -4.6e+104) {
tmp = t_0;
} else if (l <= -7800.0) {
tmp = U + (J * (3.0 - exp(-l)));
} else if ((l <= 0.76) || !(l <= 1.65e+92)) {
tmp = t_0;
} else {
tmp = U + (J * (exp(l) + -1.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 = u + (cos((k / 2.0d0)) * (j * (l * (2.0d0 + (0.3333333333333333d0 * (l * l))))))
if (l <= (-4.6d+104)) then
tmp = t_0
else if (l <= (-7800.0d0)) then
tmp = u + (j * (3.0d0 - exp(-l)))
else if ((l <= 0.76d0) .or. (.not. (l <= 1.65d+92))) then
tmp = t_0
else
tmp = u + (j * (exp(l) + (-1.0d0)))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = U + (Math.cos((K / 2.0)) * (J * (l * (2.0 + (0.3333333333333333 * (l * l))))));
double tmp;
if (l <= -4.6e+104) {
tmp = t_0;
} else if (l <= -7800.0) {
tmp = U + (J * (3.0 - Math.exp(-l)));
} else if ((l <= 0.76) || !(l <= 1.65e+92)) {
tmp = t_0;
} else {
tmp = U + (J * (Math.exp(l) + -1.0));
}
return tmp;
}
def code(J, l, K, U): t_0 = U + (math.cos((K / 2.0)) * (J * (l * (2.0 + (0.3333333333333333 * (l * l)))))) tmp = 0 if l <= -4.6e+104: tmp = t_0 elif l <= -7800.0: tmp = U + (J * (3.0 - math.exp(-l))) elif (l <= 0.76) or not (l <= 1.65e+92): tmp = t_0 else: tmp = U + (J * (math.exp(l) + -1.0)) return tmp
function code(J, l, K, U) t_0 = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(J * Float64(l * Float64(2.0 + Float64(0.3333333333333333 * Float64(l * l))))))) tmp = 0.0 if (l <= -4.6e+104) tmp = t_0; elseif (l <= -7800.0) tmp = Float64(U + Float64(J * Float64(3.0 - exp(Float64(-l))))); elseif ((l <= 0.76) || !(l <= 1.65e+92)) tmp = t_0; else tmp = Float64(U + Float64(J * Float64(exp(l) + -1.0))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = U + (cos((K / 2.0)) * (J * (l * (2.0 + (0.3333333333333333 * (l * l)))))); tmp = 0.0; if (l <= -4.6e+104) tmp = t_0; elseif (l <= -7800.0) tmp = U + (J * (3.0 - exp(-l))); elseif ((l <= 0.76) || ~((l <= 1.65e+92))) tmp = t_0; else tmp = U + (J * (exp(l) + -1.0)); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(J * N[(l * N[(2.0 + N[(0.3333333333333333 * N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -4.6e+104], t$95$0, If[LessEqual[l, -7800.0], N[(U + N[(J * N[(3.0 - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[l, 0.76], N[Not[LessEqual[l, 1.65e+92]], $MachinePrecision]], t$95$0, N[(U + N[(J * N[(N[Exp[l], $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(\ell \cdot \left(2 + 0.3333333333333333 \cdot \left(\ell \cdot \ell\right)\right)\right)\right)\\
\mathbf{if}\;\ell \leq -4.6 \cdot 10^{+104}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq -7800:\\
\;\;\;\;U + J \cdot \left(3 - e^{-\ell}\right)\\
\mathbf{elif}\;\ell \leq 0.76 \lor \neg \left(\ell \leq 1.65 \cdot 10^{+92}\right):\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(e^{\ell} + -1\right)\\
\end{array}
\end{array}
if l < -4.59999999999999969e104 or -7800 < l < 0.76000000000000001 or 1.64999999999999987e92 < l Initial program 84.5%
Taylor expanded in l around 0 99.5%
unpow299.5%
Applied egg-rr99.5%
if -4.59999999999999969e104 < l < -7800Initial program 100.0%
Taylor expanded in K around 0 90.0%
Applied egg-rr90.0%
if 0.76000000000000001 < l < 1.64999999999999987e92Initial program 100.0%
Taylor expanded in K around 0 94.1%
Taylor expanded in l around 0 90.0%
Final simplification98.1%
(FPCore (J l K U)
:precision binary64
(if (<= l -6.5e+152)
(+ U (* (* J (* l 2.0)) (+ 1.0 (* -0.125 (* K K)))))
(if (<= l -650.0)
(pow U -3.0)
(if (<= l 0.76) (+ U (* 2.0 (* l J))) (+ U (* J (+ (exp l) -1.0)))))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -6.5e+152) {
tmp = U + ((J * (l * 2.0)) * (1.0 + (-0.125 * (K * K))));
} else if (l <= -650.0) {
tmp = pow(U, -3.0);
} else if (l <= 0.76) {
tmp = U + (2.0 * (l * J));
} else {
tmp = U + (J * (exp(l) + -1.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 <= (-6.5d+152)) then
tmp = u + ((j * (l * 2.0d0)) * (1.0d0 + ((-0.125d0) * (k * k))))
else if (l <= (-650.0d0)) then
tmp = u ** (-3.0d0)
else if (l <= 0.76d0) then
tmp = u + (2.0d0 * (l * j))
else
tmp = u + (j * (exp(l) + (-1.0d0)))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (l <= -6.5e+152) {
tmp = U + ((J * (l * 2.0)) * (1.0 + (-0.125 * (K * K))));
} else if (l <= -650.0) {
tmp = Math.pow(U, -3.0);
} else if (l <= 0.76) {
tmp = U + (2.0 * (l * J));
} else {
tmp = U + (J * (Math.exp(l) + -1.0));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -6.5e+152: tmp = U + ((J * (l * 2.0)) * (1.0 + (-0.125 * (K * K)))) elif l <= -650.0: tmp = math.pow(U, -3.0) elif l <= 0.76: tmp = U + (2.0 * (l * J)) else: tmp = U + (J * (math.exp(l) + -1.0)) return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -6.5e+152) tmp = Float64(U + Float64(Float64(J * Float64(l * 2.0)) * Float64(1.0 + Float64(-0.125 * Float64(K * K))))); elseif (l <= -650.0) tmp = U ^ -3.0; elseif (l <= 0.76) tmp = Float64(U + Float64(2.0 * Float64(l * J))); else tmp = Float64(U + Float64(J * Float64(exp(l) + -1.0))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -6.5e+152) tmp = U + ((J * (l * 2.0)) * (1.0 + (-0.125 * (K * K)))); elseif (l <= -650.0) tmp = U ^ -3.0; elseif (l <= 0.76) tmp = U + (2.0 * (l * J)); else tmp = U + (J * (exp(l) + -1.0)); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -6.5e+152], N[(U + N[(N[(J * N[(l * 2.0), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(-0.125 * N[(K * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -650.0], N[Power[U, -3.0], $MachinePrecision], If[LessEqual[l, 0.76], N[(U + N[(2.0 * N[(l * J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * N[(N[Exp[l], $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -6.5 \cdot 10^{+152}:\\
\;\;\;\;U + \left(J \cdot \left(\ell \cdot 2\right)\right) \cdot \left(1 + -0.125 \cdot \left(K \cdot K\right)\right)\\
\mathbf{elif}\;\ell \leq -650:\\
\;\;\;\;{U}^{-3}\\
\mathbf{elif}\;\ell \leq 0.76:\\
\;\;\;\;U + 2 \cdot \left(\ell \cdot J\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(e^{\ell} + -1\right)\\
\end{array}
\end{array}
if l < -6.4999999999999997e152Initial program 100.0%
Taylor expanded in l around 0 36.5%
*-commutative36.5%
associate-*l*36.5%
Simplified36.5%
Taylor expanded in K around 0 35.5%
unpow235.5%
Applied egg-rr35.5%
if -6.4999999999999997e152 < l < -650Initial program 100.0%
associate-*l*100.0%
fma-define100.0%
Simplified100.0%
Applied egg-rr38.9%
if -650 < l < 0.76000000000000001Initial program 73.6%
Taylor expanded in l around 0 99.6%
*-commutative99.6%
associate-*l*99.6%
Simplified99.6%
Taylor expanded in K around 0 88.0%
if 0.76000000000000001 < l Initial program 100.0%
Taylor expanded in K around 0 77.8%
Taylor expanded in l around 0 76.8%
Final simplification73.8%
(FPCore (J l K U)
:precision binary64
(if (<= l -7800.0)
(+ U (* J (- 3.0 (exp (- l)))))
(if (<= l 0.76)
(+ U (* J (* (cos (* K 0.5)) (* l 2.0))))
(+ U (* J (+ (exp l) -1.0))))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -7800.0) {
tmp = U + (J * (3.0 - exp(-l)));
} else if (l <= 0.76) {
tmp = U + (J * (cos((K * 0.5)) * (l * 2.0)));
} else {
tmp = U + (J * (exp(l) + -1.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 <= (-7800.0d0)) then
tmp = u + (j * (3.0d0 - exp(-l)))
else if (l <= 0.76d0) then
tmp = u + (j * (cos((k * 0.5d0)) * (l * 2.0d0)))
else
tmp = u + (j * (exp(l) + (-1.0d0)))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (l <= -7800.0) {
tmp = U + (J * (3.0 - Math.exp(-l)));
} else if (l <= 0.76) {
tmp = U + (J * (Math.cos((K * 0.5)) * (l * 2.0)));
} else {
tmp = U + (J * (Math.exp(l) + -1.0));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -7800.0: tmp = U + (J * (3.0 - math.exp(-l))) elif l <= 0.76: tmp = U + (J * (math.cos((K * 0.5)) * (l * 2.0))) else: tmp = U + (J * (math.exp(l) + -1.0)) return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -7800.0) tmp = Float64(U + Float64(J * Float64(3.0 - exp(Float64(-l))))); elseif (l <= 0.76) tmp = Float64(U + Float64(J * Float64(cos(Float64(K * 0.5)) * Float64(l * 2.0)))); else tmp = Float64(U + Float64(J * Float64(exp(l) + -1.0))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -7800.0) tmp = U + (J * (3.0 - exp(-l))); elseif (l <= 0.76) tmp = U + (J * (cos((K * 0.5)) * (l * 2.0))); else tmp = U + (J * (exp(l) + -1.0)); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -7800.0], N[(U + N[(J * N[(3.0 - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 0.76], N[(U + N[(J * N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * N[(N[Exp[l], $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -7800:\\
\;\;\;\;U + J \cdot \left(3 - e^{-\ell}\right)\\
\mathbf{elif}\;\ell \leq 0.76:\\
\;\;\;\;U + J \cdot \left(\cos \left(K \cdot 0.5\right) \cdot \left(\ell \cdot 2\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(e^{\ell} + -1\right)\\
\end{array}
\end{array}
if l < -7800Initial program 100.0%
Taylor expanded in K around 0 78.2%
Applied egg-rr78.2%
if -7800 < l < 0.76000000000000001Initial program 73.8%
Taylor expanded in l around 0 98.9%
*-commutative98.9%
associate-*l*98.9%
*-commutative98.9%
associate-*l*98.9%
Simplified98.9%
if 0.76000000000000001 < l Initial program 100.0%
Taylor expanded in K around 0 77.8%
Taylor expanded in l around 0 76.8%
Final simplification88.2%
(FPCore (J l K U) :precision binary64 (if (<= l -2.1e-5) (+ U (* J (- 3.0 (exp (- l))))) (if (<= l 0.76) (+ U (* 2.0 (* l J))) (+ U (* J (+ (exp l) -1.0))))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -2.1e-5) {
tmp = U + (J * (3.0 - exp(-l)));
} else if (l <= 0.76) {
tmp = U + (2.0 * (l * J));
} else {
tmp = U + (J * (exp(l) + -1.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 <= (-2.1d-5)) then
tmp = u + (j * (3.0d0 - exp(-l)))
else if (l <= 0.76d0) then
tmp = u + (2.0d0 * (l * j))
else
tmp = u + (j * (exp(l) + (-1.0d0)))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (l <= -2.1e-5) {
tmp = U + (J * (3.0 - Math.exp(-l)));
} else if (l <= 0.76) {
tmp = U + (2.0 * (l * J));
} else {
tmp = U + (J * (Math.exp(l) + -1.0));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -2.1e-5: tmp = U + (J * (3.0 - math.exp(-l))) elif l <= 0.76: tmp = U + (2.0 * (l * J)) else: tmp = U + (J * (math.exp(l) + -1.0)) return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -2.1e-5) tmp = Float64(U + Float64(J * Float64(3.0 - exp(Float64(-l))))); elseif (l <= 0.76) tmp = Float64(U + Float64(2.0 * Float64(l * J))); else tmp = Float64(U + Float64(J * Float64(exp(l) + -1.0))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -2.1e-5) tmp = U + (J * (3.0 - exp(-l))); elseif (l <= 0.76) tmp = U + (2.0 * (l * J)); else tmp = U + (J * (exp(l) + -1.0)); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -2.1e-5], N[(U + N[(J * N[(3.0 - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 0.76], N[(U + N[(2.0 * N[(l * J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * N[(N[Exp[l], $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2.1 \cdot 10^{-5}:\\
\;\;\;\;U + J \cdot \left(3 - e^{-\ell}\right)\\
\mathbf{elif}\;\ell \leq 0.76:\\
\;\;\;\;U + 2 \cdot \left(\ell \cdot J\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(e^{\ell} + -1\right)\\
\end{array}
\end{array}
if l < -2.09999999999999988e-5Initial program 99.7%
Taylor expanded in K around 0 75.5%
Applied egg-rr75.7%
if -2.09999999999999988e-5 < l < 0.76000000000000001Initial program 73.5%
Taylor expanded in l around 0 99.9%
*-commutative99.9%
associate-*l*99.9%
Simplified99.9%
Taylor expanded in K around 0 88.7%
if 0.76000000000000001 < l Initial program 100.0%
Taylor expanded in K around 0 77.8%
Taylor expanded in l around 0 76.8%
Final simplification82.5%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (+ U (* (* J (* l 2.0)) (+ 1.0 (* -0.125 (* K K)))))))
(if (<= l -6.5e+152)
t_0
(if (<= l -950.0)
(pow U -3.0)
(if (<= l 2.55e+28) (+ U (* 2.0 (* l J))) t_0)))))
double code(double J, double l, double K, double U) {
double t_0 = U + ((J * (l * 2.0)) * (1.0 + (-0.125 * (K * K))));
double tmp;
if (l <= -6.5e+152) {
tmp = t_0;
} else if (l <= -950.0) {
tmp = pow(U, -3.0);
} else if (l <= 2.55e+28) {
tmp = U + (2.0 * (l * J));
} else {
tmp = t_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 = u + ((j * (l * 2.0d0)) * (1.0d0 + ((-0.125d0) * (k * k))))
if (l <= (-6.5d+152)) then
tmp = t_0
else if (l <= (-950.0d0)) then
tmp = u ** (-3.0d0)
else if (l <= 2.55d+28) then
tmp = u + (2.0d0 * (l * j))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = U + ((J * (l * 2.0)) * (1.0 + (-0.125 * (K * K))));
double tmp;
if (l <= -6.5e+152) {
tmp = t_0;
} else if (l <= -950.0) {
tmp = Math.pow(U, -3.0);
} else if (l <= 2.55e+28) {
tmp = U + (2.0 * (l * J));
} else {
tmp = t_0;
}
return tmp;
}
def code(J, l, K, U): t_0 = U + ((J * (l * 2.0)) * (1.0 + (-0.125 * (K * K)))) tmp = 0 if l <= -6.5e+152: tmp = t_0 elif l <= -950.0: tmp = math.pow(U, -3.0) elif l <= 2.55e+28: tmp = U + (2.0 * (l * J)) else: tmp = t_0 return tmp
function code(J, l, K, U) t_0 = Float64(U + Float64(Float64(J * Float64(l * 2.0)) * Float64(1.0 + Float64(-0.125 * Float64(K * K))))) tmp = 0.0 if (l <= -6.5e+152) tmp = t_0; elseif (l <= -950.0) tmp = U ^ -3.0; elseif (l <= 2.55e+28) tmp = Float64(U + Float64(2.0 * Float64(l * J))); else tmp = t_0; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = U + ((J * (l * 2.0)) * (1.0 + (-0.125 * (K * K)))); tmp = 0.0; if (l <= -6.5e+152) tmp = t_0; elseif (l <= -950.0) tmp = U ^ -3.0; elseif (l <= 2.55e+28) tmp = U + (2.0 * (l * J)); else tmp = t_0; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(U + N[(N[(J * N[(l * 2.0), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(-0.125 * N[(K * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -6.5e+152], t$95$0, If[LessEqual[l, -950.0], N[Power[U, -3.0], $MachinePrecision], If[LessEqual[l, 2.55e+28], N[(U + N[(2.0 * N[(l * J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + \left(J \cdot \left(\ell \cdot 2\right)\right) \cdot \left(1 + -0.125 \cdot \left(K \cdot K\right)\right)\\
\mathbf{if}\;\ell \leq -6.5 \cdot 10^{+152}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq -950:\\
\;\;\;\;{U}^{-3}\\
\mathbf{elif}\;\ell \leq 2.55 \cdot 10^{+28}:\\
\;\;\;\;U + 2 \cdot \left(\ell \cdot J\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if l < -6.4999999999999997e152 or 2.5500000000000002e28 < l Initial program 100.0%
Taylor expanded in l around 0 31.9%
*-commutative31.9%
associate-*l*31.9%
Simplified31.9%
Taylor expanded in K around 0 36.4%
unpow236.4%
Applied egg-rr36.4%
if -6.4999999999999997e152 < l < -950Initial program 100.0%
associate-*l*100.0%
fma-define100.0%
Simplified100.0%
Applied egg-rr38.9%
if -950 < l < 2.5500000000000002e28Initial program 75.3%
Taylor expanded in l around 0 94.1%
*-commutative94.1%
associate-*l*94.1%
Simplified94.1%
Taylor expanded in K around 0 83.3%
Final simplification61.8%
(FPCore (J l K U)
:precision binary64
(if (<= l -660.0)
(pow U -4.0)
(if (<= l 2.55e+28)
(+ U (* 2.0 (* l J)))
(+ U (* (* J (* l 2.0)) (+ 1.0 (* -0.125 (* K K))))))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -660.0) {
tmp = pow(U, -4.0);
} else if (l <= 2.55e+28) {
tmp = U + (2.0 * (l * J));
} else {
tmp = U + ((J * (l * 2.0)) * (1.0 + (-0.125 * (K * K))));
}
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 <= (-660.0d0)) then
tmp = u ** (-4.0d0)
else if (l <= 2.55d+28) then
tmp = u + (2.0d0 * (l * j))
else
tmp = u + ((j * (l * 2.0d0)) * (1.0d0 + ((-0.125d0) * (k * k))))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (l <= -660.0) {
tmp = Math.pow(U, -4.0);
} else if (l <= 2.55e+28) {
tmp = U + (2.0 * (l * J));
} else {
tmp = U + ((J * (l * 2.0)) * (1.0 + (-0.125 * (K * K))));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -660.0: tmp = math.pow(U, -4.0) elif l <= 2.55e+28: tmp = U + (2.0 * (l * J)) else: tmp = U + ((J * (l * 2.0)) * (1.0 + (-0.125 * (K * K)))) return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -660.0) tmp = U ^ -4.0; elseif (l <= 2.55e+28) tmp = Float64(U + Float64(2.0 * Float64(l * J))); else tmp = Float64(U + Float64(Float64(J * Float64(l * 2.0)) * Float64(1.0 + Float64(-0.125 * Float64(K * K))))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -660.0) tmp = U ^ -4.0; elseif (l <= 2.55e+28) tmp = U + (2.0 * (l * J)); else tmp = U + ((J * (l * 2.0)) * (1.0 + (-0.125 * (K * K)))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -660.0], N[Power[U, -4.0], $MachinePrecision], If[LessEqual[l, 2.55e+28], N[(U + N[(2.0 * N[(l * J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(N[(J * N[(l * 2.0), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(-0.125 * N[(K * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -660:\\
\;\;\;\;{U}^{-4}\\
\mathbf{elif}\;\ell \leq 2.55 \cdot 10^{+28}:\\
\;\;\;\;U + 2 \cdot \left(\ell \cdot J\right)\\
\mathbf{else}:\\
\;\;\;\;U + \left(J \cdot \left(\ell \cdot 2\right)\right) \cdot \left(1 + -0.125 \cdot \left(K \cdot K\right)\right)\\
\end{array}
\end{array}
if l < -660Initial program 100.0%
associate-*l*100.0%
fma-define100.0%
Simplified100.0%
Applied egg-rr29.8%
if -660 < l < 2.5500000000000002e28Initial program 75.3%
Taylor expanded in l around 0 94.1%
*-commutative94.1%
associate-*l*94.1%
Simplified94.1%
Taylor expanded in K around 0 83.3%
if 2.5500000000000002e28 < l Initial program 100.0%
Taylor expanded in l around 0 29.9%
*-commutative29.9%
associate-*l*29.9%
Simplified29.9%
Taylor expanded in K around 0 36.7%
unpow236.7%
Applied egg-rr36.7%
Final simplification60.2%
(FPCore (J l K U) :precision binary64 (if (or (<= l -2.1e-5) (not (<= l 2.55e+28))) (+ U (* (* J (* l 2.0)) (+ 1.0 (* -0.125 (* K K))))) (+ U (* 2.0 (* l J)))))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -2.1e-5) || !(l <= 2.55e+28)) {
tmp = U + ((J * (l * 2.0)) * (1.0 + (-0.125 * (K * K))));
} else {
tmp = U + (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 <= (-2.1d-5)) .or. (.not. (l <= 2.55d+28))) then
tmp = u + ((j * (l * 2.0d0)) * (1.0d0 + ((-0.125d0) * (k * k))))
else
tmp = u + (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 <= -2.1e-5) || !(l <= 2.55e+28)) {
tmp = U + ((J * (l * 2.0)) * (1.0 + (-0.125 * (K * K))));
} else {
tmp = U + (2.0 * (l * J));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -2.1e-5) or not (l <= 2.55e+28): tmp = U + ((J * (l * 2.0)) * (1.0 + (-0.125 * (K * K)))) else: tmp = U + (2.0 * (l * J)) return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -2.1e-5) || !(l <= 2.55e+28)) tmp = Float64(U + Float64(Float64(J * Float64(l * 2.0)) * Float64(1.0 + Float64(-0.125 * Float64(K * K))))); else tmp = Float64(U + Float64(2.0 * Float64(l * J))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -2.1e-5) || ~((l <= 2.55e+28))) tmp = U + ((J * (l * 2.0)) * (1.0 + (-0.125 * (K * K)))); else tmp = U + (2.0 * (l * J)); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -2.1e-5], N[Not[LessEqual[l, 2.55e+28]], $MachinePrecision]], N[(U + N[(N[(J * N[(l * 2.0), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(-0.125 * N[(K * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(2.0 * N[(l * J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2.1 \cdot 10^{-5} \lor \neg \left(\ell \leq 2.55 \cdot 10^{+28}\right):\\
\;\;\;\;U + \left(J \cdot \left(\ell \cdot 2\right)\right) \cdot \left(1 + -0.125 \cdot \left(K \cdot K\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + 2 \cdot \left(\ell \cdot J\right)\\
\end{array}
\end{array}
if l < -2.09999999999999988e-5 or 2.5500000000000002e28 < l Initial program 99.9%
Taylor expanded in l around 0 27.9%
*-commutative27.9%
associate-*l*27.9%
Simplified27.9%
Taylor expanded in K around 0 31.3%
unpow231.3%
Applied egg-rr31.3%
if -2.09999999999999988e-5 < l < 2.5500000000000002e28Initial program 75.2%
Taylor expanded in l around 0 94.3%
*-commutative94.3%
associate-*l*94.3%
Simplified94.3%
Taylor expanded in K around 0 83.9%
Final simplification59.2%
(FPCore (J l K U) :precision binary64 (if (<= l 3200000000000.0) U (* U U)))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= 3200000000000.0) {
tmp = U;
} else {
tmp = U * 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 <= 3200000000000.0d0) then
tmp = u
else
tmp = u * u
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (l <= 3200000000000.0) {
tmp = U;
} else {
tmp = U * U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= 3200000000000.0: tmp = U else: tmp = U * U return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= 3200000000000.0) tmp = U; else tmp = Float64(U * U); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= 3200000000000.0) tmp = U; else tmp = U * U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, 3200000000000.0], U, N[(U * U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 3200000000000:\\
\;\;\;\;U\\
\mathbf{else}:\\
\;\;\;\;U \cdot U\\
\end{array}
\end{array}
if l < 3.2e12Initial program 82.2%
associate-*l*82.2%
fma-define82.2%
Simplified82.2%
Taylor expanded in J around 0 49.5%
if 3.2e12 < l Initial program 100.0%
associate-*l*100.0%
fma-define100.0%
Simplified100.0%
Applied egg-rr13.8%
(FPCore (J l K U) :precision binary64 (+ U (* 2.0 (* l J))))
double code(double J, double l, double K, double U) {
return U + (2.0 * (l * J));
}
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 + (2.0d0 * (l * j))
end function
public static double code(double J, double l, double K, double U) {
return U + (2.0 * (l * J));
}
def code(J, l, K, U): return U + (2.0 * (l * J))
function code(J, l, K, U) return Float64(U + Float64(2.0 * Float64(l * J))) end
function tmp = code(J, l, K, U) tmp = U + (2.0 * (l * J)); end
code[J_, l_, K_, U_] := N[(U + N[(2.0 * N[(l * J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + 2 \cdot \left(\ell \cdot J\right)
\end{array}
Initial program 86.8%
Taylor expanded in l around 0 63.2%
*-commutative63.2%
associate-*l*63.2%
Simplified63.2%
Taylor expanded in K around 0 53.6%
Final simplification53.6%
(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.8%
associate-*l*86.8%
fma-define86.8%
Simplified86.8%
Taylor expanded in J around 0 37.3%
(FPCore (J l K U) :precision binary64 8.0)
double code(double J, double l, double K, double U) {
return 8.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 = 8.0d0
end function
public static double code(double J, double l, double K, double U) {
return 8.0;
}
def code(J, l, K, U): return 8.0
function code(J, l, K, U) return 8.0 end
function tmp = code(J, l, K, U) tmp = 8.0; end
code[J_, l_, K_, U_] := 8.0
\begin{array}{l}
\\
8
\end{array}
Initial program 86.8%
Applied egg-rr20.5%
Taylor expanded in U around 0 3.0%
(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.8%
Applied egg-rr20.6%
Taylor expanded in U around 0 3.0%
(FPCore (J l K U) :precision binary64 -4.0)
double code(double J, double l, double K, double U) {
return -4.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 = -4.0d0
end function
public static double code(double J, double l, double K, double U) {
return -4.0;
}
def code(J, l, K, U): return -4.0
function code(J, l, K, U) return -4.0 end
function tmp = code(J, l, K, U) tmp = -4.0; end
code[J_, l_, K_, U_] := -4.0
\begin{array}{l}
\\
-4
\end{array}
Initial program 86.8%
associate-*l*86.8%
fma-define86.8%
Simplified86.8%
Applied egg-rr20.2%
+-commutative20.2%
Simplified20.2%
Taylor expanded in U around 0 2.6%
herbie shell --seed 2024169
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))