
(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 21 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))) (t_1 (- (exp l) t_0)) (t_2 (cos (/ K 2.0))))
(if (<= t_1 (- INFINITY))
(+ (* t_2 (* J (- 27.0 t_0))) U)
(if (<= t_1 1e-15)
(+ U (* (* l 2.0) (* J (cos (* K 0.5)))))
(+ U (* t_2 (* J (+ (exp l) -1.0))))))))
double code(double J, double l, double K, double U) {
double t_0 = exp(-l);
double t_1 = exp(l) - t_0;
double t_2 = cos((K / 2.0));
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = (t_2 * (J * (27.0 - t_0))) + U;
} else if (t_1 <= 1e-15) {
tmp = U + ((l * 2.0) * (J * cos((K * 0.5))));
} else {
tmp = U + (t_2 * (J * (exp(l) + -1.0)));
}
return tmp;
}
public static double code(double J, double l, double K, double U) {
double t_0 = Math.exp(-l);
double t_1 = Math.exp(l) - t_0;
double t_2 = Math.cos((K / 2.0));
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = (t_2 * (J * (27.0 - t_0))) + U;
} else if (t_1 <= 1e-15) {
tmp = U + ((l * 2.0) * (J * Math.cos((K * 0.5))));
} else {
tmp = U + (t_2 * (J * (Math.exp(l) + -1.0)));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.exp(-l) t_1 = math.exp(l) - t_0 t_2 = math.cos((K / 2.0)) tmp = 0 if t_1 <= -math.inf: tmp = (t_2 * (J * (27.0 - t_0))) + U elif t_1 <= 1e-15: tmp = U + ((l * 2.0) * (J * math.cos((K * 0.5)))) else: tmp = U + (t_2 * (J * (math.exp(l) + -1.0))) return tmp
function code(J, l, K, U) t_0 = exp(Float64(-l)) t_1 = Float64(exp(l) - t_0) t_2 = cos(Float64(K / 2.0)) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(Float64(t_2 * Float64(J * Float64(27.0 - t_0))) + U); elseif (t_1 <= 1e-15) tmp = Float64(U + Float64(Float64(l * 2.0) * Float64(J * cos(Float64(K * 0.5))))); else tmp = Float64(U + Float64(t_2 * Float64(J * Float64(exp(l) + -1.0)))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = exp(-l); t_1 = exp(l) - t_0; t_2 = cos((K / 2.0)); tmp = 0.0; if (t_1 <= -Inf) tmp = (t_2 * (J * (27.0 - t_0))) + U; elseif (t_1 <= 1e-15) tmp = U + ((l * 2.0) * (J * cos((K * 0.5)))); else tmp = U + (t_2 * (J * (exp(l) + -1.0))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Exp[(-l)], $MachinePrecision]}, Block[{t$95$1 = N[(N[Exp[l], $MachinePrecision] - t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(N[(t$95$2 * N[(J * N[(27.0 - t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], If[LessEqual[t$95$1, 1e-15], N[(U + N[(N[(l * 2.0), $MachinePrecision] * N[(J * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(t$95$2 * N[(J * N[(N[Exp[l], $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-\ell}\\
t_1 := e^{\ell} - t\_0\\
t_2 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;t\_2 \cdot \left(J \cdot \left(27 - t\_0\right)\right) + U\\
\mathbf{elif}\;t\_1 \leq 10^{-15}:\\
\;\;\;\;U + \left(\ell \cdot 2\right) \cdot \left(J \cdot \cos \left(K \cdot 0.5\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + t\_2 \cdot \left(J \cdot \left(e^{\ell} + -1\right)\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.0000000000000001e-15Initial program 73.3%
Taylor expanded in l around 0 99.9%
*-commutative99.9%
associate-*r*100.0%
associate-*l*100.0%
*-commutative100.0%
associate-*r*100.0%
*-commutative100.0%
*-commutative100.0%
Simplified100.0%
if 1.0000000000000001e-15 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 100.0%
Taylor expanded in l around 0 100.0%
neg-mul-1100.0%
unsub-neg100.0%
Simplified100.0%
Taylor expanded in l around 0 100.0%
Final simplification100.0%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))) (t_1 (exp (- l))))
(if (<= l -1.25e+106)
(+ U (* t_0 (* J (* l (+ 2.0 (* l (+ 0.5 (* l 0.16666666666666666))))))))
(if (<= l -5.2)
(+ U (* J (- 27.0 t_1)))
(if (<= l 114000000.0)
(+ U (* (* l 2.0) (* J (cos (* K 0.5)))))
(if (<= l 2.6e+77)
(+ U (* (- (exp l) t_1) J))
(+
U
(*
t_0
(*
J
(*
l
(+
2.0
(*
l
(+
0.5
(*
l
(+
0.16666666666666666
(* l 0.041666666666666664))))))))))))))))
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 <= -1.25e+106) {
tmp = U + (t_0 * (J * (l * (2.0 + (l * (0.5 + (l * 0.16666666666666666)))))));
} else if (l <= -5.2) {
tmp = U + (J * (27.0 - t_1));
} else if (l <= 114000000.0) {
tmp = U + ((l * 2.0) * (J * cos((K * 0.5))));
} else if (l <= 2.6e+77) {
tmp = U + ((exp(l) - t_1) * J);
} else {
tmp = U + (t_0 * (J * (l * (2.0 + (l * (0.5 + (l * (0.16666666666666666 + (l * 0.041666666666666664)))))))));
}
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 <= (-1.25d+106)) then
tmp = u + (t_0 * (j * (l * (2.0d0 + (l * (0.5d0 + (l * 0.16666666666666666d0)))))))
else if (l <= (-5.2d0)) then
tmp = u + (j * (27.0d0 - t_1))
else if (l <= 114000000.0d0) then
tmp = u + ((l * 2.0d0) * (j * cos((k * 0.5d0))))
else if (l <= 2.6d+77) then
tmp = u + ((exp(l) - t_1) * j)
else
tmp = u + (t_0 * (j * (l * (2.0d0 + (l * (0.5d0 + (l * (0.16666666666666666d0 + (l * 0.041666666666666664d0)))))))))
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 <= -1.25e+106) {
tmp = U + (t_0 * (J * (l * (2.0 + (l * (0.5 + (l * 0.16666666666666666)))))));
} else if (l <= -5.2) {
tmp = U + (J * (27.0 - t_1));
} else if (l <= 114000000.0) {
tmp = U + ((l * 2.0) * (J * Math.cos((K * 0.5))));
} else if (l <= 2.6e+77) {
tmp = U + ((Math.exp(l) - t_1) * J);
} else {
tmp = U + (t_0 * (J * (l * (2.0 + (l * (0.5 + (l * (0.16666666666666666 + (l * 0.041666666666666664)))))))));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K / 2.0)) t_1 = math.exp(-l) tmp = 0 if l <= -1.25e+106: tmp = U + (t_0 * (J * (l * (2.0 + (l * (0.5 + (l * 0.16666666666666666))))))) elif l <= -5.2: tmp = U + (J * (27.0 - t_1)) elif l <= 114000000.0: tmp = U + ((l * 2.0) * (J * math.cos((K * 0.5)))) elif l <= 2.6e+77: tmp = U + ((math.exp(l) - t_1) * J) else: tmp = U + (t_0 * (J * (l * (2.0 + (l * (0.5 + (l * (0.16666666666666666 + (l * 0.041666666666666664))))))))) 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 <= -1.25e+106) tmp = Float64(U + Float64(t_0 * Float64(J * Float64(l * Float64(2.0 + Float64(l * Float64(0.5 + Float64(l * 0.16666666666666666)))))))); elseif (l <= -5.2) tmp = Float64(U + Float64(J * Float64(27.0 - t_1))); elseif (l <= 114000000.0) tmp = Float64(U + Float64(Float64(l * 2.0) * Float64(J * cos(Float64(K * 0.5))))); elseif (l <= 2.6e+77) tmp = Float64(U + Float64(Float64(exp(l) - t_1) * J)); else tmp = Float64(U + Float64(t_0 * Float64(J * Float64(l * Float64(2.0 + Float64(l * Float64(0.5 + Float64(l * Float64(0.16666666666666666 + Float64(l * 0.041666666666666664)))))))))); 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 <= -1.25e+106) tmp = U + (t_0 * (J * (l * (2.0 + (l * (0.5 + (l * 0.16666666666666666))))))); elseif (l <= -5.2) tmp = U + (J * (27.0 - t_1)); elseif (l <= 114000000.0) tmp = U + ((l * 2.0) * (J * cos((K * 0.5)))); elseif (l <= 2.6e+77) tmp = U + ((exp(l) - t_1) * J); else tmp = U + (t_0 * (J * (l * (2.0 + (l * (0.5 + (l * (0.16666666666666666 + (l * 0.041666666666666664))))))))); 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, -1.25e+106], N[(U + N[(t$95$0 * N[(J * N[(l * N[(2.0 + N[(l * N[(0.5 + N[(l * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -5.2], N[(U + N[(J * N[(27.0 - t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 114000000.0], N[(U + N[(N[(l * 2.0), $MachinePrecision] * N[(J * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.6e+77], N[(U + N[(N[(N[Exp[l], $MachinePrecision] - t$95$1), $MachinePrecision] * J), $MachinePrecision]), $MachinePrecision], N[(U + N[(t$95$0 * N[(J * N[(l * N[(2.0 + N[(l * N[(0.5 + N[(l * N[(0.16666666666666666 + N[(l * 0.041666666666666664), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
t_1 := e^{-\ell}\\
\mathbf{if}\;\ell \leq -1.25 \cdot 10^{+106}:\\
\;\;\;\;U + t\_0 \cdot \left(J \cdot \left(\ell \cdot \left(2 + \ell \cdot \left(0.5 + \ell \cdot 0.16666666666666666\right)\right)\right)\right)\\
\mathbf{elif}\;\ell \leq -5.2:\\
\;\;\;\;U + J \cdot \left(27 - t\_1\right)\\
\mathbf{elif}\;\ell \leq 114000000:\\
\;\;\;\;U + \left(\ell \cdot 2\right) \cdot \left(J \cdot \cos \left(K \cdot 0.5\right)\right)\\
\mathbf{elif}\;\ell \leq 2.6 \cdot 10^{+77}:\\
\;\;\;\;U + \left(e^{\ell} - t\_1\right) \cdot J\\
\mathbf{else}:\\
\;\;\;\;U + t\_0 \cdot \left(J \cdot \left(\ell \cdot \left(2 + \ell \cdot \left(0.5 + \ell \cdot \left(0.16666666666666666 + \ell \cdot 0.041666666666666664\right)\right)\right)\right)\right)\\
\end{array}
\end{array}
if l < -1.25e106Initial program 100.0%
Taylor expanded in l around 0 39.4%
neg-mul-139.4%
unsub-neg39.4%
Simplified39.4%
Taylor expanded in l around 0 100.0%
*-commutative100.0%
Simplified100.0%
if -1.25e106 < l < -5.20000000000000018Initial program 100.0%
Taylor expanded in K around 0 80.0%
*-commutative80.0%
Simplified80.0%
Applied egg-rr80.0%
if -5.20000000000000018 < l < 1.14e8Initial program 73.7%
Taylor expanded in l around 0 99.1%
*-commutative99.1%
associate-*r*99.2%
associate-*l*99.2%
*-commutative99.2%
associate-*r*99.2%
*-commutative99.2%
*-commutative99.2%
Simplified99.2%
if 1.14e8 < l < 2.6000000000000002e77Initial program 100.0%
Taylor expanded in K around 0 76.5%
*-commutative76.5%
Simplified76.5%
if 2.6000000000000002e77 < l Initial program 100.0%
Taylor expanded in l around 0 100.0%
neg-mul-1100.0%
unsub-neg100.0%
Simplified100.0%
Taylor expanded in l around 0 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification96.1%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= l -1.4e+106)
(+ U (* t_0 (* J (* l (+ 2.0 (* l (+ 0.5 (* l 0.16666666666666666))))))))
(if (<= l -10.5)
(+ U (* J (- 27.0 (exp (- l)))))
(if (<= l 5.6e-10)
(+ U (* (* l 2.0) (* J (cos (* K 0.5)))))
(+ U (* t_0 (* J (+ (exp l) -1.0)))))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double tmp;
if (l <= -1.4e+106) {
tmp = U + (t_0 * (J * (l * (2.0 + (l * (0.5 + (l * 0.16666666666666666)))))));
} else if (l <= -10.5) {
tmp = U + (J * (27.0 - exp(-l)));
} else if (l <= 5.6e-10) {
tmp = U + ((l * 2.0) * (J * cos((K * 0.5))));
} else {
tmp = U + (t_0 * (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 = cos((k / 2.0d0))
if (l <= (-1.4d+106)) then
tmp = u + (t_0 * (j * (l * (2.0d0 + (l * (0.5d0 + (l * 0.16666666666666666d0)))))))
else if (l <= (-10.5d0)) then
tmp = u + (j * (27.0d0 - exp(-l)))
else if (l <= 5.6d-10) then
tmp = u + ((l * 2.0d0) * (j * cos((k * 0.5d0))))
else
tmp = u + (t_0 * (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 = Math.cos((K / 2.0));
double tmp;
if (l <= -1.4e+106) {
tmp = U + (t_0 * (J * (l * (2.0 + (l * (0.5 + (l * 0.16666666666666666)))))));
} else if (l <= -10.5) {
tmp = U + (J * (27.0 - Math.exp(-l)));
} else if (l <= 5.6e-10) {
tmp = U + ((l * 2.0) * (J * Math.cos((K * 0.5))));
} else {
tmp = U + (t_0 * (J * (Math.exp(l) + -1.0)));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K / 2.0)) tmp = 0 if l <= -1.4e+106: tmp = U + (t_0 * (J * (l * (2.0 + (l * (0.5 + (l * 0.16666666666666666))))))) elif l <= -10.5: tmp = U + (J * (27.0 - math.exp(-l))) elif l <= 5.6e-10: tmp = U + ((l * 2.0) * (J * math.cos((K * 0.5)))) else: tmp = U + (t_0 * (J * (math.exp(l) + -1.0))) return tmp
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) tmp = 0.0 if (l <= -1.4e+106) tmp = Float64(U + Float64(t_0 * Float64(J * Float64(l * Float64(2.0 + Float64(l * Float64(0.5 + Float64(l * 0.16666666666666666)))))))); elseif (l <= -10.5) tmp = Float64(U + Float64(J * Float64(27.0 - exp(Float64(-l))))); elseif (l <= 5.6e-10) tmp = Float64(U + Float64(Float64(l * 2.0) * Float64(J * cos(Float64(K * 0.5))))); else tmp = Float64(U + Float64(t_0 * Float64(J * Float64(exp(l) + -1.0)))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = cos((K / 2.0)); tmp = 0.0; if (l <= -1.4e+106) tmp = U + (t_0 * (J * (l * (2.0 + (l * (0.5 + (l * 0.16666666666666666))))))); elseif (l <= -10.5) tmp = U + (J * (27.0 - exp(-l))); elseif (l <= 5.6e-10) tmp = U + ((l * 2.0) * (J * cos((K * 0.5)))); else tmp = U + (t_0 * (J * (exp(l) + -1.0))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -1.4e+106], N[(U + N[(t$95$0 * N[(J * N[(l * N[(2.0 + N[(l * N[(0.5 + N[(l * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -10.5], N[(U + N[(J * N[(27.0 - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 5.6e-10], N[(U + N[(N[(l * 2.0), $MachinePrecision] * N[(J * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(t$95$0 * N[(J * N[(N[Exp[l], $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;\ell \leq -1.4 \cdot 10^{+106}:\\
\;\;\;\;U + t\_0 \cdot \left(J \cdot \left(\ell \cdot \left(2 + \ell \cdot \left(0.5 + \ell \cdot 0.16666666666666666\right)\right)\right)\right)\\
\mathbf{elif}\;\ell \leq -10.5:\\
\;\;\;\;U + J \cdot \left(27 - e^{-\ell}\right)\\
\mathbf{elif}\;\ell \leq 5.6 \cdot 10^{-10}:\\
\;\;\;\;U + \left(\ell \cdot 2\right) \cdot \left(J \cdot \cos \left(K \cdot 0.5\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + t\_0 \cdot \left(J \cdot \left(e^{\ell} + -1\right)\right)\\
\end{array}
\end{array}
if l < -1.39999999999999996e106Initial program 100.0%
Taylor expanded in l around 0 39.4%
neg-mul-139.4%
unsub-neg39.4%
Simplified39.4%
Taylor expanded in l around 0 100.0%
*-commutative100.0%
Simplified100.0%
if -1.39999999999999996e106 < l < -10.5Initial program 100.0%
Taylor expanded in K around 0 80.0%
*-commutative80.0%
Simplified80.0%
Applied egg-rr80.0%
if -10.5 < l < 5.60000000000000031e-10Initial program 73.3%
Taylor expanded in l around 0 99.9%
*-commutative99.9%
associate-*r*100.0%
associate-*l*100.0%
*-commutative100.0%
associate-*r*100.0%
*-commutative100.0%
*-commutative100.0%
Simplified100.0%
if 5.60000000000000031e-10 < l Initial program 100.0%
Taylor expanded in l around 0 100.0%
neg-mul-1100.0%
unsub-neg100.0%
Simplified100.0%
Taylor expanded in l around 0 100.0%
Final simplification98.0%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= l -1.25e+106)
(+ U (* t_0 (* J (* l (+ 2.0 (* l (+ 0.5 (* l 0.16666666666666666))))))))
(if (<= l -4.2)
(+ U (* J (- 27.0 (exp (- l)))))
(if (<= l 114000000.0)
(+ U (* (* l 2.0) (* J (cos (* K 0.5)))))
(if (<= l 2.6e+77)
(+ U (* J (+ l (expm1 l))))
(+
U
(*
t_0
(*
J
(*
l
(+
2.0
(*
l
(+
0.5
(*
l
(+
0.16666666666666666
(* l 0.041666666666666664))))))))))))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double tmp;
if (l <= -1.25e+106) {
tmp = U + (t_0 * (J * (l * (2.0 + (l * (0.5 + (l * 0.16666666666666666)))))));
} else if (l <= -4.2) {
tmp = U + (J * (27.0 - exp(-l)));
} else if (l <= 114000000.0) {
tmp = U + ((l * 2.0) * (J * cos((K * 0.5))));
} else if (l <= 2.6e+77) {
tmp = U + (J * (l + expm1(l)));
} else {
tmp = U + (t_0 * (J * (l * (2.0 + (l * (0.5 + (l * (0.16666666666666666 + (l * 0.041666666666666664)))))))));
}
return tmp;
}
public static double code(double J, double l, double K, double U) {
double t_0 = Math.cos((K / 2.0));
double tmp;
if (l <= -1.25e+106) {
tmp = U + (t_0 * (J * (l * (2.0 + (l * (0.5 + (l * 0.16666666666666666)))))));
} else if (l <= -4.2) {
tmp = U + (J * (27.0 - Math.exp(-l)));
} else if (l <= 114000000.0) {
tmp = U + ((l * 2.0) * (J * Math.cos((K * 0.5))));
} else if (l <= 2.6e+77) {
tmp = U + (J * (l + Math.expm1(l)));
} else {
tmp = U + (t_0 * (J * (l * (2.0 + (l * (0.5 + (l * (0.16666666666666666 + (l * 0.041666666666666664)))))))));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K / 2.0)) tmp = 0 if l <= -1.25e+106: tmp = U + (t_0 * (J * (l * (2.0 + (l * (0.5 + (l * 0.16666666666666666))))))) elif l <= -4.2: tmp = U + (J * (27.0 - math.exp(-l))) elif l <= 114000000.0: tmp = U + ((l * 2.0) * (J * math.cos((K * 0.5)))) elif l <= 2.6e+77: tmp = U + (J * (l + math.expm1(l))) else: tmp = U + (t_0 * (J * (l * (2.0 + (l * (0.5 + (l * (0.16666666666666666 + (l * 0.041666666666666664))))))))) return tmp
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) tmp = 0.0 if (l <= -1.25e+106) tmp = Float64(U + Float64(t_0 * Float64(J * Float64(l * Float64(2.0 + Float64(l * Float64(0.5 + Float64(l * 0.16666666666666666)))))))); elseif (l <= -4.2) tmp = Float64(U + Float64(J * Float64(27.0 - exp(Float64(-l))))); elseif (l <= 114000000.0) tmp = Float64(U + Float64(Float64(l * 2.0) * Float64(J * cos(Float64(K * 0.5))))); elseif (l <= 2.6e+77) tmp = Float64(U + Float64(J * Float64(l + expm1(l)))); else tmp = Float64(U + Float64(t_0 * Float64(J * Float64(l * Float64(2.0 + Float64(l * Float64(0.5 + Float64(l * Float64(0.16666666666666666 + Float64(l * 0.041666666666666664)))))))))); end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -1.25e+106], N[(U + N[(t$95$0 * N[(J * N[(l * N[(2.0 + N[(l * N[(0.5 + N[(l * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -4.2], N[(U + N[(J * N[(27.0 - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 114000000.0], N[(U + N[(N[(l * 2.0), $MachinePrecision] * N[(J * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.6e+77], N[(U + N[(J * N[(l + N[(Exp[l] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(t$95$0 * N[(J * N[(l * N[(2.0 + N[(l * N[(0.5 + N[(l * N[(0.16666666666666666 + N[(l * 0.041666666666666664), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;\ell \leq -1.25 \cdot 10^{+106}:\\
\;\;\;\;U + t\_0 \cdot \left(J \cdot \left(\ell \cdot \left(2 + \ell \cdot \left(0.5 + \ell \cdot 0.16666666666666666\right)\right)\right)\right)\\
\mathbf{elif}\;\ell \leq -4.2:\\
\;\;\;\;U + J \cdot \left(27 - e^{-\ell}\right)\\
\mathbf{elif}\;\ell \leq 114000000:\\
\;\;\;\;U + \left(\ell \cdot 2\right) \cdot \left(J \cdot \cos \left(K \cdot 0.5\right)\right)\\
\mathbf{elif}\;\ell \leq 2.6 \cdot 10^{+77}:\\
\;\;\;\;U + J \cdot \left(\ell + \mathsf{expm1}\left(\ell\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + t\_0 \cdot \left(J \cdot \left(\ell \cdot \left(2 + \ell \cdot \left(0.5 + \ell \cdot \left(0.16666666666666666 + \ell \cdot 0.041666666666666664\right)\right)\right)\right)\right)\\
\end{array}
\end{array}
if l < -1.25e106Initial program 100.0%
Taylor expanded in l around 0 39.4%
neg-mul-139.4%
unsub-neg39.4%
Simplified39.4%
Taylor expanded in l around 0 100.0%
*-commutative100.0%
Simplified100.0%
if -1.25e106 < l < -4.20000000000000018Initial program 100.0%
Taylor expanded in K around 0 80.0%
*-commutative80.0%
Simplified80.0%
Applied egg-rr80.0%
if -4.20000000000000018 < l < 1.14e8Initial program 73.7%
Taylor expanded in l around 0 99.1%
*-commutative99.1%
associate-*r*99.2%
associate-*l*99.2%
*-commutative99.2%
associate-*r*99.2%
*-commutative99.2%
*-commutative99.2%
Simplified99.2%
if 1.14e8 < l < 2.6000000000000002e77Initial program 100.0%
Taylor expanded in l around 0 100.0%
neg-mul-1100.0%
unsub-neg100.0%
Simplified100.0%
Taylor expanded in K around 0 76.5%
associate--l+76.5%
expm1-define76.5%
Simplified76.5%
if 2.6000000000000002e77 < l Initial program 100.0%
Taylor expanded in l around 0 100.0%
neg-mul-1100.0%
unsub-neg100.0%
Simplified100.0%
Taylor expanded in l around 0 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification96.1%
(FPCore (J l K U)
:precision binary64
(let* ((t_0
(+
U
(*
(cos (/ K 2.0))
(* J (* l (+ 2.0 (* l (+ 0.5 (* l 0.16666666666666666))))))))))
(if (<= l -1.4e+106)
t_0
(if (<= l -9.2)
(+ U (* J (- 27.0 (exp (- l)))))
(if (<= l 114000000.0)
(+ U (* (* l 2.0) (* J (cos (* K 0.5)))))
(if (<= l 1.05e+103) (+ U (* J (+ l (expm1 l)))) t_0))))))
double code(double J, double l, double K, double U) {
double t_0 = U + (cos((K / 2.0)) * (J * (l * (2.0 + (l * (0.5 + (l * 0.16666666666666666)))))));
double tmp;
if (l <= -1.4e+106) {
tmp = t_0;
} else if (l <= -9.2) {
tmp = U + (J * (27.0 - exp(-l)));
} else if (l <= 114000000.0) {
tmp = U + ((l * 2.0) * (J * cos((K * 0.5))));
} else if (l <= 1.05e+103) {
tmp = U + (J * (l + expm1(l)));
} else {
tmp = t_0;
}
return tmp;
}
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 + (l * (0.5 + (l * 0.16666666666666666)))))));
double tmp;
if (l <= -1.4e+106) {
tmp = t_0;
} else if (l <= -9.2) {
tmp = U + (J * (27.0 - Math.exp(-l)));
} else if (l <= 114000000.0) {
tmp = U + ((l * 2.0) * (J * Math.cos((K * 0.5))));
} else if (l <= 1.05e+103) {
tmp = U + (J * (l + Math.expm1(l)));
} else {
tmp = t_0;
}
return tmp;
}
def code(J, l, K, U): t_0 = U + (math.cos((K / 2.0)) * (J * (l * (2.0 + (l * (0.5 + (l * 0.16666666666666666))))))) tmp = 0 if l <= -1.4e+106: tmp = t_0 elif l <= -9.2: tmp = U + (J * (27.0 - math.exp(-l))) elif l <= 114000000.0: tmp = U + ((l * 2.0) * (J * math.cos((K * 0.5)))) elif l <= 1.05e+103: tmp = U + (J * (l + math.expm1(l))) else: tmp = t_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(l * Float64(0.5 + Float64(l * 0.16666666666666666)))))))) tmp = 0.0 if (l <= -1.4e+106) tmp = t_0; elseif (l <= -9.2) tmp = Float64(U + Float64(J * Float64(27.0 - exp(Float64(-l))))); elseif (l <= 114000000.0) tmp = Float64(U + Float64(Float64(l * 2.0) * Float64(J * cos(Float64(K * 0.5))))); elseif (l <= 1.05e+103) tmp = Float64(U + Float64(J * Float64(l + expm1(l)))); else tmp = t_0; end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(J * N[(l * N[(2.0 + N[(l * N[(0.5 + N[(l * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -1.4e+106], t$95$0, If[LessEqual[l, -9.2], N[(U + N[(J * N[(27.0 - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 114000000.0], N[(U + N[(N[(l * 2.0), $MachinePrecision] * N[(J * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.05e+103], N[(U + N[(J * N[(l + N[(Exp[l] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(\ell \cdot \left(2 + \ell \cdot \left(0.5 + \ell \cdot 0.16666666666666666\right)\right)\right)\right)\\
\mathbf{if}\;\ell \leq -1.4 \cdot 10^{+106}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq -9.2:\\
\;\;\;\;U + J \cdot \left(27 - e^{-\ell}\right)\\
\mathbf{elif}\;\ell \leq 114000000:\\
\;\;\;\;U + \left(\ell \cdot 2\right) \cdot \left(J \cdot \cos \left(K \cdot 0.5\right)\right)\\
\mathbf{elif}\;\ell \leq 1.05 \cdot 10^{+103}:\\
\;\;\;\;U + J \cdot \left(\ell + \mathsf{expm1}\left(\ell\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if l < -1.39999999999999996e106 or 1.0500000000000001e103 < l Initial program 100.0%
Taylor expanded in l around 0 68.0%
neg-mul-168.0%
unsub-neg68.0%
Simplified68.0%
Taylor expanded in l around 0 100.0%
*-commutative100.0%
Simplified100.0%
if -1.39999999999999996e106 < l < -9.1999999999999993Initial program 100.0%
Taylor expanded in K around 0 80.0%
*-commutative80.0%
Simplified80.0%
Applied egg-rr80.0%
if -9.1999999999999993 < l < 1.14e8Initial program 73.7%
Taylor expanded in l around 0 99.1%
*-commutative99.1%
associate-*r*99.2%
associate-*l*99.2%
*-commutative99.2%
associate-*r*99.2%
*-commutative99.2%
*-commutative99.2%
Simplified99.2%
if 1.14e8 < l < 1.0500000000000001e103Initial program 100.0%
Taylor expanded in l around 0 100.0%
neg-mul-1100.0%
unsub-neg100.0%
Simplified100.0%
Taylor expanded in K around 0 79.2%
associate--l+79.2%
expm1-define79.2%
Simplified79.2%
Final simplification95.7%
(FPCore (J l K U)
:precision binary64
(if (<= l -4.6)
(+ U (* J (- 27.0 (exp (- l)))))
(if (<= l 114000000.0)
(+ U (* (* l 2.0) (* J (cos (* K 0.5)))))
(if (<= l 1.9e+154)
(+ U (* J (+ l (expm1 l))))
(+ U (* (cos (/ K 2.0)) (* J (* l (+ 2.0 (* l 0.5))))))))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -4.6) {
tmp = U + (J * (27.0 - exp(-l)));
} else if (l <= 114000000.0) {
tmp = U + ((l * 2.0) * (J * cos((K * 0.5))));
} else if (l <= 1.9e+154) {
tmp = U + (J * (l + expm1(l)));
} else {
tmp = U + (cos((K / 2.0)) * (J * (l * (2.0 + (l * 0.5)))));
}
return tmp;
}
public static double code(double J, double l, double K, double U) {
double tmp;
if (l <= -4.6) {
tmp = U + (J * (27.0 - Math.exp(-l)));
} else if (l <= 114000000.0) {
tmp = U + ((l * 2.0) * (J * Math.cos((K * 0.5))));
} else if (l <= 1.9e+154) {
tmp = U + (J * (l + Math.expm1(l)));
} else {
tmp = U + (Math.cos((K / 2.0)) * (J * (l * (2.0 + (l * 0.5)))));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -4.6: tmp = U + (J * (27.0 - math.exp(-l))) elif l <= 114000000.0: tmp = U + ((l * 2.0) * (J * math.cos((K * 0.5)))) elif l <= 1.9e+154: tmp = U + (J * (l + math.expm1(l))) else: tmp = U + (math.cos((K / 2.0)) * (J * (l * (2.0 + (l * 0.5))))) return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -4.6) tmp = Float64(U + Float64(J * Float64(27.0 - exp(Float64(-l))))); elseif (l <= 114000000.0) tmp = Float64(U + Float64(Float64(l * 2.0) * Float64(J * cos(Float64(K * 0.5))))); elseif (l <= 1.9e+154) tmp = Float64(U + Float64(J * Float64(l + expm1(l)))); else tmp = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(J * Float64(l * Float64(2.0 + Float64(l * 0.5)))))); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[l, -4.6], N[(U + N[(J * N[(27.0 - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 114000000.0], N[(U + N[(N[(l * 2.0), $MachinePrecision] * N[(J * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.9e+154], N[(U + N[(J * N[(l + N[(Exp[l] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(J * N[(l * N[(2.0 + N[(l * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -4.6:\\
\;\;\;\;U + J \cdot \left(27 - e^{-\ell}\right)\\
\mathbf{elif}\;\ell \leq 114000000:\\
\;\;\;\;U + \left(\ell \cdot 2\right) \cdot \left(J \cdot \cos \left(K \cdot 0.5\right)\right)\\
\mathbf{elif}\;\ell \leq 1.9 \cdot 10^{+154}:\\
\;\;\;\;U + J \cdot \left(\ell + \mathsf{expm1}\left(\ell\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(\ell \cdot \left(2 + \ell \cdot 0.5\right)\right)\right)\\
\end{array}
\end{array}
if l < -4.5999999999999996Initial program 100.0%
Taylor expanded in K around 0 73.2%
*-commutative73.2%
Simplified73.2%
Applied egg-rr73.2%
if -4.5999999999999996 < l < 1.14e8Initial program 73.7%
Taylor expanded in l around 0 99.1%
*-commutative99.1%
associate-*r*99.2%
associate-*l*99.2%
*-commutative99.2%
associate-*r*99.2%
*-commutative99.2%
*-commutative99.2%
Simplified99.2%
if 1.14e8 < l < 1.8999999999999999e154Initial program 100.0%
Taylor expanded in l around 0 100.0%
neg-mul-1100.0%
unsub-neg100.0%
Simplified100.0%
Taylor expanded in K around 0 83.3%
associate--l+83.3%
expm1-define83.3%
Simplified83.3%
if 1.8999999999999999e154 < l Initial program 100.0%
Taylor expanded in l around 0 100.0%
neg-mul-1100.0%
unsub-neg100.0%
Simplified100.0%
Taylor expanded in l around 0 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification89.8%
(FPCore (J l K U)
:precision binary64
(if (<= l -5.2)
(+ U (* J (- 27.0 (exp (- l)))))
(if (<= l 114000000.0)
(+ U (* (* l 2.0) (* J (cos (* K 0.5)))))
(+ U (* J (+ l (expm1 l)))))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -5.2) {
tmp = U + (J * (27.0 - exp(-l)));
} else if (l <= 114000000.0) {
tmp = U + ((l * 2.0) * (J * cos((K * 0.5))));
} else {
tmp = U + (J * (l + expm1(l)));
}
return tmp;
}
public static double code(double J, double l, double K, double U) {
double tmp;
if (l <= -5.2) {
tmp = U + (J * (27.0 - Math.exp(-l)));
} else if (l <= 114000000.0) {
tmp = U + ((l * 2.0) * (J * Math.cos((K * 0.5))));
} else {
tmp = U + (J * (l + Math.expm1(l)));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -5.2: tmp = U + (J * (27.0 - math.exp(-l))) elif l <= 114000000.0: tmp = U + ((l * 2.0) * (J * math.cos((K * 0.5)))) else: tmp = U + (J * (l + math.expm1(l))) return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -5.2) tmp = Float64(U + Float64(J * Float64(27.0 - exp(Float64(-l))))); elseif (l <= 114000000.0) tmp = Float64(U + Float64(Float64(l * 2.0) * Float64(J * cos(Float64(K * 0.5))))); else tmp = Float64(U + Float64(J * Float64(l + expm1(l)))); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[l, -5.2], N[(U + N[(J * N[(27.0 - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 114000000.0], N[(U + N[(N[(l * 2.0), $MachinePrecision] * N[(J * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * N[(l + N[(Exp[l] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -5.2:\\
\;\;\;\;U + J \cdot \left(27 - e^{-\ell}\right)\\
\mathbf{elif}\;\ell \leq 114000000:\\
\;\;\;\;U + \left(\ell \cdot 2\right) \cdot \left(J \cdot \cos \left(K \cdot 0.5\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(\ell + \mathsf{expm1}\left(\ell\right)\right)\\
\end{array}
\end{array}
if l < -5.20000000000000018Initial program 100.0%
Taylor expanded in K around 0 73.2%
*-commutative73.2%
Simplified73.2%
Applied egg-rr73.2%
if -5.20000000000000018 < l < 1.14e8Initial program 73.7%
Taylor expanded in l around 0 99.1%
*-commutative99.1%
associate-*r*99.2%
associate-*l*99.2%
*-commutative99.2%
associate-*r*99.2%
*-commutative99.2%
*-commutative99.2%
Simplified99.2%
if 1.14e8 < l Initial program 100.0%
Taylor expanded in l around 0 100.0%
neg-mul-1100.0%
unsub-neg100.0%
Simplified100.0%
Taylor expanded in K around 0 81.5%
associate--l+81.5%
expm1-define81.5%
Simplified81.5%
Final simplification87.5%
(FPCore (J l K U)
:precision binary64
(if (<= l -4.9)
(+ U (* J (- 27.0 (exp (- l)))))
(if (<= l 114000000.0)
(+ U (* J (* 2.0 (* l (cos (* K 0.5))))))
(+ U (* J (+ l (expm1 l)))))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -4.9) {
tmp = U + (J * (27.0 - exp(-l)));
} else if (l <= 114000000.0) {
tmp = U + (J * (2.0 * (l * cos((K * 0.5)))));
} else {
tmp = U + (J * (l + expm1(l)));
}
return tmp;
}
public static double code(double J, double l, double K, double U) {
double tmp;
if (l <= -4.9) {
tmp = U + (J * (27.0 - Math.exp(-l)));
} else if (l <= 114000000.0) {
tmp = U + (J * (2.0 * (l * Math.cos((K * 0.5)))));
} else {
tmp = U + (J * (l + Math.expm1(l)));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -4.9: tmp = U + (J * (27.0 - math.exp(-l))) elif l <= 114000000.0: tmp = U + (J * (2.0 * (l * math.cos((K * 0.5))))) else: tmp = U + (J * (l + math.expm1(l))) return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -4.9) tmp = Float64(U + Float64(J * Float64(27.0 - exp(Float64(-l))))); elseif (l <= 114000000.0) tmp = Float64(U + Float64(J * Float64(2.0 * Float64(l * cos(Float64(K * 0.5)))))); else tmp = Float64(U + Float64(J * Float64(l + expm1(l)))); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[l, -4.9], N[(U + N[(J * N[(27.0 - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 114000000.0], N[(U + N[(J * N[(2.0 * N[(l * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * N[(l + N[(Exp[l] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -4.9:\\
\;\;\;\;U + J \cdot \left(27 - e^{-\ell}\right)\\
\mathbf{elif}\;\ell \leq 114000000:\\
\;\;\;\;U + J \cdot \left(2 \cdot \left(\ell \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(\ell + \mathsf{expm1}\left(\ell\right)\right)\\
\end{array}
\end{array}
if l < -4.9000000000000004Initial program 100.0%
Taylor expanded in K around 0 73.2%
*-commutative73.2%
Simplified73.2%
Applied egg-rr73.2%
if -4.9000000000000004 < l < 1.14e8Initial program 73.7%
Taylor expanded in l around 0 99.1%
*-commutative99.1%
associate-*l*99.1%
*-commutative99.1%
Simplified99.1%
if 1.14e8 < l Initial program 100.0%
Taylor expanded in l around 0 100.0%
neg-mul-1100.0%
unsub-neg100.0%
Simplified100.0%
Taylor expanded in K around 0 81.5%
associate--l+81.5%
expm1-define81.5%
Simplified81.5%
Final simplification87.5%
(FPCore (J l K U) :precision binary64 (if (<= l -2.45) (+ U (* J (- 27.0 (exp (- l))))) (+ U (* J (+ l (expm1 l))))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -2.45) {
tmp = U + (J * (27.0 - exp(-l)));
} else {
tmp = U + (J * (l + expm1(l)));
}
return tmp;
}
public static double code(double J, double l, double K, double U) {
double tmp;
if (l <= -2.45) {
tmp = U + (J * (27.0 - Math.exp(-l)));
} else {
tmp = U + (J * (l + Math.expm1(l)));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -2.45: tmp = U + (J * (27.0 - math.exp(-l))) else: tmp = U + (J * (l + math.expm1(l))) return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -2.45) tmp = Float64(U + Float64(J * Float64(27.0 - exp(Float64(-l))))); else tmp = Float64(U + Float64(J * Float64(l + expm1(l)))); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[l, -2.45], N[(U + N[(J * N[(27.0 - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * N[(l + N[(Exp[l] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2.45:\\
\;\;\;\;U + J \cdot \left(27 - e^{-\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(\ell + \mathsf{expm1}\left(\ell\right)\right)\\
\end{array}
\end{array}
if l < -2.4500000000000002Initial program 100.0%
Taylor expanded in K around 0 73.2%
*-commutative73.2%
Simplified73.2%
Applied egg-rr73.2%
if -2.4500000000000002 < l Initial program 82.9%
Taylor expanded in l around 0 82.9%
neg-mul-182.9%
unsub-neg82.9%
Simplified82.9%
Taylor expanded in K around 0 75.6%
associate--l+77.8%
expm1-define85.7%
Simplified85.7%
Final simplification82.3%
(FPCore (J l K U) :precision binary64 (if (<= l 114000000.0) (+ U (* J (* l (+ 2.0 (* l (+ 0.5 (* l 0.16666666666666666))))))) (+ U (* J (+ l (expm1 l))))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= 114000000.0) {
tmp = U + (J * (l * (2.0 + (l * (0.5 + (l * 0.16666666666666666))))));
} else {
tmp = U + (J * (l + expm1(l)));
}
return tmp;
}
public static double code(double J, double l, double K, double U) {
double tmp;
if (l <= 114000000.0) {
tmp = U + (J * (l * (2.0 + (l * (0.5 + (l * 0.16666666666666666))))));
} else {
tmp = U + (J * (l + Math.expm1(l)));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= 114000000.0: tmp = U + (J * (l * (2.0 + (l * (0.5 + (l * 0.16666666666666666)))))) else: tmp = U + (J * (l + math.expm1(l))) return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= 114000000.0) tmp = Float64(U + Float64(J * Float64(l * Float64(2.0 + Float64(l * Float64(0.5 + Float64(l * 0.16666666666666666))))))); else tmp = Float64(U + Float64(J * Float64(l + expm1(l)))); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[l, 114000000.0], N[(U + N[(J * N[(l * N[(2.0 + N[(l * N[(0.5 + N[(l * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * N[(l + N[(Exp[l] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 114000000:\\
\;\;\;\;U + J \cdot \left(\ell \cdot \left(2 + \ell \cdot \left(0.5 + \ell \cdot 0.16666666666666666\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(\ell + \mathsf{expm1}\left(\ell\right)\right)\\
\end{array}
\end{array}
if l < 1.14e8Initial program 83.5%
Taylor expanded in K around 0 72.7%
*-commutative72.7%
Simplified72.7%
Taylor expanded in l around 0 52.5%
neg-mul-157.7%
unsub-neg57.7%
Simplified52.5%
Taylor expanded in l around 0 74.9%
*-commutative90.1%
Simplified74.9%
if 1.14e8 < l Initial program 100.0%
Taylor expanded in l around 0 100.0%
neg-mul-1100.0%
unsub-neg100.0%
Simplified100.0%
Taylor expanded in K around 0 81.5%
associate--l+81.5%
expm1-define81.5%
Simplified81.5%
Final simplification76.6%
(FPCore (J l K U)
:precision binary64
(if (<= K 3.8e-12)
(+ U (* J (* l (+ 2.0 (* l (+ 0.5 (* l 0.16666666666666666)))))))
(+
U
(*
J
(*
l
(+
2.0
(*
l
(+ 0.5 (* l (+ 0.16666666666666666 (* l 0.041666666666666664)))))))))))
double code(double J, double l, double K, double U) {
double tmp;
if (K <= 3.8e-12) {
tmp = U + (J * (l * (2.0 + (l * (0.5 + (l * 0.16666666666666666))))));
} else {
tmp = U + (J * (l * (2.0 + (l * (0.5 + (l * (0.16666666666666666 + (l * 0.041666666666666664))))))));
}
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 (k <= 3.8d-12) then
tmp = u + (j * (l * (2.0d0 + (l * (0.5d0 + (l * 0.16666666666666666d0))))))
else
tmp = u + (j * (l * (2.0d0 + (l * (0.5d0 + (l * (0.16666666666666666d0 + (l * 0.041666666666666664d0))))))))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (K <= 3.8e-12) {
tmp = U + (J * (l * (2.0 + (l * (0.5 + (l * 0.16666666666666666))))));
} else {
tmp = U + (J * (l * (2.0 + (l * (0.5 + (l * (0.16666666666666666 + (l * 0.041666666666666664))))))));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if K <= 3.8e-12: tmp = U + (J * (l * (2.0 + (l * (0.5 + (l * 0.16666666666666666)))))) else: tmp = U + (J * (l * (2.0 + (l * (0.5 + (l * (0.16666666666666666 + (l * 0.041666666666666664)))))))) return tmp
function code(J, l, K, U) tmp = 0.0 if (K <= 3.8e-12) tmp = Float64(U + Float64(J * Float64(l * Float64(2.0 + Float64(l * Float64(0.5 + Float64(l * 0.16666666666666666))))))); else tmp = Float64(U + Float64(J * Float64(l * Float64(2.0 + Float64(l * Float64(0.5 + Float64(l * Float64(0.16666666666666666 + Float64(l * 0.041666666666666664))))))))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (K <= 3.8e-12) tmp = U + (J * (l * (2.0 + (l * (0.5 + (l * 0.16666666666666666)))))); else tmp = U + (J * (l * (2.0 + (l * (0.5 + (l * (0.16666666666666666 + (l * 0.041666666666666664)))))))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[K, 3.8e-12], N[(U + N[(J * N[(l * N[(2.0 + N[(l * N[(0.5 + N[(l * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * N[(l * N[(2.0 + N[(l * N[(0.5 + N[(l * N[(0.16666666666666666 + N[(l * 0.041666666666666664), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;K \leq 3.8 \cdot 10^{-12}:\\
\;\;\;\;U + J \cdot \left(\ell \cdot \left(2 + \ell \cdot \left(0.5 + \ell \cdot 0.16666666666666666\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(\ell \cdot \left(2 + \ell \cdot \left(0.5 + \ell \cdot \left(0.16666666666666666 + \ell \cdot 0.041666666666666664\right)\right)\right)\right)\\
\end{array}
\end{array}
if K < 3.79999999999999996e-12Initial program 85.6%
Taylor expanded in K around 0 76.2%
*-commutative76.2%
Simplified76.2%
Taylor expanded in l around 0 56.7%
neg-mul-164.5%
unsub-neg64.5%
Simplified56.7%
Taylor expanded in l around 0 74.5%
*-commutative86.3%
Simplified74.5%
if 3.79999999999999996e-12 < K Initial program 93.0%
Taylor expanded in K around 0 71.8%
*-commutative71.8%
Simplified71.8%
Taylor expanded in l around 0 67.9%
neg-mul-178.5%
unsub-neg78.5%
Simplified67.9%
Taylor expanded in l around 0 74.4%
*-commutative70.9%
Simplified74.4%
Final simplification74.5%
(FPCore (J l K U) :precision binary64 (if (<= l 5e+119) (* U (+ 1.0 (* 2.0 (* J (/ l U))))) (+ U (* J (* l (+ 2.0 (* l 0.5)))))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= 5e+119) {
tmp = U * (1.0 + (2.0 * (J * (l / U))));
} else {
tmp = U + (J * (l * (2.0 + (l * 0.5))));
}
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 <= 5d+119) then
tmp = u * (1.0d0 + (2.0d0 * (j * (l / u))))
else
tmp = u + (j * (l * (2.0d0 + (l * 0.5d0))))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (l <= 5e+119) {
tmp = U * (1.0 + (2.0 * (J * (l / U))));
} else {
tmp = U + (J * (l * (2.0 + (l * 0.5))));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= 5e+119: tmp = U * (1.0 + (2.0 * (J * (l / U)))) else: tmp = U + (J * (l * (2.0 + (l * 0.5)))) return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= 5e+119) tmp = Float64(U * Float64(1.0 + Float64(2.0 * Float64(J * Float64(l / U))))); else tmp = Float64(U + Float64(J * Float64(l * Float64(2.0 + Float64(l * 0.5))))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= 5e+119) tmp = U * (1.0 + (2.0 * (J * (l / U)))); else tmp = U + (J * (l * (2.0 + (l * 0.5)))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, 5e+119], N[(U * N[(1.0 + N[(2.0 * N[(J * N[(l / U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * N[(l * N[(2.0 + N[(l * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 5 \cdot 10^{+119}:\\
\;\;\;\;U \cdot \left(1 + 2 \cdot \left(J \cdot \frac{\ell}{U}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(\ell \cdot \left(2 + \ell \cdot 0.5\right)\right)\\
\end{array}
\end{array}
if l < 4.9999999999999999e119Initial program 85.6%
Taylor expanded in K around 0 73.5%
*-commutative73.5%
Simplified73.5%
Taylor expanded in l around 0 56.1%
Taylor expanded in U around inf 59.4%
associate-/l*61.6%
Simplified61.6%
if 4.9999999999999999e119 < l Initial program 100.0%
Taylor expanded in K around 0 83.8%
*-commutative83.8%
Simplified83.8%
Taylor expanded in l around 0 83.8%
neg-mul-1100.0%
unsub-neg100.0%
Simplified83.8%
Taylor expanded in l around 0 76.1%
*-commutative92.3%
Simplified76.1%
Final simplification63.7%
(FPCore (J l K U) :precision binary64 (if (or (<= l -1.2e-15) (not (<= l 3.9e+58))) (* U (- U -4.0)) U))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -1.2e-15) || !(l <= 3.9e+58)) {
tmp = U * (U - -4.0);
} else {
tmp = U;
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if ((l <= (-1.2d-15)) .or. (.not. (l <= 3.9d+58))) then
tmp = u * (u - (-4.0d0))
else
tmp = u
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -1.2e-15) || !(l <= 3.9e+58)) {
tmp = U * (U - -4.0);
} else {
tmp = U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -1.2e-15) or not (l <= 3.9e+58): tmp = U * (U - -4.0) else: tmp = U return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -1.2e-15) || !(l <= 3.9e+58)) tmp = Float64(U * Float64(U - -4.0)); else tmp = U; end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -1.2e-15) || ~((l <= 3.9e+58))) tmp = U * (U - -4.0); else tmp = U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -1.2e-15], N[Not[LessEqual[l, 3.9e+58]], $MachinePrecision]], N[(U * N[(U - -4.0), $MachinePrecision]), $MachinePrecision], U]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.2 \cdot 10^{-15} \lor \neg \left(\ell \leq 3.9 \cdot 10^{+58}\right):\\
\;\;\;\;U \cdot \left(U - -4\right)\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\end{array}
if l < -1.19999999999999997e-15 or 3.9000000000000001e58 < l Initial program 99.1%
associate-*l*99.1%
fma-define99.1%
Simplified99.1%
Applied egg-rr11.9%
if -1.19999999999999997e-15 < l < 3.9000000000000001e58Initial program 76.0%
associate-*l*76.0%
fma-define76.0%
Simplified76.0%
Taylor expanded in J around 0 68.1%
Final simplification39.8%
(FPCore (J l K U) :precision binary64 (+ U (* J (* l (+ 2.0 (* l (+ 0.5 (* l 0.16666666666666666))))))))
double code(double J, double l, double K, double U) {
return U + (J * (l * (2.0 + (l * (0.5 + (l * 0.16666666666666666))))));
}
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 * (0.5d0 + (l * 0.16666666666666666d0))))))
end function
public static double code(double J, double l, double K, double U) {
return U + (J * (l * (2.0 + (l * (0.5 + (l * 0.16666666666666666))))));
}
def code(J, l, K, U): return U + (J * (l * (2.0 + (l * (0.5 + (l * 0.16666666666666666))))))
function code(J, l, K, U) return Float64(U + Float64(J * Float64(l * Float64(2.0 + Float64(l * Float64(0.5 + Float64(l * 0.16666666666666666))))))) end
function tmp = code(J, l, K, U) tmp = U + (J * (l * (2.0 + (l * (0.5 + (l * 0.16666666666666666)))))); end
code[J_, l_, K_, U_] := N[(U + N[(J * N[(l * N[(2.0 + N[(l * N[(0.5 + N[(l * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + J \cdot \left(\ell \cdot \left(2 + \ell \cdot \left(0.5 + \ell \cdot 0.16666666666666666\right)\right)\right)
\end{array}
Initial program 87.7%
Taylor expanded in K around 0 75.0%
*-commutative75.0%
Simplified75.0%
Taylor expanded in l around 0 59.9%
neg-mul-168.5%
unsub-neg68.5%
Simplified59.9%
Taylor expanded in l around 0 71.8%
*-commutative86.3%
Simplified71.8%
Final simplification71.8%
(FPCore (J l K U) :precision binary64 (if (<= l 2.5e-18) (+ U (* J (* l 2.0))) (* J (+ (* l 2.0) (/ U J)))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= 2.5e-18) {
tmp = U + (J * (l * 2.0));
} else {
tmp = J * ((l * 2.0) + (U / 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.5d-18) then
tmp = u + (j * (l * 2.0d0))
else
tmp = j * ((l * 2.0d0) + (u / j))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (l <= 2.5e-18) {
tmp = U + (J * (l * 2.0));
} else {
tmp = J * ((l * 2.0) + (U / J));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= 2.5e-18: tmp = U + (J * (l * 2.0)) else: tmp = J * ((l * 2.0) + (U / J)) return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= 2.5e-18) tmp = Float64(U + Float64(J * Float64(l * 2.0))); else tmp = Float64(J * Float64(Float64(l * 2.0) + Float64(U / J))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= 2.5e-18) tmp = U + (J * (l * 2.0)); else tmp = J * ((l * 2.0) + (U / J)); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, 2.5e-18], N[(U + N[(J * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(J * N[(N[(l * 2.0), $MachinePrecision] + N[(U / J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 2.5 \cdot 10^{-18}:\\
\;\;\;\;U + J \cdot \left(\ell \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;J \cdot \left(\ell \cdot 2 + \frac{U}{J}\right)\\
\end{array}
\end{array}
if l < 2.50000000000000018e-18Initial program 83.6%
Taylor expanded in K around 0 73.2%
*-commutative73.2%
Simplified73.2%
Taylor expanded in l around 0 62.7%
if 2.50000000000000018e-18 < l Initial program 98.9%
Taylor expanded in K around 0 79.8%
*-commutative79.8%
Simplified79.8%
Taylor expanded in l around 0 18.9%
Taylor expanded in J around inf 25.9%
Final simplification52.9%
(FPCore (J l K U) :precision binary64 (if (or (<= l -5.2e-9) (not (<= l 7e+73))) (* U U) U))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -5.2e-9) || !(l <= 7e+73)) {
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 <= (-5.2d-9)) .or. (.not. (l <= 7d+73))) 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 <= -5.2e-9) || !(l <= 7e+73)) {
tmp = U * U;
} else {
tmp = U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -5.2e-9) or not (l <= 7e+73): tmp = U * U else: tmp = U return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -5.2e-9) || !(l <= 7e+73)) tmp = Float64(U * U); else tmp = U; end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -5.2e-9) || ~((l <= 7e+73))) tmp = U * U; else tmp = U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -5.2e-9], N[Not[LessEqual[l, 7e+73]], $MachinePrecision]], N[(U * U), $MachinePrecision], U]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -5.2 \cdot 10^{-9} \lor \neg \left(\ell \leq 7 \cdot 10^{+73}\right):\\
\;\;\;\;U \cdot U\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\end{array}
if l < -5.2000000000000002e-9 or 7.00000000000000004e73 < l Initial program 99.7%
associate-*l*99.7%
fma-define99.7%
Simplified99.7%
Applied egg-rr12.5%
if -5.2000000000000002e-9 < l < 7.00000000000000004e73Initial program 76.9%
associate-*l*76.9%
fma-define76.9%
Simplified76.9%
Taylor expanded in J around 0 64.2%
Final simplification39.8%
(FPCore (J l K U) :precision binary64 (* U (+ 1.0 (* 2.0 (* J (/ l U))))))
double code(double J, double l, double K, double U) {
return U * (1.0 + (2.0 * (J * (l / 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 * (1.0d0 + (2.0d0 * (j * (l / u))))
end function
public static double code(double J, double l, double K, double U) {
return U * (1.0 + (2.0 * (J * (l / U))));
}
def code(J, l, K, U): return U * (1.0 + (2.0 * (J * (l / U))))
function code(J, l, K, U) return Float64(U * Float64(1.0 + Float64(2.0 * Float64(J * Float64(l / U))))) end
function tmp = code(J, l, K, U) tmp = U * (1.0 + (2.0 * (J * (l / U)))); end
code[J_, l_, K_, U_] := N[(U * N[(1.0 + N[(2.0 * N[(J * N[(l / U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U \cdot \left(1 + 2 \cdot \left(J \cdot \frac{\ell}{U}\right)\right)
\end{array}
Initial program 87.7%
Taylor expanded in K around 0 75.0%
*-commutative75.0%
Simplified75.0%
Taylor expanded in l around 0 51.0%
Taylor expanded in U around inf 54.2%
associate-/l*57.2%
Simplified57.2%
(FPCore (J l K U) :precision binary64 (+ U (* J (* l 2.0))))
double code(double J, double l, double K, double U) {
return U + (J * (l * 2.0));
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = u + (j * (l * 2.0d0))
end function
public static double code(double J, double l, double K, double U) {
return U + (J * (l * 2.0));
}
def code(J, l, K, U): return U + (J * (l * 2.0))
function code(J, l, K, U) return Float64(U + Float64(J * Float64(l * 2.0))) end
function tmp = code(J, l, K, U) tmp = U + (J * (l * 2.0)); end
code[J_, l_, K_, U_] := N[(U + N[(J * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + J \cdot \left(\ell \cdot 2\right)
\end{array}
Initial program 87.7%
Taylor expanded in K around 0 75.0%
*-commutative75.0%
Simplified75.0%
Taylor expanded in l around 0 51.0%
Final simplification51.0%
(FPCore (J l K U) :precision binary64 (+ U (* l J)))
double code(double J, double l, double K, double U) {
return U + (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 + (l * j)
end function
public static double code(double J, double l, double K, double U) {
return U + (l * J);
}
def code(J, l, K, U): return U + (l * J)
function code(J, l, K, U) return Float64(U + Float64(l * J)) end
function tmp = code(J, l, K, U) tmp = U + (l * J); end
code[J_, l_, K_, U_] := N[(U + N[(l * J), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + \ell \cdot J
\end{array}
Initial program 87.7%
Taylor expanded in K around 0 75.0%
*-commutative75.0%
Simplified75.0%
Taylor expanded in l around 0 59.9%
neg-mul-168.5%
unsub-neg68.5%
Simplified59.9%
Taylor expanded in l around inf 45.3%
Final simplification45.3%
(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 87.7%
associate-*l*87.7%
fma-define87.7%
Simplified87.7%
Taylor expanded in J around 0 34.8%
(FPCore (J l K U) :precision binary64 -3.0)
double code(double J, double l, double K, double U) {
return -3.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 = -3.0d0
end function
public static double code(double J, double l, double K, double U) {
return -3.0;
}
def code(J, l, K, U): return -3.0
function code(J, l, K, U) return -3.0 end
function tmp = code(J, l, K, U) tmp = -3.0; end
code[J_, l_, K_, U_] := -3.0
\begin{array}{l}
\\
-3
\end{array}
Initial program 87.7%
associate-*l*87.7%
fma-define87.7%
Simplified87.7%
Applied egg-rr3.6%
Applied egg-rr2.6%
herbie shell --seed 2024113
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))