
(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 15 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (J l K U) :precision binary64 (+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))
double code(double J, double l, double K, double U) {
return ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = ((j * (exp(l) - exp(-l))) * cos((k / 2.0d0))) + u
end function
public static double code(double J, double l, double K, double U) {
return ((J * (Math.exp(l) - Math.exp(-l))) * Math.cos((K / 2.0))) + U;
}
def code(J, l, K, U): return ((J * (math.exp(l) - math.exp(-l))) * math.cos((K / 2.0))) + U
function code(J, l, K, U) return Float64(Float64(Float64(J * Float64(exp(l) - exp(Float64(-l)))) * cos(Float64(K / 2.0))) + U) end
function tmp = code(J, l, K, U) tmp = ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U; end
code[J_, l_, K_, U_] := N[(N[(N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]
\begin{array}{l}
\\
\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U
\end{array}
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))) (t_1 (- (exp l) (exp (- l)))))
(if (or (<= t_1 (- INFINITY)) (not (<= t_1 0.0002)))
(+ (* (* t_1 J) t_0) U)
(+ U (* t_0 (* J (* l (+ 2.0 (* 0.3333333333333333 (pow l 2.0))))))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double t_1 = exp(l) - exp(-l);
double tmp;
if ((t_1 <= -((double) INFINITY)) || !(t_1 <= 0.0002)) {
tmp = ((t_1 * J) * t_0) + U;
} else {
tmp = U + (t_0 * (J * (l * (2.0 + (0.3333333333333333 * pow(l, 2.0))))));
}
return tmp;
}
public static double code(double J, double l, double K, double U) {
double t_0 = Math.cos((K / 2.0));
double t_1 = Math.exp(l) - Math.exp(-l);
double tmp;
if ((t_1 <= -Double.POSITIVE_INFINITY) || !(t_1 <= 0.0002)) {
tmp = ((t_1 * J) * t_0) + U;
} else {
tmp = U + (t_0 * (J * (l * (2.0 + (0.3333333333333333 * Math.pow(l, 2.0))))));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K / 2.0)) t_1 = math.exp(l) - math.exp(-l) tmp = 0 if (t_1 <= -math.inf) or not (t_1 <= 0.0002): tmp = ((t_1 * J) * t_0) + U else: tmp = U + (t_0 * (J * (l * (2.0 + (0.3333333333333333 * math.pow(l, 2.0)))))) return tmp
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) t_1 = Float64(exp(l) - exp(Float64(-l))) tmp = 0.0 if ((t_1 <= Float64(-Inf)) || !(t_1 <= 0.0002)) tmp = Float64(Float64(Float64(t_1 * J) * t_0) + U); else tmp = Float64(U + Float64(t_0 * 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) t_0 = cos((K / 2.0)); t_1 = exp(l) - exp(-l); tmp = 0.0; if ((t_1 <= -Inf) || ~((t_1 <= 0.0002))) tmp = ((t_1 * J) * t_0) + U; else tmp = U + (t_0 * (J * (l * (2.0 + (0.3333333333333333 * (l ^ 2.0)))))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, (-Infinity)], N[Not[LessEqual[t$95$1, 0.0002]], $MachinePrecision]], N[(N[(N[(t$95$1 * J), $MachinePrecision] * t$95$0), $MachinePrecision] + U), $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]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
t_1 := e^{\ell} - e^{-\ell}\\
\mathbf{if}\;t\_1 \leq -\infty \lor \neg \left(t\_1 \leq 0.0002\right):\\
\;\;\;\;\left(t\_1 \cdot J\right) \cdot t\_0 + U\\
\mathbf{else}:\\
\;\;\;\;U + t\_0 \cdot \left(J \cdot \left(\ell \cdot \left(2 + 0.3333333333333333 \cdot {\ell}^{2}\right)\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -inf.0 or 2.0000000000000001e-4 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 100.0%
if -inf.0 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 2.0000000000000001e-4Initial program 66.7%
Taylor expanded in l around 0 99.9%
Final simplification100.0%
(FPCore (J l K U)
:precision binary64
(let* ((t_0
(+ U (* (* J 0.3333333333333333) (* (pow l 3.0) (cos (* K 0.5))))))
(t_1 (* (- (exp l) (exp (- l))) J)))
(if (<= l -1.22e+138)
t_0
(if (<= l -220.0)
t_1
(if (<= l 0.0195)
(+
U
(*
(cos (/ K 2.0))
(* J (* l (+ 2.0 (* 0.3333333333333333 (pow l 2.0)))))))
(if (<= l 5.6e+102) (+ t_1 U) t_0))))))
double code(double J, double l, double K, double U) {
double t_0 = U + ((J * 0.3333333333333333) * (pow(l, 3.0) * cos((K * 0.5))));
double t_1 = (exp(l) - exp(-l)) * J;
double tmp;
if (l <= -1.22e+138) {
tmp = t_0;
} else if (l <= -220.0) {
tmp = t_1;
} else if (l <= 0.0195) {
tmp = U + (cos((K / 2.0)) * (J * (l * (2.0 + (0.3333333333333333 * pow(l, 2.0))))));
} else if (l <= 5.6e+102) {
tmp = t_1 + U;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = u + ((j * 0.3333333333333333d0) * ((l ** 3.0d0) * cos((k * 0.5d0))))
t_1 = (exp(l) - exp(-l)) * j
if (l <= (-1.22d+138)) then
tmp = t_0
else if (l <= (-220.0d0)) then
tmp = t_1
else if (l <= 0.0195d0) then
tmp = u + (cos((k / 2.0d0)) * (j * (l * (2.0d0 + (0.3333333333333333d0 * (l ** 2.0d0))))))
else if (l <= 5.6d+102) then
tmp = t_1 + u
else
tmp = t_0
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = U + ((J * 0.3333333333333333) * (Math.pow(l, 3.0) * Math.cos((K * 0.5))));
double t_1 = (Math.exp(l) - Math.exp(-l)) * J;
double tmp;
if (l <= -1.22e+138) {
tmp = t_0;
} else if (l <= -220.0) {
tmp = t_1;
} else if (l <= 0.0195) {
tmp = U + (Math.cos((K / 2.0)) * (J * (l * (2.0 + (0.3333333333333333 * Math.pow(l, 2.0))))));
} else if (l <= 5.6e+102) {
tmp = t_1 + U;
} else {
tmp = t_0;
}
return tmp;
}
def code(J, l, K, U): t_0 = U + ((J * 0.3333333333333333) * (math.pow(l, 3.0) * math.cos((K * 0.5)))) t_1 = (math.exp(l) - math.exp(-l)) * J tmp = 0 if l <= -1.22e+138: tmp = t_0 elif l <= -220.0: tmp = t_1 elif l <= 0.0195: tmp = U + (math.cos((K / 2.0)) * (J * (l * (2.0 + (0.3333333333333333 * math.pow(l, 2.0)))))) elif l <= 5.6e+102: tmp = t_1 + U else: tmp = t_0 return tmp
function code(J, l, K, U) t_0 = Float64(U + Float64(Float64(J * 0.3333333333333333) * Float64((l ^ 3.0) * cos(Float64(K * 0.5))))) t_1 = Float64(Float64(exp(l) - exp(Float64(-l))) * J) tmp = 0.0 if (l <= -1.22e+138) tmp = t_0; elseif (l <= -220.0) tmp = t_1; elseif (l <= 0.0195) tmp = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(J * Float64(l * Float64(2.0 + Float64(0.3333333333333333 * (l ^ 2.0))))))); elseif (l <= 5.6e+102) tmp = Float64(t_1 + U); else tmp = t_0; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = U + ((J * 0.3333333333333333) * ((l ^ 3.0) * cos((K * 0.5)))); t_1 = (exp(l) - exp(-l)) * J; tmp = 0.0; if (l <= -1.22e+138) tmp = t_0; elseif (l <= -220.0) tmp = t_1; elseif (l <= 0.0195) tmp = U + (cos((K / 2.0)) * (J * (l * (2.0 + (0.3333333333333333 * (l ^ 2.0)))))); elseif (l <= 5.6e+102) tmp = t_1 + U; else tmp = t_0; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(U + N[(N[(J * 0.3333333333333333), $MachinePrecision] * N[(N[Power[l, 3.0], $MachinePrecision] * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision]}, If[LessEqual[l, -1.22e+138], t$95$0, If[LessEqual[l, -220.0], t$95$1, If[LessEqual[l, 0.0195], N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(J * N[(l * N[(2.0 + N[(0.3333333333333333 * N[Power[l, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 5.6e+102], N[(t$95$1 + U), $MachinePrecision], t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + \left(J \cdot 0.3333333333333333\right) \cdot \left({\ell}^{3} \cdot \cos \left(K \cdot 0.5\right)\right)\\
t_1 := \left(e^{\ell} - e^{-\ell}\right) \cdot J\\
\mathbf{if}\;\ell \leq -1.22 \cdot 10^{+138}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq -220:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\ell \leq 0.0195:\\
\;\;\;\;U + \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(\ell \cdot \left(2 + 0.3333333333333333 \cdot {\ell}^{2}\right)\right)\right)\\
\mathbf{elif}\;\ell \leq 5.6 \cdot 10^{+102}:\\
\;\;\;\;t\_1 + U\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if l < -1.22000000000000001e138 or 5.60000000000000037e102 < l Initial program 100.0%
Taylor expanded in l around 0 100.0%
Taylor expanded in l around inf 100.0%
associate-*r*100.0%
*-commutative100.0%
Simplified100.0%
if -1.22000000000000001e138 < l < -220Initial program 100.0%
Taylor expanded in K around 0 90.3%
Taylor expanded in J around inf 90.3%
if -220 < l < 0.0195Initial program 66.7%
Taylor expanded in l around 0 99.9%
if 0.0195 < l < 5.60000000000000037e102Initial program 100.0%
Taylor expanded in K around 0 80.0%
Final simplification96.4%
(FPCore (J l K U)
:precision binary64
(let* ((t_0
(+ U (* (* J 0.3333333333333333) (* (pow l 3.0) (cos (* K 0.5))))))
(t_1 (* (- (exp l) (exp (- l))) J)))
(if (<= l -1.22e+138)
t_0
(if (<= l -160.0)
t_1
(if (<= l 0.00065)
(+ U (* (cos (/ K 2.0)) (* l (* J 2.0))))
(if (<= l 5.6e+102) (+ t_1 U) t_0))))))
double code(double J, double l, double K, double U) {
double t_0 = U + ((J * 0.3333333333333333) * (pow(l, 3.0) * cos((K * 0.5))));
double t_1 = (exp(l) - exp(-l)) * J;
double tmp;
if (l <= -1.22e+138) {
tmp = t_0;
} else if (l <= -160.0) {
tmp = t_1;
} else if (l <= 0.00065) {
tmp = U + (cos((K / 2.0)) * (l * (J * 2.0)));
} else if (l <= 5.6e+102) {
tmp = t_1 + U;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = u + ((j * 0.3333333333333333d0) * ((l ** 3.0d0) * cos((k * 0.5d0))))
t_1 = (exp(l) - exp(-l)) * j
if (l <= (-1.22d+138)) then
tmp = t_0
else if (l <= (-160.0d0)) then
tmp = t_1
else if (l <= 0.00065d0) then
tmp = u + (cos((k / 2.0d0)) * (l * (j * 2.0d0)))
else if (l <= 5.6d+102) then
tmp = t_1 + u
else
tmp = t_0
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = U + ((J * 0.3333333333333333) * (Math.pow(l, 3.0) * Math.cos((K * 0.5))));
double t_1 = (Math.exp(l) - Math.exp(-l)) * J;
double tmp;
if (l <= -1.22e+138) {
tmp = t_0;
} else if (l <= -160.0) {
tmp = t_1;
} else if (l <= 0.00065) {
tmp = U + (Math.cos((K / 2.0)) * (l * (J * 2.0)));
} else if (l <= 5.6e+102) {
tmp = t_1 + U;
} else {
tmp = t_0;
}
return tmp;
}
def code(J, l, K, U): t_0 = U + ((J * 0.3333333333333333) * (math.pow(l, 3.0) * math.cos((K * 0.5)))) t_1 = (math.exp(l) - math.exp(-l)) * J tmp = 0 if l <= -1.22e+138: tmp = t_0 elif l <= -160.0: tmp = t_1 elif l <= 0.00065: tmp = U + (math.cos((K / 2.0)) * (l * (J * 2.0))) elif l <= 5.6e+102: tmp = t_1 + U else: tmp = t_0 return tmp
function code(J, l, K, U) t_0 = Float64(U + Float64(Float64(J * 0.3333333333333333) * Float64((l ^ 3.0) * cos(Float64(K * 0.5))))) t_1 = Float64(Float64(exp(l) - exp(Float64(-l))) * J) tmp = 0.0 if (l <= -1.22e+138) tmp = t_0; elseif (l <= -160.0) tmp = t_1; elseif (l <= 0.00065) tmp = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(l * Float64(J * 2.0)))); elseif (l <= 5.6e+102) tmp = Float64(t_1 + U); else tmp = t_0; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = U + ((J * 0.3333333333333333) * ((l ^ 3.0) * cos((K * 0.5)))); t_1 = (exp(l) - exp(-l)) * J; tmp = 0.0; if (l <= -1.22e+138) tmp = t_0; elseif (l <= -160.0) tmp = t_1; elseif (l <= 0.00065) tmp = U + (cos((K / 2.0)) * (l * (J * 2.0))); elseif (l <= 5.6e+102) tmp = t_1 + U; else tmp = t_0; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(U + N[(N[(J * 0.3333333333333333), $MachinePrecision] * N[(N[Power[l, 3.0], $MachinePrecision] * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision]}, If[LessEqual[l, -1.22e+138], t$95$0, If[LessEqual[l, -160.0], t$95$1, If[LessEqual[l, 0.00065], N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(l * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 5.6e+102], N[(t$95$1 + U), $MachinePrecision], t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + \left(J \cdot 0.3333333333333333\right) \cdot \left({\ell}^{3} \cdot \cos \left(K \cdot 0.5\right)\right)\\
t_1 := \left(e^{\ell} - e^{-\ell}\right) \cdot J\\
\mathbf{if}\;\ell \leq -1.22 \cdot 10^{+138}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq -160:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\ell \leq 0.00065:\\
\;\;\;\;U + \cos \left(\frac{K}{2}\right) \cdot \left(\ell \cdot \left(J \cdot 2\right)\right)\\
\mathbf{elif}\;\ell \leq 5.6 \cdot 10^{+102}:\\
\;\;\;\;t\_1 + U\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if l < -1.22000000000000001e138 or 5.60000000000000037e102 < l Initial program 100.0%
Taylor expanded in l around 0 100.0%
Taylor expanded in l around inf 100.0%
associate-*r*100.0%
*-commutative100.0%
Simplified100.0%
if -1.22000000000000001e138 < l < -160Initial program 100.0%
Taylor expanded in K around 0 90.3%
Taylor expanded in J around inf 90.3%
if -160 < l < 6.4999999999999997e-4Initial program 66.7%
Taylor expanded in l around 0 99.6%
associate-*r*99.6%
Simplified99.6%
if 6.4999999999999997e-4 < l < 5.60000000000000037e102Initial program 100.0%
Taylor expanded in K around 0 80.0%
Final simplification96.3%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (log1p (expm1 (- (/ -4.0 U) U))))
(t_1 (+ U (* J (* l (+ 2.0 (* 0.3333333333333333 (pow l 2.0))))))))
(if (<= l -4.3e+93)
t_1
(if (<= l -1.2e+14)
t_0
(if (<= l 440000000.0)
(+ U (* (cos (/ K 2.0)) (* l (* J 2.0))))
(if (<= l 8e+98) t_0 t_1))))))
double code(double J, double l, double K, double U) {
double t_0 = log1p(expm1(((-4.0 / U) - U)));
double t_1 = U + (J * (l * (2.0 + (0.3333333333333333 * pow(l, 2.0)))));
double tmp;
if (l <= -4.3e+93) {
tmp = t_1;
} else if (l <= -1.2e+14) {
tmp = t_0;
} else if (l <= 440000000.0) {
tmp = U + (cos((K / 2.0)) * (l * (J * 2.0)));
} else if (l <= 8e+98) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
public static double code(double J, double l, double K, double U) {
double t_0 = Math.log1p(Math.expm1(((-4.0 / U) - U)));
double t_1 = U + (J * (l * (2.0 + (0.3333333333333333 * Math.pow(l, 2.0)))));
double tmp;
if (l <= -4.3e+93) {
tmp = t_1;
} else if (l <= -1.2e+14) {
tmp = t_0;
} else if (l <= 440000000.0) {
tmp = U + (Math.cos((K / 2.0)) * (l * (J * 2.0)));
} else if (l <= 8e+98) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(J, l, K, U): t_0 = math.log1p(math.expm1(((-4.0 / U) - U))) t_1 = U + (J * (l * (2.0 + (0.3333333333333333 * math.pow(l, 2.0))))) tmp = 0 if l <= -4.3e+93: tmp = t_1 elif l <= -1.2e+14: tmp = t_0 elif l <= 440000000.0: tmp = U + (math.cos((K / 2.0)) * (l * (J * 2.0))) elif l <= 8e+98: tmp = t_0 else: tmp = t_1 return tmp
function code(J, l, K, U) t_0 = log1p(expm1(Float64(Float64(-4.0 / U) - U))) t_1 = Float64(U + Float64(J * Float64(l * Float64(2.0 + Float64(0.3333333333333333 * (l ^ 2.0)))))) tmp = 0.0 if (l <= -4.3e+93) tmp = t_1; elseif (l <= -1.2e+14) tmp = t_0; elseif (l <= 440000000.0) tmp = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(l * Float64(J * 2.0)))); elseif (l <= 8e+98) tmp = t_0; else tmp = t_1; end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Log[1 + N[(Exp[N[(N[(-4.0 / U), $MachinePrecision] - U), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(U + N[(J * N[(l * N[(2.0 + N[(0.3333333333333333 * N[Power[l, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -4.3e+93], t$95$1, If[LessEqual[l, -1.2e+14], t$95$0, If[LessEqual[l, 440000000.0], N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(l * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 8e+98], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{log1p}\left(\mathsf{expm1}\left(\frac{-4}{U} - U\right)\right)\\
t_1 := U + J \cdot \left(\ell \cdot \left(2 + 0.3333333333333333 \cdot {\ell}^{2}\right)\right)\\
\mathbf{if}\;\ell \leq -4.3 \cdot 10^{+93}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\ell \leq -1.2 \cdot 10^{+14}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq 440000000:\\
\;\;\;\;U + \cos \left(\frac{K}{2}\right) \cdot \left(\ell \cdot \left(J \cdot 2\right)\right)\\
\mathbf{elif}\;\ell \leq 8 \cdot 10^{+98}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if l < -4.3e93 or 7.99999999999999998e98 < l Initial program 100.0%
Taylor expanded in l around 0 95.2%
Taylor expanded in K around 0 72.7%
if -4.3e93 < l < -1.2e14 or 4.4e8 < l < 7.99999999999999998e98Initial program 100.0%
Applied egg-rr3.6%
log1p-expm1-u68.3%
Applied egg-rr68.3%
if -1.2e14 < l < 4.4e8Initial program 68.4%
Taylor expanded in l around 0 95.6%
associate-*r*95.6%
Simplified95.6%
Final simplification82.5%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) 0.15) (* U (+ 1.0 (* 2.0 (/ (* J (* l (cos (* K 0.5)))) 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.15) {
tmp = U * (1.0 + (2.0 * ((J * (l * cos((K * 0.5)))) / 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.15d0) then
tmp = u * (1.0d0 + (2.0d0 * ((j * (l * cos((k * 0.5d0)))) / 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.15) {
tmp = U * (1.0 + (2.0 * ((J * (l * Math.cos((K * 0.5)))) / 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.15: tmp = U * (1.0 + (2.0 * ((J * (l * math.cos((K * 0.5)))) / 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.15) tmp = Float64(U * Float64(1.0 + Float64(2.0 * Float64(Float64(J * Float64(l * cos(Float64(K * 0.5)))) / 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.15) tmp = U * (1.0 + (2.0 * ((J * (l * cos((K * 0.5)))) / 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.15], N[(U * N[(1.0 + N[(2.0 * N[(N[(J * N[(l * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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.15:\\
\;\;\;\;U \cdot \left(1 + 2 \cdot \frac{J \cdot \left(\ell \cdot \cos \left(K \cdot 0.5\right)\right)}{U}\right)\\
\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.149999999999999994Initial program 79.3%
Taylor expanded in l around 0 62.1%
*-commutative62.1%
associate-*r*62.2%
associate-*l*62.2%
*-commutative62.2%
*-commutative62.2%
associate-*l*62.2%
*-commutative62.2%
Simplified62.2%
Taylor expanded in U around inf 63.6%
if 0.149999999999999994 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 87.7%
Taylor expanded in l around 0 82.6%
Taylor expanded in K around 0 78.4%
Final simplification74.7%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) 0.15) (+ U (* l (* J (* 2.0 (cos (* K 0.5)))))) (+ 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.15) {
tmp = U + (l * (J * (2.0 * cos((K * 0.5)))));
} 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.15d0) then
tmp = u + (l * (j * (2.0d0 * cos((k * 0.5d0)))))
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.15) {
tmp = U + (l * (J * (2.0 * Math.cos((K * 0.5)))));
} 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.15: tmp = U + (l * (J * (2.0 * math.cos((K * 0.5))))) 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.15) tmp = Float64(U + Float64(l * Float64(J * Float64(2.0 * cos(Float64(K * 0.5)))))); 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.15) tmp = U + (l * (J * (2.0 * cos((K * 0.5))))); 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.15], N[(U + N[(l * N[(J * N[(2.0 * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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.15:\\
\;\;\;\;U + \ell \cdot \left(J \cdot \left(2 \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\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.149999999999999994Initial program 79.3%
Taylor expanded in l around 0 62.1%
*-commutative62.1%
associate-*r*62.2%
associate-*l*62.2%
*-commutative62.2%
*-commutative62.2%
associate-*l*62.2%
*-commutative62.2%
Simplified62.2%
if 0.149999999999999994 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 87.7%
Taylor expanded in l around 0 82.6%
Taylor expanded in K around 0 78.4%
Final simplification74.3%
(FPCore (J l K U) :precision binary64 (if (or (<= l -75.0) (not (<= l 3.0))) (* (- (exp l) (exp (- l))) J) (+ U (* (cos (/ K 2.0)) (* l (* J 2.0))))))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -75.0) || !(l <= 3.0)) {
tmp = (exp(l) - exp(-l)) * J;
} else {
tmp = U + (cos((K / 2.0)) * (l * (J * 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 <= (-75.0d0)) .or. (.not. (l <= 3.0d0))) then
tmp = (exp(l) - exp(-l)) * j
else
tmp = u + (cos((k / 2.0d0)) * (l * (j * 2.0d0)))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -75.0) || !(l <= 3.0)) {
tmp = (Math.exp(l) - Math.exp(-l)) * J;
} else {
tmp = U + (Math.cos((K / 2.0)) * (l * (J * 2.0)));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -75.0) or not (l <= 3.0): tmp = (math.exp(l) - math.exp(-l)) * J else: tmp = U + (math.cos((K / 2.0)) * (l * (J * 2.0))) return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -75.0) || !(l <= 3.0)) tmp = Float64(Float64(exp(l) - exp(Float64(-l))) * J); else tmp = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(l * Float64(J * 2.0)))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -75.0) || ~((l <= 3.0))) tmp = (exp(l) - exp(-l)) * J; else tmp = U + (cos((K / 2.0)) * (l * (J * 2.0))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -75.0], N[Not[LessEqual[l, 3.0]], $MachinePrecision]], N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision], N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(l * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -75 \lor \neg \left(\ell \leq 3\right):\\
\;\;\;\;\left(e^{\ell} - e^{-\ell}\right) \cdot J\\
\mathbf{else}:\\
\;\;\;\;U + \cos \left(\frac{K}{2}\right) \cdot \left(\ell \cdot \left(J \cdot 2\right)\right)\\
\end{array}
\end{array}
if l < -75 or 3 < l Initial program 100.0%
Taylor expanded in K around 0 78.5%
Taylor expanded in J around inf 78.5%
if -75 < l < 3Initial program 67.0%
Taylor expanded in l around 0 99.6%
associate-*r*99.6%
Simplified99.6%
Final simplification87.7%
(FPCore (J l K U) :precision binary64 (+ U (* (cos (/ K 2.0)) (* l (* J 2.0)))))
double code(double J, double l, double K, double U) {
return U + (cos((K / 2.0)) * (l * (J * 2.0)));
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = u + (cos((k / 2.0d0)) * (l * (j * 2.0d0)))
end function
public static double code(double J, double l, double K, double U) {
return U + (Math.cos((K / 2.0)) * (l * (J * 2.0)));
}
def code(J, l, K, U): return U + (math.cos((K / 2.0)) * (l * (J * 2.0)))
function code(J, l, K, U) return Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(l * Float64(J * 2.0)))) end
function tmp = code(J, l, K, U) tmp = U + (cos((K / 2.0)) * (l * (J * 2.0))); end
code[J_, l_, K_, U_] := N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(l * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + \cos \left(\frac{K}{2}\right) \cdot \left(\ell \cdot \left(J \cdot 2\right)\right)
\end{array}
Initial program 85.6%
Taylor expanded in l around 0 57.6%
associate-*r*57.6%
Simplified57.6%
Final simplification57.6%
(FPCore (J l K U) :precision binary64 (+ U (* l (* J (* 2.0 (cos (* K 0.5)))))))
double code(double J, double l, double K, double U) {
return U + (l * (J * (2.0 * cos((K * 0.5)))));
}
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 * cos((k * 0.5d0)))))
end function
public static double code(double J, double l, double K, double U) {
return U + (l * (J * (2.0 * Math.cos((K * 0.5)))));
}
def code(J, l, K, U): return U + (l * (J * (2.0 * math.cos((K * 0.5)))))
function code(J, l, K, U) return Float64(U + Float64(l * Float64(J * Float64(2.0 * cos(Float64(K * 0.5)))))) end
function tmp = code(J, l, K, U) tmp = U + (l * (J * (2.0 * cos((K * 0.5))))); end
code[J_, l_, K_, U_] := N[(U + N[(l * N[(J * N[(2.0 * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + \ell \cdot \left(J \cdot \left(2 \cdot \cos \left(K \cdot 0.5\right)\right)\right)
\end{array}
Initial program 85.6%
Taylor expanded in l around 0 57.5%
*-commutative57.5%
associate-*r*57.5%
associate-*l*57.5%
*-commutative57.5%
*-commutative57.5%
associate-*l*57.5%
*-commutative57.5%
Simplified57.5%
Final simplification57.5%
(FPCore (J l K U) :precision binary64 (+ U (* 2.0 (* J (* l (cos (* K 0.5)))))))
double code(double J, double l, double K, double U) {
return U + (2.0 * (J * (l * cos((K * 0.5)))));
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = u + (2.0d0 * (j * (l * cos((k * 0.5d0)))))
end function
public static double code(double J, double l, double K, double U) {
return U + (2.0 * (J * (l * Math.cos((K * 0.5)))));
}
def code(J, l, K, U): return U + (2.0 * (J * (l * math.cos((K * 0.5)))))
function code(J, l, K, U) return Float64(U + Float64(2.0 * Float64(J * Float64(l * cos(Float64(K * 0.5)))))) end
function tmp = code(J, l, K, U) tmp = U + (2.0 * (J * (l * cos((K * 0.5))))); end
code[J_, l_, K_, U_] := N[(U + N[(2.0 * N[(J * N[(l * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + 2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(K \cdot 0.5\right)\right)\right)
\end{array}
Initial program 85.6%
Taylor expanded in l around 0 57.5%
Final simplification57.5%
(FPCore (J l K U) :precision binary64 (if (or (<= l -1.2e+14) (not (<= l 4500000.0))) (- -4.0 (* U U)) U))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -1.2e+14) || !(l <= 4500000.0)) {
tmp = -4.0 - (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 <= (-1.2d+14)) .or. (.not. (l <= 4500000.0d0))) then
tmp = (-4.0d0) - (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 <= -1.2e+14) || !(l <= 4500000.0)) {
tmp = -4.0 - (U * U);
} else {
tmp = U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -1.2e+14) or not (l <= 4500000.0): tmp = -4.0 - (U * U) else: tmp = U return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -1.2e+14) || !(l <= 4500000.0)) tmp = Float64(-4.0 - Float64(U * U)); else tmp = U; end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -1.2e+14) || ~((l <= 4500000.0))) tmp = -4.0 - (U * U); else tmp = U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -1.2e+14], N[Not[LessEqual[l, 4500000.0]], $MachinePrecision]], N[(-4.0 - N[(U * U), $MachinePrecision]), $MachinePrecision], U]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.2 \cdot 10^{+14} \lor \neg \left(\ell \leq 4500000\right):\\
\;\;\;\;-4 - U \cdot U\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\end{array}
if l < -1.2e14 or 4.5e6 < l Initial program 100.0%
associate-*l*100.0%
fma-define100.0%
Simplified100.0%
Applied egg-rr15.3%
cancel-sign-sub-inv15.3%
Simplified15.3%
if -1.2e14 < l < 4.5e6Initial program 68.1%
Taylor expanded in J around 0 62.7%
Final simplification36.8%
(FPCore (J l K U) :precision binary64 (if (or (<= l -1.05e+17) (not (<= l 1060.0))) (* U U) U))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -1.05e+17) || !(l <= 1060.0)) {
tmp = U * U;
} else {
tmp = U;
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if ((l <= (-1.05d+17)) .or. (.not. (l <= 1060.0d0))) then
tmp = u * u
else
tmp = u
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -1.05e+17) || !(l <= 1060.0)) {
tmp = U * U;
} else {
tmp = U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -1.05e+17) or not (l <= 1060.0): tmp = U * U else: tmp = U return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -1.05e+17) || !(l <= 1060.0)) tmp = Float64(U * U); else tmp = U; end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -1.05e+17) || ~((l <= 1060.0))) tmp = U * U; else tmp = U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -1.05e+17], N[Not[LessEqual[l, 1060.0]], $MachinePrecision]], N[(U * U), $MachinePrecision], U]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.05 \cdot 10^{+17} \lor \neg \left(\ell \leq 1060\right):\\
\;\;\;\;U \cdot U\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\end{array}
if l < -1.05e17 or 1060 < l Initial program 100.0%
Applied egg-rr13.8%
if -1.05e17 < l < 1060Initial program 68.4%
Taylor expanded in J around 0 62.1%
Final simplification35.9%
(FPCore (J l K U) :precision binary64 (+ U (* l (* J 2.0))))
double code(double J, double l, double K, double U) {
return U + (l * (J * 2.0));
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = u + (l * (j * 2.0d0))
end function
public static double code(double J, double l, double K, double U) {
return U + (l * (J * 2.0));
}
def code(J, l, K, U): return U + (l * (J * 2.0))
function code(J, l, K, U) return Float64(U + Float64(l * Float64(J * 2.0))) end
function tmp = code(J, l, K, U) tmp = U + (l * (J * 2.0)); end
code[J_, l_, K_, U_] := N[(U + N[(l * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + \ell \cdot \left(J \cdot 2\right)
\end{array}
Initial program 85.6%
Taylor expanded in K around 0 72.8%
Taylor expanded in l around 0 45.4%
associate-*r*57.6%
Simplified45.4%
Final simplification45.4%
(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 85.6%
Taylor expanded in J around 0 29.6%
(FPCore (J l K U) :precision binary64 1.0)
double code(double J, double l, double K, double U) {
return 1.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 = 1.0d0
end function
public static double code(double J, double l, double K, double U) {
return 1.0;
}
def code(J, l, K, U): return 1.0
function code(J, l, K, U) return 1.0 end
function tmp = code(J, l, K, U) tmp = 1.0; end
code[J_, l_, K_, U_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 85.6%
Applied egg-rr2.6%
*-inverses2.6%
Simplified2.6%
herbie shell --seed 2024107
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))