
(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 (+ (* (* J (log1p (expm1 (* l 2.0)))) (cos (/ K 2.0))) U))
double code(double J, double l, double K, double U) {
return ((J * log1p(expm1((l * 2.0)))) * cos((K / 2.0))) + U;
}
public static double code(double J, double l, double K, double U) {
return ((J * Math.log1p(Math.expm1((l * 2.0)))) * Math.cos((K / 2.0))) + U;
}
def code(J, l, K, U): return ((J * math.log1p(math.expm1((l * 2.0)))) * math.cos((K / 2.0))) + U
function code(J, l, K, U) return Float64(Float64(Float64(J * log1p(expm1(Float64(l * 2.0)))) * cos(Float64(K / 2.0))) + U) end
code[J_, l_, K_, U_] := N[(N[(N[(J * N[Log[1 + N[(Exp[N[(l * 2.0), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]
\begin{array}{l}
\\
\left(J \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(\ell \cdot 2\right)\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U
\end{array}
Initial program 87.9%
Taylor expanded in l around 0 60.3%
log1p-expm1-u99.1%
*-commutative99.1%
Applied egg-rr99.1%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (exp (- l))) (t_1 (cos (/ K 2.0))))
(if (<= l -125.0)
(+ U (* t_1 (* J (- 27.0 t_0))))
(if (<= l 0.047)
(+
U
(*
t_1
(*
l
(+
(* J 2.0)
(*
(pow l 2.0)
(+
(* 0.016666666666666666 (* J (* l l)))
(* J 0.3333333333333333)))))))
(if (<= l 1.08e+61)
(+ U (* J (- (exp l) t_0)))
(+
U
(* (* J 0.016666666666666666) (* (pow l 5.0) (cos (* K -0.5))))))))))
double code(double J, double l, double K, double U) {
double t_0 = exp(-l);
double t_1 = cos((K / 2.0));
double tmp;
if (l <= -125.0) {
tmp = U + (t_1 * (J * (27.0 - t_0)));
} else if (l <= 0.047) {
tmp = U + (t_1 * (l * ((J * 2.0) + (pow(l, 2.0) * ((0.016666666666666666 * (J * (l * l))) + (J * 0.3333333333333333))))));
} else if (l <= 1.08e+61) {
tmp = U + (J * (exp(l) - t_0));
} else {
tmp = U + ((J * 0.016666666666666666) * (pow(l, 5.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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = exp(-l)
t_1 = cos((k / 2.0d0))
if (l <= (-125.0d0)) then
tmp = u + (t_1 * (j * (27.0d0 - t_0)))
else if (l <= 0.047d0) then
tmp = u + (t_1 * (l * ((j * 2.0d0) + ((l ** 2.0d0) * ((0.016666666666666666d0 * (j * (l * l))) + (j * 0.3333333333333333d0))))))
else if (l <= 1.08d+61) then
tmp = u + (j * (exp(l) - t_0))
else
tmp = u + ((j * 0.016666666666666666d0) * ((l ** 5.0d0) * cos((k * (-0.5d0)))))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = Math.exp(-l);
double t_1 = Math.cos((K / 2.0));
double tmp;
if (l <= -125.0) {
tmp = U + (t_1 * (J * (27.0 - t_0)));
} else if (l <= 0.047) {
tmp = U + (t_1 * (l * ((J * 2.0) + (Math.pow(l, 2.0) * ((0.016666666666666666 * (J * (l * l))) + (J * 0.3333333333333333))))));
} else if (l <= 1.08e+61) {
tmp = U + (J * (Math.exp(l) - t_0));
} else {
tmp = U + ((J * 0.016666666666666666) * (Math.pow(l, 5.0) * Math.cos((K * -0.5))));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.exp(-l) t_1 = math.cos((K / 2.0)) tmp = 0 if l <= -125.0: tmp = U + (t_1 * (J * (27.0 - t_0))) elif l <= 0.047: tmp = U + (t_1 * (l * ((J * 2.0) + (math.pow(l, 2.0) * ((0.016666666666666666 * (J * (l * l))) + (J * 0.3333333333333333)))))) elif l <= 1.08e+61: tmp = U + (J * (math.exp(l) - t_0)) else: tmp = U + ((J * 0.016666666666666666) * (math.pow(l, 5.0) * math.cos((K * -0.5)))) return tmp
function code(J, l, K, U) t_0 = exp(Float64(-l)) t_1 = cos(Float64(K / 2.0)) tmp = 0.0 if (l <= -125.0) tmp = Float64(U + Float64(t_1 * Float64(J * Float64(27.0 - t_0)))); elseif (l <= 0.047) tmp = Float64(U + Float64(t_1 * Float64(l * Float64(Float64(J * 2.0) + Float64((l ^ 2.0) * Float64(Float64(0.016666666666666666 * Float64(J * Float64(l * l))) + Float64(J * 0.3333333333333333))))))); elseif (l <= 1.08e+61) tmp = Float64(U + Float64(J * Float64(exp(l) - t_0))); else tmp = Float64(U + Float64(Float64(J * 0.016666666666666666) * Float64((l ^ 5.0) * cos(Float64(K * -0.5))))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = exp(-l); t_1 = cos((K / 2.0)); tmp = 0.0; if (l <= -125.0) tmp = U + (t_1 * (J * (27.0 - t_0))); elseif (l <= 0.047) tmp = U + (t_1 * (l * ((J * 2.0) + ((l ^ 2.0) * ((0.016666666666666666 * (J * (l * l))) + (J * 0.3333333333333333)))))); elseif (l <= 1.08e+61) tmp = U + (J * (exp(l) - t_0)); else tmp = U + ((J * 0.016666666666666666) * ((l ^ 5.0) * cos((K * -0.5)))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Exp[(-l)], $MachinePrecision]}, Block[{t$95$1 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -125.0], N[(U + N[(t$95$1 * N[(J * N[(27.0 - t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 0.047], N[(U + N[(t$95$1 * N[(l * N[(N[(J * 2.0), $MachinePrecision] + N[(N[Power[l, 2.0], $MachinePrecision] * N[(N[(0.016666666666666666 * N[(J * N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(J * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.08e+61], N[(U + N[(J * N[(N[Exp[l], $MachinePrecision] - t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(N[(J * 0.016666666666666666), $MachinePrecision] * N[(N[Power[l, 5.0], $MachinePrecision] * N[Cos[N[(K * -0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-\ell}\\
t_1 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;\ell \leq -125:\\
\;\;\;\;U + t\_1 \cdot \left(J \cdot \left(27 - t\_0\right)\right)\\
\mathbf{elif}\;\ell \leq 0.047:\\
\;\;\;\;U + t\_1 \cdot \left(\ell \cdot \left(J \cdot 2 + {\ell}^{2} \cdot \left(0.016666666666666666 \cdot \left(J \cdot \left(\ell \cdot \ell\right)\right) + J \cdot 0.3333333333333333\right)\right)\right)\\
\mathbf{elif}\;\ell \leq 1.08 \cdot 10^{+61}:\\
\;\;\;\;U + J \cdot \left(e^{\ell} - t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;U + \left(J \cdot 0.016666666666666666\right) \cdot \left({\ell}^{5} \cdot \cos \left(K \cdot -0.5\right)\right)\\
\end{array}
\end{array}
if l < -125Initial program 100.0%
Applied egg-rr100.0%
if -125 < l < 0.047Initial program 74.8%
Taylor expanded in l around 0 99.9%
unpow299.9%
Applied egg-rr99.9%
if 0.047 < l < 1.08e61Initial program 100.0%
Taylor expanded in K around 0 75.0%
if 1.08e61 < l Initial program 100.0%
Taylor expanded in l around 0 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in l around inf 100.0%
associate-*r*100.0%
*-commutative100.0%
*-commutative100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
cos-neg100.0%
Simplified100.0%
Final simplification98.8%
(FPCore (J l K U)
:precision binary64
(if (or (<= l -3.3e+133)
(not (or (<= l -0.0019) (and (not (<= l 0.035)) (<= l 2.2e+88)))))
(+ U (* (cos (/ K 2.0)) (* J (* l (+ 2.0 (* (* l l) 0.3333333333333333))))))
(+ U (* J (- (exp l) (exp (- l)))))))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -3.3e+133) || !((l <= -0.0019) || (!(l <= 0.035) && (l <= 2.2e+88)))) {
tmp = U + (cos((K / 2.0)) * (J * (l * (2.0 + ((l * l) * 0.3333333333333333)))));
} else {
tmp = U + (J * (exp(l) - exp(-l)));
}
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.3d+133)) .or. (.not. (l <= (-0.0019d0)) .or. (.not. (l <= 0.035d0)) .and. (l <= 2.2d+88))) then
tmp = u + (cos((k / 2.0d0)) * (j * (l * (2.0d0 + ((l * l) * 0.3333333333333333d0)))))
else
tmp = u + (j * (exp(l) - exp(-l)))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -3.3e+133) || !((l <= -0.0019) || (!(l <= 0.035) && (l <= 2.2e+88)))) {
tmp = U + (Math.cos((K / 2.0)) * (J * (l * (2.0 + ((l * l) * 0.3333333333333333)))));
} else {
tmp = U + (J * (Math.exp(l) - Math.exp(-l)));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -3.3e+133) or not ((l <= -0.0019) or (not (l <= 0.035) and (l <= 2.2e+88))): tmp = U + (math.cos((K / 2.0)) * (J * (l * (2.0 + ((l * l) * 0.3333333333333333))))) else: tmp = U + (J * (math.exp(l) - math.exp(-l))) return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -3.3e+133) || !((l <= -0.0019) || (!(l <= 0.035) && (l <= 2.2e+88)))) tmp = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(J * Float64(l * Float64(2.0 + Float64(Float64(l * l) * 0.3333333333333333)))))); else tmp = Float64(U + Float64(J * Float64(exp(l) - exp(Float64(-l))))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -3.3e+133) || ~(((l <= -0.0019) || (~((l <= 0.035)) && (l <= 2.2e+88))))) tmp = U + (cos((K / 2.0)) * (J * (l * (2.0 + ((l * l) * 0.3333333333333333))))); else tmp = U + (J * (exp(l) - exp(-l))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -3.3e+133], N[Not[Or[LessEqual[l, -0.0019], And[N[Not[LessEqual[l, 0.035]], $MachinePrecision], LessEqual[l, 2.2e+88]]]], $MachinePrecision]], N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(J * N[(l * N[(2.0 + N[(N[(l * l), $MachinePrecision] * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -3.3 \cdot 10^{+133} \lor \neg \left(\ell \leq -0.0019 \lor \neg \left(\ell \leq 0.035\right) \land \ell \leq 2.2 \cdot 10^{+88}\right):\\
\;\;\;\;U + \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(\ell \cdot \left(2 + \left(\ell \cdot \ell\right) \cdot 0.3333333333333333\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(e^{\ell} - e^{-\ell}\right)\\
\end{array}
\end{array}
if l < -3.3e133 or -0.0019 < l < 0.035000000000000003 or 2.20000000000000009e88 < l Initial program 85.0%
Taylor expanded in l around 0 99.5%
unpow298.6%
Applied egg-rr99.5%
if -3.3e133 < l < -0.0019 or 0.035000000000000003 < l < 2.20000000000000009e88Initial program 99.8%
Taylor expanded in K around 0 82.1%
Final simplification96.0%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (exp (- l))) (t_1 (cos (/ K 2.0))))
(if (<= l -125.0)
(+ U (* t_1 (* J (- 27.0 t_0))))
(if (<= l 0.058)
(+
U
(* t_1 (* l (+ (* J 2.0) (* 0.3333333333333333 (* J (pow l 2.0)))))))
(if (<= l 4.3e+61)
(+ U (* J (- (exp l) t_0)))
(+
U
(* (* J 0.016666666666666666) (* (pow l 5.0) (cos (* K -0.5))))))))))
double code(double J, double l, double K, double U) {
double t_0 = exp(-l);
double t_1 = cos((K / 2.0));
double tmp;
if (l <= -125.0) {
tmp = U + (t_1 * (J * (27.0 - t_0)));
} else if (l <= 0.058) {
tmp = U + (t_1 * (l * ((J * 2.0) + (0.3333333333333333 * (J * pow(l, 2.0))))));
} else if (l <= 4.3e+61) {
tmp = U + (J * (exp(l) - t_0));
} else {
tmp = U + ((J * 0.016666666666666666) * (pow(l, 5.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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = exp(-l)
t_1 = cos((k / 2.0d0))
if (l <= (-125.0d0)) then
tmp = u + (t_1 * (j * (27.0d0 - t_0)))
else if (l <= 0.058d0) then
tmp = u + (t_1 * (l * ((j * 2.0d0) + (0.3333333333333333d0 * (j * (l ** 2.0d0))))))
else if (l <= 4.3d+61) then
tmp = u + (j * (exp(l) - t_0))
else
tmp = u + ((j * 0.016666666666666666d0) * ((l ** 5.0d0) * cos((k * (-0.5d0)))))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = Math.exp(-l);
double t_1 = Math.cos((K / 2.0));
double tmp;
if (l <= -125.0) {
tmp = U + (t_1 * (J * (27.0 - t_0)));
} else if (l <= 0.058) {
tmp = U + (t_1 * (l * ((J * 2.0) + (0.3333333333333333 * (J * Math.pow(l, 2.0))))));
} else if (l <= 4.3e+61) {
tmp = U + (J * (Math.exp(l) - t_0));
} else {
tmp = U + ((J * 0.016666666666666666) * (Math.pow(l, 5.0) * Math.cos((K * -0.5))));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.exp(-l) t_1 = math.cos((K / 2.0)) tmp = 0 if l <= -125.0: tmp = U + (t_1 * (J * (27.0 - t_0))) elif l <= 0.058: tmp = U + (t_1 * (l * ((J * 2.0) + (0.3333333333333333 * (J * math.pow(l, 2.0)))))) elif l <= 4.3e+61: tmp = U + (J * (math.exp(l) - t_0)) else: tmp = U + ((J * 0.016666666666666666) * (math.pow(l, 5.0) * math.cos((K * -0.5)))) return tmp
function code(J, l, K, U) t_0 = exp(Float64(-l)) t_1 = cos(Float64(K / 2.0)) tmp = 0.0 if (l <= -125.0) tmp = Float64(U + Float64(t_1 * Float64(J * Float64(27.0 - t_0)))); elseif (l <= 0.058) tmp = Float64(U + Float64(t_1 * Float64(l * Float64(Float64(J * 2.0) + Float64(0.3333333333333333 * Float64(J * (l ^ 2.0))))))); elseif (l <= 4.3e+61) tmp = Float64(U + Float64(J * Float64(exp(l) - t_0))); else tmp = Float64(U + Float64(Float64(J * 0.016666666666666666) * Float64((l ^ 5.0) * cos(Float64(K * -0.5))))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = exp(-l); t_1 = cos((K / 2.0)); tmp = 0.0; if (l <= -125.0) tmp = U + (t_1 * (J * (27.0 - t_0))); elseif (l <= 0.058) tmp = U + (t_1 * (l * ((J * 2.0) + (0.3333333333333333 * (J * (l ^ 2.0)))))); elseif (l <= 4.3e+61) tmp = U + (J * (exp(l) - t_0)); else tmp = U + ((J * 0.016666666666666666) * ((l ^ 5.0) * cos((K * -0.5)))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Exp[(-l)], $MachinePrecision]}, Block[{t$95$1 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -125.0], N[(U + N[(t$95$1 * N[(J * N[(27.0 - t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 0.058], N[(U + N[(t$95$1 * N[(l * N[(N[(J * 2.0), $MachinePrecision] + N[(0.3333333333333333 * N[(J * N[Power[l, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 4.3e+61], N[(U + N[(J * N[(N[Exp[l], $MachinePrecision] - t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(N[(J * 0.016666666666666666), $MachinePrecision] * N[(N[Power[l, 5.0], $MachinePrecision] * N[Cos[N[(K * -0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-\ell}\\
t_1 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;\ell \leq -125:\\
\;\;\;\;U + t\_1 \cdot \left(J \cdot \left(27 - t\_0\right)\right)\\
\mathbf{elif}\;\ell \leq 0.058:\\
\;\;\;\;U + t\_1 \cdot \left(\ell \cdot \left(J \cdot 2 + 0.3333333333333333 \cdot \left(J \cdot {\ell}^{2}\right)\right)\right)\\
\mathbf{elif}\;\ell \leq 4.3 \cdot 10^{+61}:\\
\;\;\;\;U + J \cdot \left(e^{\ell} - t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;U + \left(J \cdot 0.016666666666666666\right) \cdot \left({\ell}^{5} \cdot \cos \left(K \cdot -0.5\right)\right)\\
\end{array}
\end{array}
if l < -125Initial program 100.0%
Applied egg-rr100.0%
if -125 < l < 0.0580000000000000029Initial program 74.8%
Taylor expanded in l around 0 99.8%
if 0.0580000000000000029 < l < 4.3000000000000001e61Initial program 100.0%
Taylor expanded in K around 0 75.0%
if 4.3000000000000001e61 < l Initial program 100.0%
Taylor expanded in l around 0 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in l around inf 100.0%
associate-*r*100.0%
*-commutative100.0%
*-commutative100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
cos-neg100.0%
Simplified100.0%
Final simplification98.7%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (exp (- l))) (t_1 (cos (/ K 2.0))))
(if (<= l -125.0)
(+ U (* t_1 (* J (- 27.0 t_0))))
(if (<= l 0.06)
(+ U (* t_1 (* J (* l (+ 2.0 (* (* l l) 0.3333333333333333))))))
(if (<= l 2e+58)
(+ U (* J (- (exp l) t_0)))
(+
U
(* (* J 0.016666666666666666) (* (pow l 5.0) (cos (* K -0.5))))))))))
double code(double J, double l, double K, double U) {
double t_0 = exp(-l);
double t_1 = cos((K / 2.0));
double tmp;
if (l <= -125.0) {
tmp = U + (t_1 * (J * (27.0 - t_0)));
} else if (l <= 0.06) {
tmp = U + (t_1 * (J * (l * (2.0 + ((l * l) * 0.3333333333333333)))));
} else if (l <= 2e+58) {
tmp = U + (J * (exp(l) - t_0));
} else {
tmp = U + ((J * 0.016666666666666666) * (pow(l, 5.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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = exp(-l)
t_1 = cos((k / 2.0d0))
if (l <= (-125.0d0)) then
tmp = u + (t_1 * (j * (27.0d0 - t_0)))
else if (l <= 0.06d0) then
tmp = u + (t_1 * (j * (l * (2.0d0 + ((l * l) * 0.3333333333333333d0)))))
else if (l <= 2d+58) then
tmp = u + (j * (exp(l) - t_0))
else
tmp = u + ((j * 0.016666666666666666d0) * ((l ** 5.0d0) * cos((k * (-0.5d0)))))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = Math.exp(-l);
double t_1 = Math.cos((K / 2.0));
double tmp;
if (l <= -125.0) {
tmp = U + (t_1 * (J * (27.0 - t_0)));
} else if (l <= 0.06) {
tmp = U + (t_1 * (J * (l * (2.0 + ((l * l) * 0.3333333333333333)))));
} else if (l <= 2e+58) {
tmp = U + (J * (Math.exp(l) - t_0));
} else {
tmp = U + ((J * 0.016666666666666666) * (Math.pow(l, 5.0) * Math.cos((K * -0.5))));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.exp(-l) t_1 = math.cos((K / 2.0)) tmp = 0 if l <= -125.0: tmp = U + (t_1 * (J * (27.0 - t_0))) elif l <= 0.06: tmp = U + (t_1 * (J * (l * (2.0 + ((l * l) * 0.3333333333333333))))) elif l <= 2e+58: tmp = U + (J * (math.exp(l) - t_0)) else: tmp = U + ((J * 0.016666666666666666) * (math.pow(l, 5.0) * math.cos((K * -0.5)))) return tmp
function code(J, l, K, U) t_0 = exp(Float64(-l)) t_1 = cos(Float64(K / 2.0)) tmp = 0.0 if (l <= -125.0) tmp = Float64(U + Float64(t_1 * Float64(J * Float64(27.0 - t_0)))); elseif (l <= 0.06) tmp = Float64(U + Float64(t_1 * Float64(J * Float64(l * Float64(2.0 + Float64(Float64(l * l) * 0.3333333333333333)))))); elseif (l <= 2e+58) tmp = Float64(U + Float64(J * Float64(exp(l) - t_0))); else tmp = Float64(U + Float64(Float64(J * 0.016666666666666666) * Float64((l ^ 5.0) * cos(Float64(K * -0.5))))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = exp(-l); t_1 = cos((K / 2.0)); tmp = 0.0; if (l <= -125.0) tmp = U + (t_1 * (J * (27.0 - t_0))); elseif (l <= 0.06) tmp = U + (t_1 * (J * (l * (2.0 + ((l * l) * 0.3333333333333333))))); elseif (l <= 2e+58) tmp = U + (J * (exp(l) - t_0)); else tmp = U + ((J * 0.016666666666666666) * ((l ^ 5.0) * cos((K * -0.5)))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Exp[(-l)], $MachinePrecision]}, Block[{t$95$1 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -125.0], N[(U + N[(t$95$1 * N[(J * N[(27.0 - t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 0.06], N[(U + N[(t$95$1 * N[(J * N[(l * N[(2.0 + N[(N[(l * l), $MachinePrecision] * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2e+58], N[(U + N[(J * N[(N[Exp[l], $MachinePrecision] - t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(N[(J * 0.016666666666666666), $MachinePrecision] * N[(N[Power[l, 5.0], $MachinePrecision] * N[Cos[N[(K * -0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-\ell}\\
t_1 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;\ell \leq -125:\\
\;\;\;\;U + t\_1 \cdot \left(J \cdot \left(27 - t\_0\right)\right)\\
\mathbf{elif}\;\ell \leq 0.06:\\
\;\;\;\;U + t\_1 \cdot \left(J \cdot \left(\ell \cdot \left(2 + \left(\ell \cdot \ell\right) \cdot 0.3333333333333333\right)\right)\right)\\
\mathbf{elif}\;\ell \leq 2 \cdot 10^{+58}:\\
\;\;\;\;U + J \cdot \left(e^{\ell} - t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;U + \left(J \cdot 0.016666666666666666\right) \cdot \left({\ell}^{5} \cdot \cos \left(K \cdot -0.5\right)\right)\\
\end{array}
\end{array}
if l < -125Initial program 100.0%
Applied egg-rr100.0%
if -125 < l < 0.059999999999999998Initial program 74.8%
Taylor expanded in l around 0 99.8%
unpow299.9%
Applied egg-rr99.8%
if 0.059999999999999998 < l < 1.99999999999999989e58Initial program 100.0%
Taylor expanded in K around 0 75.0%
if 1.99999999999999989e58 < l Initial program 100.0%
Taylor expanded in l around 0 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in l around inf 100.0%
associate-*r*100.0%
*-commutative100.0%
*-commutative100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
cos-neg100.0%
Simplified100.0%
Final simplification98.7%
(FPCore (J l K U)
:precision binary64
(let* ((t_0
(+
U
(* (* J 0.016666666666666666) (* (pow l 5.0) (cos (* K -0.5)))))))
(if (<= l -125.0)
t_0
(if (<= l 0.056)
(+
U
(* (cos (/ K 2.0)) (* J (* l (+ 2.0 (* (* l l) 0.3333333333333333))))))
(if (<= l 9.4e+58) (+ U (* J (- (exp l) (exp (- l))))) t_0)))))
double code(double J, double l, double K, double U) {
double t_0 = U + ((J * 0.016666666666666666) * (pow(l, 5.0) * cos((K * -0.5))));
double tmp;
if (l <= -125.0) {
tmp = t_0;
} else if (l <= 0.056) {
tmp = U + (cos((K / 2.0)) * (J * (l * (2.0 + ((l * l) * 0.3333333333333333)))));
} else if (l <= 9.4e+58) {
tmp = U + (J * (exp(l) - exp(-l)));
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: t_0
real(8) :: tmp
t_0 = u + ((j * 0.016666666666666666d0) * ((l ** 5.0d0) * cos((k * (-0.5d0)))))
if (l <= (-125.0d0)) then
tmp = t_0
else if (l <= 0.056d0) then
tmp = u + (cos((k / 2.0d0)) * (j * (l * (2.0d0 + ((l * l) * 0.3333333333333333d0)))))
else if (l <= 9.4d+58) then
tmp = u + (j * (exp(l) - exp(-l)))
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.016666666666666666) * (Math.pow(l, 5.0) * Math.cos((K * -0.5))));
double tmp;
if (l <= -125.0) {
tmp = t_0;
} else if (l <= 0.056) {
tmp = U + (Math.cos((K / 2.0)) * (J * (l * (2.0 + ((l * l) * 0.3333333333333333)))));
} else if (l <= 9.4e+58) {
tmp = U + (J * (Math.exp(l) - Math.exp(-l)));
} else {
tmp = t_0;
}
return tmp;
}
def code(J, l, K, U): t_0 = U + ((J * 0.016666666666666666) * (math.pow(l, 5.0) * math.cos((K * -0.5)))) tmp = 0 if l <= -125.0: tmp = t_0 elif l <= 0.056: tmp = U + (math.cos((K / 2.0)) * (J * (l * (2.0 + ((l * l) * 0.3333333333333333))))) elif l <= 9.4e+58: tmp = U + (J * (math.exp(l) - math.exp(-l))) else: tmp = t_0 return tmp
function code(J, l, K, U) t_0 = Float64(U + Float64(Float64(J * 0.016666666666666666) * Float64((l ^ 5.0) * cos(Float64(K * -0.5))))) tmp = 0.0 if (l <= -125.0) tmp = t_0; elseif (l <= 0.056) tmp = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(J * Float64(l * Float64(2.0 + Float64(Float64(l * l) * 0.3333333333333333)))))); elseif (l <= 9.4e+58) tmp = Float64(U + Float64(J * Float64(exp(l) - exp(Float64(-l))))); else tmp = t_0; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = U + ((J * 0.016666666666666666) * ((l ^ 5.0) * cos((K * -0.5)))); tmp = 0.0; if (l <= -125.0) tmp = t_0; elseif (l <= 0.056) tmp = U + (cos((K / 2.0)) * (J * (l * (2.0 + ((l * l) * 0.3333333333333333))))); elseif (l <= 9.4e+58) tmp = U + (J * (exp(l) - exp(-l))); else tmp = t_0; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(U + N[(N[(J * 0.016666666666666666), $MachinePrecision] * N[(N[Power[l, 5.0], $MachinePrecision] * N[Cos[N[(K * -0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -125.0], t$95$0, If[LessEqual[l, 0.056], N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(J * N[(l * N[(2.0 + N[(N[(l * l), $MachinePrecision] * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 9.4e+58], N[(U + N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + \left(J \cdot 0.016666666666666666\right) \cdot \left({\ell}^{5} \cdot \cos \left(K \cdot -0.5\right)\right)\\
\mathbf{if}\;\ell \leq -125:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq 0.056:\\
\;\;\;\;U + \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(\ell \cdot \left(2 + \left(\ell \cdot \ell\right) \cdot 0.3333333333333333\right)\right)\right)\\
\mathbf{elif}\;\ell \leq 9.4 \cdot 10^{+58}:\\
\;\;\;\;U + J \cdot \left(e^{\ell} - e^{-\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if l < -125 or 9.39999999999999944e58 < l Initial program 100.0%
Taylor expanded in l around 0 93.6%
*-commutative93.6%
Simplified93.6%
Taylor expanded in l around inf 93.6%
associate-*r*93.6%
*-commutative93.6%
*-commutative93.6%
metadata-eval93.6%
distribute-rgt-neg-in93.6%
cos-neg93.6%
Simplified93.6%
if -125 < l < 0.0560000000000000012Initial program 74.8%
Taylor expanded in l around 0 99.8%
unpow299.9%
Applied egg-rr99.8%
if 0.0560000000000000012 < l < 9.39999999999999944e58Initial program 100.0%
Taylor expanded in K around 0 75.0%
Final simplification95.7%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= t_0 0.11)
(+ U (* t_0 (* J (* l 2.0))))
(+ U (* J (+ (* l 2.0) (* 0.3333333333333333 (pow l 3.0))))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double tmp;
if (t_0 <= 0.11) {
tmp = U + (t_0 * (J * (l * 2.0)));
} else {
tmp = U + (J * ((l * 2.0) + (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) :: t_0
real(8) :: tmp
t_0 = cos((k / 2.0d0))
if (t_0 <= 0.11d0) then
tmp = u + (t_0 * (j * (l * 2.0d0)))
else
tmp = u + (j * ((l * 2.0d0) + (0.3333333333333333d0 * (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 / 2.0));
double tmp;
if (t_0 <= 0.11) {
tmp = U + (t_0 * (J * (l * 2.0)));
} else {
tmp = U + (J * ((l * 2.0) + (0.3333333333333333 * Math.pow(l, 3.0))));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K / 2.0)) tmp = 0 if t_0 <= 0.11: tmp = U + (t_0 * (J * (l * 2.0))) else: tmp = U + (J * ((l * 2.0) + (0.3333333333333333 * math.pow(l, 3.0)))) return tmp
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) tmp = 0.0 if (t_0 <= 0.11) tmp = Float64(U + Float64(t_0 * Float64(J * Float64(l * 2.0)))); else tmp = Float64(U + Float64(J * Float64(Float64(l * 2.0) + Float64(0.3333333333333333 * (l ^ 3.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.11) tmp = U + (t_0 * (J * (l * 2.0))); else tmp = U + (J * ((l * 2.0) + (0.3333333333333333 * (l ^ 3.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.11], N[(U + N[(t$95$0 * N[(J * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * N[(N[(l * 2.0), $MachinePrecision] + N[(0.3333333333333333 * N[Power[l, 3.0], $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.11:\\
\;\;\;\;U + t\_0 \cdot \left(J \cdot \left(\ell \cdot 2\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(\ell \cdot 2 + 0.3333333333333333 \cdot {\ell}^{3}\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < 0.110000000000000001Initial program 84.9%
Taylor expanded in l around 0 63.6%
if 0.110000000000000001 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 88.9%
Taylor expanded in l around 0 87.5%
Taylor expanded in K around 0 86.0%
associate-*r*84.5%
*-commutative84.5%
distribute-lft-out84.5%
associate-*r*84.5%
associate-*r*86.0%
distribute-lft-out86.0%
fma-define86.0%
associate-*r*86.0%
unpow286.0%
cube-mult86.0%
*-commutative86.0%
Simplified86.0%
fma-undefine86.0%
Applied egg-rr86.0%
Final simplification80.3%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= t_0 0.11)
(+ U (* t_0 (* J (* l 2.0))))
(+ U (* J (* l (+ 2.0 (* (pow l 2.0) 0.3333333333333333))))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double tmp;
if (t_0 <= 0.11) {
tmp = U + (t_0 * (J * (l * 2.0)));
} else {
tmp = U + (J * (l * (2.0 + (pow(l, 2.0) * 0.3333333333333333))));
}
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.11d0) then
tmp = u + (t_0 * (j * (l * 2.0d0)))
else
tmp = u + (j * (l * (2.0d0 + ((l ** 2.0d0) * 0.3333333333333333d0))))
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.11) {
tmp = U + (t_0 * (J * (l * 2.0)));
} else {
tmp = U + (J * (l * (2.0 + (Math.pow(l, 2.0) * 0.3333333333333333))));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K / 2.0)) tmp = 0 if t_0 <= 0.11: tmp = U + (t_0 * (J * (l * 2.0))) else: tmp = U + (J * (l * (2.0 + (math.pow(l, 2.0) * 0.3333333333333333)))) return tmp
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) tmp = 0.0 if (t_0 <= 0.11) tmp = Float64(U + Float64(t_0 * Float64(J * Float64(l * 2.0)))); else tmp = Float64(U + Float64(J * Float64(l * Float64(2.0 + Float64((l ^ 2.0) * 0.3333333333333333))))); 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.11) tmp = U + (t_0 * (J * (l * 2.0))); else tmp = U + (J * (l * (2.0 + ((l ^ 2.0) * 0.3333333333333333)))); 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.11], 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[(N[Power[l, 2.0], $MachinePrecision] * 0.3333333333333333), $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.11:\\
\;\;\;\;U + t\_0 \cdot \left(J \cdot \left(\ell \cdot 2\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(\ell \cdot \left(2 + {\ell}^{2} \cdot 0.3333333333333333\right)\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < 0.110000000000000001Initial program 84.9%
Taylor expanded in l around 0 63.6%
if 0.110000000000000001 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 88.9%
Taylor expanded in l around 0 87.5%
Taylor expanded in K around 0 86.0%
Final simplification80.3%
(FPCore (J l K U) :precision binary64 (if (or (<= l -3.3e+133) (not (<= l -125.0))) (+ U (* (cos (/ K 2.0)) (* J (* l (+ 2.0 (* (* l l) 0.3333333333333333)))))) (+ U (* J (- 27.0 (exp (- l)))))))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -3.3e+133) || !(l <= -125.0)) {
tmp = U + (cos((K / 2.0)) * (J * (l * (2.0 + ((l * l) * 0.3333333333333333)))));
} else {
tmp = U + (J * (27.0 - exp(-l)));
}
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.3d+133)) .or. (.not. (l <= (-125.0d0)))) then
tmp = u + (cos((k / 2.0d0)) * (j * (l * (2.0d0 + ((l * l) * 0.3333333333333333d0)))))
else
tmp = u + (j * (27.0d0 - exp(-l)))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -3.3e+133) || !(l <= -125.0)) {
tmp = U + (Math.cos((K / 2.0)) * (J * (l * (2.0 + ((l * l) * 0.3333333333333333)))));
} else {
tmp = U + (J * (27.0 - Math.exp(-l)));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -3.3e+133) or not (l <= -125.0): tmp = U + (math.cos((K / 2.0)) * (J * (l * (2.0 + ((l * l) * 0.3333333333333333))))) else: tmp = U + (J * (27.0 - math.exp(-l))) return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -3.3e+133) || !(l <= -125.0)) tmp = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(J * Float64(l * Float64(2.0 + Float64(Float64(l * l) * 0.3333333333333333)))))); else tmp = Float64(U + Float64(J * Float64(27.0 - exp(Float64(-l))))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -3.3e+133) || ~((l <= -125.0))) tmp = U + (cos((K / 2.0)) * (J * (l * (2.0 + ((l * l) * 0.3333333333333333))))); else tmp = U + (J * (27.0 - exp(-l))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -3.3e+133], N[Not[LessEqual[l, -125.0]], $MachinePrecision]], N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(J * N[(l * N[(2.0 + N[(N[(l * l), $MachinePrecision] * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * N[(27.0 - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -3.3 \cdot 10^{+133} \lor \neg \left(\ell \leq -125\right):\\
\;\;\;\;U + \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(\ell \cdot \left(2 + \left(\ell \cdot \ell\right) \cdot 0.3333333333333333\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(27 - e^{-\ell}\right)\\
\end{array}
\end{array}
if l < -3.3e133 or -125 < l Initial program 86.5%
Taylor expanded in l around 0 92.0%
unpow293.7%
Applied egg-rr92.0%
if -3.3e133 < l < -125Initial program 100.0%
Applied egg-rr100.0%
Taylor expanded in K around 0 85.2%
Final simplification91.2%
(FPCore (J l K U)
:precision binary64
(if (<= l -125.0)
(+ U (* J (- 27.0 (exp (- l)))))
(if (<= l 80000000000.0)
(+ U (* (cos (/ K 2.0)) (* J (* l 2.0))))
(*
U
(+ 1.0 (/ (* J (+ (* l 2.0) (* 0.3333333333333333 (pow l 3.0)))) U))))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -125.0) {
tmp = U + (J * (27.0 - exp(-l)));
} else if (l <= 80000000000.0) {
tmp = U + (cos((K / 2.0)) * (J * (l * 2.0)));
} else {
tmp = U * (1.0 + ((J * ((l * 2.0) + (0.3333333333333333 * pow(l, 3.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) :: tmp
if (l <= (-125.0d0)) then
tmp = u + (j * (27.0d0 - exp(-l)))
else if (l <= 80000000000.0d0) then
tmp = u + (cos((k / 2.0d0)) * (j * (l * 2.0d0)))
else
tmp = u * (1.0d0 + ((j * ((l * 2.0d0) + (0.3333333333333333d0 * (l ** 3.0d0)))) / u))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (l <= -125.0) {
tmp = U + (J * (27.0 - Math.exp(-l)));
} else if (l <= 80000000000.0) {
tmp = U + (Math.cos((K / 2.0)) * (J * (l * 2.0)));
} else {
tmp = U * (1.0 + ((J * ((l * 2.0) + (0.3333333333333333 * Math.pow(l, 3.0)))) / U));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -125.0: tmp = U + (J * (27.0 - math.exp(-l))) elif l <= 80000000000.0: tmp = U + (math.cos((K / 2.0)) * (J * (l * 2.0))) else: tmp = U * (1.0 + ((J * ((l * 2.0) + (0.3333333333333333 * math.pow(l, 3.0)))) / U)) return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -125.0) tmp = Float64(U + Float64(J * Float64(27.0 - exp(Float64(-l))))); elseif (l <= 80000000000.0) tmp = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(J * Float64(l * 2.0)))); else tmp = Float64(U * Float64(1.0 + Float64(Float64(J * Float64(Float64(l * 2.0) + Float64(0.3333333333333333 * (l ^ 3.0)))) / U))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -125.0) tmp = U + (J * (27.0 - exp(-l))); elseif (l <= 80000000000.0) tmp = U + (cos((K / 2.0)) * (J * (l * 2.0))); else tmp = U * (1.0 + ((J * ((l * 2.0) + (0.3333333333333333 * (l ^ 3.0)))) / U)); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -125.0], N[(U + N[(J * N[(27.0 - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 80000000000.0], N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(J * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U * N[(1.0 + N[(N[(J * N[(N[(l * 2.0), $MachinePrecision] + N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -125:\\
\;\;\;\;U + J \cdot \left(27 - e^{-\ell}\right)\\
\mathbf{elif}\;\ell \leq 80000000000:\\
\;\;\;\;U + \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(\ell \cdot 2\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U \cdot \left(1 + \frac{J \cdot \left(\ell \cdot 2 + 0.3333333333333333 \cdot {\ell}^{3}\right)}{U}\right)\\
\end{array}
\end{array}
if l < -125Initial program 100.0%
Applied egg-rr100.0%
Taylor expanded in K around 0 76.1%
if -125 < l < 8e10Initial program 75.6%
Taylor expanded in l around 0 95.9%
if 8e10 < l Initial program 100.0%
Taylor expanded in l around 0 76.8%
Taylor expanded in K around 0 57.4%
associate-*r*54.4%
*-commutative54.4%
distribute-lft-out54.4%
associate-*r*54.4%
associate-*r*57.4%
distribute-lft-out57.4%
fma-define57.4%
associate-*r*57.4%
unpow257.4%
cube-mult57.4%
*-commutative57.4%
Simplified57.4%
Taylor expanded in U around inf 60.4%
Final simplification82.1%
(FPCore (J l K U)
:precision binary64
(if (<= l -125.0)
(+ U (* J (- 27.0 (exp (- l)))))
(if (<= l 95000000000.0)
(+ U (* (cos (/ K 2.0)) (* J (* l 2.0))))
(+ U (* 0.3333333333333333 (* J (pow l 3.0)))))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -125.0) {
tmp = U + (J * (27.0 - exp(-l)));
} else if (l <= 95000000000.0) {
tmp = U + (cos((K / 2.0)) * (J * (l * 2.0)));
} else {
tmp = U + (0.3333333333333333 * (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) :: tmp
if (l <= (-125.0d0)) then
tmp = u + (j * (27.0d0 - exp(-l)))
else if (l <= 95000000000.0d0) then
tmp = u + (cos((k / 2.0d0)) * (j * (l * 2.0d0)))
else
tmp = u + (0.3333333333333333d0 * (j * (l ** 3.0d0)))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (l <= -125.0) {
tmp = U + (J * (27.0 - Math.exp(-l)));
} else if (l <= 95000000000.0) {
tmp = U + (Math.cos((K / 2.0)) * (J * (l * 2.0)));
} else {
tmp = U + (0.3333333333333333 * (J * Math.pow(l, 3.0)));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -125.0: tmp = U + (J * (27.0 - math.exp(-l))) elif l <= 95000000000.0: tmp = U + (math.cos((K / 2.0)) * (J * (l * 2.0))) else: tmp = U + (0.3333333333333333 * (J * math.pow(l, 3.0))) return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -125.0) tmp = Float64(U + Float64(J * Float64(27.0 - exp(Float64(-l))))); elseif (l <= 95000000000.0) tmp = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(J * Float64(l * 2.0)))); else tmp = Float64(U + Float64(0.3333333333333333 * Float64(J * (l ^ 3.0)))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -125.0) tmp = U + (J * (27.0 - exp(-l))); elseif (l <= 95000000000.0) tmp = U + (cos((K / 2.0)) * (J * (l * 2.0))); else tmp = U + (0.3333333333333333 * (J * (l ^ 3.0))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -125.0], N[(U + N[(J * N[(27.0 - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 95000000000.0], N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(J * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(0.3333333333333333 * N[(J * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -125:\\
\;\;\;\;U + J \cdot \left(27 - e^{-\ell}\right)\\
\mathbf{elif}\;\ell \leq 95000000000:\\
\;\;\;\;U + \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(\ell \cdot 2\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + 0.3333333333333333 \cdot \left(J \cdot {\ell}^{3}\right)\\
\end{array}
\end{array}
if l < -125Initial program 100.0%
Applied egg-rr100.0%
Taylor expanded in K around 0 76.1%
if -125 < l < 9.5e10Initial program 75.6%
Taylor expanded in l around 0 95.9%
if 9.5e10 < l Initial program 100.0%
Taylor expanded in l around 0 76.8%
Taylor expanded in K around 0 57.4%
associate-*r*54.4%
*-commutative54.4%
distribute-lft-out54.4%
associate-*r*54.4%
associate-*r*57.4%
distribute-lft-out57.4%
fma-define57.4%
associate-*r*57.4%
unpow257.4%
cube-mult57.4%
*-commutative57.4%
Simplified57.4%
Taylor expanded in l around inf 57.4%
Final simplification81.4%
(FPCore (J l K U)
:precision binary64
(if (<= l -125.0)
(+ U (* J (- 27.0 (exp (- l)))))
(if (<= l 115000000000.0)
(+ U (* 2.0 (* J (* l (cos (* K 0.5))))))
(+ U (* 0.3333333333333333 (* J (pow l 3.0)))))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -125.0) {
tmp = U + (J * (27.0 - exp(-l)));
} else if (l <= 115000000000.0) {
tmp = U + (2.0 * (J * (l * cos((K * 0.5)))));
} else {
tmp = U + (0.3333333333333333 * (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) :: tmp
if (l <= (-125.0d0)) then
tmp = u + (j * (27.0d0 - exp(-l)))
else if (l <= 115000000000.0d0) then
tmp = u + (2.0d0 * (j * (l * cos((k * 0.5d0)))))
else
tmp = u + (0.3333333333333333d0 * (j * (l ** 3.0d0)))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (l <= -125.0) {
tmp = U + (J * (27.0 - Math.exp(-l)));
} else if (l <= 115000000000.0) {
tmp = U + (2.0 * (J * (l * Math.cos((K * 0.5)))));
} else {
tmp = U + (0.3333333333333333 * (J * Math.pow(l, 3.0)));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -125.0: tmp = U + (J * (27.0 - math.exp(-l))) elif l <= 115000000000.0: tmp = U + (2.0 * (J * (l * math.cos((K * 0.5))))) else: tmp = U + (0.3333333333333333 * (J * math.pow(l, 3.0))) return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -125.0) tmp = Float64(U + Float64(J * Float64(27.0 - exp(Float64(-l))))); elseif (l <= 115000000000.0) tmp = Float64(U + Float64(2.0 * Float64(J * Float64(l * cos(Float64(K * 0.5)))))); else tmp = Float64(U + Float64(0.3333333333333333 * Float64(J * (l ^ 3.0)))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -125.0) tmp = U + (J * (27.0 - exp(-l))); elseif (l <= 115000000000.0) tmp = U + (2.0 * (J * (l * cos((K * 0.5))))); else tmp = U + (0.3333333333333333 * (J * (l ^ 3.0))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -125.0], N[(U + N[(J * N[(27.0 - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 115000000000.0], N[(U + N[(2.0 * N[(J * N[(l * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(0.3333333333333333 * N[(J * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -125:\\
\;\;\;\;U + J \cdot \left(27 - e^{-\ell}\right)\\
\mathbf{elif}\;\ell \leq 115000000000:\\
\;\;\;\;U + 2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + 0.3333333333333333 \cdot \left(J \cdot {\ell}^{3}\right)\\
\end{array}
\end{array}
if l < -125Initial program 100.0%
Applied egg-rr100.0%
Taylor expanded in K around 0 76.1%
if -125 < l < 1.15e11Initial program 75.6%
Taylor expanded in l around 0 95.9%
if 1.15e11 < l Initial program 100.0%
Taylor expanded in l around 0 76.8%
Taylor expanded in K around 0 57.4%
associate-*r*54.4%
*-commutative54.4%
distribute-lft-out54.4%
associate-*r*54.4%
associate-*r*57.4%
distribute-lft-out57.4%
fma-define57.4%
associate-*r*57.4%
unpow257.4%
cube-mult57.4%
*-commutative57.4%
Simplified57.4%
Taylor expanded in l around inf 57.4%
Final simplification81.4%
(FPCore (J l K U) :precision binary64 (if (or (<= l -125.0) (not (<= l 78000000000.0))) (+ U (* 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 <= -125.0) || !(l <= 78000000000.0)) {
tmp = U + (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 <= (-125.0d0)) .or. (.not. (l <= 78000000000.0d0))) then
tmp = u + (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 <= -125.0) || !(l <= 78000000000.0)) {
tmp = U + (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 <= -125.0) or not (l <= 78000000000.0): tmp = U + (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 <= -125.0) || !(l <= 78000000000.0)) tmp = Float64(U + 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 <= -125.0) || ~((l <= 78000000000.0))) tmp = U + (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, -125.0], N[Not[LessEqual[l, 78000000000.0]], $MachinePrecision]], N[(U + N[(0.3333333333333333 * N[(J * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(l * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -125 \lor \neg \left(\ell \leq 78000000000\right):\\
\;\;\;\;U + 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 < -125 or 7.8e10 < l Initial program 100.0%
Taylor expanded in l around 0 78.5%
Taylor expanded in K around 0 59.1%
associate-*r*56.9%
*-commutative56.9%
distribute-lft-out56.9%
associate-*r*56.9%
associate-*r*59.1%
distribute-lft-out59.1%
fma-define59.1%
associate-*r*59.1%
unpow259.1%
cube-mult59.1%
*-commutative59.1%
Simplified59.1%
Taylor expanded in l around inf 59.1%
if -125 < l < 7.8e10Initial program 75.6%
Taylor expanded in l around 0 95.9%
log1p-expm1-u98.1%
*-commutative98.1%
Applied egg-rr98.1%
Taylor expanded in K around 0 85.3%
associate-*r*85.3%
*-commutative85.3%
Simplified85.3%
Final simplification72.1%
(FPCore (J l K U)
:precision binary64
(if (<= l -125.0)
(+ U (* J (- 27.0 (exp (- l)))))
(if (<= l 78000000000.0)
(+ U (* l (* J 2.0)))
(+ U (* 0.3333333333333333 (* J (pow l 3.0)))))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -125.0) {
tmp = U + (J * (27.0 - exp(-l)));
} else if (l <= 78000000000.0) {
tmp = U + (l * (J * 2.0));
} else {
tmp = U + (0.3333333333333333 * (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) :: tmp
if (l <= (-125.0d0)) then
tmp = u + (j * (27.0d0 - exp(-l)))
else if (l <= 78000000000.0d0) then
tmp = u + (l * (j * 2.0d0))
else
tmp = u + (0.3333333333333333d0 * (j * (l ** 3.0d0)))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (l <= -125.0) {
tmp = U + (J * (27.0 - Math.exp(-l)));
} else if (l <= 78000000000.0) {
tmp = U + (l * (J * 2.0));
} else {
tmp = U + (0.3333333333333333 * (J * Math.pow(l, 3.0)));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -125.0: tmp = U + (J * (27.0 - math.exp(-l))) elif l <= 78000000000.0: tmp = U + (l * (J * 2.0)) else: tmp = U + (0.3333333333333333 * (J * math.pow(l, 3.0))) return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -125.0) tmp = Float64(U + Float64(J * Float64(27.0 - exp(Float64(-l))))); elseif (l <= 78000000000.0) tmp = Float64(U + Float64(l * Float64(J * 2.0))); else tmp = Float64(U + Float64(0.3333333333333333 * Float64(J * (l ^ 3.0)))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -125.0) tmp = U + (J * (27.0 - exp(-l))); elseif (l <= 78000000000.0) tmp = U + (l * (J * 2.0)); else tmp = U + (0.3333333333333333 * (J * (l ^ 3.0))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -125.0], N[(U + N[(J * N[(27.0 - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 78000000000.0], N[(U + N[(l * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(0.3333333333333333 * N[(J * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -125:\\
\;\;\;\;U + J \cdot \left(27 - e^{-\ell}\right)\\
\mathbf{elif}\;\ell \leq 78000000000:\\
\;\;\;\;U + \ell \cdot \left(J \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;U + 0.3333333333333333 \cdot \left(J \cdot {\ell}^{3}\right)\\
\end{array}
\end{array}
if l < -125Initial program 100.0%
Applied egg-rr100.0%
Taylor expanded in K around 0 76.1%
if -125 < l < 7.8e10Initial program 75.6%
Taylor expanded in l around 0 95.9%
log1p-expm1-u98.1%
*-commutative98.1%
Applied egg-rr98.1%
Taylor expanded in K around 0 85.3%
associate-*r*85.3%
*-commutative85.3%
Simplified85.3%
if 7.8e10 < l Initial program 100.0%
Taylor expanded in l around 0 76.8%
Taylor expanded in K around 0 57.4%
associate-*r*54.4%
*-commutative54.4%
distribute-lft-out54.4%
associate-*r*54.4%
associate-*r*57.4%
distribute-lft-out57.4%
fma-define57.4%
associate-*r*57.4%
unpow257.4%
cube-mult57.4%
*-commutative57.4%
Simplified57.4%
Taylor expanded in l around inf 57.4%
Final simplification76.2%
(FPCore (J l K U) :precision binary64 (if (<= l 4e-6) U (* J (- (/ U J) 4.0))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= 4e-6) {
tmp = U;
} else {
tmp = J * ((U / J) - 4.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 <= 4d-6) then
tmp = u
else
tmp = j * ((u / j) - 4.0d0)
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (l <= 4e-6) {
tmp = U;
} else {
tmp = J * ((U / J) - 4.0);
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= 4e-6: tmp = U else: tmp = J * ((U / J) - 4.0) return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= 4e-6) tmp = U; else tmp = Float64(J * Float64(Float64(U / J) - 4.0)); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= 4e-6) tmp = U; else tmp = J * ((U / J) - 4.0); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, 4e-6], U, N[(J * N[(N[(U / J), $MachinePrecision] - 4.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 4 \cdot 10^{-6}:\\
\;\;\;\;U\\
\mathbf{else}:\\
\;\;\;\;J \cdot \left(\frac{U}{J} - 4\right)\\
\end{array}
\end{array}
if l < 3.99999999999999982e-6Initial program 83.7%
Applied egg-rr32.0%
Taylor expanded in J around 0 47.7%
if 3.99999999999999982e-6 < l Initial program 99.6%
Applied egg-rr1.7%
Taylor expanded in K around 0 2.2%
*-commutative2.2%
Simplified2.2%
Taylor expanded in J around inf 9.2%
(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 87.9%
Taylor expanded in l around 0 60.3%
log1p-expm1-u99.1%
*-commutative99.1%
Applied egg-rr99.1%
Taylor expanded in K around 0 51.3%
associate-*r*51.3%
*-commutative51.3%
Simplified51.3%
Final simplification51.3%
(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 87.9%
Applied egg-rr24.1%
Taylor expanded in J around 0 35.9%
herbie shell --seed 2024137
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))