
(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 (/ K 2.0))) (t_1 (exp (- l))) (t_2 (- (exp l) t_1)))
(if (<= t_2 (- INFINITY))
(+ (* (* J (- 27.0 t_1)) t_0) U)
(if (<= t_2 0.0)
(fma
l
(* (cos (* K 0.5)) (* J (fma 0.3333333333333333 (pow l 2.0) 2.0)))
U)
(+ U (* t_0 (* t_2 J)))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double t_1 = exp(-l);
double t_2 = exp(l) - t_1;
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = ((J * (27.0 - t_1)) * t_0) + U;
} else if (t_2 <= 0.0) {
tmp = fma(l, (cos((K * 0.5)) * (J * fma(0.3333333333333333, pow(l, 2.0), 2.0))), U);
} else {
tmp = U + (t_0 * (t_2 * J));
}
return tmp;
}
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) t_1 = exp(Float64(-l)) t_2 = Float64(exp(l) - t_1) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = Float64(Float64(Float64(J * Float64(27.0 - t_1)) * t_0) + U); elseif (t_2 <= 0.0) tmp = fma(l, Float64(cos(Float64(K * 0.5)) * Float64(J * fma(0.3333333333333333, (l ^ 2.0), 2.0))), U); else tmp = Float64(U + Float64(t_0 * Float64(t_2 * J))); end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Exp[(-l)], $MachinePrecision]}, Block[{t$95$2 = N[(N[Exp[l], $MachinePrecision] - t$95$1), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], N[(N[(N[(J * N[(27.0 - t$95$1), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] + U), $MachinePrecision], If[LessEqual[t$95$2, 0.0], N[(l * N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * N[(J * N[(0.3333333333333333 * N[Power[l, 2.0], $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], N[(U + N[(t$95$0 * N[(t$95$2 * J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
t_1 := e^{-\ell}\\
t_2 := e^{\ell} - t\_1\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;\left(J \cdot \left(27 - t\_1\right)\right) \cdot t\_0 + U\\
\mathbf{elif}\;t\_2 \leq 0:\\
\;\;\;\;\mathsf{fma}\left(\ell, \cos \left(K \cdot 0.5\right) \cdot \left(J \cdot \mathsf{fma}\left(0.3333333333333333, {\ell}^{2}, 2\right)\right), U\right)\\
\mathbf{else}:\\
\;\;\;\;U + t\_0 \cdot \left(t\_2 \cdot J\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -inf.0Initial program 100.0%
Applied egg-rr100.0%
if -inf.0 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 0.0Initial program 69.4%
Taylor expanded in l around 0 99.9%
+-commutative99.9%
fma-define99.9%
associate-*r*99.9%
associate-*r*99.9%
associate-*r*99.9%
distribute-rgt-out99.9%
*-commutative99.9%
associate-*r*99.9%
distribute-rgt-out99.9%
fma-define99.9%
Simplified99.9%
if 0.0 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 100.0%
Final simplification100.0%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))) (t_1 (exp (- l))) (t_2 (- (exp l) t_1)))
(if (<= t_2 (- INFINITY))
(+ (* (* J (- 27.0 t_1)) t_0) U)
(if (<= t_2 0.0)
(+ U (* 2.0 (* l (* J (cos (* K 0.5))))))
(+ U (* t_0 (* t_2 J)))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double t_1 = exp(-l);
double t_2 = exp(l) - t_1;
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = ((J * (27.0 - t_1)) * t_0) + U;
} else if (t_2 <= 0.0) {
tmp = U + (2.0 * (l * (J * cos((K * 0.5)))));
} else {
tmp = U + (t_0 * (t_2 * J));
}
return tmp;
}
public static double code(double J, double l, double K, double U) {
double t_0 = Math.cos((K / 2.0));
double t_1 = Math.exp(-l);
double t_2 = Math.exp(l) - t_1;
double tmp;
if (t_2 <= -Double.POSITIVE_INFINITY) {
tmp = ((J * (27.0 - t_1)) * t_0) + U;
} else if (t_2 <= 0.0) {
tmp = U + (2.0 * (l * (J * Math.cos((K * 0.5)))));
} else {
tmp = U + (t_0 * (t_2 * J));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K / 2.0)) t_1 = math.exp(-l) t_2 = math.exp(l) - t_1 tmp = 0 if t_2 <= -math.inf: tmp = ((J * (27.0 - t_1)) * t_0) + U elif t_2 <= 0.0: tmp = U + (2.0 * (l * (J * math.cos((K * 0.5))))) else: tmp = U + (t_0 * (t_2 * J)) return tmp
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) t_1 = exp(Float64(-l)) t_2 = Float64(exp(l) - t_1) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = Float64(Float64(Float64(J * Float64(27.0 - t_1)) * t_0) + U); elseif (t_2 <= 0.0) tmp = Float64(U + Float64(2.0 * Float64(l * Float64(J * cos(Float64(K * 0.5)))))); else tmp = Float64(U + Float64(t_0 * Float64(t_2 * J))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = cos((K / 2.0)); t_1 = exp(-l); t_2 = exp(l) - t_1; tmp = 0.0; if (t_2 <= -Inf) tmp = ((J * (27.0 - t_1)) * t_0) + U; elseif (t_2 <= 0.0) tmp = U + (2.0 * (l * (J * cos((K * 0.5))))); else tmp = U + (t_0 * (t_2 * J)); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Exp[(-l)], $MachinePrecision]}, Block[{t$95$2 = N[(N[Exp[l], $MachinePrecision] - t$95$1), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], N[(N[(N[(J * N[(27.0 - t$95$1), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] + U), $MachinePrecision], If[LessEqual[t$95$2, 0.0], N[(U + N[(2.0 * N[(l * N[(J * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(t$95$0 * N[(t$95$2 * J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
t_1 := e^{-\ell}\\
t_2 := e^{\ell} - t\_1\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;\left(J \cdot \left(27 - t\_1\right)\right) \cdot t\_0 + U\\
\mathbf{elif}\;t\_2 \leq 0:\\
\;\;\;\;U + 2 \cdot \left(\ell \cdot \left(J \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + t\_0 \cdot \left(t\_2 \cdot J\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -inf.0Initial program 100.0%
Applied egg-rr100.0%
if -inf.0 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 0.0Initial program 69.4%
Taylor expanded in l around 0 99.9%
*-commutative99.9%
associate-*l*99.9%
Simplified99.9%
Taylor expanded in J around 0 99.9%
*-commutative99.9%
associate-*l*99.9%
*-commutative99.9%
Simplified99.9%
if 0.0 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 100.0%
Final simplification100.0%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))) (t_1 (exp (- l))))
(if (<= (- (exp l) t_1) (- INFINITY))
(+ (* (* J (- 27.0 t_1)) t_0) U)
(+ U (* t_0 (* J (* l (+ 2.0 (* 0.3333333333333333 (* l l))))))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double t_1 = exp(-l);
double tmp;
if ((exp(l) - t_1) <= -((double) INFINITY)) {
tmp = ((J * (27.0 - t_1)) * t_0) + U;
} else {
tmp = U + (t_0 * (J * (l * (2.0 + (0.3333333333333333 * (l * l))))));
}
return tmp;
}
public static double code(double J, double l, double K, double U) {
double t_0 = Math.cos((K / 2.0));
double t_1 = Math.exp(-l);
double tmp;
if ((Math.exp(l) - t_1) <= -Double.POSITIVE_INFINITY) {
tmp = ((J * (27.0 - t_1)) * t_0) + U;
} else {
tmp = U + (t_0 * (J * (l * (2.0 + (0.3333333333333333 * (l * l))))));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K / 2.0)) t_1 = math.exp(-l) tmp = 0 if (math.exp(l) - t_1) <= -math.inf: tmp = ((J * (27.0 - t_1)) * t_0) + U else: tmp = U + (t_0 * (J * (l * (2.0 + (0.3333333333333333 * (l * l)))))) return tmp
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) t_1 = exp(Float64(-l)) tmp = 0.0 if (Float64(exp(l) - t_1) <= Float64(-Inf)) tmp = Float64(Float64(Float64(J * Float64(27.0 - t_1)) * t_0) + U); else tmp = Float64(U + Float64(t_0 * Float64(J * Float64(l * Float64(2.0 + Float64(0.3333333333333333 * Float64(l * l))))))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = cos((K / 2.0)); t_1 = exp(-l); tmp = 0.0; if ((exp(l) - t_1) <= -Inf) tmp = ((J * (27.0 - t_1)) * t_0) + U; else tmp = U + (t_0 * (J * (l * (2.0 + (0.3333333333333333 * (l * l)))))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Exp[(-l)], $MachinePrecision]}, If[LessEqual[N[(N[Exp[l], $MachinePrecision] - t$95$1), $MachinePrecision], (-Infinity)], N[(N[(N[(J * N[(27.0 - t$95$1), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] + U), $MachinePrecision], N[(U + N[(t$95$0 * N[(J * N[(l * N[(2.0 + N[(0.3333333333333333 * N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
t_1 := e^{-\ell}\\
\mathbf{if}\;e^{\ell} - t\_1 \leq -\infty:\\
\;\;\;\;\left(J \cdot \left(27 - t\_1\right)\right) \cdot t\_0 + U\\
\mathbf{else}:\\
\;\;\;\;U + t\_0 \cdot \left(J \cdot \left(\ell \cdot \left(2 + 0.3333333333333333 \cdot \left(\ell \cdot \ell\right)\right)\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))) Initial program 82.7%
Taylor expanded in l around 0 93.3%
unpow293.3%
Applied egg-rr93.3%
Final simplification95.2%
(FPCore (J l K U) :precision binary64 (if (or (<= l -1.8e+113) (not (<= l -2050000.0))) (+ U (* (cos (/ K 2.0)) (* J (* l (+ 2.0 (* 0.3333333333333333 (* l l))))))) (+ U (* J (- 0.3333333333333333 (exp (- l)))))))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -1.8e+113) || !(l <= -2050000.0)) {
tmp = U + (cos((K / 2.0)) * (J * (l * (2.0 + (0.3333333333333333 * (l * l))))));
} else {
tmp = U + (J * (0.3333333333333333 - exp(-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 ((l <= (-1.8d+113)) .or. (.not. (l <= (-2050000.0d0)))) then
tmp = u + (cos((k / 2.0d0)) * (j * (l * (2.0d0 + (0.3333333333333333d0 * (l * l))))))
else
tmp = u + (j * (0.3333333333333333d0 - exp(-l)))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -1.8e+113) || !(l <= -2050000.0)) {
tmp = U + (Math.cos((K / 2.0)) * (J * (l * (2.0 + (0.3333333333333333 * (l * l))))));
} else {
tmp = U + (J * (0.3333333333333333 - Math.exp(-l)));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -1.8e+113) or not (l <= -2050000.0): tmp = U + (math.cos((K / 2.0)) * (J * (l * (2.0 + (0.3333333333333333 * (l * l)))))) else: tmp = U + (J * (0.3333333333333333 - math.exp(-l))) return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -1.8e+113) || !(l <= -2050000.0)) tmp = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(J * Float64(l * Float64(2.0 + Float64(0.3333333333333333 * Float64(l * l))))))); else tmp = Float64(U + Float64(J * Float64(0.3333333333333333 - exp(Float64(-l))))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -1.8e+113) || ~((l <= -2050000.0))) tmp = U + (cos((K / 2.0)) * (J * (l * (2.0 + (0.3333333333333333 * (l * l)))))); else tmp = U + (J * (0.3333333333333333 - exp(-l))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -1.8e+113], N[Not[LessEqual[l, -2050000.0]], $MachinePrecision]], N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(J * N[(l * N[(2.0 + N[(0.3333333333333333 * N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * N[(0.3333333333333333 - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.8 \cdot 10^{+113} \lor \neg \left(\ell \leq -2050000\right):\\
\;\;\;\;U + \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(\ell \cdot \left(2 + 0.3333333333333333 \cdot \left(\ell \cdot \ell\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(0.3333333333333333 - e^{-\ell}\right)\\
\end{array}
\end{array}
if l < -1.79999999999999996e113 or -2.05e6 < l Initial program 86.2%
Taylor expanded in l around 0 94.3%
unpow294.3%
Applied egg-rr94.3%
if -1.79999999999999996e113 < l < -2.05e6Initial program 100.0%
Taylor expanded in K around 0 88.5%
Applied egg-rr88.5%
Final simplification93.7%
(FPCore (J l K U)
:precision binary64
(if (<= l -0.95)
(+ U (* J (- 0.3333333333333333 (exp (- l)))))
(if (<= l 2.4e-17)
(+ U (* 2.0 (* l (* J (cos (* K 0.5))))))
(+ U (* J (- (exp l) 0.3333333333333333))))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -0.95) {
tmp = U + (J * (0.3333333333333333 - exp(-l)));
} else if (l <= 2.4e-17) {
tmp = U + (2.0 * (l * (J * cos((K * 0.5)))));
} else {
tmp = U + (J * (exp(l) - 0.3333333333333333));
}
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 <= (-0.95d0)) then
tmp = u + (j * (0.3333333333333333d0 - exp(-l)))
else if (l <= 2.4d-17) then
tmp = u + (2.0d0 * (l * (j * cos((k * 0.5d0)))))
else
tmp = u + (j * (exp(l) - 0.3333333333333333d0))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (l <= -0.95) {
tmp = U + (J * (0.3333333333333333 - Math.exp(-l)));
} else if (l <= 2.4e-17) {
tmp = U + (2.0 * (l * (J * Math.cos((K * 0.5)))));
} else {
tmp = U + (J * (Math.exp(l) - 0.3333333333333333));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -0.95: tmp = U + (J * (0.3333333333333333 - math.exp(-l))) elif l <= 2.4e-17: tmp = U + (2.0 * (l * (J * math.cos((K * 0.5))))) else: tmp = U + (J * (math.exp(l) - 0.3333333333333333)) return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -0.95) tmp = Float64(U + Float64(J * Float64(0.3333333333333333 - exp(Float64(-l))))); elseif (l <= 2.4e-17) tmp = Float64(U + Float64(2.0 * Float64(l * Float64(J * cos(Float64(K * 0.5)))))); else tmp = Float64(U + Float64(J * Float64(exp(l) - 0.3333333333333333))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -0.95) tmp = U + (J * (0.3333333333333333 - exp(-l))); elseif (l <= 2.4e-17) tmp = U + (2.0 * (l * (J * cos((K * 0.5))))); else tmp = U + (J * (exp(l) - 0.3333333333333333)); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -0.95], N[(U + N[(J * N[(0.3333333333333333 - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.4e-17], N[(U + N[(2.0 * N[(l * N[(J * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * N[(N[Exp[l], $MachinePrecision] - 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -0.95:\\
\;\;\;\;U + J \cdot \left(0.3333333333333333 - e^{-\ell}\right)\\
\mathbf{elif}\;\ell \leq 2.4 \cdot 10^{-17}:\\
\;\;\;\;U + 2 \cdot \left(\ell \cdot \left(J \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(e^{\ell} - 0.3333333333333333\right)\\
\end{array}
\end{array}
if l < -0.94999999999999996Initial program 100.0%
Taylor expanded in K around 0 76.4%
Applied egg-rr76.4%
if -0.94999999999999996 < l < 2.39999999999999986e-17Initial program 69.1%
Taylor expanded in l around 0 99.9%
*-commutative99.9%
associate-*l*99.9%
Simplified99.9%
Taylor expanded in J around 0 99.9%
*-commutative99.9%
associate-*l*99.9%
*-commutative99.9%
Simplified99.9%
if 2.39999999999999986e-17 < l Initial program 100.0%
Taylor expanded in K around 0 78.0%
Applied egg-rr77.3%
Final simplification86.1%
(FPCore (J l K U)
:precision binary64
(if (<= l -0.95)
(+ U (* J (- 0.3333333333333333 (exp (- l)))))
(if (<= l 2.4e-17)
(+ U (* 2.0 (* J (* l (cos (* K 0.5))))))
(+ U (* J (- (exp l) 0.3333333333333333))))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -0.95) {
tmp = U + (J * (0.3333333333333333 - exp(-l)));
} else if (l <= 2.4e-17) {
tmp = U + (2.0 * (J * (l * cos((K * 0.5)))));
} else {
tmp = U + (J * (exp(l) - 0.3333333333333333));
}
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 <= (-0.95d0)) then
tmp = u + (j * (0.3333333333333333d0 - exp(-l)))
else if (l <= 2.4d-17) then
tmp = u + (2.0d0 * (j * (l * cos((k * 0.5d0)))))
else
tmp = u + (j * (exp(l) - 0.3333333333333333d0))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (l <= -0.95) {
tmp = U + (J * (0.3333333333333333 - Math.exp(-l)));
} else if (l <= 2.4e-17) {
tmp = U + (2.0 * (J * (l * Math.cos((K * 0.5)))));
} else {
tmp = U + (J * (Math.exp(l) - 0.3333333333333333));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -0.95: tmp = U + (J * (0.3333333333333333 - math.exp(-l))) elif l <= 2.4e-17: tmp = U + (2.0 * (J * (l * math.cos((K * 0.5))))) else: tmp = U + (J * (math.exp(l) - 0.3333333333333333)) return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -0.95) tmp = Float64(U + Float64(J * Float64(0.3333333333333333 - exp(Float64(-l))))); elseif (l <= 2.4e-17) tmp = Float64(U + Float64(2.0 * Float64(J * Float64(l * cos(Float64(K * 0.5)))))); else tmp = Float64(U + Float64(J * Float64(exp(l) - 0.3333333333333333))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -0.95) tmp = U + (J * (0.3333333333333333 - exp(-l))); elseif (l <= 2.4e-17) tmp = U + (2.0 * (J * (l * cos((K * 0.5))))); else tmp = U + (J * (exp(l) - 0.3333333333333333)); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -0.95], N[(U + N[(J * N[(0.3333333333333333 - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.4e-17], N[(U + N[(2.0 * N[(J * N[(l * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * N[(N[Exp[l], $MachinePrecision] - 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -0.95:\\
\;\;\;\;U + J \cdot \left(0.3333333333333333 - e^{-\ell}\right)\\
\mathbf{elif}\;\ell \leq 2.4 \cdot 10^{-17}:\\
\;\;\;\;U + 2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(e^{\ell} - 0.3333333333333333\right)\\
\end{array}
\end{array}
if l < -0.94999999999999996Initial program 100.0%
Taylor expanded in K around 0 76.4%
Applied egg-rr76.4%
if -0.94999999999999996 < l < 2.39999999999999986e-17Initial program 69.1%
Taylor expanded in l around 0 99.9%
if 2.39999999999999986e-17 < l Initial program 100.0%
Taylor expanded in K around 0 78.0%
Applied egg-rr77.3%
Final simplification86.1%
(FPCore (J l K U)
:precision binary64
(if (<= l -0.76)
(+ U (* J (- 0.3333333333333333 (exp (- l)))))
(if (<= l 2.4e-17)
(fma l (* J 2.0) U)
(+ U (* J (- (exp l) 0.3333333333333333))))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -0.76) {
tmp = U + (J * (0.3333333333333333 - exp(-l)));
} else if (l <= 2.4e-17) {
tmp = fma(l, (J * 2.0), U);
} else {
tmp = U + (J * (exp(l) - 0.3333333333333333));
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (l <= -0.76) tmp = Float64(U + Float64(J * Float64(0.3333333333333333 - exp(Float64(-l))))); elseif (l <= 2.4e-17) tmp = fma(l, Float64(J * 2.0), U); else tmp = Float64(U + Float64(J * Float64(exp(l) - 0.3333333333333333))); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[l, -0.76], N[(U + N[(J * N[(0.3333333333333333 - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.4e-17], N[(l * N[(J * 2.0), $MachinePrecision] + U), $MachinePrecision], N[(U + N[(J * N[(N[Exp[l], $MachinePrecision] - 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -0.76:\\
\;\;\;\;U + J \cdot \left(0.3333333333333333 - e^{-\ell}\right)\\
\mathbf{elif}\;\ell \leq 2.4 \cdot 10^{-17}:\\
\;\;\;\;\mathsf{fma}\left(\ell, J \cdot 2, U\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(e^{\ell} - 0.3333333333333333\right)\\
\end{array}
\end{array}
if l < -0.76000000000000001Initial program 100.0%
Taylor expanded in K around 0 76.4%
Applied egg-rr76.4%
if -0.76000000000000001 < l < 2.39999999999999986e-17Initial program 69.1%
Taylor expanded in l around 0 99.9%
*-commutative99.9%
associate-*l*99.9%
Simplified99.9%
Taylor expanded in K around 0 84.7%
+-commutative84.7%
associate-*r*84.7%
*-commutative84.7%
fma-define84.8%
Simplified84.8%
if 2.39999999999999986e-17 < l Initial program 100.0%
Taylor expanded in K around 0 78.0%
Applied egg-rr77.3%
Final simplification80.1%
(FPCore (J l K U) :precision binary64 (if (<= l 2.4e-17) (* U (+ 1.0 (* J (/ (* l 2.0) U)))) (+ U (* J (- (exp l) 0.3333333333333333)))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= 2.4e-17) {
tmp = U * (1.0 + (J * ((l * 2.0) / U)));
} else {
tmp = U + (J * (exp(l) - 0.3333333333333333));
}
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.4d-17) then
tmp = u * (1.0d0 + (j * ((l * 2.0d0) / u)))
else
tmp = u + (j * (exp(l) - 0.3333333333333333d0))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (l <= 2.4e-17) {
tmp = U * (1.0 + (J * ((l * 2.0) / U)));
} else {
tmp = U + (J * (Math.exp(l) - 0.3333333333333333));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= 2.4e-17: tmp = U * (1.0 + (J * ((l * 2.0) / U))) else: tmp = U + (J * (math.exp(l) - 0.3333333333333333)) return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= 2.4e-17) tmp = Float64(U * Float64(1.0 + Float64(J * Float64(Float64(l * 2.0) / U)))); else tmp = Float64(U + Float64(J * Float64(exp(l) - 0.3333333333333333))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= 2.4e-17) tmp = U * (1.0 + (J * ((l * 2.0) / U))); else tmp = U + (J * (exp(l) - 0.3333333333333333)); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, 2.4e-17], N[(U * N[(1.0 + N[(J * N[(N[(l * 2.0), $MachinePrecision] / U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * N[(N[Exp[l], $MachinePrecision] - 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 2.4 \cdot 10^{-17}:\\
\;\;\;\;U \cdot \left(1 + J \cdot \frac{\ell \cdot 2}{U}\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(e^{\ell} - 0.3333333333333333\right)\\
\end{array}
\end{array}
if l < 2.39999999999999986e-17Initial program 81.8%
Taylor expanded in l around 0 72.6%
*-commutative72.6%
associate-*l*72.6%
Simplified72.6%
Taylor expanded in U around inf 74.7%
Taylor expanded in K around 0 62.6%
*-commutative62.6%
associate-/l*64.2%
associate-*l*64.2%
associate-*l/64.2%
Simplified64.2%
if 2.39999999999999986e-17 < l Initial program 100.0%
Taylor expanded in K around 0 78.0%
Applied egg-rr77.3%
Final simplification68.3%
(FPCore (J l K U) :precision binary64 (if (or (<= K 2.7e-157) (not (<= K 1.95e-59))) (* U (+ 1.0 (* 2.0 (* l (/ J U))))) (* J (+ (* l 2.0) (/ U J)))))
double code(double J, double l, double K, double U) {
double tmp;
if ((K <= 2.7e-157) || !(K <= 1.95e-59)) {
tmp = U * (1.0 + (2.0 * (l * (J / U))));
} 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 ((k <= 2.7d-157) .or. (.not. (k <= 1.95d-59))) then
tmp = u * (1.0d0 + (2.0d0 * (l * (j / u))))
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 ((K <= 2.7e-157) || !(K <= 1.95e-59)) {
tmp = U * (1.0 + (2.0 * (l * (J / U))));
} else {
tmp = J * ((l * 2.0) + (U / J));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (K <= 2.7e-157) or not (K <= 1.95e-59): tmp = U * (1.0 + (2.0 * (l * (J / U)))) else: tmp = J * ((l * 2.0) + (U / J)) return tmp
function code(J, l, K, U) tmp = 0.0 if ((K <= 2.7e-157) || !(K <= 1.95e-59)) tmp = Float64(U * Float64(1.0 + Float64(2.0 * Float64(l * Float64(J / U))))); 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 ((K <= 2.7e-157) || ~((K <= 1.95e-59))) tmp = U * (1.0 + (2.0 * (l * (J / U)))); else tmp = J * ((l * 2.0) + (U / J)); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[K, 2.7e-157], N[Not[LessEqual[K, 1.95e-59]], $MachinePrecision]], N[(U * N[(1.0 + N[(2.0 * N[(l * N[(J / U), $MachinePrecision]), $MachinePrecision]), $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}\;K \leq 2.7 \cdot 10^{-157} \lor \neg \left(K \leq 1.95 \cdot 10^{-59}\right):\\
\;\;\;\;U \cdot \left(1 + 2 \cdot \left(\ell \cdot \frac{J}{U}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;J \cdot \left(\ell \cdot 2 + \frac{U}{J}\right)\\
\end{array}
\end{array}
if K < 2.7e-157 or 1.95000000000000009e-59 < K Initial program 88.6%
Taylor expanded in l around 0 61.2%
*-commutative61.2%
associate-*l*61.2%
Simplified61.2%
Taylor expanded in U around inf 66.7%
Taylor expanded in K around 0 55.1%
*-commutative55.1%
associate-/l*53.2%
Simplified53.2%
if 2.7e-157 < K < 1.95000000000000009e-59Initial program 75.6%
Taylor expanded in l around 0 51.5%
*-commutative51.5%
associate-*l*51.5%
Simplified51.5%
Taylor expanded in K around 0 51.5%
+-commutative51.5%
associate-*r*51.5%
*-commutative51.5%
fma-define51.5%
Simplified51.5%
Taylor expanded in J around inf 51.4%
Final simplification53.1%
(FPCore (J l K U) :precision binary64 (if (or (<= J -2.5e+114) (not (<= J 2.45e+53))) (* l (* J 2.0)) U))
double code(double J, double l, double K, double U) {
double tmp;
if ((J <= -2.5e+114) || !(J <= 2.45e+53)) {
tmp = l * (J * 2.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 ((j <= (-2.5d+114)) .or. (.not. (j <= 2.45d+53))) then
tmp = l * (j * 2.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 ((J <= -2.5e+114) || !(J <= 2.45e+53)) {
tmp = l * (J * 2.0);
} else {
tmp = U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (J <= -2.5e+114) or not (J <= 2.45e+53): tmp = l * (J * 2.0) else: tmp = U return tmp
function code(J, l, K, U) tmp = 0.0 if ((J <= -2.5e+114) || !(J <= 2.45e+53)) tmp = Float64(l * Float64(J * 2.0)); else tmp = U; end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((J <= -2.5e+114) || ~((J <= 2.45e+53))) tmp = l * (J * 2.0); else tmp = U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[J, -2.5e+114], N[Not[LessEqual[J, 2.45e+53]], $MachinePrecision]], N[(l * N[(J * 2.0), $MachinePrecision]), $MachinePrecision], U]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;J \leq -2.5 \cdot 10^{+114} \lor \neg \left(J \leq 2.45 \cdot 10^{+53}\right):\\
\;\;\;\;\ell \cdot \left(J \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\end{array}
if J < -2.5e114 or 2.45000000000000009e53 < J Initial program 75.9%
Taylor expanded in l around 0 74.8%
*-commutative74.8%
associate-*l*74.8%
Simplified74.8%
Taylor expanded in K around 0 58.3%
+-commutative58.3%
associate-*r*58.3%
*-commutative58.3%
fma-define58.3%
Simplified58.3%
Taylor expanded in l around inf 48.4%
associate-*r*48.4%
*-commutative48.4%
Simplified48.4%
if -2.5e114 < J < 2.45000000000000009e53Initial program 95.1%
Taylor expanded in J around 0 42.0%
Final simplification44.5%
(FPCore (J l K U) :precision binary64 (if (or (<= l -750.0) (not (<= l 2.9e+74))) (* U U) U))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -750.0) || !(l <= 2.9e+74)) {
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 <= (-750.0d0)) .or. (.not. (l <= 2.9d+74))) 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 <= -750.0) || !(l <= 2.9e+74)) {
tmp = U * U;
} else {
tmp = U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -750.0) or not (l <= 2.9e+74): tmp = U * U else: tmp = U return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -750.0) || !(l <= 2.9e+74)) tmp = Float64(U * U); else tmp = U; end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -750.0) || ~((l <= 2.9e+74))) tmp = U * U; else tmp = U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -750.0], N[Not[LessEqual[l, 2.9e+74]], $MachinePrecision]], N[(U * U), $MachinePrecision], U]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -750 \lor \neg \left(\ell \leq 2.9 \cdot 10^{+74}\right):\\
\;\;\;\;U \cdot U\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\end{array}
if l < -750 or 2.9000000000000002e74 < l Initial program 100.0%
Applied egg-rr13.1%
if -750 < l < 2.9000000000000002e74Initial program 73.0%
Taylor expanded in J around 0 62.8%
Final simplification36.0%
(FPCore (J l K U) :precision binary64 (if (<= l -760.0) (* U (- U -4.0)) (if (<= l 2.9e+74) U (* U U))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -760.0) {
tmp = U * (U - -4.0);
} else if (l <= 2.9e+74) {
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 <= (-760.0d0)) then
tmp = u * (u - (-4.0d0))
else if (l <= 2.9d+74) 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 <= -760.0) {
tmp = U * (U - -4.0);
} else if (l <= 2.9e+74) {
tmp = U;
} else {
tmp = U * U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -760.0: tmp = U * (U - -4.0) elif l <= 2.9e+74: tmp = U else: tmp = U * U return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -760.0) tmp = Float64(U * Float64(U - -4.0)); elseif (l <= 2.9e+74) tmp = U; else tmp = Float64(U * U); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -760.0) tmp = U * (U - -4.0); elseif (l <= 2.9e+74) tmp = U; else tmp = U * U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -760.0], N[(U * N[(U - -4.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.9e+74], U, N[(U * U), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -760:\\
\;\;\;\;U \cdot \left(U - -4\right)\\
\mathbf{elif}\;\ell \leq 2.9 \cdot 10^{+74}:\\
\;\;\;\;U\\
\mathbf{else}:\\
\;\;\;\;U \cdot U\\
\end{array}
\end{array}
if l < -760Initial program 100.0%
Applied egg-rr9.8%
if -760 < l < 2.9000000000000002e74Initial program 73.0%
Taylor expanded in J around 0 62.8%
if 2.9000000000000002e74 < l Initial program 100.0%
Applied egg-rr16.8%
(FPCore (J l K U) :precision binary64 (* U (+ 1.0 (* J (/ (* l 2.0) U)))))
double code(double J, double l, double K, double U) {
return U * (1.0 + (J * ((l * 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 = u * (1.0d0 + (j * ((l * 2.0d0) / u)))
end function
public static double code(double J, double l, double K, double U) {
return U * (1.0 + (J * ((l * 2.0) / U)));
}
def code(J, l, K, U): return U * (1.0 + (J * ((l * 2.0) / U)))
function code(J, l, K, U) return Float64(U * Float64(1.0 + Float64(J * Float64(Float64(l * 2.0) / U)))) end
function tmp = code(J, l, K, U) tmp = U * (1.0 + (J * ((l * 2.0) / U))); end
code[J_, l_, K_, U_] := N[(U * N[(1.0 + N[(J * N[(N[(l * 2.0), $MachinePrecision] / U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U \cdot \left(1 + J \cdot \frac{\ell \cdot 2}{U}\right)
\end{array}
Initial program 87.6%
Taylor expanded in l around 0 60.4%
*-commutative60.4%
associate-*l*60.4%
Simplified60.4%
Taylor expanded in U around inf 64.8%
Taylor expanded in K around 0 54.0%
*-commutative54.0%
associate-/l*57.0%
associate-*l*57.0%
associate-*l/57.0%
Simplified57.0%
(FPCore (J l K U) :precision binary64 (* U (+ 1.0 (* 2.0 (/ (* l J) U)))))
double code(double J, double l, double K, double U) {
return U * (1.0 + (2.0 * ((l * J) / 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 * ((l * j) / u)))
end function
public static double code(double J, double l, double K, double U) {
return U * (1.0 + (2.0 * ((l * J) / U)));
}
def code(J, l, K, U): return U * (1.0 + (2.0 * ((l * J) / U)))
function code(J, l, K, U) return Float64(U * Float64(1.0 + Float64(2.0 * Float64(Float64(l * J) / U)))) end
function tmp = code(J, l, K, U) tmp = U * (1.0 + (2.0 * ((l * J) / U))); end
code[J_, l_, K_, U_] := N[(U * N[(1.0 + N[(2.0 * N[(N[(l * J), $MachinePrecision] / U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U \cdot \left(1 + 2 \cdot \frac{\ell \cdot J}{U}\right)
\end{array}
Initial program 87.6%
Taylor expanded in l around 0 60.4%
*-commutative60.4%
associate-*l*60.4%
Simplified60.4%
Taylor expanded in U around inf 64.8%
Taylor expanded in K around 0 54.0%
*-commutative54.0%
Simplified54.0%
(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 87.6%
Taylor expanded in l around 0 60.4%
*-commutative60.4%
associate-*l*60.4%
Simplified60.4%
Taylor expanded in K around 0 50.1%
associate-*r*50.1%
*-commutative50.1%
Simplified50.1%
Final simplification50.1%
(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.6%
Taylor expanded in J around 0 30.1%
(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 87.6%
Applied egg-rr2.5%
fma-undefine2.5%
*-commutative2.5%
fma-define2.5%
Simplified2.5%
Taylor expanded in U around 0 2.6%
herbie shell --seed 2024158
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))