
(FPCore (J l K U) :precision binary64 (+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))
double code(double J, double l, double K, double U) {
return ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = ((j * (exp(l) - exp(-l))) * cos((k / 2.0d0))) + u
end function
public static double code(double J, double l, double K, double U) {
return ((J * (Math.exp(l) - Math.exp(-l))) * Math.cos((K / 2.0))) + U;
}
def code(J, l, K, U): return ((J * (math.exp(l) - math.exp(-l))) * math.cos((K / 2.0))) + U
function code(J, l, K, U) return Float64(Float64(Float64(J * Float64(exp(l) - exp(Float64(-l)))) * cos(Float64(K / 2.0))) + U) end
function tmp = code(J, l, K, U) tmp = ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U; end
code[J_, l_, K_, U_] := N[(N[(N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]
\begin{array}{l}
\\
\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 17 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (J l K U) :precision binary64 (+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))
double code(double J, double l, double K, double U) {
return ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = ((j * (exp(l) - exp(-l))) * cos((k / 2.0d0))) + u
end function
public static double code(double J, double l, double K, double U) {
return ((J * (Math.exp(l) - Math.exp(-l))) * Math.cos((K / 2.0))) + U;
}
def code(J, l, K, U): return ((J * (math.exp(l) - math.exp(-l))) * math.cos((K / 2.0))) + U
function code(J, l, K, U) return Float64(Float64(Float64(J * Float64(exp(l) - exp(Float64(-l)))) * cos(Float64(K / 2.0))) + U) end
function tmp = code(J, l, K, U) tmp = ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U; end
code[J_, l_, K_, U_] := N[(N[(N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]
\begin{array}{l}
\\
\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U
\end{array}
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (- (exp l) (exp (- l)))) (t_1 (cos (/ K 2.0))))
(if (<= t_0 -0.2)
(+ (* t_0 (* J (cos (* 0.5 K)))) U)
(if (<= t_0 0.04)
(+
U
(*
(*
J
(*
l
(+
2.0
(*
(pow l 2.0)
(+
0.3333333333333333
(*
(pow l 2.0)
(+
0.016666666666666666
(* (pow l 2.0) 0.0003968253968253968))))))))
t_1))
(+ U (* t_1 (* t_0 J)))))))
double code(double J, double l, double K, double U) {
double t_0 = exp(l) - exp(-l);
double t_1 = cos((K / 2.0));
double tmp;
if (t_0 <= -0.2) {
tmp = (t_0 * (J * cos((0.5 * K)))) + U;
} else if (t_0 <= 0.04) {
tmp = U + ((J * (l * (2.0 + (pow(l, 2.0) * (0.3333333333333333 + (pow(l, 2.0) * (0.016666666666666666 + (pow(l, 2.0) * 0.0003968253968253968)))))))) * t_1);
} else {
tmp = U + (t_1 * (t_0 * J));
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = exp(l) - exp(-l)
t_1 = cos((k / 2.0d0))
if (t_0 <= (-0.2d0)) then
tmp = (t_0 * (j * cos((0.5d0 * k)))) + u
else if (t_0 <= 0.04d0) then
tmp = u + ((j * (l * (2.0d0 + ((l ** 2.0d0) * (0.3333333333333333d0 + ((l ** 2.0d0) * (0.016666666666666666d0 + ((l ** 2.0d0) * 0.0003968253968253968d0)))))))) * t_1)
else
tmp = u + (t_1 * (t_0 * j))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = Math.exp(l) - Math.exp(-l);
double t_1 = Math.cos((K / 2.0));
double tmp;
if (t_0 <= -0.2) {
tmp = (t_0 * (J * Math.cos((0.5 * K)))) + U;
} else if (t_0 <= 0.04) {
tmp = U + ((J * (l * (2.0 + (Math.pow(l, 2.0) * (0.3333333333333333 + (Math.pow(l, 2.0) * (0.016666666666666666 + (Math.pow(l, 2.0) * 0.0003968253968253968)))))))) * t_1);
} else {
tmp = U + (t_1 * (t_0 * J));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.exp(l) - math.exp(-l) t_1 = math.cos((K / 2.0)) tmp = 0 if t_0 <= -0.2: tmp = (t_0 * (J * math.cos((0.5 * K)))) + U elif t_0 <= 0.04: tmp = U + ((J * (l * (2.0 + (math.pow(l, 2.0) * (0.3333333333333333 + (math.pow(l, 2.0) * (0.016666666666666666 + (math.pow(l, 2.0) * 0.0003968253968253968)))))))) * t_1) else: tmp = U + (t_1 * (t_0 * J)) return tmp
function code(J, l, K, U) t_0 = Float64(exp(l) - exp(Float64(-l))) t_1 = cos(Float64(K / 2.0)) tmp = 0.0 if (t_0 <= -0.2) tmp = Float64(Float64(t_0 * Float64(J * cos(Float64(0.5 * K)))) + U); elseif (t_0 <= 0.04) tmp = Float64(U + Float64(Float64(J * Float64(l * Float64(2.0 + Float64((l ^ 2.0) * Float64(0.3333333333333333 + Float64((l ^ 2.0) * Float64(0.016666666666666666 + Float64((l ^ 2.0) * 0.0003968253968253968)))))))) * t_1)); else tmp = Float64(U + Float64(t_1 * Float64(t_0 * J))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = exp(l) - exp(-l); t_1 = cos((K / 2.0)); tmp = 0.0; if (t_0 <= -0.2) tmp = (t_0 * (J * cos((0.5 * K)))) + U; elseif (t_0 <= 0.04) tmp = U + ((J * (l * (2.0 + ((l ^ 2.0) * (0.3333333333333333 + ((l ^ 2.0) * (0.016666666666666666 + ((l ^ 2.0) * 0.0003968253968253968)))))))) * t_1); else tmp = U + (t_1 * (t_0 * J)); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, -0.2], N[(N[(t$95$0 * N[(J * N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], If[LessEqual[t$95$0, 0.04], N[(U + N[(N[(J * N[(l * N[(2.0 + N[(N[Power[l, 2.0], $MachinePrecision] * N[(0.3333333333333333 + N[(N[Power[l, 2.0], $MachinePrecision] * N[(0.016666666666666666 + N[(N[Power[l, 2.0], $MachinePrecision] * 0.0003968253968253968), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision], N[(U + N[(t$95$1 * N[(t$95$0 * J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{\ell} - e^{-\ell}\\
t_1 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;t\_0 \leq -0.2:\\
\;\;\;\;t\_0 \cdot \left(J \cdot \cos \left(0.5 \cdot K\right)\right) + U\\
\mathbf{elif}\;t\_0 \leq 0.04:\\
\;\;\;\;U + \left(J \cdot \left(\ell \cdot \left(2 + {\ell}^{2} \cdot \left(0.3333333333333333 + {\ell}^{2} \cdot \left(0.016666666666666666 + {\ell}^{2} \cdot 0.0003968253968253968\right)\right)\right)\right)\right) \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;U + t\_1 \cdot \left(t\_0 \cdot J\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -0.20000000000000001Initial program 100.0%
Taylor expanded in J around 0 100.0%
associate-*r*100.0%
*-commutative100.0%
Simplified100.0%
if -0.20000000000000001 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 0.0400000000000000008Initial program 68.3%
Taylor expanded in l around 0 99.9%
*-commutative99.9%
Simplified99.9%
if 0.0400000000000000008 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 100.0%
Final simplification100.0%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (- (exp l) (exp (- l)))) (t_1 (cos (/ K 2.0))))
(if (<= t_0 -0.2)
(+ (* t_0 (* J (cos (* 0.5 K)))) U)
(if (<= t_0 0.04)
(+
U
(*
t_1
(*
l
(+
(* J 2.0)
(*
(pow l 2.0)
(+
(* 0.016666666666666666 (* J (pow l 2.0)))
(* J 0.3333333333333333)))))))
(+ U (* t_1 (* t_0 J)))))))
double code(double J, double l, double K, double U) {
double t_0 = exp(l) - exp(-l);
double t_1 = cos((K / 2.0));
double tmp;
if (t_0 <= -0.2) {
tmp = (t_0 * (J * cos((0.5 * K)))) + U;
} else if (t_0 <= 0.04) {
tmp = U + (t_1 * (l * ((J * 2.0) + (pow(l, 2.0) * ((0.016666666666666666 * (J * pow(l, 2.0))) + (J * 0.3333333333333333))))));
} else {
tmp = U + (t_1 * (t_0 * J));
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = exp(l) - exp(-l)
t_1 = cos((k / 2.0d0))
if (t_0 <= (-0.2d0)) then
tmp = (t_0 * (j * cos((0.5d0 * k)))) + u
else if (t_0 <= 0.04d0) then
tmp = u + (t_1 * (l * ((j * 2.0d0) + ((l ** 2.0d0) * ((0.016666666666666666d0 * (j * (l ** 2.0d0))) + (j * 0.3333333333333333d0))))))
else
tmp = u + (t_1 * (t_0 * j))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = Math.exp(l) - Math.exp(-l);
double t_1 = Math.cos((K / 2.0));
double tmp;
if (t_0 <= -0.2) {
tmp = (t_0 * (J * Math.cos((0.5 * K)))) + U;
} else if (t_0 <= 0.04) {
tmp = U + (t_1 * (l * ((J * 2.0) + (Math.pow(l, 2.0) * ((0.016666666666666666 * (J * Math.pow(l, 2.0))) + (J * 0.3333333333333333))))));
} else {
tmp = U + (t_1 * (t_0 * J));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.exp(l) - math.exp(-l) t_1 = math.cos((K / 2.0)) tmp = 0 if t_0 <= -0.2: tmp = (t_0 * (J * math.cos((0.5 * K)))) + U elif t_0 <= 0.04: tmp = U + (t_1 * (l * ((J * 2.0) + (math.pow(l, 2.0) * ((0.016666666666666666 * (J * math.pow(l, 2.0))) + (J * 0.3333333333333333)))))) else: tmp = U + (t_1 * (t_0 * J)) return tmp
function code(J, l, K, U) t_0 = Float64(exp(l) - exp(Float64(-l))) t_1 = cos(Float64(K / 2.0)) tmp = 0.0 if (t_0 <= -0.2) tmp = Float64(Float64(t_0 * Float64(J * cos(Float64(0.5 * K)))) + U); elseif (t_0 <= 0.04) tmp = Float64(U + Float64(t_1 * Float64(l * Float64(Float64(J * 2.0) + Float64((l ^ 2.0) * Float64(Float64(0.016666666666666666 * Float64(J * (l ^ 2.0))) + Float64(J * 0.3333333333333333))))))); else tmp = Float64(U + Float64(t_1 * Float64(t_0 * J))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = exp(l) - exp(-l); t_1 = cos((K / 2.0)); tmp = 0.0; if (t_0 <= -0.2) tmp = (t_0 * (J * cos((0.5 * K)))) + U; elseif (t_0 <= 0.04) tmp = U + (t_1 * (l * ((J * 2.0) + ((l ^ 2.0) * ((0.016666666666666666 * (J * (l ^ 2.0))) + (J * 0.3333333333333333)))))); else tmp = U + (t_1 * (t_0 * J)); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, -0.2], N[(N[(t$95$0 * N[(J * N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], If[LessEqual[t$95$0, 0.04], 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[Power[l, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(J * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(t$95$1 * N[(t$95$0 * J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{\ell} - e^{-\ell}\\
t_1 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;t\_0 \leq -0.2:\\
\;\;\;\;t\_0 \cdot \left(J \cdot \cos \left(0.5 \cdot K\right)\right) + U\\
\mathbf{elif}\;t\_0 \leq 0.04:\\
\;\;\;\;U + t\_1 \cdot \left(\ell \cdot \left(J \cdot 2 + {\ell}^{2} \cdot \left(0.016666666666666666 \cdot \left(J \cdot {\ell}^{2}\right) + J \cdot 0.3333333333333333\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + t\_1 \cdot \left(t\_0 \cdot J\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -0.20000000000000001Initial program 100.0%
Taylor expanded in J around 0 100.0%
associate-*r*100.0%
*-commutative100.0%
Simplified100.0%
if -0.20000000000000001 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 0.0400000000000000008Initial program 68.3%
Taylor expanded in l around 0 99.9%
if 0.0400000000000000008 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 100.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 -0.2) (not (<= t_1 0.04)))
(+ U (* t_0 (* t_1 J)))
(+
U
(*
t_0
(*
J
(*
l
(+
2.0
(*
(pow l 2.0)
(+ 0.3333333333333333 (* 0.016666666666666666 (* l l))))))))))))
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 <= -0.2) || !(t_1 <= 0.04)) {
tmp = U + (t_0 * (t_1 * J));
} else {
tmp = U + (t_0 * (J * (l * (2.0 + (pow(l, 2.0) * (0.3333333333333333 + (0.016666666666666666 * (l * 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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = cos((k / 2.0d0))
t_1 = exp(l) - exp(-l)
if ((t_1 <= (-0.2d0)) .or. (.not. (t_1 <= 0.04d0))) then
tmp = u + (t_0 * (t_1 * j))
else
tmp = u + (t_0 * (j * (l * (2.0d0 + ((l ** 2.0d0) * (0.3333333333333333d0 + (0.016666666666666666d0 * (l * l))))))))
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 t_1 = Math.exp(l) - Math.exp(-l);
double tmp;
if ((t_1 <= -0.2) || !(t_1 <= 0.04)) {
tmp = U + (t_0 * (t_1 * J));
} else {
tmp = U + (t_0 * (J * (l * (2.0 + (Math.pow(l, 2.0) * (0.3333333333333333 + (0.016666666666666666 * (l * l))))))));
}
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 <= -0.2) or not (t_1 <= 0.04): tmp = U + (t_0 * (t_1 * J)) else: tmp = U + (t_0 * (J * (l * (2.0 + (math.pow(l, 2.0) * (0.3333333333333333 + (0.016666666666666666 * (l * l)))))))) 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 <= -0.2) || !(t_1 <= 0.04)) tmp = Float64(U + Float64(t_0 * Float64(t_1 * J))); else tmp = Float64(U + Float64(t_0 * Float64(J * Float64(l * Float64(2.0 + Float64((l ^ 2.0) * Float64(0.3333333333333333 + Float64(0.016666666666666666 * Float64(l * l))))))))); 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 <= -0.2) || ~((t_1 <= 0.04))) tmp = U + (t_0 * (t_1 * J)); else tmp = U + (t_0 * (J * (l * (2.0 + ((l ^ 2.0) * (0.3333333333333333 + (0.016666666666666666 * (l * l)))))))); 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, -0.2], N[Not[LessEqual[t$95$1, 0.04]], $MachinePrecision]], N[(U + N[(t$95$0 * N[(t$95$1 * J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(t$95$0 * N[(J * N[(l * N[(2.0 + N[(N[Power[l, 2.0], $MachinePrecision] * N[(0.3333333333333333 + N[(0.016666666666666666 * N[(l * l), $MachinePrecision]), $MachinePrecision]), $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 -0.2 \lor \neg \left(t\_1 \leq 0.04\right):\\
\;\;\;\;U + t\_0 \cdot \left(t\_1 \cdot J\right)\\
\mathbf{else}:\\
\;\;\;\;U + t\_0 \cdot \left(J \cdot \left(\ell \cdot \left(2 + {\ell}^{2} \cdot \left(0.3333333333333333 + 0.016666666666666666 \cdot \left(\ell \cdot \ell\right)\right)\right)\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -0.20000000000000001 or 0.0400000000000000008 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 100.0%
if -0.20000000000000001 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 0.0400000000000000008Initial program 68.3%
Taylor expanded in l around 0 99.9%
*-commutative99.9%
Simplified99.9%
unpow299.9%
Applied egg-rr99.9%
Final simplification100.0%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (- (exp l) (exp (- l)))) (t_1 (cos (/ K 2.0))))
(if (<= t_0 -0.2)
(+ (* t_0 (* J (cos (* 0.5 K)))) U)
(if (<= t_0 0.04)
(+
U
(*
t_1
(*
J
(*
l
(+
2.0
(*
(pow l 2.0)
(+ 0.3333333333333333 (* 0.016666666666666666 (* l l)))))))))
(+ U (* t_1 (* t_0 J)))))))
double code(double J, double l, double K, double U) {
double t_0 = exp(l) - exp(-l);
double t_1 = cos((K / 2.0));
double tmp;
if (t_0 <= -0.2) {
tmp = (t_0 * (J * cos((0.5 * K)))) + U;
} else if (t_0 <= 0.04) {
tmp = U + (t_1 * (J * (l * (2.0 + (pow(l, 2.0) * (0.3333333333333333 + (0.016666666666666666 * (l * l))))))));
} else {
tmp = U + (t_1 * (t_0 * J));
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = exp(l) - exp(-l)
t_1 = cos((k / 2.0d0))
if (t_0 <= (-0.2d0)) then
tmp = (t_0 * (j * cos((0.5d0 * k)))) + u
else if (t_0 <= 0.04d0) then
tmp = u + (t_1 * (j * (l * (2.0d0 + ((l ** 2.0d0) * (0.3333333333333333d0 + (0.016666666666666666d0 * (l * l))))))))
else
tmp = u + (t_1 * (t_0 * j))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = Math.exp(l) - Math.exp(-l);
double t_1 = Math.cos((K / 2.0));
double tmp;
if (t_0 <= -0.2) {
tmp = (t_0 * (J * Math.cos((0.5 * K)))) + U;
} else if (t_0 <= 0.04) {
tmp = U + (t_1 * (J * (l * (2.0 + (Math.pow(l, 2.0) * (0.3333333333333333 + (0.016666666666666666 * (l * l))))))));
} else {
tmp = U + (t_1 * (t_0 * J));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.exp(l) - math.exp(-l) t_1 = math.cos((K / 2.0)) tmp = 0 if t_0 <= -0.2: tmp = (t_0 * (J * math.cos((0.5 * K)))) + U elif t_0 <= 0.04: tmp = U + (t_1 * (J * (l * (2.0 + (math.pow(l, 2.0) * (0.3333333333333333 + (0.016666666666666666 * (l * l)))))))) else: tmp = U + (t_1 * (t_0 * J)) return tmp
function code(J, l, K, U) t_0 = Float64(exp(l) - exp(Float64(-l))) t_1 = cos(Float64(K / 2.0)) tmp = 0.0 if (t_0 <= -0.2) tmp = Float64(Float64(t_0 * Float64(J * cos(Float64(0.5 * K)))) + U); elseif (t_0 <= 0.04) tmp = Float64(U + Float64(t_1 * Float64(J * Float64(l * Float64(2.0 + Float64((l ^ 2.0) * Float64(0.3333333333333333 + Float64(0.016666666666666666 * Float64(l * l))))))))); else tmp = Float64(U + Float64(t_1 * Float64(t_0 * J))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = exp(l) - exp(-l); t_1 = cos((K / 2.0)); tmp = 0.0; if (t_0 <= -0.2) tmp = (t_0 * (J * cos((0.5 * K)))) + U; elseif (t_0 <= 0.04) tmp = U + (t_1 * (J * (l * (2.0 + ((l ^ 2.0) * (0.3333333333333333 + (0.016666666666666666 * (l * l)))))))); else tmp = U + (t_1 * (t_0 * J)); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, -0.2], N[(N[(t$95$0 * N[(J * N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], If[LessEqual[t$95$0, 0.04], N[(U + N[(t$95$1 * N[(J * N[(l * N[(2.0 + N[(N[Power[l, 2.0], $MachinePrecision] * N[(0.3333333333333333 + N[(0.016666666666666666 * N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(t$95$1 * N[(t$95$0 * J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{\ell} - e^{-\ell}\\
t_1 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;t\_0 \leq -0.2:\\
\;\;\;\;t\_0 \cdot \left(J \cdot \cos \left(0.5 \cdot K\right)\right) + U\\
\mathbf{elif}\;t\_0 \leq 0.04:\\
\;\;\;\;U + t\_1 \cdot \left(J \cdot \left(\ell \cdot \left(2 + {\ell}^{2} \cdot \left(0.3333333333333333 + 0.016666666666666666 \cdot \left(\ell \cdot \ell\right)\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + t\_1 \cdot \left(t\_0 \cdot J\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -0.20000000000000001Initial program 100.0%
Taylor expanded in J around 0 100.0%
associate-*r*100.0%
*-commutative100.0%
Simplified100.0%
if -0.20000000000000001 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 0.0400000000000000008Initial program 68.3%
Taylor expanded in l around 0 99.9%
*-commutative99.9%
Simplified99.9%
unpow299.9%
Applied egg-rr99.9%
if 0.0400000000000000008 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 100.0%
Final simplification100.0%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (* (- (exp l) (exp (- l))) J)))
(if (or (<= t_0 -5e-48) (not (<= t_0 2e+210)))
(+ U t_0)
(+ U (* 2.0 (* J (* l (cos (* 0.5 K)))))))))
double code(double J, double l, double K, double U) {
double t_0 = (exp(l) - exp(-l)) * J;
double tmp;
if ((t_0 <= -5e-48) || !(t_0 <= 2e+210)) {
tmp = U + t_0;
} else {
tmp = U + (2.0 * (J * (l * cos((0.5 * K)))));
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: t_0
real(8) :: tmp
t_0 = (exp(l) - exp(-l)) * j
if ((t_0 <= (-5d-48)) .or. (.not. (t_0 <= 2d+210))) then
tmp = u + t_0
else
tmp = u + (2.0d0 * (j * (l * cos((0.5d0 * k)))))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = (Math.exp(l) - Math.exp(-l)) * J;
double tmp;
if ((t_0 <= -5e-48) || !(t_0 <= 2e+210)) {
tmp = U + t_0;
} else {
tmp = U + (2.0 * (J * (l * Math.cos((0.5 * K)))));
}
return tmp;
}
def code(J, l, K, U): t_0 = (math.exp(l) - math.exp(-l)) * J tmp = 0 if (t_0 <= -5e-48) or not (t_0 <= 2e+210): tmp = U + t_0 else: tmp = U + (2.0 * (J * (l * math.cos((0.5 * K))))) return tmp
function code(J, l, K, U) t_0 = Float64(Float64(exp(l) - exp(Float64(-l))) * J) tmp = 0.0 if ((t_0 <= -5e-48) || !(t_0 <= 2e+210)) tmp = Float64(U + t_0); else tmp = Float64(U + Float64(2.0 * Float64(J * Float64(l * cos(Float64(0.5 * K)))))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = (exp(l) - exp(-l)) * J; tmp = 0.0; if ((t_0 <= -5e-48) || ~((t_0 <= 2e+210))) tmp = U + t_0; else tmp = U + (2.0 * (J * (l * cos((0.5 * K))))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision]}, If[Or[LessEqual[t$95$0, -5e-48], N[Not[LessEqual[t$95$0, 2e+210]], $MachinePrecision]], N[(U + t$95$0), $MachinePrecision], N[(U + N[(2.0 * N[(J * N[(l * N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(e^{\ell} - e^{-\ell}\right) \cdot J\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{-48} \lor \neg \left(t\_0 \leq 2 \cdot 10^{+210}\right):\\
\;\;\;\;U + t\_0\\
\mathbf{else}:\\
\;\;\;\;U + 2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(0.5 \cdot K\right)\right)\right)\\
\end{array}
\end{array}
if (*.f64 J (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l)))) < -4.9999999999999999e-48 or 1.99999999999999985e210 < (*.f64 J (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l)))) Initial program 99.8%
Taylor expanded in K around 0 78.7%
if -4.9999999999999999e-48 < (*.f64 J (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l)))) < 1.99999999999999985e210Initial program 68.5%
Taylor expanded in l around 0 99.4%
Final simplification88.7%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (exp (- l))) (t_1 (- (exp l) t_0)))
(if (<= t_1 (- INFINITY))
(+ U (* (cos (/ K 2.0)) (* J (- 27.0 t_0))))
(if (<= t_1 5e-16)
(+ U (* 2.0 (* J (* l (cos (* 0.5 K))))))
(+ U (* t_1 J))))))
double code(double J, double l, double K, double U) {
double t_0 = exp(-l);
double t_1 = exp(l) - t_0;
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = U + (cos((K / 2.0)) * (J * (27.0 - t_0)));
} else if (t_1 <= 5e-16) {
tmp = U + (2.0 * (J * (l * cos((0.5 * K)))));
} else {
tmp = U + (t_1 * J);
}
return tmp;
}
public static double code(double J, double l, double K, double U) {
double t_0 = Math.exp(-l);
double t_1 = Math.exp(l) - t_0;
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = U + (Math.cos((K / 2.0)) * (J * (27.0 - t_0)));
} else if (t_1 <= 5e-16) {
tmp = U + (2.0 * (J * (l * Math.cos((0.5 * K)))));
} else {
tmp = U + (t_1 * J);
}
return tmp;
}
def code(J, l, K, U): t_0 = math.exp(-l) t_1 = math.exp(l) - t_0 tmp = 0 if t_1 <= -math.inf: tmp = U + (math.cos((K / 2.0)) * (J * (27.0 - t_0))) elif t_1 <= 5e-16: tmp = U + (2.0 * (J * (l * math.cos((0.5 * K))))) else: tmp = U + (t_1 * J) return tmp
function code(J, l, K, U) t_0 = exp(Float64(-l)) t_1 = Float64(exp(l) - t_0) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(J * Float64(27.0 - t_0)))); elseif (t_1 <= 5e-16) tmp = Float64(U + Float64(2.0 * Float64(J * Float64(l * cos(Float64(0.5 * K)))))); else tmp = Float64(U + Float64(t_1 * J)); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = exp(-l); t_1 = exp(l) - t_0; tmp = 0.0; if (t_1 <= -Inf) tmp = U + (cos((K / 2.0)) * (J * (27.0 - t_0))); elseif (t_1 <= 5e-16) tmp = U + (2.0 * (J * (l * cos((0.5 * K))))); else tmp = U + (t_1 * J); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Exp[(-l)], $MachinePrecision]}, Block[{t$95$1 = N[(N[Exp[l], $MachinePrecision] - t$95$0), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(J * N[(27.0 - t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e-16], N[(U + N[(2.0 * N[(J * N[(l * N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(t$95$1 * J), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-\ell}\\
t_1 := e^{\ell} - t\_0\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;U + \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(27 - t\_0\right)\right)\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{-16}:\\
\;\;\;\;U + 2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(0.5 \cdot K\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + t\_1 \cdot J\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -inf.0Initial program 100.0%
Applied egg-rr100.0%
if -inf.0 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 5.0000000000000004e-16Initial program 67.8%
Taylor expanded in l around 0 99.2%
if 5.0000000000000004e-16 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 99.9%
Taylor expanded in K around 0 83.5%
Final simplification95.7%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))) (t_1 (exp (- l))))
(if (<= (- (exp l) t_1) (- INFINITY))
(+ U (* t_0 (* J (- 27.0 t_1))))
(+
U
(*
t_0
(*
J
(*
l
(+
2.0
(*
(pow l 2.0)
(+ 0.3333333333333333 (* 0.016666666666666666 (* l l))))))))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double t_1 = exp(-l);
double tmp;
if ((exp(l) - t_1) <= -((double) INFINITY)) {
tmp = U + (t_0 * (J * (27.0 - t_1)));
} else {
tmp = U + (t_0 * (J * (l * (2.0 + (pow(l, 2.0) * (0.3333333333333333 + (0.016666666666666666 * (l * l))))))));
}
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);
double tmp;
if ((Math.exp(l) - t_1) <= -Double.POSITIVE_INFINITY) {
tmp = U + (t_0 * (J * (27.0 - t_1)));
} else {
tmp = U + (t_0 * (J * (l * (2.0 + (Math.pow(l, 2.0) * (0.3333333333333333 + (0.016666666666666666 * (l * l))))))));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K / 2.0)) t_1 = math.exp(-l) tmp = 0 if (math.exp(l) - t_1) <= -math.inf: tmp = U + (t_0 * (J * (27.0 - t_1))) else: tmp = U + (t_0 * (J * (l * (2.0 + (math.pow(l, 2.0) * (0.3333333333333333 + (0.016666666666666666 * (l * l)))))))) return tmp
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) t_1 = exp(Float64(-l)) tmp = 0.0 if (Float64(exp(l) - t_1) <= Float64(-Inf)) tmp = Float64(U + Float64(t_0 * Float64(J * Float64(27.0 - t_1)))); else tmp = Float64(U + Float64(t_0 * Float64(J * Float64(l * Float64(2.0 + Float64((l ^ 2.0) * Float64(0.3333333333333333 + Float64(0.016666666666666666 * Float64(l * l))))))))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = cos((K / 2.0)); t_1 = exp(-l); tmp = 0.0; if ((exp(l) - t_1) <= -Inf) tmp = U + (t_0 * (J * (27.0 - t_1))); else tmp = U + (t_0 * (J * (l * (2.0 + ((l ^ 2.0) * (0.3333333333333333 + (0.016666666666666666 * (l * l)))))))); 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[Exp[(-l)], $MachinePrecision]}, If[LessEqual[N[(N[Exp[l], $MachinePrecision] - t$95$1), $MachinePrecision], (-Infinity)], N[(U + N[(t$95$0 * N[(J * N[(27.0 - t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(t$95$0 * N[(J * N[(l * N[(2.0 + N[(N[Power[l, 2.0], $MachinePrecision] * N[(0.3333333333333333 + N[(0.016666666666666666 * N[(l * l), $MachinePrecision]), $MachinePrecision]), $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}\\
\mathbf{if}\;e^{\ell} - t\_1 \leq -\infty:\\
\;\;\;\;U + t\_0 \cdot \left(J \cdot \left(27 - t\_1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + t\_0 \cdot \left(J \cdot \left(\ell \cdot \left(2 + {\ell}^{2} \cdot \left(0.3333333333333333 + 0.016666666666666666 \cdot \left(\ell \cdot \ell\right)\right)\right)\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -inf.0Initial program 100.0%
Applied egg-rr100.0%
if -inf.0 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 78.5%
Taylor expanded in l around 0 96.1%
*-commutative96.1%
Simplified96.1%
unpow296.1%
Applied egg-rr96.1%
Final simplification97.2%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))) (t_1 (exp (- l))))
(if (<= (- (exp l) t_1) (- INFINITY))
(+ U (* t_0 (* J (- 27.0 t_1))))
(+ U (* t_0 (* 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 t_1 = exp(-l);
double tmp;
if ((exp(l) - t_1) <= -((double) INFINITY)) {
tmp = U + (t_0 * (J * (27.0 - t_1)));
} else {
tmp = U + (t_0 * (J * (l * (2.0 + (pow(l, 2.0) * 0.3333333333333333)))));
}
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);
double tmp;
if ((Math.exp(l) - t_1) <= -Double.POSITIVE_INFINITY) {
tmp = U + (t_0 * (J * (27.0 - t_1)));
} else {
tmp = U + (t_0 * (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)) t_1 = math.exp(-l) tmp = 0 if (math.exp(l) - t_1) <= -math.inf: tmp = U + (t_0 * (J * (27.0 - t_1))) else: tmp = U + (t_0 * (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)) t_1 = exp(Float64(-l)) tmp = 0.0 if (Float64(exp(l) - t_1) <= Float64(-Inf)) tmp = Float64(U + Float64(t_0 * Float64(J * Float64(27.0 - t_1)))); else tmp = Float64(U + Float64(t_0 * 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)); t_1 = exp(-l); tmp = 0.0; if ((exp(l) - t_1) <= -Inf) tmp = U + (t_0 * (J * (27.0 - t_1))); else tmp = U + (t_0 * (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]}, Block[{t$95$1 = N[Exp[(-l)], $MachinePrecision]}, If[LessEqual[N[(N[Exp[l], $MachinePrecision] - t$95$1), $MachinePrecision], (-Infinity)], N[(U + N[(t$95$0 * N[(J * N[(27.0 - t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(t$95$0 * N[(J * N[(l * N[(2.0 + N[(N[Power[l, 2.0], $MachinePrecision] * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
t_1 := e^{-\ell}\\
\mathbf{if}\;e^{\ell} - t\_1 \leq -\infty:\\
\;\;\;\;U + t\_0 \cdot \left(J \cdot \left(27 - t\_1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + t\_0 \cdot \left(J \cdot \left(\ell \cdot \left(2 + {\ell}^{2} \cdot 0.3333333333333333\right)\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -inf.0Initial program 100.0%
Applied egg-rr100.0%
if -inf.0 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 78.5%
Taylor expanded in l around 0 93.2%
Final simplification95.2%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (* J (* l (cos (* 0.5 K)))))
(t_1 (* U (+ 1.0 (* 2.0 (/ t_0 U))))))
(if (<= l -4.8e+159)
t_1
(if (<= l -8.8e+90)
(+ U (+ (* -0.25 (* J (* l (* K K)))) (* 2.0 (* l J))))
(if (<= l -95000000.0)
(log1p (expm1 (* U -3.0)))
(if (<= l 1.4e-15) (+ U (* 2.0 t_0)) t_1))))))
double code(double J, double l, double K, double U) {
double t_0 = J * (l * cos((0.5 * K)));
double t_1 = U * (1.0 + (2.0 * (t_0 / U)));
double tmp;
if (l <= -4.8e+159) {
tmp = t_1;
} else if (l <= -8.8e+90) {
tmp = U + ((-0.25 * (J * (l * (K * K)))) + (2.0 * (l * J)));
} else if (l <= -95000000.0) {
tmp = log1p(expm1((U * -3.0)));
} else if (l <= 1.4e-15) {
tmp = U + (2.0 * t_0);
} else {
tmp = t_1;
}
return tmp;
}
public static double code(double J, double l, double K, double U) {
double t_0 = J * (l * Math.cos((0.5 * K)));
double t_1 = U * (1.0 + (2.0 * (t_0 / U)));
double tmp;
if (l <= -4.8e+159) {
tmp = t_1;
} else if (l <= -8.8e+90) {
tmp = U + ((-0.25 * (J * (l * (K * K)))) + (2.0 * (l * J)));
} else if (l <= -95000000.0) {
tmp = Math.log1p(Math.expm1((U * -3.0)));
} else if (l <= 1.4e-15) {
tmp = U + (2.0 * t_0);
} else {
tmp = t_1;
}
return tmp;
}
def code(J, l, K, U): t_0 = J * (l * math.cos((0.5 * K))) t_1 = U * (1.0 + (2.0 * (t_0 / U))) tmp = 0 if l <= -4.8e+159: tmp = t_1 elif l <= -8.8e+90: tmp = U + ((-0.25 * (J * (l * (K * K)))) + (2.0 * (l * J))) elif l <= -95000000.0: tmp = math.log1p(math.expm1((U * -3.0))) elif l <= 1.4e-15: tmp = U + (2.0 * t_0) else: tmp = t_1 return tmp
function code(J, l, K, U) t_0 = Float64(J * Float64(l * cos(Float64(0.5 * K)))) t_1 = Float64(U * Float64(1.0 + Float64(2.0 * Float64(t_0 / U)))) tmp = 0.0 if (l <= -4.8e+159) tmp = t_1; elseif (l <= -8.8e+90) tmp = Float64(U + Float64(Float64(-0.25 * Float64(J * Float64(l * Float64(K * K)))) + Float64(2.0 * Float64(l * J)))); elseif (l <= -95000000.0) tmp = log1p(expm1(Float64(U * -3.0))); elseif (l <= 1.4e-15) tmp = Float64(U + Float64(2.0 * t_0)); else tmp = t_1; end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(J * N[(l * N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(U * N[(1.0 + N[(2.0 * N[(t$95$0 / U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -4.8e+159], t$95$1, If[LessEqual[l, -8.8e+90], N[(U + N[(N[(-0.25 * N[(J * N[(l * N[(K * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(2.0 * N[(l * J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -95000000.0], N[Log[1 + N[(Exp[N[(U * -3.0), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision], If[LessEqual[l, 1.4e-15], N[(U + N[(2.0 * t$95$0), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := J \cdot \left(\ell \cdot \cos \left(0.5 \cdot K\right)\right)\\
t_1 := U \cdot \left(1 + 2 \cdot \frac{t\_0}{U}\right)\\
\mathbf{if}\;\ell \leq -4.8 \cdot 10^{+159}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\ell \leq -8.8 \cdot 10^{+90}:\\
\;\;\;\;U + \left(-0.25 \cdot \left(J \cdot \left(\ell \cdot \left(K \cdot K\right)\right)\right) + 2 \cdot \left(\ell \cdot J\right)\right)\\
\mathbf{elif}\;\ell \leq -95000000:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(U \cdot -3\right)\right)\\
\mathbf{elif}\;\ell \leq 1.4 \cdot 10^{-15}:\\
\;\;\;\;U + 2 \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if l < -4.8e159 or 1.40000000000000007e-15 < l Initial program 99.9%
Taylor expanded in l around 0 94.0%
*-commutative94.0%
Simplified94.0%
Taylor expanded in l around 0 40.4%
*-commutative40.4%
associate-*r*40.4%
Simplified40.4%
pow140.4%
associate-*l*40.4%
associate-*l*40.4%
div-inv40.4%
metadata-eval40.4%
Applied egg-rr40.4%
unpow140.4%
*-commutative40.4%
Simplified40.4%
Taylor expanded in U around inf 52.3%
if -4.8e159 < l < -8.79999999999999961e90Initial program 100.0%
Taylor expanded in l around 0 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in l around 0 12.8%
*-commutative12.8%
associate-*r*12.8%
Simplified12.8%
Taylor expanded in K around 0 56.4%
unpow256.4%
Applied egg-rr56.4%
if -8.79999999999999961e90 < l < -9.5e7Initial program 100.0%
associate-*l*100.0%
fma-define100.0%
Simplified100.0%
Applied egg-rr4.1%
*-rgt-identity4.1%
distribute-lft-out4.1%
metadata-eval4.1%
Simplified4.1%
log1p-expm1-u47.9%
Applied egg-rr47.9%
if -9.5e7 < l < 1.40000000000000007e-15Initial program 68.8%
Taylor expanded in l around 0 96.1%
Final simplification73.7%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.472) (+ U (* J (* l (* -0.25 (pow K 2.0))))) (+ U (* l (* J 2.0)))))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.472) {
tmp = U + (J * (l * (-0.25 * pow(K, 2.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 (cos((k / 2.0d0)) <= (-0.472d0)) then
tmp = u + (j * (l * ((-0.25d0) * (k ** 2.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 (Math.cos((K / 2.0)) <= -0.472) {
tmp = U + (J * (l * (-0.25 * Math.pow(K, 2.0))));
} else {
tmp = U + (l * (J * 2.0));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if math.cos((K / 2.0)) <= -0.472: tmp = U + (J * (l * (-0.25 * math.pow(K, 2.0)))) else: tmp = U + (l * (J * 2.0)) return tmp
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.472) tmp = Float64(U + Float64(J * Float64(l * Float64(-0.25 * (K ^ 2.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 (cos((K / 2.0)) <= -0.472) tmp = U + (J * (l * (-0.25 * (K ^ 2.0)))); else tmp = U + (l * (J * 2.0)); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.472], N[(U + N[(J * N[(l * N[(-0.25 * N[Power[K, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(l * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.472:\\
\;\;\;\;U + J \cdot \left(\ell \cdot \left(-0.25 \cdot {K}^{2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + \ell \cdot \left(J \cdot 2\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.47199999999999998Initial program 83.4%
Taylor expanded in l around 0 95.1%
*-commutative95.1%
Simplified95.1%
Taylor expanded in l around 0 52.2%
*-commutative52.2%
associate-*r*52.2%
Simplified52.2%
Taylor expanded in K around 0 46.4%
Taylor expanded in K around inf 56.4%
*-commutative56.4%
*-commutative56.4%
associate-*l*56.4%
*-commutative56.4%
*-commutative56.4%
associate-*r*56.4%
*-commutative56.4%
*-commutative56.4%
Simplified56.4%
if -0.47199999999999998 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 85.0%
Taylor expanded in l around 0 94.6%
*-commutative94.6%
Simplified94.6%
Taylor expanded in l around 0 65.5%
*-commutative65.5%
associate-*r*65.5%
Simplified65.5%
pow165.5%
associate-*l*65.5%
associate-*l*65.5%
div-inv65.5%
metadata-eval65.5%
Applied egg-rr65.5%
unpow165.5%
*-commutative65.5%
Simplified65.5%
Taylor expanded in K around 0 59.4%
+-commutative59.4%
associate-*r*59.4%
*-commutative59.4%
*-commutative59.4%
Simplified59.4%
Final simplification59.0%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (* J (* l (cos (* 0.5 K)))))
(t_1 (* U (+ 1.0 (* 2.0 (/ t_0 U))))))
(if (<= l -4.8e+159)
t_1
(if (<= l -2.45e+101)
(+ U (+ (* -0.25 (* J (* l (* K K)))) (* 2.0 (* l J))))
(if (<= l -92000.0)
(log1p
(*
U
(+
1.0
(*
U
(+
0.5
(* U (+ 0.16666666666666666 (* U 0.041666666666666664))))))))
(if (<= l 1.4e-15) (+ U (* 2.0 t_0)) t_1))))))
double code(double J, double l, double K, double U) {
double t_0 = J * (l * cos((0.5 * K)));
double t_1 = U * (1.0 + (2.0 * (t_0 / U)));
double tmp;
if (l <= -4.8e+159) {
tmp = t_1;
} else if (l <= -2.45e+101) {
tmp = U + ((-0.25 * (J * (l * (K * K)))) + (2.0 * (l * J)));
} else if (l <= -92000.0) {
tmp = log1p((U * (1.0 + (U * (0.5 + (U * (0.16666666666666666 + (U * 0.041666666666666664))))))));
} else if (l <= 1.4e-15) {
tmp = U + (2.0 * t_0);
} else {
tmp = t_1;
}
return tmp;
}
public static double code(double J, double l, double K, double U) {
double t_0 = J * (l * Math.cos((0.5 * K)));
double t_1 = U * (1.0 + (2.0 * (t_0 / U)));
double tmp;
if (l <= -4.8e+159) {
tmp = t_1;
} else if (l <= -2.45e+101) {
tmp = U + ((-0.25 * (J * (l * (K * K)))) + (2.0 * (l * J)));
} else if (l <= -92000.0) {
tmp = Math.log1p((U * (1.0 + (U * (0.5 + (U * (0.16666666666666666 + (U * 0.041666666666666664))))))));
} else if (l <= 1.4e-15) {
tmp = U + (2.0 * t_0);
} else {
tmp = t_1;
}
return tmp;
}
def code(J, l, K, U): t_0 = J * (l * math.cos((0.5 * K))) t_1 = U * (1.0 + (2.0 * (t_0 / U))) tmp = 0 if l <= -4.8e+159: tmp = t_1 elif l <= -2.45e+101: tmp = U + ((-0.25 * (J * (l * (K * K)))) + (2.0 * (l * J))) elif l <= -92000.0: tmp = math.log1p((U * (1.0 + (U * (0.5 + (U * (0.16666666666666666 + (U * 0.041666666666666664)))))))) elif l <= 1.4e-15: tmp = U + (2.0 * t_0) else: tmp = t_1 return tmp
function code(J, l, K, U) t_0 = Float64(J * Float64(l * cos(Float64(0.5 * K)))) t_1 = Float64(U * Float64(1.0 + Float64(2.0 * Float64(t_0 / U)))) tmp = 0.0 if (l <= -4.8e+159) tmp = t_1; elseif (l <= -2.45e+101) tmp = Float64(U + Float64(Float64(-0.25 * Float64(J * Float64(l * Float64(K * K)))) + Float64(2.0 * Float64(l * J)))); elseif (l <= -92000.0) tmp = log1p(Float64(U * Float64(1.0 + Float64(U * Float64(0.5 + Float64(U * Float64(0.16666666666666666 + Float64(U * 0.041666666666666664)))))))); elseif (l <= 1.4e-15) tmp = Float64(U + Float64(2.0 * t_0)); else tmp = t_1; end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(J * N[(l * N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(U * N[(1.0 + N[(2.0 * N[(t$95$0 / U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -4.8e+159], t$95$1, If[LessEqual[l, -2.45e+101], N[(U + N[(N[(-0.25 * N[(J * N[(l * N[(K * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(2.0 * N[(l * J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -92000.0], N[Log[1 + N[(U * N[(1.0 + N[(U * N[(0.5 + N[(U * N[(0.16666666666666666 + N[(U * 0.041666666666666664), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[l, 1.4e-15], N[(U + N[(2.0 * t$95$0), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := J \cdot \left(\ell \cdot \cos \left(0.5 \cdot K\right)\right)\\
t_1 := U \cdot \left(1 + 2 \cdot \frac{t\_0}{U}\right)\\
\mathbf{if}\;\ell \leq -4.8 \cdot 10^{+159}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\ell \leq -2.45 \cdot 10^{+101}:\\
\;\;\;\;U + \left(-0.25 \cdot \left(J \cdot \left(\ell \cdot \left(K \cdot K\right)\right)\right) + 2 \cdot \left(\ell \cdot J\right)\right)\\
\mathbf{elif}\;\ell \leq -92000:\\
\;\;\;\;\mathsf{log1p}\left(U \cdot \left(1 + U \cdot \left(0.5 + U \cdot \left(0.16666666666666666 + U \cdot 0.041666666666666664\right)\right)\right)\right)\\
\mathbf{elif}\;\ell \leq 1.4 \cdot 10^{-15}:\\
\;\;\;\;U + 2 \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if l < -4.8e159 or 1.40000000000000007e-15 < l Initial program 99.9%
Taylor expanded in l around 0 94.0%
*-commutative94.0%
Simplified94.0%
Taylor expanded in l around 0 40.4%
*-commutative40.4%
associate-*r*40.4%
Simplified40.4%
pow140.4%
associate-*l*40.4%
associate-*l*40.4%
div-inv40.4%
metadata-eval40.4%
Applied egg-rr40.4%
unpow140.4%
*-commutative40.4%
Simplified40.4%
Taylor expanded in U around inf 52.3%
if -4.8e159 < l < -2.44999999999999991e101Initial program 100.0%
Taylor expanded in l around 0 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in l around 0 12.8%
*-commutative12.8%
associate-*r*12.8%
Simplified12.8%
Taylor expanded in K around 0 56.4%
unpow256.4%
Applied egg-rr56.4%
if -2.44999999999999991e101 < l < -92000Initial program 100.0%
associate-*l*100.0%
fma-define100.0%
Simplified100.0%
Applied egg-rr26.6%
Taylor expanded in U around 0 42.5%
*-commutative42.5%
Simplified42.5%
if -92000 < l < 1.40000000000000007e-15Initial program 68.3%
Taylor expanded in l around 0 97.6%
Final simplification73.7%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (+ U (* 2.0 (* J (* l (cos (* 0.5 K))))))))
(if (<= l -2.3e+216)
t_0
(if (<= l -5e+90)
(+ U (+ (* -0.25 (* J (* l (* K K)))) (* 2.0 (* l J))))
(if (<= l -620000.0)
(log1p
(*
U
(+
1.0
(*
U
(+
0.5
(* U (+ 0.16666666666666666 (* U 0.041666666666666664))))))))
t_0)))))
double code(double J, double l, double K, double U) {
double t_0 = U + (2.0 * (J * (l * cos((0.5 * K)))));
double tmp;
if (l <= -2.3e+216) {
tmp = t_0;
} else if (l <= -5e+90) {
tmp = U + ((-0.25 * (J * (l * (K * K)))) + (2.0 * (l * J)));
} else if (l <= -620000.0) {
tmp = log1p((U * (1.0 + (U * (0.5 + (U * (0.16666666666666666 + (U * 0.041666666666666664))))))));
} else {
tmp = t_0;
}
return tmp;
}
public static double code(double J, double l, double K, double U) {
double t_0 = U + (2.0 * (J * (l * Math.cos((0.5 * K)))));
double tmp;
if (l <= -2.3e+216) {
tmp = t_0;
} else if (l <= -5e+90) {
tmp = U + ((-0.25 * (J * (l * (K * K)))) + (2.0 * (l * J)));
} else if (l <= -620000.0) {
tmp = Math.log1p((U * (1.0 + (U * (0.5 + (U * (0.16666666666666666 + (U * 0.041666666666666664))))))));
} else {
tmp = t_0;
}
return tmp;
}
def code(J, l, K, U): t_0 = U + (2.0 * (J * (l * math.cos((0.5 * K))))) tmp = 0 if l <= -2.3e+216: tmp = t_0 elif l <= -5e+90: tmp = U + ((-0.25 * (J * (l * (K * K)))) + (2.0 * (l * J))) elif l <= -620000.0: tmp = math.log1p((U * (1.0 + (U * (0.5 + (U * (0.16666666666666666 + (U * 0.041666666666666664)))))))) else: tmp = t_0 return tmp
function code(J, l, K, U) t_0 = Float64(U + Float64(2.0 * Float64(J * Float64(l * cos(Float64(0.5 * K)))))) tmp = 0.0 if (l <= -2.3e+216) tmp = t_0; elseif (l <= -5e+90) tmp = Float64(U + Float64(Float64(-0.25 * Float64(J * Float64(l * Float64(K * K)))) + Float64(2.0 * Float64(l * J)))); elseif (l <= -620000.0) tmp = log1p(Float64(U * Float64(1.0 + Float64(U * Float64(0.5 + Float64(U * Float64(0.16666666666666666 + Float64(U * 0.041666666666666664)))))))); else tmp = t_0; end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(U + N[(2.0 * N[(J * N[(l * N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -2.3e+216], t$95$0, If[LessEqual[l, -5e+90], N[(U + N[(N[(-0.25 * N[(J * N[(l * N[(K * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(2.0 * N[(l * J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -620000.0], N[Log[1 + N[(U * N[(1.0 + N[(U * N[(0.5 + N[(U * N[(0.16666666666666666 + N[(U * 0.041666666666666664), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + 2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(0.5 \cdot K\right)\right)\right)\\
\mathbf{if}\;\ell \leq -2.3 \cdot 10^{+216}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq -5 \cdot 10^{+90}:\\
\;\;\;\;U + \left(-0.25 \cdot \left(J \cdot \left(\ell \cdot \left(K \cdot K\right)\right)\right) + 2 \cdot \left(\ell \cdot J\right)\right)\\
\mathbf{elif}\;\ell \leq -620000:\\
\;\;\;\;\mathsf{log1p}\left(U \cdot \left(1 + U \cdot \left(0.5 + U \cdot \left(0.16666666666666666 + U \cdot 0.041666666666666664\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if l < -2.29999999999999996e216 or -6.2e5 < l Initial program 80.7%
Taylor expanded in l around 0 76.9%
if -2.29999999999999996e216 < l < -5.0000000000000004e90Initial program 100.0%
Taylor expanded in l around 0 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in l around 0 14.8%
*-commutative14.8%
associate-*r*14.8%
Simplified14.8%
Taylor expanded in K around 0 47.5%
unpow247.5%
Applied egg-rr47.5%
if -5.0000000000000004e90 < l < -6.2e5Initial program 100.0%
associate-*l*100.0%
fma-define100.0%
Simplified100.0%
Applied egg-rr26.6%
Taylor expanded in U around 0 42.5%
*-commutative42.5%
Simplified42.5%
Final simplification70.4%
(FPCore (J l K U) :precision binary64 (if (or (<= l -2.15e+216) (not (<= l -3e+23))) (+ U (* 2.0 (* J (* l (cos (* 0.5 K)))))) (+ U (+ (* -0.25 (* J (* l (* K K)))) (* 2.0 (* l J))))))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -2.15e+216) || !(l <= -3e+23)) {
tmp = U + (2.0 * (J * (l * cos((0.5 * K)))));
} else {
tmp = U + ((-0.25 * (J * (l * (K * K)))) + (2.0 * (l * J)));
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if ((l <= (-2.15d+216)) .or. (.not. (l <= (-3d+23)))) then
tmp = u + (2.0d0 * (j * (l * cos((0.5d0 * k)))))
else
tmp = u + (((-0.25d0) * (j * (l * (k * k)))) + (2.0d0 * (l * j)))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -2.15e+216) || !(l <= -3e+23)) {
tmp = U + (2.0 * (J * (l * Math.cos((0.5 * K)))));
} else {
tmp = U + ((-0.25 * (J * (l * (K * K)))) + (2.0 * (l * J)));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -2.15e+216) or not (l <= -3e+23): tmp = U + (2.0 * (J * (l * math.cos((0.5 * K))))) else: tmp = U + ((-0.25 * (J * (l * (K * K)))) + (2.0 * (l * J))) return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -2.15e+216) || !(l <= -3e+23)) tmp = Float64(U + Float64(2.0 * Float64(J * Float64(l * cos(Float64(0.5 * K)))))); else tmp = Float64(U + Float64(Float64(-0.25 * Float64(J * Float64(l * Float64(K * K)))) + Float64(2.0 * Float64(l * J)))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -2.15e+216) || ~((l <= -3e+23))) tmp = U + (2.0 * (J * (l * cos((0.5 * K))))); else tmp = U + ((-0.25 * (J * (l * (K * K)))) + (2.0 * (l * J))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -2.15e+216], N[Not[LessEqual[l, -3e+23]], $MachinePrecision]], N[(U + N[(2.0 * N[(J * N[(l * N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(N[(-0.25 * N[(J * N[(l * N[(K * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(2.0 * N[(l * J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2.15 \cdot 10^{+216} \lor \neg \left(\ell \leq -3 \cdot 10^{+23}\right):\\
\;\;\;\;U + 2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(0.5 \cdot K\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + \left(-0.25 \cdot \left(J \cdot \left(\ell \cdot \left(K \cdot K\right)\right)\right) + 2 \cdot \left(\ell \cdot J\right)\right)\\
\end{array}
\end{array}
if l < -2.14999999999999985e216 or -3.0000000000000001e23 < l Initial program 81.2%
Taylor expanded in l around 0 75.3%
if -2.14999999999999985e216 < l < -3.0000000000000001e23Initial program 100.0%
Taylor expanded in l around 0 96.1%
*-commutative96.1%
Simplified96.1%
Taylor expanded in l around 0 11.8%
*-commutative11.8%
associate-*r*11.8%
Simplified11.8%
Taylor expanded in K around 0 37.2%
unpow237.2%
Applied egg-rr37.2%
Final simplification68.1%
(FPCore (J l K U) :precision binary64 (if (<= l -3.2e+23) (+ U (+ (* -0.25 (* J (* l (* K K)))) (* 2.0 (* l J)))) (+ U (* l (* J 2.0)))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -3.2e+23) {
tmp = U + ((-0.25 * (J * (l * (K * K)))) + (2.0 * (l * J)));
} 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 <= (-3.2d+23)) then
tmp = u + (((-0.25d0) * (j * (l * (k * k)))) + (2.0d0 * (l * j)))
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 <= -3.2e+23) {
tmp = U + ((-0.25 * (J * (l * (K * K)))) + (2.0 * (l * J)));
} else {
tmp = U + (l * (J * 2.0));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -3.2e+23: tmp = U + ((-0.25 * (J * (l * (K * K)))) + (2.0 * (l * J))) else: tmp = U + (l * (J * 2.0)) return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -3.2e+23) tmp = Float64(U + Float64(Float64(-0.25 * Float64(J * Float64(l * Float64(K * K)))) + Float64(2.0 * Float64(l * J)))); 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 <= -3.2e+23) tmp = U + ((-0.25 * (J * (l * (K * K)))) + (2.0 * (l * J))); else tmp = U + (l * (J * 2.0)); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -3.2e+23], N[(U + N[(N[(-0.25 * N[(J * N[(l * N[(K * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(2.0 * N[(l * J), $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 -3.2 \cdot 10^{+23}:\\
\;\;\;\;U + \left(-0.25 \cdot \left(J \cdot \left(\ell \cdot \left(K \cdot K\right)\right)\right) + 2 \cdot \left(\ell \cdot J\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + \ell \cdot \left(J \cdot 2\right)\\
\end{array}
\end{array}
if l < -3.2e23Initial program 100.0%
Taylor expanded in l around 0 97.1%
*-commutative97.1%
Simplified97.1%
Taylor expanded in l around 0 22.8%
*-commutative22.8%
associate-*r*22.8%
Simplified22.8%
Taylor expanded in K around 0 34.9%
unpow234.9%
Applied egg-rr34.9%
if -3.2e23 < l Initial program 79.4%
Taylor expanded in l around 0 93.9%
*-commutative93.9%
Simplified93.9%
Taylor expanded in l around 0 77.5%
*-commutative77.5%
associate-*r*77.5%
Simplified77.5%
pow177.5%
associate-*l*77.5%
associate-*l*77.5%
div-inv77.5%
metadata-eval77.5%
Applied egg-rr77.5%
unpow177.5%
*-commutative77.5%
Simplified77.5%
Taylor expanded in K around 0 65.4%
+-commutative65.4%
associate-*r*65.4%
*-commutative65.4%
*-commutative65.4%
Simplified65.4%
Final simplification57.5%
(FPCore (J l K U) :precision binary64 (if (or (<= l -115000.0) (not (<= l 9.5e+30))) (* U U) U))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -115000.0) || !(l <= 9.5e+30)) {
tmp = U * U;
} else {
tmp = U;
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if ((l <= (-115000.0d0)) .or. (.not. (l <= 9.5d+30))) then
tmp = u * u
else
tmp = u
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -115000.0) || !(l <= 9.5e+30)) {
tmp = U * U;
} else {
tmp = U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -115000.0) or not (l <= 9.5e+30): tmp = U * U else: tmp = U return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -115000.0) || !(l <= 9.5e+30)) tmp = Float64(U * U); else tmp = U; end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -115000.0) || ~((l <= 9.5e+30))) tmp = U * U; else tmp = U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -115000.0], N[Not[LessEqual[l, 9.5e+30]], $MachinePrecision]], N[(U * U), $MachinePrecision], U]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -115000 \lor \neg \left(\ell \leq 9.5 \cdot 10^{+30}\right):\\
\;\;\;\;U \cdot U\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\end{array}
if l < -115000 or 9.5000000000000003e30 < l Initial program 100.0%
associate-*l*100.0%
fma-define100.0%
Simplified100.0%
Applied egg-rr13.7%
if -115000 < l < 9.5000000000000003e30Initial program 70.2%
associate-*l*70.2%
fma-define70.2%
Simplified70.2%
Taylor expanded in J around 0 63.9%
Final simplification39.4%
(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 84.7%
Taylor expanded in l around 0 94.7%
*-commutative94.7%
Simplified94.7%
Taylor expanded in l around 0 63.4%
*-commutative63.4%
associate-*r*63.4%
Simplified63.4%
pow163.4%
associate-*l*63.4%
associate-*l*63.4%
div-inv63.4%
metadata-eval63.4%
Applied egg-rr63.4%
unpow163.4%
*-commutative63.4%
Simplified63.4%
Taylor expanded in K around 0 53.8%
+-commutative53.8%
associate-*r*53.8%
*-commutative53.8%
*-commutative53.8%
Simplified53.8%
Final simplification53.8%
(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 84.7%
associate-*l*84.8%
fma-define84.8%
Simplified84.8%
Taylor expanded in J around 0 33.7%
herbie shell --seed 2024112
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))