
(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 19 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 2e-7)
(+
U
(* t_0 (* l (+ (* 0.3333333333333333 (* J (pow l 2.0))) (* 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 <= 2e-7) {
tmp = U + (t_0 * (l * ((0.3333333333333333 * (J * pow(l, 2.0))) + (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 <= 2e-7) tmp = Float64(U + Float64(t_0 * Float64(l * Float64(Float64(0.3333333333333333 * Float64(J * (l ^ 2.0))) + 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, 2e-7], N[(U + N[(t$95$0 * N[(l * N[(N[(0.3333333333333333 * N[(J * N[Power[l, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(J * 2.0), $MachinePrecision]), $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 2 \cdot 10^{-7}:\\
\;\;\;\;U + t\_0 \cdot \left(\ell \cdot \left(0.3333333333333333 \cdot \left(J \cdot {\ell}^{2}\right) + 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))) < 1.9999999999999999e-7Initial program 66.6%
Taylor expanded in l around 0 99.9%
if 1.9999999999999999e-7 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 98.3%
associate-*l*98.3%
fma-define98.3%
Simplified98.3%
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 2e-7)))
(+ (* (* t_1 J) t_0) U)
(+
U
(* t_0 (* l (+ (* 0.3333333333333333 (* J (pow l 2.0))) (* 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 <= 2e-7)) {
tmp = ((t_1 * J) * t_0) + U;
} else {
tmp = U + (t_0 * (l * ((0.3333333333333333 * (J * pow(l, 2.0))) + (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 <= 2e-7)) {
tmp = ((t_1 * J) * t_0) + U;
} else {
tmp = U + (t_0 * (l * ((0.3333333333333333 * (J * Math.pow(l, 2.0))) + (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 <= 2e-7): tmp = ((t_1 * J) * t_0) + U else: tmp = U + (t_0 * (l * ((0.3333333333333333 * (J * math.pow(l, 2.0))) + (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 <= 2e-7)) tmp = Float64(Float64(Float64(t_1 * J) * t_0) + U); else tmp = Float64(U + Float64(t_0 * Float64(l * Float64(Float64(0.3333333333333333 * Float64(J * (l ^ 2.0))) + 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 <= 2e-7))) tmp = ((t_1 * J) * t_0) + U; else tmp = U + (t_0 * (l * ((0.3333333333333333 * (J * (l ^ 2.0))) + (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, 2e-7]], $MachinePrecision]], N[(N[(N[(t$95$1 * J), $MachinePrecision] * t$95$0), $MachinePrecision] + U), $MachinePrecision], N[(U + N[(t$95$0 * N[(l * N[(N[(0.3333333333333333 * N[(J * N[Power[l, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(J * 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^{-7}\right):\\
\;\;\;\;\left(t\_1 \cdot J\right) \cdot t\_0 + U\\
\mathbf{else}:\\
\;\;\;\;U + t\_0 \cdot \left(\ell \cdot \left(0.3333333333333333 \cdot \left(J \cdot {\ell}^{2}\right) + J \cdot 2\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -inf.0 or 1.9999999999999999e-7 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 99.2%
if -inf.0 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 1.9999999999999999e-7Initial program 66.6%
Taylor expanded in l around 0 99.9%
Final simplification99.6%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (* K 0.5))) (t_1 (+ (* (- (exp l) (exp (- l))) J) U)))
(if (<= l -2.7e+81)
(+ U (* (* J 0.3333333333333333) (* (pow l 3.0) t_0)))
(if (<= l -23.0)
t_1
(if (<= l 840.0)
(+ U (* (cos (/ K 2.0)) (* J (* l 2.0))))
(if (<= l 3.4e+89)
t_1
(* 0.3333333333333333 (* t_0 (* J (pow l 3.0))))))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K * 0.5));
double t_1 = ((exp(l) - exp(-l)) * J) + U;
double tmp;
if (l <= -2.7e+81) {
tmp = U + ((J * 0.3333333333333333) * (pow(l, 3.0) * t_0));
} else if (l <= -23.0) {
tmp = t_1;
} else if (l <= 840.0) {
tmp = U + (cos((K / 2.0)) * (J * (l * 2.0)));
} else if (l <= 3.4e+89) {
tmp = t_1;
} else {
tmp = 0.3333333333333333 * (t_0 * (J * pow(l, 3.0)));
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = cos((k * 0.5d0))
t_1 = ((exp(l) - exp(-l)) * j) + u
if (l <= (-2.7d+81)) then
tmp = u + ((j * 0.3333333333333333d0) * ((l ** 3.0d0) * t_0))
else if (l <= (-23.0d0)) then
tmp = t_1
else if (l <= 840.0d0) then
tmp = u + (cos((k / 2.0d0)) * (j * (l * 2.0d0)))
else if (l <= 3.4d+89) then
tmp = t_1
else
tmp = 0.3333333333333333d0 * (t_0 * (j * (l ** 3.0d0)))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = Math.cos((K * 0.5));
double t_1 = ((Math.exp(l) - Math.exp(-l)) * J) + U;
double tmp;
if (l <= -2.7e+81) {
tmp = U + ((J * 0.3333333333333333) * (Math.pow(l, 3.0) * t_0));
} else if (l <= -23.0) {
tmp = t_1;
} else if (l <= 840.0) {
tmp = U + (Math.cos((K / 2.0)) * (J * (l * 2.0)));
} else if (l <= 3.4e+89) {
tmp = t_1;
} else {
tmp = 0.3333333333333333 * (t_0 * (J * Math.pow(l, 3.0)));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K * 0.5)) t_1 = ((math.exp(l) - math.exp(-l)) * J) + U tmp = 0 if l <= -2.7e+81: tmp = U + ((J * 0.3333333333333333) * (math.pow(l, 3.0) * t_0)) elif l <= -23.0: tmp = t_1 elif l <= 840.0: tmp = U + (math.cos((K / 2.0)) * (J * (l * 2.0))) elif l <= 3.4e+89: tmp = t_1 else: tmp = 0.3333333333333333 * (t_0 * (J * math.pow(l, 3.0))) return tmp
function code(J, l, K, U) t_0 = cos(Float64(K * 0.5)) t_1 = Float64(Float64(Float64(exp(l) - exp(Float64(-l))) * J) + U) tmp = 0.0 if (l <= -2.7e+81) tmp = Float64(U + Float64(Float64(J * 0.3333333333333333) * Float64((l ^ 3.0) * t_0))); elseif (l <= -23.0) tmp = t_1; elseif (l <= 840.0) tmp = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(J * Float64(l * 2.0)))); elseif (l <= 3.4e+89) tmp = t_1; else tmp = Float64(0.3333333333333333 * Float64(t_0 * Float64(J * (l ^ 3.0)))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = cos((K * 0.5)); t_1 = ((exp(l) - exp(-l)) * J) + U; tmp = 0.0; if (l <= -2.7e+81) tmp = U + ((J * 0.3333333333333333) * ((l ^ 3.0) * t_0)); elseif (l <= -23.0) tmp = t_1; elseif (l <= 840.0) tmp = U + (cos((K / 2.0)) * (J * (l * 2.0))); elseif (l <= 3.4e+89) tmp = t_1; else tmp = 0.3333333333333333 * (t_0 * (J * (l ^ 3.0))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision] + U), $MachinePrecision]}, If[LessEqual[l, -2.7e+81], N[(U + N[(N[(J * 0.3333333333333333), $MachinePrecision] * N[(N[Power[l, 3.0], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -23.0], t$95$1, If[LessEqual[l, 840.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, 3.4e+89], t$95$1, N[(0.3333333333333333 * N[(t$95$0 * N[(J * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(K \cdot 0.5\right)\\
t_1 := \left(e^{\ell} - e^{-\ell}\right) \cdot J + U\\
\mathbf{if}\;\ell \leq -2.7 \cdot 10^{+81}:\\
\;\;\;\;U + \left(J \cdot 0.3333333333333333\right) \cdot \left({\ell}^{3} \cdot t\_0\right)\\
\mathbf{elif}\;\ell \leq -23:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\ell \leq 840:\\
\;\;\;\;U + \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(\ell \cdot 2\right)\right)\\
\mathbf{elif}\;\ell \leq 3.4 \cdot 10^{+89}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;0.3333333333333333 \cdot \left(t\_0 \cdot \left(J \cdot {\ell}^{3}\right)\right)\\
\end{array}
\end{array}
if l < -2.6999999999999999e81Initial program 100.0%
Taylor expanded in l around 0 98.2%
Taylor expanded in l around inf 98.2%
associate-*r*98.2%
*-commutative98.2%
Simplified98.2%
if -2.6999999999999999e81 < l < -23 or 840 < l < 3.4000000000000002e89Initial program 100.0%
Taylor expanded in K around 0 70.6%
+-commutative70.6%
Simplified70.6%
if -23 < l < 840Initial program 66.9%
Taylor expanded in l around 0 98.3%
*-commutative98.3%
associate-*r*98.3%
Simplified98.3%
if 3.4000000000000002e89 < l Initial program 100.0%
Taylor expanded in l around 0 100.0%
distribute-lft-in100.0%
distribute-rgt-in100.0%
*-commutative100.0%
associate-*l*100.0%
unpow2100.0%
pow3100.0%
Applied egg-rr100.0%
Taylor expanded in U around inf 100.0%
*-rgt-identity100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
+-commutative100.0%
distribute-lft1-in100.0%
*-commutative100.0%
metadata-eval100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in l around inf 100.0%
associate-*r*100.0%
Simplified100.0%
Final simplification94.8%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (+ (* (- (exp l) (exp (- l))) J) U))
(t_1 (* 0.3333333333333333 (* (cos (* K 0.5)) (* J (pow l 3.0))))))
(if (<= l -2.7e+81)
t_1
(if (<= l -23.0)
t_0
(if (<= l 750.0)
(+ U (* (cos (/ K 2.0)) (* J (* l 2.0))))
(if (<= l 1.55e+88) t_0 t_1))))))
double code(double J, double l, double K, double U) {
double t_0 = ((exp(l) - exp(-l)) * J) + U;
double t_1 = 0.3333333333333333 * (cos((K * 0.5)) * (J * pow(l, 3.0)));
double tmp;
if (l <= -2.7e+81) {
tmp = t_1;
} else if (l <= -23.0) {
tmp = t_0;
} else if (l <= 750.0) {
tmp = U + (cos((K / 2.0)) * (J * (l * 2.0)));
} else if (l <= 1.55e+88) {
tmp = t_0;
} 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) :: tmp
t_0 = ((exp(l) - exp(-l)) * j) + u
t_1 = 0.3333333333333333d0 * (cos((k * 0.5d0)) * (j * (l ** 3.0d0)))
if (l <= (-2.7d+81)) then
tmp = t_1
else if (l <= (-23.0d0)) then
tmp = t_0
else if (l <= 750.0d0) then
tmp = u + (cos((k / 2.0d0)) * (j * (l * 2.0d0)))
else if (l <= 1.55d+88) then
tmp = t_0
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.exp(l) - Math.exp(-l)) * J) + U;
double t_1 = 0.3333333333333333 * (Math.cos((K * 0.5)) * (J * Math.pow(l, 3.0)));
double tmp;
if (l <= -2.7e+81) {
tmp = t_1;
} else if (l <= -23.0) {
tmp = t_0;
} else if (l <= 750.0) {
tmp = U + (Math.cos((K / 2.0)) * (J * (l * 2.0)));
} else if (l <= 1.55e+88) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(J, l, K, U): t_0 = ((math.exp(l) - math.exp(-l)) * J) + U t_1 = 0.3333333333333333 * (math.cos((K * 0.5)) * (J * math.pow(l, 3.0))) tmp = 0 if l <= -2.7e+81: tmp = t_1 elif l <= -23.0: tmp = t_0 elif l <= 750.0: tmp = U + (math.cos((K / 2.0)) * (J * (l * 2.0))) elif l <= 1.55e+88: tmp = t_0 else: tmp = t_1 return tmp
function code(J, l, K, U) t_0 = Float64(Float64(Float64(exp(l) - exp(Float64(-l))) * J) + U) t_1 = Float64(0.3333333333333333 * Float64(cos(Float64(K * 0.5)) * Float64(J * (l ^ 3.0)))) tmp = 0.0 if (l <= -2.7e+81) tmp = t_1; elseif (l <= -23.0) tmp = t_0; elseif (l <= 750.0) tmp = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(J * Float64(l * 2.0)))); elseif (l <= 1.55e+88) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = ((exp(l) - exp(-l)) * J) + U; t_1 = 0.3333333333333333 * (cos((K * 0.5)) * (J * (l ^ 3.0))); tmp = 0.0; if (l <= -2.7e+81) tmp = t_1; elseif (l <= -23.0) tmp = t_0; elseif (l <= 750.0) tmp = U + (cos((K / 2.0)) * (J * (l * 2.0))); elseif (l <= 1.55e+88) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision] + U), $MachinePrecision]}, Block[{t$95$1 = N[(0.3333333333333333 * N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * N[(J * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -2.7e+81], t$95$1, If[LessEqual[l, -23.0], t$95$0, If[LessEqual[l, 750.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.55e+88], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(e^{\ell} - e^{-\ell}\right) \cdot J + U\\
t_1 := 0.3333333333333333 \cdot \left(\cos \left(K \cdot 0.5\right) \cdot \left(J \cdot {\ell}^{3}\right)\right)\\
\mathbf{if}\;\ell \leq -2.7 \cdot 10^{+81}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\ell \leq -23:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq 750:\\
\;\;\;\;U + \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(\ell \cdot 2\right)\right)\\
\mathbf{elif}\;\ell \leq 1.55 \cdot 10^{+88}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if l < -2.6999999999999999e81 or 1.5500000000000001e88 < l Initial program 100.0%
Taylor expanded in l around 0 98.9%
distribute-lft-in98.9%
distribute-rgt-in98.9%
*-commutative98.9%
associate-*l*98.9%
unpow298.9%
pow398.9%
Applied egg-rr98.9%
Taylor expanded in U around inf 98.9%
*-rgt-identity98.9%
metadata-eval98.9%
distribute-rgt-neg-in98.9%
+-commutative98.9%
distribute-lft1-in98.9%
*-commutative98.9%
metadata-eval98.9%
sub-neg98.9%
Simplified98.9%
Taylor expanded in l around inf 98.9%
associate-*r*98.9%
Simplified98.9%
if -2.6999999999999999e81 < l < -23 or 750 < l < 1.5500000000000001e88Initial program 100.0%
Taylor expanded in K around 0 70.6%
+-commutative70.6%
Simplified70.6%
if -23 < l < 750Initial program 66.9%
Taylor expanded in l around 0 98.3%
*-commutative98.3%
associate-*r*98.3%
Simplified98.3%
Final simplification94.8%
(FPCore (J l K U)
:precision binary64
(if (<= l -1.9e+81)
(+ U (* (* J 0.3333333333333333) (* (pow l 3.0) (cos (* K 0.5)))))
(if (<= l -23.0)
(+ (* (- (exp l) (exp (- l))) J) U)
(+
U
(*
(cos (/ K 2.0))
(* J (* l (+ 2.0 (* 0.3333333333333333 (pow l 2.0))))))))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -1.9e+81) {
tmp = U + ((J * 0.3333333333333333) * (pow(l, 3.0) * cos((K * 0.5))));
} else if (l <= -23.0) {
tmp = ((exp(l) - exp(-l)) * J) + U;
} else {
tmp = U + (cos((K / 2.0)) * (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 (l <= (-1.9d+81)) then
tmp = u + ((j * 0.3333333333333333d0) * ((l ** 3.0d0) * cos((k * 0.5d0))))
else if (l <= (-23.0d0)) then
tmp = ((exp(l) - exp(-l)) * j) + u
else
tmp = u + (cos((k / 2.0d0)) * (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 (l <= -1.9e+81) {
tmp = U + ((J * 0.3333333333333333) * (Math.pow(l, 3.0) * Math.cos((K * 0.5))));
} else if (l <= -23.0) {
tmp = ((Math.exp(l) - Math.exp(-l)) * J) + U;
} else {
tmp = U + (Math.cos((K / 2.0)) * (J * (l * (2.0 + (0.3333333333333333 * Math.pow(l, 2.0))))));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -1.9e+81: tmp = U + ((J * 0.3333333333333333) * (math.pow(l, 3.0) * math.cos((K * 0.5)))) elif l <= -23.0: tmp = ((math.exp(l) - math.exp(-l)) * J) + U else: tmp = U + (math.cos((K / 2.0)) * (J * (l * (2.0 + (0.3333333333333333 * math.pow(l, 2.0)))))) return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -1.9e+81) tmp = Float64(U + Float64(Float64(J * 0.3333333333333333) * Float64((l ^ 3.0) * cos(Float64(K * 0.5))))); elseif (l <= -23.0) 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 * 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 (l <= -1.9e+81) tmp = U + ((J * 0.3333333333333333) * ((l ^ 3.0) * cos((K * 0.5)))); elseif (l <= -23.0) tmp = ((exp(l) - exp(-l)) * J) + U; else tmp = U + (cos((K / 2.0)) * (J * (l * (2.0 + (0.3333333333333333 * (l ^ 2.0)))))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -1.9e+81], 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, -23.0], 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 * N[(2.0 + N[(0.3333333333333333 * N[Power[l, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.9 \cdot 10^{+81}:\\
\;\;\;\;U + \left(J \cdot 0.3333333333333333\right) \cdot \left({\ell}^{3} \cdot \cos \left(K \cdot 0.5\right)\right)\\
\mathbf{elif}\;\ell \leq -23:\\
\;\;\;\;\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 \left(2 + 0.3333333333333333 \cdot {\ell}^{2}\right)\right)\right)\\
\end{array}
\end{array}
if l < -1.9e81Initial program 100.0%
Taylor expanded in l around 0 98.2%
Taylor expanded in l around inf 98.2%
associate-*r*98.2%
*-commutative98.2%
Simplified98.2%
if -1.9e81 < l < -23Initial program 100.0%
Taylor expanded in K around 0 68.4%
+-commutative68.4%
Simplified68.4%
if -23 < l Initial program 76.4%
Taylor expanded in l around 0 92.7%
Final simplification92.0%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= t_0 0.58)
(+ U (* t_0 (* J (* l 2.0))))
(+ U (+ (* 0.3333333333333333 (* J (pow l 3.0))) (* 2.0 (* l J)))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double tmp;
if (t_0 <= 0.58) {
tmp = U + (t_0 * (J * (l * 2.0)));
} else {
tmp = U + ((0.3333333333333333 * (J * pow(l, 3.0))) + (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) :: t_0
real(8) :: tmp
t_0 = cos((k / 2.0d0))
if (t_0 <= 0.58d0) then
tmp = u + (t_0 * (j * (l * 2.0d0)))
else
tmp = u + ((0.3333333333333333d0 * (j * (l ** 3.0d0))) + (2.0d0 * (l * j)))
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 tmp;
if (t_0 <= 0.58) {
tmp = U + (t_0 * (J * (l * 2.0)));
} else {
tmp = U + ((0.3333333333333333 * (J * Math.pow(l, 3.0))) + (2.0 * (l * J)));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K / 2.0)) tmp = 0 if t_0 <= 0.58: tmp = U + (t_0 * (J * (l * 2.0))) else: tmp = U + ((0.3333333333333333 * (J * math.pow(l, 3.0))) + (2.0 * (l * J))) return tmp
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) tmp = 0.0 if (t_0 <= 0.58) tmp = Float64(U + Float64(t_0 * Float64(J * Float64(l * 2.0)))); else tmp = Float64(U + Float64(Float64(0.3333333333333333 * Float64(J * (l ^ 3.0))) + Float64(2.0 * Float64(l * J)))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = cos((K / 2.0)); tmp = 0.0; if (t_0 <= 0.58) tmp = U + (t_0 * (J * (l * 2.0))); else tmp = U + ((0.3333333333333333 * (J * (l ^ 3.0))) + (2.0 * (l * J))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, 0.58], N[(U + N[(t$95$0 * N[(J * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(N[(0.3333333333333333 * N[(J * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(2.0 * N[(l * J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;t\_0 \leq 0.58:\\
\;\;\;\;U + t\_0 \cdot \left(J \cdot \left(\ell \cdot 2\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + \left(0.3333333333333333 \cdot \left(J \cdot {\ell}^{3}\right) + 2 \cdot \left(\ell \cdot J\right)\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < 0.57999999999999996Initial program 78.8%
Taylor expanded in l around 0 67.9%
*-commutative67.9%
associate-*r*67.9%
Simplified67.9%
if 0.57999999999999996 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 84.7%
Taylor expanded in l around 0 89.2%
distribute-lft-in89.2%
distribute-rgt-in89.2%
*-commutative89.2%
associate-*l*89.2%
unpow289.2%
pow389.2%
Applied egg-rr89.2%
Taylor expanded in K around 0 84.9%
Final simplification79.7%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= t_0 0.58)
(+ U (* t_0 (* J (* l 2.0))))
(+ U (* J (* l (+ 2.0 (* 0.3333333333333333 (pow l 2.0)))))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double tmp;
if (t_0 <= 0.58) {
tmp = U + (t_0 * (J * (l * 2.0)));
} 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) :: t_0
real(8) :: tmp
t_0 = cos((k / 2.0d0))
if (t_0 <= 0.58d0) then
tmp = u + (t_0 * (j * (l * 2.0d0)))
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 t_0 = Math.cos((K / 2.0));
double tmp;
if (t_0 <= 0.58) {
tmp = U + (t_0 * (J * (l * 2.0)));
} else {
tmp = U + (J * (l * (2.0 + (0.3333333333333333 * Math.pow(l, 2.0)))));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K / 2.0)) tmp = 0 if t_0 <= 0.58: tmp = U + (t_0 * (J * (l * 2.0))) else: tmp = U + (J * (l * (2.0 + (0.3333333333333333 * math.pow(l, 2.0))))) return tmp
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) tmp = 0.0 if (t_0 <= 0.58) tmp = Float64(U + Float64(t_0 * Float64(J * Float64(l * 2.0)))); 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) t_0 = cos((K / 2.0)); tmp = 0.0; if (t_0 <= 0.58) tmp = U + (t_0 * (J * (l * 2.0))); else tmp = U + (J * (l * (2.0 + (0.3333333333333333 * (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]}, If[LessEqual[t$95$0, 0.58], N[(U + N[(t$95$0 * N[(J * N[(l * 2.0), $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}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;t\_0 \leq 0.58:\\
\;\;\;\;U + t\_0 \cdot \left(J \cdot \left(\ell \cdot 2\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.57999999999999996Initial program 78.8%
Taylor expanded in l around 0 67.9%
*-commutative67.9%
associate-*r*67.9%
Simplified67.9%
if 0.57999999999999996 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 84.7%
Taylor expanded in l around 0 89.2%
Taylor expanded in K around 0 84.9%
Final simplification79.7%
(FPCore (J l K U) :precision binary64 (if (or (<= l -23.0) (not (<= l 750.0))) (+ (* (- (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 <= -23.0) || !(l <= 750.0)) {
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 <= (-23.0d0)) .or. (.not. (l <= 750.0d0))) 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 <= -23.0) || !(l <= 750.0)) {
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 <= -23.0) or not (l <= 750.0): 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 <= -23.0) || !(l <= 750.0)) 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 <= -23.0) || ~((l <= 750.0))) 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, -23.0], N[Not[LessEqual[l, 750.0]], $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 -23 \lor \neg \left(\ell \leq 750\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 < -23 or 750 < l Initial program 100.0%
Taylor expanded in K around 0 77.4%
+-commutative77.4%
Simplified77.4%
if -23 < l < 750Initial program 66.9%
Taylor expanded in l around 0 98.3%
*-commutative98.3%
associate-*r*98.3%
Simplified98.3%
Final simplification88.2%
(FPCore (J l K U) :precision binary64 (if (or (<= l -2.05e+54) (not (<= l 3.5e+63))) (* 0.3333333333333333 (* J (pow l 3.0))) (+ U (* (cos (/ K 2.0)) (* J (* l 2.0))))))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -2.05e+54) || !(l <= 3.5e+63)) {
tmp = 0.3333333333333333 * (J * pow(l, 3.0));
} 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 <= (-2.05d+54)) .or. (.not. (l <= 3.5d+63))) then
tmp = 0.3333333333333333d0 * (j * (l ** 3.0d0))
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 <= -2.05e+54) || !(l <= 3.5e+63)) {
tmp = 0.3333333333333333 * (J * Math.pow(l, 3.0));
} else {
tmp = U + (Math.cos((K / 2.0)) * (J * (l * 2.0)));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -2.05e+54) or not (l <= 3.5e+63): tmp = 0.3333333333333333 * (J * math.pow(l, 3.0)) 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 <= -2.05e+54) || !(l <= 3.5e+63)) tmp = Float64(0.3333333333333333 * Float64(J * (l ^ 3.0))); 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 <= -2.05e+54) || ~((l <= 3.5e+63))) tmp = 0.3333333333333333 * (J * (l ^ 3.0)); 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, -2.05e+54], N[Not[LessEqual[l, 3.5e+63]], $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[(J * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2.05 \cdot 10^{+54} \lor \neg \left(\ell \leq 3.5 \cdot 10^{+63}\right):\\
\;\;\;\;0.3333333333333333 \cdot \left(J \cdot {\ell}^{3}\right)\\
\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 < -2.04999999999999984e54 or 3.50000000000000029e63 < l Initial program 100.0%
Taylor expanded in l around 0 88.3%
Taylor expanded in K around 0 70.3%
Taylor expanded in l around inf 70.3%
if -2.04999999999999984e54 < l < 3.50000000000000029e63Initial program 70.8%
Taylor expanded in l around 0 88.9%
*-commutative88.9%
associate-*r*88.9%
Simplified88.9%
Final simplification81.1%
(FPCore (J l K U) :precision binary64 (if (or (<= l -2.15e+53) (not (<= l 1.9e+63))) (* 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 <= -2.15e+53) || !(l <= 1.9e+63)) {
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 <= (-2.15d+53)) .or. (.not. (l <= 1.9d+63))) 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 <= -2.15e+53) || !(l <= 1.9e+63)) {
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 <= -2.15e+53) or not (l <= 1.9e+63): 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 <= -2.15e+53) || !(l <= 1.9e+63)) 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 <= -2.15e+53) || ~((l <= 1.9e+63))) 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, -2.15e+53], N[Not[LessEqual[l, 1.9e+63]], $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 -2.15 \cdot 10^{+53} \lor \neg \left(\ell \leq 1.9 \cdot 10^{+63}\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 < -2.1499999999999999e53 or 1.9000000000000001e63 < l Initial program 100.0%
Taylor expanded in l around 0 88.3%
Taylor expanded in K around 0 70.3%
Taylor expanded in l around inf 70.3%
if -2.1499999999999999e53 < l < 1.9000000000000001e63Initial program 70.8%
Taylor expanded in l around 0 88.8%
Final simplification81.1%
(FPCore (J l K U) :precision binary64 (if (or (<= l -2.1e+53) (not (<= l 740.0))) (* 0.3333333333333333 (* J (pow l 3.0))) (fma J (* l 2.0) U)))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -2.1e+53) || !(l <= 740.0)) {
tmp = 0.3333333333333333 * (J * pow(l, 3.0));
} else {
tmp = fma(J, (l * 2.0), U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if ((l <= -2.1e+53) || !(l <= 740.0)) tmp = Float64(0.3333333333333333 * Float64(J * (l ^ 3.0))); else tmp = fma(J, Float64(l * 2.0), U); end return tmp end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -2.1e+53], N[Not[LessEqual[l, 740.0]], $MachinePrecision]], N[(0.3333333333333333 * N[(J * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(J * N[(l * 2.0), $MachinePrecision] + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2.1 \cdot 10^{+53} \lor \neg \left(\ell \leq 740\right):\\
\;\;\;\;0.3333333333333333 \cdot \left(J \cdot {\ell}^{3}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(J, \ell \cdot 2, U\right)\\
\end{array}
\end{array}
if l < -2.1000000000000002e53 or 740 < l Initial program 99.2%
Taylor expanded in l around 0 82.0%
Taylor expanded in K around 0 64.7%
Taylor expanded in l around inf 64.7%
if -2.1000000000000002e53 < l < 740Initial program 69.2%
Taylor expanded in l around 0 94.4%
Taylor expanded in K around 0 77.6%
Taylor expanded in l around 0 77.6%
+-commutative77.6%
*-commutative77.6%
associate-*r*77.6%
*-commutative77.6%
fma-define77.6%
*-commutative77.6%
Simplified77.6%
Final simplification71.7%
(FPCore (J l K U) :precision binary64 (if (or (<= K 1.06e+189) (not (<= K 1.6e+256))) (+ U (* l (* J 2.0))) (* (pow K 2.0) 32.0)))
double code(double J, double l, double K, double U) {
double tmp;
if ((K <= 1.06e+189) || !(K <= 1.6e+256)) {
tmp = U + (l * (J * 2.0));
} else {
tmp = pow(K, 2.0) * 32.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 ((k <= 1.06d+189) .or. (.not. (k <= 1.6d+256))) then
tmp = u + (l * (j * 2.0d0))
else
tmp = (k ** 2.0d0) * 32.0d0
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if ((K <= 1.06e+189) || !(K <= 1.6e+256)) {
tmp = U + (l * (J * 2.0));
} else {
tmp = Math.pow(K, 2.0) * 32.0;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (K <= 1.06e+189) or not (K <= 1.6e+256): tmp = U + (l * (J * 2.0)) else: tmp = math.pow(K, 2.0) * 32.0 return tmp
function code(J, l, K, U) tmp = 0.0 if ((K <= 1.06e+189) || !(K <= 1.6e+256)) tmp = Float64(U + Float64(l * Float64(J * 2.0))); else tmp = Float64((K ^ 2.0) * 32.0); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((K <= 1.06e+189) || ~((K <= 1.6e+256))) tmp = U + (l * (J * 2.0)); else tmp = (K ^ 2.0) * 32.0; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[K, 1.06e+189], N[Not[LessEqual[K, 1.6e+256]], $MachinePrecision]], N[(U + N[(l * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[K, 2.0], $MachinePrecision] * 32.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;K \leq 1.06 \cdot 10^{+189} \lor \neg \left(K \leq 1.6 \cdot 10^{+256}\right):\\
\;\;\;\;U + \ell \cdot \left(J \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;{K}^{2} \cdot 32\\
\end{array}
\end{array}
if K < 1.05999999999999998e189 or 1.59999999999999998e256 < K Initial program 82.8%
Taylor expanded in l around 0 88.9%
Taylor expanded in K around 0 73.5%
Taylor expanded in l around 0 54.3%
associate-*r*54.3%
*-commutative54.3%
Simplified54.3%
if 1.05999999999999998e189 < K < 1.59999999999999998e256Initial program 85.7%
Applied egg-rr2.3%
fma-neg2.3%
*-commutative2.3%
Simplified2.3%
Taylor expanded in K around 0 46.5%
Taylor expanded in K around inf 46.5%
*-commutative46.5%
Simplified46.5%
Final simplification53.9%
(FPCore (J l K U) :precision binary64 (if (<= K 8.5e+188) (fma J (* l 2.0) U) (if (<= K 4.6e+255) (* (pow K 2.0) 32.0) (+ U (* l (* J 2.0))))))
double code(double J, double l, double K, double U) {
double tmp;
if (K <= 8.5e+188) {
tmp = fma(J, (l * 2.0), U);
} else if (K <= 4.6e+255) {
tmp = pow(K, 2.0) * 32.0;
} else {
tmp = U + (l * (J * 2.0));
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (K <= 8.5e+188) tmp = fma(J, Float64(l * 2.0), U); elseif (K <= 4.6e+255) tmp = Float64((K ^ 2.0) * 32.0); else tmp = Float64(U + Float64(l * Float64(J * 2.0))); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[K, 8.5e+188], N[(J * N[(l * 2.0), $MachinePrecision] + U), $MachinePrecision], If[LessEqual[K, 4.6e+255], N[(N[Power[K, 2.0], $MachinePrecision] * 32.0), $MachinePrecision], N[(U + N[(l * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;K \leq 8.5 \cdot 10^{+188}:\\
\;\;\;\;\mathsf{fma}\left(J, \ell \cdot 2, U\right)\\
\mathbf{elif}\;K \leq 4.6 \cdot 10^{+255}:\\
\;\;\;\;{K}^{2} \cdot 32\\
\mathbf{else}:\\
\;\;\;\;U + \ell \cdot \left(J \cdot 2\right)\\
\end{array}
\end{array}
if K < 8.49999999999999958e188Initial program 83.3%
Taylor expanded in l around 0 88.4%
Taylor expanded in K around 0 74.0%
Taylor expanded in l around 0 54.2%
+-commutative54.2%
*-commutative54.2%
associate-*r*54.2%
*-commutative54.2%
fma-define54.3%
*-commutative54.3%
Simplified54.3%
if 8.49999999999999958e188 < K < 4.6000000000000001e255Initial program 85.7%
Applied egg-rr2.3%
fma-neg2.3%
*-commutative2.3%
Simplified2.3%
Taylor expanded in K around 0 46.5%
Taylor expanded in K around inf 46.5%
*-commutative46.5%
Simplified46.5%
if 4.6000000000000001e255 < K Initial program 72.8%
Taylor expanded in l around 0 99.7%
Taylor expanded in K around 0 63.6%
Taylor expanded in l around 0 55.7%
associate-*r*55.7%
*-commutative55.7%
Simplified55.7%
Final simplification53.9%
(FPCore (J l K U) :precision binary64 (if (or (<= l -560000000000.0) (not (<= l 260.0))) (- -4.0 (* U U)) U))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -560000000000.0) || !(l <= 260.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 <= (-560000000000.0d0)) .or. (.not. (l <= 260.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 <= -560000000000.0) || !(l <= 260.0)) {
tmp = -4.0 - (U * U);
} else {
tmp = U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -560000000000.0) or not (l <= 260.0): tmp = -4.0 - (U * U) else: tmp = U return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -560000000000.0) || !(l <= 260.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 <= -560000000000.0) || ~((l <= 260.0))) tmp = -4.0 - (U * U); else tmp = U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -560000000000.0], N[Not[LessEqual[l, 260.0]], $MachinePrecision]], N[(-4.0 - N[(U * U), $MachinePrecision]), $MachinePrecision], U]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -560000000000 \lor \neg \left(\ell \leq 260\right):\\
\;\;\;\;-4 - U \cdot U\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\end{array}
if l < -5.6e11 or 260 < l Initial program 99.2%
associate-*l*99.2%
fma-define99.2%
Simplified99.2%
Applied egg-rr14.8%
cancel-sign-sub-inv14.8%
Simplified14.8%
if -5.6e11 < l < 260Initial program 67.6%
Taylor expanded in J around 0 64.6%
Final simplification40.5%
(FPCore (J l K U) :precision binary64 (if (<= l -5.4e+34) (* U (- 2.0 U)) (if (<= l 260.0) U (- -4.0 (* U U)))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -5.4e+34) {
tmp = U * (2.0 - U);
} else if (l <= 260.0) {
tmp = U;
} else {
tmp = -4.0 - (U * U);
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if (l <= (-5.4d+34)) then
tmp = u * (2.0d0 - u)
else if (l <= 260.0d0) then
tmp = u
else
tmp = (-4.0d0) - (u * u)
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (l <= -5.4e+34) {
tmp = U * (2.0 - U);
} else if (l <= 260.0) {
tmp = U;
} else {
tmp = -4.0 - (U * U);
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -5.4e+34: tmp = U * (2.0 - U) elif l <= 260.0: tmp = U else: tmp = -4.0 - (U * U) return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -5.4e+34) tmp = Float64(U * Float64(2.0 - U)); elseif (l <= 260.0) tmp = U; else tmp = Float64(-4.0 - Float64(U * U)); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -5.4e+34) tmp = U * (2.0 - U); elseif (l <= 260.0) tmp = U; else tmp = -4.0 - (U * U); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -5.4e+34], N[(U * N[(2.0 - U), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 260.0], U, N[(-4.0 - N[(U * U), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -5.4 \cdot 10^{+34}:\\
\;\;\;\;U \cdot \left(2 - U\right)\\
\mathbf{elif}\;\ell \leq 260:\\
\;\;\;\;U\\
\mathbf{else}:\\
\;\;\;\;-4 - U \cdot U\\
\end{array}
\end{array}
if l < -5.4000000000000001e34Initial program 100.0%
associate-*l*100.0%
fma-define100.0%
Simplified100.0%
Applied egg-rr16.6%
+-commutative16.6%
fma-undefine16.6%
associate-+l+16.6%
count-216.6%
distribute-rgt-out16.6%
Simplified16.6%
if -5.4000000000000001e34 < l < 260Initial program 67.8%
Taylor expanded in J around 0 64.2%
if 260 < l Initial program 98.2%
associate-*l*98.2%
fma-define98.2%
Simplified98.2%
Applied egg-rr12.9%
cancel-sign-sub-inv12.9%
Simplified12.9%
Final simplification40.5%
(FPCore (J l K U) :precision binary64 (if (or (<= l -6.2e+69) (not (<= l 4.2e+89))) (* U U) U))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -6.2e+69) || !(l <= 4.2e+89)) {
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 <= (-6.2d+69)) .or. (.not. (l <= 4.2d+89))) 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 <= -6.2e+69) || !(l <= 4.2e+89)) {
tmp = U * U;
} else {
tmp = U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -6.2e+69) or not (l <= 4.2e+89): tmp = U * U else: tmp = U return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -6.2e+69) || !(l <= 4.2e+89)) tmp = Float64(U * U); else tmp = U; end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -6.2e+69) || ~((l <= 4.2e+89))) tmp = U * U; else tmp = U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -6.2e+69], N[Not[LessEqual[l, 4.2e+89]], $MachinePrecision]], N[(U * U), $MachinePrecision], U]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -6.2 \cdot 10^{+69} \lor \neg \left(\ell \leq 4.2 \cdot 10^{+89}\right):\\
\;\;\;\;U \cdot U\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\end{array}
if l < -6.1999999999999997e69 or 4.19999999999999972e89 < l Initial program 100.0%
Applied egg-rr14.3%
if -6.1999999999999997e69 < l < 4.19999999999999972e89Initial program 73.2%
Taylor expanded in J around 0 52.8%
Final simplification38.8%
(FPCore (J l K U) :precision binary64 (if (<= l -1.75e+72) (* U (- U -4.0)) (if (<= l 4.2e+89) U (* U U))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -1.75e+72) {
tmp = U * (U - -4.0);
} else if (l <= 4.2e+89) {
tmp = U;
} else {
tmp = U * U;
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if (l <= (-1.75d+72)) then
tmp = u * (u - (-4.0d0))
else if (l <= 4.2d+89) then
tmp = u
else
tmp = u * u
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (l <= -1.75e+72) {
tmp = U * (U - -4.0);
} else if (l <= 4.2e+89) {
tmp = U;
} else {
tmp = U * U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -1.75e+72: tmp = U * (U - -4.0) elif l <= 4.2e+89: tmp = U else: tmp = U * U return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -1.75e+72) tmp = Float64(U * Float64(U - -4.0)); elseif (l <= 4.2e+89) tmp = U; else tmp = Float64(U * U); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -1.75e+72) tmp = U * (U - -4.0); elseif (l <= 4.2e+89) tmp = U; else tmp = U * U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -1.75e+72], N[(U * N[(U - -4.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 4.2e+89], U, N[(U * U), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.75 \cdot 10^{+72}:\\
\;\;\;\;U \cdot \left(U - -4\right)\\
\mathbf{elif}\;\ell \leq 4.2 \cdot 10^{+89}:\\
\;\;\;\;U\\
\mathbf{else}:\\
\;\;\;\;U \cdot U\\
\end{array}
\end{array}
if l < -1.75000000000000005e72Initial program 100.0%
Applied egg-rr14.5%
if -1.75000000000000005e72 < l < 4.19999999999999972e89Initial program 73.5%
Taylor expanded in J around 0 52.1%
if 4.19999999999999972e89 < l Initial program 100.0%
Applied egg-rr14.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 82.9%
Taylor expanded in l around 0 88.7%
Taylor expanded in K around 0 71.7%
Taylor expanded in l around 0 52.5%
associate-*r*52.5%
*-commutative52.5%
Simplified52.5%
Final simplification52.5%
(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 82.9%
Taylor expanded in J around 0 34.5%
herbie shell --seed 2024106
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))