
(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 17 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 (* 0.5 K))) (t_1 (- (exp l) (exp (- l)))))
(if (or (<= t_1 -0.2) (not (<= t_1 0.0)))
(* J (* t_1 t_0))
(+ (* J (* t_0 (* l 2.0))) U))))
double code(double J, double l, double K, double U) {
double t_0 = cos((0.5 * K));
double t_1 = exp(l) - exp(-l);
double tmp;
if ((t_1 <= -0.2) || !(t_1 <= 0.0)) {
tmp = J * (t_1 * t_0);
} else {
tmp = (J * (t_0 * (l * 2.0))) + 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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = cos((0.5d0 * k))
t_1 = exp(l) - exp(-l)
if ((t_1 <= (-0.2d0)) .or. (.not. (t_1 <= 0.0d0))) then
tmp = j * (t_1 * t_0)
else
tmp = (j * (t_0 * (l * 2.0d0))) + u
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = Math.cos((0.5 * K));
double t_1 = Math.exp(l) - Math.exp(-l);
double tmp;
if ((t_1 <= -0.2) || !(t_1 <= 0.0)) {
tmp = J * (t_1 * t_0);
} else {
tmp = (J * (t_0 * (l * 2.0))) + U;
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((0.5 * K)) t_1 = math.exp(l) - math.exp(-l) tmp = 0 if (t_1 <= -0.2) or not (t_1 <= 0.0): tmp = J * (t_1 * t_0) else: tmp = (J * (t_0 * (l * 2.0))) + U return tmp
function code(J, l, K, U) t_0 = cos(Float64(0.5 * K)) t_1 = Float64(exp(l) - exp(Float64(-l))) tmp = 0.0 if ((t_1 <= -0.2) || !(t_1 <= 0.0)) tmp = Float64(J * Float64(t_1 * t_0)); else tmp = Float64(Float64(J * Float64(t_0 * Float64(l * 2.0))) + U); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = cos((0.5 * K)); t_1 = exp(l) - exp(-l); tmp = 0.0; if ((t_1 <= -0.2) || ~((t_1 <= 0.0))) tmp = J * (t_1 * t_0); else tmp = (J * (t_0 * (l * 2.0))) + U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -0.2], N[Not[LessEqual[t$95$1, 0.0]], $MachinePrecision]], N[(J * N[(t$95$1 * t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(J * N[(t$95$0 * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(0.5 \cdot K\right)\\
t_1 := e^{\ell} - e^{-\ell}\\
\mathbf{if}\;t\_1 \leq -0.2 \lor \neg \left(t\_1 \leq 0\right):\\
\;\;\;\;J \cdot \left(t\_1 \cdot t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;J \cdot \left(t\_0 \cdot \left(\ell \cdot 2\right)\right) + U\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -0.20000000000000001 or 0.0 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 100.0%
Taylor expanded in J around 0 100.0%
Taylor expanded in J around inf 100.0%
if -0.20000000000000001 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 0.0Initial program 77.0%
Taylor expanded in l around 0 99.9%
*-commutative99.9%
associate-*l*99.9%
*-commutative99.9%
associate-*l*99.9%
Simplified99.9%
Final simplification100.0%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))) (t_1 (exp (- l))))
(if (<= l -4.0)
(+ U (* (* J (- 27.0 t_1)) t_0))
(if (or (<= l 3.8) (not (<= l 8e+102)))
(+ U (* t_0 (* J (* l (+ 2.0 (* 0.3333333333333333 (pow l 2.0)))))))
(+ 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 = U + ((J * (27.0 - t_1)) * t_0);
} else if ((l <= 3.8) || !(l <= 8e+102)) {
tmp = U + (t_0 * (J * (l * (2.0 + (0.3333333333333333 * pow(l, 2.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 = cos((k / 2.0d0))
t_1 = exp(-l)
if (l <= (-4.0d0)) then
tmp = u + ((j * (27.0d0 - t_1)) * t_0)
else if ((l <= 3.8d0) .or. (.not. (l <= 8d+102))) then
tmp = u + (t_0 * (j * (l * (2.0d0 + (0.3333333333333333d0 * (l ** 2.0d0))))))
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 = U + ((J * (27.0 - t_1)) * t_0);
} else if ((l <= 3.8) || !(l <= 8e+102)) {
tmp = U + (t_0 * (J * (l * (2.0 + (0.3333333333333333 * Math.pow(l, 2.0))))));
} 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 = U + ((J * (27.0 - t_1)) * t_0) elif (l <= 3.8) or not (l <= 8e+102): tmp = U + (t_0 * (J * (l * (2.0 + (0.3333333333333333 * math.pow(l, 2.0)))))) 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(U + Float64(Float64(J * Float64(27.0 - t_1)) * t_0)); elseif ((l <= 3.8) || !(l <= 8e+102)) tmp = Float64(U + Float64(t_0 * Float64(J * Float64(l * Float64(2.0 + Float64(0.3333333333333333 * (l ^ 2.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 = cos((K / 2.0)); t_1 = exp(-l); tmp = 0.0; if (l <= -4.0) tmp = U + ((J * (27.0 - t_1)) * t_0); elseif ((l <= 3.8) || ~((l <= 8e+102))) tmp = U + (t_0 * (J * (l * (2.0 + (0.3333333333333333 * (l ^ 2.0)))))); 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[(U + N[(N[(J * N[(27.0 - t$95$1), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[l, 3.8], N[Not[LessEqual[l, 8e+102]], $MachinePrecision]], N[(U + N[(t$95$0 * N[(J * N[(l * N[(2.0 + N[(0.3333333333333333 * N[Power[l, 2.0], $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:\\
\;\;\;\;U + \left(J \cdot \left(27 - t\_1\right)\right) \cdot t\_0\\
\mathbf{elif}\;\ell \leq 3.8 \lor \neg \left(\ell \leq 8 \cdot 10^{+102}\right):\\
\;\;\;\;U + t\_0 \cdot \left(J \cdot \left(\ell \cdot \left(2 + 0.3333333333333333 \cdot {\ell}^{2}\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 < 3.7999999999999998 or 7.99999999999999982e102 < l Initial program 82.6%
Taylor expanded in l around 0 99.1%
if 3.7999999999999998 < l < 7.99999999999999982e102Initial program 100.0%
Taylor expanded in K around 0 75.0%
Final simplification97.1%
(FPCore (J l K U)
:precision binary64
(if (or (<= l -2.5e+145)
(not (or (<= l -0.44) (and (not (<= l 3.8)) (<= l 5.8e+112)))))
(+ U (* l (* J (* (cos (* 0.5 K)) (+ 2.0 (* 0.3333333333333333 (* l l)))))))
(+ U (* (- (exp l) (exp (- l))) J))))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -2.5e+145) || !((l <= -0.44) || (!(l <= 3.8) && (l <= 5.8e+112)))) {
tmp = U + (l * (J * (cos((0.5 * K)) * (2.0 + (0.3333333333333333 * (l * l))))));
} else {
tmp = U + ((exp(l) - exp(-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.5d+145)) .or. (.not. (l <= (-0.44d0)) .or. (.not. (l <= 3.8d0)) .and. (l <= 5.8d+112))) then
tmp = u + (l * (j * (cos((0.5d0 * k)) * (2.0d0 + (0.3333333333333333d0 * (l * l))))))
else
tmp = u + ((exp(l) - exp(-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.5e+145) || !((l <= -0.44) || (!(l <= 3.8) && (l <= 5.8e+112)))) {
tmp = U + (l * (J * (Math.cos((0.5 * K)) * (2.0 + (0.3333333333333333 * (l * l))))));
} else {
tmp = U + ((Math.exp(l) - Math.exp(-l)) * J);
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -2.5e+145) or not ((l <= -0.44) or (not (l <= 3.8) and (l <= 5.8e+112))): tmp = U + (l * (J * (math.cos((0.5 * K)) * (2.0 + (0.3333333333333333 * (l * l)))))) else: tmp = U + ((math.exp(l) - math.exp(-l)) * J) return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -2.5e+145) || !((l <= -0.44) || (!(l <= 3.8) && (l <= 5.8e+112)))) tmp = Float64(U + Float64(l * Float64(J * Float64(cos(Float64(0.5 * K)) * Float64(2.0 + Float64(0.3333333333333333 * Float64(l * l))))))); else tmp = Float64(U + Float64(Float64(exp(l) - exp(Float64(-l))) * J)); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -2.5e+145) || ~(((l <= -0.44) || (~((l <= 3.8)) && (l <= 5.8e+112))))) tmp = U + (l * (J * (cos((0.5 * K)) * (2.0 + (0.3333333333333333 * (l * l)))))); else tmp = U + ((exp(l) - exp(-l)) * J); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -2.5e+145], N[Not[Or[LessEqual[l, -0.44], And[N[Not[LessEqual[l, 3.8]], $MachinePrecision], LessEqual[l, 5.8e+112]]]], $MachinePrecision]], N[(U + N[(l * N[(J * N[(N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision] * N[(2.0 + N[(0.3333333333333333 * N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2.5 \cdot 10^{+145} \lor \neg \left(\ell \leq -0.44 \lor \neg \left(\ell \leq 3.8\right) \land \ell \leq 5.8 \cdot 10^{+112}\right):\\
\;\;\;\;U + \ell \cdot \left(J \cdot \left(\cos \left(0.5 \cdot K\right) \cdot \left(2 + 0.3333333333333333 \cdot \left(\ell \cdot \ell\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + \left(e^{\ell} - e^{-\ell}\right) \cdot J\\
\end{array}
\end{array}
if l < -2.49999999999999983e145 or -0.440000000000000002 < l < 3.7999999999999998 or 5.8000000000000004e112 < l Initial program 85.1%
Taylor expanded in J around 0 85.1%
Taylor expanded in l around 0 98.3%
*-commutative98.3%
associate-*r*98.3%
*-commutative98.3%
associate-*r*98.3%
*-commutative98.3%
associate-*r*98.3%
distribute-rgt-out98.3%
*-commutative98.3%
associate-*l*98.3%
*-commutative98.3%
distribute-lft-in98.3%
*-commutative98.3%
Simplified98.3%
unpow298.3%
Applied egg-rr98.3%
if -2.49999999999999983e145 < l < -0.440000000000000002 or 3.7999999999999998 < l < 5.8000000000000004e112Initial program 100.0%
Taylor expanded in K around 0 77.2%
Final simplification93.6%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (exp (- l))))
(if (<= l -4.0)
(+ U (* (* J (- 27.0 t_0)) (cos (/ K 2.0))))
(if (or (<= l 3.8) (not (<= l 1.5e+113)))
(+
U
(* l (* J (* (cos (* 0.5 K)) (+ 2.0 (* 0.3333333333333333 (* l l)))))))
(+ U (* (- (exp l) t_0) J))))))
double code(double J, double l, double K, double U) {
double t_0 = exp(-l);
double tmp;
if (l <= -4.0) {
tmp = U + ((J * (27.0 - t_0)) * cos((K / 2.0)));
} else if ((l <= 3.8) || !(l <= 1.5e+113)) {
tmp = U + (l * (J * (cos((0.5 * K)) * (2.0 + (0.3333333333333333 * (l * l))))));
} else {
tmp = U + ((exp(l) - t_0) * 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) :: tmp
t_0 = exp(-l)
if (l <= (-4.0d0)) then
tmp = u + ((j * (27.0d0 - t_0)) * cos((k / 2.0d0)))
else if ((l <= 3.8d0) .or. (.not. (l <= 1.5d+113))) then
tmp = u + (l * (j * (cos((0.5d0 * k)) * (2.0d0 + (0.3333333333333333d0 * (l * l))))))
else
tmp = u + ((exp(l) - t_0) * j)
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = Math.exp(-l);
double tmp;
if (l <= -4.0) {
tmp = U + ((J * (27.0 - t_0)) * Math.cos((K / 2.0)));
} else if ((l <= 3.8) || !(l <= 1.5e+113)) {
tmp = U + (l * (J * (Math.cos((0.5 * K)) * (2.0 + (0.3333333333333333 * (l * l))))));
} else {
tmp = U + ((Math.exp(l) - t_0) * J);
}
return tmp;
}
def code(J, l, K, U): t_0 = math.exp(-l) tmp = 0 if l <= -4.0: tmp = U + ((J * (27.0 - t_0)) * math.cos((K / 2.0))) elif (l <= 3.8) or not (l <= 1.5e+113): tmp = U + (l * (J * (math.cos((0.5 * K)) * (2.0 + (0.3333333333333333 * (l * l)))))) else: tmp = U + ((math.exp(l) - t_0) * J) return tmp
function code(J, l, K, U) t_0 = exp(Float64(-l)) tmp = 0.0 if (l <= -4.0) tmp = Float64(U + Float64(Float64(J * Float64(27.0 - t_0)) * cos(Float64(K / 2.0)))); elseif ((l <= 3.8) || !(l <= 1.5e+113)) tmp = Float64(U + Float64(l * Float64(J * Float64(cos(Float64(0.5 * K)) * Float64(2.0 + Float64(0.3333333333333333 * Float64(l * l))))))); else tmp = Float64(U + Float64(Float64(exp(l) - t_0) * J)); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = exp(-l); tmp = 0.0; if (l <= -4.0) tmp = U + ((J * (27.0 - t_0)) * cos((K / 2.0))); elseif ((l <= 3.8) || ~((l <= 1.5e+113))) tmp = U + (l * (J * (cos((0.5 * K)) * (2.0 + (0.3333333333333333 * (l * l)))))); else tmp = U + ((exp(l) - t_0) * J); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Exp[(-l)], $MachinePrecision]}, If[LessEqual[l, -4.0], N[(U + N[(N[(J * N[(27.0 - t$95$0), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[l, 3.8], N[Not[LessEqual[l, 1.5e+113]], $MachinePrecision]], N[(U + N[(l * N[(J * N[(N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision] * 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$0), $MachinePrecision] * J), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-\ell}\\
\mathbf{if}\;\ell \leq -4:\\
\;\;\;\;U + \left(J \cdot \left(27 - t\_0\right)\right) \cdot \cos \left(\frac{K}{2}\right)\\
\mathbf{elif}\;\ell \leq 3.8 \lor \neg \left(\ell \leq 1.5 \cdot 10^{+113}\right):\\
\;\;\;\;U + \ell \cdot \left(J \cdot \left(\cos \left(0.5 \cdot K\right) \cdot \left(2 + 0.3333333333333333 \cdot \left(\ell \cdot \ell\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + \left(e^{\ell} - t\_0\right) \cdot J\\
\end{array}
\end{array}
if l < -4Initial program 100.0%
Applied egg-rr100.0%
if -4 < l < 3.7999999999999998 or 1.5e113 < l Initial program 82.2%
Taylor expanded in J around 0 82.2%
Taylor expanded in l around 0 98.6%
*-commutative98.6%
associate-*r*98.6%
*-commutative98.6%
associate-*r*98.6%
*-commutative98.6%
associate-*r*98.6%
distribute-rgt-out98.6%
*-commutative98.6%
associate-*l*98.6%
*-commutative98.6%
distribute-lft-in98.6%
*-commutative98.6%
Simplified98.6%
unpow298.6%
Applied egg-rr98.6%
if 3.7999999999999998 < l < 1.5e113Initial program 100.0%
Taylor expanded in K around 0 75.0%
Final simplification96.3%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) 0.38) (+ (* J (* (cos (* 0.5 K)) (* l 2.0))) U) (+ U (* J (* l (+ 2.0 (* 0.3333333333333333 (pow l 2.0))))))))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= 0.38) {
tmp = (J * (cos((0.5 * K)) * (l * 2.0))) + U;
} else {
tmp = U + (J * (l * (2.0 + (0.3333333333333333 * pow(l, 2.0)))));
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if (cos((k / 2.0d0)) <= 0.38d0) then
tmp = (j * (cos((0.5d0 * k)) * (l * 2.0d0))) + u
else
tmp = u + (j * (l * (2.0d0 + (0.3333333333333333d0 * (l ** 2.0d0)))))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (Math.cos((K / 2.0)) <= 0.38) {
tmp = (J * (Math.cos((0.5 * K)) * (l * 2.0))) + U;
} else {
tmp = U + (J * (l * (2.0 + (0.3333333333333333 * Math.pow(l, 2.0)))));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if math.cos((K / 2.0)) <= 0.38: tmp = (J * (math.cos((0.5 * K)) * (l * 2.0))) + U else: tmp = U + (J * (l * (2.0 + (0.3333333333333333 * math.pow(l, 2.0))))) return tmp
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= 0.38) tmp = Float64(Float64(J * Float64(cos(Float64(0.5 * K)) * Float64(l * 2.0))) + U); else tmp = Float64(U + Float64(J * Float64(l * Float64(2.0 + Float64(0.3333333333333333 * (l ^ 2.0)))))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (cos((K / 2.0)) <= 0.38) tmp = (J * (cos((0.5 * K)) * (l * 2.0))) + U; else tmp = U + (J * (l * (2.0 + (0.3333333333333333 * (l ^ 2.0))))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], 0.38], N[(N[(J * N[(N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision] * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], N[(U + N[(J * N[(l * N[(2.0 + N[(0.3333333333333333 * N[Power[l, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq 0.38:\\
\;\;\;\;J \cdot \left(\cos \left(0.5 \cdot K\right) \cdot \left(\ell \cdot 2\right)\right) + U\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(\ell \cdot \left(2 + 0.3333333333333333 \cdot {\ell}^{2}\right)\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < 0.38Initial program 84.1%
Taylor expanded in l around 0 71.5%
*-commutative71.5%
associate-*l*71.5%
*-commutative71.5%
associate-*l*71.5%
Simplified71.5%
if 0.38 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 90.5%
Taylor expanded in J around 0 90.5%
Taylor expanded in l around 0 83.0%
*-commutative83.0%
associate-*r*83.0%
*-commutative83.0%
associate-*r*83.0%
*-commutative83.0%
associate-*r*83.0%
distribute-rgt-out83.0%
*-commutative83.0%
associate-*l*83.0%
*-commutative83.0%
distribute-lft-in83.0%
*-commutative83.0%
Simplified83.0%
Taylor expanded in K around 0 83.9%
Final simplification79.9%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) 0.38) (+ (* J (* (cos (* 0.5 K)) (* l 2.0))) U) (+ U (* l (* J (+ 2.0 (* 0.3333333333333333 (* l l))))))))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= 0.38) {
tmp = (J * (cos((0.5 * K)) * (l * 2.0))) + U;
} else {
tmp = U + (l * (J * (2.0 + (0.3333333333333333 * (l * l)))));
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if (cos((k / 2.0d0)) <= 0.38d0) then
tmp = (j * (cos((0.5d0 * k)) * (l * 2.0d0))) + u
else
tmp = u + (l * (j * (2.0d0 + (0.3333333333333333d0 * (l * l)))))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (Math.cos((K / 2.0)) <= 0.38) {
tmp = (J * (Math.cos((0.5 * K)) * (l * 2.0))) + U;
} else {
tmp = U + (l * (J * (2.0 + (0.3333333333333333 * (l * l)))));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if math.cos((K / 2.0)) <= 0.38: tmp = (J * (math.cos((0.5 * K)) * (l * 2.0))) + U else: tmp = U + (l * (J * (2.0 + (0.3333333333333333 * (l * l))))) return tmp
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= 0.38) tmp = Float64(Float64(J * Float64(cos(Float64(0.5 * K)) * Float64(l * 2.0))) + U); else tmp = Float64(U + Float64(l * Float64(J * Float64(2.0 + Float64(0.3333333333333333 * Float64(l * l)))))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (cos((K / 2.0)) <= 0.38) tmp = (J * (cos((0.5 * K)) * (l * 2.0))) + U; else tmp = U + (l * (J * (2.0 + (0.3333333333333333 * (l * l))))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], 0.38], N[(N[(J * N[(N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision] * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], N[(U + N[(l * N[(J * N[(2.0 + N[(0.3333333333333333 * N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq 0.38:\\
\;\;\;\;J \cdot \left(\cos \left(0.5 \cdot K\right) \cdot \left(\ell \cdot 2\right)\right) + U\\
\mathbf{else}:\\
\;\;\;\;U + \ell \cdot \left(J \cdot \left(2 + 0.3333333333333333 \cdot \left(\ell \cdot \ell\right)\right)\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < 0.38Initial program 84.1%
Taylor expanded in l around 0 71.5%
*-commutative71.5%
associate-*l*71.5%
*-commutative71.5%
associate-*l*71.5%
Simplified71.5%
if 0.38 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 90.5%
Taylor expanded in J around 0 90.5%
Taylor expanded in l around 0 83.0%
*-commutative83.0%
associate-*r*83.0%
*-commutative83.0%
associate-*r*83.0%
*-commutative83.0%
associate-*r*83.0%
distribute-rgt-out83.0%
*-commutative83.0%
associate-*l*83.0%
*-commutative83.0%
distribute-lft-in83.0%
*-commutative83.0%
Simplified83.0%
unpow283.0%
Applied egg-rr83.0%
Taylor expanded in K around 0 81.1%
Final simplification78.0%
(FPCore (J l K U) :precision binary64 (if (or (<= l -5.5e+118) (not (<= l -600.0))) (+ U (* l (* J (* (cos (* 0.5 K)) (+ 2.0 (* 0.3333333333333333 (* l l))))))) (log1p (expm1 (+ U -262144.0)))))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -5.5e+118) || !(l <= -600.0)) {
tmp = U + (l * (J * (cos((0.5 * K)) * (2.0 + (0.3333333333333333 * (l * l))))));
} else {
tmp = log1p(expm1((U + -262144.0)));
}
return tmp;
}
public static double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -5.5e+118) || !(l <= -600.0)) {
tmp = U + (l * (J * (Math.cos((0.5 * K)) * (2.0 + (0.3333333333333333 * (l * l))))));
} else {
tmp = Math.log1p(Math.expm1((U + -262144.0)));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -5.5e+118) or not (l <= -600.0): tmp = U + (l * (J * (math.cos((0.5 * K)) * (2.0 + (0.3333333333333333 * (l * l)))))) else: tmp = math.log1p(math.expm1((U + -262144.0))) return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -5.5e+118) || !(l <= -600.0)) tmp = Float64(U + Float64(l * Float64(J * Float64(cos(Float64(0.5 * K)) * Float64(2.0 + Float64(0.3333333333333333 * Float64(l * l))))))); else tmp = log1p(expm1(Float64(U + -262144.0))); end return tmp end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -5.5e+118], N[Not[LessEqual[l, -600.0]], $MachinePrecision]], N[(U + N[(l * N[(J * N[(N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision] * N[(2.0 + N[(0.3333333333333333 * N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Log[1 + N[(Exp[N[(U + -262144.0), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -5.5 \cdot 10^{+118} \lor \neg \left(\ell \leq -600\right):\\
\;\;\;\;U + \ell \cdot \left(J \cdot \left(\cos \left(0.5 \cdot K\right) \cdot \left(2 + 0.3333333333333333 \cdot \left(\ell \cdot \ell\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(U + -262144\right)\right)\\
\end{array}
\end{array}
if l < -5.5000000000000003e118 or -600 < l Initial program 87.3%
Taylor expanded in J around 0 87.3%
Taylor expanded in l around 0 88.8%
*-commutative88.8%
associate-*r*88.8%
*-commutative88.8%
associate-*r*88.8%
*-commutative88.8%
associate-*r*88.8%
distribute-rgt-out88.8%
*-commutative88.8%
associate-*l*88.8%
*-commutative88.8%
distribute-lft-in88.8%
*-commutative88.8%
Simplified88.8%
unpow288.8%
Applied egg-rr88.8%
if -5.5000000000000003e118 < l < -600Initial program 100.0%
associate-*l*100.0%
fma-define100.0%
Simplified100.0%
Applied egg-rr4.0%
+-commutative4.0%
Simplified4.0%
Applied egg-rr72.7%
Final simplification87.4%
(FPCore (J l K U) :precision binary64 (+ U (* l (* J (* (cos (* 0.5 K)) (+ 2.0 (* 0.3333333333333333 (* l l))))))))
double code(double J, double l, double K, double U) {
return U + (l * (J * (cos((0.5 * K)) * (2.0 + (0.3333333333333333 * (l * l))))));
}
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 * (cos((0.5d0 * k)) * (2.0d0 + (0.3333333333333333d0 * (l * l))))))
end function
public static double code(double J, double l, double K, double U) {
return U + (l * (J * (Math.cos((0.5 * K)) * (2.0 + (0.3333333333333333 * (l * l))))));
}
def code(J, l, K, U): return U + (l * (J * (math.cos((0.5 * K)) * (2.0 + (0.3333333333333333 * (l * l))))))
function code(J, l, K, U) return Float64(U + Float64(l * Float64(J * Float64(cos(Float64(0.5 * K)) * Float64(2.0 + Float64(0.3333333333333333 * Float64(l * l))))))) end
function tmp = code(J, l, K, U) tmp = U + (l * (J * (cos((0.5 * K)) * (2.0 + (0.3333333333333333 * (l * l)))))); end
code[J_, l_, K_, U_] := N[(U + N[(l * N[(J * N[(N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision] * N[(2.0 + N[(0.3333333333333333 * N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + \ell \cdot \left(J \cdot \left(\cos \left(0.5 \cdot K\right) \cdot \left(2 + 0.3333333333333333 \cdot \left(\ell \cdot \ell\right)\right)\right)\right)
\end{array}
Initial program 88.4%
Taylor expanded in J around 0 88.4%
Taylor expanded in l around 0 83.0%
*-commutative83.0%
associate-*r*83.0%
*-commutative83.0%
associate-*r*83.0%
*-commutative83.0%
associate-*r*83.0%
distribute-rgt-out83.0%
*-commutative83.0%
associate-*l*83.0%
*-commutative83.0%
distribute-lft-in83.0%
*-commutative83.0%
Simplified83.0%
unpow283.0%
Applied egg-rr83.0%
Final simplification83.0%
(FPCore (J l K U)
:precision binary64
(if (<= l -650.0)
(-
(*
U
(+
0.4444444444444444
(* U (- (* U 0.7901234567901234) 0.5925925925925926))))
0.3333333333333333)
(+ U (* J (* l 2.0)))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -650.0) {
tmp = (U * (0.4444444444444444 + (U * ((U * 0.7901234567901234) - 0.5925925925925926)))) - 0.3333333333333333;
} else {
tmp = U + (J * (l * 2.0));
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if (l <= (-650.0d0)) then
tmp = (u * (0.4444444444444444d0 + (u * ((u * 0.7901234567901234d0) - 0.5925925925925926d0)))) - 0.3333333333333333d0
else
tmp = u + (j * (l * 2.0d0))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (l <= -650.0) {
tmp = (U * (0.4444444444444444 + (U * ((U * 0.7901234567901234) - 0.5925925925925926)))) - 0.3333333333333333;
} else {
tmp = U + (J * (l * 2.0));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -650.0: tmp = (U * (0.4444444444444444 + (U * ((U * 0.7901234567901234) - 0.5925925925925926)))) - 0.3333333333333333 else: tmp = U + (J * (l * 2.0)) return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -650.0) tmp = Float64(Float64(U * Float64(0.4444444444444444 + Float64(U * Float64(Float64(U * 0.7901234567901234) - 0.5925925925925926)))) - 0.3333333333333333); else tmp = Float64(U + Float64(J * Float64(l * 2.0))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -650.0) tmp = (U * (0.4444444444444444 + (U * ((U * 0.7901234567901234) - 0.5925925925925926)))) - 0.3333333333333333; else tmp = U + (J * (l * 2.0)); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -650.0], N[(N[(U * N[(0.4444444444444444 + N[(U * N[(N[(U * 0.7901234567901234), $MachinePrecision] - 0.5925925925925926), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 0.3333333333333333), $MachinePrecision], N[(U + N[(J * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -650:\\
\;\;\;\;U \cdot \left(0.4444444444444444 + U \cdot \left(U \cdot 0.7901234567901234 - 0.5925925925925926\right)\right) - 0.3333333333333333\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(\ell \cdot 2\right)\\
\end{array}
\end{array}
if l < -650Initial program 100.0%
associate-*l*100.0%
fma-define100.0%
Simplified100.0%
Applied egg-rr1.8%
associate-+r+1.8%
distribute-rgt1-in1.9%
metadata-eval1.9%
*-commutative1.9%
distribute-lft-out1.9%
associate-/r*1.9%
*-inverses1.9%
*-commutative1.9%
Simplified1.9%
Taylor expanded in U around 0 25.9%
if -650 < l Initial program 84.8%
Taylor expanded in l around 0 73.5%
*-commutative73.5%
associate-*l*73.5%
*-commutative73.5%
associate-*l*73.5%
Simplified73.5%
Taylor expanded in K around 0 63.6%
*-commutative63.6%
associate-*l*63.6%
Simplified63.6%
Final simplification54.6%
(FPCore (J l K U) :precision binary64 (if (or (<= l -6.2e+33) (not (<= l 5.2e+17))) (* U U) U))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -6.2e+33) || !(l <= 5.2e+17)) {
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 <= (-6.2d+33)) .or. (.not. (l <= 5.2d+17))) 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 <= -6.2e+33) || !(l <= 5.2e+17)) {
tmp = U * U;
} else {
tmp = U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -6.2e+33) or not (l <= 5.2e+17): tmp = U * U else: tmp = U return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -6.2e+33) || !(l <= 5.2e+17)) tmp = Float64(U * U); else tmp = U; end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -6.2e+33) || ~((l <= 5.2e+17))) tmp = U * U; else tmp = U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -6.2e+33], N[Not[LessEqual[l, 5.2e+17]], $MachinePrecision]], N[(U * U), $MachinePrecision], U]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -6.2 \cdot 10^{+33} \lor \neg \left(\ell \leq 5.2 \cdot 10^{+17}\right):\\
\;\;\;\;U \cdot U\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\end{array}
if l < -6.2e33 or 5.2e17 < l Initial program 100.0%
associate-*l*100.0%
fma-define100.0%
Simplified100.0%
Applied egg-rr16.7%
if -6.2e33 < l < 5.2e17Initial program 78.5%
associate-*l*78.5%
fma-define78.5%
Simplified78.5%
Taylor expanded in J around 0 72.3%
Final simplification46.6%
(FPCore (J l K U) :precision binary64 (if (<= l -820.0) (- -4.0 (* U U)) (if (<= l 5.2e+17) U (* U U))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -820.0) {
tmp = -4.0 - (U * U);
} else if (l <= 5.2e+17) {
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 <= (-820.0d0)) then
tmp = (-4.0d0) - (u * u)
else if (l <= 5.2d+17) 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 <= -820.0) {
tmp = -4.0 - (U * U);
} else if (l <= 5.2e+17) {
tmp = U;
} else {
tmp = U * U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -820.0: tmp = -4.0 - (U * U) elif l <= 5.2e+17: tmp = U else: tmp = U * U return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -820.0) tmp = Float64(-4.0 - Float64(U * U)); elseif (l <= 5.2e+17) tmp = U; else tmp = Float64(U * U); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -820.0) tmp = -4.0 - (U * U); elseif (l <= 5.2e+17) tmp = U; else tmp = U * U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -820.0], N[(-4.0 - N[(U * U), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 5.2e+17], U, N[(U * U), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -820:\\
\;\;\;\;-4 - U \cdot U\\
\mathbf{elif}\;\ell \leq 5.2 \cdot 10^{+17}:\\
\;\;\;\;U\\
\mathbf{else}:\\
\;\;\;\;U \cdot U\\
\end{array}
\end{array}
if l < -820Initial program 100.0%
associate-*l*100.0%
fma-define100.0%
Simplified100.0%
Applied egg-rr23.2%
cancel-sign-sub-inv23.2%
Simplified23.2%
if -820 < l < 5.2e17Initial program 77.7%
associate-*l*77.7%
fma-define77.7%
Simplified77.7%
Taylor expanded in J around 0 74.8%
if 5.2e17 < l Initial program 100.0%
associate-*l*100.0%
fma-define100.0%
Simplified100.0%
Applied egg-rr19.3%
(FPCore (J l K U) :precision binary64 (+ U (* l (* J (+ 2.0 (* 0.3333333333333333 (* l l)))))))
double code(double J, double l, double K, double U) {
return U + (l * (J * (2.0 + (0.3333333333333333 * (l * l)))));
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = u + (l * (j * (2.0d0 + (0.3333333333333333d0 * (l * l)))))
end function
public static double code(double J, double l, double K, double U) {
return U + (l * (J * (2.0 + (0.3333333333333333 * (l * l)))));
}
def code(J, l, K, U): return U + (l * (J * (2.0 + (0.3333333333333333 * (l * l)))))
function code(J, l, K, U) return Float64(U + Float64(l * Float64(J * Float64(2.0 + Float64(0.3333333333333333 * Float64(l * l)))))) end
function tmp = code(J, l, K, U) tmp = U + (l * (J * (2.0 + (0.3333333333333333 * (l * l))))); end
code[J_, l_, K_, U_] := N[(U + N[(l * N[(J * N[(2.0 + N[(0.3333333333333333 * N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + \ell \cdot \left(J \cdot \left(2 + 0.3333333333333333 \cdot \left(\ell \cdot \ell\right)\right)\right)
\end{array}
Initial program 88.4%
Taylor expanded in J around 0 88.4%
Taylor expanded in l around 0 83.0%
*-commutative83.0%
associate-*r*83.0%
*-commutative83.0%
associate-*r*83.0%
*-commutative83.0%
associate-*r*83.0%
distribute-rgt-out83.0%
*-commutative83.0%
associate-*l*83.0%
*-commutative83.0%
distribute-lft-in83.0%
*-commutative83.0%
Simplified83.0%
unpow283.0%
Applied egg-rr83.0%
Taylor expanded in K around 0 69.1%
Final simplification69.1%
(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 88.4%
Taylor expanded in l around 0 62.9%
*-commutative62.9%
associate-*l*62.9%
*-commutative62.9%
associate-*l*62.9%
Simplified62.9%
Taylor expanded in K around 0 52.9%
*-commutative52.9%
associate-*l*52.9%
Simplified52.9%
Final simplification52.9%
(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 88.4%
associate-*l*88.4%
fma-define88.4%
Simplified88.4%
Taylor expanded in J around 0 40.0%
(FPCore (J l K U) :precision binary64 -0.3333333333333333)
double code(double J, double l, double K, double U) {
return -0.3333333333333333;
}
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.3333333333333333d0
end function
public static double code(double J, double l, double K, double U) {
return -0.3333333333333333;
}
def code(J, l, K, U): return -0.3333333333333333
function code(J, l, K, U) return -0.3333333333333333 end
function tmp = code(J, l, K, U) tmp = -0.3333333333333333; end
code[J_, l_, K_, U_] := -0.3333333333333333
\begin{array}{l}
\\
-0.3333333333333333
\end{array}
Initial program 88.4%
associate-*l*88.4%
fma-define88.4%
Simplified88.4%
Applied egg-rr2.5%
associate-+r+2.5%
distribute-rgt1-in2.5%
metadata-eval2.5%
*-commutative2.5%
distribute-lft-out2.5%
associate-/r*2.5%
*-inverses2.5%
*-commutative2.5%
Simplified2.5%
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 88.4%
associate-*l*88.4%
fma-define88.4%
Simplified88.4%
Applied egg-rr27.0%
+-commutative27.0%
Simplified27.0%
Taylor expanded in U around 0 3.0%
(FPCore (J l K U) :precision binary64 -19683.0)
double code(double J, double l, double K, double U) {
return -19683.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 = -19683.0d0
end function
public static double code(double J, double l, double K, double U) {
return -19683.0;
}
def code(J, l, K, U): return -19683.0
function code(J, l, K, U) return -19683.0 end
function tmp = code(J, l, K, U) tmp = -19683.0; end
code[J_, l_, K_, U_] := -19683.0
\begin{array}{l}
\\
-19683
\end{array}
Initial program 88.4%
associate-*l*88.4%
fma-define88.4%
Simplified88.4%
Applied egg-rr2.5%
associate-+r+2.5%
distribute-rgt1-in2.5%
metadata-eval2.5%
*-commutative2.5%
distribute-lft-out2.5%
associate-/r*2.5%
*-inverses2.5%
*-commutative2.5%
Simplified2.5%
Applied egg-rr2.9%
Taylor expanded in U around 0 2.9%
herbie shell --seed 2024143
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))