
(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 18 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 -100000.0)
(+ (* t_0 (* J (cos (* 0.5 K)))) U)
(if (<= t_0 0.0) (fma J (* (* l 2.0) t_1) U) (+ 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 <= -100000.0) {
tmp = (t_0 * (J * cos((0.5 * K)))) + U;
} else if (t_0 <= 0.0) {
tmp = fma(J, ((l * 2.0) * t_1), U);
} 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 <= -100000.0) tmp = Float64(Float64(t_0 * Float64(J * cos(Float64(0.5 * K)))) + U); elseif (t_0 <= 0.0) tmp = fma(J, Float64(Float64(l * 2.0) * t_1), U); else tmp = Float64(U + Float64(t_1 * Float64(t_0 * J))); end return 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, -100000.0], 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.0], N[(J * N[(N[(l * 2.0), $MachinePrecision] * t$95$1), $MachinePrecision] + U), $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 -100000:\\
\;\;\;\;t_0 \cdot \left(J \cdot \cos \left(0.5 \cdot K\right)\right) + U\\
\mathbf{elif}\;t_0 \leq 0:\\
\;\;\;\;\mathsf{fma}\left(J, \left(\ell \cdot 2\right) \cdot t_1, U\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))) < -1e5Initial program 100.0%
Taylor expanded in J around 0 100.0%
associate-*r*100.0%
*-commutative100.0%
Simplified100.0%
if -1e5 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 0.0Initial program 71.3%
associate-*l*71.3%
fma-def71.3%
Simplified71.3%
Taylor expanded in l around 0 99.9%
if 0.0 < (-.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 -100000.0) (not (<= t_1 0.0)))
(+ U (* t_0 (* t_1 J)))
(fma J (* (* l 2.0) t_0) U))))
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 <= -100000.0) || !(t_1 <= 0.0)) {
tmp = U + (t_0 * (t_1 * J));
} else {
tmp = fma(J, ((l * 2.0) * t_0), U);
}
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 <= -100000.0) || !(t_1 <= 0.0)) tmp = Float64(U + Float64(t_0 * Float64(t_1 * J))); else tmp = fma(J, Float64(Float64(l * 2.0) * t_0), U); 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, -100000.0], N[Not[LessEqual[t$95$1, 0.0]], $MachinePrecision]], N[(U + N[(t$95$0 * N[(t$95$1 * J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(J * N[(N[(l * 2.0), $MachinePrecision] * t$95$0), $MachinePrecision] + U), $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 -100000 \lor \neg \left(t_1 \leq 0\right):\\
\;\;\;\;U + t_0 \cdot \left(t_1 \cdot J\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(J, \left(\ell \cdot 2\right) \cdot t_0, U\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -1e5 or 0.0 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 100.0%
if -1e5 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 0.0Initial program 71.3%
associate-*l*71.3%
fma-def71.3%
Simplified71.3%
Taylor expanded in l around 0 99.9%
Final simplification100.0%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (- (exp l) (exp (- l)))))
(if (or (<= t_0 -100000.0) (not (<= t_0 0.0)))
(+ U (* t_0 J))
(+ 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);
double tmp;
if ((t_0 <= -100000.0) || !(t_0 <= 0.0)) {
tmp = U + (t_0 * J);
} 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)
if ((t_0 <= (-100000.0d0)) .or. (.not. (t_0 <= 0.0d0))) then
tmp = u + (t_0 * j)
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);
double tmp;
if ((t_0 <= -100000.0) || !(t_0 <= 0.0)) {
tmp = U + (t_0 * J);
} 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) tmp = 0 if (t_0 <= -100000.0) or not (t_0 <= 0.0): tmp = U + (t_0 * J) else: tmp = U + (2.0 * (J * (l * math.cos((0.5 * K))))) return tmp
function code(J, l, K, U) t_0 = Float64(exp(l) - exp(Float64(-l))) tmp = 0.0 if ((t_0 <= -100000.0) || !(t_0 <= 0.0)) tmp = Float64(U + Float64(t_0 * J)); 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); tmp = 0.0; if ((t_0 <= -100000.0) || ~((t_0 <= 0.0))) tmp = U + (t_0 * J); 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[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, -100000.0], N[Not[LessEqual[t$95$0, 0.0]], $MachinePrecision]], N[(U + N[(t$95$0 * J), $MachinePrecision]), $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 := e^{\ell} - e^{-\ell}\\
\mathbf{if}\;t_0 \leq -100000 \lor \neg \left(t_0 \leq 0\right):\\
\;\;\;\;U + t_0 \cdot J\\
\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 (exp.f64 l) (exp.f64 (neg.f64 l))) < -1e5 or 0.0 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 100.0%
Taylor expanded in K around 0 74.6%
if -1e5 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 0.0Initial program 71.3%
Taylor expanded in l around 0 99.9%
Final simplification86.6%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= t_0 -0.92)
(+ U (* 2.0 (* J (* l (cos (* 0.5 K))))))
(if (<= t_0 -0.02)
(+ U (* (* J (* K K)) (* l -0.25)))
(+ U (* J (+ (* l 2.0) (* 0.3333333333333333 (pow l 3.0)))))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double tmp;
if (t_0 <= -0.92) {
tmp = U + (2.0 * (J * (l * cos((0.5 * K)))));
} else if (t_0 <= -0.02) {
tmp = U + ((J * (K * K)) * (l * -0.25));
} else {
tmp = U + (J * ((l * 2.0) + (0.3333333333333333 * pow(l, 3.0))));
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: t_0
real(8) :: tmp
t_0 = cos((k / 2.0d0))
if (t_0 <= (-0.92d0)) then
tmp = u + (2.0d0 * (j * (l * cos((0.5d0 * k)))))
else if (t_0 <= (-0.02d0)) then
tmp = u + ((j * (k * k)) * (l * (-0.25d0)))
else
tmp = u + (j * ((l * 2.0d0) + (0.3333333333333333d0 * (l ** 3.0d0))))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = Math.cos((K / 2.0));
double tmp;
if (t_0 <= -0.92) {
tmp = U + (2.0 * (J * (l * Math.cos((0.5 * K)))));
} else if (t_0 <= -0.02) {
tmp = U + ((J * (K * K)) * (l * -0.25));
} else {
tmp = U + (J * ((l * 2.0) + (0.3333333333333333 * Math.pow(l, 3.0))));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K / 2.0)) tmp = 0 if t_0 <= -0.92: tmp = U + (2.0 * (J * (l * math.cos((0.5 * K))))) elif t_0 <= -0.02: tmp = U + ((J * (K * K)) * (l * -0.25)) else: tmp = U + (J * ((l * 2.0) + (0.3333333333333333 * math.pow(l, 3.0)))) return tmp
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) tmp = 0.0 if (t_0 <= -0.92) tmp = Float64(U + Float64(2.0 * Float64(J * Float64(l * cos(Float64(0.5 * K)))))); elseif (t_0 <= -0.02) tmp = Float64(U + Float64(Float64(J * Float64(K * K)) * Float64(l * -0.25))); else tmp = Float64(U + Float64(J * Float64(Float64(l * 2.0) + Float64(0.3333333333333333 * (l ^ 3.0))))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = cos((K / 2.0)); tmp = 0.0; if (t_0 <= -0.92) tmp = U + (2.0 * (J * (l * cos((0.5 * K))))); elseif (t_0 <= -0.02) tmp = U + ((J * (K * K)) * (l * -0.25)); else tmp = U + (J * ((l * 2.0) + (0.3333333333333333 * (l ^ 3.0)))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, -0.92], N[(U + N[(2.0 * N[(J * N[(l * N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, -0.02], N[(U + N[(N[(J * N[(K * K), $MachinePrecision]), $MachinePrecision] * N[(l * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * N[(N[(l * 2.0), $MachinePrecision] + N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;t_0 \leq -0.92:\\
\;\;\;\;U + 2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(0.5 \cdot K\right)\right)\right)\\
\mathbf{elif}\;t_0 \leq -0.02:\\
\;\;\;\;U + \left(J \cdot \left(K \cdot K\right)\right) \cdot \left(\ell \cdot -0.25\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(\ell \cdot 2 + 0.3333333333333333 \cdot {\ell}^{3}\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K 2)) < -0.92000000000000004Initial program 100.0%
Taylor expanded in l around 0 61.2%
if -0.92000000000000004 < (cos.f64 (/.f64 K 2)) < -0.0200000000000000004Initial program 88.2%
Taylor expanded in l around 0 55.9%
Taylor expanded in K around 0 55.0%
associate-*r*55.0%
associate-*r*55.0%
associate-*r*55.0%
distribute-rgt-out69.7%
*-commutative69.7%
associate-*r*69.7%
distribute-rgt-out69.7%
unpow269.7%
Simplified69.7%
Taylor expanded in K around inf 69.7%
*-commutative69.7%
associate-*r*69.7%
associate-*l*69.7%
unpow269.7%
Simplified69.7%
if -0.0200000000000000004 < (cos.f64 (/.f64 K 2)) Initial program 84.7%
Taylor expanded in J around 0 84.7%
associate-*r*84.7%
*-commutative84.7%
Simplified84.7%
Taylor expanded in K around 0 84.0%
Taylor expanded in l around 0 81.3%
Final simplification77.9%
(FPCore (J l K U)
:precision binary64
(if (<= l -5e+176)
(+ U (* 0.3333333333333333 (* J (pow l 3.0))))
(if (or (<= l -3.3) (not (<= l 3e-14)))
(+ U (* (- (exp l) (exp (- l))) (+ J (* J (* K (* K -0.125))))))
(fma J (* (* l 2.0) (cos (/ K 2.0))) U))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -5e+176) {
tmp = U + (0.3333333333333333 * (J * pow(l, 3.0)));
} else if ((l <= -3.3) || !(l <= 3e-14)) {
tmp = U + ((exp(l) - exp(-l)) * (J + (J * (K * (K * -0.125)))));
} else {
tmp = fma(J, ((l * 2.0) * cos((K / 2.0))), U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (l <= -5e+176) tmp = Float64(U + Float64(0.3333333333333333 * Float64(J * (l ^ 3.0)))); elseif ((l <= -3.3) || !(l <= 3e-14)) tmp = Float64(U + Float64(Float64(exp(l) - exp(Float64(-l))) * Float64(J + Float64(J * Float64(K * Float64(K * -0.125)))))); else tmp = fma(J, Float64(Float64(l * 2.0) * cos(Float64(K / 2.0))), U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[l, -5e+176], N[(U + N[(0.3333333333333333 * N[(J * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[l, -3.3], N[Not[LessEqual[l, 3e-14]], $MachinePrecision]], N[(U + N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * N[(J + N[(J * N[(K * N[(K * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(J * N[(N[(l * 2.0), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -5 \cdot 10^{+176}:\\
\;\;\;\;U + 0.3333333333333333 \cdot \left(J \cdot {\ell}^{3}\right)\\
\mathbf{elif}\;\ell \leq -3.3 \lor \neg \left(\ell \leq 3 \cdot 10^{-14}\right):\\
\;\;\;\;U + \left(e^{\ell} - e^{-\ell}\right) \cdot \left(J + J \cdot \left(K \cdot \left(K \cdot -0.125\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(J, \left(\ell \cdot 2\right) \cdot \cos \left(\frac{K}{2}\right), U\right)\\
\end{array}
\end{array}
if l < -5e176Initial program 100.0%
Taylor expanded in J around 0 100.0%
associate-*r*100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in K around 0 95.8%
Taylor expanded in l around 0 95.8%
Taylor expanded in l around inf 95.8%
if -5e176 < l < -3.2999999999999998 or 2.9999999999999998e-14 < l Initial program 100.0%
Taylor expanded in K around 0 3.5%
+-commutative3.5%
associate-*r*3.5%
associate-*r*3.5%
distribute-rgt-out81.9%
associate-*r*81.9%
*-commutative81.9%
associate-*l*81.9%
*-commutative81.9%
unpow281.9%
associate-*l*81.9%
Simplified81.9%
if -3.2999999999999998 < l < 2.9999999999999998e-14Initial program 71.3%
associate-*l*71.3%
fma-def71.3%
Simplified71.3%
Taylor expanded in l around 0 99.9%
Final simplification91.7%
(FPCore (J l K U) :precision binary64 (if (or (<= l -0.0009) (not (<= l 2.3e-31))) (+ U (* (- (exp l) (exp (- l))) J)) (fma J (* (* l 2.0) (cos (/ K 2.0))) U)))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -0.0009) || !(l <= 2.3e-31)) {
tmp = U + ((exp(l) - exp(-l)) * J);
} else {
tmp = fma(J, ((l * 2.0) * cos((K / 2.0))), U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if ((l <= -0.0009) || !(l <= 2.3e-31)) tmp = Float64(U + Float64(Float64(exp(l) - exp(Float64(-l))) * J)); else tmp = fma(J, Float64(Float64(l * 2.0) * cos(Float64(K / 2.0))), U); end return tmp end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -0.0009], N[Not[LessEqual[l, 2.3e-31]], $MachinePrecision]], N[(U + N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision]), $MachinePrecision], N[(J * N[(N[(l * 2.0), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -0.0009 \lor \neg \left(\ell \leq 2.3 \cdot 10^{-31}\right):\\
\;\;\;\;U + \left(e^{\ell} - e^{-\ell}\right) \cdot J\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(J, \left(\ell \cdot 2\right) \cdot \cos \left(\frac{K}{2}\right), U\right)\\
\end{array}
\end{array}
if l < -8.9999999999999998e-4 or 2.2999999999999998e-31 < l Initial program 100.0%
Taylor expanded in K around 0 75.0%
if -8.9999999999999998e-4 < l < 2.2999999999999998e-31Initial program 70.9%
associate-*l*70.9%
fma-def70.9%
Simplified70.9%
Taylor expanded in l around 0 99.9%
Final simplification86.6%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (+ U (* 0.3333333333333333 (* J (pow l 3.0))))))
(if (<= l -1.55e+55)
t_0
(if (<= l -7.5e+20)
(+ U (* l (* J (+ 2.0 (* (* K K) -0.25)))))
(if (<= l -1300000000.0)
(+ U (* J (+ 512.0 (* K (* K -64.0)))))
(if (<= l 2.3e-31) (+ U (* 2.0 (* J (* l (cos (* 0.5 K)))))) t_0))))))
double code(double J, double l, double K, double U) {
double t_0 = U + (0.3333333333333333 * (J * pow(l, 3.0)));
double tmp;
if (l <= -1.55e+55) {
tmp = t_0;
} else if (l <= -7.5e+20) {
tmp = U + (l * (J * (2.0 + ((K * K) * -0.25))));
} else if (l <= -1300000000.0) {
tmp = U + (J * (512.0 + (K * (K * -64.0))));
} else if (l <= 2.3e-31) {
tmp = U + (2.0 * (J * (l * cos((0.5 * K)))));
} 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 + (0.3333333333333333d0 * (j * (l ** 3.0d0)))
if (l <= (-1.55d+55)) then
tmp = t_0
else if (l <= (-7.5d+20)) then
tmp = u + (l * (j * (2.0d0 + ((k * k) * (-0.25d0)))))
else if (l <= (-1300000000.0d0)) then
tmp = u + (j * (512.0d0 + (k * (k * (-64.0d0)))))
else if (l <= 2.3d-31) then
tmp = u + (2.0d0 * (j * (l * cos((0.5d0 * k)))))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = U + (0.3333333333333333 * (J * Math.pow(l, 3.0)));
double tmp;
if (l <= -1.55e+55) {
tmp = t_0;
} else if (l <= -7.5e+20) {
tmp = U + (l * (J * (2.0 + ((K * K) * -0.25))));
} else if (l <= -1300000000.0) {
tmp = U + (J * (512.0 + (K * (K * -64.0))));
} else if (l <= 2.3e-31) {
tmp = U + (2.0 * (J * (l * Math.cos((0.5 * K)))));
} else {
tmp = t_0;
}
return tmp;
}
def code(J, l, K, U): t_0 = U + (0.3333333333333333 * (J * math.pow(l, 3.0))) tmp = 0 if l <= -1.55e+55: tmp = t_0 elif l <= -7.5e+20: tmp = U + (l * (J * (2.0 + ((K * K) * -0.25)))) elif l <= -1300000000.0: tmp = U + (J * (512.0 + (K * (K * -64.0)))) elif l <= 2.3e-31: tmp = U + (2.0 * (J * (l * math.cos((0.5 * K))))) else: tmp = t_0 return tmp
function code(J, l, K, U) t_0 = Float64(U + Float64(0.3333333333333333 * Float64(J * (l ^ 3.0)))) tmp = 0.0 if (l <= -1.55e+55) tmp = t_0; elseif (l <= -7.5e+20) tmp = Float64(U + Float64(l * Float64(J * Float64(2.0 + Float64(Float64(K * K) * -0.25))))); elseif (l <= -1300000000.0) tmp = Float64(U + Float64(J * Float64(512.0 + Float64(K * Float64(K * -64.0))))); elseif (l <= 2.3e-31) tmp = Float64(U + Float64(2.0 * Float64(J * Float64(l * cos(Float64(0.5 * K)))))); else tmp = t_0; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = U + (0.3333333333333333 * (J * (l ^ 3.0))); tmp = 0.0; if (l <= -1.55e+55) tmp = t_0; elseif (l <= -7.5e+20) tmp = U + (l * (J * (2.0 + ((K * K) * -0.25)))); elseif (l <= -1300000000.0) tmp = U + (J * (512.0 + (K * (K * -64.0)))); elseif (l <= 2.3e-31) tmp = U + (2.0 * (J * (l * cos((0.5 * K))))); else tmp = t_0; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(U + N[(0.3333333333333333 * N[(J * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -1.55e+55], t$95$0, If[LessEqual[l, -7.5e+20], N[(U + N[(l * N[(J * N[(2.0 + N[(N[(K * K), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -1300000000.0], N[(U + N[(J * N[(512.0 + N[(K * N[(K * -64.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.3e-31], N[(U + N[(2.0 * N[(J * N[(l * N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + 0.3333333333333333 \cdot \left(J \cdot {\ell}^{3}\right)\\
\mathbf{if}\;\ell \leq -1.55 \cdot 10^{+55}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq -7.5 \cdot 10^{+20}:\\
\;\;\;\;U + \ell \cdot \left(J \cdot \left(2 + \left(K \cdot K\right) \cdot -0.25\right)\right)\\
\mathbf{elif}\;\ell \leq -1300000000:\\
\;\;\;\;U + J \cdot \left(512 + K \cdot \left(K \cdot -64\right)\right)\\
\mathbf{elif}\;\ell \leq 2.3 \cdot 10^{-31}:\\
\;\;\;\;U + 2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(0.5 \cdot K\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if l < -1.54999999999999997e55 or 2.2999999999999998e-31 < l Initial program 100.0%
Taylor expanded in J around 0 100.0%
associate-*r*100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in K around 0 77.8%
Taylor expanded in l around 0 62.7%
Taylor expanded in l around inf 62.7%
if -1.54999999999999997e55 < l < -7.5e20Initial program 100.0%
Taylor expanded in l around 0 2.5%
Taylor expanded in K around 0 38.9%
associate-*r*38.9%
associate-*r*38.9%
associate-*r*38.9%
distribute-rgt-out38.9%
*-commutative38.9%
associate-*r*38.9%
distribute-rgt-out38.9%
unpow238.9%
Simplified38.9%
if -7.5e20 < l < -1.3e9Initial program 100.0%
Applied egg-rr3.8%
Taylor expanded in K around 0 68.4%
+-commutative68.4%
*-commutative68.4%
associate-*r*68.4%
distribute-rgt-out68.4%
*-commutative68.4%
unpow268.4%
associate-*l*68.4%
Simplified68.4%
if -1.3e9 < l < 2.2999999999999998e-31Initial program 72.3%
Taylor expanded in l around 0 95.5%
Final simplification77.7%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (+ U (* 0.3333333333333333 (* J (pow l 3.0))))))
(if (<= l -1.6e+55)
t_0
(if (<= l -1.46e+20)
(+ U (* l (* J (+ 2.0 (* (* K K) -0.25)))))
(if (<= l 2.3e-31) (fma (* J 2.0) l U) t_0)))))
double code(double J, double l, double K, double U) {
double t_0 = U + (0.3333333333333333 * (J * pow(l, 3.0)));
double tmp;
if (l <= -1.6e+55) {
tmp = t_0;
} else if (l <= -1.46e+20) {
tmp = U + (l * (J * (2.0 + ((K * K) * -0.25))));
} else if (l <= 2.3e-31) {
tmp = fma((J * 2.0), l, U);
} else {
tmp = t_0;
}
return tmp;
}
function code(J, l, K, U) t_0 = Float64(U + Float64(0.3333333333333333 * Float64(J * (l ^ 3.0)))) tmp = 0.0 if (l <= -1.6e+55) tmp = t_0; elseif (l <= -1.46e+20) tmp = Float64(U + Float64(l * Float64(J * Float64(2.0 + Float64(Float64(K * K) * -0.25))))); elseif (l <= 2.3e-31) tmp = fma(Float64(J * 2.0), l, U); else tmp = t_0; end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(U + N[(0.3333333333333333 * N[(J * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -1.6e+55], t$95$0, If[LessEqual[l, -1.46e+20], N[(U + N[(l * N[(J * N[(2.0 + N[(N[(K * K), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.3e-31], N[(N[(J * 2.0), $MachinePrecision] * l + U), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + 0.3333333333333333 \cdot \left(J \cdot {\ell}^{3}\right)\\
\mathbf{if}\;\ell \leq -1.6 \cdot 10^{+55}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq -1.46 \cdot 10^{+20}:\\
\;\;\;\;U + \ell \cdot \left(J \cdot \left(2 + \left(K \cdot K\right) \cdot -0.25\right)\right)\\
\mathbf{elif}\;\ell \leq 2.3 \cdot 10^{-31}:\\
\;\;\;\;\mathsf{fma}\left(J \cdot 2, \ell, U\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if l < -1.6000000000000001e55 or 2.2999999999999998e-31 < l Initial program 100.0%
Taylor expanded in J around 0 100.0%
associate-*r*100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in K around 0 77.8%
Taylor expanded in l around 0 62.7%
Taylor expanded in l around inf 62.7%
if -1.6000000000000001e55 < l < -1.46e20Initial program 100.0%
Taylor expanded in l around 0 2.5%
Taylor expanded in K around 0 38.9%
associate-*r*38.9%
associate-*r*38.9%
associate-*r*38.9%
distribute-rgt-out38.9%
*-commutative38.9%
associate-*r*38.9%
distribute-rgt-out38.9%
unpow238.9%
Simplified38.9%
if -1.46e20 < l < 2.2999999999999998e-31Initial program 72.9%
Taylor expanded in l around 0 93.3%
Taylor expanded in K around 0 84.5%
+-commutative84.5%
associate-*r*84.5%
fma-def84.5%
*-commutative84.5%
Simplified84.5%
Final simplification72.6%
(FPCore (J l K U)
:precision binary64
(if (<= l -8.4e+215)
(+ U (* 2.0 (* l J)))
(if (<= l -6e+152)
(* U U)
(if (<= l -1100.0)
(- -8.0 (* U U))
(if (<= l 2.45e+27)
(fma (* J 2.0) l U)
(+ U (* l (* J (+ 2.0 (* (* K K) -0.25))))))))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -8.4e+215) {
tmp = U + (2.0 * (l * J));
} else if (l <= -6e+152) {
tmp = U * U;
} else if (l <= -1100.0) {
tmp = -8.0 - (U * U);
} else if (l <= 2.45e+27) {
tmp = fma((J * 2.0), l, U);
} else {
tmp = U + (l * (J * (2.0 + ((K * K) * -0.25))));
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (l <= -8.4e+215) tmp = Float64(U + Float64(2.0 * Float64(l * J))); elseif (l <= -6e+152) tmp = Float64(U * U); elseif (l <= -1100.0) tmp = Float64(-8.0 - Float64(U * U)); elseif (l <= 2.45e+27) tmp = fma(Float64(J * 2.0), l, U); else tmp = Float64(U + Float64(l * Float64(J * Float64(2.0 + Float64(Float64(K * K) * -0.25))))); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[l, -8.4e+215], N[(U + N[(2.0 * N[(l * J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -6e+152], N[(U * U), $MachinePrecision], If[LessEqual[l, -1100.0], N[(-8.0 - N[(U * U), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.45e+27], N[(N[(J * 2.0), $MachinePrecision] * l + U), $MachinePrecision], N[(U + N[(l * N[(J * N[(2.0 + N[(N[(K * K), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -8.4 \cdot 10^{+215}:\\
\;\;\;\;U + 2 \cdot \left(\ell \cdot J\right)\\
\mathbf{elif}\;\ell \leq -6 \cdot 10^{+152}:\\
\;\;\;\;U \cdot U\\
\mathbf{elif}\;\ell \leq -1100:\\
\;\;\;\;-8 - U \cdot U\\
\mathbf{elif}\;\ell \leq 2.45 \cdot 10^{+27}:\\
\;\;\;\;\mathsf{fma}\left(J \cdot 2, \ell, U\right)\\
\mathbf{else}:\\
\;\;\;\;U + \ell \cdot \left(J \cdot \left(2 + \left(K \cdot K\right) \cdot -0.25\right)\right)\\
\end{array}
\end{array}
if l < -8.4000000000000007e215Initial program 100.0%
Taylor expanded in l around 0 57.3%
Taylor expanded in K around 0 57.3%
if -8.4000000000000007e215 < l < -5.99999999999999981e152Initial program 100.0%
Applied egg-rr64.5%
if -5.99999999999999981e152 < l < -1100Initial program 100.0%
associate-*l*100.0%
fma-def100.0%
Simplified100.0%
Applied egg-rr26.9%
cancel-sign-sub-inv26.9%
Simplified26.9%
if -1100 < l < 2.45000000000000007e27Initial program 73.5%
Taylor expanded in l around 0 94.3%
Taylor expanded in K around 0 85.8%
+-commutative85.8%
associate-*r*85.8%
fma-def85.8%
*-commutative85.8%
Simplified85.8%
if 2.45000000000000007e27 < l Initial program 100.0%
Taylor expanded in l around 0 26.8%
Taylor expanded in K around 0 34.1%
associate-*r*34.1%
associate-*r*34.1%
associate-*r*34.1%
distribute-rgt-out43.1%
*-commutative43.1%
associate-*r*43.1%
distribute-rgt-out43.1%
unpow243.1%
Simplified43.1%
Final simplification64.3%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (+ U (* 2.0 (* l J)))))
(if (<= l -5.6e+215)
t_0
(if (<= l -4.4e+153)
(* U U)
(if (<= l -1100.0)
(- -8.0 (* U U))
(if (<= l 4.6e+28)
t_0
(+ U (* l (* J (+ 2.0 (* (* K K) -0.25)))))))))))
double code(double J, double l, double K, double U) {
double t_0 = U + (2.0 * (l * J));
double tmp;
if (l <= -5.6e+215) {
tmp = t_0;
} else if (l <= -4.4e+153) {
tmp = U * U;
} else if (l <= -1100.0) {
tmp = -8.0 - (U * U);
} else if (l <= 4.6e+28) {
tmp = t_0;
} else {
tmp = U + (l * (J * (2.0 + ((K * K) * -0.25))));
}
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 + (2.0d0 * (l * j))
if (l <= (-5.6d+215)) then
tmp = t_0
else if (l <= (-4.4d+153)) then
tmp = u * u
else if (l <= (-1100.0d0)) then
tmp = (-8.0d0) - (u * u)
else if (l <= 4.6d+28) then
tmp = t_0
else
tmp = u + (l * (j * (2.0d0 + ((k * k) * (-0.25d0)))))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = U + (2.0 * (l * J));
double tmp;
if (l <= -5.6e+215) {
tmp = t_0;
} else if (l <= -4.4e+153) {
tmp = U * U;
} else if (l <= -1100.0) {
tmp = -8.0 - (U * U);
} else if (l <= 4.6e+28) {
tmp = t_0;
} else {
tmp = U + (l * (J * (2.0 + ((K * K) * -0.25))));
}
return tmp;
}
def code(J, l, K, U): t_0 = U + (2.0 * (l * J)) tmp = 0 if l <= -5.6e+215: tmp = t_0 elif l <= -4.4e+153: tmp = U * U elif l <= -1100.0: tmp = -8.0 - (U * U) elif l <= 4.6e+28: tmp = t_0 else: tmp = U + (l * (J * (2.0 + ((K * K) * -0.25)))) return tmp
function code(J, l, K, U) t_0 = Float64(U + Float64(2.0 * Float64(l * J))) tmp = 0.0 if (l <= -5.6e+215) tmp = t_0; elseif (l <= -4.4e+153) tmp = Float64(U * U); elseif (l <= -1100.0) tmp = Float64(-8.0 - Float64(U * U)); elseif (l <= 4.6e+28) tmp = t_0; else tmp = Float64(U + Float64(l * Float64(J * Float64(2.0 + Float64(Float64(K * K) * -0.25))))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = U + (2.0 * (l * J)); tmp = 0.0; if (l <= -5.6e+215) tmp = t_0; elseif (l <= -4.4e+153) tmp = U * U; elseif (l <= -1100.0) tmp = -8.0 - (U * U); elseif (l <= 4.6e+28) tmp = t_0; else tmp = U + (l * (J * (2.0 + ((K * K) * -0.25)))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(U + N[(2.0 * N[(l * J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -5.6e+215], t$95$0, If[LessEqual[l, -4.4e+153], N[(U * U), $MachinePrecision], If[LessEqual[l, -1100.0], N[(-8.0 - N[(U * U), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 4.6e+28], t$95$0, N[(U + N[(l * N[(J * N[(2.0 + N[(N[(K * K), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + 2 \cdot \left(\ell \cdot J\right)\\
\mathbf{if}\;\ell \leq -5.6 \cdot 10^{+215}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq -4.4 \cdot 10^{+153}:\\
\;\;\;\;U \cdot U\\
\mathbf{elif}\;\ell \leq -1100:\\
\;\;\;\;-8 - U \cdot U\\
\mathbf{elif}\;\ell \leq 4.6 \cdot 10^{+28}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;U + \ell \cdot \left(J \cdot \left(2 + \left(K \cdot K\right) \cdot -0.25\right)\right)\\
\end{array}
\end{array}
if l < -5.5999999999999999e215 or -1100 < l < 4.59999999999999968e28Initial program 76.7%
Taylor expanded in l around 0 89.9%
Taylor expanded in K around 0 82.3%
if -5.5999999999999999e215 < l < -4.3999999999999999e153Initial program 100.0%
Applied egg-rr64.5%
if -4.3999999999999999e153 < l < -1100Initial program 100.0%
associate-*l*100.0%
fma-def100.0%
Simplified100.0%
Applied egg-rr26.9%
cancel-sign-sub-inv26.9%
Simplified26.9%
if 4.59999999999999968e28 < l Initial program 100.0%
Taylor expanded in l around 0 26.8%
Taylor expanded in K around 0 34.1%
associate-*r*34.1%
associate-*r*34.1%
associate-*r*34.1%
distribute-rgt-out43.1%
*-commutative43.1%
associate-*r*43.1%
distribute-rgt-out43.1%
unpow243.1%
Simplified43.1%
Final simplification64.3%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (+ U (* 2.0 (* l J)))))
(if (<= l -5.6e+215)
t_0
(if (<= l -5.2e+155)
(* U U)
(if (<= l -1200.0)
(- -8.0 (* U U))
(if (<= l 3.8e+32) t_0 (+ U (* (* J (* K K)) (* l -0.25)))))))))
double code(double J, double l, double K, double U) {
double t_0 = U + (2.0 * (l * J));
double tmp;
if (l <= -5.6e+215) {
tmp = t_0;
} else if (l <= -5.2e+155) {
tmp = U * U;
} else if (l <= -1200.0) {
tmp = -8.0 - (U * U);
} else if (l <= 3.8e+32) {
tmp = t_0;
} else {
tmp = U + ((J * (K * K)) * (l * -0.25));
}
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 + (2.0d0 * (l * j))
if (l <= (-5.6d+215)) then
tmp = t_0
else if (l <= (-5.2d+155)) then
tmp = u * u
else if (l <= (-1200.0d0)) then
tmp = (-8.0d0) - (u * u)
else if (l <= 3.8d+32) then
tmp = t_0
else
tmp = u + ((j * (k * k)) * (l * (-0.25d0)))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = U + (2.0 * (l * J));
double tmp;
if (l <= -5.6e+215) {
tmp = t_0;
} else if (l <= -5.2e+155) {
tmp = U * U;
} else if (l <= -1200.0) {
tmp = -8.0 - (U * U);
} else if (l <= 3.8e+32) {
tmp = t_0;
} else {
tmp = U + ((J * (K * K)) * (l * -0.25));
}
return tmp;
}
def code(J, l, K, U): t_0 = U + (2.0 * (l * J)) tmp = 0 if l <= -5.6e+215: tmp = t_0 elif l <= -5.2e+155: tmp = U * U elif l <= -1200.0: tmp = -8.0 - (U * U) elif l <= 3.8e+32: tmp = t_0 else: tmp = U + ((J * (K * K)) * (l * -0.25)) return tmp
function code(J, l, K, U) t_0 = Float64(U + Float64(2.0 * Float64(l * J))) tmp = 0.0 if (l <= -5.6e+215) tmp = t_0; elseif (l <= -5.2e+155) tmp = Float64(U * U); elseif (l <= -1200.0) tmp = Float64(-8.0 - Float64(U * U)); elseif (l <= 3.8e+32) tmp = t_0; else tmp = Float64(U + Float64(Float64(J * Float64(K * K)) * Float64(l * -0.25))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = U + (2.0 * (l * J)); tmp = 0.0; if (l <= -5.6e+215) tmp = t_0; elseif (l <= -5.2e+155) tmp = U * U; elseif (l <= -1200.0) tmp = -8.0 - (U * U); elseif (l <= 3.8e+32) tmp = t_0; else tmp = U + ((J * (K * K)) * (l * -0.25)); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(U + N[(2.0 * N[(l * J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -5.6e+215], t$95$0, If[LessEqual[l, -5.2e+155], N[(U * U), $MachinePrecision], If[LessEqual[l, -1200.0], N[(-8.0 - N[(U * U), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 3.8e+32], t$95$0, N[(U + N[(N[(J * N[(K * K), $MachinePrecision]), $MachinePrecision] * N[(l * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + 2 \cdot \left(\ell \cdot J\right)\\
\mathbf{if}\;\ell \leq -5.6 \cdot 10^{+215}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq -5.2 \cdot 10^{+155}:\\
\;\;\;\;U \cdot U\\
\mathbf{elif}\;\ell \leq -1200:\\
\;\;\;\;-8 - U \cdot U\\
\mathbf{elif}\;\ell \leq 3.8 \cdot 10^{+32}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;U + \left(J \cdot \left(K \cdot K\right)\right) \cdot \left(\ell \cdot -0.25\right)\\
\end{array}
\end{array}
if l < -5.5999999999999999e215 or -1200 < l < 3.8000000000000003e32Initial program 76.9%
Taylor expanded in l around 0 89.3%
Taylor expanded in K around 0 81.8%
if -5.5999999999999999e215 < l < -5.2000000000000004e155Initial program 100.0%
Applied egg-rr64.5%
if -5.2000000000000004e155 < l < -1200Initial program 100.0%
associate-*l*100.0%
fma-def100.0%
Simplified100.0%
Applied egg-rr26.9%
cancel-sign-sub-inv26.9%
Simplified26.9%
if 3.8000000000000003e32 < l Initial program 100.0%
Taylor expanded in l around 0 27.2%
Taylor expanded in K around 0 34.6%
associate-*r*34.6%
associate-*r*34.6%
associate-*r*34.6%
distribute-rgt-out43.7%
*-commutative43.7%
associate-*r*43.7%
distribute-rgt-out43.7%
unpow243.7%
Simplified43.7%
Taylor expanded in K around inf 34.1%
*-commutative34.1%
associate-*r*34.1%
associate-*l*34.1%
unpow234.1%
Simplified34.1%
Final simplification62.2%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (* U (* U -8.0))))
(if (<= l -3.6e+154)
(* U U)
(if (<= l -1000.0)
t_0
(if (<= l 1100.0) U (if (<= l 1.35e+78) (* U U) t_0))))))
double code(double J, double l, double K, double U) {
double t_0 = U * (U * -8.0);
double tmp;
if (l <= -3.6e+154) {
tmp = U * U;
} else if (l <= -1000.0) {
tmp = t_0;
} else if (l <= 1100.0) {
tmp = U;
} else if (l <= 1.35e+78) {
tmp = U * U;
} 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 * (u * (-8.0d0))
if (l <= (-3.6d+154)) then
tmp = u * u
else if (l <= (-1000.0d0)) then
tmp = t_0
else if (l <= 1100.0d0) then
tmp = u
else if (l <= 1.35d+78) then
tmp = u * u
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 * (U * -8.0);
double tmp;
if (l <= -3.6e+154) {
tmp = U * U;
} else if (l <= -1000.0) {
tmp = t_0;
} else if (l <= 1100.0) {
tmp = U;
} else if (l <= 1.35e+78) {
tmp = U * U;
} else {
tmp = t_0;
}
return tmp;
}
def code(J, l, K, U): t_0 = U * (U * -8.0) tmp = 0 if l <= -3.6e+154: tmp = U * U elif l <= -1000.0: tmp = t_0 elif l <= 1100.0: tmp = U elif l <= 1.35e+78: tmp = U * U else: tmp = t_0 return tmp
function code(J, l, K, U) t_0 = Float64(U * Float64(U * -8.0)) tmp = 0.0 if (l <= -3.6e+154) tmp = Float64(U * U); elseif (l <= -1000.0) tmp = t_0; elseif (l <= 1100.0) tmp = U; elseif (l <= 1.35e+78) tmp = Float64(U * U); else tmp = t_0; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = U * (U * -8.0); tmp = 0.0; if (l <= -3.6e+154) tmp = U * U; elseif (l <= -1000.0) tmp = t_0; elseif (l <= 1100.0) tmp = U; elseif (l <= 1.35e+78) tmp = U * U; else tmp = t_0; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(U * N[(U * -8.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -3.6e+154], N[(U * U), $MachinePrecision], If[LessEqual[l, -1000.0], t$95$0, If[LessEqual[l, 1100.0], U, If[LessEqual[l, 1.35e+78], N[(U * U), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U \cdot \left(U \cdot -8\right)\\
\mathbf{if}\;\ell \leq -3.6 \cdot 10^{+154}:\\
\;\;\;\;U \cdot U\\
\mathbf{elif}\;\ell \leq -1000:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq 1100:\\
\;\;\;\;U\\
\mathbf{elif}\;\ell \leq 1.35 \cdot 10^{+78}:\\
\;\;\;\;U \cdot U\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if l < -3.6000000000000001e154 or 1100 < l < 1.35000000000000002e78Initial program 100.0%
Applied egg-rr32.7%
if -3.6000000000000001e154 < l < -1e3 or 1.35000000000000002e78 < l Initial program 100.0%
Taylor expanded in J around 0 100.0%
associate-*r*100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in K around 0 71.8%
Applied egg-rr22.8%
if -1e3 < l < 1100Initial program 72.5%
Taylor expanded in J around 0 70.2%
Final simplification47.9%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (- -8.0 (* U U))))
(if (<= l -8.5e+155)
(* U U)
(if (<= l -480.0)
t_0
(if (<= l 2300.0) U (if (<= l 6.6e+81) (* U U) t_0))))))
double code(double J, double l, double K, double U) {
double t_0 = -8.0 - (U * U);
double tmp;
if (l <= -8.5e+155) {
tmp = U * U;
} else if (l <= -480.0) {
tmp = t_0;
} else if (l <= 2300.0) {
tmp = U;
} else if (l <= 6.6e+81) {
tmp = U * U;
} 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 = (-8.0d0) - (u * u)
if (l <= (-8.5d+155)) then
tmp = u * u
else if (l <= (-480.0d0)) then
tmp = t_0
else if (l <= 2300.0d0) then
tmp = u
else if (l <= 6.6d+81) then
tmp = u * u
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 = -8.0 - (U * U);
double tmp;
if (l <= -8.5e+155) {
tmp = U * U;
} else if (l <= -480.0) {
tmp = t_0;
} else if (l <= 2300.0) {
tmp = U;
} else if (l <= 6.6e+81) {
tmp = U * U;
} else {
tmp = t_0;
}
return tmp;
}
def code(J, l, K, U): t_0 = -8.0 - (U * U) tmp = 0 if l <= -8.5e+155: tmp = U * U elif l <= -480.0: tmp = t_0 elif l <= 2300.0: tmp = U elif l <= 6.6e+81: tmp = U * U else: tmp = t_0 return tmp
function code(J, l, K, U) t_0 = Float64(-8.0 - Float64(U * U)) tmp = 0.0 if (l <= -8.5e+155) tmp = Float64(U * U); elseif (l <= -480.0) tmp = t_0; elseif (l <= 2300.0) tmp = U; elseif (l <= 6.6e+81) tmp = Float64(U * U); else tmp = t_0; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = -8.0 - (U * U); tmp = 0.0; if (l <= -8.5e+155) tmp = U * U; elseif (l <= -480.0) tmp = t_0; elseif (l <= 2300.0) tmp = U; elseif (l <= 6.6e+81) tmp = U * U; else tmp = t_0; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(-8.0 - N[(U * U), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -8.5e+155], N[(U * U), $MachinePrecision], If[LessEqual[l, -480.0], t$95$0, If[LessEqual[l, 2300.0], U, If[LessEqual[l, 6.6e+81], N[(U * U), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -8 - U \cdot U\\
\mathbf{if}\;\ell \leq -8.5 \cdot 10^{+155}:\\
\;\;\;\;U \cdot U\\
\mathbf{elif}\;\ell \leq -480:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq 2300:\\
\;\;\;\;U\\
\mathbf{elif}\;\ell \leq 6.6 \cdot 10^{+81}:\\
\;\;\;\;U \cdot U\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if l < -8.5000000000000002e155 or 2300 < l < 6.6e81Initial program 100.0%
Applied egg-rr32.0%
if -8.5000000000000002e155 < l < -480 or 6.6e81 < l Initial program 100.0%
associate-*l*100.0%
fma-def100.0%
Simplified100.0%
Applied egg-rr23.2%
cancel-sign-sub-inv23.2%
Simplified23.2%
if -480 < l < 2300Initial program 72.5%
Taylor expanded in J around 0 70.2%
Final simplification47.9%
(FPCore (J l K U)
:precision binary64
(if (<= l -2.5e+155)
(* U U)
(if (<= l -780.0)
(- -8.0 (* U U))
(if (<= l 600.0) U (if (<= l 1.95e+82) (* U U) (* U (- 2.0 U)))))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -2.5e+155) {
tmp = U * U;
} else if (l <= -780.0) {
tmp = -8.0 - (U * U);
} else if (l <= 600.0) {
tmp = U;
} else if (l <= 1.95e+82) {
tmp = U * U;
} else {
tmp = U * (2.0 - U);
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if (l <= (-2.5d+155)) then
tmp = u * u
else if (l <= (-780.0d0)) then
tmp = (-8.0d0) - (u * u)
else if (l <= 600.0d0) then
tmp = u
else if (l <= 1.95d+82) then
tmp = u * u
else
tmp = u * (2.0d0 - u)
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (l <= -2.5e+155) {
tmp = U * U;
} else if (l <= -780.0) {
tmp = -8.0 - (U * U);
} else if (l <= 600.0) {
tmp = U;
} else if (l <= 1.95e+82) {
tmp = U * U;
} else {
tmp = U * (2.0 - U);
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -2.5e+155: tmp = U * U elif l <= -780.0: tmp = -8.0 - (U * U) elif l <= 600.0: tmp = U elif l <= 1.95e+82: tmp = U * U else: tmp = U * (2.0 - U) return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -2.5e+155) tmp = Float64(U * U); elseif (l <= -780.0) tmp = Float64(-8.0 - Float64(U * U)); elseif (l <= 600.0) tmp = U; elseif (l <= 1.95e+82) tmp = Float64(U * U); else tmp = Float64(U * Float64(2.0 - U)); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -2.5e+155) tmp = U * U; elseif (l <= -780.0) tmp = -8.0 - (U * U); elseif (l <= 600.0) tmp = U; elseif (l <= 1.95e+82) tmp = U * U; else tmp = U * (2.0 - U); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -2.5e+155], N[(U * U), $MachinePrecision], If[LessEqual[l, -780.0], N[(-8.0 - N[(U * U), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 600.0], U, If[LessEqual[l, 1.95e+82], N[(U * U), $MachinePrecision], N[(U * N[(2.0 - U), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2.5 \cdot 10^{+155}:\\
\;\;\;\;U \cdot U\\
\mathbf{elif}\;\ell \leq -780:\\
\;\;\;\;-8 - U \cdot U\\
\mathbf{elif}\;\ell \leq 600:\\
\;\;\;\;U\\
\mathbf{elif}\;\ell \leq 1.95 \cdot 10^{+82}:\\
\;\;\;\;U \cdot U\\
\mathbf{else}:\\
\;\;\;\;U \cdot \left(2 - U\right)\\
\end{array}
\end{array}
if l < -2.5e155 or 600 < l < 1.94999999999999988e82Initial program 100.0%
Applied egg-rr32.0%
if -2.5e155 < l < -780Initial program 100.0%
associate-*l*100.0%
fma-def100.0%
Simplified100.0%
Applied egg-rr26.9%
cancel-sign-sub-inv26.9%
Simplified26.9%
if -780 < l < 600Initial program 72.5%
Taylor expanded in J around 0 70.2%
if 1.94999999999999988e82 < l Initial program 100.0%
associate-*l*100.0%
fma-def100.0%
Simplified100.0%
Applied egg-rr19.9%
fma-udef19.9%
+-commutative19.9%
associate-+r+19.9%
count-219.9%
distribute-rgt-out19.9%
Simplified19.9%
Final simplification47.9%
(FPCore (J l K U) :precision binary64 (if (<= l -180000.0) (* U U) (if (<= l 800.0) U (* U U))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -180000.0) {
tmp = U * U;
} else if (l <= 800.0) {
tmp = U;
} else {
tmp = U * 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 <= (-180000.0d0)) then
tmp = u * u
else if (l <= 800.0d0) then
tmp = u
else
tmp = u * u
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (l <= -180000.0) {
tmp = U * U;
} else if (l <= 800.0) {
tmp = U;
} else {
tmp = U * U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -180000.0: tmp = U * U elif l <= 800.0: tmp = U else: tmp = U * U return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -180000.0) tmp = Float64(U * U); elseif (l <= 800.0) tmp = U; else tmp = Float64(U * U); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -180000.0) tmp = U * U; elseif (l <= 800.0) tmp = U; else tmp = U * U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -180000.0], N[(U * U), $MachinePrecision], If[LessEqual[l, 800.0], U, N[(U * U), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -180000:\\
\;\;\;\;U \cdot U\\
\mathbf{elif}\;\ell \leq 800:\\
\;\;\;\;U\\
\mathbf{else}:\\
\;\;\;\;U \cdot U\\
\end{array}
\end{array}
if l < -1.8e5 or 800 < l Initial program 100.0%
Applied egg-rr17.8%
if -1.8e5 < l < 800Initial program 72.9%
Taylor expanded in J around 0 69.1%
Final simplification43.5%
(FPCore (J l K U) :precision binary64 (+ U (* 2.0 (* l J))))
double code(double J, double l, double K, double U) {
return U + (2.0 * (l * J));
}
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 + (2.0d0 * (l * j))
end function
public static double code(double J, double l, double K, double U) {
return U + (2.0 * (l * J));
}
def code(J, l, K, U): return U + (2.0 * (l * J))
function code(J, l, K, U) return Float64(U + Float64(2.0 * Float64(l * J))) end
function tmp = code(J, l, K, U) tmp = U + (2.0 * (l * J)); end
code[J_, l_, K_, U_] := N[(U + N[(2.0 * N[(l * J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + 2 \cdot \left(\ell \cdot J\right)
\end{array}
Initial program 86.5%
Taylor expanded in l around 0 60.8%
Taylor expanded in K around 0 53.8%
Final simplification53.8%
(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.5%
Applied egg-rr2.9%
*-inverses2.9%
Simplified2.9%
Final simplification2.9%
(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%
Taylor expanded in J around 0 35.8%
Final simplification35.8%
herbie shell --seed 2023278
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))