
(FPCore (J l K U) :precision binary64 (+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))
double code(double J, double l, double K, double U) {
return ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = ((j * (exp(l) - exp(-l))) * cos((k / 2.0d0))) + u
end function
public static double code(double J, double l, double K, double U) {
return ((J * (Math.exp(l) - Math.exp(-l))) * Math.cos((K / 2.0))) + U;
}
def code(J, l, K, U): return ((J * (math.exp(l) - math.exp(-l))) * math.cos((K / 2.0))) + U
function code(J, l, K, U) return Float64(Float64(Float64(J * Float64(exp(l) - exp(Float64(-l)))) * cos(Float64(K / 2.0))) + U) end
function tmp = code(J, l, K, U) tmp = ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U; end
code[J_, l_, K_, U_] := N[(N[(N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]
\begin{array}{l}
\\
\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (J l K U) :precision binary64 (+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))
double code(double J, double l, double K, double U) {
return ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = ((j * (exp(l) - exp(-l))) * cos((k / 2.0d0))) + u
end function
public static double code(double J, double l, double K, double U) {
return ((J * (Math.exp(l) - Math.exp(-l))) * Math.cos((K / 2.0))) + U;
}
def code(J, l, K, U): return ((J * (math.exp(l) - math.exp(-l))) * math.cos((K / 2.0))) + U
function code(J, l, K, U) return Float64(Float64(Float64(J * Float64(exp(l) - exp(Float64(-l)))) * cos(Float64(K / 2.0))) + U) end
function tmp = code(J, l, K, U) tmp = ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U; end
code[J_, l_, K_, U_] := N[(N[(N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]
\begin{array}{l}
\\
\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U
\end{array}
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))) (t_1 (- (exp l) (exp (- l)))))
(if (<= t_1 -200.0)
(+ (* (* t_1 J) t_0) U)
(+
U
(*
t_0
(*
J
(*
l
(+
2.0
(*
(* l l)
(+
0.3333333333333333
(*
(* l l)
(+
0.016666666666666666
(* (* l l) 0.0003968253968253968)))))))))))))
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 <= -200.0) {
tmp = ((t_1 * J) * t_0) + U;
} else {
tmp = U + (t_0 * (J * (l * (2.0 + ((l * l) * (0.3333333333333333 + ((l * l) * (0.016666666666666666 + ((l * l) * 0.0003968253968253968)))))))));
}
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 <= (-200.0d0)) then
tmp = ((t_1 * j) * t_0) + u
else
tmp = u + (t_0 * (j * (l * (2.0d0 + ((l * l) * (0.3333333333333333d0 + ((l * l) * (0.016666666666666666d0 + ((l * l) * 0.0003968253968253968d0)))))))))
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 <= -200.0) {
tmp = ((t_1 * J) * t_0) + U;
} else {
tmp = U + (t_0 * (J * (l * (2.0 + ((l * l) * (0.3333333333333333 + ((l * l) * (0.016666666666666666 + ((l * l) * 0.0003968253968253968)))))))));
}
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 <= -200.0: tmp = ((t_1 * J) * t_0) + U else: tmp = U + (t_0 * (J * (l * (2.0 + ((l * l) * (0.3333333333333333 + ((l * l) * (0.016666666666666666 + ((l * l) * 0.0003968253968253968))))))))) 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 <= -200.0) tmp = Float64(Float64(Float64(t_1 * J) * t_0) + U); else tmp = Float64(U + Float64(t_0 * Float64(J * Float64(l * Float64(2.0 + Float64(Float64(l * l) * Float64(0.3333333333333333 + Float64(Float64(l * l) * Float64(0.016666666666666666 + Float64(Float64(l * l) * 0.0003968253968253968)))))))))); 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 <= -200.0) tmp = ((t_1 * J) * t_0) + U; else tmp = U + (t_0 * (J * (l * (2.0 + ((l * l) * (0.3333333333333333 + ((l * l) * (0.016666666666666666 + ((l * l) * 0.0003968253968253968))))))))); 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[LessEqual[t$95$1, -200.0], N[(N[(N[(t$95$1 * J), $MachinePrecision] * t$95$0), $MachinePrecision] + U), $MachinePrecision], N[(U + N[(t$95$0 * N[(J * N[(l * N[(2.0 + N[(N[(l * l), $MachinePrecision] * N[(0.3333333333333333 + N[(N[(l * l), $MachinePrecision] * N[(0.016666666666666666 + N[(N[(l * l), $MachinePrecision] * 0.0003968253968253968), $MachinePrecision]), $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 -200:\\
\;\;\;\;\left(t\_1 \cdot J\right) \cdot t\_0 + U\\
\mathbf{else}:\\
\;\;\;\;U + t\_0 \cdot \left(J \cdot \left(\ell \cdot \left(2 + \left(\ell \cdot \ell\right) \cdot \left(0.3333333333333333 + \left(\ell \cdot \ell\right) \cdot \left(0.016666666666666666 + \left(\ell \cdot \ell\right) \cdot 0.0003968253968253968\right)\right)\right)\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -200Initial program 100.0%
if -200 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 81.0%
Taylor expanded in l around 0 98.4%
*-commutative98.4%
Simplified98.4%
unpow298.4%
Applied egg-rr98.4%
unpow298.4%
Applied egg-rr98.4%
unpow298.4%
Applied egg-rr98.4%
Final simplification98.8%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (exp (- l))))
(if (<= (- (exp l) t_0) -200.0)
(+ U (* (- 0.3333333333333333 t_0) (* J (cos (* K 0.5)))))
(+
U
(*
(cos (/ K 2.0))
(*
J
(*
l
(+
2.0
(*
(* l l)
(+
0.3333333333333333
(*
(* l l)
(+
0.016666666666666666
(* (* l l) 0.0003968253968253968)))))))))))))
double code(double J, double l, double K, double U) {
double t_0 = exp(-l);
double tmp;
if ((exp(l) - t_0) <= -200.0) {
tmp = U + ((0.3333333333333333 - t_0) * (J * cos((K * 0.5))));
} else {
tmp = U + (cos((K / 2.0)) * (J * (l * (2.0 + ((l * l) * (0.3333333333333333 + ((l * l) * (0.016666666666666666 + ((l * l) * 0.0003968253968253968)))))))));
}
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)
if ((exp(l) - t_0) <= (-200.0d0)) then
tmp = u + ((0.3333333333333333d0 - t_0) * (j * cos((k * 0.5d0))))
else
tmp = u + (cos((k / 2.0d0)) * (j * (l * (2.0d0 + ((l * l) * (0.3333333333333333d0 + ((l * l) * (0.016666666666666666d0 + ((l * l) * 0.0003968253968253968d0)))))))))
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 tmp;
if ((Math.exp(l) - t_0) <= -200.0) {
tmp = U + ((0.3333333333333333 - t_0) * (J * Math.cos((K * 0.5))));
} else {
tmp = U + (Math.cos((K / 2.0)) * (J * (l * (2.0 + ((l * l) * (0.3333333333333333 + ((l * l) * (0.016666666666666666 + ((l * l) * 0.0003968253968253968)))))))));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.exp(-l) tmp = 0 if (math.exp(l) - t_0) <= -200.0: tmp = U + ((0.3333333333333333 - t_0) * (J * math.cos((K * 0.5)))) else: tmp = U + (math.cos((K / 2.0)) * (J * (l * (2.0 + ((l * l) * (0.3333333333333333 + ((l * l) * (0.016666666666666666 + ((l * l) * 0.0003968253968253968))))))))) return tmp
function code(J, l, K, U) t_0 = exp(Float64(-l)) tmp = 0.0 if (Float64(exp(l) - t_0) <= -200.0) tmp = Float64(U + Float64(Float64(0.3333333333333333 - t_0) * Float64(J * cos(Float64(K * 0.5))))); else tmp = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(J * Float64(l * Float64(2.0 + Float64(Float64(l * l) * Float64(0.3333333333333333 + Float64(Float64(l * l) * Float64(0.016666666666666666 + Float64(Float64(l * l) * 0.0003968253968253968)))))))))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = exp(-l); tmp = 0.0; if ((exp(l) - t_0) <= -200.0) tmp = U + ((0.3333333333333333 - t_0) * (J * cos((K * 0.5)))); else tmp = U + (cos((K / 2.0)) * (J * (l * (2.0 + ((l * l) * (0.3333333333333333 + ((l * l) * (0.016666666666666666 + ((l * l) * 0.0003968253968253968))))))))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Exp[(-l)], $MachinePrecision]}, If[LessEqual[N[(N[Exp[l], $MachinePrecision] - t$95$0), $MachinePrecision], -200.0], N[(U + N[(N[(0.3333333333333333 - t$95$0), $MachinePrecision] * N[(J * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(J * N[(l * N[(2.0 + N[(N[(l * l), $MachinePrecision] * N[(0.3333333333333333 + N[(N[(l * l), $MachinePrecision] * N[(0.016666666666666666 + N[(N[(l * l), $MachinePrecision] * 0.0003968253968253968), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-\ell}\\
\mathbf{if}\;e^{\ell} - t\_0 \leq -200:\\
\;\;\;\;U + \left(0.3333333333333333 - t\_0\right) \cdot \left(J \cdot \cos \left(K \cdot 0.5\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(\ell \cdot \left(2 + \left(\ell \cdot \ell\right) \cdot \left(0.3333333333333333 + \left(\ell \cdot \ell\right) \cdot \left(0.016666666666666666 + \left(\ell \cdot \ell\right) \cdot 0.0003968253968253968\right)\right)\right)\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -200Initial program 100.0%
Applied egg-rr99.1%
Taylor expanded in J around 0 99.1%
associate-*r*99.1%
*-commutative99.1%
Simplified99.1%
if -200 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 81.0%
Taylor expanded in l around 0 98.4%
*-commutative98.4%
Simplified98.4%
unpow298.4%
Applied egg-rr98.4%
unpow298.4%
Applied egg-rr98.4%
unpow298.4%
Applied egg-rr98.4%
Final simplification98.6%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (exp (- l))) (t_1 (cos (/ K 2.0))))
(if (<= (- (exp l) t_0) -200.0)
(+ U (* t_1 (* J (- 0.3333333333333333 t_0))))
(+
U
(*
t_1
(*
J
(*
l
(+
2.0
(*
(* l l)
(+
0.3333333333333333
(*
(* l l)
(+
0.016666666666666666
(* (* l l) 0.0003968253968253968)))))))))))))
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 ((exp(l) - t_0) <= -200.0) {
tmp = U + (t_1 * (J * (0.3333333333333333 - t_0)));
} else {
tmp = U + (t_1 * (J * (l * (2.0 + ((l * l) * (0.3333333333333333 + ((l * l) * (0.016666666666666666 + ((l * l) * 0.0003968253968253968)))))))));
}
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 ((exp(l) - t_0) <= (-200.0d0)) then
tmp = u + (t_1 * (j * (0.3333333333333333d0 - t_0)))
else
tmp = u + (t_1 * (j * (l * (2.0d0 + ((l * l) * (0.3333333333333333d0 + ((l * l) * (0.016666666666666666d0 + ((l * l) * 0.0003968253968253968d0)))))))))
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 ((Math.exp(l) - t_0) <= -200.0) {
tmp = U + (t_1 * (J * (0.3333333333333333 - t_0)));
} else {
tmp = U + (t_1 * (J * (l * (2.0 + ((l * l) * (0.3333333333333333 + ((l * l) * (0.016666666666666666 + ((l * l) * 0.0003968253968253968)))))))));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.exp(-l) t_1 = math.cos((K / 2.0)) tmp = 0 if (math.exp(l) - t_0) <= -200.0: tmp = U + (t_1 * (J * (0.3333333333333333 - t_0))) else: tmp = U + (t_1 * (J * (l * (2.0 + ((l * l) * (0.3333333333333333 + ((l * l) * (0.016666666666666666 + ((l * l) * 0.0003968253968253968))))))))) return tmp
function code(J, l, K, U) t_0 = exp(Float64(-l)) t_1 = cos(Float64(K / 2.0)) tmp = 0.0 if (Float64(exp(l) - t_0) <= -200.0) tmp = Float64(U + Float64(t_1 * Float64(J * Float64(0.3333333333333333 - t_0)))); else tmp = Float64(U + Float64(t_1 * Float64(J * Float64(l * Float64(2.0 + Float64(Float64(l * l) * Float64(0.3333333333333333 + Float64(Float64(l * l) * Float64(0.016666666666666666 + Float64(Float64(l * l) * 0.0003968253968253968)))))))))); 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 ((exp(l) - t_0) <= -200.0) tmp = U + (t_1 * (J * (0.3333333333333333 - t_0))); else tmp = U + (t_1 * (J * (l * (2.0 + ((l * l) * (0.3333333333333333 + ((l * l) * (0.016666666666666666 + ((l * l) * 0.0003968253968253968))))))))); 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[N[(N[Exp[l], $MachinePrecision] - t$95$0), $MachinePrecision], -200.0], N[(U + N[(t$95$1 * N[(J * N[(0.3333333333333333 - t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(t$95$1 * N[(J * N[(l * N[(2.0 + N[(N[(l * l), $MachinePrecision] * N[(0.3333333333333333 + N[(N[(l * l), $MachinePrecision] * N[(0.016666666666666666 + N[(N[(l * l), $MachinePrecision] * 0.0003968253968253968), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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}\;e^{\ell} - t\_0 \leq -200:\\
\;\;\;\;U + t\_1 \cdot \left(J \cdot \left(0.3333333333333333 - t\_0\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + t\_1 \cdot \left(J \cdot \left(\ell \cdot \left(2 + \left(\ell \cdot \ell\right) \cdot \left(0.3333333333333333 + \left(\ell \cdot \ell\right) \cdot \left(0.016666666666666666 + \left(\ell \cdot \ell\right) \cdot 0.0003968253968253968\right)\right)\right)\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -200Initial program 100.0%
Applied egg-rr99.1%
if -200 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 81.0%
Taylor expanded in l around 0 98.4%
*-commutative98.4%
Simplified98.4%
unpow298.4%
Applied egg-rr98.4%
unpow298.4%
Applied egg-rr98.4%
unpow298.4%
Applied egg-rr98.4%
Final simplification98.6%
(FPCore (J l K U)
:precision binary64
(let* ((t_0
(+
U
(*
(cos (/ K 2.0))
(*
J
(-
(* l (+ 1.0 (* l (- (* l 0.16666666666666666) 0.5))))
0.6666666666666666))))))
(if (<= l -1e+103)
t_0
(if (<= l -22.0)
(+ U (* J (- 0.3333333333333333 (exp (- l)))))
(if (<= l 1.9e-9) (+ U (* J (* (cos (* K 0.5)) (* l 2.0)))) t_0)))))
double code(double J, double l, double K, double U) {
double t_0 = U + (cos((K / 2.0)) * (J * ((l * (1.0 + (l * ((l * 0.16666666666666666) - 0.5)))) - 0.6666666666666666)));
double tmp;
if (l <= -1e+103) {
tmp = t_0;
} else if (l <= -22.0) {
tmp = U + (J * (0.3333333333333333 - exp(-l)));
} else if (l <= 1.9e-9) {
tmp = U + (J * (cos((K * 0.5)) * (l * 2.0)));
} 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 + (cos((k / 2.0d0)) * (j * ((l * (1.0d0 + (l * ((l * 0.16666666666666666d0) - 0.5d0)))) - 0.6666666666666666d0)))
if (l <= (-1d+103)) then
tmp = t_0
else if (l <= (-22.0d0)) then
tmp = u + (j * (0.3333333333333333d0 - exp(-l)))
else if (l <= 1.9d-9) then
tmp = u + (j * (cos((k * 0.5d0)) * (l * 2.0d0)))
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 + (Math.cos((K / 2.0)) * (J * ((l * (1.0 + (l * ((l * 0.16666666666666666) - 0.5)))) - 0.6666666666666666)));
double tmp;
if (l <= -1e+103) {
tmp = t_0;
} else if (l <= -22.0) {
tmp = U + (J * (0.3333333333333333 - Math.exp(-l)));
} else if (l <= 1.9e-9) {
tmp = U + (J * (Math.cos((K * 0.5)) * (l * 2.0)));
} else {
tmp = t_0;
}
return tmp;
}
def code(J, l, K, U): t_0 = U + (math.cos((K / 2.0)) * (J * ((l * (1.0 + (l * ((l * 0.16666666666666666) - 0.5)))) - 0.6666666666666666))) tmp = 0 if l <= -1e+103: tmp = t_0 elif l <= -22.0: tmp = U + (J * (0.3333333333333333 - math.exp(-l))) elif l <= 1.9e-9: tmp = U + (J * (math.cos((K * 0.5)) * (l * 2.0))) else: tmp = t_0 return tmp
function code(J, l, K, U) t_0 = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(J * Float64(Float64(l * Float64(1.0 + Float64(l * Float64(Float64(l * 0.16666666666666666) - 0.5)))) - 0.6666666666666666)))) tmp = 0.0 if (l <= -1e+103) tmp = t_0; elseif (l <= -22.0) tmp = Float64(U + Float64(J * Float64(0.3333333333333333 - exp(Float64(-l))))); elseif (l <= 1.9e-9) tmp = Float64(U + Float64(J * Float64(cos(Float64(K * 0.5)) * Float64(l * 2.0)))); else tmp = t_0; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = U + (cos((K / 2.0)) * (J * ((l * (1.0 + (l * ((l * 0.16666666666666666) - 0.5)))) - 0.6666666666666666))); tmp = 0.0; if (l <= -1e+103) tmp = t_0; elseif (l <= -22.0) tmp = U + (J * (0.3333333333333333 - exp(-l))); elseif (l <= 1.9e-9) tmp = U + (J * (cos((K * 0.5)) * (l * 2.0))); else tmp = t_0; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(J * N[(N[(l * N[(1.0 + N[(l * N[(N[(l * 0.16666666666666666), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 0.6666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -1e+103], t$95$0, If[LessEqual[l, -22.0], N[(U + N[(J * N[(0.3333333333333333 - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.9e-9], N[(U + N[(J * N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(\ell \cdot \left(1 + \ell \cdot \left(\ell \cdot 0.16666666666666666 - 0.5\right)\right) - 0.6666666666666666\right)\right)\\
\mathbf{if}\;\ell \leq -1 \cdot 10^{+103}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq -22:\\
\;\;\;\;U + J \cdot \left(0.3333333333333333 - e^{-\ell}\right)\\
\mathbf{elif}\;\ell \leq 1.9 \cdot 10^{-9}:\\
\;\;\;\;U + J \cdot \left(\cos \left(K \cdot 0.5\right) \cdot \left(\ell \cdot 2\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if l < -1e103 or 1.90000000000000006e-9 < l Initial program 100.0%
Applied egg-rr52.3%
Taylor expanded in l around 0 89.3%
if -1e103 < l < -22Initial program 100.0%
Applied egg-rr100.0%
Taylor expanded in K around 0 81.0%
if -22 < l < 1.90000000000000006e-9Initial program 72.9%
Taylor expanded in l around 0 98.6%
*-commutative98.6%
associate-*l*98.6%
*-commutative98.6%
associate-*l*98.6%
Simplified98.6%
Final simplification93.3%
(FPCore (J l K U)
:precision binary64
(+
U
(*
(cos (/ K 2.0))
(*
J
(*
l
(+
2.0
(*
(* l l)
(+
0.3333333333333333
(*
(* l l)
(+ 0.016666666666666666 (* (* l l) 0.0003968253968253968)))))))))))
double code(double J, double l, double K, double U) {
return U + (cos((K / 2.0)) * (J * (l * (2.0 + ((l * l) * (0.3333333333333333 + ((l * l) * (0.016666666666666666 + ((l * l) * 0.0003968253968253968)))))))));
}
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 + (cos((k / 2.0d0)) * (j * (l * (2.0d0 + ((l * l) * (0.3333333333333333d0 + ((l * l) * (0.016666666666666666d0 + ((l * l) * 0.0003968253968253968d0)))))))))
end function
public static double code(double J, double l, double K, double U) {
return U + (Math.cos((K / 2.0)) * (J * (l * (2.0 + ((l * l) * (0.3333333333333333 + ((l * l) * (0.016666666666666666 + ((l * l) * 0.0003968253968253968)))))))));
}
def code(J, l, K, U): return U + (math.cos((K / 2.0)) * (J * (l * (2.0 + ((l * l) * (0.3333333333333333 + ((l * l) * (0.016666666666666666 + ((l * l) * 0.0003968253968253968)))))))))
function code(J, l, K, U) return Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(J * Float64(l * Float64(2.0 + Float64(Float64(l * l) * Float64(0.3333333333333333 + Float64(Float64(l * l) * Float64(0.016666666666666666 + Float64(Float64(l * l) * 0.0003968253968253968)))))))))) end
function tmp = code(J, l, K, U) tmp = U + (cos((K / 2.0)) * (J * (l * (2.0 + ((l * l) * (0.3333333333333333 + ((l * l) * (0.016666666666666666 + ((l * l) * 0.0003968253968253968))))))))); end
code[J_, l_, K_, U_] := N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(J * N[(l * N[(2.0 + N[(N[(l * l), $MachinePrecision] * N[(0.3333333333333333 + N[(N[(l * l), $MachinePrecision] * N[(0.016666666666666666 + N[(N[(l * l), $MachinePrecision] * 0.0003968253968253968), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(\ell \cdot \left(2 + \left(\ell \cdot \ell\right) \cdot \left(0.3333333333333333 + \left(\ell \cdot \ell\right) \cdot \left(0.016666666666666666 + \left(\ell \cdot \ell\right) \cdot 0.0003968253968253968\right)\right)\right)\right)\right)
\end{array}
Initial program 86.5%
Taylor expanded in l around 0 95.9%
*-commutative95.9%
Simplified95.9%
unpow295.9%
Applied egg-rr95.9%
unpow295.9%
Applied egg-rr95.9%
unpow295.9%
Applied egg-rr95.9%
Final simplification95.9%
(FPCore (J l K U)
:precision binary64
(if (<= l -7.4e+144)
(+
U
(* (cos (/ K 2.0)) (* J (- (* l (+ 1.0 (* l -0.5))) 0.6666666666666666))))
(if (<= l -22.0)
(+ U (* J (- 0.3333333333333333 (exp (- l)))))
(if (<= l 1.9e-9)
(+ U (* J (* (cos (* K 0.5)) (* l 2.0))))
(+
U
(*
J
(-
(* l (+ 1.0 (* l (- (* l 0.16666666666666666) 0.5))))
0.6666666666666666)))))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -7.4e+144) {
tmp = U + (cos((K / 2.0)) * (J * ((l * (1.0 + (l * -0.5))) - 0.6666666666666666)));
} else if (l <= -22.0) {
tmp = U + (J * (0.3333333333333333 - exp(-l)));
} else if (l <= 1.9e-9) {
tmp = U + (J * (cos((K * 0.5)) * (l * 2.0)));
} else {
tmp = U + (J * ((l * (1.0 + (l * ((l * 0.16666666666666666) - 0.5)))) - 0.6666666666666666));
}
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 <= (-7.4d+144)) then
tmp = u + (cos((k / 2.0d0)) * (j * ((l * (1.0d0 + (l * (-0.5d0)))) - 0.6666666666666666d0)))
else if (l <= (-22.0d0)) then
tmp = u + (j * (0.3333333333333333d0 - exp(-l)))
else if (l <= 1.9d-9) then
tmp = u + (j * (cos((k * 0.5d0)) * (l * 2.0d0)))
else
tmp = u + (j * ((l * (1.0d0 + (l * ((l * 0.16666666666666666d0) - 0.5d0)))) - 0.6666666666666666d0))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (l <= -7.4e+144) {
tmp = U + (Math.cos((K / 2.0)) * (J * ((l * (1.0 + (l * -0.5))) - 0.6666666666666666)));
} else if (l <= -22.0) {
tmp = U + (J * (0.3333333333333333 - Math.exp(-l)));
} else if (l <= 1.9e-9) {
tmp = U + (J * (Math.cos((K * 0.5)) * (l * 2.0)));
} else {
tmp = U + (J * ((l * (1.0 + (l * ((l * 0.16666666666666666) - 0.5)))) - 0.6666666666666666));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -7.4e+144: tmp = U + (math.cos((K / 2.0)) * (J * ((l * (1.0 + (l * -0.5))) - 0.6666666666666666))) elif l <= -22.0: tmp = U + (J * (0.3333333333333333 - math.exp(-l))) elif l <= 1.9e-9: tmp = U + (J * (math.cos((K * 0.5)) * (l * 2.0))) else: tmp = U + (J * ((l * (1.0 + (l * ((l * 0.16666666666666666) - 0.5)))) - 0.6666666666666666)) return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -7.4e+144) tmp = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(J * Float64(Float64(l * Float64(1.0 + Float64(l * -0.5))) - 0.6666666666666666)))); elseif (l <= -22.0) tmp = Float64(U + Float64(J * Float64(0.3333333333333333 - exp(Float64(-l))))); elseif (l <= 1.9e-9) tmp = Float64(U + Float64(J * Float64(cos(Float64(K * 0.5)) * Float64(l * 2.0)))); else tmp = Float64(U + Float64(J * Float64(Float64(l * Float64(1.0 + Float64(l * Float64(Float64(l * 0.16666666666666666) - 0.5)))) - 0.6666666666666666))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -7.4e+144) tmp = U + (cos((K / 2.0)) * (J * ((l * (1.0 + (l * -0.5))) - 0.6666666666666666))); elseif (l <= -22.0) tmp = U + (J * (0.3333333333333333 - exp(-l))); elseif (l <= 1.9e-9) tmp = U + (J * (cos((K * 0.5)) * (l * 2.0))); else tmp = U + (J * ((l * (1.0 + (l * ((l * 0.16666666666666666) - 0.5)))) - 0.6666666666666666)); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -7.4e+144], N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(J * N[(N[(l * N[(1.0 + N[(l * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 0.6666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -22.0], N[(U + N[(J * N[(0.3333333333333333 - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.9e-9], N[(U + N[(J * N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * N[(N[(l * N[(1.0 + N[(l * N[(N[(l * 0.16666666666666666), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 0.6666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -7.4 \cdot 10^{+144}:\\
\;\;\;\;U + \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(\ell \cdot \left(1 + \ell \cdot -0.5\right) - 0.6666666666666666\right)\right)\\
\mathbf{elif}\;\ell \leq -22:\\
\;\;\;\;U + J \cdot \left(0.3333333333333333 - e^{-\ell}\right)\\
\mathbf{elif}\;\ell \leq 1.9 \cdot 10^{-9}:\\
\;\;\;\;U + J \cdot \left(\cos \left(K \cdot 0.5\right) \cdot \left(\ell \cdot 2\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(\ell \cdot \left(1 + \ell \cdot \left(\ell \cdot 0.16666666666666666 - 0.5\right)\right) - 0.6666666666666666\right)\\
\end{array}
\end{array}
if l < -7.3999999999999993e144Initial program 100.0%
Applied egg-rr100.0%
Taylor expanded in l around 0 94.7%
if -7.3999999999999993e144 < l < -22Initial program 100.0%
Applied egg-rr100.0%
Taylor expanded in K around 0 80.0%
if -22 < l < 1.90000000000000006e-9Initial program 72.9%
Taylor expanded in l around 0 98.6%
*-commutative98.6%
associate-*l*98.6%
*-commutative98.6%
associate-*l*98.6%
Simplified98.6%
if 1.90000000000000006e-9 < l Initial program 100.0%
Applied egg-rr8.9%
Taylor expanded in l around 0 79.6%
Taylor expanded in K around 0 54.6%
Final simplification85.9%
(FPCore (J l K U)
:precision binary64
(if (<= l -22.0)
(+ U (* J (- 0.3333333333333333 (exp (- l)))))
(if (<= l 1.9e-9)
(+ U (* J (* (cos (* K 0.5)) (* l 2.0))))
(+
U
(*
J
(-
(* l (+ 1.0 (* l (- (* l 0.16666666666666666) 0.5))))
0.6666666666666666))))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -22.0) {
tmp = U + (J * (0.3333333333333333 - exp(-l)));
} else if (l <= 1.9e-9) {
tmp = U + (J * (cos((K * 0.5)) * (l * 2.0)));
} else {
tmp = U + (J * ((l * (1.0 + (l * ((l * 0.16666666666666666) - 0.5)))) - 0.6666666666666666));
}
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 <= (-22.0d0)) then
tmp = u + (j * (0.3333333333333333d0 - exp(-l)))
else if (l <= 1.9d-9) then
tmp = u + (j * (cos((k * 0.5d0)) * (l * 2.0d0)))
else
tmp = u + (j * ((l * (1.0d0 + (l * ((l * 0.16666666666666666d0) - 0.5d0)))) - 0.6666666666666666d0))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (l <= -22.0) {
tmp = U + (J * (0.3333333333333333 - Math.exp(-l)));
} else if (l <= 1.9e-9) {
tmp = U + (J * (Math.cos((K * 0.5)) * (l * 2.0)));
} else {
tmp = U + (J * ((l * (1.0 + (l * ((l * 0.16666666666666666) - 0.5)))) - 0.6666666666666666));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -22.0: tmp = U + (J * (0.3333333333333333 - math.exp(-l))) elif l <= 1.9e-9: tmp = U + (J * (math.cos((K * 0.5)) * (l * 2.0))) else: tmp = U + (J * ((l * (1.0 + (l * ((l * 0.16666666666666666) - 0.5)))) - 0.6666666666666666)) return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -22.0) tmp = Float64(U + Float64(J * Float64(0.3333333333333333 - exp(Float64(-l))))); elseif (l <= 1.9e-9) tmp = Float64(U + Float64(J * Float64(cos(Float64(K * 0.5)) * Float64(l * 2.0)))); else tmp = Float64(U + Float64(J * Float64(Float64(l * Float64(1.0 + Float64(l * Float64(Float64(l * 0.16666666666666666) - 0.5)))) - 0.6666666666666666))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -22.0) tmp = U + (J * (0.3333333333333333 - exp(-l))); elseif (l <= 1.9e-9) tmp = U + (J * (cos((K * 0.5)) * (l * 2.0))); else tmp = U + (J * ((l * (1.0 + (l * ((l * 0.16666666666666666) - 0.5)))) - 0.6666666666666666)); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -22.0], N[(U + N[(J * N[(0.3333333333333333 - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.9e-9], N[(U + N[(J * N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * N[(N[(l * N[(1.0 + N[(l * N[(N[(l * 0.16666666666666666), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 0.6666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -22:\\
\;\;\;\;U + J \cdot \left(0.3333333333333333 - e^{-\ell}\right)\\
\mathbf{elif}\;\ell \leq 1.9 \cdot 10^{-9}:\\
\;\;\;\;U + J \cdot \left(\cos \left(K \cdot 0.5\right) \cdot \left(\ell \cdot 2\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(\ell \cdot \left(1 + \ell \cdot \left(\ell \cdot 0.16666666666666666 - 0.5\right)\right) - 0.6666666666666666\right)\\
\end{array}
\end{array}
if l < -22Initial program 100.0%
Applied egg-rr100.0%
Taylor expanded in K around 0 77.8%
if -22 < l < 1.90000000000000006e-9Initial program 72.9%
Taylor expanded in l around 0 98.6%
*-commutative98.6%
associate-*l*98.6%
*-commutative98.6%
associate-*l*98.6%
Simplified98.6%
if 1.90000000000000006e-9 < l Initial program 100.0%
Applied egg-rr8.9%
Taylor expanded in l around 0 79.6%
Taylor expanded in K around 0 54.6%
Final simplification83.1%
(FPCore (J l K U)
:precision binary64
(if (<= l -2.3e-51)
(+ U (* J (- 0.3333333333333333 (exp (- l)))))
(if (<= l 1.9e-9)
U
(+
U
(*
J
(-
(* l (+ 1.0 (* l (- (* l 0.16666666666666666) 0.5))))
0.6666666666666666))))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -2.3e-51) {
tmp = U + (J * (0.3333333333333333 - exp(-l)));
} else if (l <= 1.9e-9) {
tmp = U;
} else {
tmp = U + (J * ((l * (1.0 + (l * ((l * 0.16666666666666666) - 0.5)))) - 0.6666666666666666));
}
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.3d-51)) then
tmp = u + (j * (0.3333333333333333d0 - exp(-l)))
else if (l <= 1.9d-9) then
tmp = u
else
tmp = u + (j * ((l * (1.0d0 + (l * ((l * 0.16666666666666666d0) - 0.5d0)))) - 0.6666666666666666d0))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (l <= -2.3e-51) {
tmp = U + (J * (0.3333333333333333 - Math.exp(-l)));
} else if (l <= 1.9e-9) {
tmp = U;
} else {
tmp = U + (J * ((l * (1.0 + (l * ((l * 0.16666666666666666) - 0.5)))) - 0.6666666666666666));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -2.3e-51: tmp = U + (J * (0.3333333333333333 - math.exp(-l))) elif l <= 1.9e-9: tmp = U else: tmp = U + (J * ((l * (1.0 + (l * ((l * 0.16666666666666666) - 0.5)))) - 0.6666666666666666)) return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -2.3e-51) tmp = Float64(U + Float64(J * Float64(0.3333333333333333 - exp(Float64(-l))))); elseif (l <= 1.9e-9) tmp = U; else tmp = Float64(U + Float64(J * Float64(Float64(l * Float64(1.0 + Float64(l * Float64(Float64(l * 0.16666666666666666) - 0.5)))) - 0.6666666666666666))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -2.3e-51) tmp = U + (J * (0.3333333333333333 - exp(-l))); elseif (l <= 1.9e-9) tmp = U; else tmp = U + (J * ((l * (1.0 + (l * ((l * 0.16666666666666666) - 0.5)))) - 0.6666666666666666)); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -2.3e-51], N[(U + N[(J * N[(0.3333333333333333 - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.9e-9], U, N[(U + N[(J * N[(N[(l * N[(1.0 + N[(l * N[(N[(l * 0.16666666666666666), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 0.6666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2.3 \cdot 10^{-51}:\\
\;\;\;\;U + J \cdot \left(0.3333333333333333 - e^{-\ell}\right)\\
\mathbf{elif}\;\ell \leq 1.9 \cdot 10^{-9}:\\
\;\;\;\;U\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(\ell \cdot \left(1 + \ell \cdot \left(\ell \cdot 0.16666666666666666 - 0.5\right)\right) - 0.6666666666666666\right)\\
\end{array}
\end{array}
if l < -2.30000000000000002e-51Initial program 94.0%
Applied egg-rr91.9%
Taylor expanded in K around 0 72.7%
if -2.30000000000000002e-51 < l < 1.90000000000000006e-9Initial program 74.2%
associate-*l*74.2%
fma-define74.2%
Simplified74.2%
Taylor expanded in J around 0 74.0%
if 1.90000000000000006e-9 < l Initial program 100.0%
Applied egg-rr8.9%
Taylor expanded in l around 0 79.6%
Taylor expanded in K around 0 54.6%
Final simplification69.3%
(FPCore (J l K U)
:precision binary64
(if (or (<= l -2.2e-51) (not (<= l 5.8e+15)))
(+
U
(*
J
(-
(* l (+ 1.0 (* l (- (* l 0.16666666666666666) 0.5))))
0.6666666666666666)))
U))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -2.2e-51) || !(l <= 5.8e+15)) {
tmp = U + (J * ((l * (1.0 + (l * ((l * 0.16666666666666666) - 0.5)))) - 0.6666666666666666));
} 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 <= (-2.2d-51)) .or. (.not. (l <= 5.8d+15))) then
tmp = u + (j * ((l * (1.0d0 + (l * ((l * 0.16666666666666666d0) - 0.5d0)))) - 0.6666666666666666d0))
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 <= -2.2e-51) || !(l <= 5.8e+15)) {
tmp = U + (J * ((l * (1.0 + (l * ((l * 0.16666666666666666) - 0.5)))) - 0.6666666666666666));
} else {
tmp = U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -2.2e-51) or not (l <= 5.8e+15): tmp = U + (J * ((l * (1.0 + (l * ((l * 0.16666666666666666) - 0.5)))) - 0.6666666666666666)) else: tmp = U return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -2.2e-51) || !(l <= 5.8e+15)) tmp = Float64(U + Float64(J * Float64(Float64(l * Float64(1.0 + Float64(l * Float64(Float64(l * 0.16666666666666666) - 0.5)))) - 0.6666666666666666))); else tmp = U; end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -2.2e-51) || ~((l <= 5.8e+15))) tmp = U + (J * ((l * (1.0 + (l * ((l * 0.16666666666666666) - 0.5)))) - 0.6666666666666666)); else tmp = U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -2.2e-51], N[Not[LessEqual[l, 5.8e+15]], $MachinePrecision]], N[(U + N[(J * N[(N[(l * N[(1.0 + N[(l * N[(N[(l * 0.16666666666666666), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 0.6666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], U]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2.2 \cdot 10^{-51} \lor \neg \left(\ell \leq 5.8 \cdot 10^{+15}\right):\\
\;\;\;\;U + J \cdot \left(\ell \cdot \left(1 + \ell \cdot \left(\ell \cdot 0.16666666666666666 - 0.5\right)\right) - 0.6666666666666666\right)\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\end{array}
if l < -2.2e-51 or 5.8e15 < l Initial program 96.2%
Applied egg-rr59.1%
Taylor expanded in l around 0 76.0%
Taylor expanded in K around 0 56.6%
if -2.2e-51 < l < 5.8e15Initial program 75.3%
associate-*l*75.3%
fma-define75.3%
Simplified75.3%
Taylor expanded in J around 0 73.4%
Final simplification64.4%
(FPCore (J l K U)
:precision binary64
(if (<= l -3e+22)
(* U U)
(if (<= l 480.0)
U
(+
U
(+ (* J -0.6666666666666666) (* 0.08333333333333333 (* J (* K K))))))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -3e+22) {
tmp = U * U;
} else if (l <= 480.0) {
tmp = U;
} else {
tmp = U + ((J * -0.6666666666666666) + (0.08333333333333333 * (J * (K * 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) :: tmp
if (l <= (-3d+22)) then
tmp = u * u
else if (l <= 480.0d0) then
tmp = u
else
tmp = u + ((j * (-0.6666666666666666d0)) + (0.08333333333333333d0 * (j * (k * k))))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (l <= -3e+22) {
tmp = U * U;
} else if (l <= 480.0) {
tmp = U;
} else {
tmp = U + ((J * -0.6666666666666666) + (0.08333333333333333 * (J * (K * K))));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -3e+22: tmp = U * U elif l <= 480.0: tmp = U else: tmp = U + ((J * -0.6666666666666666) + (0.08333333333333333 * (J * (K * K)))) return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -3e+22) tmp = Float64(U * U); elseif (l <= 480.0) tmp = U; else tmp = Float64(U + Float64(Float64(J * -0.6666666666666666) + Float64(0.08333333333333333 * Float64(J * Float64(K * K))))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -3e+22) tmp = U * U; elseif (l <= 480.0) tmp = U; else tmp = U + ((J * -0.6666666666666666) + (0.08333333333333333 * (J * (K * K)))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -3e+22], N[(U * U), $MachinePrecision], If[LessEqual[l, 480.0], U, N[(U + N[(N[(J * -0.6666666666666666), $MachinePrecision] + N[(0.08333333333333333 * N[(J * N[(K * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -3 \cdot 10^{+22}:\\
\;\;\;\;U \cdot U\\
\mathbf{elif}\;\ell \leq 480:\\
\;\;\;\;U\\
\mathbf{else}:\\
\;\;\;\;U + \left(J \cdot -0.6666666666666666 + 0.08333333333333333 \cdot \left(J \cdot \left(K \cdot K\right)\right)\right)\\
\end{array}
\end{array}
if l < -3e22Initial program 100.0%
associate-*l*100.0%
fma-define100.0%
Simplified100.0%
Applied egg-rr17.7%
if -3e22 < l < 480Initial program 74.4%
associate-*l*74.3%
fma-define74.3%
Simplified74.3%
Taylor expanded in J around 0 69.4%
if 480 < l Initial program 100.0%
Applied egg-rr3.7%
Taylor expanded in l around 0 1.3%
*-commutative1.3%
Simplified1.3%
Taylor expanded in K around 0 19.6%
unpow219.6%
Applied egg-rr19.6%
Final simplification45.3%
(FPCore (J l K U) :precision binary64 (if (or (<= l -8.2e+22) (not (<= l 820.0))) (* U U) U))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -8.2e+22) || !(l <= 820.0)) {
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 <= (-8.2d+22)) .or. (.not. (l <= 820.0d0))) 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 <= -8.2e+22) || !(l <= 820.0)) {
tmp = U * U;
} else {
tmp = U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -8.2e+22) or not (l <= 820.0): tmp = U * U else: tmp = U return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -8.2e+22) || !(l <= 820.0)) tmp = Float64(U * U); else tmp = U; end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -8.2e+22) || ~((l <= 820.0))) tmp = U * U; else tmp = U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -8.2e+22], N[Not[LessEqual[l, 820.0]], $MachinePrecision]], N[(U * U), $MachinePrecision], U]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -8.2 \cdot 10^{+22} \lor \neg \left(\ell \leq 820\right):\\
\;\;\;\;U \cdot U\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\end{array}
if l < -8.19999999999999958e22 or 820 < l Initial program 100.0%
associate-*l*100.0%
fma-define100.0%
Simplified100.0%
Applied egg-rr17.2%
if -8.19999999999999958e22 < l < 820Initial program 74.4%
associate-*l*74.3%
fma-define74.3%
Simplified74.3%
Taylor expanded in J around 0 69.4%
Final simplification44.7%
(FPCore (J l K U) :precision binary64 U)
double code(double J, double l, double K, double U) {
return U;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = u
end function
public static double code(double J, double l, double K, double U) {
return U;
}
def code(J, l, K, U): return U
function code(J, l, K, U) return U end
function tmp = code(J, l, K, U) tmp = U; end
code[J_, l_, K_, U_] := U
\begin{array}{l}
\\
U
\end{array}
Initial program 86.5%
associate-*l*86.5%
fma-define86.5%
Simplified86.5%
Taylor expanded in J around 0 37.7%
(FPCore (J l K U) :precision binary64 8.0)
double code(double J, double l, double K, double U) {
return 8.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 = 8.0d0
end function
public static double code(double J, double l, double K, double U) {
return 8.0;
}
def code(J, l, K, U): return 8.0
function code(J, l, K, U) return 8.0 end
function tmp = code(J, l, K, U) tmp = 8.0; end
code[J_, l_, K_, U_] := 8.0
\begin{array}{l}
\\
8
\end{array}
Initial program 86.5%
Applied egg-rr27.1%
Taylor expanded in U around 0 2.7%
herbie shell --seed 2024132
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))