
(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 5e-7)))
(+ (* (* t_0 J) (cos (/ K 2.0))) U)
(+
U
(*
J
(*
(cos (* K 0.5))
(+ (* 0.3333333333333333 (pow l 3.0)) (* 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 <= -((double) INFINITY)) || !(t_0 <= 5e-7)) {
tmp = ((t_0 * J) * cos((K / 2.0))) + U;
} else {
tmp = U + (J * (cos((K * 0.5)) * ((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.exp(l) - Math.exp(-l);
double tmp;
if ((t_0 <= -Double.POSITIVE_INFINITY) || !(t_0 <= 5e-7)) {
tmp = ((t_0 * J) * Math.cos((K / 2.0))) + U;
} else {
tmp = U + (J * (Math.cos((K * 0.5)) * ((0.3333333333333333 * Math.pow(l, 3.0)) + (l * 2.0))));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.exp(l) - math.exp(-l) tmp = 0 if (t_0 <= -math.inf) or not (t_0 <= 5e-7): tmp = ((t_0 * J) * math.cos((K / 2.0))) + U else: tmp = U + (J * (math.cos((K * 0.5)) * ((0.3333333333333333 * math.pow(l, 3.0)) + (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 <= Float64(-Inf)) || !(t_0 <= 5e-7)) tmp = Float64(Float64(Float64(t_0 * J) * cos(Float64(K / 2.0))) + U); else tmp = Float64(U + Float64(J * Float64(cos(Float64(K * 0.5)) * 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 = exp(l) - exp(-l); tmp = 0.0; if ((t_0 <= -Inf) || ~((t_0 <= 5e-7))) tmp = ((t_0 * J) * cos((K / 2.0))) + U; else tmp = U + (J * (cos((K * 0.5)) * ((0.3333333333333333 * (l ^ 3.0)) + (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, (-Infinity)], N[Not[LessEqual[t$95$0, 5e-7]], $MachinePrecision]], N[(N[(N[(t$95$0 * J), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], N[(U + N[(J * N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * 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 := e^{\ell} - e^{-\ell}\\
\mathbf{if}\;t_0 \leq -\infty \lor \neg \left(t_0 \leq 5 \cdot 10^{-7}\right):\\
\;\;\;\;\left(t_0 \cdot J\right) \cdot \cos \left(\frac{K}{2}\right) + U\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(\cos \left(K \cdot 0.5\right) \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 4.99999999999999977e-7 < (-.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))) < 4.99999999999999977e-7Initial program 69.2%
Taylor expanded in l around 0 99.8%
Taylor expanded in J around 0 99.9%
Final simplification99.9%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (- (exp l) (exp (- l)))))
(if (or (<= t_0 (- INFINITY)) (not (<= t_0 0.5)))
(* t_0 J)
(+ U (* 2.0 (* J (* l (cos (* K 0.5)))))))))
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.5)) {
tmp = t_0 * J;
} else {
tmp = U + (2.0 * (J * (l * cos((K * 0.5)))));
}
return tmp;
}
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 <= -Double.POSITIVE_INFINITY) || !(t_0 <= 0.5)) {
tmp = t_0 * J;
} else {
tmp = U + (2.0 * (J * (l * Math.cos((K * 0.5)))));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.exp(l) - math.exp(-l) tmp = 0 if (t_0 <= -math.inf) or not (t_0 <= 0.5): tmp = t_0 * J else: tmp = U + (2.0 * (J * (l * math.cos((K * 0.5))))) 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.5)) tmp = Float64(t_0 * J); else tmp = Float64(U + Float64(2.0 * Float64(J * Float64(l * cos(Float64(K * 0.5)))))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = exp(l) - exp(-l); tmp = 0.0; if ((t_0 <= -Inf) || ~((t_0 <= 0.5))) tmp = t_0 * J; else tmp = U + (2.0 * (J * (l * cos((K * 0.5))))); 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, (-Infinity)], N[Not[LessEqual[t$95$0, 0.5]], $MachinePrecision]], N[(t$95$0 * J), $MachinePrecision], N[(U + N[(2.0 * N[(J * N[(l * N[Cos[N[(K * 0.5), $MachinePrecision]], $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.5\right):\\
\;\;\;\;t_0 \cdot J\\
\mathbf{else}:\\
\;\;\;\;U + 2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -inf.0 or 0.5 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 100.0%
Taylor expanded in K around 0 76.4%
Taylor expanded in J around inf 76.4%
if -inf.0 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 0.5Initial program 69.4%
Taylor expanded in l around 0 99.3%
Final simplification87.2%
(FPCore (J l K U)
:precision binary64
(let* ((t_0
(+ U (* (cos (/ K 2.0)) (* (pow l 3.0) (* J 0.3333333333333333)))))
(t_1 (* (- (exp l) (exp (- l))) J)))
(if (<= l -3.45e+100)
t_0
(if (<= l -200.0)
t_1
(if (<= l 0.38)
(+ U (* 2.0 (* J (* l (cos (* K 0.5))))))
(if (<= l 1.26e+92) (+ t_1 U) t_0))))))
double code(double J, double l, double K, double U) {
double t_0 = U + (cos((K / 2.0)) * (pow(l, 3.0) * (J * 0.3333333333333333)));
double t_1 = (exp(l) - exp(-l)) * J;
double tmp;
if (l <= -3.45e+100) {
tmp = t_0;
} else if (l <= -200.0) {
tmp = t_1;
} else if (l <= 0.38) {
tmp = U + (2.0 * (J * (l * cos((K * 0.5)))));
} else if (l <= 1.26e+92) {
tmp = t_1 + U;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = u + (cos((k / 2.0d0)) * ((l ** 3.0d0) * (j * 0.3333333333333333d0)))
t_1 = (exp(l) - exp(-l)) * j
if (l <= (-3.45d+100)) then
tmp = t_0
else if (l <= (-200.0d0)) then
tmp = t_1
else if (l <= 0.38d0) then
tmp = u + (2.0d0 * (j * (l * cos((k * 0.5d0)))))
else if (l <= 1.26d+92) then
tmp = t_1 + u
else
tmp = t_0
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = U + (Math.cos((K / 2.0)) * (Math.pow(l, 3.0) * (J * 0.3333333333333333)));
double t_1 = (Math.exp(l) - Math.exp(-l)) * J;
double tmp;
if (l <= -3.45e+100) {
tmp = t_0;
} else if (l <= -200.0) {
tmp = t_1;
} else if (l <= 0.38) {
tmp = U + (2.0 * (J * (l * Math.cos((K * 0.5)))));
} else if (l <= 1.26e+92) {
tmp = t_1 + U;
} else {
tmp = t_0;
}
return tmp;
}
def code(J, l, K, U): t_0 = U + (math.cos((K / 2.0)) * (math.pow(l, 3.0) * (J * 0.3333333333333333))) t_1 = (math.exp(l) - math.exp(-l)) * J tmp = 0 if l <= -3.45e+100: tmp = t_0 elif l <= -200.0: tmp = t_1 elif l <= 0.38: tmp = U + (2.0 * (J * (l * math.cos((K * 0.5))))) elif l <= 1.26e+92: tmp = t_1 + U else: tmp = t_0 return tmp
function code(J, l, K, U) t_0 = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64((l ^ 3.0) * Float64(J * 0.3333333333333333)))) t_1 = Float64(Float64(exp(l) - exp(Float64(-l))) * J) tmp = 0.0 if (l <= -3.45e+100) tmp = t_0; elseif (l <= -200.0) tmp = t_1; elseif (l <= 0.38) tmp = Float64(U + Float64(2.0 * Float64(J * Float64(l * cos(Float64(K * 0.5)))))); elseif (l <= 1.26e+92) tmp = Float64(t_1 + U); else tmp = t_0; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = U + (cos((K / 2.0)) * ((l ^ 3.0) * (J * 0.3333333333333333))); t_1 = (exp(l) - exp(-l)) * J; tmp = 0.0; if (l <= -3.45e+100) tmp = t_0; elseif (l <= -200.0) tmp = t_1; elseif (l <= 0.38) tmp = U + (2.0 * (J * (l * cos((K * 0.5))))); elseif (l <= 1.26e+92) tmp = t_1 + U; else tmp = t_0; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(N[Power[l, 3.0], $MachinePrecision] * N[(J * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision]}, If[LessEqual[l, -3.45e+100], t$95$0, If[LessEqual[l, -200.0], t$95$1, If[LessEqual[l, 0.38], N[(U + N[(2.0 * N[(J * N[(l * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.26e+92], N[(t$95$1 + U), $MachinePrecision], t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + \cos \left(\frac{K}{2}\right) \cdot \left({\ell}^{3} \cdot \left(J \cdot 0.3333333333333333\right)\right)\\
t_1 := \left(e^{\ell} - e^{-\ell}\right) \cdot J\\
\mathbf{if}\;\ell \leq -3.45 \cdot 10^{+100}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq -200:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\ell \leq 0.38:\\
\;\;\;\;U + 2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\mathbf{elif}\;\ell \leq 1.26 \cdot 10^{+92}:\\
\;\;\;\;t_1 + U\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if l < -3.45e100 or 1.26e92 < l Initial program 100.0%
Taylor expanded in l around 0 97.9%
Taylor expanded in l around inf 97.9%
*-commutative97.9%
*-commutative97.9%
associate-*l*97.9%
Simplified97.9%
if -3.45e100 < l < -200Initial program 100.0%
Taylor expanded in K around 0 91.7%
Taylor expanded in J around inf 91.7%
if -200 < l < 0.38Initial program 69.4%
Taylor expanded in l around 0 99.3%
if 0.38 < l < 1.26e92Initial program 100.0%
Taylor expanded in K around 0 74.7%
Final simplification95.8%
(FPCore (J l K U)
:precision binary64
(let* ((t_0
(+ U (* (cos (/ K 2.0)) (* (pow l 3.0) (* J 0.3333333333333333)))))
(t_1 (* (- (exp l) (exp (- l))) J)))
(if (<= l -5.6e+100)
t_0
(if (<= l -210.0)
t_1
(if (<= l 0.245)
(+
U
(*
J
(*
(cos (* K 0.5))
(+ (* 0.3333333333333333 (pow l 3.0)) (* l 2.0)))))
(if (<= l 1.26e+92) (+ t_1 U) t_0))))))
double code(double J, double l, double K, double U) {
double t_0 = U + (cos((K / 2.0)) * (pow(l, 3.0) * (J * 0.3333333333333333)));
double t_1 = (exp(l) - exp(-l)) * J;
double tmp;
if (l <= -5.6e+100) {
tmp = t_0;
} else if (l <= -210.0) {
tmp = t_1;
} else if (l <= 0.245) {
tmp = U + (J * (cos((K * 0.5)) * ((0.3333333333333333 * pow(l, 3.0)) + (l * 2.0))));
} else if (l <= 1.26e+92) {
tmp = t_1 + U;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = u + (cos((k / 2.0d0)) * ((l ** 3.0d0) * (j * 0.3333333333333333d0)))
t_1 = (exp(l) - exp(-l)) * j
if (l <= (-5.6d+100)) then
tmp = t_0
else if (l <= (-210.0d0)) then
tmp = t_1
else if (l <= 0.245d0) then
tmp = u + (j * (cos((k * 0.5d0)) * ((0.3333333333333333d0 * (l ** 3.0d0)) + (l * 2.0d0))))
else if (l <= 1.26d+92) then
tmp = t_1 + u
else
tmp = t_0
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = U + (Math.cos((K / 2.0)) * (Math.pow(l, 3.0) * (J * 0.3333333333333333)));
double t_1 = (Math.exp(l) - Math.exp(-l)) * J;
double tmp;
if (l <= -5.6e+100) {
tmp = t_0;
} else if (l <= -210.0) {
tmp = t_1;
} else if (l <= 0.245) {
tmp = U + (J * (Math.cos((K * 0.5)) * ((0.3333333333333333 * Math.pow(l, 3.0)) + (l * 2.0))));
} else if (l <= 1.26e+92) {
tmp = t_1 + U;
} else {
tmp = t_0;
}
return tmp;
}
def code(J, l, K, U): t_0 = U + (math.cos((K / 2.0)) * (math.pow(l, 3.0) * (J * 0.3333333333333333))) t_1 = (math.exp(l) - math.exp(-l)) * J tmp = 0 if l <= -5.6e+100: tmp = t_0 elif l <= -210.0: tmp = t_1 elif l <= 0.245: tmp = U + (J * (math.cos((K * 0.5)) * ((0.3333333333333333 * math.pow(l, 3.0)) + (l * 2.0)))) elif l <= 1.26e+92: tmp = t_1 + U else: tmp = t_0 return tmp
function code(J, l, K, U) t_0 = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64((l ^ 3.0) * Float64(J * 0.3333333333333333)))) t_1 = Float64(Float64(exp(l) - exp(Float64(-l))) * J) tmp = 0.0 if (l <= -5.6e+100) tmp = t_0; elseif (l <= -210.0) tmp = t_1; elseif (l <= 0.245) tmp = Float64(U + Float64(J * Float64(cos(Float64(K * 0.5)) * Float64(Float64(0.3333333333333333 * (l ^ 3.0)) + Float64(l * 2.0))))); elseif (l <= 1.26e+92) tmp = Float64(t_1 + U); else tmp = t_0; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = U + (cos((K / 2.0)) * ((l ^ 3.0) * (J * 0.3333333333333333))); t_1 = (exp(l) - exp(-l)) * J; tmp = 0.0; if (l <= -5.6e+100) tmp = t_0; elseif (l <= -210.0) tmp = t_1; elseif (l <= 0.245) tmp = U + (J * (cos((K * 0.5)) * ((0.3333333333333333 * (l ^ 3.0)) + (l * 2.0)))); elseif (l <= 1.26e+92) tmp = t_1 + U; else tmp = t_0; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(N[Power[l, 3.0], $MachinePrecision] * N[(J * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision]}, If[LessEqual[l, -5.6e+100], t$95$0, If[LessEqual[l, -210.0], t$95$1, If[LessEqual[l, 0.245], N[(U + N[(J * N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * N[(N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision] + N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.26e+92], N[(t$95$1 + U), $MachinePrecision], t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + \cos \left(\frac{K}{2}\right) \cdot \left({\ell}^{3} \cdot \left(J \cdot 0.3333333333333333\right)\right)\\
t_1 := \left(e^{\ell} - e^{-\ell}\right) \cdot J\\
\mathbf{if}\;\ell \leq -5.6 \cdot 10^{+100}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq -210:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\ell \leq 0.245:\\
\;\;\;\;U + J \cdot \left(\cos \left(K \cdot 0.5\right) \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right)\right)\\
\mathbf{elif}\;\ell \leq 1.26 \cdot 10^{+92}:\\
\;\;\;\;t_1 + U\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if l < -5.5999999999999996e100 or 1.26e92 < l Initial program 100.0%
Taylor expanded in l around 0 97.9%
Taylor expanded in l around inf 97.9%
*-commutative97.9%
*-commutative97.9%
associate-*l*97.9%
Simplified97.9%
if -5.5999999999999996e100 < l < -210Initial program 100.0%
Taylor expanded in K around 0 91.7%
Taylor expanded in J around inf 91.7%
if -210 < l < 0.245Initial program 69.4%
Taylor expanded in l around 0 99.4%
Taylor expanded in J around 0 99.4%
if 0.245 < l < 1.26e92Initial program 100.0%
Taylor expanded in K around 0 74.7%
Final simplification95.9%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (log1p (expm1 (- (/ -4.0 U) U))))
(t_1 (+ U (* J (+ (* 0.3333333333333333 (pow l 3.0)) (* l 2.0))))))
(if (<= l -1.05e+90)
t_1
(if (<= l -900.0)
t_0
(if (<= l 470.0)
(+ U (* 2.0 (* J (* l (cos (* K 0.5))))))
(if (<= l 7e+121) t_0 t_1))))))
double code(double J, double l, double K, double U) {
double t_0 = log1p(expm1(((-4.0 / U) - U)));
double t_1 = U + (J * ((0.3333333333333333 * pow(l, 3.0)) + (l * 2.0)));
double tmp;
if (l <= -1.05e+90) {
tmp = t_1;
} else if (l <= -900.0) {
tmp = t_0;
} else if (l <= 470.0) {
tmp = U + (2.0 * (J * (l * cos((K * 0.5)))));
} else if (l <= 7e+121) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
public static double code(double J, double l, double K, double U) {
double t_0 = Math.log1p(Math.expm1(((-4.0 / U) - U)));
double t_1 = U + (J * ((0.3333333333333333 * Math.pow(l, 3.0)) + (l * 2.0)));
double tmp;
if (l <= -1.05e+90) {
tmp = t_1;
} else if (l <= -900.0) {
tmp = t_0;
} else if (l <= 470.0) {
tmp = U + (2.0 * (J * (l * Math.cos((K * 0.5)))));
} else if (l <= 7e+121) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(J, l, K, U): t_0 = math.log1p(math.expm1(((-4.0 / U) - U))) t_1 = U + (J * ((0.3333333333333333 * math.pow(l, 3.0)) + (l * 2.0))) tmp = 0 if l <= -1.05e+90: tmp = t_1 elif l <= -900.0: tmp = t_0 elif l <= 470.0: tmp = U + (2.0 * (J * (l * math.cos((K * 0.5))))) elif l <= 7e+121: tmp = t_0 else: tmp = t_1 return tmp
function code(J, l, K, U) t_0 = log1p(expm1(Float64(Float64(-4.0 / U) - U))) t_1 = Float64(U + Float64(J * Float64(Float64(0.3333333333333333 * (l ^ 3.0)) + Float64(l * 2.0)))) tmp = 0.0 if (l <= -1.05e+90) tmp = t_1; elseif (l <= -900.0) tmp = t_0; elseif (l <= 470.0) tmp = Float64(U + Float64(2.0 * Float64(J * Float64(l * cos(Float64(K * 0.5)))))); elseif (l <= 7e+121) tmp = t_0; else tmp = t_1; end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Log[1 + N[(Exp[N[(N[(-4.0 / U), $MachinePrecision] - U), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(U + N[(J * N[(N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision] + N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -1.05e+90], t$95$1, If[LessEqual[l, -900.0], t$95$0, If[LessEqual[l, 470.0], N[(U + N[(2.0 * N[(J * N[(l * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 7e+121], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{log1p}\left(\mathsf{expm1}\left(\frac{-4}{U} - U\right)\right)\\
t_1 := U + J \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right)\\
\mathbf{if}\;\ell \leq -1.05 \cdot 10^{+90}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\ell \leq -900:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq 470:\\
\;\;\;\;U + 2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\mathbf{elif}\;\ell \leq 7 \cdot 10^{+121}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if l < -1.0499999999999999e90 or 6.9999999999999999e121 < l Initial program 100.0%
Taylor expanded in l around 0 97.8%
Taylor expanded in K around 0 74.8%
if -1.0499999999999999e90 < l < -900 or 470 < l < 6.9999999999999999e121Initial program 100.0%
Applied egg-rr3.6%
log1p-expm1-u66.0%
Applied egg-rr66.0%
if -900 < l < 470Initial program 69.7%
Taylor expanded in l around 0 98.5%
Final simplification84.4%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.005) (+ U (* l (* (cos (* K 0.5)) (* J 2.0)))) (+ U (* J (+ (* 0.3333333333333333 (pow l 3.0)) (* l 2.0))))))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.005) {
tmp = U + (l * (cos((K * 0.5)) * (J * 2.0)));
} 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) :: tmp
if (cos((k / 2.0d0)) <= (-0.005d0)) then
tmp = u + (l * (cos((k * 0.5d0)) * (j * 2.0d0)))
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 tmp;
if (Math.cos((K / 2.0)) <= -0.005) {
tmp = U + (l * (Math.cos((K * 0.5)) * (J * 2.0)));
} else {
tmp = U + (J * ((0.3333333333333333 * Math.pow(l, 3.0)) + (l * 2.0)));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if math.cos((K / 2.0)) <= -0.005: tmp = U + (l * (math.cos((K * 0.5)) * (J * 2.0))) else: tmp = U + (J * ((0.3333333333333333 * math.pow(l, 3.0)) + (l * 2.0))) return tmp
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.005) tmp = Float64(U + Float64(l * Float64(cos(Float64(K * 0.5)) * Float64(J * 2.0)))); 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) tmp = 0.0; if (cos((K / 2.0)) <= -0.005) tmp = U + (l * (cos((K * 0.5)) * (J * 2.0))); else tmp = U + (J * ((0.3333333333333333 * (l ^ 3.0)) + (l * 2.0))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.005], N[(U + N[(l * N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 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}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.005:\\
\;\;\;\;U + \ell \cdot \left(\cos \left(K \cdot 0.5\right) \cdot \left(J \cdot 2\right)\right)\\
\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.0050000000000000001Initial program 73.8%
Taylor expanded in l around 0 66.5%
associate-*r*66.5%
*-commutative66.5%
associate-*l*66.5%
Simplified66.5%
if -0.0050000000000000001 < (cos.f64 (/.f64 K 2)) Initial program 89.6%
Taylor expanded in l around 0 84.5%
Taylor expanded in K around 0 80.7%
Final simplification77.0%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (* (- (exp l) (exp (- l))) J)))
(if (<= l -240.0)
t_0
(if (<= l 0.245) (+ U (* 2.0 (* J (* l (cos (* K 0.5)))))) (+ t_0 U)))))
double code(double J, double l, double K, double U) {
double t_0 = (exp(l) - exp(-l)) * J;
double tmp;
if (l <= -240.0) {
tmp = t_0;
} else if (l <= 0.245) {
tmp = U + (2.0 * (J * (l * cos((K * 0.5)))));
} else {
tmp = t_0 + U;
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: t_0
real(8) :: tmp
t_0 = (exp(l) - exp(-l)) * j
if (l <= (-240.0d0)) then
tmp = t_0
else if (l <= 0.245d0) then
tmp = u + (2.0d0 * (j * (l * cos((k * 0.5d0)))))
else
tmp = t_0 + u
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)) * J;
double tmp;
if (l <= -240.0) {
tmp = t_0;
} else if (l <= 0.245) {
tmp = U + (2.0 * (J * (l * Math.cos((K * 0.5)))));
} else {
tmp = t_0 + U;
}
return tmp;
}
def code(J, l, K, U): t_0 = (math.exp(l) - math.exp(-l)) * J tmp = 0 if l <= -240.0: tmp = t_0 elif l <= 0.245: tmp = U + (2.0 * (J * (l * math.cos((K * 0.5))))) else: tmp = t_0 + U return tmp
function code(J, l, K, U) t_0 = Float64(Float64(exp(l) - exp(Float64(-l))) * J) tmp = 0.0 if (l <= -240.0) tmp = t_0; elseif (l <= 0.245) tmp = Float64(U + Float64(2.0 * Float64(J * Float64(l * cos(Float64(K * 0.5)))))); else tmp = Float64(t_0 + U); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = (exp(l) - exp(-l)) * J; tmp = 0.0; if (l <= -240.0) tmp = t_0; elseif (l <= 0.245) tmp = U + (2.0 * (J * (l * cos((K * 0.5))))); else tmp = t_0 + U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision]}, If[LessEqual[l, -240.0], t$95$0, If[LessEqual[l, 0.245], N[(U + N[(2.0 * N[(J * N[(l * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 + U), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(e^{\ell} - e^{-\ell}\right) \cdot J\\
\mathbf{if}\;\ell \leq -240:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq 0.245:\\
\;\;\;\;U + 2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_0 + U\\
\end{array}
\end{array}
if l < -240Initial program 100.0%
Taylor expanded in K around 0 85.1%
Taylor expanded in J around inf 85.1%
if -240 < l < 0.245Initial program 69.4%
Taylor expanded in l around 0 99.3%
if 0.245 < l Initial program 100.0%
Taylor expanded in K around 0 67.9%
Final simplification87.2%
(FPCore (J l K U) :precision binary64 (if (or (<= l -2.5e+54) (not (<= l 2e+32))) (* (pow l 3.0) (* J 0.3333333333333333)) (+ U (* 2.0 (* J (* l (cos (* K 0.5))))))))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -2.5e+54) || !(l <= 2e+32)) {
tmp = pow(l, 3.0) * (J * 0.3333333333333333);
} else {
tmp = U + (2.0 * (J * (l * cos((K * 0.5)))));
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if ((l <= (-2.5d+54)) .or. (.not. (l <= 2d+32))) then
tmp = (l ** 3.0d0) * (j * 0.3333333333333333d0)
else
tmp = u + (2.0d0 * (j * (l * cos((k * 0.5d0)))))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -2.5e+54) || !(l <= 2e+32)) {
tmp = Math.pow(l, 3.0) * (J * 0.3333333333333333);
} else {
tmp = U + (2.0 * (J * (l * Math.cos((K * 0.5)))));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -2.5e+54) or not (l <= 2e+32): tmp = math.pow(l, 3.0) * (J * 0.3333333333333333) else: tmp = U + (2.0 * (J * (l * math.cos((K * 0.5))))) return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -2.5e+54) || !(l <= 2e+32)) tmp = Float64((l ^ 3.0) * Float64(J * 0.3333333333333333)); else tmp = Float64(U + Float64(2.0 * Float64(J * Float64(l * cos(Float64(K * 0.5)))))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -2.5e+54) || ~((l <= 2e+32))) tmp = (l ^ 3.0) * (J * 0.3333333333333333); else tmp = U + (2.0 * (J * (l * cos((K * 0.5))))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -2.5e+54], N[Not[LessEqual[l, 2e+32]], $MachinePrecision]], N[(N[Power[l, 3.0], $MachinePrecision] * N[(J * 0.3333333333333333), $MachinePrecision]), $MachinePrecision], N[(U + N[(2.0 * N[(J * N[(l * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2.5 \cdot 10^{+54} \lor \neg \left(\ell \leq 2 \cdot 10^{+32}\right):\\
\;\;\;\;{\ell}^{3} \cdot \left(J \cdot 0.3333333333333333\right)\\
\mathbf{else}:\\
\;\;\;\;U + 2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\end{array}
\end{array}
if l < -2.50000000000000003e54 or 2.00000000000000011e32 < l Initial program 100.0%
Taylor expanded in l around 0 83.4%
Taylor expanded in K around 0 64.2%
Taylor expanded in l around inf 64.2%
*-commutative64.2%
*-commutative64.2%
associate-*l*64.2%
Simplified64.2%
if -2.50000000000000003e54 < l < 2.00000000000000011e32Initial program 73.8%
Taylor expanded in l around 0 86.3%
Final simplification76.4%
(FPCore (J l K U) :precision binary64 (if (or (<= l -2.5e+54) (not (<= l 1.24e+32))) (* (pow l 3.0) (* J 0.3333333333333333)) (fma J (* l 2.0) U)))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -2.5e+54) || !(l <= 1.24e+32)) {
tmp = pow(l, 3.0) * (J * 0.3333333333333333);
} else {
tmp = fma(J, (l * 2.0), U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if ((l <= -2.5e+54) || !(l <= 1.24e+32)) tmp = Float64((l ^ 3.0) * Float64(J * 0.3333333333333333)); else tmp = fma(J, Float64(l * 2.0), U); end return tmp end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -2.5e+54], N[Not[LessEqual[l, 1.24e+32]], $MachinePrecision]], N[(N[Power[l, 3.0], $MachinePrecision] * N[(J * 0.3333333333333333), $MachinePrecision]), $MachinePrecision], N[(J * N[(l * 2.0), $MachinePrecision] + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2.5 \cdot 10^{+54} \lor \neg \left(\ell \leq 1.24 \cdot 10^{+32}\right):\\
\;\;\;\;{\ell}^{3} \cdot \left(J \cdot 0.3333333333333333\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(J, \ell \cdot 2, U\right)\\
\end{array}
\end{array}
if l < -2.50000000000000003e54 or 1.24000000000000008e32 < l Initial program 100.0%
Taylor expanded in l around 0 83.4%
Taylor expanded in K around 0 64.2%
Taylor expanded in l around inf 64.2%
*-commutative64.2%
*-commutative64.2%
associate-*l*64.2%
Simplified64.2%
if -2.50000000000000003e54 < l < 1.24000000000000008e32Initial program 73.8%
Taylor expanded in K around 0 68.6%
Taylor expanded in l around 0 68.0%
+-commutative68.0%
*-commutative68.0%
associate-*l*68.0%
fma-def68.0%
Simplified68.0%
Final simplification66.3%
(FPCore (J l K U) :precision binary64 (fma J (* l 2.0) U))
double code(double J, double l, double K, double U) {
return fma(J, (l * 2.0), U);
}
function code(J, l, K, U) return fma(J, Float64(l * 2.0), U) end
code[J_, l_, K_, U_] := N[(J * N[(l * 2.0), $MachinePrecision] + U), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(J, \ell \cdot 2, U\right)
\end{array}
Initial program 85.6%
Taylor expanded in K around 0 72.2%
Taylor expanded in l around 0 45.2%
+-commutative45.2%
*-commutative45.2%
associate-*l*45.2%
fma-def45.2%
Simplified45.2%
Final simplification45.2%
(FPCore (J l K U) :precision binary64 (if (or (<= l -1.15e-10) (not (<= l 108.0))) (* U (+ U -1.0)) U))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -1.15e-10) || !(l <= 108.0)) {
tmp = U * (U + -1.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 <= (-1.15d-10)) .or. (.not. (l <= 108.0d0))) then
tmp = u * (u + (-1.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 <= -1.15e-10) || !(l <= 108.0)) {
tmp = U * (U + -1.0);
} else {
tmp = U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -1.15e-10) or not (l <= 108.0): tmp = U * (U + -1.0) else: tmp = U return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -1.15e-10) || !(l <= 108.0)) tmp = Float64(U * Float64(U + -1.0)); else tmp = U; end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -1.15e-10) || ~((l <= 108.0))) tmp = U * (U + -1.0); else tmp = U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -1.15e-10], N[Not[LessEqual[l, 108.0]], $MachinePrecision]], N[(U * N[(U + -1.0), $MachinePrecision]), $MachinePrecision], U]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.15 \cdot 10^{-10} \lor \neg \left(\ell \leq 108\right):\\
\;\;\;\;U \cdot \left(U + -1\right)\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\end{array}
if l < -1.15000000000000004e-10 or 108 < l Initial program 99.6%
Taylor expanded in K around 0 75.9%
Applied egg-rr15.5%
fma-udef15.5%
neg-mul-115.5%
distribute-rgt-out15.5%
Simplified15.5%
if -1.15000000000000004e-10 < l < 108Initial program 69.6%
Taylor expanded in J around 0 67.4%
Final simplification39.8%
(FPCore (J l K U) :precision binary64 (if (or (<= l -1.15e-10) (not (<= l 80000000000000.0))) (* U U) U))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -1.15e-10) || !(l <= 80000000000000.0)) {
tmp = U * U;
} else {
tmp = U;
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if ((l <= (-1.15d-10)) .or. (.not. (l <= 80000000000000.0d0))) then
tmp = u * u
else
tmp = u
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -1.15e-10) || !(l <= 80000000000000.0)) {
tmp = U * U;
} else {
tmp = U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -1.15e-10) or not (l <= 80000000000000.0): tmp = U * U else: tmp = U return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -1.15e-10) || !(l <= 80000000000000.0)) tmp = Float64(U * U); else tmp = U; end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -1.15e-10) || ~((l <= 80000000000000.0))) tmp = U * U; else tmp = U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -1.15e-10], N[Not[LessEqual[l, 80000000000000.0]], $MachinePrecision]], N[(U * U), $MachinePrecision], U]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.15 \cdot 10^{-10} \lor \neg \left(\ell \leq 80000000000000\right):\\
\;\;\;\;U \cdot U\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\end{array}
if l < -1.15000000000000004e-10 or 8e13 < l Initial program 99.6%
Applied egg-rr15.8%
if -1.15000000000000004e-10 < l < 8e13Initial program 70.8%
Taylor expanded in J around 0 64.8%
Final simplification39.8%
(FPCore (J l K U) :precision binary64 (+ U (* l (* J 2.0))))
double code(double J, double l, double K, double U) {
return U + (l * (J * 2.0));
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = u + (l * (j * 2.0d0))
end function
public static double code(double J, double l, double K, double U) {
return U + (l * (J * 2.0));
}
def code(J, l, K, U): return U + (l * (J * 2.0))
function code(J, l, K, U) return Float64(U + Float64(l * Float64(J * 2.0))) end
function tmp = code(J, l, K, U) tmp = U + (l * (J * 2.0)); end
code[J_, l_, K_, U_] := N[(U + N[(l * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + \ell \cdot \left(J \cdot 2\right)
\end{array}
Initial program 85.6%
Taylor expanded in l around 0 85.1%
Taylor expanded in K around 0 66.3%
Taylor expanded in l around 0 45.2%
associate-*r*45.2%
Simplified45.2%
Final simplification45.2%
(FPCore (J l K U) :precision binary64 0.0)
double code(double J, double l, double K, double U) {
return 0.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 = 0.0d0
end function
public static double code(double J, double l, double K, double U) {
return 0.0;
}
def code(J, l, K, U): return 0.0
function code(J, l, K, U) return 0.0 end
function tmp = code(J, l, K, U) tmp = 0.0; end
code[J_, l_, K_, U_] := 0.0
\begin{array}{l}
\\
0
\end{array}
Initial program 85.6%
Taylor expanded in K around 0 72.2%
Applied egg-rr2.4%
+-inverses2.4%
Simplified2.4%
Final simplification2.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.6%
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.6%
Taylor expanded in J around 0 32.8%
Final simplification32.8%
herbie shell --seed 2024021
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))