
(FPCore (J l K U) :precision binary64 (+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))
double code(double J, double l, double K, double U) {
return ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = ((j * (exp(l) - exp(-l))) * cos((k / 2.0d0))) + u
end function
public static double code(double J, double l, double K, double U) {
return ((J * (Math.exp(l) - Math.exp(-l))) * Math.cos((K / 2.0))) + U;
}
def code(J, l, K, U): return ((J * (math.exp(l) - math.exp(-l))) * math.cos((K / 2.0))) + U
function code(J, l, K, U) return Float64(Float64(Float64(J * Float64(exp(l) - exp(Float64(-l)))) * cos(Float64(K / 2.0))) + U) end
function tmp = code(J, l, K, U) tmp = ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U; end
code[J_, l_, K_, U_] := N[(N[(N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]
\begin{array}{l}
\\
\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 16 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (J l K U) :precision binary64 (+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))
double code(double J, double l, double K, double U) {
return ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = ((j * (exp(l) - exp(-l))) * cos((k / 2.0d0))) + u
end function
public static double code(double J, double l, double K, double U) {
return ((J * (Math.exp(l) - Math.exp(-l))) * Math.cos((K / 2.0))) + U;
}
def code(J, l, K, U): return ((J * (math.exp(l) - math.exp(-l))) * math.cos((K / 2.0))) + U
function code(J, l, K, U) return Float64(Float64(Float64(J * Float64(exp(l) - exp(Float64(-l)))) * cos(Float64(K / 2.0))) + U) end
function tmp = code(J, l, K, U) tmp = ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U; end
code[J_, l_, K_, U_] := N[(N[(N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]
\begin{array}{l}
\\
\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U
\end{array}
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (- (exp l) (exp (- l)))))
(if (or (<= t_0 (- INFINITY)) (not (<= t_0 0.0)))
(+ (* (* t_0 J) (cos (/ K 2.0))) U)
(+
U
(*
(* J (cos (* K 0.5)))
(fma 2.0 l (* 0.3333333333333333 (pow l 3.0))))))))
double code(double J, double l, double K, double U) {
double t_0 = exp(l) - exp(-l);
double tmp;
if ((t_0 <= -((double) INFINITY)) || !(t_0 <= 0.0)) {
tmp = ((t_0 * J) * cos((K / 2.0))) + U;
} else {
tmp = U + ((J * cos((K * 0.5))) * fma(2.0, l, (0.3333333333333333 * pow(l, 3.0))));
}
return tmp;
}
function code(J, l, K, U) t_0 = Float64(exp(l) - exp(Float64(-l))) tmp = 0.0 if ((t_0 <= Float64(-Inf)) || !(t_0 <= 0.0)) tmp = Float64(Float64(Float64(t_0 * J) * cos(Float64(K / 2.0))) + U); else tmp = Float64(U + Float64(Float64(J * cos(Float64(K * 0.5))) * fma(2.0, l, Float64(0.3333333333333333 * (l ^ 3.0))))); end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, (-Infinity)], N[Not[LessEqual[t$95$0, 0.0]], $MachinePrecision]], N[(N[(N[(t$95$0 * J), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], N[(U + N[(N[(J * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(2.0 * l + N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{\ell} - e^{-\ell}\\
\mathbf{if}\;t_0 \leq -\infty \lor \neg \left(t_0 \leq 0\right):\\
\;\;\;\;\left(t_0 \cdot J\right) \cdot \cos \left(\frac{K}{2}\right) + U\\
\mathbf{else}:\\
\;\;\;\;U + \left(J \cdot \cos \left(K \cdot 0.5\right)\right) \cdot \mathsf{fma}\left(2, \ell, 0.3333333333333333 \cdot {\ell}^{3}\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -inf.0 or 0.0 < (-.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))) < 0.0Initial program 73.7%
Taylor expanded in l around 0 99.9%
Taylor expanded in J around 0 99.9%
associate-*r*99.9%
+-commutative99.9%
fma-def99.9%
Simplified99.9%
Final simplification100.0%
(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.0)))
(+ (* (* t_1 J) t_0) U)
(+ U (* t_0 (* J (+ (* 0.3333333333333333 (pow l 3.0)) (* 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.0)) {
tmp = ((t_1 * J) * t_0) + U;
} else {
tmp = U + (t_0 * (J * ((0.3333333333333333 * pow(l, 3.0)) + (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.0)) {
tmp = ((t_1 * J) * t_0) + U;
} else {
tmp = U + (t_0 * (J * ((0.3333333333333333 * Math.pow(l, 3.0)) + (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.0): tmp = ((t_1 * J) * t_0) + U else: tmp = U + (t_0 * (J * ((0.3333333333333333 * math.pow(l, 3.0)) + (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.0)) tmp = Float64(Float64(Float64(t_1 * J) * t_0) + U); else tmp = Float64(U + Float64(t_0 * Float64(J * Float64(Float64(0.3333333333333333 * (l ^ 3.0)) + Float64(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.0))) tmp = ((t_1 * J) * t_0) + U; else tmp = U + (t_0 * (J * ((0.3333333333333333 * (l ^ 3.0)) + (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.0]], $MachinePrecision]], N[(N[(N[(t$95$1 * J), $MachinePrecision] * t$95$0), $MachinePrecision] + U), $MachinePrecision], N[(U + N[(t$95$0 * N[(J * N[(N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision] + N[(l * 2.0), $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\right):\\
\;\;\;\;\left(t_1 \cdot J\right) \cdot t_0 + U\\
\mathbf{else}:\\
\;\;\;\;U + t_0 \cdot \left(J \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -inf.0 or 0.0 < (-.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))) < 0.0Initial program 73.7%
Taylor expanded in l around 0 99.9%
Final simplification100.0%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (- (exp l) (exp (- l)))))
(if (or (<= t_0 -0.0001) (not (<= t_0 1.0)))
(+ (* t_0 J) U)
(+ U (* (cos (/ K 2.0)) (* J (* l 2.0)))))))
double code(double J, double l, double K, double U) {
double t_0 = exp(l) - exp(-l);
double tmp;
if ((t_0 <= -0.0001) || !(t_0 <= 1.0)) {
tmp = (t_0 * J) + U;
} else {
tmp = U + (cos((K / 2.0)) * (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) :: t_0
real(8) :: tmp
t_0 = exp(l) - exp(-l)
if ((t_0 <= (-0.0001d0)) .or. (.not. (t_0 <= 1.0d0))) then
tmp = (t_0 * j) + u
else
tmp = u + (cos((k / 2.0d0)) * (j * (l * 2.0d0)))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = Math.exp(l) - Math.exp(-l);
double tmp;
if ((t_0 <= -0.0001) || !(t_0 <= 1.0)) {
tmp = (t_0 * J) + U;
} else {
tmp = U + (Math.cos((K / 2.0)) * (J * (l * 2.0)));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.exp(l) - math.exp(-l) tmp = 0 if (t_0 <= -0.0001) or not (t_0 <= 1.0): tmp = (t_0 * J) + U else: tmp = U + (math.cos((K / 2.0)) * (J * (l * 2.0))) return tmp
function code(J, l, K, U) t_0 = Float64(exp(l) - exp(Float64(-l))) tmp = 0.0 if ((t_0 <= -0.0001) || !(t_0 <= 1.0)) tmp = Float64(Float64(t_0 * J) + U); else tmp = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(J * Float64(l * 2.0)))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = exp(l) - exp(-l); tmp = 0.0; if ((t_0 <= -0.0001) || ~((t_0 <= 1.0))) tmp = (t_0 * J) + U; else tmp = U + (cos((K / 2.0)) * (J * (l * 2.0))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, -0.0001], N[Not[LessEqual[t$95$0, 1.0]], $MachinePrecision]], N[(N[(t$95$0 * J), $MachinePrecision] + U), $MachinePrecision], N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(J * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{\ell} - e^{-\ell}\\
\mathbf{if}\;t_0 \leq -0.0001 \lor \neg \left(t_0 \leq 1\right):\\
\;\;\;\;t_0 \cdot J + U\\
\mathbf{else}:\\
\;\;\;\;U + \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(\ell \cdot 2\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -1.00000000000000005e-4 or 1 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 99.9%
Taylor expanded in K around 0 69.6%
if -1.00000000000000005e-4 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 1Initial program 74.0%
Taylor expanded in l around 0 99.0%
Final simplification83.8%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0)))
(t_1 (+ U (* 2.0 (* J (+ l (* l (* -0.125 (* K K)))))))))
(if (<= t_0 -0.535)
t_1
(if (<= t_0 -0.35)
(+ U (* t_0 (* J (* l 2.0))))
(if (<= t_0 -0.02)
t_1
(+ U (* J (+ (* 0.3333333333333333 (pow l 3.0)) (* l 2.0)))))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double t_1 = U + (2.0 * (J * (l + (l * (-0.125 * (K * K))))));
double tmp;
if (t_0 <= -0.535) {
tmp = t_1;
} else if (t_0 <= -0.35) {
tmp = U + (t_0 * (J * (l * 2.0)));
} else if (t_0 <= -0.02) {
tmp = t_1;
} else {
tmp = U + (J * ((0.3333333333333333 * pow(l, 3.0)) + (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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = cos((k / 2.0d0))
t_1 = u + (2.0d0 * (j * (l + (l * ((-0.125d0) * (k * k))))))
if (t_0 <= (-0.535d0)) then
tmp = t_1
else if (t_0 <= (-0.35d0)) then
tmp = u + (t_0 * (j * (l * 2.0d0)))
else if (t_0 <= (-0.02d0)) then
tmp = t_1
else
tmp = u + (j * ((0.3333333333333333d0 * (l ** 3.0d0)) + (l * 2.0d0)))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = Math.cos((K / 2.0));
double t_1 = U + (2.0 * (J * (l + (l * (-0.125 * (K * K))))));
double tmp;
if (t_0 <= -0.535) {
tmp = t_1;
} else if (t_0 <= -0.35) {
tmp = U + (t_0 * (J * (l * 2.0)));
} else if (t_0 <= -0.02) {
tmp = t_1;
} else {
tmp = U + (J * ((0.3333333333333333 * Math.pow(l, 3.0)) + (l * 2.0)));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K / 2.0)) t_1 = U + (2.0 * (J * (l + (l * (-0.125 * (K * K)))))) tmp = 0 if t_0 <= -0.535: tmp = t_1 elif t_0 <= -0.35: tmp = U + (t_0 * (J * (l * 2.0))) elif t_0 <= -0.02: tmp = t_1 else: tmp = U + (J * ((0.3333333333333333 * math.pow(l, 3.0)) + (l * 2.0))) return tmp
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) t_1 = Float64(U + Float64(2.0 * Float64(J * Float64(l + Float64(l * Float64(-0.125 * Float64(K * K))))))) tmp = 0.0 if (t_0 <= -0.535) tmp = t_1; elseif (t_0 <= -0.35) tmp = Float64(U + Float64(t_0 * Float64(J * Float64(l * 2.0)))); elseif (t_0 <= -0.02) tmp = t_1; else tmp = Float64(U + Float64(J * Float64(Float64(0.3333333333333333 * (l ^ 3.0)) + Float64(l * 2.0)))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = cos((K / 2.0)); t_1 = U + (2.0 * (J * (l + (l * (-0.125 * (K * K)))))); tmp = 0.0; if (t_0 <= -0.535) tmp = t_1; elseif (t_0 <= -0.35) tmp = U + (t_0 * (J * (l * 2.0))); elseif (t_0 <= -0.02) tmp = t_1; else tmp = U + (J * ((0.3333333333333333 * (l ^ 3.0)) + (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[(U + N[(2.0 * N[(J * N[(l + N[(l * N[(-0.125 * N[(K * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -0.535], t$95$1, If[LessEqual[t$95$0, -0.35], N[(U + N[(t$95$0 * N[(J * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, -0.02], t$95$1, N[(U + N[(J * N[(N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision] + N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
t_1 := U + 2 \cdot \left(J \cdot \left(\ell + \ell \cdot \left(-0.125 \cdot \left(K \cdot K\right)\right)\right)\right)\\
\mathbf{if}\;t_0 \leq -0.535:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t_0 \leq -0.35:\\
\;\;\;\;U + t_0 \cdot \left(J \cdot \left(\ell \cdot 2\right)\right)\\
\mathbf{elif}\;t_0 \leq -0.02:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K 2)) < -0.535000000000000031 or -0.34999999999999998 < (cos.f64 (/.f64 K 2)) < -0.0200000000000000004Initial program 90.6%
Taylor expanded in l around 0 48.8%
Taylor expanded in K around 0 67.2%
associate-*r*67.2%
unpow267.2%
Simplified67.2%
if -0.535000000000000031 < (cos.f64 (/.f64 K 2)) < -0.34999999999999998Initial program 82.1%
Taylor expanded in l around 0 65.6%
if -0.0200000000000000004 < (cos.f64 (/.f64 K 2)) Initial program 86.5%
Taylor expanded in l around 0 88.8%
Taylor expanded in K around 0 84.8%
Final simplification79.8%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (* K 0.5)))
(t_1 (+ U (* 0.3333333333333333 (* t_0 (* J (pow l 3.0))))))
(t_2 (+ (* (- (exp l) (exp (- l))) J) U)))
(if (<= l -1e+77)
t_1
(if (<= l -0.035)
t_2
(if (<= l 15500.0)
(+ U (* J (* t_0 (+ (* 0.3333333333333333 (pow l 3.0)) (* l 2.0)))))
(if (<= l 2.2e+100) t_2 t_1))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K * 0.5));
double t_1 = U + (0.3333333333333333 * (t_0 * (J * pow(l, 3.0))));
double t_2 = ((exp(l) - exp(-l)) * J) + U;
double tmp;
if (l <= -1e+77) {
tmp = t_1;
} else if (l <= -0.035) {
tmp = t_2;
} else if (l <= 15500.0) {
tmp = U + (J * (t_0 * ((0.3333333333333333 * pow(l, 3.0)) + (l * 2.0))));
} else if (l <= 2.2e+100) {
tmp = t_2;
} else {
tmp = t_1;
}
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) :: t_2
real(8) :: tmp
t_0 = cos((k * 0.5d0))
t_1 = u + (0.3333333333333333d0 * (t_0 * (j * (l ** 3.0d0))))
t_2 = ((exp(l) - exp(-l)) * j) + u
if (l <= (-1d+77)) then
tmp = t_1
else if (l <= (-0.035d0)) then
tmp = t_2
else if (l <= 15500.0d0) then
tmp = u + (j * (t_0 * ((0.3333333333333333d0 * (l ** 3.0d0)) + (l * 2.0d0))))
else if (l <= 2.2d+100) then
tmp = t_2
else
tmp = t_1
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = Math.cos((K * 0.5));
double t_1 = U + (0.3333333333333333 * (t_0 * (J * Math.pow(l, 3.0))));
double t_2 = ((Math.exp(l) - Math.exp(-l)) * J) + U;
double tmp;
if (l <= -1e+77) {
tmp = t_1;
} else if (l <= -0.035) {
tmp = t_2;
} else if (l <= 15500.0) {
tmp = U + (J * (t_0 * ((0.3333333333333333 * Math.pow(l, 3.0)) + (l * 2.0))));
} else if (l <= 2.2e+100) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K * 0.5)) t_1 = U + (0.3333333333333333 * (t_0 * (J * math.pow(l, 3.0)))) t_2 = ((math.exp(l) - math.exp(-l)) * J) + U tmp = 0 if l <= -1e+77: tmp = t_1 elif l <= -0.035: tmp = t_2 elif l <= 15500.0: tmp = U + (J * (t_0 * ((0.3333333333333333 * math.pow(l, 3.0)) + (l * 2.0)))) elif l <= 2.2e+100: tmp = t_2 else: tmp = t_1 return tmp
function code(J, l, K, U) t_0 = cos(Float64(K * 0.5)) t_1 = Float64(U + Float64(0.3333333333333333 * Float64(t_0 * Float64(J * (l ^ 3.0))))) t_2 = Float64(Float64(Float64(exp(l) - exp(Float64(-l))) * J) + U) tmp = 0.0 if (l <= -1e+77) tmp = t_1; elseif (l <= -0.035) tmp = t_2; elseif (l <= 15500.0) tmp = Float64(U + Float64(J * Float64(t_0 * Float64(Float64(0.3333333333333333 * (l ^ 3.0)) + Float64(l * 2.0))))); elseif (l <= 2.2e+100) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = cos((K * 0.5)); t_1 = U + (0.3333333333333333 * (t_0 * (J * (l ^ 3.0)))); t_2 = ((exp(l) - exp(-l)) * J) + U; tmp = 0.0; if (l <= -1e+77) tmp = t_1; elseif (l <= -0.035) tmp = t_2; elseif (l <= 15500.0) tmp = U + (J * (t_0 * ((0.3333333333333333 * (l ^ 3.0)) + (l * 2.0)))); elseif (l <= 2.2e+100) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(U + N[(0.3333333333333333 * N[(t$95$0 * N[(J * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision] + U), $MachinePrecision]}, If[LessEqual[l, -1e+77], t$95$1, If[LessEqual[l, -0.035], t$95$2, If[LessEqual[l, 15500.0], N[(U + N[(J * N[(t$95$0 * N[(N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision] + N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.2e+100], t$95$2, t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(K \cdot 0.5\right)\\
t_1 := U + 0.3333333333333333 \cdot \left(t_0 \cdot \left(J \cdot {\ell}^{3}\right)\right)\\
t_2 := \left(e^{\ell} - e^{-\ell}\right) \cdot J + U\\
\mathbf{if}\;\ell \leq -1 \cdot 10^{+77}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\ell \leq -0.035:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\ell \leq 15500:\\
\;\;\;\;U + J \cdot \left(t_0 \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right)\right)\\
\mathbf{elif}\;\ell \leq 2.2 \cdot 10^{+100}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if l < -9.99999999999999983e76 or 2.2000000000000001e100 < l Initial program 100.0%
Taylor expanded in l around 0 95.2%
Taylor expanded in l around inf 95.2%
associate-*r*95.2%
Simplified95.2%
if -9.99999999999999983e76 < l < -0.035000000000000003 or 15500 < l < 2.2000000000000001e100Initial program 100.0%
Taylor expanded in K around 0 75.8%
if -0.035000000000000003 < l < 15500Initial program 74.3%
Taylor expanded in l around 0 98.6%
Taylor expanded in J around 0 98.6%
Final simplification94.4%
(FPCore (J l K U)
:precision binary64
(let* ((t_0
(+ U (* 0.3333333333333333 (* (cos (* K 0.5)) (* J (pow l 3.0))))))
(t_1 (+ (* (- (exp l) (exp (- l))) J) U)))
(if (<= l -1e+77)
t_0
(if (<= l -0.23)
t_1
(if (<= l 15500.0)
(+
U
(*
(cos (/ K 2.0))
(* J (+ (* 0.3333333333333333 (pow l 3.0)) (* l 2.0)))))
(if (<= l 1.8e+100) t_1 t_0))))))
double code(double J, double l, double K, double U) {
double t_0 = U + (0.3333333333333333 * (cos((K * 0.5)) * (J * pow(l, 3.0))));
double t_1 = ((exp(l) - exp(-l)) * J) + U;
double tmp;
if (l <= -1e+77) {
tmp = t_0;
} else if (l <= -0.23) {
tmp = t_1;
} else if (l <= 15500.0) {
tmp = U + (cos((K / 2.0)) * (J * ((0.3333333333333333 * pow(l, 3.0)) + (l * 2.0))));
} else if (l <= 1.8e+100) {
tmp = t_1;
} 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 + (0.3333333333333333d0 * (cos((k * 0.5d0)) * (j * (l ** 3.0d0))))
t_1 = ((exp(l) - exp(-l)) * j) + u
if (l <= (-1d+77)) then
tmp = t_0
else if (l <= (-0.23d0)) then
tmp = t_1
else if (l <= 15500.0d0) then
tmp = u + (cos((k / 2.0d0)) * (j * ((0.3333333333333333d0 * (l ** 3.0d0)) + (l * 2.0d0))))
else if (l <= 1.8d+100) then
tmp = t_1
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 + (0.3333333333333333 * (Math.cos((K * 0.5)) * (J * Math.pow(l, 3.0))));
double t_1 = ((Math.exp(l) - Math.exp(-l)) * J) + U;
double tmp;
if (l <= -1e+77) {
tmp = t_0;
} else if (l <= -0.23) {
tmp = t_1;
} else if (l <= 15500.0) {
tmp = U + (Math.cos((K / 2.0)) * (J * ((0.3333333333333333 * Math.pow(l, 3.0)) + (l * 2.0))));
} else if (l <= 1.8e+100) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(J, l, K, U): t_0 = U + (0.3333333333333333 * (math.cos((K * 0.5)) * (J * math.pow(l, 3.0)))) t_1 = ((math.exp(l) - math.exp(-l)) * J) + U tmp = 0 if l <= -1e+77: tmp = t_0 elif l <= -0.23: tmp = t_1 elif l <= 15500.0: tmp = U + (math.cos((K / 2.0)) * (J * ((0.3333333333333333 * math.pow(l, 3.0)) + (l * 2.0)))) elif l <= 1.8e+100: tmp = t_1 else: tmp = t_0 return tmp
function code(J, l, K, U) t_0 = Float64(U + Float64(0.3333333333333333 * Float64(cos(Float64(K * 0.5)) * Float64(J * (l ^ 3.0))))) t_1 = Float64(Float64(Float64(exp(l) - exp(Float64(-l))) * J) + U) tmp = 0.0 if (l <= -1e+77) tmp = t_0; elseif (l <= -0.23) tmp = t_1; elseif (l <= 15500.0) tmp = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(J * Float64(Float64(0.3333333333333333 * (l ^ 3.0)) + Float64(l * 2.0))))); elseif (l <= 1.8e+100) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = U + (0.3333333333333333 * (cos((K * 0.5)) * (J * (l ^ 3.0)))); t_1 = ((exp(l) - exp(-l)) * J) + U; tmp = 0.0; if (l <= -1e+77) tmp = t_0; elseif (l <= -0.23) tmp = t_1; elseif (l <= 15500.0) tmp = U + (cos((K / 2.0)) * (J * ((0.3333333333333333 * (l ^ 3.0)) + (l * 2.0)))); elseif (l <= 1.8e+100) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(U + N[(0.3333333333333333 * N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * N[(J * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision] + U), $MachinePrecision]}, If[LessEqual[l, -1e+77], t$95$0, If[LessEqual[l, -0.23], t$95$1, If[LessEqual[l, 15500.0], N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(J * N[(N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision] + N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.8e+100], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + 0.3333333333333333 \cdot \left(\cos \left(K \cdot 0.5\right) \cdot \left(J \cdot {\ell}^{3}\right)\right)\\
t_1 := \left(e^{\ell} - e^{-\ell}\right) \cdot J + U\\
\mathbf{if}\;\ell \leq -1 \cdot 10^{+77}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq -0.23:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\ell \leq 15500:\\
\;\;\;\;U + \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right)\right)\\
\mathbf{elif}\;\ell \leq 1.8 \cdot 10^{+100}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if l < -9.99999999999999983e76 or 1.8e100 < l Initial program 100.0%
Taylor expanded in l around 0 95.2%
Taylor expanded in l around inf 95.2%
associate-*r*95.2%
Simplified95.2%
if -9.99999999999999983e76 < l < -0.23000000000000001 or 15500 < l < 1.8e100Initial program 100.0%
Taylor expanded in K around 0 75.8%
if -0.23000000000000001 < l < 15500Initial program 74.3%
Taylor expanded in l around 0 98.6%
Final simplification94.4%
(FPCore (J l K U)
:precision binary64
(let* ((t_0
(+ U (* 0.3333333333333333 (* (cos (* K 0.5)) (* J (pow l 3.0))))))
(t_1 (+ (* (- (exp l) (exp (- l))) J) U)))
(if (<= l -1e+77)
t_0
(if (<= l -8.4e-5)
t_1
(if (<= l 15500.0)
(+ U (* (cos (/ K 2.0)) (* J (* l 2.0))))
(if (<= l 1.8e+100) t_1 t_0))))))
double code(double J, double l, double K, double U) {
double t_0 = U + (0.3333333333333333 * (cos((K * 0.5)) * (J * pow(l, 3.0))));
double t_1 = ((exp(l) - exp(-l)) * J) + U;
double tmp;
if (l <= -1e+77) {
tmp = t_0;
} else if (l <= -8.4e-5) {
tmp = t_1;
} else if (l <= 15500.0) {
tmp = U + (cos((K / 2.0)) * (J * (l * 2.0)));
} else if (l <= 1.8e+100) {
tmp = t_1;
} 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 + (0.3333333333333333d0 * (cos((k * 0.5d0)) * (j * (l ** 3.0d0))))
t_1 = ((exp(l) - exp(-l)) * j) + u
if (l <= (-1d+77)) then
tmp = t_0
else if (l <= (-8.4d-5)) then
tmp = t_1
else if (l <= 15500.0d0) then
tmp = u + (cos((k / 2.0d0)) * (j * (l * 2.0d0)))
else if (l <= 1.8d+100) then
tmp = t_1
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 + (0.3333333333333333 * (Math.cos((K * 0.5)) * (J * Math.pow(l, 3.0))));
double t_1 = ((Math.exp(l) - Math.exp(-l)) * J) + U;
double tmp;
if (l <= -1e+77) {
tmp = t_0;
} else if (l <= -8.4e-5) {
tmp = t_1;
} else if (l <= 15500.0) {
tmp = U + (Math.cos((K / 2.0)) * (J * (l * 2.0)));
} else if (l <= 1.8e+100) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(J, l, K, U): t_0 = U + (0.3333333333333333 * (math.cos((K * 0.5)) * (J * math.pow(l, 3.0)))) t_1 = ((math.exp(l) - math.exp(-l)) * J) + U tmp = 0 if l <= -1e+77: tmp = t_0 elif l <= -8.4e-5: tmp = t_1 elif l <= 15500.0: tmp = U + (math.cos((K / 2.0)) * (J * (l * 2.0))) elif l <= 1.8e+100: tmp = t_1 else: tmp = t_0 return tmp
function code(J, l, K, U) t_0 = Float64(U + Float64(0.3333333333333333 * Float64(cos(Float64(K * 0.5)) * Float64(J * (l ^ 3.0))))) t_1 = Float64(Float64(Float64(exp(l) - exp(Float64(-l))) * J) + U) tmp = 0.0 if (l <= -1e+77) tmp = t_0; elseif (l <= -8.4e-5) tmp = t_1; elseif (l <= 15500.0) tmp = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(J * Float64(l * 2.0)))); elseif (l <= 1.8e+100) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = U + (0.3333333333333333 * (cos((K * 0.5)) * (J * (l ^ 3.0)))); t_1 = ((exp(l) - exp(-l)) * J) + U; tmp = 0.0; if (l <= -1e+77) tmp = t_0; elseif (l <= -8.4e-5) tmp = t_1; elseif (l <= 15500.0) tmp = U + (cos((K / 2.0)) * (J * (l * 2.0))); elseif (l <= 1.8e+100) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(U + N[(0.3333333333333333 * N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * N[(J * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision] + U), $MachinePrecision]}, If[LessEqual[l, -1e+77], t$95$0, If[LessEqual[l, -8.4e-5], t$95$1, If[LessEqual[l, 15500.0], N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(J * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.8e+100], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + 0.3333333333333333 \cdot \left(\cos \left(K \cdot 0.5\right) \cdot \left(J \cdot {\ell}^{3}\right)\right)\\
t_1 := \left(e^{\ell} - e^{-\ell}\right) \cdot J + U\\
\mathbf{if}\;\ell \leq -1 \cdot 10^{+77}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq -8.4 \cdot 10^{-5}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\ell \leq 15500:\\
\;\;\;\;U + \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(\ell \cdot 2\right)\right)\\
\mathbf{elif}\;\ell \leq 1.8 \cdot 10^{+100}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if l < -9.99999999999999983e76 or 1.8e100 < l Initial program 100.0%
Taylor expanded in l around 0 95.2%
Taylor expanded in l around inf 95.2%
associate-*r*95.2%
Simplified95.2%
if -9.99999999999999983e76 < l < -8.39999999999999954e-5 or 15500 < l < 1.8e100Initial program 99.6%
Taylor expanded in K around 0 76.0%
if -8.39999999999999954e-5 < l < 15500Initial program 74.2%
Taylor expanded in l around 0 98.2%
Final simplification94.1%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.02) (+ U (* 2.0 (* J (+ l (* l (* -0.125 (* K K))))))) (+ U (* 0.3333333333333333 (* J (pow l 3.0))))))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.02) {
tmp = U + (2.0 * (J * (l + (l * (-0.125 * (K * K))))));
} else {
tmp = U + (0.3333333333333333 * (J * pow(l, 3.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.02d0)) then
tmp = u + (2.0d0 * (j * (l + (l * ((-0.125d0) * (k * k))))))
else
tmp = u + (0.3333333333333333d0 * (j * (l ** 3.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.02) {
tmp = U + (2.0 * (J * (l + (l * (-0.125 * (K * K))))));
} else {
tmp = U + (0.3333333333333333 * (J * Math.pow(l, 3.0)));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if math.cos((K / 2.0)) <= -0.02: tmp = U + (2.0 * (J * (l + (l * (-0.125 * (K * K)))))) else: tmp = U + (0.3333333333333333 * (J * math.pow(l, 3.0))) return tmp
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.02) tmp = Float64(U + Float64(2.0 * Float64(J * Float64(l + Float64(l * Float64(-0.125 * Float64(K * K))))))); else tmp = Float64(U + Float64(0.3333333333333333 * Float64(J * (l ^ 3.0)))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (cos((K / 2.0)) <= -0.02) tmp = U + (2.0 * (J * (l + (l * (-0.125 * (K * K)))))); else tmp = U + (0.3333333333333333 * (J * (l ^ 3.0))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.02], N[(U + N[(2.0 * N[(J * N[(l + N[(l * N[(-0.125 * N[(K * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(0.3333333333333333 * N[(J * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.02:\\
\;\;\;\;U + 2 \cdot \left(J \cdot \left(\ell + \ell \cdot \left(-0.125 \cdot \left(K \cdot K\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + 0.3333333333333333 \cdot \left(J \cdot {\ell}^{3}\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K 2)) < -0.0200000000000000004Initial program 89.5%
Taylor expanded in l around 0 50.9%
Taylor expanded in K around 0 60.5%
associate-*r*60.5%
unpow260.5%
Simplified60.5%
if -0.0200000000000000004 < (cos.f64 (/.f64 K 2)) Initial program 86.5%
Taylor expanded in l around 0 88.8%
Taylor expanded in l around inf 74.0%
associate-*r*74.0%
Simplified74.0%
Taylor expanded in K around 0 74.0%
Final simplification70.2%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (+ U (* J (+ (* (* K K) -64.0) 512.0))))
(t_1 (+ U (* 2.0 (* J (+ l (* l (* -0.125 (* K K))))))))
(t_2 (+ U (* 0.3333333333333333 (* J (pow l 3.0))))))
(if (<= l -1.4e+101)
t_2
(if (<= l -6e+77)
t_1
(if (<= l -1.25e+41)
t_0
(if (<= l -50000000000.0)
(* U U)
(if (<= l -8.4e-5)
t_0
(if (<= l 190000.0)
(+ U (* 2.0 (* J (* l (cos (* K 0.5))))))
(if (or (<= l 1.45e+200) (not (<= l 5e+251))) t_2 t_1)))))))))
double code(double J, double l, double K, double U) {
double t_0 = U + (J * (((K * K) * -64.0) + 512.0));
double t_1 = U + (2.0 * (J * (l + (l * (-0.125 * (K * K))))));
double t_2 = U + (0.3333333333333333 * (J * pow(l, 3.0)));
double tmp;
if (l <= -1.4e+101) {
tmp = t_2;
} else if (l <= -6e+77) {
tmp = t_1;
} else if (l <= -1.25e+41) {
tmp = t_0;
} else if (l <= -50000000000.0) {
tmp = U * U;
} else if (l <= -8.4e-5) {
tmp = t_0;
} else if (l <= 190000.0) {
tmp = U + (2.0 * (J * (l * cos((K * 0.5)))));
} else if ((l <= 1.45e+200) || !(l <= 5e+251)) {
tmp = t_2;
} else {
tmp = t_1;
}
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) :: t_2
real(8) :: tmp
t_0 = u + (j * (((k * k) * (-64.0d0)) + 512.0d0))
t_1 = u + (2.0d0 * (j * (l + (l * ((-0.125d0) * (k * k))))))
t_2 = u + (0.3333333333333333d0 * (j * (l ** 3.0d0)))
if (l <= (-1.4d+101)) then
tmp = t_2
else if (l <= (-6d+77)) then
tmp = t_1
else if (l <= (-1.25d+41)) then
tmp = t_0
else if (l <= (-50000000000.0d0)) then
tmp = u * u
else if (l <= (-8.4d-5)) then
tmp = t_0
else if (l <= 190000.0d0) then
tmp = u + (2.0d0 * (j * (l * cos((k * 0.5d0)))))
else if ((l <= 1.45d+200) .or. (.not. (l <= 5d+251))) then
tmp = t_2
else
tmp = t_1
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = U + (J * (((K * K) * -64.0) + 512.0));
double t_1 = U + (2.0 * (J * (l + (l * (-0.125 * (K * K))))));
double t_2 = U + (0.3333333333333333 * (J * Math.pow(l, 3.0)));
double tmp;
if (l <= -1.4e+101) {
tmp = t_2;
} else if (l <= -6e+77) {
tmp = t_1;
} else if (l <= -1.25e+41) {
tmp = t_0;
} else if (l <= -50000000000.0) {
tmp = U * U;
} else if (l <= -8.4e-5) {
tmp = t_0;
} else if (l <= 190000.0) {
tmp = U + (2.0 * (J * (l * Math.cos((K * 0.5)))));
} else if ((l <= 1.45e+200) || !(l <= 5e+251)) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(J, l, K, U): t_0 = U + (J * (((K * K) * -64.0) + 512.0)) t_1 = U + (2.0 * (J * (l + (l * (-0.125 * (K * K)))))) t_2 = U + (0.3333333333333333 * (J * math.pow(l, 3.0))) tmp = 0 if l <= -1.4e+101: tmp = t_2 elif l <= -6e+77: tmp = t_1 elif l <= -1.25e+41: tmp = t_0 elif l <= -50000000000.0: tmp = U * U elif l <= -8.4e-5: tmp = t_0 elif l <= 190000.0: tmp = U + (2.0 * (J * (l * math.cos((K * 0.5))))) elif (l <= 1.45e+200) or not (l <= 5e+251): tmp = t_2 else: tmp = t_1 return tmp
function code(J, l, K, U) t_0 = Float64(U + Float64(J * Float64(Float64(Float64(K * K) * -64.0) + 512.0))) t_1 = Float64(U + Float64(2.0 * Float64(J * Float64(l + Float64(l * Float64(-0.125 * Float64(K * K))))))) t_2 = Float64(U + Float64(0.3333333333333333 * Float64(J * (l ^ 3.0)))) tmp = 0.0 if (l <= -1.4e+101) tmp = t_2; elseif (l <= -6e+77) tmp = t_1; elseif (l <= -1.25e+41) tmp = t_0; elseif (l <= -50000000000.0) tmp = Float64(U * U); elseif (l <= -8.4e-5) tmp = t_0; elseif (l <= 190000.0) tmp = Float64(U + Float64(2.0 * Float64(J * Float64(l * cos(Float64(K * 0.5)))))); elseif ((l <= 1.45e+200) || !(l <= 5e+251)) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = U + (J * (((K * K) * -64.0) + 512.0)); t_1 = U + (2.0 * (J * (l + (l * (-0.125 * (K * K)))))); t_2 = U + (0.3333333333333333 * (J * (l ^ 3.0))); tmp = 0.0; if (l <= -1.4e+101) tmp = t_2; elseif (l <= -6e+77) tmp = t_1; elseif (l <= -1.25e+41) tmp = t_0; elseif (l <= -50000000000.0) tmp = U * U; elseif (l <= -8.4e-5) tmp = t_0; elseif (l <= 190000.0) tmp = U + (2.0 * (J * (l * cos((K * 0.5))))); elseif ((l <= 1.45e+200) || ~((l <= 5e+251))) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(U + N[(J * N[(N[(N[(K * K), $MachinePrecision] * -64.0), $MachinePrecision] + 512.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(U + N[(2.0 * N[(J * N[(l + N[(l * N[(-0.125 * N[(K * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(U + N[(0.3333333333333333 * N[(J * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -1.4e+101], t$95$2, If[LessEqual[l, -6e+77], t$95$1, If[LessEqual[l, -1.25e+41], t$95$0, If[LessEqual[l, -50000000000.0], N[(U * U), $MachinePrecision], If[LessEqual[l, -8.4e-5], t$95$0, If[LessEqual[l, 190000.0], N[(U + N[(2.0 * N[(J * N[(l * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[l, 1.45e+200], N[Not[LessEqual[l, 5e+251]], $MachinePrecision]], t$95$2, t$95$1]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + J \cdot \left(\left(K \cdot K\right) \cdot -64 + 512\right)\\
t_1 := U + 2 \cdot \left(J \cdot \left(\ell + \ell \cdot \left(-0.125 \cdot \left(K \cdot K\right)\right)\right)\right)\\
t_2 := U + 0.3333333333333333 \cdot \left(J \cdot {\ell}^{3}\right)\\
\mathbf{if}\;\ell \leq -1.4 \cdot 10^{+101}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\ell \leq -6 \cdot 10^{+77}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\ell \leq -1.25 \cdot 10^{+41}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq -50000000000:\\
\;\;\;\;U \cdot U\\
\mathbf{elif}\;\ell \leq -8.4 \cdot 10^{-5}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq 190000:\\
\;\;\;\;U + 2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\mathbf{elif}\;\ell \leq 1.45 \cdot 10^{+200} \lor \neg \left(\ell \leq 5 \cdot 10^{+251}\right):\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if l < -1.39999999999999991e101 or 1.9e5 < l < 1.4499999999999999e200 or 5.0000000000000005e251 < l Initial program 100.0%
Taylor expanded in l around 0 86.1%
Taylor expanded in l around inf 86.1%
associate-*r*86.1%
Simplified86.1%
Taylor expanded in K around 0 66.5%
if -1.39999999999999991e101 < l < -5.9999999999999996e77 or 1.4499999999999999e200 < l < 5.0000000000000005e251Initial program 100.0%
Taylor expanded in l around 0 24.5%
Taylor expanded in K around 0 87.1%
associate-*r*87.1%
unpow287.1%
Simplified87.1%
if -5.9999999999999996e77 < l < -1.25000000000000006e41 or -5e10 < l < -8.39999999999999954e-5Initial program 98.7%
Applied egg-rr2.2%
Taylor expanded in K around 0 46.7%
*-commutative46.7%
associate-*l*46.7%
*-commutative46.7%
distribute-lft-out46.7%
unpow246.7%
Simplified46.7%
if -1.25000000000000006e41 < l < -5e10Initial program 100.0%
associate-*l*100.0%
fma-def100.0%
Simplified100.0%
Applied egg-rr38.5%
if -8.39999999999999954e-5 < l < 1.9e5Initial program 74.2%
Taylor expanded in l around 0 98.2%
Final simplification81.4%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (+ U (* J (+ (* (* K K) -64.0) 512.0))))
(t_1 (+ U (* 2.0 (* J (+ l (* l (* -0.125 (* K K))))))))
(t_2 (+ U (* 0.3333333333333333 (* J (pow l 3.0))))))
(if (<= l -3.2e+103)
t_2
(if (<= l -4.4e+77)
t_1
(if (<= l -1.5e+39)
t_0
(if (<= l -17000000000.0)
(* U U)
(if (<= l -8.4e-5)
t_0
(if (<= l 29000.0)
(+ U (* (cos (/ K 2.0)) (* J (* l 2.0))))
(if (or (<= l 4.9e+197) (not (<= l 5e+251))) t_2 t_1)))))))))
double code(double J, double l, double K, double U) {
double t_0 = U + (J * (((K * K) * -64.0) + 512.0));
double t_1 = U + (2.0 * (J * (l + (l * (-0.125 * (K * K))))));
double t_2 = U + (0.3333333333333333 * (J * pow(l, 3.0)));
double tmp;
if (l <= -3.2e+103) {
tmp = t_2;
} else if (l <= -4.4e+77) {
tmp = t_1;
} else if (l <= -1.5e+39) {
tmp = t_0;
} else if (l <= -17000000000.0) {
tmp = U * U;
} else if (l <= -8.4e-5) {
tmp = t_0;
} else if (l <= 29000.0) {
tmp = U + (cos((K / 2.0)) * (J * (l * 2.0)));
} else if ((l <= 4.9e+197) || !(l <= 5e+251)) {
tmp = t_2;
} else {
tmp = t_1;
}
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) :: t_2
real(8) :: tmp
t_0 = u + (j * (((k * k) * (-64.0d0)) + 512.0d0))
t_1 = u + (2.0d0 * (j * (l + (l * ((-0.125d0) * (k * k))))))
t_2 = u + (0.3333333333333333d0 * (j * (l ** 3.0d0)))
if (l <= (-3.2d+103)) then
tmp = t_2
else if (l <= (-4.4d+77)) then
tmp = t_1
else if (l <= (-1.5d+39)) then
tmp = t_0
else if (l <= (-17000000000.0d0)) then
tmp = u * u
else if (l <= (-8.4d-5)) then
tmp = t_0
else if (l <= 29000.0d0) then
tmp = u + (cos((k / 2.0d0)) * (j * (l * 2.0d0)))
else if ((l <= 4.9d+197) .or. (.not. (l <= 5d+251))) then
tmp = t_2
else
tmp = t_1
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = U + (J * (((K * K) * -64.0) + 512.0));
double t_1 = U + (2.0 * (J * (l + (l * (-0.125 * (K * K))))));
double t_2 = U + (0.3333333333333333 * (J * Math.pow(l, 3.0)));
double tmp;
if (l <= -3.2e+103) {
tmp = t_2;
} else if (l <= -4.4e+77) {
tmp = t_1;
} else if (l <= -1.5e+39) {
tmp = t_0;
} else if (l <= -17000000000.0) {
tmp = U * U;
} else if (l <= -8.4e-5) {
tmp = t_0;
} else if (l <= 29000.0) {
tmp = U + (Math.cos((K / 2.0)) * (J * (l * 2.0)));
} else if ((l <= 4.9e+197) || !(l <= 5e+251)) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(J, l, K, U): t_0 = U + (J * (((K * K) * -64.0) + 512.0)) t_1 = U + (2.0 * (J * (l + (l * (-0.125 * (K * K)))))) t_2 = U + (0.3333333333333333 * (J * math.pow(l, 3.0))) tmp = 0 if l <= -3.2e+103: tmp = t_2 elif l <= -4.4e+77: tmp = t_1 elif l <= -1.5e+39: tmp = t_0 elif l <= -17000000000.0: tmp = U * U elif l <= -8.4e-5: tmp = t_0 elif l <= 29000.0: tmp = U + (math.cos((K / 2.0)) * (J * (l * 2.0))) elif (l <= 4.9e+197) or not (l <= 5e+251): tmp = t_2 else: tmp = t_1 return tmp
function code(J, l, K, U) t_0 = Float64(U + Float64(J * Float64(Float64(Float64(K * K) * -64.0) + 512.0))) t_1 = Float64(U + Float64(2.0 * Float64(J * Float64(l + Float64(l * Float64(-0.125 * Float64(K * K))))))) t_2 = Float64(U + Float64(0.3333333333333333 * Float64(J * (l ^ 3.0)))) tmp = 0.0 if (l <= -3.2e+103) tmp = t_2; elseif (l <= -4.4e+77) tmp = t_1; elseif (l <= -1.5e+39) tmp = t_0; elseif (l <= -17000000000.0) tmp = Float64(U * U); elseif (l <= -8.4e-5) tmp = t_0; elseif (l <= 29000.0) tmp = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(J * Float64(l * 2.0)))); elseif ((l <= 4.9e+197) || !(l <= 5e+251)) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = U + (J * (((K * K) * -64.0) + 512.0)); t_1 = U + (2.0 * (J * (l + (l * (-0.125 * (K * K)))))); t_2 = U + (0.3333333333333333 * (J * (l ^ 3.0))); tmp = 0.0; if (l <= -3.2e+103) tmp = t_2; elseif (l <= -4.4e+77) tmp = t_1; elseif (l <= -1.5e+39) tmp = t_0; elseif (l <= -17000000000.0) tmp = U * U; elseif (l <= -8.4e-5) tmp = t_0; elseif (l <= 29000.0) tmp = U + (cos((K / 2.0)) * (J * (l * 2.0))); elseif ((l <= 4.9e+197) || ~((l <= 5e+251))) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(U + N[(J * N[(N[(N[(K * K), $MachinePrecision] * -64.0), $MachinePrecision] + 512.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(U + N[(2.0 * N[(J * N[(l + N[(l * N[(-0.125 * N[(K * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(U + N[(0.3333333333333333 * N[(J * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -3.2e+103], t$95$2, If[LessEqual[l, -4.4e+77], t$95$1, If[LessEqual[l, -1.5e+39], t$95$0, If[LessEqual[l, -17000000000.0], N[(U * U), $MachinePrecision], If[LessEqual[l, -8.4e-5], t$95$0, If[LessEqual[l, 29000.0], N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(J * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[l, 4.9e+197], N[Not[LessEqual[l, 5e+251]], $MachinePrecision]], t$95$2, t$95$1]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + J \cdot \left(\left(K \cdot K\right) \cdot -64 + 512\right)\\
t_1 := U + 2 \cdot \left(J \cdot \left(\ell + \ell \cdot \left(-0.125 \cdot \left(K \cdot K\right)\right)\right)\right)\\
t_2 := U + 0.3333333333333333 \cdot \left(J \cdot {\ell}^{3}\right)\\
\mathbf{if}\;\ell \leq -3.2 \cdot 10^{+103}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\ell \leq -4.4 \cdot 10^{+77}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\ell \leq -1.5 \cdot 10^{+39}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq -17000000000:\\
\;\;\;\;U \cdot U\\
\mathbf{elif}\;\ell \leq -8.4 \cdot 10^{-5}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq 29000:\\
\;\;\;\;U + \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(\ell \cdot 2\right)\right)\\
\mathbf{elif}\;\ell \leq 4.9 \cdot 10^{+197} \lor \neg \left(\ell \leq 5 \cdot 10^{+251}\right):\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if l < -3.19999999999999993e103 or 29000 < l < 4.90000000000000026e197 or 5.0000000000000005e251 < l Initial program 100.0%
Taylor expanded in l around 0 86.1%
Taylor expanded in l around inf 86.1%
associate-*r*86.1%
Simplified86.1%
Taylor expanded in K around 0 66.5%
if -3.19999999999999993e103 < l < -4.4000000000000001e77 or 4.90000000000000026e197 < l < 5.0000000000000005e251Initial program 100.0%
Taylor expanded in l around 0 24.5%
Taylor expanded in K around 0 87.1%
associate-*r*87.1%
unpow287.1%
Simplified87.1%
if -4.4000000000000001e77 < l < -1.5e39 or -1.7e10 < l < -8.39999999999999954e-5Initial program 98.7%
Applied egg-rr2.2%
Taylor expanded in K around 0 46.7%
*-commutative46.7%
associate-*l*46.7%
*-commutative46.7%
distribute-lft-out46.7%
unpow246.7%
Simplified46.7%
if -1.5e39 < l < -1.7e10Initial program 100.0%
associate-*l*100.0%
fma-def100.0%
Simplified100.0%
Applied egg-rr38.5%
if -8.39999999999999954e-5 < l < 29000Initial program 74.2%
Taylor expanded in l around 0 98.2%
Final simplification81.4%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (+ U (* 2.0 (* J (+ l (* l (* -0.125 (* K K))))))))
(t_1 (+ U (* 0.3333333333333333 (* J (pow l 3.0))))))
(if (<= l -3.4e+105)
t_1
(if (<= l -4e+77)
t_0
(if (<= l -1.25e+39)
(+ U (* J (+ (* (* K K) -64.0) 512.0)))
(if (<= l -50000000000.0)
(* U U)
(if (<= l -8.4e-5)
(+ U (fma J 0.125 (* (* K K) (* J -0.015625))))
(if (<= l 210000.0)
(+ U (* (cos (/ K 2.0)) (* J (* l 2.0))))
(if (or (<= l 4.9e+197) (not (<= l 5e+251))) t_1 t_0)))))))))
double code(double J, double l, double K, double U) {
double t_0 = U + (2.0 * (J * (l + (l * (-0.125 * (K * K))))));
double t_1 = U + (0.3333333333333333 * (J * pow(l, 3.0)));
double tmp;
if (l <= -3.4e+105) {
tmp = t_1;
} else if (l <= -4e+77) {
tmp = t_0;
} else if (l <= -1.25e+39) {
tmp = U + (J * (((K * K) * -64.0) + 512.0));
} else if (l <= -50000000000.0) {
tmp = U * U;
} else if (l <= -8.4e-5) {
tmp = U + fma(J, 0.125, ((K * K) * (J * -0.015625)));
} else if (l <= 210000.0) {
tmp = U + (cos((K / 2.0)) * (J * (l * 2.0)));
} else if ((l <= 4.9e+197) || !(l <= 5e+251)) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
function code(J, l, K, U) t_0 = Float64(U + Float64(2.0 * Float64(J * Float64(l + Float64(l * Float64(-0.125 * Float64(K * K))))))) t_1 = Float64(U + Float64(0.3333333333333333 * Float64(J * (l ^ 3.0)))) tmp = 0.0 if (l <= -3.4e+105) tmp = t_1; elseif (l <= -4e+77) tmp = t_0; elseif (l <= -1.25e+39) tmp = Float64(U + Float64(J * Float64(Float64(Float64(K * K) * -64.0) + 512.0))); elseif (l <= -50000000000.0) tmp = Float64(U * U); elseif (l <= -8.4e-5) tmp = Float64(U + fma(J, 0.125, Float64(Float64(K * K) * Float64(J * -0.015625)))); elseif (l <= 210000.0) tmp = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(J * Float64(l * 2.0)))); elseif ((l <= 4.9e+197) || !(l <= 5e+251)) tmp = t_1; else tmp = t_0; end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(U + N[(2.0 * N[(J * N[(l + N[(l * N[(-0.125 * N[(K * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(U + N[(0.3333333333333333 * N[(J * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -3.4e+105], t$95$1, If[LessEqual[l, -4e+77], t$95$0, If[LessEqual[l, -1.25e+39], N[(U + N[(J * N[(N[(N[(K * K), $MachinePrecision] * -64.0), $MachinePrecision] + 512.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -50000000000.0], N[(U * U), $MachinePrecision], If[LessEqual[l, -8.4e-5], N[(U + N[(J * 0.125 + N[(N[(K * K), $MachinePrecision] * N[(J * -0.015625), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 210000.0], N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(J * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[l, 4.9e+197], N[Not[LessEqual[l, 5e+251]], $MachinePrecision]], t$95$1, t$95$0]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + 2 \cdot \left(J \cdot \left(\ell + \ell \cdot \left(-0.125 \cdot \left(K \cdot K\right)\right)\right)\right)\\
t_1 := U + 0.3333333333333333 \cdot \left(J \cdot {\ell}^{3}\right)\\
\mathbf{if}\;\ell \leq -3.4 \cdot 10^{+105}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\ell \leq -4 \cdot 10^{+77}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq -1.25 \cdot 10^{+39}:\\
\;\;\;\;U + J \cdot \left(\left(K \cdot K\right) \cdot -64 + 512\right)\\
\mathbf{elif}\;\ell \leq -50000000000:\\
\;\;\;\;U \cdot U\\
\mathbf{elif}\;\ell \leq -8.4 \cdot 10^{-5}:\\
\;\;\;\;U + \mathsf{fma}\left(J, 0.125, \left(K \cdot K\right) \cdot \left(J \cdot -0.015625\right)\right)\\
\mathbf{elif}\;\ell \leq 210000:\\
\;\;\;\;U + \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(\ell \cdot 2\right)\right)\\
\mathbf{elif}\;\ell \leq 4.9 \cdot 10^{+197} \lor \neg \left(\ell \leq 5 \cdot 10^{+251}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if l < -3.3999999999999999e105 or 2.1e5 < l < 4.90000000000000026e197 or 5.0000000000000005e251 < l Initial program 100.0%
Taylor expanded in l around 0 86.1%
Taylor expanded in l around inf 86.1%
associate-*r*86.1%
Simplified86.1%
Taylor expanded in K around 0 66.5%
if -3.3999999999999999e105 < l < -3.99999999999999993e77 or 4.90000000000000026e197 < l < 5.0000000000000005e251Initial program 100.0%
Taylor expanded in l around 0 24.5%
Taylor expanded in K around 0 87.1%
associate-*r*87.1%
unpow287.1%
Simplified87.1%
if -3.99999999999999993e77 < l < -1.25000000000000004e39Initial program 100.0%
Applied egg-rr2.7%
Taylor expanded in K around 0 51.4%
*-commutative51.4%
associate-*l*51.4%
*-commutative51.4%
distribute-lft-out51.4%
unpow251.4%
Simplified51.4%
if -1.25000000000000004e39 < l < -5e10Initial program 100.0%
associate-*l*100.0%
fma-def100.0%
Simplified100.0%
Applied egg-rr38.5%
if -5e10 < l < -8.39999999999999954e-5Initial program 95.1%
Applied egg-rr0.8%
Taylor expanded in K around 0 34.1%
+-commutative34.1%
*-commutative34.1%
fma-def34.1%
*-commutative34.1%
*-commutative34.1%
associate-*l*34.1%
unpow234.1%
Simplified34.1%
if -8.39999999999999954e-5 < l < 2.1e5Initial program 74.2%
Taylor expanded in l around 0 98.2%
Final simplification81.4%
(FPCore (J l K U) :precision binary64 (if (or (<= l -1e+20) (not (<= l 75.0))) (+ U (* 2.0 (* J (+ l (* l (* -0.125 (* K K))))))) (+ U (* J (* l 2.0)))))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -1e+20) || !(l <= 75.0)) {
tmp = U + (2.0 * (J * (l + (l * (-0.125 * (K * K))))));
} 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 <= (-1d+20)) .or. (.not. (l <= 75.0d0))) then
tmp = u + (2.0d0 * (j * (l + (l * ((-0.125d0) * (k * k))))))
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 <= -1e+20) || !(l <= 75.0)) {
tmp = U + (2.0 * (J * (l + (l * (-0.125 * (K * K))))));
} else {
tmp = U + (J * (l * 2.0));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -1e+20) or not (l <= 75.0): tmp = U + (2.0 * (J * (l + (l * (-0.125 * (K * K)))))) else: tmp = U + (J * (l * 2.0)) return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -1e+20) || !(l <= 75.0)) tmp = Float64(U + Float64(2.0 * Float64(J * Float64(l + Float64(l * Float64(-0.125 * Float64(K * K))))))); 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 <= -1e+20) || ~((l <= 75.0))) tmp = U + (2.0 * (J * (l + (l * (-0.125 * (K * K)))))); else tmp = U + (J * (l * 2.0)); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -1e+20], N[Not[LessEqual[l, 75.0]], $MachinePrecision]], N[(U + N[(2.0 * N[(J * N[(l + N[(l * N[(-0.125 * N[(K * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1 \cdot 10^{+20} \lor \neg \left(\ell \leq 75\right):\\
\;\;\;\;U + 2 \cdot \left(J \cdot \left(\ell + \ell \cdot \left(-0.125 \cdot \left(K \cdot K\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(\ell \cdot 2\right)\\
\end{array}
\end{array}
if l < -1e20 or 75 < l Initial program 100.0%
Taylor expanded in l around 0 26.5%
Taylor expanded in K around 0 43.2%
associate-*r*43.2%
unpow243.2%
Simplified43.2%
if -1e20 < l < 75Initial program 75.3%
Taylor expanded in K around 0 72.2%
Taylor expanded in l around 0 82.0%
Final simplification63.1%
(FPCore (J l K U) :precision binary64 (if (<= l -8.4e-5) (* U U) (if (<= l 0.38) U (* U U))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -8.4e-5) {
tmp = U * U;
} else if (l <= 0.38) {
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 <= (-8.4d-5)) then
tmp = u * u
else if (l <= 0.38d0) 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 <= -8.4e-5) {
tmp = U * U;
} else if (l <= 0.38) {
tmp = U;
} else {
tmp = U * U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -8.4e-5: tmp = U * U elif l <= 0.38: tmp = U else: tmp = U * U return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -8.4e-5) tmp = Float64(U * U); elseif (l <= 0.38) tmp = U; else tmp = Float64(U * U); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -8.4e-5) tmp = U * U; elseif (l <= 0.38) tmp = U; else tmp = U * U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -8.4e-5], N[(U * U), $MachinePrecision], If[LessEqual[l, 0.38], U, N[(U * U), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -8.4 \cdot 10^{-5}:\\
\;\;\;\;U \cdot U\\
\mathbf{elif}\;\ell \leq 0.38:\\
\;\;\;\;U\\
\mathbf{else}:\\
\;\;\;\;U \cdot U\\
\end{array}
\end{array}
if l < -8.39999999999999954e-5 or 0.38 < l Initial program 99.9%
associate-*l*99.9%
fma-def99.9%
Simplified99.9%
Applied egg-rr18.1%
if -8.39999999999999954e-5 < l < 0.38Initial program 73.8%
associate-*l*73.8%
fma-def73.8%
Simplified73.8%
Taylor expanded in J around 0 71.2%
Final simplification43.6%
(FPCore (J l K U) :precision binary64 (+ U (* J (* l 2.0))))
double code(double J, double l, double K, double U) {
return U + (J * (l * 2.0));
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = u + (j * (l * 2.0d0))
end function
public static double code(double J, double l, double K, double U) {
return U + (J * (l * 2.0));
}
def code(J, l, K, U): return U + (J * (l * 2.0))
function code(J, l, K, U) return Float64(U + Float64(J * Float64(l * 2.0))) end
function tmp = code(J, l, K, U) tmp = U + (J * (l * 2.0)); end
code[J_, l_, K_, U_] := N[(U + N[(J * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + J \cdot \left(\ell \cdot 2\right)
\end{array}
Initial program 87.4%
Taylor expanded in K around 0 70.5%
Taylor expanded in l around 0 52.9%
Final simplification52.9%
(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 87.4%
associate-*l*87.4%
fma-def87.4%
Simplified87.4%
Applied egg-rr3.0%
*-inverses3.0%
Simplified3.0%
Final simplification3.0%
(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.4%
associate-*l*87.4%
fma-def87.4%
Simplified87.4%
Taylor expanded in J around 0 35.4%
Final simplification35.4%
herbie shell --seed 2023285
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))