
(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 (<= t_1 (- INFINITY))
(+ (* (* t_1 J) t_0) U)
(if (<= t_1 0.0) (+ U (* t_0 (* l (* J 2.0)))) (fma J (* t_1 t_0) U)))))
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)) {
tmp = ((t_1 * J) * t_0) + U;
} else if (t_1 <= 0.0) {
tmp = U + (t_0 * (l * (J * 2.0)));
} else {
tmp = fma(J, (t_1 * t_0), U);
}
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)) tmp = Float64(Float64(Float64(t_1 * J) * t_0) + U); elseif (t_1 <= 0.0) tmp = Float64(U + Float64(t_0 * Float64(l * Float64(J * 2.0)))); else tmp = fma(J, Float64(t_1 * t_0), U); end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(N[(N[(t$95$1 * J), $MachinePrecision] * t$95$0), $MachinePrecision] + U), $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[(U + N[(t$95$0 * N[(l * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(J * N[(t$95$1 * t$95$0), $MachinePrecision] + U), $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:\\
\;\;\;\;\left(t\_1 \cdot J\right) \cdot t\_0 + U\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;U + t\_0 \cdot \left(\ell \cdot \left(J \cdot 2\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(J, t\_1 \cdot t\_0, U\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -inf.0Initial program 100.0%
if -inf.0 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 0.0Initial program 66.6%
Taylor expanded in l around 0 99.9%
associate-*r*99.9%
Simplified99.9%
if 0.0 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 98.8%
associate-*l*98.8%
fma-define98.8%
Simplified98.8%
Final simplification99.6%
(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 (* l (* J 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 * (l * (J * 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 * (l * (J * 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 * (l * (J * 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(l * Float64(J * 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 * (l * (J * 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[(l * N[(J * 2.0), $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(\ell \cdot \left(J \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 99.3%
if -inf.0 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 0.0Initial program 66.6%
Taylor expanded in l around 0 99.9%
associate-*r*99.9%
Simplified99.9%
Final simplification99.6%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (* (- (exp l) (exp (- l))) J)))
(if (<= l -1.22e+138)
(+ U (* (* J 0.3333333333333333) (* (pow l 3.0) (cos (* K 0.5)))))
(if (<= l -9.8e+30)
t_0
(if (or (<= l 0.057) (not (<= l 1.05e+99)))
(+
U
(*
(cos (/ K 2.0))
(* J (* l (+ 2.0 (* 0.3333333333333333 (pow l 2.0)))))))
(+ 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 <= -1.22e+138) {
tmp = U + ((J * 0.3333333333333333) * (pow(l, 3.0) * cos((K * 0.5))));
} else if (l <= -9.8e+30) {
tmp = t_0;
} else if ((l <= 0.057) || !(l <= 1.05e+99)) {
tmp = U + (cos((K / 2.0)) * (J * (l * (2.0 + (0.3333333333333333 * pow(l, 2.0))))));
} 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 <= (-1.22d+138)) then
tmp = u + ((j * 0.3333333333333333d0) * ((l ** 3.0d0) * cos((k * 0.5d0))))
else if (l <= (-9.8d+30)) then
tmp = t_0
else if ((l <= 0.057d0) .or. (.not. (l <= 1.05d+99))) then
tmp = u + (cos((k / 2.0d0)) * (j * (l * (2.0d0 + (0.3333333333333333d0 * (l ** 2.0d0))))))
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 <= -1.22e+138) {
tmp = U + ((J * 0.3333333333333333) * (Math.pow(l, 3.0) * Math.cos((K * 0.5))));
} else if (l <= -9.8e+30) {
tmp = t_0;
} else if ((l <= 0.057) || !(l <= 1.05e+99)) {
tmp = U + (Math.cos((K / 2.0)) * (J * (l * (2.0 + (0.3333333333333333 * Math.pow(l, 2.0))))));
} 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 <= -1.22e+138: tmp = U + ((J * 0.3333333333333333) * (math.pow(l, 3.0) * math.cos((K * 0.5)))) elif l <= -9.8e+30: tmp = t_0 elif (l <= 0.057) or not (l <= 1.05e+99): tmp = U + (math.cos((K / 2.0)) * (J * (l * (2.0 + (0.3333333333333333 * math.pow(l, 2.0)))))) 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 <= -1.22e+138) tmp = Float64(U + Float64(Float64(J * 0.3333333333333333) * Float64((l ^ 3.0) * cos(Float64(K * 0.5))))); elseif (l <= -9.8e+30) tmp = t_0; elseif ((l <= 0.057) || !(l <= 1.05e+99)) tmp = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(J * Float64(l * Float64(2.0 + Float64(0.3333333333333333 * (l ^ 2.0))))))); 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 <= -1.22e+138) tmp = U + ((J * 0.3333333333333333) * ((l ^ 3.0) * cos((K * 0.5)))); elseif (l <= -9.8e+30) tmp = t_0; elseif ((l <= 0.057) || ~((l <= 1.05e+99))) tmp = U + (cos((K / 2.0)) * (J * (l * (2.0 + (0.3333333333333333 * (l ^ 2.0)))))); 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, -1.22e+138], N[(U + N[(N[(J * 0.3333333333333333), $MachinePrecision] * N[(N[Power[l, 3.0], $MachinePrecision] * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -9.8e+30], t$95$0, If[Or[LessEqual[l, 0.057], N[Not[LessEqual[l, 1.05e+99]], $MachinePrecision]], N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(J * N[(l * N[(2.0 + N[(0.3333333333333333 * N[Power[l, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 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 -1.22 \cdot 10^{+138}:\\
\;\;\;\;U + \left(J \cdot 0.3333333333333333\right) \cdot \left({\ell}^{3} \cdot \cos \left(K \cdot 0.5\right)\right)\\
\mathbf{elif}\;\ell \leq -9.8 \cdot 10^{+30}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq 0.057 \lor \neg \left(\ell \leq 1.05 \cdot 10^{+99}\right):\\
\;\;\;\;U + \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(\ell \cdot \left(2 + 0.3333333333333333 \cdot {\ell}^{2}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0 + U\\
\end{array}
\end{array}
if l < -1.22000000000000001e138Initial program 100.0%
Taylor expanded in l around 0 100.0%
Taylor expanded in l around inf 100.0%
associate-*r*100.0%
*-commutative100.0%
Simplified100.0%
if -1.22000000000000001e138 < l < -9.79999999999999969e30Initial program 100.0%
Taylor expanded in K around 0 91.7%
Taylor expanded in J around inf 91.7%
if -9.79999999999999969e30 < l < 0.0570000000000000021 or 1.05000000000000005e99 < l Initial program 78.0%
Taylor expanded in l around 0 94.7%
if 0.0570000000000000021 < l < 1.05000000000000005e99Initial program 100.0%
Taylor expanded in K around 0 77.8%
Final simplification93.4%
(FPCore (J l K U)
:precision binary64
(let* ((t_0
(+ U (* (* J 0.3333333333333333) (* (pow l 3.0) (cos (* K 0.5))))))
(t_1 (* (- (exp l) (exp (- l))) J)))
(if (<= l -1.22e+138)
t_0
(if (<= l -9.8e+30)
t_1
(if (<= l 8.4e-10)
(+ U (* (cos (/ K 2.0)) (* l (* J 2.0))))
(if (<= l 1.6e+100) (+ t_1 U) t_0))))))
double code(double J, double l, double K, double U) {
double t_0 = U + ((J * 0.3333333333333333) * (pow(l, 3.0) * cos((K * 0.5))));
double t_1 = (exp(l) - exp(-l)) * J;
double tmp;
if (l <= -1.22e+138) {
tmp = t_0;
} else if (l <= -9.8e+30) {
tmp = t_1;
} else if (l <= 8.4e-10) {
tmp = U + (cos((K / 2.0)) * (l * (J * 2.0)));
} else if (l <= 1.6e+100) {
tmp = t_1 + U;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = u + ((j * 0.3333333333333333d0) * ((l ** 3.0d0) * cos((k * 0.5d0))))
t_1 = (exp(l) - exp(-l)) * j
if (l <= (-1.22d+138)) then
tmp = t_0
else if (l <= (-9.8d+30)) then
tmp = t_1
else if (l <= 8.4d-10) then
tmp = u + (cos((k / 2.0d0)) * (l * (j * 2.0d0)))
else if (l <= 1.6d+100) then
tmp = t_1 + u
else
tmp = t_0
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = U + ((J * 0.3333333333333333) * (Math.pow(l, 3.0) * Math.cos((K * 0.5))));
double t_1 = (Math.exp(l) - Math.exp(-l)) * J;
double tmp;
if (l <= -1.22e+138) {
tmp = t_0;
} else if (l <= -9.8e+30) {
tmp = t_1;
} else if (l <= 8.4e-10) {
tmp = U + (Math.cos((K / 2.0)) * (l * (J * 2.0)));
} else if (l <= 1.6e+100) {
tmp = t_1 + U;
} else {
tmp = t_0;
}
return tmp;
}
def code(J, l, K, U): t_0 = U + ((J * 0.3333333333333333) * (math.pow(l, 3.0) * math.cos((K * 0.5)))) t_1 = (math.exp(l) - math.exp(-l)) * J tmp = 0 if l <= -1.22e+138: tmp = t_0 elif l <= -9.8e+30: tmp = t_1 elif l <= 8.4e-10: tmp = U + (math.cos((K / 2.0)) * (l * (J * 2.0))) elif l <= 1.6e+100: tmp = t_1 + U else: tmp = t_0 return tmp
function code(J, l, K, U) t_0 = Float64(U + Float64(Float64(J * 0.3333333333333333) * Float64((l ^ 3.0) * cos(Float64(K * 0.5))))) t_1 = Float64(Float64(exp(l) - exp(Float64(-l))) * J) tmp = 0.0 if (l <= -1.22e+138) tmp = t_0; elseif (l <= -9.8e+30) tmp = t_1; elseif (l <= 8.4e-10) tmp = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(l * Float64(J * 2.0)))); elseif (l <= 1.6e+100) tmp = Float64(t_1 + U); else tmp = t_0; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = U + ((J * 0.3333333333333333) * ((l ^ 3.0) * cos((K * 0.5)))); t_1 = (exp(l) - exp(-l)) * J; tmp = 0.0; if (l <= -1.22e+138) tmp = t_0; elseif (l <= -9.8e+30) tmp = t_1; elseif (l <= 8.4e-10) tmp = U + (cos((K / 2.0)) * (l * (J * 2.0))); elseif (l <= 1.6e+100) tmp = t_1 + U; else tmp = t_0; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(U + N[(N[(J * 0.3333333333333333), $MachinePrecision] * N[(N[Power[l, 3.0], $MachinePrecision] * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision]}, If[LessEqual[l, -1.22e+138], t$95$0, If[LessEqual[l, -9.8e+30], t$95$1, If[LessEqual[l, 8.4e-10], N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(l * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.6e+100], N[(t$95$1 + U), $MachinePrecision], t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + \left(J \cdot 0.3333333333333333\right) \cdot \left({\ell}^{3} \cdot \cos \left(K \cdot 0.5\right)\right)\\
t_1 := \left(e^{\ell} - e^{-\ell}\right) \cdot J\\
\mathbf{if}\;\ell \leq -1.22 \cdot 10^{+138}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq -9.8 \cdot 10^{+30}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\ell \leq 8.4 \cdot 10^{-10}:\\
\;\;\;\;U + \cos \left(\frac{K}{2}\right) \cdot \left(\ell \cdot \left(J \cdot 2\right)\right)\\
\mathbf{elif}\;\ell \leq 1.6 \cdot 10^{+100}:\\
\;\;\;\;t\_1 + U\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if l < -1.22000000000000001e138 or 1.5999999999999999e100 < l Initial program 100.0%
Taylor expanded in l around 0 97.8%
Taylor expanded in l around inf 97.8%
associate-*r*97.8%
*-commutative97.8%
Simplified97.8%
if -1.22000000000000001e138 < l < -9.79999999999999969e30Initial program 100.0%
Taylor expanded in K around 0 91.7%
Taylor expanded in J around inf 91.7%
if -9.79999999999999969e30 < l < 8.3999999999999999e-10Initial program 68.7%
Taylor expanded in l around 0 94.8%
associate-*r*94.8%
Simplified94.8%
if 8.3999999999999999e-10 < l < 1.5999999999999999e100Initial program 97.9%
Taylor expanded in K around 0 73.3%
Final simplification93.0%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.075) (* U (+ 1.0 (* 2.0 (/ (* J (* l (cos (* K 0.5)))) U)))) (+ U (* J (* l (+ 2.0 (* 0.3333333333333333 (pow l 2.0))))))))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.075) {
tmp = U * (1.0 + (2.0 * ((J * (l * cos((K * 0.5)))) / U)));
} else {
tmp = U + (J * (l * (2.0 + (0.3333333333333333 * pow(l, 2.0)))));
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if (cos((k / 2.0d0)) <= (-0.075d0)) then
tmp = u * (1.0d0 + (2.0d0 * ((j * (l * cos((k * 0.5d0)))) / u)))
else
tmp = u + (j * (l * (2.0d0 + (0.3333333333333333d0 * (l ** 2.0d0)))))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (Math.cos((K / 2.0)) <= -0.075) {
tmp = U * (1.0 + (2.0 * ((J * (l * Math.cos((K * 0.5)))) / U)));
} else {
tmp = U + (J * (l * (2.0 + (0.3333333333333333 * Math.pow(l, 2.0)))));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if math.cos((K / 2.0)) <= -0.075: tmp = U * (1.0 + (2.0 * ((J * (l * math.cos((K * 0.5)))) / U))) else: tmp = U + (J * (l * (2.0 + (0.3333333333333333 * math.pow(l, 2.0))))) return tmp
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.075) tmp = Float64(U * Float64(1.0 + Float64(2.0 * Float64(Float64(J * Float64(l * cos(Float64(K * 0.5)))) / U)))); else tmp = Float64(U + Float64(J * Float64(l * Float64(2.0 + Float64(0.3333333333333333 * (l ^ 2.0)))))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (cos((K / 2.0)) <= -0.075) tmp = U * (1.0 + (2.0 * ((J * (l * cos((K * 0.5)))) / U))); else tmp = U + (J * (l * (2.0 + (0.3333333333333333 * (l ^ 2.0))))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.075], N[(U * N[(1.0 + N[(2.0 * N[(N[(J * N[(l * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * N[(l * N[(2.0 + N[(0.3333333333333333 * N[Power[l, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.075:\\
\;\;\;\;U \cdot \left(1 + 2 \cdot \frac{J \cdot \left(\ell \cdot \cos \left(K \cdot 0.5\right)\right)}{U}\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(\ell \cdot \left(2 + 0.3333333333333333 \cdot {\ell}^{2}\right)\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0749999999999999972Initial program 81.8%
Taylor expanded in l around 0 60.9%
*-commutative60.9%
associate-*r*61.0%
associate-*l*61.0%
*-commutative61.0%
*-commutative61.0%
associate-*l*61.0%
*-commutative61.0%
Simplified61.0%
Taylor expanded in U around inf 62.5%
if -0.0749999999999999972 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 86.7%
Taylor expanded in l around 0 82.7%
Taylor expanded in K around 0 77.4%
Final simplification74.0%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.05) (+ U (* l (* J (* 2.0 (cos (* K 0.5)))))) (+ U (* J (* l (+ 2.0 (* 0.3333333333333333 (pow l 2.0))))))))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.05) {
tmp = U + (l * (J * (2.0 * cos((K * 0.5)))));
} else {
tmp = U + (J * (l * (2.0 + (0.3333333333333333 * pow(l, 2.0)))));
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if (cos((k / 2.0d0)) <= (-0.05d0)) then
tmp = u + (l * (j * (2.0d0 * cos((k * 0.5d0)))))
else
tmp = u + (j * (l * (2.0d0 + (0.3333333333333333d0 * (l ** 2.0d0)))))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (Math.cos((K / 2.0)) <= -0.05) {
tmp = U + (l * (J * (2.0 * Math.cos((K * 0.5)))));
} else {
tmp = U + (J * (l * (2.0 + (0.3333333333333333 * Math.pow(l, 2.0)))));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if math.cos((K / 2.0)) <= -0.05: tmp = U + (l * (J * (2.0 * math.cos((K * 0.5))))) else: tmp = U + (J * (l * (2.0 + (0.3333333333333333 * math.pow(l, 2.0))))) return tmp
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.05) tmp = Float64(U + Float64(l * Float64(J * Float64(2.0 * cos(Float64(K * 0.5)))))); else tmp = Float64(U + Float64(J * Float64(l * Float64(2.0 + Float64(0.3333333333333333 * (l ^ 2.0)))))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (cos((K / 2.0)) <= -0.05) tmp = U + (l * (J * (2.0 * cos((K * 0.5))))); else tmp = U + (J * (l * (2.0 + (0.3333333333333333 * (l ^ 2.0))))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.05], N[(U + N[(l * N[(J * N[(2.0 * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * N[(l * N[(2.0 + N[(0.3333333333333333 * N[Power[l, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.05:\\
\;\;\;\;U + \ell \cdot \left(J \cdot \left(2 \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(\ell \cdot \left(2 + 0.3333333333333333 \cdot {\ell}^{2}\right)\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.050000000000000003Initial program 80.5%
Taylor expanded in l around 0 61.5%
*-commutative61.5%
associate-*r*61.6%
associate-*l*61.6%
*-commutative61.6%
*-commutative61.6%
associate-*l*61.6%
*-commutative61.6%
Simplified61.6%
if -0.050000000000000003 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 87.1%
Taylor expanded in l around 0 82.6%
Taylor expanded in K around 0 77.8%
Final simplification74.0%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (* (- (exp l) (exp (- l))) J)))
(if (<= l -450.0)
t_0
(if (<= l 7.2e-5) (+ U (* (cos (/ K 2.0)) (* l (* J 2.0)))) (+ 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 <= -450.0) {
tmp = t_0;
} else if (l <= 7.2e-5) {
tmp = U + (cos((K / 2.0)) * (l * (J * 2.0)));
} 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 <= (-450.0d0)) then
tmp = t_0
else if (l <= 7.2d-5) then
tmp = u + (cos((k / 2.0d0)) * (l * (j * 2.0d0)))
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 <= -450.0) {
tmp = t_0;
} else if (l <= 7.2e-5) {
tmp = U + (Math.cos((K / 2.0)) * (l * (J * 2.0)));
} 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 <= -450.0: tmp = t_0 elif l <= 7.2e-5: tmp = U + (math.cos((K / 2.0)) * (l * (J * 2.0))) 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 <= -450.0) tmp = t_0; elseif (l <= 7.2e-5) tmp = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(l * Float64(J * 2.0)))); 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 <= -450.0) tmp = t_0; elseif (l <= 7.2e-5) tmp = U + (cos((K / 2.0)) * (l * (J * 2.0))); 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, -450.0], t$95$0, If[LessEqual[l, 7.2e-5], N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(l * N[(J * 2.0), $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 -450:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq 7.2 \cdot 10^{-5}:\\
\;\;\;\;U + \cos \left(\frac{K}{2}\right) \cdot \left(\ell \cdot \left(J \cdot 2\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0 + U\\
\end{array}
\end{array}
if l < -450Initial program 100.0%
Taylor expanded in K around 0 77.9%
Taylor expanded in J around inf 77.9%
if -450 < l < 7.20000000000000018e-5Initial program 66.5%
Taylor expanded in l around 0 99.9%
associate-*r*99.9%
Simplified99.9%
if 7.20000000000000018e-5 < l Initial program 99.8%
Taylor expanded in K around 0 78.2%
Final simplification87.5%
(FPCore (J l K U) :precision binary64 (if (or (<= l -170.0) (not (<= l 7.5e-5))) (* (- (exp l) (exp (- l))) J) (+ U (* (cos (/ K 2.0)) (* l (* J 2.0))))))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -170.0) || !(l <= 7.5e-5)) {
tmp = (exp(l) - exp(-l)) * J;
} else {
tmp = U + (cos((K / 2.0)) * (l * (J * 2.0)));
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if ((l <= (-170.0d0)) .or. (.not. (l <= 7.5d-5))) then
tmp = (exp(l) - exp(-l)) * j
else
tmp = u + (cos((k / 2.0d0)) * (l * (j * 2.0d0)))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -170.0) || !(l <= 7.5e-5)) {
tmp = (Math.exp(l) - Math.exp(-l)) * J;
} else {
tmp = U + (Math.cos((K / 2.0)) * (l * (J * 2.0)));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -170.0) or not (l <= 7.5e-5): tmp = (math.exp(l) - math.exp(-l)) * J else: tmp = U + (math.cos((K / 2.0)) * (l * (J * 2.0))) return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -170.0) || !(l <= 7.5e-5)) tmp = Float64(Float64(exp(l) - exp(Float64(-l))) * J); else tmp = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(l * Float64(J * 2.0)))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -170.0) || ~((l <= 7.5e-5))) tmp = (exp(l) - exp(-l)) * J; else tmp = U + (cos((K / 2.0)) * (l * (J * 2.0))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -170.0], N[Not[LessEqual[l, 7.5e-5]], $MachinePrecision]], N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision], N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(l * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -170 \lor \neg \left(\ell \leq 7.5 \cdot 10^{-5}\right):\\
\;\;\;\;\left(e^{\ell} - e^{-\ell}\right) \cdot J\\
\mathbf{else}:\\
\;\;\;\;U + \cos \left(\frac{K}{2}\right) \cdot \left(\ell \cdot \left(J \cdot 2\right)\right)\\
\end{array}
\end{array}
if l < -170 or 7.49999999999999934e-5 < l Initial program 99.9%
Taylor expanded in K around 0 78.1%
Taylor expanded in J around inf 77.4%
if -170 < l < 7.49999999999999934e-5Initial program 66.5%
Taylor expanded in l around 0 99.9%
associate-*r*99.9%
Simplified99.9%
Final simplification87.1%
(FPCore (J l K U) :precision binary64 (if (or (<= l -1.35e+94) (not (<= l 3.0))) (* 0.3333333333333333 (* J (pow l 3.0))) (+ U (* (cos (/ K 2.0)) (* l (* J 2.0))))))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -1.35e+94) || !(l <= 3.0)) {
tmp = 0.3333333333333333 * (J * pow(l, 3.0));
} else {
tmp = U + (cos((K / 2.0)) * (l * (J * 2.0)));
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if ((l <= (-1.35d+94)) .or. (.not. (l <= 3.0d0))) then
tmp = 0.3333333333333333d0 * (j * (l ** 3.0d0))
else
tmp = u + (cos((k / 2.0d0)) * (l * (j * 2.0d0)))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -1.35e+94) || !(l <= 3.0)) {
tmp = 0.3333333333333333 * (J * Math.pow(l, 3.0));
} else {
tmp = U + (Math.cos((K / 2.0)) * (l * (J * 2.0)));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -1.35e+94) or not (l <= 3.0): tmp = 0.3333333333333333 * (J * math.pow(l, 3.0)) else: tmp = U + (math.cos((K / 2.0)) * (l * (J * 2.0))) return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -1.35e+94) || !(l <= 3.0)) tmp = Float64(0.3333333333333333 * Float64(J * (l ^ 3.0))); else tmp = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(l * Float64(J * 2.0)))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -1.35e+94) || ~((l <= 3.0))) tmp = 0.3333333333333333 * (J * (l ^ 3.0)); else tmp = U + (cos((K / 2.0)) * (l * (J * 2.0))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -1.35e+94], N[Not[LessEqual[l, 3.0]], $MachinePrecision]], N[(0.3333333333333333 * N[(J * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(l * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.35 \cdot 10^{+94} \lor \neg \left(\ell \leq 3\right):\\
\;\;\;\;0.3333333333333333 \cdot \left(J \cdot {\ell}^{3}\right)\\
\mathbf{else}:\\
\;\;\;\;U + \cos \left(\frac{K}{2}\right) \cdot \left(\ell \cdot \left(J \cdot 2\right)\right)\\
\end{array}
\end{array}
if l < -1.3500000000000001e94 or 3 < l Initial program 100.0%
Taylor expanded in l around 0 80.0%
Taylor expanded in K around 0 60.1%
Taylor expanded in l around inf 60.7%
if -1.3500000000000001e94 < l < 3Initial program 72.4%
Taylor expanded in l around 0 85.9%
associate-*r*85.9%
Simplified85.9%
Final simplification73.9%
(FPCore (J l K U) :precision binary64 (if (or (<= l -2.2e+94) (not (<= l 3.0))) (* 0.3333333333333333 (* J (pow l 3.0))) (+ U (* l (* J (* 2.0 (cos (* K 0.5))))))))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -2.2e+94) || !(l <= 3.0)) {
tmp = 0.3333333333333333 * (J * pow(l, 3.0));
} else {
tmp = U + (l * (J * (2.0 * 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.2d+94)) .or. (.not. (l <= 3.0d0))) then
tmp = 0.3333333333333333d0 * (j * (l ** 3.0d0))
else
tmp = u + (l * (j * (2.0d0 * 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.2e+94) || !(l <= 3.0)) {
tmp = 0.3333333333333333 * (J * Math.pow(l, 3.0));
} else {
tmp = U + (l * (J * (2.0 * Math.cos((K * 0.5)))));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -2.2e+94) or not (l <= 3.0): tmp = 0.3333333333333333 * (J * math.pow(l, 3.0)) else: tmp = U + (l * (J * (2.0 * math.cos((K * 0.5))))) return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -2.2e+94) || !(l <= 3.0)) tmp = Float64(0.3333333333333333 * Float64(J * (l ^ 3.0))); else tmp = Float64(U + Float64(l * Float64(J * Float64(2.0 * cos(Float64(K * 0.5)))))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -2.2e+94) || ~((l <= 3.0))) tmp = 0.3333333333333333 * (J * (l ^ 3.0)); else tmp = U + (l * (J * (2.0 * cos((K * 0.5))))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -2.2e+94], N[Not[LessEqual[l, 3.0]], $MachinePrecision]], N[(0.3333333333333333 * N[(J * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(l * N[(J * N[(2.0 * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2.2 \cdot 10^{+94} \lor \neg \left(\ell \leq 3\right):\\
\;\;\;\;0.3333333333333333 \cdot \left(J \cdot {\ell}^{3}\right)\\
\mathbf{else}:\\
\;\;\;\;U + \ell \cdot \left(J \cdot \left(2 \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\end{array}
\end{array}
if l < -2.20000000000000012e94 or 3 < l Initial program 100.0%
Taylor expanded in l around 0 80.0%
Taylor expanded in K around 0 60.1%
Taylor expanded in l around inf 60.7%
if -2.20000000000000012e94 < l < 3Initial program 72.4%
Taylor expanded in l around 0 85.9%
*-commutative85.9%
associate-*r*85.9%
associate-*l*85.9%
*-commutative85.9%
*-commutative85.9%
associate-*l*85.9%
*-commutative85.9%
Simplified85.9%
Final simplification73.9%
(FPCore (J l K U) :precision binary64 (if (or (<= l -1.25e+94) (not (<= l 0.175))) (* 0.3333333333333333 (* J (pow l 3.0))) (+ U (* 2.0 (* J (* l (cos (* K 0.5))))))))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -1.25e+94) || !(l <= 0.175)) {
tmp = 0.3333333333333333 * (J * pow(l, 3.0));
} 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 <= (-1.25d+94)) .or. (.not. (l <= 0.175d0))) then
tmp = 0.3333333333333333d0 * (j * (l ** 3.0d0))
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 <= -1.25e+94) || !(l <= 0.175)) {
tmp = 0.3333333333333333 * (J * Math.pow(l, 3.0));
} else {
tmp = U + (2.0 * (J * (l * Math.cos((K * 0.5)))));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -1.25e+94) or not (l <= 0.175): tmp = 0.3333333333333333 * (J * math.pow(l, 3.0)) 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 <= -1.25e+94) || !(l <= 0.175)) tmp = Float64(0.3333333333333333 * Float64(J * (l ^ 3.0))); 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 <= -1.25e+94) || ~((l <= 0.175))) tmp = 0.3333333333333333 * (J * (l ^ 3.0)); 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, -1.25e+94], N[Not[LessEqual[l, 0.175]], $MachinePrecision]], N[(0.3333333333333333 * N[(J * N[Power[l, 3.0], $MachinePrecision]), $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 -1.25 \cdot 10^{+94} \lor \neg \left(\ell \leq 0.175\right):\\
\;\;\;\;0.3333333333333333 \cdot \left(J \cdot {\ell}^{3}\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 < -1.25000000000000003e94 or 0.17499999999999999 < l Initial program 100.0%
Taylor expanded in l around 0 80.1%
Taylor expanded in K around 0 60.4%
Taylor expanded in l around inf 60.2%
if -1.25000000000000003e94 < l < 0.17499999999999999Initial program 72.2%
Taylor expanded in l around 0 85.7%
Final simplification73.5%
(FPCore (J l K U) :precision binary64 (if (or (<= l -1.25e+94) (not (<= l 6.3e-24))) (* 0.3333333333333333 (* J (pow l 3.0))) (+ U (* l (* J 2.0)))))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -1.25e+94) || !(l <= 6.3e-24)) {
tmp = 0.3333333333333333 * (J * pow(l, 3.0));
} else {
tmp = U + (l * (J * 2.0));
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if ((l <= (-1.25d+94)) .or. (.not. (l <= 6.3d-24))) then
tmp = 0.3333333333333333d0 * (j * (l ** 3.0d0))
else
tmp = u + (l * (j * 2.0d0))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -1.25e+94) || !(l <= 6.3e-24)) {
tmp = 0.3333333333333333 * (J * Math.pow(l, 3.0));
} else {
tmp = U + (l * (J * 2.0));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -1.25e+94) or not (l <= 6.3e-24): tmp = 0.3333333333333333 * (J * math.pow(l, 3.0)) else: tmp = U + (l * (J * 2.0)) return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -1.25e+94) || !(l <= 6.3e-24)) tmp = Float64(0.3333333333333333 * Float64(J * (l ^ 3.0))); else tmp = Float64(U + Float64(l * Float64(J * 2.0))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -1.25e+94) || ~((l <= 6.3e-24))) tmp = 0.3333333333333333 * (J * (l ^ 3.0)); else tmp = U + (l * (J * 2.0)); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -1.25e+94], N[Not[LessEqual[l, 6.3e-24]], $MachinePrecision]], N[(0.3333333333333333 * N[(J * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(l * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.25 \cdot 10^{+94} \lor \neg \left(\ell \leq 6.3 \cdot 10^{-24}\right):\\
\;\;\;\;0.3333333333333333 \cdot \left(J \cdot {\ell}^{3}\right)\\
\mathbf{else}:\\
\;\;\;\;U + \ell \cdot \left(J \cdot 2\right)\\
\end{array}
\end{array}
if l < -1.25000000000000003e94 or 6.29999999999999979e-24 < l Initial program 98.5%
Taylor expanded in l around 0 80.8%
Taylor expanded in K around 0 59.3%
Taylor expanded in l around inf 58.4%
if -1.25000000000000003e94 < l < 6.29999999999999979e-24Initial program 72.8%
Taylor expanded in K around 0 70.3%
Taylor expanded in l around 0 69.4%
associate-*r*85.7%
Simplified69.4%
Final simplification63.9%
(FPCore (J l K U) :precision binary64 (if (or (<= l -1.2e+14) (not (<= l 3.0))) (- -4.0 (* U U)) U))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -1.2e+14) || !(l <= 3.0)) {
tmp = -4.0 - (U * U);
} else {
tmp = U;
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if ((l <= (-1.2d+14)) .or. (.not. (l <= 3.0d0))) then
tmp = (-4.0d0) - (u * u)
else
tmp = u
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -1.2e+14) || !(l <= 3.0)) {
tmp = -4.0 - (U * U);
} else {
tmp = U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -1.2e+14) or not (l <= 3.0): tmp = -4.0 - (U * U) else: tmp = U return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -1.2e+14) || !(l <= 3.0)) tmp = Float64(-4.0 - Float64(U * U)); else tmp = U; end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -1.2e+14) || ~((l <= 3.0))) tmp = -4.0 - (U * U); else tmp = U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -1.2e+14], N[Not[LessEqual[l, 3.0]], $MachinePrecision]], N[(-4.0 - N[(U * U), $MachinePrecision]), $MachinePrecision], U]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.2 \cdot 10^{+14} \lor \neg \left(\ell \leq 3\right):\\
\;\;\;\;-4 - U \cdot U\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\end{array}
if l < -1.2e14 or 3 < l Initial program 100.0%
associate-*l*100.0%
fma-define100.0%
Simplified100.0%
Applied egg-rr15.1%
cancel-sign-sub-inv15.1%
Simplified15.1%
if -1.2e14 < l < 3Initial program 67.6%
Taylor expanded in J around 0 63.7%
Final simplification36.7%
(FPCore (J l K U) :precision binary64 (if (or (<= l -3.2e+217) (not (<= l 2.05e-48))) (* U U) U))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -3.2e+217) || !(l <= 2.05e-48)) {
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 <= (-3.2d+217)) .or. (.not. (l <= 2.05d-48))) 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 <= -3.2e+217) || !(l <= 2.05e-48)) {
tmp = U * U;
} else {
tmp = U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -3.2e+217) or not (l <= 2.05e-48): tmp = U * U else: tmp = U return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -3.2e+217) || !(l <= 2.05e-48)) tmp = Float64(U * U); else tmp = U; end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -3.2e+217) || ~((l <= 2.05e-48))) tmp = U * U; else tmp = U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -3.2e+217], N[Not[LessEqual[l, 2.05e-48]], $MachinePrecision]], N[(U * U), $MachinePrecision], U]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -3.2 \cdot 10^{+217} \lor \neg \left(\ell \leq 2.05 \cdot 10^{-48}\right):\\
\;\;\;\;U \cdot U\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\end{array}
if l < -3.2000000000000001e217 or 2.05000000000000007e-48 < l Initial program 94.8%
Applied egg-rr14.3%
if -3.2000000000000001e217 < l < 2.05000000000000007e-48Initial program 78.5%
Taylor expanded in J around 0 48.1%
Final simplification33.5%
(FPCore (J l K U) :precision binary64 (+ U (* l (* J 2.0))))
double code(double J, double l, double K, double U) {
return U + (l * (J * 2.0));
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = u + (l * (j * 2.0d0))
end function
public static double code(double J, double l, double K, double U) {
return U + (l * (J * 2.0));
}
def code(J, l, K, U): return U + (l * (J * 2.0))
function code(J, l, K, U) return Float64(U + Float64(l * Float64(J * 2.0))) end
function tmp = code(J, l, K, U) tmp = U + (l * (J * 2.0)); end
code[J_, l_, K_, U_] := N[(U + N[(l * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + \ell \cdot \left(J \cdot 2\right)
\end{array}
Initial program 85.6%
Taylor expanded in K around 0 72.8%
Taylor expanded in l around 0 45.4%
associate-*r*57.6%
Simplified45.4%
Final simplification45.4%
(FPCore (J l K U) :precision binary64 U)
double code(double J, double l, double K, double U) {
return U;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = u
end function
public static double code(double J, double l, double K, double U) {
return U;
}
def code(J, l, K, U): return U
function code(J, l, K, U) return U end
function tmp = code(J, l, K, U) tmp = U; end
code[J_, l_, K_, U_] := U
\begin{array}{l}
\\
U
\end{array}
Initial program 85.6%
Taylor expanded in J around 0 29.6%
(FPCore (J l K U) :precision binary64 1.0)
double code(double J, double l, double K, double U) {
return 1.0;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = 1.0d0
end function
public static double code(double J, double l, double K, double U) {
return 1.0;
}
def code(J, l, K, U): return 1.0
function code(J, l, K, U) return 1.0 end
function tmp = code(J, l, K, U) tmp = 1.0; end
code[J_, l_, K_, U_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 85.6%
Applied egg-rr2.6%
*-inverses2.6%
Simplified2.6%
herbie shell --seed 2024107
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))