
(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) (exp (- l)))))
(if (or (<= t_1 (- INFINITY)) (not (<= t_1 2e-15)))
(+ (* (* t_1 J) t_0) U)
(+
U
(*
t_0
(*
J
(+
(* 0.3333333333333333 (pow l 3.0))
(+ (* 0.016666666666666666 (pow l 5.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 <= 2e-15)) {
tmp = ((t_1 * J) * t_0) + U;
} else {
tmp = U + (t_0 * (J * ((0.3333333333333333 * pow(l, 3.0)) + ((0.016666666666666666 * pow(l, 5.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 <= 2e-15)) {
tmp = ((t_1 * J) * t_0) + U;
} else {
tmp = U + (t_0 * (J * ((0.3333333333333333 * Math.pow(l, 3.0)) + ((0.016666666666666666 * Math.pow(l, 5.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 <= 2e-15): tmp = ((t_1 * J) * t_0) + U else: tmp = U + (t_0 * (J * ((0.3333333333333333 * math.pow(l, 3.0)) + ((0.016666666666666666 * math.pow(l, 5.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 <= 2e-15)) 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(Float64(0.016666666666666666 * (l ^ 5.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 <= 2e-15))) tmp = ((t_1 * J) * t_0) + U; else tmp = U + (t_0 * (J * ((0.3333333333333333 * (l ^ 3.0)) + ((0.016666666666666666 * (l ^ 5.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, 2e-15]], $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[(N[(0.016666666666666666 * N[Power[l, 5.0], $MachinePrecision]), $MachinePrecision] + N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
t_1 := e^{\ell} - e^{-\ell}\\
\mathbf{if}\;t_1 \leq -\infty \lor \neg \left(t_1 \leq 2 \cdot 10^{-15}\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} + \left(0.016666666666666666 \cdot {\ell}^{5} + \ell \cdot 2\right)\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -inf.0 or 2.0000000000000002e-15 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 100.0%
if -inf.0 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 2.0000000000000002e-15Initial program 69.7%
Taylor expanded in l around 0 99.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 2e-15)))
(+ (* (* 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 <= 2e-15)) {
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 <= 2e-15)) {
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 <= 2e-15): 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 <= 2e-15)) 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 <= 2e-15))) 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, 2e-15]], $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 2 \cdot 10^{-15}\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 2.0000000000000002e-15 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 100.0%
if -inf.0 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 2.0000000000000002e-15Initial program 69.7%
Taylor expanded in l around 0 99.9%
Final simplification100.0%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0)))
(t_1 (+ U (* t_0 (* (pow l 5.0) (* J 0.016666666666666666)))))
(t_2 (+ (* (- (exp l) (exp (- l))) J) U)))
(if (<= l -3e+72)
t_1
(if (<= l -0.108)
t_2
(if (<= l 1.25e-8)
(+ U (* t_0 (* J (+ (* 0.3333333333333333 (pow l 3.0)) (* l 2.0)))))
(if (<= l 8e+50) t_2 t_1))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double t_1 = U + (t_0 * (pow(l, 5.0) * (J * 0.016666666666666666)));
double t_2 = ((exp(l) - exp(-l)) * J) + U;
double tmp;
if (l <= -3e+72) {
tmp = t_1;
} else if (l <= -0.108) {
tmp = t_2;
} else if (l <= 1.25e-8) {
tmp = U + (t_0 * (J * ((0.3333333333333333 * pow(l, 3.0)) + (l * 2.0))));
} else if (l <= 8e+50) {
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 / 2.0d0))
t_1 = u + (t_0 * ((l ** 5.0d0) * (j * 0.016666666666666666d0)))
t_2 = ((exp(l) - exp(-l)) * j) + u
if (l <= (-3d+72)) then
tmp = t_1
else if (l <= (-0.108d0)) then
tmp = t_2
else if (l <= 1.25d-8) then
tmp = u + (t_0 * (j * ((0.3333333333333333d0 * (l ** 3.0d0)) + (l * 2.0d0))))
else if (l <= 8d+50) 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 / 2.0));
double t_1 = U + (t_0 * (Math.pow(l, 5.0) * (J * 0.016666666666666666)));
double t_2 = ((Math.exp(l) - Math.exp(-l)) * J) + U;
double tmp;
if (l <= -3e+72) {
tmp = t_1;
} else if (l <= -0.108) {
tmp = t_2;
} else if (l <= 1.25e-8) {
tmp = U + (t_0 * (J * ((0.3333333333333333 * Math.pow(l, 3.0)) + (l * 2.0))));
} else if (l <= 8e+50) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K / 2.0)) t_1 = U + (t_0 * (math.pow(l, 5.0) * (J * 0.016666666666666666))) t_2 = ((math.exp(l) - math.exp(-l)) * J) + U tmp = 0 if l <= -3e+72: tmp = t_1 elif l <= -0.108: tmp = t_2 elif l <= 1.25e-8: tmp = U + (t_0 * (J * ((0.3333333333333333 * math.pow(l, 3.0)) + (l * 2.0)))) elif l <= 8e+50: tmp = t_2 else: tmp = t_1 return tmp
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) t_1 = Float64(U + Float64(t_0 * Float64((l ^ 5.0) * Float64(J * 0.016666666666666666)))) t_2 = Float64(Float64(Float64(exp(l) - exp(Float64(-l))) * J) + U) tmp = 0.0 if (l <= -3e+72) tmp = t_1; elseif (l <= -0.108) tmp = t_2; elseif (l <= 1.25e-8) tmp = Float64(U + Float64(t_0 * Float64(J * Float64(Float64(0.3333333333333333 * (l ^ 3.0)) + Float64(l * 2.0))))); elseif (l <= 8e+50) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = cos((K / 2.0)); t_1 = U + (t_0 * ((l ^ 5.0) * (J * 0.016666666666666666))); t_2 = ((exp(l) - exp(-l)) * J) + U; tmp = 0.0; if (l <= -3e+72) tmp = t_1; elseif (l <= -0.108) tmp = t_2; elseif (l <= 1.25e-8) tmp = U + (t_0 * (J * ((0.3333333333333333 * (l ^ 3.0)) + (l * 2.0)))); elseif (l <= 8e+50) 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 / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(U + N[(t$95$0 * N[(N[Power[l, 5.0], $MachinePrecision] * N[(J * 0.016666666666666666), $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, -3e+72], t$95$1, If[LessEqual[l, -0.108], t$95$2, If[LessEqual[l, 1.25e-8], 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], If[LessEqual[l, 8e+50], t$95$2, t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
t_1 := U + t_0 \cdot \left({\ell}^{5} \cdot \left(J \cdot 0.016666666666666666\right)\right)\\
t_2 := \left(e^{\ell} - e^{-\ell}\right) \cdot J + U\\
\mathbf{if}\;\ell \leq -3 \cdot 10^{+72}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\ell \leq -0.108:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\ell \leq 1.25 \cdot 10^{-8}:\\
\;\;\;\;U + t_0 \cdot \left(J \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right)\right)\\
\mathbf{elif}\;\ell \leq 8 \cdot 10^{+50}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if l < -3.00000000000000003e72 or 8.0000000000000006e50 < l Initial program 100.0%
Taylor expanded in l around 0 99.0%
Taylor expanded in l around inf 99.0%
associate-*r*99.0%
*-commutative99.0%
associate-*l*99.0%
Simplified99.0%
if -3.00000000000000003e72 < l < -0.107999999999999999 or 1.2499999999999999e-8 < l < 8.0000000000000006e50Initial program 100.0%
Taylor expanded in K around 0 89.7%
if -0.107999999999999999 < l < 1.2499999999999999e-8Initial program 69.7%
Taylor expanded in l around 0 99.9%
Final simplification98.0%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0)))
(t_1 (+ U (* t_0 (* (pow l 5.0) (* J 0.016666666666666666)))))
(t_2 (+ (* (- (exp l) (exp (- l))) J) U)))
(if (<= l -3e+72)
t_1
(if (<= l -0.0033)
t_2
(if (<= l 1.25e-8)
(+ U (* t_0 (* J (* l 2.0))))
(if (<= l 7.5e+50) t_2 t_1))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double t_1 = U + (t_0 * (pow(l, 5.0) * (J * 0.016666666666666666)));
double t_2 = ((exp(l) - exp(-l)) * J) + U;
double tmp;
if (l <= -3e+72) {
tmp = t_1;
} else if (l <= -0.0033) {
tmp = t_2;
} else if (l <= 1.25e-8) {
tmp = U + (t_0 * (J * (l * 2.0)));
} else if (l <= 7.5e+50) {
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 / 2.0d0))
t_1 = u + (t_0 * ((l ** 5.0d0) * (j * 0.016666666666666666d0)))
t_2 = ((exp(l) - exp(-l)) * j) + u
if (l <= (-3d+72)) then
tmp = t_1
else if (l <= (-0.0033d0)) then
tmp = t_2
else if (l <= 1.25d-8) then
tmp = u + (t_0 * (j * (l * 2.0d0)))
else if (l <= 7.5d+50) 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 / 2.0));
double t_1 = U + (t_0 * (Math.pow(l, 5.0) * (J * 0.016666666666666666)));
double t_2 = ((Math.exp(l) - Math.exp(-l)) * J) + U;
double tmp;
if (l <= -3e+72) {
tmp = t_1;
} else if (l <= -0.0033) {
tmp = t_2;
} else if (l <= 1.25e-8) {
tmp = U + (t_0 * (J * (l * 2.0)));
} else if (l <= 7.5e+50) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K / 2.0)) t_1 = U + (t_0 * (math.pow(l, 5.0) * (J * 0.016666666666666666))) t_2 = ((math.exp(l) - math.exp(-l)) * J) + U tmp = 0 if l <= -3e+72: tmp = t_1 elif l <= -0.0033: tmp = t_2 elif l <= 1.25e-8: tmp = U + (t_0 * (J * (l * 2.0))) elif l <= 7.5e+50: tmp = t_2 else: tmp = t_1 return tmp
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) t_1 = Float64(U + Float64(t_0 * Float64((l ^ 5.0) * Float64(J * 0.016666666666666666)))) t_2 = Float64(Float64(Float64(exp(l) - exp(Float64(-l))) * J) + U) tmp = 0.0 if (l <= -3e+72) tmp = t_1; elseif (l <= -0.0033) tmp = t_2; elseif (l <= 1.25e-8) tmp = Float64(U + Float64(t_0 * Float64(J * Float64(l * 2.0)))); elseif (l <= 7.5e+50) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = cos((K / 2.0)); t_1 = U + (t_0 * ((l ^ 5.0) * (J * 0.016666666666666666))); t_2 = ((exp(l) - exp(-l)) * J) + U; tmp = 0.0; if (l <= -3e+72) tmp = t_1; elseif (l <= -0.0033) tmp = t_2; elseif (l <= 1.25e-8) tmp = U + (t_0 * (J * (l * 2.0))); elseif (l <= 7.5e+50) 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 / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(U + N[(t$95$0 * N[(N[Power[l, 5.0], $MachinePrecision] * N[(J * 0.016666666666666666), $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, -3e+72], t$95$1, If[LessEqual[l, -0.0033], t$95$2, If[LessEqual[l, 1.25e-8], N[(U + N[(t$95$0 * N[(J * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 7.5e+50], t$95$2, t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
t_1 := U + t_0 \cdot \left({\ell}^{5} \cdot \left(J \cdot 0.016666666666666666\right)\right)\\
t_2 := \left(e^{\ell} - e^{-\ell}\right) \cdot J + U\\
\mathbf{if}\;\ell \leq -3 \cdot 10^{+72}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\ell \leq -0.0033:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\ell \leq 1.25 \cdot 10^{-8}:\\
\;\;\;\;U + t_0 \cdot \left(J \cdot \left(\ell \cdot 2\right)\right)\\
\mathbf{elif}\;\ell \leq 7.5 \cdot 10^{+50}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if l < -3.00000000000000003e72 or 7.4999999999999999e50 < l Initial program 100.0%
Taylor expanded in l around 0 99.0%
Taylor expanded in l around inf 99.0%
associate-*r*99.0%
*-commutative99.0%
associate-*l*99.0%
Simplified99.0%
if -3.00000000000000003e72 < l < -0.0033 or 1.2499999999999999e-8 < l < 7.4999999999999999e50Initial program 100.0%
Taylor expanded in K around 0 89.7%
if -0.0033 < l < 1.2499999999999999e-8Initial program 69.7%
Taylor expanded in l around 0 99.3%
Final simplification97.8%
(FPCore (J l K U) :precision binary64 (if (or (<= l -0.0023) (not (<= l 1.25e-8))) (+ (* (- (exp l) (exp (- l))) J) U) (+ U (* (cos (/ K 2.0)) (* J (* l 2.0))))))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -0.0023) || !(l <= 1.25e-8)) {
tmp = ((exp(l) - exp(-l)) * 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) :: tmp
if ((l <= (-0.0023d0)) .or. (.not. (l <= 1.25d-8))) then
tmp = ((exp(l) - exp(-l)) * 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 tmp;
if ((l <= -0.0023) || !(l <= 1.25e-8)) {
tmp = ((Math.exp(l) - Math.exp(-l)) * J) + U;
} else {
tmp = U + (Math.cos((K / 2.0)) * (J * (l * 2.0)));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -0.0023) or not (l <= 1.25e-8): tmp = ((math.exp(l) - math.exp(-l)) * J) + U else: tmp = U + (math.cos((K / 2.0)) * (J * (l * 2.0))) return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -0.0023) || !(l <= 1.25e-8)) tmp = Float64(Float64(Float64(exp(l) - exp(Float64(-l))) * 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) tmp = 0.0; if ((l <= -0.0023) || ~((l <= 1.25e-8))) tmp = ((exp(l) - exp(-l)) * J) + U; else tmp = U + (cos((K / 2.0)) * (J * (l * 2.0))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -0.0023], N[Not[LessEqual[l, 1.25e-8]], $MachinePrecision]], N[(N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * 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}
\mathbf{if}\;\ell \leq -0.0023 \lor \neg \left(\ell \leq 1.25 \cdot 10^{-8}\right):\\
\;\;\;\;\left(e^{\ell} - e^{-\ell}\right) \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 l < -0.0023 or 1.2499999999999999e-8 < l Initial program 100.0%
Taylor expanded in K around 0 77.3%
if -0.0023 < l < 1.2499999999999999e-8Initial program 69.7%
Taylor expanded in l around 0 99.3%
Final simplification88.0%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (log1p (expm1 U)))
(t_1 (+ U (* 2.0 (* J (fma (* -0.125 (* K K)) l l))))))
(if (<= l -2.8e+95)
t_1
(if (<= l -4.6e+17)
t_0
(if (<= l 3400.0)
(+ U (* (cos (/ K 2.0)) (* J (* l 2.0))))
(if (<= l 1.8e+51) (pow U -8.0) (if (<= l 1.95e+238) t_1 t_0)))))))
double code(double J, double l, double K, double U) {
double t_0 = log1p(expm1(U));
double t_1 = U + (2.0 * (J * fma((-0.125 * (K * K)), l, l)));
double tmp;
if (l <= -2.8e+95) {
tmp = t_1;
} else if (l <= -4.6e+17) {
tmp = t_0;
} else if (l <= 3400.0) {
tmp = U + (cos((K / 2.0)) * (J * (l * 2.0)));
} else if (l <= 1.8e+51) {
tmp = pow(U, -8.0);
} else if (l <= 1.95e+238) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
function code(J, l, K, U) t_0 = log1p(expm1(U)) t_1 = Float64(U + Float64(2.0 * Float64(J * fma(Float64(-0.125 * Float64(K * K)), l, l)))) tmp = 0.0 if (l <= -2.8e+95) tmp = t_1; elseif (l <= -4.6e+17) tmp = t_0; elseif (l <= 3400.0) tmp = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(J * Float64(l * 2.0)))); elseif (l <= 1.8e+51) tmp = U ^ -8.0; elseif (l <= 1.95e+238) tmp = t_1; else tmp = t_0; end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Log[1 + N[(Exp[U] - 1), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(U + N[(2.0 * N[(J * N[(N[(-0.125 * N[(K * K), $MachinePrecision]), $MachinePrecision] * l + l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -2.8e+95], t$95$1, If[LessEqual[l, -4.6e+17], t$95$0, If[LessEqual[l, 3400.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+51], N[Power[U, -8.0], $MachinePrecision], If[LessEqual[l, 1.95e+238], t$95$1, t$95$0]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{log1p}\left(\mathsf{expm1}\left(U\right)\right)\\
t_1 := U + 2 \cdot \left(J \cdot \mathsf{fma}\left(-0.125 \cdot \left(K \cdot K\right), \ell, \ell\right)\right)\\
\mathbf{if}\;\ell \leq -2.8 \cdot 10^{+95}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\ell \leq -4.6 \cdot 10^{+17}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq 3400:\\
\;\;\;\;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^{+51}:\\
\;\;\;\;{U}^{-8}\\
\mathbf{elif}\;\ell \leq 1.95 \cdot 10^{+238}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if l < -2.7999999999999998e95 or 1.80000000000000005e51 < l < 1.94999999999999996e238Initial program 100.0%
Taylor expanded in l around 0 98.9%
Taylor expanded in l around 0 32.9%
associate-*r*32.9%
Simplified32.9%
Taylor expanded in K around 0 41.2%
associate-*r*41.2%
fma-def41.2%
unpow241.2%
Simplified41.2%
if -2.7999999999999998e95 < l < -4.6e17 or 1.94999999999999996e238 < l Initial program 100.0%
Applied egg-rr46.6%
if -4.6e17 < l < 3400Initial program 70.6%
Taylor expanded in l around 0 97.1%
if 3400 < l < 1.80000000000000005e51Initial program 100.0%
Applied egg-rr46.6%
Final simplification70.2%
(FPCore (J l K U) :precision binary64 (+ U (* 2.0 (* J (* l (cos (* K 0.5)))))))
double code(double J, double l, double K, double U) {
return U + (2.0 * (J * (l * cos((K * 0.5)))));
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = u + (2.0d0 * (j * (l * cos((k * 0.5d0)))))
end function
public static double code(double J, double l, double K, double U) {
return U + (2.0 * (J * (l * Math.cos((K * 0.5)))));
}
def code(J, l, K, U): return U + (2.0 * (J * (l * math.cos((K * 0.5)))))
function code(J, l, K, U) return Float64(U + Float64(2.0 * Float64(J * Float64(l * cos(Float64(K * 0.5)))))) end
function tmp = code(J, l, K, U) tmp = U + (2.0 * (J * (l * cos((K * 0.5))))); end
code[J_, l_, K_, U_] := N[(U + N[(2.0 * N[(J * N[(l * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + 2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(K \cdot 0.5\right)\right)\right)
\end{array}
Initial program 85.3%
Taylor expanded in l around 0 88.4%
Taylor expanded in l around 0 62.1%
associate-*r*62.0%
Simplified62.0%
Final simplification62.0%
(FPCore (J l K U) :precision binary64 (+ U (* l (* 2.0 (* J (cos (* K 0.5)))))))
double code(double J, double l, double K, double U) {
return U + (l * (2.0 * (J * cos((K * 0.5)))));
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = u + (l * (2.0d0 * (j * cos((k * 0.5d0)))))
end function
public static double code(double J, double l, double K, double U) {
return U + (l * (2.0 * (J * Math.cos((K * 0.5)))));
}
def code(J, l, K, U): return U + (l * (2.0 * (J * math.cos((K * 0.5)))))
function code(J, l, K, U) return Float64(U + Float64(l * Float64(2.0 * Float64(J * cos(Float64(K * 0.5)))))) end
function tmp = code(J, l, K, U) tmp = U + (l * (2.0 * (J * cos((K * 0.5))))); end
code[J_, l_, K_, U_] := N[(U + N[(l * N[(2.0 * N[(J * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + \ell \cdot \left(2 \cdot \left(J \cdot \cos \left(K \cdot 0.5\right)\right)\right)
\end{array}
Initial program 85.3%
Taylor expanded in l around 0 85.3%
Taylor expanded in l around 0 62.1%
*-commutative62.1%
associate-*r*62.0%
*-commutative62.0%
*-commutative62.0%
associate-*r*62.0%
associate-*l*62.0%
*-commutative62.0%
*-commutative62.0%
Simplified62.0%
Final simplification62.0%
(FPCore (J l K U) :precision binary64 (+ U (* (cos (/ K 2.0)) (* J (* l 2.0)))))
double code(double J, double l, double K, double U) {
return U + (cos((K / 2.0)) * (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 + (cos((k / 2.0d0)) * (j * (l * 2.0d0)))
end function
public static double code(double J, double l, double K, double U) {
return U + (Math.cos((K / 2.0)) * (J * (l * 2.0)));
}
def code(J, l, K, U): return U + (math.cos((K / 2.0)) * (J * (l * 2.0)))
function code(J, l, K, U) return Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(J * Float64(l * 2.0)))) end
function tmp = code(J, l, K, U) tmp = U + (cos((K / 2.0)) * (J * (l * 2.0))); end
code[J_, l_, K_, U_] := N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(J * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(\ell \cdot 2\right)\right)
\end{array}
Initial program 85.3%
Taylor expanded in l around 0 62.1%
Final simplification62.1%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (+ U (* (* l J) (+ 2.0 (* (* K K) -0.25))))))
(if (<= l -1.4e+47)
t_0
(if (<= l 3400.0)
(fma (* l 2.0) J U)
(if (<= l 1.8e+55) (pow U -8.0) t_0)))))
double code(double J, double l, double K, double U) {
double t_0 = U + ((l * J) * (2.0 + ((K * K) * -0.25)));
double tmp;
if (l <= -1.4e+47) {
tmp = t_0;
} else if (l <= 3400.0) {
tmp = fma((l * 2.0), J, U);
} else if (l <= 1.8e+55) {
tmp = pow(U, -8.0);
} else {
tmp = t_0;
}
return tmp;
}
function code(J, l, K, U) t_0 = Float64(U + Float64(Float64(l * J) * Float64(2.0 + Float64(Float64(K * K) * -0.25)))) tmp = 0.0 if (l <= -1.4e+47) tmp = t_0; elseif (l <= 3400.0) tmp = fma(Float64(l * 2.0), J, U); elseif (l <= 1.8e+55) tmp = U ^ -8.0; else tmp = t_0; end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(U + N[(N[(l * J), $MachinePrecision] * N[(2.0 + N[(N[(K * K), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -1.4e+47], t$95$0, If[LessEqual[l, 3400.0], N[(N[(l * 2.0), $MachinePrecision] * J + U), $MachinePrecision], If[LessEqual[l, 1.8e+55], N[Power[U, -8.0], $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + \left(\ell \cdot J\right) \cdot \left(2 + \left(K \cdot K\right) \cdot -0.25\right)\\
\mathbf{if}\;\ell \leq -1.4 \cdot 10^{+47}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq 3400:\\
\;\;\;\;\mathsf{fma}\left(\ell \cdot 2, J, U\right)\\
\mathbf{elif}\;\ell \leq 1.8 \cdot 10^{+55}:\\
\;\;\;\;{U}^{-8}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if l < -1.39999999999999994e47 or 1.79999999999999994e55 < l Initial program 100.0%
Taylor expanded in l around 0 94.3%
Taylor expanded in l around 0 31.5%
associate-*r*31.5%
Simplified31.5%
Taylor expanded in K around 0 15.9%
+-commutative15.9%
associate-*r*15.9%
distribute-rgt-out35.9%
*-commutative35.9%
unpow235.9%
Simplified35.9%
if -1.39999999999999994e47 < l < 3400Initial program 73.7%
Taylor expanded in l around 0 89.9%
Taylor expanded in l around 0 88.0%
associate-*r*87.9%
Simplified87.9%
Taylor expanded in K around 0 75.0%
associate-*r*75.0%
*-commutative75.0%
fma-def75.0%
Simplified75.0%
if 3400 < l < 1.79999999999999994e55Initial program 100.0%
Applied egg-rr46.6%
Final simplification58.3%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (+ U (* (* l J) (+ 2.0 (* (* K K) -0.25))))))
(if (<= l -1.2e+47)
t_0
(if (<= l 3400.0)
(+ U (* 2.0 (* l J)))
(if (<= l 1e+51) (pow U -8.0) t_0)))))
double code(double J, double l, double K, double U) {
double t_0 = U + ((l * J) * (2.0 + ((K * K) * -0.25)));
double tmp;
if (l <= -1.2e+47) {
tmp = t_0;
} else if (l <= 3400.0) {
tmp = U + (2.0 * (l * J));
} else if (l <= 1e+51) {
tmp = pow(U, -8.0);
} 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) :: tmp
t_0 = u + ((l * j) * (2.0d0 + ((k * k) * (-0.25d0))))
if (l <= (-1.2d+47)) then
tmp = t_0
else if (l <= 3400.0d0) then
tmp = u + (2.0d0 * (l * j))
else if (l <= 1d+51) then
tmp = u ** (-8.0d0)
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 + ((l * J) * (2.0 + ((K * K) * -0.25)));
double tmp;
if (l <= -1.2e+47) {
tmp = t_0;
} else if (l <= 3400.0) {
tmp = U + (2.0 * (l * J));
} else if (l <= 1e+51) {
tmp = Math.pow(U, -8.0);
} else {
tmp = t_0;
}
return tmp;
}
def code(J, l, K, U): t_0 = U + ((l * J) * (2.0 + ((K * K) * -0.25))) tmp = 0 if l <= -1.2e+47: tmp = t_0 elif l <= 3400.0: tmp = U + (2.0 * (l * J)) elif l <= 1e+51: tmp = math.pow(U, -8.0) else: tmp = t_0 return tmp
function code(J, l, K, U) t_0 = Float64(U + Float64(Float64(l * J) * Float64(2.0 + Float64(Float64(K * K) * -0.25)))) tmp = 0.0 if (l <= -1.2e+47) tmp = t_0; elseif (l <= 3400.0) tmp = Float64(U + Float64(2.0 * Float64(l * J))); elseif (l <= 1e+51) tmp = U ^ -8.0; else tmp = t_0; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = U + ((l * J) * (2.0 + ((K * K) * -0.25))); tmp = 0.0; if (l <= -1.2e+47) tmp = t_0; elseif (l <= 3400.0) tmp = U + (2.0 * (l * J)); elseif (l <= 1e+51) tmp = U ^ -8.0; else tmp = t_0; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(U + N[(N[(l * J), $MachinePrecision] * N[(2.0 + N[(N[(K * K), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -1.2e+47], t$95$0, If[LessEqual[l, 3400.0], N[(U + N[(2.0 * N[(l * J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1e+51], N[Power[U, -8.0], $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + \left(\ell \cdot J\right) \cdot \left(2 + \left(K \cdot K\right) \cdot -0.25\right)\\
\mathbf{if}\;\ell \leq -1.2 \cdot 10^{+47}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq 3400:\\
\;\;\;\;U + 2 \cdot \left(\ell \cdot J\right)\\
\mathbf{elif}\;\ell \leq 10^{+51}:\\
\;\;\;\;{U}^{-8}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if l < -1.20000000000000009e47 or 1e51 < l Initial program 100.0%
Taylor expanded in l around 0 94.3%
Taylor expanded in l around 0 31.5%
associate-*r*31.5%
Simplified31.5%
Taylor expanded in K around 0 15.9%
+-commutative15.9%
associate-*r*15.9%
distribute-rgt-out35.9%
*-commutative35.9%
unpow235.9%
Simplified35.9%
if -1.20000000000000009e47 < l < 3400Initial program 73.7%
Taylor expanded in l around 0 89.9%
Taylor expanded in l around 0 88.0%
associate-*r*87.9%
Simplified87.9%
Taylor expanded in K around 0 75.0%
if 3400 < l < 1e51Initial program 100.0%
Applied egg-rr46.6%
Final simplification58.3%
(FPCore (J l K U) :precision binary64 (if (or (<= l -1.2e+47) (not (<= l 1e+20))) (+ U (* (* l J) (+ 2.0 (* (* K K) -0.25)))) (+ U (* 2.0 (* l J)))))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -1.2e+47) || !(l <= 1e+20)) {
tmp = U + ((l * J) * (2.0 + ((K * K) * -0.25)));
} else {
tmp = U + (2.0 * (l * J));
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if ((l <= (-1.2d+47)) .or. (.not. (l <= 1d+20))) then
tmp = u + ((l * j) * (2.0d0 + ((k * k) * (-0.25d0))))
else
tmp = u + (2.0d0 * (l * j))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -1.2e+47) || !(l <= 1e+20)) {
tmp = U + ((l * J) * (2.0 + ((K * K) * -0.25)));
} else {
tmp = U + (2.0 * (l * J));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -1.2e+47) or not (l <= 1e+20): tmp = U + ((l * J) * (2.0 + ((K * K) * -0.25))) else: tmp = U + (2.0 * (l * J)) return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -1.2e+47) || !(l <= 1e+20)) tmp = Float64(U + Float64(Float64(l * J) * Float64(2.0 + Float64(Float64(K * K) * -0.25)))); else tmp = Float64(U + Float64(2.0 * Float64(l * J))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -1.2e+47) || ~((l <= 1e+20))) tmp = U + ((l * J) * (2.0 + ((K * K) * -0.25))); else tmp = U + (2.0 * (l * J)); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -1.2e+47], N[Not[LessEqual[l, 1e+20]], $MachinePrecision]], N[(U + N[(N[(l * J), $MachinePrecision] * N[(2.0 + N[(N[(K * K), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(2.0 * N[(l * J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.2 \cdot 10^{+47} \lor \neg \left(\ell \leq 10^{+20}\right):\\
\;\;\;\;U + \left(\ell \cdot J\right) \cdot \left(2 + \left(K \cdot K\right) \cdot -0.25\right)\\
\mathbf{else}:\\
\;\;\;\;U + 2 \cdot \left(\ell \cdot J\right)\\
\end{array}
\end{array}
if l < -1.20000000000000009e47 or 1e20 < l Initial program 100.0%
Taylor expanded in l around 0 90.3%
Taylor expanded in l around 0 30.6%
associate-*r*30.6%
Simplified30.6%
Taylor expanded in K around 0 15.0%
+-commutative15.0%
associate-*r*15.0%
distribute-rgt-out34.7%
*-commutative34.7%
unpow234.7%
Simplified34.7%
if -1.20000000000000009e47 < l < 1e20Initial program 74.8%
Taylor expanded in l around 0 87.1%
Taylor expanded in l around 0 84.7%
associate-*r*84.6%
Simplified84.6%
Taylor expanded in K around 0 72.1%
Final simplification56.5%
(FPCore (J l K U) :precision binary64 (if (<= l -0.00046) (* U (- U -8.0)) U))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -0.00046) {
tmp = U * (U - -8.0);
} else {
tmp = U;
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if (l <= (-0.00046d0)) then
tmp = u * (u - (-8.0d0))
else
tmp = u
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (l <= -0.00046) {
tmp = U * (U - -8.0);
} else {
tmp = U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -0.00046: tmp = U * (U - -8.0) else: tmp = U return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -0.00046) tmp = Float64(U * Float64(U - -8.0)); else tmp = U; end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -0.00046) tmp = U * (U - -8.0); else tmp = U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -0.00046], N[(U * N[(U - -8.0), $MachinePrecision]), $MachinePrecision], U]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -0.00046:\\
\;\;\;\;U \cdot \left(U - -8\right)\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\end{array}
if l < -4.6000000000000001e-4Initial program 99.9%
Applied egg-rr14.6%
if -4.6000000000000001e-4 < l Initial program 79.1%
Taylor expanded in J around 0 48.6%
Final simplification38.4%
(FPCore (J l K U) :precision binary64 (+ U (* 2.0 (* l J))))
double code(double J, double l, double K, double U) {
return U + (2.0 * (l * J));
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = u + (2.0d0 * (l * j))
end function
public static double code(double J, double l, double K, double U) {
return U + (2.0 * (l * J));
}
def code(J, l, K, U): return U + (2.0 * (l * J))
function code(J, l, K, U) return Float64(U + Float64(2.0 * Float64(l * J))) end
function tmp = code(J, l, K, U) tmp = U + (2.0 * (l * J)); end
code[J_, l_, K_, U_] := N[(U + N[(2.0 * N[(l * J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + 2 \cdot \left(\ell \cdot J\right)
\end{array}
Initial program 85.3%
Taylor expanded in l around 0 88.4%
Taylor expanded in l around 0 62.1%
associate-*r*62.0%
Simplified62.0%
Taylor expanded in K around 0 51.0%
Final simplification51.0%
(FPCore (J l K U) :precision binary64 (if (<= l -0.00046) (* U U) U))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -0.00046) {
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 <= (-0.00046d0)) 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 <= -0.00046) {
tmp = U * U;
} else {
tmp = U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -0.00046: tmp = U * U else: tmp = U return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -0.00046) tmp = Float64(U * U); else tmp = U; end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -0.00046) tmp = U * U; else tmp = U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -0.00046], N[(U * U), $MachinePrecision], U]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -0.00046:\\
\;\;\;\;U \cdot U\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\end{array}
if l < -4.6000000000000001e-4Initial program 99.9%
Applied egg-rr14.6%
if -4.6000000000000001e-4 < l Initial program 79.1%
Taylor expanded in J around 0 48.6%
Final simplification38.4%
(FPCore (J l K U) :precision binary64 1.0)
double code(double J, double l, double K, double U) {
return 1.0;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = 1.0d0
end function
public static double code(double J, double l, double K, double U) {
return 1.0;
}
def code(J, l, K, U): return 1.0
function code(J, l, K, U) return 1.0 end
function tmp = code(J, l, K, U) tmp = 1.0; end
code[J_, l_, K_, U_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 85.3%
Applied egg-rr2.6%
*-inverses2.6%
Simplified2.6%
Final simplification2.6%
(FPCore (J l K U) :precision binary64 U)
double code(double J, double l, double K, double U) {
return U;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = u
end function
public static double code(double J, double l, double K, double U) {
return U;
}
def code(J, l, K, U): return U
function code(J, l, K, U) return U end
function tmp = code(J, l, K, U) tmp = U; end
code[J_, l_, K_, U_] := U
\begin{array}{l}
\\
U
\end{array}
Initial program 85.3%
Taylor expanded in J around 0 34.8%
Final simplification34.8%
herbie shell --seed 2023189
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))