
(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 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (J l K U) :precision binary64 (+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))
double code(double J, double l, double K, double U) {
return ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = ((j * (exp(l) - exp(-l))) * cos((k / 2.0d0))) + u
end function
public static double code(double J, double l, double K, double U) {
return ((J * (Math.exp(l) - Math.exp(-l))) * Math.cos((K / 2.0))) + U;
}
def code(J, l, K, U): return ((J * (math.exp(l) - math.exp(-l))) * math.cos((K / 2.0))) + U
function code(J, l, K, U) return Float64(Float64(Float64(J * Float64(exp(l) - exp(Float64(-l)))) * cos(Float64(K / 2.0))) + U) end
function tmp = code(J, l, K, U) tmp = ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U; end
code[J_, l_, K_, U_] := N[(N[(N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]
\begin{array}{l}
\\
\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U
\end{array}
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (- (exp l) (exp (- l)))))
(if (or (<= t_0 (- INFINITY)) (not (<= t_0 0.05)))
(+ (* (* J t_0) (cos (/ K 2.0))) U)
(+
U
(*
(* J (cos (* K 0.5)))
(+
(* 0.3333333333333333 (pow l 3.0))
(+ (* l 2.0) (* 0.016666666666666666 (pow l 5.0)))))))))
double code(double J, double l, double K, double U) {
double t_0 = exp(l) - exp(-l);
double tmp;
if ((t_0 <= -((double) INFINITY)) || !(t_0 <= 0.05)) {
tmp = ((J * t_0) * cos((K / 2.0))) + U;
} else {
tmp = U + ((J * cos((K * 0.5))) * ((0.3333333333333333 * pow(l, 3.0)) + ((l * 2.0) + (0.016666666666666666 * pow(l, 5.0)))));
}
return tmp;
}
public static double code(double J, double l, double K, double U) {
double t_0 = Math.exp(l) - Math.exp(-l);
double tmp;
if ((t_0 <= -Double.POSITIVE_INFINITY) || !(t_0 <= 0.05)) {
tmp = ((J * t_0) * Math.cos((K / 2.0))) + U;
} else {
tmp = U + ((J * Math.cos((K * 0.5))) * ((0.3333333333333333 * Math.pow(l, 3.0)) + ((l * 2.0) + (0.016666666666666666 * Math.pow(l, 5.0)))));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.exp(l) - math.exp(-l) tmp = 0 if (t_0 <= -math.inf) or not (t_0 <= 0.05): tmp = ((J * t_0) * math.cos((K / 2.0))) + U else: tmp = U + ((J * math.cos((K * 0.5))) * ((0.3333333333333333 * math.pow(l, 3.0)) + ((l * 2.0) + (0.016666666666666666 * math.pow(l, 5.0))))) return tmp
function code(J, l, K, U) t_0 = Float64(exp(l) - exp(Float64(-l))) tmp = 0.0 if ((t_0 <= Float64(-Inf)) || !(t_0 <= 0.05)) tmp = Float64(Float64(Float64(J * t_0) * cos(Float64(K / 2.0))) + U); else tmp = Float64(U + Float64(Float64(J * cos(Float64(K * 0.5))) * Float64(Float64(0.3333333333333333 * (l ^ 3.0)) + Float64(Float64(l * 2.0) + Float64(0.016666666666666666 * (l ^ 5.0)))))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = exp(l) - exp(-l); tmp = 0.0; if ((t_0 <= -Inf) || ~((t_0 <= 0.05))) tmp = ((J * t_0) * cos((K / 2.0))) + U; else tmp = U + ((J * cos((K * 0.5))) * ((0.3333333333333333 * (l ^ 3.0)) + ((l * 2.0) + (0.016666666666666666 * (l ^ 5.0))))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, (-Infinity)], N[Not[LessEqual[t$95$0, 0.05]], $MachinePrecision]], N[(N[(N[(J * t$95$0), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], N[(U + N[(N[(J * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision] + N[(N[(l * 2.0), $MachinePrecision] + N[(0.016666666666666666 * N[Power[l, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{\ell} - e^{-\ell}\\
\mathbf{if}\;t_0 \leq -\infty \lor \neg \left(t_0 \leq 0.05\right):\\
\;\;\;\;\left(J \cdot t_0\right) \cdot \cos \left(\frac{K}{2}\right) + U\\
\mathbf{else}:\\
\;\;\;\;U + \left(J \cdot \cos \left(K \cdot 0.5\right)\right) \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + \left(\ell \cdot 2 + 0.016666666666666666 \cdot {\ell}^{5}\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -inf.0 or 0.050000000000000003 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 100.0%
if -inf.0 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 0.050000000000000003Initial program 74.1%
Taylor expanded in l around 0 99.8%
Taylor expanded in J around 0 99.9%
Final simplification99.9%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0)))))
(if (<= t_0 (- INFINITY))
(+ t_0 U)
(+
U
(*
(* J (cos (* K 0.5)))
(+
(* 0.3333333333333333 (pow l 3.0))
(+
(* 0.0003968253968253968 (pow l 7.0))
(+ (* l 2.0) (* 0.016666666666666666 (pow l 5.0))))))))))
double code(double J, double l, double K, double U) {
double t_0 = (J * (exp(l) - exp(-l))) * cos((K / 2.0));
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = t_0 + U;
} else {
tmp = U + ((J * cos((K * 0.5))) * ((0.3333333333333333 * pow(l, 3.0)) + ((0.0003968253968253968 * pow(l, 7.0)) + ((l * 2.0) + (0.016666666666666666 * pow(l, 5.0))))));
}
return tmp;
}
public static double code(double J, double l, double K, double U) {
double t_0 = (J * (Math.exp(l) - Math.exp(-l))) * Math.cos((K / 2.0));
double tmp;
if (t_0 <= -Double.POSITIVE_INFINITY) {
tmp = t_0 + U;
} else {
tmp = U + ((J * Math.cos((K * 0.5))) * ((0.3333333333333333 * Math.pow(l, 3.0)) + ((0.0003968253968253968 * Math.pow(l, 7.0)) + ((l * 2.0) + (0.016666666666666666 * Math.pow(l, 5.0))))));
}
return tmp;
}
def code(J, l, K, U): t_0 = (J * (math.exp(l) - math.exp(-l))) * math.cos((K / 2.0)) tmp = 0 if t_0 <= -math.inf: tmp = t_0 + U else: tmp = U + ((J * math.cos((K * 0.5))) * ((0.3333333333333333 * math.pow(l, 3.0)) + ((0.0003968253968253968 * math.pow(l, 7.0)) + ((l * 2.0) + (0.016666666666666666 * math.pow(l, 5.0)))))) return tmp
function code(J, l, K, U) t_0 = Float64(Float64(J * Float64(exp(l) - exp(Float64(-l)))) * cos(Float64(K / 2.0))) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = Float64(t_0 + U); else tmp = Float64(U + Float64(Float64(J * cos(Float64(K * 0.5))) * Float64(Float64(0.3333333333333333 * (l ^ 3.0)) + Float64(Float64(0.0003968253968253968 * (l ^ 7.0)) + Float64(Float64(l * 2.0) + Float64(0.016666666666666666 * (l ^ 5.0))))))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = (J * (exp(l) - exp(-l))) * cos((K / 2.0)); tmp = 0.0; if (t_0 <= -Inf) tmp = t_0 + U; else tmp = U + ((J * cos((K * 0.5))) * ((0.3333333333333333 * (l ^ 3.0)) + ((0.0003968253968253968 * (l ^ 7.0)) + ((l * 2.0) + (0.016666666666666666 * (l ^ 5.0)))))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(t$95$0 + U), $MachinePrecision], N[(U + N[(N[(J * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision] + N[(N[(0.0003968253968253968 * N[Power[l, 7.0], $MachinePrecision]), $MachinePrecision] + N[(N[(l * 2.0), $MachinePrecision] + N[(0.016666666666666666 * N[Power[l, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;t_0 \leq -\infty:\\
\;\;\;\;t_0 + U\\
\mathbf{else}:\\
\;\;\;\;U + \left(J \cdot \cos \left(K \cdot 0.5\right)\right) \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + \left(0.0003968253968253968 \cdot {\ell}^{7} + \left(\ell \cdot 2 + 0.016666666666666666 \cdot {\ell}^{5}\right)\right)\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 J (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l)))) (cos.f64 (/.f64 K 2))) < -inf.0Initial program 100.0%
if -inf.0 < (*.f64 (*.f64 J (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l)))) (cos.f64 (/.f64 K 2))) Initial program 81.4%
Taylor expanded in l around 0 98.2%
Taylor expanded in J around 0 98.2%
Final simplification98.7%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))) (t_1 (* (* J (- (exp l) (exp (- l)))) t_0)))
(if (<= t_1 (- INFINITY))
(+ t_1 U)
(+
U
(*
t_0
(*
J
(+
(* 0.3333333333333333 (pow l 3.0))
(+
(* 0.0003968253968253968 (pow l 7.0))
(+ (* l 2.0) (* 0.016666666666666666 (pow l 5.0)))))))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double t_1 = (J * (exp(l) - exp(-l))) * t_0;
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = t_1 + U;
} else {
tmp = U + (t_0 * (J * ((0.3333333333333333 * pow(l, 3.0)) + ((0.0003968253968253968 * pow(l, 7.0)) + ((l * 2.0) + (0.016666666666666666 * pow(l, 5.0)))))));
}
return tmp;
}
public static double code(double J, double l, double K, double U) {
double t_0 = Math.cos((K / 2.0));
double t_1 = (J * (Math.exp(l) - Math.exp(-l))) * t_0;
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = t_1 + U;
} else {
tmp = U + (t_0 * (J * ((0.3333333333333333 * Math.pow(l, 3.0)) + ((0.0003968253968253968 * Math.pow(l, 7.0)) + ((l * 2.0) + (0.016666666666666666 * Math.pow(l, 5.0)))))));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K / 2.0)) t_1 = (J * (math.exp(l) - math.exp(-l))) * t_0 tmp = 0 if t_1 <= -math.inf: tmp = t_1 + U else: tmp = U + (t_0 * (J * ((0.3333333333333333 * math.pow(l, 3.0)) + ((0.0003968253968253968 * math.pow(l, 7.0)) + ((l * 2.0) + (0.016666666666666666 * math.pow(l, 5.0))))))) return tmp
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) t_1 = Float64(Float64(J * Float64(exp(l) - exp(Float64(-l)))) * t_0) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(t_1 + U); else tmp = Float64(U + Float64(t_0 * Float64(J * Float64(Float64(0.3333333333333333 * (l ^ 3.0)) + Float64(Float64(0.0003968253968253968 * (l ^ 7.0)) + Float64(Float64(l * 2.0) + Float64(0.016666666666666666 * (l ^ 5.0)))))))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = cos((K / 2.0)); t_1 = (J * (exp(l) - exp(-l))) * t_0; tmp = 0.0; if (t_1 <= -Inf) tmp = t_1 + U; else tmp = U + (t_0 * (J * ((0.3333333333333333 * (l ^ 3.0)) + ((0.0003968253968253968 * (l ^ 7.0)) + ((l * 2.0) + (0.016666666666666666 * (l ^ 5.0))))))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(t$95$1 + U), $MachinePrecision], N[(U + N[(t$95$0 * N[(J * N[(N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision] + N[(N[(0.0003968253968253968 * N[Power[l, 7.0], $MachinePrecision]), $MachinePrecision] + N[(N[(l * 2.0), $MachinePrecision] + N[(0.016666666666666666 * N[Power[l, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
t_1 := \left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot t_0\\
\mathbf{if}\;t_1 \leq -\infty:\\
\;\;\;\;t_1 + U\\
\mathbf{else}:\\
\;\;\;\;U + t_0 \cdot \left(J \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + \left(0.0003968253968253968 \cdot {\ell}^{7} + \left(\ell \cdot 2 + 0.016666666666666666 \cdot {\ell}^{5}\right)\right)\right)\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 J (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l)))) (cos.f64 (/.f64 K 2))) < -inf.0Initial program 100.0%
if -inf.0 < (*.f64 (*.f64 J (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l)))) (cos.f64 (/.f64 K 2))) Initial program 81.4%
Taylor expanded in l around 0 98.2%
Final simplification98.7%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))) (t_1 (- (exp l) (exp (- l)))))
(if (or (<= t_1 (- INFINITY)) (not (<= t_1 0.05)))
(+ (* (* J t_1) t_0) U)
(+
U
(*
t_0
(*
J
(+
(* 0.3333333333333333 (pow l 3.0))
(+ (* l 2.0) (* 0.016666666666666666 (pow l 5.0))))))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double t_1 = exp(l) - exp(-l);
double tmp;
if ((t_1 <= -((double) INFINITY)) || !(t_1 <= 0.05)) {
tmp = ((J * t_1) * t_0) + U;
} else {
tmp = U + (t_0 * (J * ((0.3333333333333333 * pow(l, 3.0)) + ((l * 2.0) + (0.016666666666666666 * pow(l, 5.0))))));
}
return tmp;
}
public static double code(double J, double l, double K, double U) {
double t_0 = Math.cos((K / 2.0));
double t_1 = Math.exp(l) - Math.exp(-l);
double tmp;
if ((t_1 <= -Double.POSITIVE_INFINITY) || !(t_1 <= 0.05)) {
tmp = ((J * t_1) * t_0) + U;
} else {
tmp = U + (t_0 * (J * ((0.3333333333333333 * Math.pow(l, 3.0)) + ((l * 2.0) + (0.016666666666666666 * Math.pow(l, 5.0))))));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K / 2.0)) t_1 = math.exp(l) - math.exp(-l) tmp = 0 if (t_1 <= -math.inf) or not (t_1 <= 0.05): tmp = ((J * t_1) * t_0) + U else: tmp = U + (t_0 * (J * ((0.3333333333333333 * math.pow(l, 3.0)) + ((l * 2.0) + (0.016666666666666666 * math.pow(l, 5.0)))))) return tmp
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) t_1 = Float64(exp(l) - exp(Float64(-l))) tmp = 0.0 if ((t_1 <= Float64(-Inf)) || !(t_1 <= 0.05)) tmp = Float64(Float64(Float64(J * t_1) * t_0) + U); else tmp = Float64(U + Float64(t_0 * Float64(J * Float64(Float64(0.3333333333333333 * (l ^ 3.0)) + Float64(Float64(l * 2.0) + Float64(0.016666666666666666 * (l ^ 5.0))))))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = cos((K / 2.0)); t_1 = exp(l) - exp(-l); tmp = 0.0; if ((t_1 <= -Inf) || ~((t_1 <= 0.05))) tmp = ((J * t_1) * t_0) + U; else tmp = U + (t_0 * (J * ((0.3333333333333333 * (l ^ 3.0)) + ((l * 2.0) + (0.016666666666666666 * (l ^ 5.0)))))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, (-Infinity)], N[Not[LessEqual[t$95$1, 0.05]], $MachinePrecision]], N[(N[(N[(J * t$95$1), $MachinePrecision] * t$95$0), $MachinePrecision] + U), $MachinePrecision], N[(U + N[(t$95$0 * N[(J * N[(N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision] + N[(N[(l * 2.0), $MachinePrecision] + N[(0.016666666666666666 * N[Power[l, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
t_1 := e^{\ell} - e^{-\ell}\\
\mathbf{if}\;t_1 \leq -\infty \lor \neg \left(t_1 \leq 0.05\right):\\
\;\;\;\;\left(J \cdot t_1\right) \cdot t_0 + U\\
\mathbf{else}:\\
\;\;\;\;U + t_0 \cdot \left(J \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + \left(\ell \cdot 2 + 0.016666666666666666 \cdot {\ell}^{5}\right)\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -inf.0 or 0.050000000000000003 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 100.0%
if -inf.0 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 0.050000000000000003Initial program 74.1%
Taylor expanded in l around 0 99.8%
Final simplification99.9%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))) (t_1 (- (exp l) (exp (- l)))))
(if (or (<= t_1 (- INFINITY)) (not (<= t_1 0.002)))
(+ (* (* J t_1) t_0) U)
(+ U (* t_0 (* l (* J (fma 0.3333333333333333 (* l l) 2.0))))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double t_1 = exp(l) - exp(-l);
double tmp;
if ((t_1 <= -((double) INFINITY)) || !(t_1 <= 0.002)) {
tmp = ((J * t_1) * t_0) + U;
} else {
tmp = U + (t_0 * (l * (J * fma(0.3333333333333333, (l * l), 2.0))));
}
return tmp;
}
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) t_1 = Float64(exp(l) - exp(Float64(-l))) tmp = 0.0 if ((t_1 <= Float64(-Inf)) || !(t_1 <= 0.002)) tmp = Float64(Float64(Float64(J * t_1) * t_0) + U); else tmp = Float64(U + Float64(t_0 * Float64(l * Float64(J * fma(0.3333333333333333, Float64(l * l), 2.0))))); end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, (-Infinity)], N[Not[LessEqual[t$95$1, 0.002]], $MachinePrecision]], N[(N[(N[(J * t$95$1), $MachinePrecision] * t$95$0), $MachinePrecision] + U), $MachinePrecision], N[(U + N[(t$95$0 * N[(l * N[(J * N[(0.3333333333333333 * N[(l * l), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
t_1 := e^{\ell} - e^{-\ell}\\
\mathbf{if}\;t_1 \leq -\infty \lor \neg \left(t_1 \leq 0.002\right):\\
\;\;\;\;\left(J \cdot t_1\right) \cdot t_0 + U\\
\mathbf{else}:\\
\;\;\;\;U + t_0 \cdot \left(\ell \cdot \left(J \cdot \mathsf{fma}\left(0.3333333333333333, \ell \cdot \ell, 2\right)\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -inf.0 or 2e-3 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 99.9%
if -inf.0 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 2e-3Initial program 74.0%
Taylor expanded in l around 0 99.9%
Taylor expanded in l around 0 99.8%
associate-*r*99.8%
associate-*r*99.8%
distribute-rgt-out99.8%
*-commutative99.8%
*-commutative99.8%
cube-mult99.8%
associate-*l*99.8%
distribute-lft-out99.8%
Simplified99.8%
Taylor expanded in J around 0 99.8%
*-commutative99.8%
+-commutative99.8%
unpow299.8%
fma-udef99.8%
Simplified99.8%
Final simplification99.9%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= t_0 0.988)
(+ U (* t_0 (+ (* 2.0 (* J l)) (* 0.3333333333333333 (* J (pow l 3.0))))))
(+ U (* J (* 2.0 (sinh l)))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double tmp;
if (t_0 <= 0.988) {
tmp = U + (t_0 * ((2.0 * (J * l)) + (0.3333333333333333 * (J * pow(l, 3.0)))));
} else {
tmp = U + (J * (2.0 * sinh(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) :: tmp
t_0 = cos((k / 2.0d0))
if (t_0 <= 0.988d0) then
tmp = u + (t_0 * ((2.0d0 * (j * l)) + (0.3333333333333333d0 * (j * (l ** 3.0d0)))))
else
tmp = u + (j * (2.0d0 * sinh(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 tmp;
if (t_0 <= 0.988) {
tmp = U + (t_0 * ((2.0 * (J * l)) + (0.3333333333333333 * (J * Math.pow(l, 3.0)))));
} else {
tmp = U + (J * (2.0 * Math.sinh(l)));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K / 2.0)) tmp = 0 if t_0 <= 0.988: tmp = U + (t_0 * ((2.0 * (J * l)) + (0.3333333333333333 * (J * math.pow(l, 3.0))))) else: tmp = U + (J * (2.0 * math.sinh(l))) return tmp
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) tmp = 0.0 if (t_0 <= 0.988) tmp = Float64(U + Float64(t_0 * Float64(Float64(2.0 * Float64(J * l)) + Float64(0.3333333333333333 * Float64(J * (l ^ 3.0)))))); else tmp = Float64(U + Float64(J * Float64(2.0 * sinh(l)))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = cos((K / 2.0)); tmp = 0.0; if (t_0 <= 0.988) tmp = U + (t_0 * ((2.0 * (J * l)) + (0.3333333333333333 * (J * (l ^ 3.0))))); else tmp = U + (J * (2.0 * sinh(l))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, 0.988], N[(U + N[(t$95$0 * N[(N[(2.0 * N[(J * l), $MachinePrecision]), $MachinePrecision] + N[(0.3333333333333333 * N[(J * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * N[(2.0 * N[Sinh[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;t_0 \leq 0.988:\\
\;\;\;\;U + t_0 \cdot \left(2 \cdot \left(J \cdot \ell\right) + 0.3333333333333333 \cdot \left(J \cdot {\ell}^{3}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(2 \cdot \sinh \ell\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K 2)) < 0.98799999999999999Initial program 83.4%
Taylor expanded in l around 0 92.0%
if 0.98799999999999999 < (cos.f64 (/.f64 K 2)) Initial program 90.1%
Taylor expanded in K around 0 90.1%
expm1-log1p-u63.3%
expm1-udef63.3%
*-commutative63.3%
sinh-undef63.7%
Applied egg-rr63.7%
expm1-def68.2%
expm1-log1p100.0%
Simplified100.0%
Final simplification96.0%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= t_0 0.988)
(+ U (* t_0 (* J (+ (* l 2.0) (* l (* 0.3333333333333333 (* l l)))))))
(+ U (* J (* 2.0 (sinh l)))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double tmp;
if (t_0 <= 0.988) {
tmp = U + (t_0 * (J * ((l * 2.0) + (l * (0.3333333333333333 * (l * l))))));
} else {
tmp = U + (J * (2.0 * sinh(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) :: tmp
t_0 = cos((k / 2.0d0))
if (t_0 <= 0.988d0) then
tmp = u + (t_0 * (j * ((l * 2.0d0) + (l * (0.3333333333333333d0 * (l * l))))))
else
tmp = u + (j * (2.0d0 * sinh(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 tmp;
if (t_0 <= 0.988) {
tmp = U + (t_0 * (J * ((l * 2.0) + (l * (0.3333333333333333 * (l * l))))));
} else {
tmp = U + (J * (2.0 * Math.sinh(l)));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K / 2.0)) tmp = 0 if t_0 <= 0.988: tmp = U + (t_0 * (J * ((l * 2.0) + (l * (0.3333333333333333 * (l * l)))))) else: tmp = U + (J * (2.0 * math.sinh(l))) return tmp
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) tmp = 0.0 if (t_0 <= 0.988) tmp = Float64(U + Float64(t_0 * Float64(J * Float64(Float64(l * 2.0) + Float64(l * Float64(0.3333333333333333 * Float64(l * l))))))); else tmp = Float64(U + Float64(J * Float64(2.0 * sinh(l)))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = cos((K / 2.0)); tmp = 0.0; if (t_0 <= 0.988) tmp = U + (t_0 * (J * ((l * 2.0) + (l * (0.3333333333333333 * (l * l)))))); else tmp = U + (J * (2.0 * sinh(l))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, 0.988], N[(U + N[(t$95$0 * N[(J * N[(N[(l * 2.0), $MachinePrecision] + N[(l * N[(0.3333333333333333 * N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * N[(2.0 * N[Sinh[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;t_0 \leq 0.988:\\
\;\;\;\;U + t_0 \cdot \left(J \cdot \left(\ell \cdot 2 + \ell \cdot \left(0.3333333333333333 \cdot \left(\ell \cdot \ell\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(2 \cdot \sinh \ell\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K 2)) < 0.98799999999999999Initial program 83.4%
Taylor expanded in l around 0 96.8%
Taylor expanded in l around 0 92.0%
associate-*r*92.0%
associate-*r*92.0%
distribute-rgt-out92.0%
*-commutative92.0%
*-commutative92.0%
cube-mult92.0%
associate-*l*92.0%
distribute-lft-out92.0%
Simplified92.0%
distribute-rgt-in92.0%
*-commutative92.0%
*-commutative92.0%
Applied egg-rr92.0%
if 0.98799999999999999 < (cos.f64 (/.f64 K 2)) Initial program 90.1%
Taylor expanded in K around 0 90.1%
expm1-log1p-u63.3%
expm1-udef63.3%
*-commutative63.3%
sinh-undef63.7%
Applied egg-rr63.7%
expm1-def68.2%
expm1-log1p100.0%
Simplified100.0%
Final simplification96.0%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= t_0 0.988)
(+ U (* t_0 (* J (* l (+ 2.0 (* 0.3333333333333333 (* l l)))))))
(+ U (* J (* 2.0 (sinh l)))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double tmp;
if (t_0 <= 0.988) {
tmp = U + (t_0 * (J * (l * (2.0 + (0.3333333333333333 * (l * l))))));
} else {
tmp = U + (J * (2.0 * sinh(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) :: tmp
t_0 = cos((k / 2.0d0))
if (t_0 <= 0.988d0) then
tmp = u + (t_0 * (j * (l * (2.0d0 + (0.3333333333333333d0 * (l * l))))))
else
tmp = u + (j * (2.0d0 * sinh(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 tmp;
if (t_0 <= 0.988) {
tmp = U + (t_0 * (J * (l * (2.0 + (0.3333333333333333 * (l * l))))));
} else {
tmp = U + (J * (2.0 * Math.sinh(l)));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K / 2.0)) tmp = 0 if t_0 <= 0.988: tmp = U + (t_0 * (J * (l * (2.0 + (0.3333333333333333 * (l * l)))))) else: tmp = U + (J * (2.0 * math.sinh(l))) return tmp
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) tmp = 0.0 if (t_0 <= 0.988) tmp = Float64(U + Float64(t_0 * Float64(J * Float64(l * Float64(2.0 + Float64(0.3333333333333333 * Float64(l * l))))))); else tmp = Float64(U + Float64(J * Float64(2.0 * sinh(l)))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = cos((K / 2.0)); tmp = 0.0; if (t_0 <= 0.988) tmp = U + (t_0 * (J * (l * (2.0 + (0.3333333333333333 * (l * l)))))); else tmp = U + (J * (2.0 * sinh(l))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, 0.988], N[(U + N[(t$95$0 * N[(J * N[(l * N[(2.0 + N[(0.3333333333333333 * N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * N[(2.0 * N[Sinh[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;t_0 \leq 0.988:\\
\;\;\;\;U + t_0 \cdot \left(J \cdot \left(\ell \cdot \left(2 + 0.3333333333333333 \cdot \left(\ell \cdot \ell\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(2 \cdot \sinh \ell\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K 2)) < 0.98799999999999999Initial program 83.4%
Taylor expanded in l around 0 96.8%
Taylor expanded in l around 0 92.0%
associate-*r*92.0%
associate-*r*92.0%
distribute-rgt-out92.0%
*-commutative92.0%
*-commutative92.0%
cube-mult92.0%
associate-*l*92.0%
distribute-lft-out92.0%
Simplified92.0%
if 0.98799999999999999 < (cos.f64 (/.f64 K 2)) Initial program 90.1%
Taylor expanded in K around 0 90.1%
expm1-log1p-u63.3%
expm1-udef63.3%
*-commutative63.3%
sinh-undef63.7%
Applied egg-rr63.7%
expm1-def68.2%
expm1-log1p100.0%
Simplified100.0%
Final simplification96.0%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= t_0 -0.02)
(+ U (* t_0 (* l (* J 2.0))))
(+ U (* J (* 2.0 (sinh l)))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double tmp;
if (t_0 <= -0.02) {
tmp = U + (t_0 * (l * (J * 2.0)));
} else {
tmp = U + (J * (2.0 * sinh(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) :: tmp
t_0 = cos((k / 2.0d0))
if (t_0 <= (-0.02d0)) then
tmp = u + (t_0 * (l * (j * 2.0d0)))
else
tmp = u + (j * (2.0d0 * sinh(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 tmp;
if (t_0 <= -0.02) {
tmp = U + (t_0 * (l * (J * 2.0)));
} else {
tmp = U + (J * (2.0 * Math.sinh(l)));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K / 2.0)) tmp = 0 if t_0 <= -0.02: tmp = U + (t_0 * (l * (J * 2.0))) else: tmp = U + (J * (2.0 * math.sinh(l))) return tmp
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) tmp = 0.0 if (t_0 <= -0.02) tmp = Float64(U + Float64(t_0 * Float64(l * Float64(J * 2.0)))); else tmp = Float64(U + Float64(J * Float64(2.0 * sinh(l)))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = cos((K / 2.0)); tmp = 0.0; if (t_0 <= -0.02) tmp = U + (t_0 * (l * (J * 2.0))); else tmp = U + (J * (2.0 * sinh(l))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, -0.02], N[(U + N[(t$95$0 * N[(l * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * N[(2.0 * N[Sinh[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;t_0 \leq -0.02:\\
\;\;\;\;U + t_0 \cdot \left(\ell \cdot \left(J \cdot 2\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(2 \cdot \sinh \ell\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K 2)) < -0.0200000000000000004Initial program 80.1%
Taylor expanded in l around 0 67.4%
associate-*r*67.4%
*-commutative67.4%
associate-*l*67.4%
Simplified67.4%
if -0.0200000000000000004 < (cos.f64 (/.f64 K 2)) Initial program 89.1%
Taylor expanded in K around 0 88.1%
expm1-log1p-u59.5%
expm1-udef59.3%
*-commutative59.3%
sinh-undef59.1%
Applied egg-rr59.1%
expm1-def62.6%
expm1-log1p95.4%
Simplified95.4%
Final simplification88.1%
(FPCore (J l K U) :precision binary64 (+ U (* J (* 2.0 (sinh l)))))
double code(double J, double l, double K, double U) {
return U + (J * (2.0 * sinh(l)));
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = u + (j * (2.0d0 * sinh(l)))
end function
public static double code(double J, double l, double K, double U) {
return U + (J * (2.0 * Math.sinh(l)));
}
def code(J, l, K, U): return U + (J * (2.0 * math.sinh(l)))
function code(J, l, K, U) return Float64(U + Float64(J * Float64(2.0 * sinh(l)))) end
function tmp = code(J, l, K, U) tmp = U + (J * (2.0 * sinh(l))); end
code[J_, l_, K_, U_] := N[(U + N[(J * N[(2.0 * N[Sinh[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + J \cdot \left(2 \cdot \sinh \ell\right)
\end{array}
Initial program 86.7%
Taylor expanded in K around 0 72.7%
expm1-log1p-u51.5%
expm1-udef51.4%
*-commutative51.4%
sinh-undef50.4%
Applied egg-rr50.4%
expm1-def53.0%
expm1-log1p78.0%
Simplified78.0%
Final simplification78.0%
(FPCore (J l K U) :precision binary64 (+ U (* J (* l 2.0))))
double code(double J, double l, double K, double U) {
return U + (J * (l * 2.0));
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = u + (j * (l * 2.0d0))
end function
public static double code(double J, double l, double K, double U) {
return U + (J * (l * 2.0));
}
def code(J, l, K, U): return U + (J * (l * 2.0))
function code(J, l, K, U) return Float64(U + Float64(J * Float64(l * 2.0))) end
function tmp = code(J, l, K, U) tmp = U + (J * (l * 2.0)); end
code[J_, l_, K_, U_] := N[(U + N[(J * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + J \cdot \left(\ell \cdot 2\right)
\end{array}
Initial program 86.7%
Taylor expanded in K around 0 72.7%
Taylor expanded in l around 0 56.1%
Final simplification56.1%
(FPCore (J l K U) :precision binary64 (if (<= l -2.85e+51) (* U U) U))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -2.85e+51) {
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 <= (-2.85d+51)) 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 <= -2.85e+51) {
tmp = U * U;
} else {
tmp = U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -2.85e+51: tmp = U * U else: tmp = U return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -2.85e+51) tmp = Float64(U * U); else tmp = U; end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -2.85e+51) tmp = U * U; else tmp = U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -2.85e+51], N[(U * U), $MachinePrecision], U]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2.85 \cdot 10^{+51}:\\
\;\;\;\;U \cdot U\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\end{array}
if l < -2.8500000000000001e51Initial program 100.0%
associate-*l*100.0%
fma-def100.0%
Simplified100.0%
Applied egg-rr27.8%
if -2.8500000000000001e51 < l Initial program 84.2%
associate-*l*84.2%
fma-def84.2%
Simplified84.2%
Taylor expanded in J around 0 43.9%
Final simplification41.3%
(FPCore (J l K U) :precision binary64 1.0)
double code(double J, double l, double K, double U) {
return 1.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 = 1.0d0
end function
public static double code(double J, double l, double K, double U) {
return 1.0;
}
def code(J, l, K, U): return 1.0
function code(J, l, K, U) return 1.0 end
function tmp = code(J, l, K, U) tmp = 1.0; end
code[J_, l_, K_, U_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 86.7%
associate-*l*86.7%
fma-def86.7%
Simplified86.7%
Applied egg-rr2.6%
*-inverses2.6%
Simplified2.6%
Final simplification2.6%
(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.7%
associate-*l*86.7%
fma-def86.7%
Simplified86.7%
Taylor expanded in J around 0 37.2%
Final simplification37.2%
herbie shell --seed 2023182
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))