
(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 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (J l K U) :precision binary64 (+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))
double code(double J, double l, double K, double U) {
return ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = ((j * (exp(l) - exp(-l))) * cos((k / 2.0d0))) + u
end function
public static double code(double J, double l, double K, double U) {
return ((J * (Math.exp(l) - Math.exp(-l))) * Math.cos((K / 2.0))) + U;
}
def code(J, l, K, U): return ((J * (math.exp(l) - math.exp(-l))) * math.cos((K / 2.0))) + U
function code(J, l, K, U) return Float64(Float64(Float64(J * Float64(exp(l) - exp(Float64(-l)))) * cos(Float64(K / 2.0))) + U) end
function tmp = code(J, l, K, U) tmp = ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U; end
code[J_, l_, K_, U_] := N[(N[(N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]
\begin{array}{l}
\\
\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U
\end{array}
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (- (exp l) (exp (- l)))))
(if (or (<= t_0 (- INFINITY)) (not (<= t_0 0.0)))
(+ (* (* t_0 J) (cos (/ K 2.0))) U)
(+
U
(*
l
(* (* J (cos (* K 0.5))) (fma 0.3333333333333333 (pow l 2.0) 2.0)))))))
double code(double J, double l, double K, double U) {
double t_0 = exp(l) - exp(-l);
double tmp;
if ((t_0 <= -((double) INFINITY)) || !(t_0 <= 0.0)) {
tmp = ((t_0 * J) * cos((K / 2.0))) + U;
} else {
tmp = U + (l * ((J * cos((K * 0.5))) * fma(0.3333333333333333, pow(l, 2.0), 2.0)));
}
return tmp;
}
function code(J, l, K, U) t_0 = Float64(exp(l) - exp(Float64(-l))) tmp = 0.0 if ((t_0 <= Float64(-Inf)) || !(t_0 <= 0.0)) tmp = Float64(Float64(Float64(t_0 * J) * cos(Float64(K / 2.0))) + U); else tmp = Float64(U + Float64(l * Float64(Float64(J * cos(Float64(K * 0.5))) * fma(0.3333333333333333, (l ^ 2.0), 2.0)))); end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, (-Infinity)], N[Not[LessEqual[t$95$0, 0.0]], $MachinePrecision]], N[(N[(N[(t$95$0 * J), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], N[(U + N[(l * N[(N[(J * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(0.3333333333333333 * N[Power[l, 2.0], $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{\ell} - e^{-\ell}\\
\mathbf{if}\;t\_0 \leq -\infty \lor \neg \left(t\_0 \leq 0\right):\\
\;\;\;\;\left(t\_0 \cdot J\right) \cdot \cos \left(\frac{K}{2}\right) + U\\
\mathbf{else}:\\
\;\;\;\;U + \ell \cdot \left(\left(J \cdot \cos \left(K \cdot 0.5\right)\right) \cdot \mathsf{fma}\left(0.3333333333333333, {\ell}^{2}, 2\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -inf.0 or 0.0 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 100.0%
if -inf.0 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 0.0Initial program 78.9%
Taylor expanded in l around 0 100.0%
*-commutative100.0%
*-commutative100.0%
associate-*r*100.0%
associate-*r*100.0%
*-commutative100.0%
*-commutative100.0%
distribute-lft-out100.0%
fma-define100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))) (t_1 (- (exp l) (exp (- l)))))
(if (or (<= t_1 (- INFINITY)) (not (<= t_1 0.0)))
(+ (* (* t_1 J) t_0) U)
(+ U (* t_0 (* J (* 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 t_1 = exp(l) - exp(-l);
double tmp;
if ((t_1 <= -((double) INFINITY)) || !(t_1 <= 0.0)) {
tmp = ((t_1 * J) * t_0) + U;
} else {
tmp = U + (t_0 * (J * (l * (2.0 + (0.3333333333333333 * pow(l, 2.0))))));
}
return tmp;
}
public static double code(double J, double l, double K, double U) {
double t_0 = Math.cos((K / 2.0));
double t_1 = Math.exp(l) - Math.exp(-l);
double tmp;
if ((t_1 <= -Double.POSITIVE_INFINITY) || !(t_1 <= 0.0)) {
tmp = ((t_1 * J) * t_0) + U;
} else {
tmp = U + (t_0 * (J * (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)) t_1 = math.exp(l) - math.exp(-l) tmp = 0 if (t_1 <= -math.inf) or not (t_1 <= 0.0): tmp = ((t_1 * J) * t_0) + U else: tmp = U + (t_0 * (J * (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)) t_1 = Float64(exp(l) - exp(Float64(-l))) tmp = 0.0 if ((t_1 <= Float64(-Inf)) || !(t_1 <= 0.0)) tmp = Float64(Float64(Float64(t_1 * J) * t_0) + U); else tmp = Float64(U + Float64(t_0 * Float64(J * Float64(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)); t_1 = exp(l) - exp(-l); tmp = 0.0; if ((t_1 <= -Inf) || ~((t_1 <= 0.0))) tmp = ((t_1 * J) * t_0) + U; else tmp = U + (t_0 * (J * (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]}, Block[{t$95$1 = N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, (-Infinity)], N[Not[LessEqual[t$95$1, 0.0]], $MachinePrecision]], N[(N[(N[(t$95$1 * J), $MachinePrecision] * t$95$0), $MachinePrecision] + U), $MachinePrecision], N[(U + N[(t$95$0 * N[(J * N[(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}
t_0 := \cos \left(\frac{K}{2}\right)\\
t_1 := e^{\ell} - e^{-\ell}\\
\mathbf{if}\;t\_1 \leq -\infty \lor \neg \left(t\_1 \leq 0\right):\\
\;\;\;\;\left(t\_1 \cdot J\right) \cdot t\_0 + U\\
\mathbf{else}:\\
\;\;\;\;U + t\_0 \cdot \left(J \cdot \left(\ell \cdot \left(2 + 0.3333333333333333 \cdot {\ell}^{2}\right)\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -inf.0 or 0.0 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 100.0%
if -inf.0 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 0.0Initial program 78.9%
Taylor expanded in l around 0 99.9%
Final simplification100.0%
(FPCore (J l K U)
:precision binary64
(let* ((t_0
(+ U (* 0.3333333333333333 (* J (* (cos (* K 0.5)) (pow l 3.0))))))
(t_1 (+ (* (- (exp l) (exp (- l))) J) U)))
(if (<= l -1.1e+81)
t_0
(if (<= l -0.0052)
t_1
(if (<= l 8e-30)
(+ U (* (cos (/ K 2.0)) (* J (* l 2.0))))
(if (<= l 4.3e+88) t_1 t_0))))))
double code(double J, double l, double K, double U) {
double t_0 = U + (0.3333333333333333 * (J * (cos((K * 0.5)) * pow(l, 3.0))));
double t_1 = ((exp(l) - exp(-l)) * J) + U;
double tmp;
if (l <= -1.1e+81) {
tmp = t_0;
} else if (l <= -0.0052) {
tmp = t_1;
} else if (l <= 8e-30) {
tmp = U + (cos((K / 2.0)) * (J * (l * 2.0)));
} else if (l <= 4.3e+88) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = u + (0.3333333333333333d0 * (j * (cos((k * 0.5d0)) * (l ** 3.0d0))))
t_1 = ((exp(l) - exp(-l)) * j) + u
if (l <= (-1.1d+81)) then
tmp = t_0
else if (l <= (-0.0052d0)) then
tmp = t_1
else if (l <= 8d-30) then
tmp = u + (cos((k / 2.0d0)) * (j * (l * 2.0d0)))
else if (l <= 4.3d+88) then
tmp = t_1
else
tmp = t_0
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = U + (0.3333333333333333 * (J * (Math.cos((K * 0.5)) * Math.pow(l, 3.0))));
double t_1 = ((Math.exp(l) - Math.exp(-l)) * J) + U;
double tmp;
if (l <= -1.1e+81) {
tmp = t_0;
} else if (l <= -0.0052) {
tmp = t_1;
} else if (l <= 8e-30) {
tmp = U + (Math.cos((K / 2.0)) * (J * (l * 2.0)));
} else if (l <= 4.3e+88) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(J, l, K, U): t_0 = U + (0.3333333333333333 * (J * (math.cos((K * 0.5)) * math.pow(l, 3.0)))) t_1 = ((math.exp(l) - math.exp(-l)) * J) + U tmp = 0 if l <= -1.1e+81: tmp = t_0 elif l <= -0.0052: tmp = t_1 elif l <= 8e-30: tmp = U + (math.cos((K / 2.0)) * (J * (l * 2.0))) elif l <= 4.3e+88: tmp = t_1 else: tmp = t_0 return tmp
function code(J, l, K, U) t_0 = Float64(U + Float64(0.3333333333333333 * Float64(J * Float64(cos(Float64(K * 0.5)) * (l ^ 3.0))))) t_1 = Float64(Float64(Float64(exp(l) - exp(Float64(-l))) * J) + U) tmp = 0.0 if (l <= -1.1e+81) tmp = t_0; elseif (l <= -0.0052) tmp = t_1; elseif (l <= 8e-30) tmp = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(J * Float64(l * 2.0)))); elseif (l <= 4.3e+88) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = U + (0.3333333333333333 * (J * (cos((K * 0.5)) * (l ^ 3.0)))); t_1 = ((exp(l) - exp(-l)) * J) + U; tmp = 0.0; if (l <= -1.1e+81) tmp = t_0; elseif (l <= -0.0052) tmp = t_1; elseif (l <= 8e-30) tmp = U + (cos((K / 2.0)) * (J * (l * 2.0))); elseif (l <= 4.3e+88) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(U + N[(0.3333333333333333 * N[(J * N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision] + U), $MachinePrecision]}, If[LessEqual[l, -1.1e+81], t$95$0, If[LessEqual[l, -0.0052], t$95$1, If[LessEqual[l, 8e-30], N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(J * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 4.3e+88], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + 0.3333333333333333 \cdot \left(J \cdot \left(\cos \left(K \cdot 0.5\right) \cdot {\ell}^{3}\right)\right)\\
t_1 := \left(e^{\ell} - e^{-\ell}\right) \cdot J + U\\
\mathbf{if}\;\ell \leq -1.1 \cdot 10^{+81}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq -0.0052:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\ell \leq 8 \cdot 10^{-30}:\\
\;\;\;\;U + \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(\ell \cdot 2\right)\right)\\
\mathbf{elif}\;\ell \leq 4.3 \cdot 10^{+88}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if l < -1.09999999999999993e81 or 4.29999999999999974e88 < l Initial program 100.0%
Taylor expanded in l around 0 97.9%
Taylor expanded in l around inf 97.9%
if -1.09999999999999993e81 < l < -0.0051999999999999998 or 8.000000000000001e-30 < l < 4.29999999999999974e88Initial program 100.0%
Taylor expanded in K around 0 86.1%
if -0.0051999999999999998 < l < 8.000000000000001e-30Initial program 78.7%
Taylor expanded in l around 0 99.8%
Final simplification97.2%
(FPCore (J l K U)
:precision binary64
(let* ((t_0
(+ U (* 0.3333333333333333 (* J (* (cos (* K 0.5)) (pow l 3.0))))))
(t_1 (+ (* (- (exp l) (exp (- l))) J) U)))
(if (<= l -1.1e+81)
t_0
(if (<= l -0.078)
t_1
(if (<= l 8e-30)
(+
U
(*
(cos (/ K 2.0))
(* J (* l (+ 2.0 (* 0.3333333333333333 (pow l 2.0)))))))
(if (<= l 4.3e+88) t_1 t_0))))))
double code(double J, double l, double K, double U) {
double t_0 = U + (0.3333333333333333 * (J * (cos((K * 0.5)) * pow(l, 3.0))));
double t_1 = ((exp(l) - exp(-l)) * J) + U;
double tmp;
if (l <= -1.1e+81) {
tmp = t_0;
} else if (l <= -0.078) {
tmp = t_1;
} else if (l <= 8e-30) {
tmp = U + (cos((K / 2.0)) * (J * (l * (2.0 + (0.3333333333333333 * pow(l, 2.0))))));
} else if (l <= 4.3e+88) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = u + (0.3333333333333333d0 * (j * (cos((k * 0.5d0)) * (l ** 3.0d0))))
t_1 = ((exp(l) - exp(-l)) * j) + u
if (l <= (-1.1d+81)) then
tmp = t_0
else if (l <= (-0.078d0)) then
tmp = t_1
else if (l <= 8d-30) then
tmp = u + (cos((k / 2.0d0)) * (j * (l * (2.0d0 + (0.3333333333333333d0 * (l ** 2.0d0))))))
else if (l <= 4.3d+88) then
tmp = t_1
else
tmp = t_0
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = U + (0.3333333333333333 * (J * (Math.cos((K * 0.5)) * Math.pow(l, 3.0))));
double t_1 = ((Math.exp(l) - Math.exp(-l)) * J) + U;
double tmp;
if (l <= -1.1e+81) {
tmp = t_0;
} else if (l <= -0.078) {
tmp = t_1;
} else if (l <= 8e-30) {
tmp = U + (Math.cos((K / 2.0)) * (J * (l * (2.0 + (0.3333333333333333 * Math.pow(l, 2.0))))));
} else if (l <= 4.3e+88) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(J, l, K, U): t_0 = U + (0.3333333333333333 * (J * (math.cos((K * 0.5)) * math.pow(l, 3.0)))) t_1 = ((math.exp(l) - math.exp(-l)) * J) + U tmp = 0 if l <= -1.1e+81: tmp = t_0 elif l <= -0.078: tmp = t_1 elif l <= 8e-30: tmp = U + (math.cos((K / 2.0)) * (J * (l * (2.0 + (0.3333333333333333 * math.pow(l, 2.0)))))) elif l <= 4.3e+88: tmp = t_1 else: tmp = t_0 return tmp
function code(J, l, K, U) t_0 = Float64(U + Float64(0.3333333333333333 * Float64(J * Float64(cos(Float64(K * 0.5)) * (l ^ 3.0))))) t_1 = Float64(Float64(Float64(exp(l) - exp(Float64(-l))) * J) + U) tmp = 0.0 if (l <= -1.1e+81) tmp = t_0; elseif (l <= -0.078) tmp = t_1; elseif (l <= 8e-30) tmp = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(J * Float64(l * Float64(2.0 + Float64(0.3333333333333333 * (l ^ 2.0))))))); elseif (l <= 4.3e+88) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = U + (0.3333333333333333 * (J * (cos((K * 0.5)) * (l ^ 3.0)))); t_1 = ((exp(l) - exp(-l)) * J) + U; tmp = 0.0; if (l <= -1.1e+81) tmp = t_0; elseif (l <= -0.078) tmp = t_1; elseif (l <= 8e-30) tmp = U + (cos((K / 2.0)) * (J * (l * (2.0 + (0.3333333333333333 * (l ^ 2.0)))))); elseif (l <= 4.3e+88) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(U + N[(0.3333333333333333 * N[(J * N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision] + U), $MachinePrecision]}, If[LessEqual[l, -1.1e+81], t$95$0, If[LessEqual[l, -0.078], t$95$1, If[LessEqual[l, 8e-30], 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], If[LessEqual[l, 4.3e+88], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + 0.3333333333333333 \cdot \left(J \cdot \left(\cos \left(K \cdot 0.5\right) \cdot {\ell}^{3}\right)\right)\\
t_1 := \left(e^{\ell} - e^{-\ell}\right) \cdot J + U\\
\mathbf{if}\;\ell \leq -1.1 \cdot 10^{+81}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq -0.078:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\ell \leq 8 \cdot 10^{-30}:\\
\;\;\;\;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{elif}\;\ell \leq 4.3 \cdot 10^{+88}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if l < -1.09999999999999993e81 or 4.29999999999999974e88 < l Initial program 100.0%
Taylor expanded in l around 0 97.9%
Taylor expanded in l around inf 97.9%
if -1.09999999999999993e81 < l < -0.0779999999999999999 or 8.000000000000001e-30 < l < 4.29999999999999974e88Initial program 100.0%
Taylor expanded in K around 0 86.1%
if -0.0779999999999999999 < l < 8.000000000000001e-30Initial program 78.7%
Taylor expanded in l around 0 99.9%
Final simplification97.3%
(FPCore (J l K U)
:precision binary64
(if (<= l -2.05e+214)
(* U (+ 1.0 (* 2.0 (* J (/ (+ l (* -8.0 (* l (pow K 2.0)))) U)))))
(if (or (<= l -0.0042) (not (<= l 8e-30)))
(+ (* (- (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 <= -2.05e+214) {
tmp = U * (1.0 + (2.0 * (J * ((l + (-8.0 * (l * pow(K, 2.0)))) / U))));
} else if ((l <= -0.0042) || !(l <= 8e-30)) {
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 <= (-2.05d+214)) then
tmp = u * (1.0d0 + (2.0d0 * (j * ((l + ((-8.0d0) * (l * (k ** 2.0d0)))) / u))))
else if ((l <= (-0.0042d0)) .or. (.not. (l <= 8d-30))) 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 <= -2.05e+214) {
tmp = U * (1.0 + (2.0 * (J * ((l + (-8.0 * (l * Math.pow(K, 2.0)))) / U))));
} else if ((l <= -0.0042) || !(l <= 8e-30)) {
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 <= -2.05e+214: tmp = U * (1.0 + (2.0 * (J * ((l + (-8.0 * (l * math.pow(K, 2.0)))) / U)))) elif (l <= -0.0042) or not (l <= 8e-30): 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 <= -2.05e+214) tmp = Float64(U * Float64(1.0 + Float64(2.0 * Float64(J * Float64(Float64(l + Float64(-8.0 * Float64(l * (K ^ 2.0)))) / U))))); elseif ((l <= -0.0042) || !(l <= 8e-30)) 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 <= -2.05e+214) tmp = U * (1.0 + (2.0 * (J * ((l + (-8.0 * (l * (K ^ 2.0)))) / U)))); elseif ((l <= -0.0042) || ~((l <= 8e-30))) 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[LessEqual[l, -2.05e+214], N[(U * N[(1.0 + N[(2.0 * N[(J * N[(N[(l + N[(-8.0 * N[(l * N[Power[K, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[l, -0.0042], N[Not[LessEqual[l, 8e-30]], $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 -2.05 \cdot 10^{+214}:\\
\;\;\;\;U \cdot \left(1 + 2 \cdot \left(J \cdot \frac{\ell + -8 \cdot \left(\ell \cdot {K}^{2}\right)}{U}\right)\right)\\
\mathbf{elif}\;\ell \leq -0.0042 \lor \neg \left(\ell \leq 8 \cdot 10^{-30}\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 < -2.05e214Initial program 100.0%
Taylor expanded in l around 0 35.5%
Applied egg-rr22.5%
rem-log-exp22.5%
*-commutative22.5%
Simplified22.5%
Taylor expanded in U around inf 30.1%
associate-/l*37.8%
*-commutative37.8%
Simplified37.8%
Taylor expanded in K around 0 72.5%
if -2.05e214 < l < -0.00419999999999999974 or 8.000000000000001e-30 < l Initial program 100.0%
Taylor expanded in K around 0 81.8%
if -0.00419999999999999974 < l < 8.000000000000001e-30Initial program 78.7%
Taylor expanded in l around 0 99.8%
Final simplification90.2%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= t_0 0.065)
(+ 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.065) {
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.065d0) 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.065) {
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.065: 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.065) 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.065) 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.065], 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.065:\\
\;\;\;\;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.065000000000000002Initial program 85.2%
Taylor expanded in l around 0 66.5%
if 0.065000000000000002 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 90.1%
Taylor expanded in l around 0 89.5%
Taylor expanded in K around 0 87.4%
Final simplification82.7%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.49) (+ U (* (* J (* l (pow K 2.0))) -0.25)) (+ U (* J (* 0.3333333333333333 (pow l 3.0))))))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.49) {
tmp = U + ((J * (l * pow(K, 2.0))) * -0.25);
} else {
tmp = U + (J * (0.3333333333333333 * pow(l, 3.0)));
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if (cos((k / 2.0d0)) <= (-0.49d0)) then
tmp = u + ((j * (l * (k ** 2.0d0))) * (-0.25d0))
else
tmp = u + (j * (0.3333333333333333d0 * (l ** 3.0d0)))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (Math.cos((K / 2.0)) <= -0.49) {
tmp = U + ((J * (l * Math.pow(K, 2.0))) * -0.25);
} else {
tmp = U + (J * (0.3333333333333333 * Math.pow(l, 3.0)));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if math.cos((K / 2.0)) <= -0.49: tmp = U + ((J * (l * math.pow(K, 2.0))) * -0.25) else: tmp = U + (J * (0.3333333333333333 * math.pow(l, 3.0))) return tmp
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.49) tmp = Float64(U + Float64(Float64(J * Float64(l * (K ^ 2.0))) * -0.25)); else tmp = Float64(U + Float64(J * Float64(0.3333333333333333 * (l ^ 3.0)))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (cos((K / 2.0)) <= -0.49) tmp = U + ((J * (l * (K ^ 2.0))) * -0.25); else tmp = U + (J * (0.3333333333333333 * (l ^ 3.0))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.49], N[(U + N[(N[(J * N[(l * N[Power[K, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.49:\\
\;\;\;\;U + \left(J \cdot \left(\ell \cdot {K}^{2}\right)\right) \cdot -0.25\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(0.3333333333333333 \cdot {\ell}^{3}\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.48999999999999999Initial program 89.8%
Taylor expanded in l around 0 60.6%
Taylor expanded in K around 0 56.7%
Taylor expanded in K around inf 63.7%
*-commutative63.7%
*-commutative63.7%
Simplified63.7%
if -0.48999999999999999 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 88.9%
Taylor expanded in l around 0 89.4%
Taylor expanded in l around inf 78.1%
Taylor expanded in K around 0 77.6%
associate-*r*77.6%
*-commutative77.6%
associate-*l*77.6%
Simplified77.6%
Final simplification75.3%
(FPCore (J l K U) :precision binary64 (if (or (<= J -1.7e+126) (not (<= J 3.2e+76))) (+ U (* 2.0 (* J (* l (cos (* K 0.5)))))) (+ U (* J (* 0.3333333333333333 (pow l 3.0))))))
double code(double J, double l, double K, double U) {
double tmp;
if ((J <= -1.7e+126) || !(J <= 3.2e+76)) {
tmp = U + (2.0 * (J * (l * cos((K * 0.5)))));
} else {
tmp = U + (J * (0.3333333333333333 * pow(l, 3.0)));
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if ((j <= (-1.7d+126)) .or. (.not. (j <= 3.2d+76))) then
tmp = u + (2.0d0 * (j * (l * cos((k * 0.5d0)))))
else
tmp = u + (j * (0.3333333333333333d0 * (l ** 3.0d0)))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if ((J <= -1.7e+126) || !(J <= 3.2e+76)) {
tmp = U + (2.0 * (J * (l * Math.cos((K * 0.5)))));
} else {
tmp = U + (J * (0.3333333333333333 * Math.pow(l, 3.0)));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (J <= -1.7e+126) or not (J <= 3.2e+76): tmp = U + (2.0 * (J * (l * math.cos((K * 0.5))))) else: tmp = U + (J * (0.3333333333333333 * math.pow(l, 3.0))) return tmp
function code(J, l, K, U) tmp = 0.0 if ((J <= -1.7e+126) || !(J <= 3.2e+76)) tmp = Float64(U + Float64(2.0 * Float64(J * Float64(l * cos(Float64(K * 0.5)))))); else tmp = Float64(U + Float64(J * Float64(0.3333333333333333 * (l ^ 3.0)))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((J <= -1.7e+126) || ~((J <= 3.2e+76))) tmp = U + (2.0 * (J * (l * cos((K * 0.5))))); else tmp = U + (J * (0.3333333333333333 * (l ^ 3.0))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[J, -1.7e+126], N[Not[LessEqual[J, 3.2e+76]], $MachinePrecision]], N[(U + N[(2.0 * N[(J * N[(l * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;J \leq -1.7 \cdot 10^{+126} \lor \neg \left(J \leq 3.2 \cdot 10^{+76}\right):\\
\;\;\;\;U + 2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(0.3333333333333333 \cdot {\ell}^{3}\right)\\
\end{array}
\end{array}
if J < -1.69999999999999995e126 or 3.19999999999999976e76 < J Initial program 69.8%
Taylor expanded in l around 0 91.0%
if -1.69999999999999995e126 < J < 3.19999999999999976e76Initial program 97.1%
Taylor expanded in l around 0 86.3%
Taylor expanded in l around inf 83.3%
Taylor expanded in K around 0 76.0%
associate-*r*76.0%
*-commutative76.0%
associate-*l*76.0%
Simplified76.0%
Final simplification80.5%
(FPCore (J l K U)
:precision binary64
(if (<= J -1.22e+120)
(+ U (* 2.0 (* J (* l (cos (* K 0.5))))))
(if (<= J 4.2e+78)
(+ U (* J (* 0.3333333333333333 (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 (J <= -1.22e+120) {
tmp = U + (2.0 * (J * (l * cos((K * 0.5)))));
} else if (J <= 4.2e+78) {
tmp = U + (J * (0.3333333333333333 * 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 (j <= (-1.22d+120)) then
tmp = u + (2.0d0 * (j * (l * cos((k * 0.5d0)))))
else if (j <= 4.2d+78) then
tmp = u + (j * (0.3333333333333333d0 * (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 (J <= -1.22e+120) {
tmp = U + (2.0 * (J * (l * Math.cos((K * 0.5)))));
} else if (J <= 4.2e+78) {
tmp = U + (J * (0.3333333333333333 * 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 J <= -1.22e+120: tmp = U + (2.0 * (J * (l * math.cos((K * 0.5))))) elif J <= 4.2e+78: tmp = U + (J * (0.3333333333333333 * 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 (J <= -1.22e+120) tmp = Float64(U + Float64(2.0 * Float64(J * Float64(l * cos(Float64(K * 0.5)))))); elseif (J <= 4.2e+78) tmp = Float64(U + Float64(J * Float64(0.3333333333333333 * (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 (J <= -1.22e+120) tmp = U + (2.0 * (J * (l * cos((K * 0.5))))); elseif (J <= 4.2e+78) tmp = U + (J * (0.3333333333333333 * (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[LessEqual[J, -1.22e+120], N[(U + N[(2.0 * N[(J * N[(l * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[J, 4.2e+78], N[(U + N[(J * N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $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}\;J \leq -1.22 \cdot 10^{+120}:\\
\;\;\;\;U + 2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\mathbf{elif}\;J \leq 4.2 \cdot 10^{+78}:\\
\;\;\;\;U + J \cdot \left(0.3333333333333333 \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 J < -1.22e120Initial program 68.5%
Taylor expanded in l around 0 92.9%
if -1.22e120 < J < 4.2000000000000002e78Initial program 97.1%
Taylor expanded in l around 0 86.3%
Taylor expanded in l around inf 83.3%
Taylor expanded in K around 0 76.0%
associate-*r*76.0%
*-commutative76.0%
associate-*l*76.0%
Simplified76.0%
if 4.2000000000000002e78 < J Initial program 70.6%
Taylor expanded in l around 0 90.0%
Final simplification80.5%
(FPCore (J l K U) :precision binary64 (if (<= J 8.1e+83) (+ U (* J (* 0.3333333333333333 (pow l 3.0)))) (* U (+ 1.0 (* 2.0 (* J (/ l U)))))))
double code(double J, double l, double K, double U) {
double tmp;
if (J <= 8.1e+83) {
tmp = U + (J * (0.3333333333333333 * pow(l, 3.0)));
} else {
tmp = U * (1.0 + (2.0 * (J * (l / 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 (j <= 8.1d+83) then
tmp = u + (j * (0.3333333333333333d0 * (l ** 3.0d0)))
else
tmp = u * (1.0d0 + (2.0d0 * (j * (l / u))))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (J <= 8.1e+83) {
tmp = U + (J * (0.3333333333333333 * Math.pow(l, 3.0)));
} else {
tmp = U * (1.0 + (2.0 * (J * (l / U))));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if J <= 8.1e+83: tmp = U + (J * (0.3333333333333333 * math.pow(l, 3.0))) else: tmp = U * (1.0 + (2.0 * (J * (l / U)))) return tmp
function code(J, l, K, U) tmp = 0.0 if (J <= 8.1e+83) tmp = Float64(U + Float64(J * Float64(0.3333333333333333 * (l ^ 3.0)))); else tmp = Float64(U * Float64(1.0 + Float64(2.0 * Float64(J * Float64(l / U))))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (J <= 8.1e+83) tmp = U + (J * (0.3333333333333333 * (l ^ 3.0))); else tmp = U * (1.0 + (2.0 * (J * (l / U)))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[J, 8.1e+83], N[(U + N[(J * N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U * N[(1.0 + N[(2.0 * N[(J * N[(l / U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;J \leq 8.1 \cdot 10^{+83}:\\
\;\;\;\;U + J \cdot \left(0.3333333333333333 \cdot {\ell}^{3}\right)\\
\mathbf{else}:\\
\;\;\;\;U \cdot \left(1 + 2 \cdot \left(J \cdot \frac{\ell}{U}\right)\right)\\
\end{array}
\end{array}
if J < 8.0999999999999997e83Initial program 93.2%
Taylor expanded in l around 0 88.2%
Taylor expanded in l around inf 81.0%
Taylor expanded in K around 0 72.7%
associate-*r*72.7%
*-commutative72.7%
associate-*l*72.7%
Simplified72.7%
if 8.0999999999999997e83 < J Initial program 70.6%
Taylor expanded in l around 0 90.0%
Applied egg-rr71.1%
rem-log-exp71.1%
*-commutative71.1%
Simplified71.1%
Taylor expanded in U around inf 72.7%
associate-/l*72.6%
*-commutative72.6%
Simplified72.6%
Taylor expanded in K around 0 71.7%
associate-/l*71.6%
Simplified71.6%
Final simplification72.5%
(FPCore (J l K U) :precision binary64 (* U (+ 1.0 (* 2.0 (* J (/ l U))))))
double code(double J, double l, double K, double U) {
return U * (1.0 + (2.0 * (J * (l / 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 * (1.0d0 + (2.0d0 * (j * (l / u))))
end function
public static double code(double J, double l, double K, double U) {
return U * (1.0 + (2.0 * (J * (l / U))));
}
def code(J, l, K, U): return U * (1.0 + (2.0 * (J * (l / U))))
function code(J, l, K, U) return Float64(U * Float64(1.0 + Float64(2.0 * Float64(J * Float64(l / U))))) end
function tmp = code(J, l, K, U) tmp = U * (1.0 + (2.0 * (J * (l / U)))); end
code[J_, l_, K_, U_] := N[(U * N[(1.0 + N[(2.0 * N[(J * N[(l / U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U \cdot \left(1 + 2 \cdot \left(J \cdot \frac{\ell}{U}\right)\right)
\end{array}
Initial program 89.0%
Taylor expanded in l around 0 65.7%
Applied egg-rr57.2%
rem-log-exp57.2%
*-commutative57.2%
Simplified57.2%
Taylor expanded in U around inf 61.8%
associate-/l*64.4%
*-commutative64.4%
Simplified64.4%
Taylor expanded in K around 0 61.4%
associate-/l*64.0%
Simplified64.0%
Final simplification64.0%
(FPCore (J l K U) :precision binary64 (+ U (* J (* l 2.0))))
double code(double J, double l, double K, double U) {
return U + (J * (l * 2.0));
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = u + (j * (l * 2.0d0))
end function
public static double code(double J, double l, double K, double U) {
return U + (J * (l * 2.0));
}
def code(J, l, K, U): return U + (J * (l * 2.0))
function code(J, l, K, U) return Float64(U + Float64(J * Float64(l * 2.0))) end
function tmp = code(J, l, K, U) tmp = U + (J * (l * 2.0)); end
code[J_, l_, K_, U_] := N[(U + N[(J * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + J \cdot \left(\ell \cdot 2\right)
\end{array}
Initial program 89.0%
Taylor expanded in l around 0 65.7%
Taylor expanded in K around 0 56.4%
*-commutative56.4%
associate-*r*56.7%
*-commutative56.7%
Simplified56.7%
Final simplification56.7%
(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 89.0%
Applied egg-rr28.3%
Taylor expanded in J around 0 42.1%
Final simplification42.1%
herbie shell --seed 2024095
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))