
(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 16 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 2e-13)))
(+ (* (* t_0 J) (cos (/ K 2.0))) U)
(+ U (* 2.0 (* J (* l (cos (* K 0.5)))))))))
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 <= 2e-13)) {
tmp = ((t_0 * J) * cos((K / 2.0))) + U;
} else {
tmp = U + (2.0 * (J * (l * cos((K * 0.5)))));
}
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 <= 2e-13)) {
tmp = ((t_0 * J) * Math.cos((K / 2.0))) + U;
} else {
tmp = U + (2.0 * (J * (l * Math.cos((K * 0.5)))));
}
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 <= 2e-13): tmp = ((t_0 * J) * math.cos((K / 2.0))) + U else: tmp = U + (2.0 * (J * (l * math.cos((K * 0.5))))) 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 <= 2e-13)) tmp = Float64(Float64(Float64(t_0 * J) * cos(Float64(K / 2.0))) + U); else tmp = Float64(U + Float64(2.0 * Float64(J * Float64(l * cos(Float64(K * 0.5)))))); 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 <= 2e-13))) tmp = ((t_0 * J) * cos((K / 2.0))) + U; else tmp = U + (2.0 * (J * (l * cos((K * 0.5))))); 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, 2e-13]], $MachinePrecision]], N[(N[(N[(t$95$0 * J), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], N[(U + N[(2.0 * N[(J * N[(l * N[Cos[N[(K * 0.5), $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 2 \cdot 10^{-13}\right):\\
\;\;\;\;\left(t\_0 \cdot J\right) \cdot \cos \left(\frac{K}{2}\right) + U\\
\mathbf{else}:\\
\;\;\;\;U + 2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -inf.0 or 2.0000000000000001e-13 < (-.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))) < 2.0000000000000001e-13Initial program 80.6%
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))) J)) (t_1 (cos (/ K 2.0))))
(if (<= l -1.22e+92)
(+ U (* t_1 (* J (* 0.3333333333333333 (pow l 3.0)))))
(if (<= l -160.0)
t_0
(if (<= l 440.0)
(+ U (* 2.0 (* J (* l (cos (* K 0.5))))))
(if (<= l 1.65e+100)
t_0
(+
U
(*
t_1
(* J (* l (+ 2.0 (* 0.3333333333333333 (pow l 2.0)))))))))))))
double code(double J, double l, double K, double U) {
double t_0 = (exp(l) - exp(-l)) * J;
double t_1 = cos((K / 2.0));
double tmp;
if (l <= -1.22e+92) {
tmp = U + (t_1 * (J * (0.3333333333333333 * pow(l, 3.0))));
} else if (l <= -160.0) {
tmp = t_0;
} else if (l <= 440.0) {
tmp = U + (2.0 * (J * (l * cos((K * 0.5)))));
} else if (l <= 1.65e+100) {
tmp = t_0;
} else {
tmp = U + (t_1 * (J * (l * (2.0 + (0.3333333333333333 * pow(l, 2.0))))));
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (exp(l) - exp(-l)) * j
t_1 = cos((k / 2.0d0))
if (l <= (-1.22d+92)) then
tmp = u + (t_1 * (j * (0.3333333333333333d0 * (l ** 3.0d0))))
else if (l <= (-160.0d0)) then
tmp = t_0
else if (l <= 440.0d0) then
tmp = u + (2.0d0 * (j * (l * cos((k * 0.5d0)))))
else if (l <= 1.65d+100) then
tmp = t_0
else
tmp = u + (t_1 * (j * (l * (2.0d0 + (0.3333333333333333d0 * (l ** 2.0d0))))))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = (Math.exp(l) - Math.exp(-l)) * J;
double t_1 = Math.cos((K / 2.0));
double tmp;
if (l <= -1.22e+92) {
tmp = U + (t_1 * (J * (0.3333333333333333 * Math.pow(l, 3.0))));
} else if (l <= -160.0) {
tmp = t_0;
} else if (l <= 440.0) {
tmp = U + (2.0 * (J * (l * Math.cos((K * 0.5)))));
} else if (l <= 1.65e+100) {
tmp = t_0;
} else {
tmp = U + (t_1 * (J * (l * (2.0 + (0.3333333333333333 * Math.pow(l, 2.0))))));
}
return tmp;
}
def code(J, l, K, U): t_0 = (math.exp(l) - math.exp(-l)) * J t_1 = math.cos((K / 2.0)) tmp = 0 if l <= -1.22e+92: tmp = U + (t_1 * (J * (0.3333333333333333 * math.pow(l, 3.0)))) elif l <= -160.0: tmp = t_0 elif l <= 440.0: tmp = U + (2.0 * (J * (l * math.cos((K * 0.5))))) elif l <= 1.65e+100: tmp = t_0 else: tmp = U + (t_1 * (J * (l * (2.0 + (0.3333333333333333 * math.pow(l, 2.0)))))) return tmp
function code(J, l, K, U) t_0 = Float64(Float64(exp(l) - exp(Float64(-l))) * J) t_1 = cos(Float64(K / 2.0)) tmp = 0.0 if (l <= -1.22e+92) tmp = Float64(U + Float64(t_1 * Float64(J * Float64(0.3333333333333333 * (l ^ 3.0))))); elseif (l <= -160.0) tmp = t_0; elseif (l <= 440.0) tmp = Float64(U + Float64(2.0 * Float64(J * Float64(l * cos(Float64(K * 0.5)))))); elseif (l <= 1.65e+100) tmp = t_0; else tmp = Float64(U + Float64(t_1 * Float64(J * Float64(l * Float64(2.0 + Float64(0.3333333333333333 * (l ^ 2.0))))))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = (exp(l) - exp(-l)) * J; t_1 = cos((K / 2.0)); tmp = 0.0; if (l <= -1.22e+92) tmp = U + (t_1 * (J * (0.3333333333333333 * (l ^ 3.0)))); elseif (l <= -160.0) tmp = t_0; elseif (l <= 440.0) tmp = U + (2.0 * (J * (l * cos((K * 0.5))))); elseif (l <= 1.65e+100) tmp = t_0; else tmp = U + (t_1 * (J * (l * (2.0 + (0.3333333333333333 * (l ^ 2.0)))))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision]}, Block[{t$95$1 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -1.22e+92], N[(U + N[(t$95$1 * N[(J * N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -160.0], t$95$0, If[LessEqual[l, 440.0], N[(U + N[(2.0 * N[(J * N[(l * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.65e+100], t$95$0, N[(U + N[(t$95$1 * N[(J * N[(l * N[(2.0 + N[(0.3333333333333333 * N[Power[l, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(e^{\ell} - e^{-\ell}\right) \cdot J\\
t_1 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;\ell \leq -1.22 \cdot 10^{+92}:\\
\;\;\;\;U + t\_1 \cdot \left(J \cdot \left(0.3333333333333333 \cdot {\ell}^{3}\right)\right)\\
\mathbf{elif}\;\ell \leq -160:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq 440:\\
\;\;\;\;U + 2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\mathbf{elif}\;\ell \leq 1.65 \cdot 10^{+100}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;U + t\_1 \cdot \left(J \cdot \left(\ell \cdot \left(2 + 0.3333333333333333 \cdot {\ell}^{2}\right)\right)\right)\\
\end{array}
\end{array}
if l < -1.22e92Initial program 100.0%
Taylor expanded in l around 0 97.9%
Taylor expanded in l around inf 97.9%
associate-*r*97.9%
*-commutative97.9%
associate-*r*97.9%
Simplified97.9%
if -1.22e92 < l < -160 or 440 < l < 1.6500000000000001e100Initial program 100.0%
Taylor expanded in K around 0 88.2%
Taylor expanded in J around inf 88.2%
if -160 < l < 440Initial program 80.8%
Taylor expanded in l around 0 99.9%
if 1.6500000000000001e100 < l Initial program 100.0%
Taylor expanded in l around 0 97.7%
Final simplification96.9%
(FPCore (J l K U)
:precision binary64
(let* ((t_0
(+ U (* (cos (/ K 2.0)) (* J (* 0.3333333333333333 (pow l 3.0))))))
(t_1 (* (- (exp l) (exp (- l))) J)))
(if (<= l -1.22e+92)
t_0
(if (<= l -260.0)
t_1
(if (<= l 150.0)
(+ U (* 2.0 (* J (* l (cos (* K 0.5))))))
(if (<= l 1.65e+100) t_1 t_0))))))
double code(double J, double l, double K, double U) {
double t_0 = U + (cos((K / 2.0)) * (J * (0.3333333333333333 * pow(l, 3.0))));
double t_1 = (exp(l) - exp(-l)) * J;
double tmp;
if (l <= -1.22e+92) {
tmp = t_0;
} else if (l <= -260.0) {
tmp = t_1;
} else if (l <= 150.0) {
tmp = U + (2.0 * (J * (l * cos((K * 0.5)))));
} else if (l <= 1.65e+100) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_0 = u + (cos((k / 2.0d0)) * (j * (0.3333333333333333d0 * (l ** 3.0d0))))
t_1 = (exp(l) - exp(-l)) * j
if (l <= (-1.22d+92)) then
tmp = t_0
else if (l <= (-260.0d0)) then
tmp = t_1
else if (l <= 150.0d0) then
tmp = u + (2.0d0 * (j * (l * cos((k * 0.5d0)))))
else if (l <= 1.65d+100) then
tmp = t_1
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 * (0.3333333333333333 * Math.pow(l, 3.0))));
double t_1 = (Math.exp(l) - Math.exp(-l)) * J;
double tmp;
if (l <= -1.22e+92) {
tmp = t_0;
} else if (l <= -260.0) {
tmp = t_1;
} else if (l <= 150.0) {
tmp = U + (2.0 * (J * (l * Math.cos((K * 0.5)))));
} else if (l <= 1.65e+100) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(J, l, K, U): t_0 = U + (math.cos((K / 2.0)) * (J * (0.3333333333333333 * math.pow(l, 3.0)))) t_1 = (math.exp(l) - math.exp(-l)) * J tmp = 0 if l <= -1.22e+92: tmp = t_0 elif l <= -260.0: tmp = t_1 elif l <= 150.0: tmp = U + (2.0 * (J * (l * math.cos((K * 0.5))))) elif l <= 1.65e+100: tmp = t_1 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(0.3333333333333333 * (l ^ 3.0))))) t_1 = Float64(Float64(exp(l) - exp(Float64(-l))) * J) tmp = 0.0 if (l <= -1.22e+92) tmp = t_0; elseif (l <= -260.0) tmp = t_1; elseif (l <= 150.0) tmp = Float64(U + Float64(2.0 * Float64(J * Float64(l * cos(Float64(K * 0.5)))))); elseif (l <= 1.65e+100) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = U + (cos((K / 2.0)) * (J * (0.3333333333333333 * (l ^ 3.0)))); t_1 = (exp(l) - exp(-l)) * J; tmp = 0.0; if (l <= -1.22e+92) tmp = t_0; elseif (l <= -260.0) tmp = t_1; elseif (l <= 150.0) tmp = U + (2.0 * (J * (l * cos((K * 0.5))))); elseif (l <= 1.65e+100) tmp = t_1; 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[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision]}, If[LessEqual[l, -1.22e+92], t$95$0, If[LessEqual[l, -260.0], t$95$1, If[LessEqual[l, 150.0], N[(U + N[(2.0 * N[(J * N[(l * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.65e+100], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(0.3333333333333333 \cdot {\ell}^{3}\right)\right)\\
t_1 := \left(e^{\ell} - e^{-\ell}\right) \cdot J\\
\mathbf{if}\;\ell \leq -1.22 \cdot 10^{+92}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq -260:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\ell \leq 150:\\
\;\;\;\;U + 2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\mathbf{elif}\;\ell \leq 1.65 \cdot 10^{+100}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if l < -1.22e92 or 1.6500000000000001e100 < l Initial program 100.0%
Taylor expanded in l around 0 97.8%
Taylor expanded in l around inf 97.8%
associate-*r*97.8%
*-commutative97.8%
associate-*r*97.8%
Simplified97.8%
if -1.22e92 < l < -260 or 150 < l < 1.6500000000000001e100Initial program 100.0%
Taylor expanded in K around 0 88.2%
Taylor expanded in J around inf 88.2%
if -260 < l < 150Initial program 80.8%
Taylor expanded in l around 0 99.9%
Final simplification96.9%
(FPCore (J l K U) :precision binary64 (if (or (<= l -245.0) (not (<= l 300.0))) (* (- (exp l) (exp (- l))) J) (+ U (* 2.0 (* J (* l (cos (* K 0.5))))))))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -245.0) || !(l <= 300.0)) {
tmp = (exp(l) - exp(-l)) * J;
} else {
tmp = U + (2.0 * (J * (l * cos((K * 0.5)))));
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if ((l <= (-245.0d0)) .or. (.not. (l <= 300.0d0))) then
tmp = (exp(l) - exp(-l)) * j
else
tmp = u + (2.0d0 * (j * (l * cos((k * 0.5d0)))))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -245.0) || !(l <= 300.0)) {
tmp = (Math.exp(l) - Math.exp(-l)) * J;
} else {
tmp = U + (2.0 * (J * (l * Math.cos((K * 0.5)))));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -245.0) or not (l <= 300.0): tmp = (math.exp(l) - math.exp(-l)) * J else: tmp = U + (2.0 * (J * (l * math.cos((K * 0.5))))) return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -245.0) || !(l <= 300.0)) tmp = Float64(Float64(exp(l) - exp(Float64(-l))) * J); else tmp = Float64(U + Float64(2.0 * Float64(J * Float64(l * cos(Float64(K * 0.5)))))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -245.0) || ~((l <= 300.0))) tmp = (exp(l) - exp(-l)) * J; else tmp = U + (2.0 * (J * (l * cos((K * 0.5))))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -245.0], N[Not[LessEqual[l, 300.0]], $MachinePrecision]], N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision], N[(U + N[(2.0 * N[(J * N[(l * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -245 \lor \neg \left(\ell \leq 300\right):\\
\;\;\;\;\left(e^{\ell} - e^{-\ell}\right) \cdot J\\
\mathbf{else}:\\
\;\;\;\;U + 2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\end{array}
\end{array}
if l < -245 or 300 < l Initial program 100.0%
Taylor expanded in K around 0 80.9%
Taylor expanded in J around inf 80.9%
if -245 < l < 300Initial program 80.8%
Taylor expanded in l around 0 99.9%
Final simplification89.8%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (+ U (* J (* l (+ 2.0 (* 0.3333333333333333 (pow l 2.0))))))))
(if (<= l -3.2e+23)
t_0
(if (<= l 1.45e-11)
(+ U (* 2.0 (* J (* l (cos (* K 0.5))))))
(if (<= l 7.8e+85)
(* U (+ 1.0 (* J (/ (+ (/ 68719476736.0 (pow K 3.0)) -0.5) U))))
t_0)))))
double code(double J, double l, double K, double U) {
double t_0 = U + (J * (l * (2.0 + (0.3333333333333333 * pow(l, 2.0)))));
double tmp;
if (l <= -3.2e+23) {
tmp = t_0;
} else if (l <= 1.45e-11) {
tmp = U + (2.0 * (J * (l * cos((K * 0.5)))));
} else if (l <= 7.8e+85) {
tmp = U * (1.0 + (J * (((68719476736.0 / pow(K, 3.0)) + -0.5) / 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 + (j * (l * (2.0d0 + (0.3333333333333333d0 * (l ** 2.0d0)))))
if (l <= (-3.2d+23)) then
tmp = t_0
else if (l <= 1.45d-11) then
tmp = u + (2.0d0 * (j * (l * cos((k * 0.5d0)))))
else if (l <= 7.8d+85) then
tmp = u * (1.0d0 + (j * (((68719476736.0d0 / (k ** 3.0d0)) + (-0.5d0)) / 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 + (J * (l * (2.0 + (0.3333333333333333 * Math.pow(l, 2.0)))));
double tmp;
if (l <= -3.2e+23) {
tmp = t_0;
} else if (l <= 1.45e-11) {
tmp = U + (2.0 * (J * (l * Math.cos((K * 0.5)))));
} else if (l <= 7.8e+85) {
tmp = U * (1.0 + (J * (((68719476736.0 / Math.pow(K, 3.0)) + -0.5) / U)));
} else {
tmp = t_0;
}
return tmp;
}
def code(J, l, K, U): t_0 = U + (J * (l * (2.0 + (0.3333333333333333 * math.pow(l, 2.0))))) tmp = 0 if l <= -3.2e+23: tmp = t_0 elif l <= 1.45e-11: tmp = U + (2.0 * (J * (l * math.cos((K * 0.5))))) elif l <= 7.8e+85: tmp = U * (1.0 + (J * (((68719476736.0 / math.pow(K, 3.0)) + -0.5) / U))) else: tmp = t_0 return tmp
function code(J, l, K, U) t_0 = Float64(U + Float64(J * Float64(l * Float64(2.0 + Float64(0.3333333333333333 * (l ^ 2.0)))))) tmp = 0.0 if (l <= -3.2e+23) tmp = t_0; elseif (l <= 1.45e-11) tmp = Float64(U + Float64(2.0 * Float64(J * Float64(l * cos(Float64(K * 0.5)))))); elseif (l <= 7.8e+85) tmp = Float64(U * Float64(1.0 + Float64(J * Float64(Float64(Float64(68719476736.0 / (K ^ 3.0)) + -0.5) / U)))); else tmp = t_0; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = U + (J * (l * (2.0 + (0.3333333333333333 * (l ^ 2.0))))); tmp = 0.0; if (l <= -3.2e+23) tmp = t_0; elseif (l <= 1.45e-11) tmp = U + (2.0 * (J * (l * cos((K * 0.5))))); elseif (l <= 7.8e+85) tmp = U * (1.0 + (J * (((68719476736.0 / (K ^ 3.0)) + -0.5) / U))); else tmp = t_0; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(U + N[(J * N[(l * N[(2.0 + N[(0.3333333333333333 * N[Power[l, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -3.2e+23], t$95$0, If[LessEqual[l, 1.45e-11], N[(U + N[(2.0 * N[(J * N[(l * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 7.8e+85], N[(U * N[(1.0 + N[(J * N[(N[(N[(68719476736.0 / N[Power[K, 3.0], $MachinePrecision]), $MachinePrecision] + -0.5), $MachinePrecision] / U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + J \cdot \left(\ell \cdot \left(2 + 0.3333333333333333 \cdot {\ell}^{2}\right)\right)\\
\mathbf{if}\;\ell \leq -3.2 \cdot 10^{+23}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq 1.45 \cdot 10^{-11}:\\
\;\;\;\;U + 2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\mathbf{elif}\;\ell \leq 7.8 \cdot 10^{+85}:\\
\;\;\;\;U \cdot \left(1 + J \cdot \frac{\frac{68719476736}{{K}^{3}} + -0.5}{U}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if l < -3.2e23 or 7.80000000000000067e85 < l Initial program 100.0%
Taylor expanded in l around 0 83.0%
Taylor expanded in K around 0 66.1%
if -3.2e23 < l < 1.45e-11Initial program 80.9%
Taylor expanded in l around 0 98.3%
if 1.45e-11 < l < 7.80000000000000067e85Initial program 100.0%
Applied egg-rr5.2%
Taylor expanded in K around 0 15.5%
*-commutative15.5%
*-commutative15.5%
associate-*l*15.5%
distribute-lft-out15.5%
Simplified15.5%
Applied egg-rr26.3%
Taylor expanded in U around inf 29.7%
associate-/l*29.7%
sub-neg29.7%
associate-*r/29.7%
metadata-eval29.7%
metadata-eval29.7%
Simplified29.7%
Final simplification77.3%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (+ U (* J (* l (+ 2.0 (* 0.3333333333333333 (pow l 2.0))))))))
(if (<= l -7.5e+23)
t_0
(if (<= l 1.45e-11)
(+ U (* 2.0 (* J (* l (cos (* K 0.5))))))
(if (<= l 8e+85)
(+ U (* J (+ -0.5 (pow (* K 0.000244140625) -3.0))))
t_0)))))
double code(double J, double l, double K, double U) {
double t_0 = U + (J * (l * (2.0 + (0.3333333333333333 * pow(l, 2.0)))));
double tmp;
if (l <= -7.5e+23) {
tmp = t_0;
} else if (l <= 1.45e-11) {
tmp = U + (2.0 * (J * (l * cos((K * 0.5)))));
} else if (l <= 8e+85) {
tmp = U + (J * (-0.5 + pow((K * 0.000244140625), -3.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 + (j * (l * (2.0d0 + (0.3333333333333333d0 * (l ** 2.0d0)))))
if (l <= (-7.5d+23)) then
tmp = t_0
else if (l <= 1.45d-11) then
tmp = u + (2.0d0 * (j * (l * cos((k * 0.5d0)))))
else if (l <= 8d+85) then
tmp = u + (j * ((-0.5d0) + ((k * 0.000244140625d0) ** (-3.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 + (J * (l * (2.0 + (0.3333333333333333 * Math.pow(l, 2.0)))));
double tmp;
if (l <= -7.5e+23) {
tmp = t_0;
} else if (l <= 1.45e-11) {
tmp = U + (2.0 * (J * (l * Math.cos((K * 0.5)))));
} else if (l <= 8e+85) {
tmp = U + (J * (-0.5 + Math.pow((K * 0.000244140625), -3.0)));
} else {
tmp = t_0;
}
return tmp;
}
def code(J, l, K, U): t_0 = U + (J * (l * (2.0 + (0.3333333333333333 * math.pow(l, 2.0))))) tmp = 0 if l <= -7.5e+23: tmp = t_0 elif l <= 1.45e-11: tmp = U + (2.0 * (J * (l * math.cos((K * 0.5))))) elif l <= 8e+85: tmp = U + (J * (-0.5 + math.pow((K * 0.000244140625), -3.0))) else: tmp = t_0 return tmp
function code(J, l, K, U) t_0 = Float64(U + Float64(J * Float64(l * Float64(2.0 + Float64(0.3333333333333333 * (l ^ 2.0)))))) tmp = 0.0 if (l <= -7.5e+23) tmp = t_0; elseif (l <= 1.45e-11) tmp = Float64(U + Float64(2.0 * Float64(J * Float64(l * cos(Float64(K * 0.5)))))); elseif (l <= 8e+85) tmp = Float64(U + Float64(J * Float64(-0.5 + (Float64(K * 0.000244140625) ^ -3.0)))); else tmp = t_0; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = U + (J * (l * (2.0 + (0.3333333333333333 * (l ^ 2.0))))); tmp = 0.0; if (l <= -7.5e+23) tmp = t_0; elseif (l <= 1.45e-11) tmp = U + (2.0 * (J * (l * cos((K * 0.5))))); elseif (l <= 8e+85) tmp = U + (J * (-0.5 + ((K * 0.000244140625) ^ -3.0))); else tmp = t_0; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(U + N[(J * N[(l * N[(2.0 + N[(0.3333333333333333 * N[Power[l, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -7.5e+23], t$95$0, If[LessEqual[l, 1.45e-11], N[(U + N[(2.0 * N[(J * N[(l * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 8e+85], N[(U + N[(J * N[(-0.5 + N[Power[N[(K * 0.000244140625), $MachinePrecision], -3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + J \cdot \left(\ell \cdot \left(2 + 0.3333333333333333 \cdot {\ell}^{2}\right)\right)\\
\mathbf{if}\;\ell \leq -7.5 \cdot 10^{+23}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq 1.45 \cdot 10^{-11}:\\
\;\;\;\;U + 2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\mathbf{elif}\;\ell \leq 8 \cdot 10^{+85}:\\
\;\;\;\;U + J \cdot \left(-0.5 + {\left(K \cdot 0.000244140625\right)}^{-3}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if l < -7.49999999999999987e23 or 8.0000000000000001e85 < l Initial program 100.0%
Taylor expanded in l around 0 83.0%
Taylor expanded in K around 0 66.1%
if -7.49999999999999987e23 < l < 1.45e-11Initial program 80.9%
Taylor expanded in l around 0 98.3%
if 1.45e-11 < l < 8.0000000000000001e85Initial program 100.0%
Applied egg-rr5.2%
Taylor expanded in K around 0 15.5%
*-commutative15.5%
*-commutative15.5%
associate-*l*15.5%
distribute-lft-out15.5%
Simplified15.5%
Applied egg-rr26.3%
Final simplification77.0%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (+ U (* 2.0 (* J (* l (cos (* K 0.5))))))))
(if (<= l -1.4e+98)
t_0
(if (<= l -1.28e+35)
(pow U -3.0)
(if (<= l 1.45e-11)
t_0
(+ U (* J (+ -0.5 (pow (* K 0.000244140625) -3.0)))))))))
double code(double J, double l, double K, double U) {
double t_0 = U + (2.0 * (J * (l * cos((K * 0.5)))));
double tmp;
if (l <= -1.4e+98) {
tmp = t_0;
} else if (l <= -1.28e+35) {
tmp = pow(U, -3.0);
} else if (l <= 1.45e-11) {
tmp = t_0;
} else {
tmp = U + (J * (-0.5 + pow((K * 0.000244140625), -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 = u + (2.0d0 * (j * (l * cos((k * 0.5d0)))))
if (l <= (-1.4d+98)) then
tmp = t_0
else if (l <= (-1.28d+35)) then
tmp = u ** (-3.0d0)
else if (l <= 1.45d-11) then
tmp = t_0
else
tmp = u + (j * ((-0.5d0) + ((k * 0.000244140625d0) ** (-3.0d0))))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = U + (2.0 * (J * (l * Math.cos((K * 0.5)))));
double tmp;
if (l <= -1.4e+98) {
tmp = t_0;
} else if (l <= -1.28e+35) {
tmp = Math.pow(U, -3.0);
} else if (l <= 1.45e-11) {
tmp = t_0;
} else {
tmp = U + (J * (-0.5 + Math.pow((K * 0.000244140625), -3.0)));
}
return tmp;
}
def code(J, l, K, U): t_0 = U + (2.0 * (J * (l * math.cos((K * 0.5))))) tmp = 0 if l <= -1.4e+98: tmp = t_0 elif l <= -1.28e+35: tmp = math.pow(U, -3.0) elif l <= 1.45e-11: tmp = t_0 else: tmp = U + (J * (-0.5 + math.pow((K * 0.000244140625), -3.0))) return tmp
function code(J, l, K, U) t_0 = Float64(U + Float64(2.0 * Float64(J * Float64(l * cos(Float64(K * 0.5)))))) tmp = 0.0 if (l <= -1.4e+98) tmp = t_0; elseif (l <= -1.28e+35) tmp = U ^ -3.0; elseif (l <= 1.45e-11) tmp = t_0; else tmp = Float64(U + Float64(J * Float64(-0.5 + (Float64(K * 0.000244140625) ^ -3.0)))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = U + (2.0 * (J * (l * cos((K * 0.5))))); tmp = 0.0; if (l <= -1.4e+98) tmp = t_0; elseif (l <= -1.28e+35) tmp = U ^ -3.0; elseif (l <= 1.45e-11) tmp = t_0; else tmp = U + (J * (-0.5 + ((K * 0.000244140625) ^ -3.0))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(U + N[(2.0 * N[(J * N[(l * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -1.4e+98], t$95$0, If[LessEqual[l, -1.28e+35], N[Power[U, -3.0], $MachinePrecision], If[LessEqual[l, 1.45e-11], t$95$0, N[(U + N[(J * N[(-0.5 + N[Power[N[(K * 0.000244140625), $MachinePrecision], -3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + 2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\mathbf{if}\;\ell \leq -1.4 \cdot 10^{+98}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq -1.28 \cdot 10^{+35}:\\
\;\;\;\;{U}^{-3}\\
\mathbf{elif}\;\ell \leq 1.45 \cdot 10^{-11}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(-0.5 + {\left(K \cdot 0.000244140625\right)}^{-3}\right)\\
\end{array}
\end{array}
if l < -1.4e98 or -1.2799999999999999e35 < l < 1.45e-11Initial program 86.3%
Taylor expanded in l around 0 78.9%
if -1.4e98 < l < -1.2799999999999999e35Initial program 100.0%
Applied egg-rr43.9%
if 1.45e-11 < l Initial program 100.0%
Applied egg-rr3.0%
Taylor expanded in K around 0 17.3%
*-commutative17.3%
*-commutative17.3%
associate-*l*16.1%
distribute-lft-out16.1%
Simplified16.1%
Applied egg-rr20.4%
Final simplification60.1%
(FPCore (J l K U)
:precision binary64
(if (<= l -1.8e+104)
(+ U (* l (* J 2.0)))
(if (<= l -2.7e+35)
(pow U -3.0)
(if (<= l 1.45e-11)
(fma J (* l 2.0) U)
(+ U (* J (+ -0.5 (pow (* K 0.000244140625) -3.0))))))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -1.8e+104) {
tmp = U + (l * (J * 2.0));
} else if (l <= -2.7e+35) {
tmp = pow(U, -3.0);
} else if (l <= 1.45e-11) {
tmp = fma(J, (l * 2.0), U);
} else {
tmp = U + (J * (-0.5 + pow((K * 0.000244140625), -3.0)));
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (l <= -1.8e+104) tmp = Float64(U + Float64(l * Float64(J * 2.0))); elseif (l <= -2.7e+35) tmp = U ^ -3.0; elseif (l <= 1.45e-11) tmp = fma(J, Float64(l * 2.0), U); else tmp = Float64(U + Float64(J * Float64(-0.5 + (Float64(K * 0.000244140625) ^ -3.0)))); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[l, -1.8e+104], N[(U + N[(l * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -2.7e+35], N[Power[U, -3.0], $MachinePrecision], If[LessEqual[l, 1.45e-11], N[(J * N[(l * 2.0), $MachinePrecision] + U), $MachinePrecision], N[(U + N[(J * N[(-0.5 + N[Power[N[(K * 0.000244140625), $MachinePrecision], -3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.8 \cdot 10^{+104}:\\
\;\;\;\;U + \ell \cdot \left(J \cdot 2\right)\\
\mathbf{elif}\;\ell \leq -2.7 \cdot 10^{+35}:\\
\;\;\;\;{U}^{-3}\\
\mathbf{elif}\;\ell \leq 1.45 \cdot 10^{-11}:\\
\;\;\;\;\mathsf{fma}\left(J, \ell \cdot 2, U\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(-0.5 + {\left(K \cdot 0.000244140625\right)}^{-3}\right)\\
\end{array}
\end{array}
if l < -1.8e104Initial program 100.0%
Taylor expanded in K around 0 76.2%
Taylor expanded in l around 0 24.1%
associate-*r*24.1%
Simplified24.1%
if -1.8e104 < l < -2.70000000000000003e35Initial program 100.0%
Applied egg-rr43.9%
if -2.70000000000000003e35 < l < 1.45e-11Initial program 81.7%
Taylor expanded in K around 0 81.4%
Taylor expanded in l around 0 87.1%
associate-*r*87.1%
+-commutative87.1%
associate-*r*87.1%
*-commutative87.1%
associate-*l*87.1%
fma-define87.1%
Simplified87.1%
if 1.45e-11 < l Initial program 100.0%
Applied egg-rr3.0%
Taylor expanded in K around 0 17.3%
*-commutative17.3%
*-commutative17.3%
associate-*l*16.1%
distribute-lft-out16.1%
Simplified16.1%
Applied egg-rr20.4%
Final simplification55.2%
(FPCore (J l K U)
:precision binary64
(if (<= l -4.2e+103)
(+ U (* l (* J 2.0)))
(if (<= l -6e+34)
(pow U -3.0)
(if (<= l 1.45e-11)
(fma J (* l 2.0) U)
(+ U (* J (/ 68719476736.0 (pow K 3.0))))))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -4.2e+103) {
tmp = U + (l * (J * 2.0));
} else if (l <= -6e+34) {
tmp = pow(U, -3.0);
} else if (l <= 1.45e-11) {
tmp = fma(J, (l * 2.0), U);
} else {
tmp = U + (J * (68719476736.0 / pow(K, 3.0)));
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (l <= -4.2e+103) tmp = Float64(U + Float64(l * Float64(J * 2.0))); elseif (l <= -6e+34) tmp = U ^ -3.0; elseif (l <= 1.45e-11) tmp = fma(J, Float64(l * 2.0), U); else tmp = Float64(U + Float64(J * Float64(68719476736.0 / (K ^ 3.0)))); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[l, -4.2e+103], N[(U + N[(l * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -6e+34], N[Power[U, -3.0], $MachinePrecision], If[LessEqual[l, 1.45e-11], N[(J * N[(l * 2.0), $MachinePrecision] + U), $MachinePrecision], N[(U + N[(J * N[(68719476736.0 / N[Power[K, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -4.2 \cdot 10^{+103}:\\
\;\;\;\;U + \ell \cdot \left(J \cdot 2\right)\\
\mathbf{elif}\;\ell \leq -6 \cdot 10^{+34}:\\
\;\;\;\;{U}^{-3}\\
\mathbf{elif}\;\ell \leq 1.45 \cdot 10^{-11}:\\
\;\;\;\;\mathsf{fma}\left(J, \ell \cdot 2, U\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \frac{68719476736}{{K}^{3}}\\
\end{array}
\end{array}
if l < -4.2000000000000003e103Initial program 100.0%
Taylor expanded in K around 0 76.2%
Taylor expanded in l around 0 24.1%
associate-*r*24.1%
Simplified24.1%
if -4.2000000000000003e103 < l < -6.00000000000000037e34Initial program 100.0%
Applied egg-rr43.9%
if -6.00000000000000037e34 < l < 1.45e-11Initial program 81.7%
Taylor expanded in K around 0 81.4%
Taylor expanded in l around 0 87.1%
associate-*r*87.1%
+-commutative87.1%
associate-*r*87.1%
*-commutative87.1%
associate-*l*87.1%
fma-define87.1%
Simplified87.1%
if 1.45e-11 < l Initial program 100.0%
Applied egg-rr3.0%
Taylor expanded in K around 0 17.3%
*-commutative17.3%
*-commutative17.3%
associate-*l*16.1%
distribute-lft-out16.1%
Simplified16.1%
Applied egg-rr20.4%
Taylor expanded in K around 0 19.0%
associate-*r/19.0%
*-commutative19.0%
associate-/l*20.3%
Simplified20.3%
Final simplification55.1%
(FPCore (J l K U) :precision binary64 (fma J (* l 2.0) U))
double code(double J, double l, double K, double U) {
return fma(J, (l * 2.0), U);
}
function code(J, l, K, U) return fma(J, Float64(l * 2.0), U) end
code[J_, l_, K_, U_] := N[(J * N[(l * 2.0), $MachinePrecision] + U), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(J, \ell \cdot 2, U\right)
\end{array}
Initial program 91.0%
Taylor expanded in K around 0 80.7%
Taylor expanded in l around 0 52.5%
associate-*r*52.5%
+-commutative52.5%
associate-*r*52.5%
*-commutative52.5%
associate-*l*52.5%
fma-define52.5%
Simplified52.5%
(FPCore (J l K U) :precision binary64 (if (or (<= l -1.2e+45) (not (<= l 160000.0))) (* U U) U))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -1.2e+45) || !(l <= 160000.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 <= (-1.2d+45)) .or. (.not. (l <= 160000.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 <= -1.2e+45) || !(l <= 160000.0)) {
tmp = U * U;
} else {
tmp = U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -1.2e+45) or not (l <= 160000.0): tmp = U * U else: tmp = U return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -1.2e+45) || !(l <= 160000.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 <= -1.2e+45) || ~((l <= 160000.0))) tmp = U * U; else tmp = U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -1.2e+45], N[Not[LessEqual[l, 160000.0]], $MachinePrecision]], N[(U * U), $MachinePrecision], U]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.2 \cdot 10^{+45} \lor \neg \left(\ell \leq 160000\right):\\
\;\;\;\;U \cdot U\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\end{array}
if l < -1.19999999999999995e45 or 1.6e5 < l Initial program 100.0%
Applied egg-rr15.9%
if -1.19999999999999995e45 < l < 1.6e5Initial program 82.5%
Taylor expanded in J around 0 73.1%
Final simplification45.4%
(FPCore (J l K U) :precision binary64 (if (<= l -1.2e+45) (* U (+ U -1.0)) (if (<= l 1600000.0) U (* U U))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -1.2e+45) {
tmp = U * (U + -1.0);
} else if (l <= 1600000.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 <= (-1.2d+45)) then
tmp = u * (u + (-1.0d0))
else if (l <= 1600000.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 <= -1.2e+45) {
tmp = U * (U + -1.0);
} else if (l <= 1600000.0) {
tmp = U;
} else {
tmp = U * U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -1.2e+45: tmp = U * (U + -1.0) elif l <= 1600000.0: tmp = U else: tmp = U * U return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -1.2e+45) tmp = Float64(U * Float64(U + -1.0)); elseif (l <= 1600000.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 <= -1.2e+45) tmp = U * (U + -1.0); elseif (l <= 1600000.0) tmp = U; else tmp = U * U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -1.2e+45], N[(U * N[(U + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1600000.0], U, N[(U * U), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.2 \cdot 10^{+45}:\\
\;\;\;\;U \cdot \left(U + -1\right)\\
\mathbf{elif}\;\ell \leq 1600000:\\
\;\;\;\;U\\
\mathbf{else}:\\
\;\;\;\;U \cdot U\\
\end{array}
\end{array}
if l < -1.19999999999999995e45Initial program 100.0%
Taylor expanded in K around 0 76.9%
Applied egg-rr18.9%
fma-undefine18.9%
neg-mul-118.9%
distribute-rgt-out18.9%
Simplified18.9%
if -1.19999999999999995e45 < l < 1.6e6Initial program 82.5%
Taylor expanded in J around 0 73.1%
if 1.6e6 < l Initial program 100.0%
Applied egg-rr13.9%
(FPCore (J l K U) :precision binary64 (+ U (* l (* J 2.0))))
double code(double J, double l, double K, double U) {
return U + (l * (J * 2.0));
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = u + (l * (j * 2.0d0))
end function
public static double code(double J, double l, double K, double U) {
return U + (l * (J * 2.0));
}
def code(J, l, K, U): return U + (l * (J * 2.0))
function code(J, l, K, U) return Float64(U + Float64(l * Float64(J * 2.0))) end
function tmp = code(J, l, K, U) tmp = U + (l * (J * 2.0)); end
code[J_, l_, K_, U_] := N[(U + N[(l * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + \ell \cdot \left(J \cdot 2\right)
\end{array}
Initial program 91.0%
Taylor expanded in K around 0 80.7%
Taylor expanded in l around 0 52.5%
associate-*r*52.5%
Simplified52.5%
Final simplification52.5%
(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 91.0%
Taylor expanded in J around 0 38.6%
(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 91.0%
Applied egg-rr2.7%
*-inverses2.7%
Simplified2.7%
(FPCore (J l K U) :precision binary64 0.0)
double code(double J, double l, double K, double U) {
return 0.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 = 0.0d0
end function
public static double code(double J, double l, double K, double U) {
return 0.0;
}
def code(J, l, K, U): return 0.0
function code(J, l, K, U) return 0.0 end
function tmp = code(J, l, K, U) tmp = 0.0; end
code[J_, l_, K_, U_] := 0.0
\begin{array}{l}
\\
0
\end{array}
Initial program 91.0%
Taylor expanded in K around 0 80.7%
Applied egg-rr2.2%
+-inverses2.2%
Simplified2.2%
herbie shell --seed 2024108
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))