
(FPCore (J l K U) :precision binary64 (+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))
double code(double J, double l, double K, double U) {
return ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = ((j * (exp(l) - exp(-l))) * cos((k / 2.0d0))) + u
end function
public static double code(double J, double l, double K, double U) {
return ((J * (Math.exp(l) - Math.exp(-l))) * Math.cos((K / 2.0))) + U;
}
def code(J, l, K, U): return ((J * (math.exp(l) - math.exp(-l))) * math.cos((K / 2.0))) + U
function code(J, l, K, U) return Float64(Float64(Float64(J * Float64(exp(l) - exp(Float64(-l)))) * cos(Float64(K / 2.0))) + U) end
function tmp = code(J, l, K, U) tmp = ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U; end
code[J_, l_, K_, U_] := N[(N[(N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]
\begin{array}{l}
\\
\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 17 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (J l K U) :precision binary64 (+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))
double code(double J, double l, double K, double U) {
return ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = ((j * (exp(l) - exp(-l))) * cos((k / 2.0d0))) + u
end function
public static double code(double J, double l, double K, double U) {
return ((J * (Math.exp(l) - Math.exp(-l))) * Math.cos((K / 2.0))) + U;
}
def code(J, l, K, U): return ((J * (math.exp(l) - math.exp(-l))) * math.cos((K / 2.0))) + U
function code(J, l, K, U) return Float64(Float64(Float64(J * Float64(exp(l) - exp(Float64(-l)))) * cos(Float64(K / 2.0))) + U) end
function tmp = code(J, l, K, U) tmp = ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U; end
code[J_, l_, K_, U_] := N[(N[(N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]
\begin{array}{l}
\\
\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U
\end{array}
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))) (t_1 (- (exp l) (exp (- l)))))
(if (or (<= t_1 (- INFINITY)) (not (<= t_1 0.02)))
(+ (* (* t_1 J) t_0) U)
(+
U
(*
t_0
(*
J
(+
(* 0.016666666666666666 (pow l 5.0))
(+ (* 0.3333333333333333 (pow l 3.0)) (* l 2.0)))))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double t_1 = exp(l) - exp(-l);
double tmp;
if ((t_1 <= -((double) INFINITY)) || !(t_1 <= 0.02)) {
tmp = ((t_1 * J) * t_0) + U;
} else {
tmp = U + (t_0 * (J * ((0.016666666666666666 * pow(l, 5.0)) + ((0.3333333333333333 * pow(l, 3.0)) + (l * 2.0)))));
}
return tmp;
}
public static double code(double J, double l, double K, double U) {
double t_0 = Math.cos((K / 2.0));
double t_1 = Math.exp(l) - Math.exp(-l);
double tmp;
if ((t_1 <= -Double.POSITIVE_INFINITY) || !(t_1 <= 0.02)) {
tmp = ((t_1 * J) * t_0) + U;
} else {
tmp = U + (t_0 * (J * ((0.016666666666666666 * Math.pow(l, 5.0)) + ((0.3333333333333333 * Math.pow(l, 3.0)) + (l * 2.0)))));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K / 2.0)) t_1 = math.exp(l) - math.exp(-l) tmp = 0 if (t_1 <= -math.inf) or not (t_1 <= 0.02): tmp = ((t_1 * J) * t_0) + U else: tmp = U + (t_0 * (J * ((0.016666666666666666 * math.pow(l, 5.0)) + ((0.3333333333333333 * math.pow(l, 3.0)) + (l * 2.0))))) return tmp
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) t_1 = Float64(exp(l) - exp(Float64(-l))) tmp = 0.0 if ((t_1 <= Float64(-Inf)) || !(t_1 <= 0.02)) tmp = Float64(Float64(Float64(t_1 * J) * t_0) + U); else tmp = Float64(U + Float64(t_0 * Float64(J * Float64(Float64(0.016666666666666666 * (l ^ 5.0)) + Float64(Float64(0.3333333333333333 * (l ^ 3.0)) + Float64(l * 2.0)))))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = cos((K / 2.0)); t_1 = exp(l) - exp(-l); tmp = 0.0; if ((t_1 <= -Inf) || ~((t_1 <= 0.02))) tmp = ((t_1 * J) * t_0) + U; else tmp = U + (t_0 * (J * ((0.016666666666666666 * (l ^ 5.0)) + ((0.3333333333333333 * (l ^ 3.0)) + (l * 2.0))))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, (-Infinity)], N[Not[LessEqual[t$95$1, 0.02]], $MachinePrecision]], N[(N[(N[(t$95$1 * J), $MachinePrecision] * t$95$0), $MachinePrecision] + U), $MachinePrecision], N[(U + N[(t$95$0 * N[(J * N[(N[(0.016666666666666666 * N[Power[l, 5.0], $MachinePrecision]), $MachinePrecision] + N[(N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision] + N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
t_1 := e^{\ell} - e^{-\ell}\\
\mathbf{if}\;t_1 \leq -\infty \lor \neg \left(t_1 \leq 0.02\right):\\
\;\;\;\;\left(t_1 \cdot J\right) \cdot t_0 + U\\
\mathbf{else}:\\
\;\;\;\;U + t_0 \cdot \left(J \cdot \left(0.016666666666666666 \cdot {\ell}^{5} + \left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right)\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -inf.0 or 0.0200000000000000004 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 100.0%
if -inf.0 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 0.0200000000000000004Initial program 66.2%
Taylor expanded in l around 0 99.9%
Final simplification99.9%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (- (exp l) (exp (- l)))))
(if (or (<= t_0 (- INFINITY)) (not (<= t_0 1e-9)))
(+ (* (* t_0 J) (cos (/ K 2.0))) U)
(+ U (* (* l J) (* 2.0 (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 <= 1e-9)) {
tmp = ((t_0 * J) * cos((K / 2.0))) + U;
} else {
tmp = U + ((l * J) * (2.0 * 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 <= 1e-9)) {
tmp = ((t_0 * J) * Math.cos((K / 2.0))) + U;
} else {
tmp = U + ((l * J) * (2.0 * 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 <= 1e-9): tmp = ((t_0 * J) * math.cos((K / 2.0))) + U else: tmp = U + ((l * J) * (2.0 * 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 <= 1e-9)) tmp = Float64(Float64(Float64(t_0 * J) * cos(Float64(K / 2.0))) + U); else tmp = Float64(U + Float64(Float64(l * J) * Float64(2.0 * 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 <= 1e-9))) tmp = ((t_0 * J) * cos((K / 2.0))) + U; else tmp = U + ((l * J) * (2.0 * 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, 1e-9]], $MachinePrecision]], N[(N[(N[(t$95$0 * J), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], N[(U + N[(N[(l * J), $MachinePrecision] * N[(2.0 * N[Cos[N[(K * 0.5), $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 10^{-9}\right):\\
\;\;\;\;\left(t_0 \cdot J\right) \cdot \cos \left(\frac{K}{2}\right) + U\\
\mathbf{else}:\\
\;\;\;\;U + \left(\ell \cdot J\right) \cdot \left(2 \cdot \cos \left(K \cdot 0.5\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -inf.0 or 1.00000000000000006e-9 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 99.9%
if -inf.0 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 1.00000000000000006e-9Initial program 65.7%
Taylor expanded in l around 0 99.9%
*-commutative99.9%
associate-*r*99.9%
associate-*l*99.9%
*-commutative99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (* K 0.5)))
(t_1 (+ U (* (pow l 5.0) (* 0.016666666666666666 (* J t_0)))))
(t_2 (+ (* (- (exp l) (exp (- l))) J) U)))
(if (<= l -4.2e+90)
t_1
(if (<= l -8.5e-5)
t_2
(if (<= l 0.000145)
(+ U (* (* l J) (* 2.0 t_0)))
(if (<= l 4.2e+61) t_2 t_1))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K * 0.5));
double t_1 = U + (pow(l, 5.0) * (0.016666666666666666 * (J * t_0)));
double t_2 = ((exp(l) - exp(-l)) * J) + U;
double tmp;
if (l <= -4.2e+90) {
tmp = t_1;
} else if (l <= -8.5e-5) {
tmp = t_2;
} else if (l <= 0.000145) {
tmp = U + ((l * J) * (2.0 * t_0));
} else if (l <= 4.2e+61) {
tmp = t_2;
} else {
tmp = t_1;
}
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) :: t_2
real(8) :: tmp
t_0 = cos((k * 0.5d0))
t_1 = u + ((l ** 5.0d0) * (0.016666666666666666d0 * (j * t_0)))
t_2 = ((exp(l) - exp(-l)) * j) + u
if (l <= (-4.2d+90)) then
tmp = t_1
else if (l <= (-8.5d-5)) then
tmp = t_2
else if (l <= 0.000145d0) then
tmp = u + ((l * j) * (2.0d0 * t_0))
else if (l <= 4.2d+61) then
tmp = t_2
else
tmp = t_1
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = Math.cos((K * 0.5));
double t_1 = U + (Math.pow(l, 5.0) * (0.016666666666666666 * (J * t_0)));
double t_2 = ((Math.exp(l) - Math.exp(-l)) * J) + U;
double tmp;
if (l <= -4.2e+90) {
tmp = t_1;
} else if (l <= -8.5e-5) {
tmp = t_2;
} else if (l <= 0.000145) {
tmp = U + ((l * J) * (2.0 * t_0));
} else if (l <= 4.2e+61) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K * 0.5)) t_1 = U + (math.pow(l, 5.0) * (0.016666666666666666 * (J * t_0))) t_2 = ((math.exp(l) - math.exp(-l)) * J) + U tmp = 0 if l <= -4.2e+90: tmp = t_1 elif l <= -8.5e-5: tmp = t_2 elif l <= 0.000145: tmp = U + ((l * J) * (2.0 * t_0)) elif l <= 4.2e+61: tmp = t_2 else: tmp = t_1 return tmp
function code(J, l, K, U) t_0 = cos(Float64(K * 0.5)) t_1 = Float64(U + Float64((l ^ 5.0) * Float64(0.016666666666666666 * Float64(J * t_0)))) t_2 = Float64(Float64(Float64(exp(l) - exp(Float64(-l))) * J) + U) tmp = 0.0 if (l <= -4.2e+90) tmp = t_1; elseif (l <= -8.5e-5) tmp = t_2; elseif (l <= 0.000145) tmp = Float64(U + Float64(Float64(l * J) * Float64(2.0 * t_0))); elseif (l <= 4.2e+61) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = cos((K * 0.5)); t_1 = U + ((l ^ 5.0) * (0.016666666666666666 * (J * t_0))); t_2 = ((exp(l) - exp(-l)) * J) + U; tmp = 0.0; if (l <= -4.2e+90) tmp = t_1; elseif (l <= -8.5e-5) tmp = t_2; elseif (l <= 0.000145) tmp = U + ((l * J) * (2.0 * t_0)); elseif (l <= 4.2e+61) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(U + N[(N[Power[l, 5.0], $MachinePrecision] * N[(0.016666666666666666 * N[(J * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision] + U), $MachinePrecision]}, If[LessEqual[l, -4.2e+90], t$95$1, If[LessEqual[l, -8.5e-5], t$95$2, If[LessEqual[l, 0.000145], N[(U + N[(N[(l * J), $MachinePrecision] * N[(2.0 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 4.2e+61], t$95$2, t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(K \cdot 0.5\right)\\
t_1 := U + {\ell}^{5} \cdot \left(0.016666666666666666 \cdot \left(J \cdot t_0\right)\right)\\
t_2 := \left(e^{\ell} - e^{-\ell}\right) \cdot J + U\\
\mathbf{if}\;\ell \leq -4.2 \cdot 10^{+90}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\ell \leq -8.5 \cdot 10^{-5}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\ell \leq 0.000145:\\
\;\;\;\;U + \left(\ell \cdot J\right) \cdot \left(2 \cdot t_0\right)\\
\mathbf{elif}\;\ell \leq 4.2 \cdot 10^{+61}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if l < -4.19999999999999961e90 or 4.2000000000000002e61 < l Initial program 100.0%
Taylor expanded in l around 0 100.0%
Taylor expanded in l around inf 100.0%
associate-*r*100.0%
*-commutative100.0%
*-commutative100.0%
associate-*l*100.0%
associate-*l*100.0%
*-commutative100.0%
associate-*l*100.0%
*-commutative100.0%
Simplified100.0%
if -4.19999999999999961e90 < l < -8.500000000000001e-5 or 1.45e-4 < l < 4.2000000000000002e61Initial program 99.7%
Taylor expanded in K around 0 87.2%
if -8.500000000000001e-5 < l < 1.45e-4Initial program 65.7%
Taylor expanded in l around 0 99.9%
*-commutative99.9%
associate-*r*99.9%
associate-*l*99.9%
*-commutative99.9%
Simplified99.9%
Final simplification98.5%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (* K 0.5)))
(t_1 (+ U (* (pow l 5.0) (* 0.016666666666666666 (* J t_0)))))
(t_2 (* (- (exp l) (exp (- l))) J)))
(if (<= l -4.4e+92)
t_1
(if (<= l -230.0)
(+ U (* t_2 (+ 1.0 (* -0.125 (* K K)))))
(if (<= l 0.00055)
(+ U (* (* l J) (* 2.0 t_0)))
(if (<= l 4.5e+61) (+ t_2 U) t_1))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K * 0.5));
double t_1 = U + (pow(l, 5.0) * (0.016666666666666666 * (J * t_0)));
double t_2 = (exp(l) - exp(-l)) * J;
double tmp;
if (l <= -4.4e+92) {
tmp = t_1;
} else if (l <= -230.0) {
tmp = U + (t_2 * (1.0 + (-0.125 * (K * K))));
} else if (l <= 0.00055) {
tmp = U + ((l * J) * (2.0 * t_0));
} else if (l <= 4.5e+61) {
tmp = t_2 + U;
} else {
tmp = t_1;
}
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) :: t_2
real(8) :: tmp
t_0 = cos((k * 0.5d0))
t_1 = u + ((l ** 5.0d0) * (0.016666666666666666d0 * (j * t_0)))
t_2 = (exp(l) - exp(-l)) * j
if (l <= (-4.4d+92)) then
tmp = t_1
else if (l <= (-230.0d0)) then
tmp = u + (t_2 * (1.0d0 + ((-0.125d0) * (k * k))))
else if (l <= 0.00055d0) then
tmp = u + ((l * j) * (2.0d0 * t_0))
else if (l <= 4.5d+61) then
tmp = t_2 + u
else
tmp = t_1
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = Math.cos((K * 0.5));
double t_1 = U + (Math.pow(l, 5.0) * (0.016666666666666666 * (J * t_0)));
double t_2 = (Math.exp(l) - Math.exp(-l)) * J;
double tmp;
if (l <= -4.4e+92) {
tmp = t_1;
} else if (l <= -230.0) {
tmp = U + (t_2 * (1.0 + (-0.125 * (K * K))));
} else if (l <= 0.00055) {
tmp = U + ((l * J) * (2.0 * t_0));
} else if (l <= 4.5e+61) {
tmp = t_2 + U;
} else {
tmp = t_1;
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K * 0.5)) t_1 = U + (math.pow(l, 5.0) * (0.016666666666666666 * (J * t_0))) t_2 = (math.exp(l) - math.exp(-l)) * J tmp = 0 if l <= -4.4e+92: tmp = t_1 elif l <= -230.0: tmp = U + (t_2 * (1.0 + (-0.125 * (K * K)))) elif l <= 0.00055: tmp = U + ((l * J) * (2.0 * t_0)) elif l <= 4.5e+61: tmp = t_2 + U else: tmp = t_1 return tmp
function code(J, l, K, U) t_0 = cos(Float64(K * 0.5)) t_1 = Float64(U + Float64((l ^ 5.0) * Float64(0.016666666666666666 * Float64(J * t_0)))) t_2 = Float64(Float64(exp(l) - exp(Float64(-l))) * J) tmp = 0.0 if (l <= -4.4e+92) tmp = t_1; elseif (l <= -230.0) tmp = Float64(U + Float64(t_2 * Float64(1.0 + Float64(-0.125 * Float64(K * K))))); elseif (l <= 0.00055) tmp = Float64(U + Float64(Float64(l * J) * Float64(2.0 * t_0))); elseif (l <= 4.5e+61) tmp = Float64(t_2 + U); else tmp = t_1; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = cos((K * 0.5)); t_1 = U + ((l ^ 5.0) * (0.016666666666666666 * (J * t_0))); t_2 = (exp(l) - exp(-l)) * J; tmp = 0.0; if (l <= -4.4e+92) tmp = t_1; elseif (l <= -230.0) tmp = U + (t_2 * (1.0 + (-0.125 * (K * K)))); elseif (l <= 0.00055) tmp = U + ((l * J) * (2.0 * t_0)); elseif (l <= 4.5e+61) tmp = t_2 + U; else tmp = t_1; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(U + N[(N[Power[l, 5.0], $MachinePrecision] * N[(0.016666666666666666 * N[(J * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision]}, If[LessEqual[l, -4.4e+92], t$95$1, If[LessEqual[l, -230.0], N[(U + N[(t$95$2 * N[(1.0 + N[(-0.125 * N[(K * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 0.00055], N[(U + N[(N[(l * J), $MachinePrecision] * N[(2.0 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 4.5e+61], N[(t$95$2 + U), $MachinePrecision], t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(K \cdot 0.5\right)\\
t_1 := U + {\ell}^{5} \cdot \left(0.016666666666666666 \cdot \left(J \cdot t_0\right)\right)\\
t_2 := \left(e^{\ell} - e^{-\ell}\right) \cdot J\\
\mathbf{if}\;\ell \leq -4.4 \cdot 10^{+92}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\ell \leq -230:\\
\;\;\;\;U + t_2 \cdot \left(1 + -0.125 \cdot \left(K \cdot K\right)\right)\\
\mathbf{elif}\;\ell \leq 0.00055:\\
\;\;\;\;U + \left(\ell \cdot J\right) \cdot \left(2 \cdot t_0\right)\\
\mathbf{elif}\;\ell \leq 4.5 \cdot 10^{+61}:\\
\;\;\;\;t_2 + U\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if l < -4.39999999999999984e92 or 4.5e61 < l Initial program 100.0%
Taylor expanded in l around 0 100.0%
Taylor expanded in l around inf 100.0%
associate-*r*100.0%
*-commutative100.0%
*-commutative100.0%
associate-*l*100.0%
associate-*l*100.0%
*-commutative100.0%
associate-*l*100.0%
*-commutative100.0%
Simplified100.0%
if -4.39999999999999984e92 < l < -230Initial program 100.0%
Taylor expanded in K around 0 89.5%
unpow289.5%
Simplified89.5%
if -230 < l < 5.50000000000000033e-4Initial program 65.7%
Taylor expanded in l around 0 99.9%
*-commutative99.9%
associate-*r*99.9%
associate-*l*99.9%
*-commutative99.9%
Simplified99.9%
if 5.50000000000000033e-4 < l < 4.5e61Initial program 99.2%
Taylor expanded in K around 0 84.7%
Final simplification98.5%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) 0.08) (+ U (* (* l J) (* 2.0 (cos (* K 0.5))))) (+ U (* J (+ (* 0.3333333333333333 (pow l 3.0)) (* l 2.0))))))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= 0.08) {
tmp = U + ((l * J) * (2.0 * cos((K * 0.5))));
} else {
tmp = U + (J * ((0.3333333333333333 * pow(l, 3.0)) + (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) :: tmp
if (cos((k / 2.0d0)) <= 0.08d0) then
tmp = u + ((l * j) * (2.0d0 * cos((k * 0.5d0))))
else
tmp = u + (j * ((0.3333333333333333d0 * (l ** 3.0d0)) + (l * 2.0d0)))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (Math.cos((K / 2.0)) <= 0.08) {
tmp = U + ((l * J) * (2.0 * Math.cos((K * 0.5))));
} else {
tmp = U + (J * ((0.3333333333333333 * Math.pow(l, 3.0)) + (l * 2.0)));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if math.cos((K / 2.0)) <= 0.08: tmp = U + ((l * J) * (2.0 * math.cos((K * 0.5)))) else: tmp = U + (J * ((0.3333333333333333 * math.pow(l, 3.0)) + (l * 2.0))) return tmp
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= 0.08) tmp = Float64(U + Float64(Float64(l * J) * Float64(2.0 * cos(Float64(K * 0.5))))); else tmp = Float64(U + Float64(J * Float64(Float64(0.3333333333333333 * (l ^ 3.0)) + Float64(l * 2.0)))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (cos((K / 2.0)) <= 0.08) tmp = U + ((l * J) * (2.0 * cos((K * 0.5)))); else tmp = U + (J * ((0.3333333333333333 * (l ^ 3.0)) + (l * 2.0))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], 0.08], N[(U + N[(N[(l * J), $MachinePrecision] * N[(2.0 * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * N[(N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision] + N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq 0.08:\\
\;\;\;\;U + \left(\ell \cdot J\right) \cdot \left(2 \cdot \cos \left(K \cdot 0.5\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K 2)) < 0.0800000000000000017Initial program 79.0%
Taylor expanded in l around 0 74.5%
*-commutative74.5%
associate-*r*74.6%
associate-*l*74.6%
*-commutative74.6%
Simplified74.6%
if 0.0800000000000000017 < (cos.f64 (/.f64 K 2)) Initial program 83.4%
Taylor expanded in l around 0 88.2%
Taylor expanded in K around 0 84.9%
Final simplification82.6%
(FPCore (J l K U) :precision binary64 (if (or (<= l -0.0031) (not (<= l 0.0007))) (+ (* (- (exp l) (exp (- l))) J) U) (+ U (* (* l J) (* 2.0 (cos (* K 0.5)))))))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -0.0031) || !(l <= 0.0007)) {
tmp = ((exp(l) - exp(-l)) * J) + U;
} else {
tmp = U + ((l * J) * (2.0 * 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 <= (-0.0031d0)) .or. (.not. (l <= 0.0007d0))) then
tmp = ((exp(l) - exp(-l)) * j) + u
else
tmp = u + ((l * j) * (2.0d0 * 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 <= -0.0031) || !(l <= 0.0007)) {
tmp = ((Math.exp(l) - Math.exp(-l)) * J) + U;
} else {
tmp = U + ((l * J) * (2.0 * Math.cos((K * 0.5))));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -0.0031) or not (l <= 0.0007): tmp = ((math.exp(l) - math.exp(-l)) * J) + U else: tmp = U + ((l * J) * (2.0 * math.cos((K * 0.5)))) return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -0.0031) || !(l <= 0.0007)) tmp = Float64(Float64(Float64(exp(l) - exp(Float64(-l))) * J) + U); else tmp = Float64(U + Float64(Float64(l * J) * Float64(2.0 * cos(Float64(K * 0.5))))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -0.0031) || ~((l <= 0.0007))) tmp = ((exp(l) - exp(-l)) * J) + U; else tmp = U + ((l * J) * (2.0 * cos((K * 0.5)))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -0.0031], N[Not[LessEqual[l, 0.0007]], $MachinePrecision]], N[(N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision] + U), $MachinePrecision], N[(U + N[(N[(l * J), $MachinePrecision] * N[(2.0 * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -0.0031 \lor \neg \left(\ell \leq 0.0007\right):\\
\;\;\;\;\left(e^{\ell} - e^{-\ell}\right) \cdot J + U\\
\mathbf{else}:\\
\;\;\;\;U + \left(\ell \cdot J\right) \cdot \left(2 \cdot \cos \left(K \cdot 0.5\right)\right)\\
\end{array}
\end{array}
if l < -0.00309999999999999989 or 6.99999999999999993e-4 < l Initial program 99.9%
Taylor expanded in K around 0 80.9%
if -0.00309999999999999989 < l < 6.99999999999999993e-4Initial program 65.7%
Taylor expanded in l around 0 99.9%
*-commutative99.9%
associate-*r*99.9%
associate-*l*99.9%
*-commutative99.9%
Simplified99.9%
Final simplification90.6%
(FPCore (J l K U)
:precision binary64
(if (<= l -4.3e+71)
(+ U (* (* l 2.0) (* J (+ 1.0 (* -0.125 (* K K))))))
(if (<= l -2200.0)
(fabs (* U (+ U 8.0)))
(+ U (* 2.0 (* J (* l (cos (* K 0.5)))))))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -4.3e+71) {
tmp = U + ((l * 2.0) * (J * (1.0 + (-0.125 * (K * K)))));
} else if (l <= -2200.0) {
tmp = fabs((U * (U + 8.0)));
} 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 <= (-4.3d+71)) then
tmp = u + ((l * 2.0d0) * (j * (1.0d0 + ((-0.125d0) * (k * k)))))
else if (l <= (-2200.0d0)) then
tmp = abs((u * (u + 8.0d0)))
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 <= -4.3e+71) {
tmp = U + ((l * 2.0) * (J * (1.0 + (-0.125 * (K * K)))));
} else if (l <= -2200.0) {
tmp = Math.abs((U * (U + 8.0)));
} else {
tmp = U + (2.0 * (J * (l * Math.cos((K * 0.5)))));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -4.3e+71: tmp = U + ((l * 2.0) * (J * (1.0 + (-0.125 * (K * K))))) elif l <= -2200.0: tmp = math.fabs((U * (U + 8.0))) 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 <= -4.3e+71) tmp = Float64(U + Float64(Float64(l * 2.0) * Float64(J * Float64(1.0 + Float64(-0.125 * Float64(K * K)))))); elseif (l <= -2200.0) tmp = abs(Float64(U * Float64(U + 8.0))); 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 <= -4.3e+71) tmp = U + ((l * 2.0) * (J * (1.0 + (-0.125 * (K * K))))); elseif (l <= -2200.0) tmp = abs((U * (U + 8.0))); else tmp = U + (2.0 * (J * (l * cos((K * 0.5))))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -4.3e+71], N[(U + N[(N[(l * 2.0), $MachinePrecision] * N[(J * N[(1.0 + N[(-0.125 * N[(K * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -2200.0], N[Abs[N[(U * N[(U + 8.0), $MachinePrecision]), $MachinePrecision]], $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 -4.3 \cdot 10^{+71}:\\
\;\;\;\;U + \left(\ell \cdot 2\right) \cdot \left(J \cdot \left(1 + -0.125 \cdot \left(K \cdot K\right)\right)\right)\\
\mathbf{elif}\;\ell \leq -2200:\\
\;\;\;\;\left|U \cdot \left(U + 8\right)\right|\\
\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 < -4.29999999999999984e71Initial program 100.0%
Taylor expanded in l around 0 29.9%
*-commutative29.9%
associate-*l*29.9%
*-commutative29.9%
associate-*r*29.9%
Simplified29.9%
Taylor expanded in K around 0 39.3%
unpow239.3%
Simplified39.3%
if -4.29999999999999984e71 < l < -2200Initial program 100.0%
Applied egg-rr43.5%
add-sqr-sqrt43.2%
sqrt-unprod43.5%
pow243.5%
sub-neg43.5%
metadata-eval43.5%
Applied egg-rr43.5%
unpow243.5%
rem-sqrt-square43.6%
+-commutative43.6%
Simplified43.6%
if -2200 < l Initial program 76.8%
Taylor expanded in l around 0 77.0%
Final simplification68.1%
(FPCore (J l K U)
:precision binary64
(if (<= l -3.5e+71)
(+ U (* (* l 2.0) (* J (+ 1.0 (* -0.125 (* K K))))))
(if (<= l -1300.0)
(fabs (* U (+ U 8.0)))
(+ U (* (* l 2.0) (* J (cos (* K 0.5))))))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -3.5e+71) {
tmp = U + ((l * 2.0) * (J * (1.0 + (-0.125 * (K * K)))));
} else if (l <= -1300.0) {
tmp = fabs((U * (U + 8.0)));
} else {
tmp = U + ((l * 2.0) * (J * 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 <= (-3.5d+71)) then
tmp = u + ((l * 2.0d0) * (j * (1.0d0 + ((-0.125d0) * (k * k)))))
else if (l <= (-1300.0d0)) then
tmp = abs((u * (u + 8.0d0)))
else
tmp = u + ((l * 2.0d0) * (j * 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 <= -3.5e+71) {
tmp = U + ((l * 2.0) * (J * (1.0 + (-0.125 * (K * K)))));
} else if (l <= -1300.0) {
tmp = Math.abs((U * (U + 8.0)));
} else {
tmp = U + ((l * 2.0) * (J * Math.cos((K * 0.5))));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -3.5e+71: tmp = U + ((l * 2.0) * (J * (1.0 + (-0.125 * (K * K))))) elif l <= -1300.0: tmp = math.fabs((U * (U + 8.0))) else: tmp = U + ((l * 2.0) * (J * math.cos((K * 0.5)))) return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -3.5e+71) tmp = Float64(U + Float64(Float64(l * 2.0) * Float64(J * Float64(1.0 + Float64(-0.125 * Float64(K * K)))))); elseif (l <= -1300.0) tmp = abs(Float64(U * Float64(U + 8.0))); else tmp = Float64(U + Float64(Float64(l * 2.0) * Float64(J * cos(Float64(K * 0.5))))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -3.5e+71) tmp = U + ((l * 2.0) * (J * (1.0 + (-0.125 * (K * K))))); elseif (l <= -1300.0) tmp = abs((U * (U + 8.0))); else tmp = U + ((l * 2.0) * (J * cos((K * 0.5)))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -3.5e+71], N[(U + N[(N[(l * 2.0), $MachinePrecision] * N[(J * N[(1.0 + N[(-0.125 * N[(K * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -1300.0], N[Abs[N[(U * N[(U + 8.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(U + N[(N[(l * 2.0), $MachinePrecision] * N[(J * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -3.5 \cdot 10^{+71}:\\
\;\;\;\;U + \left(\ell \cdot 2\right) \cdot \left(J \cdot \left(1 + -0.125 \cdot \left(K \cdot K\right)\right)\right)\\
\mathbf{elif}\;\ell \leq -1300:\\
\;\;\;\;\left|U \cdot \left(U + 8\right)\right|\\
\mathbf{else}:\\
\;\;\;\;U + \left(\ell \cdot 2\right) \cdot \left(J \cdot \cos \left(K \cdot 0.5\right)\right)\\
\end{array}
\end{array}
if l < -3.4999999999999999e71Initial program 100.0%
Taylor expanded in l around 0 29.9%
*-commutative29.9%
associate-*l*29.9%
*-commutative29.9%
associate-*r*29.9%
Simplified29.9%
Taylor expanded in K around 0 39.3%
unpow239.3%
Simplified39.3%
if -3.4999999999999999e71 < l < -1300Initial program 100.0%
Applied egg-rr43.5%
add-sqr-sqrt43.2%
sqrt-unprod43.5%
pow243.5%
sub-neg43.5%
metadata-eval43.5%
Applied egg-rr43.5%
unpow243.5%
rem-sqrt-square43.6%
+-commutative43.6%
Simplified43.6%
if -1300 < l Initial program 76.8%
Taylor expanded in l around 0 77.0%
*-commutative77.0%
associate-*l*77.0%
*-commutative77.0%
associate-*r*77.0%
Simplified77.0%
Final simplification68.1%
(FPCore (J l K U)
:precision binary64
(if (<= l -5.5e+71)
(+ U (* (* l 2.0) (* J (+ 1.0 (* -0.125 (* K K))))))
(if (<= l -900.0)
(fabs (* U (+ U 8.0)))
(+ U (* (* l J) (* 2.0 (cos (* K 0.5))))))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -5.5e+71) {
tmp = U + ((l * 2.0) * (J * (1.0 + (-0.125 * (K * K)))));
} else if (l <= -900.0) {
tmp = fabs((U * (U + 8.0)));
} else {
tmp = U + ((l * J) * (2.0 * 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 <= (-5.5d+71)) then
tmp = u + ((l * 2.0d0) * (j * (1.0d0 + ((-0.125d0) * (k * k)))))
else if (l <= (-900.0d0)) then
tmp = abs((u * (u + 8.0d0)))
else
tmp = u + ((l * j) * (2.0d0 * 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 <= -5.5e+71) {
tmp = U + ((l * 2.0) * (J * (1.0 + (-0.125 * (K * K)))));
} else if (l <= -900.0) {
tmp = Math.abs((U * (U + 8.0)));
} else {
tmp = U + ((l * J) * (2.0 * Math.cos((K * 0.5))));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -5.5e+71: tmp = U + ((l * 2.0) * (J * (1.0 + (-0.125 * (K * K))))) elif l <= -900.0: tmp = math.fabs((U * (U + 8.0))) else: tmp = U + ((l * J) * (2.0 * math.cos((K * 0.5)))) return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -5.5e+71) tmp = Float64(U + Float64(Float64(l * 2.0) * Float64(J * Float64(1.0 + Float64(-0.125 * Float64(K * K)))))); elseif (l <= -900.0) tmp = abs(Float64(U * Float64(U + 8.0))); else tmp = Float64(U + Float64(Float64(l * J) * Float64(2.0 * cos(Float64(K * 0.5))))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -5.5e+71) tmp = U + ((l * 2.0) * (J * (1.0 + (-0.125 * (K * K))))); elseif (l <= -900.0) tmp = abs((U * (U + 8.0))); else tmp = U + ((l * J) * (2.0 * cos((K * 0.5)))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -5.5e+71], N[(U + N[(N[(l * 2.0), $MachinePrecision] * N[(J * N[(1.0 + N[(-0.125 * N[(K * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -900.0], N[Abs[N[(U * N[(U + 8.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(U + N[(N[(l * J), $MachinePrecision] * N[(2.0 * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -5.5 \cdot 10^{+71}:\\
\;\;\;\;U + \left(\ell \cdot 2\right) \cdot \left(J \cdot \left(1 + -0.125 \cdot \left(K \cdot K\right)\right)\right)\\
\mathbf{elif}\;\ell \leq -900:\\
\;\;\;\;\left|U \cdot \left(U + 8\right)\right|\\
\mathbf{else}:\\
\;\;\;\;U + \left(\ell \cdot J\right) \cdot \left(2 \cdot \cos \left(K \cdot 0.5\right)\right)\\
\end{array}
\end{array}
if l < -5.5e71Initial program 100.0%
Taylor expanded in l around 0 29.9%
*-commutative29.9%
associate-*l*29.9%
*-commutative29.9%
associate-*r*29.9%
Simplified29.9%
Taylor expanded in K around 0 39.3%
unpow239.3%
Simplified39.3%
if -5.5e71 < l < -900Initial program 100.0%
Applied egg-rr43.5%
add-sqr-sqrt43.2%
sqrt-unprod43.5%
pow243.5%
sub-neg43.5%
metadata-eval43.5%
Applied egg-rr43.5%
unpow243.5%
rem-sqrt-square43.6%
+-commutative43.6%
Simplified43.6%
if -900 < l Initial program 76.8%
Taylor expanded in l around 0 77.0%
*-commutative77.0%
associate-*r*77.0%
associate-*l*77.0%
*-commutative77.0%
Simplified77.0%
Final simplification68.1%
(FPCore (J l K U) :precision binary64 (if (<= l -4.3e+71) (+ U (* (* l 2.0) (* J (+ 1.0 (* -0.125 (* K K)))))) (if (<= l -820.0) (fabs (* U (+ U 8.0))) (+ U (* J (* l 2.0))))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -4.3e+71) {
tmp = U + ((l * 2.0) * (J * (1.0 + (-0.125 * (K * K)))));
} else if (l <= -820.0) {
tmp = fabs((U * (U + 8.0)));
} else {
tmp = U + (J * (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) :: tmp
if (l <= (-4.3d+71)) then
tmp = u + ((l * 2.0d0) * (j * (1.0d0 + ((-0.125d0) * (k * k)))))
else if (l <= (-820.0d0)) then
tmp = abs((u * (u + 8.0d0)))
else
tmp = u + (j * (l * 2.0d0))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (l <= -4.3e+71) {
tmp = U + ((l * 2.0) * (J * (1.0 + (-0.125 * (K * K)))));
} else if (l <= -820.0) {
tmp = Math.abs((U * (U + 8.0)));
} else {
tmp = U + (J * (l * 2.0));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -4.3e+71: tmp = U + ((l * 2.0) * (J * (1.0 + (-0.125 * (K * K))))) elif l <= -820.0: tmp = math.fabs((U * (U + 8.0))) else: tmp = U + (J * (l * 2.0)) return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -4.3e+71) tmp = Float64(U + Float64(Float64(l * 2.0) * Float64(J * Float64(1.0 + Float64(-0.125 * Float64(K * K)))))); elseif (l <= -820.0) tmp = abs(Float64(U * Float64(U + 8.0))); else tmp = Float64(U + Float64(J * Float64(l * 2.0))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -4.3e+71) tmp = U + ((l * 2.0) * (J * (1.0 + (-0.125 * (K * K))))); elseif (l <= -820.0) tmp = abs((U * (U + 8.0))); else tmp = U + (J * (l * 2.0)); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -4.3e+71], N[(U + N[(N[(l * 2.0), $MachinePrecision] * N[(J * N[(1.0 + N[(-0.125 * N[(K * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -820.0], N[Abs[N[(U * N[(U + 8.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(U + N[(J * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -4.3 \cdot 10^{+71}:\\
\;\;\;\;U + \left(\ell \cdot 2\right) \cdot \left(J \cdot \left(1 + -0.125 \cdot \left(K \cdot K\right)\right)\right)\\
\mathbf{elif}\;\ell \leq -820:\\
\;\;\;\;\left|U \cdot \left(U + 8\right)\right|\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(\ell \cdot 2\right)\\
\end{array}
\end{array}
if l < -4.29999999999999984e71Initial program 100.0%
Taylor expanded in l around 0 29.9%
*-commutative29.9%
associate-*l*29.9%
*-commutative29.9%
associate-*r*29.9%
Simplified29.9%
Taylor expanded in K around 0 39.3%
unpow239.3%
Simplified39.3%
if -4.29999999999999984e71 < l < -820Initial program 100.0%
Applied egg-rr43.5%
add-sqr-sqrt43.2%
sqrt-unprod43.5%
pow243.5%
sub-neg43.5%
metadata-eval43.5%
Applied egg-rr43.5%
unpow243.5%
rem-sqrt-square43.6%
+-commutative43.6%
Simplified43.6%
if -820 < l Initial program 76.8%
Taylor expanded in l around 0 77.0%
*-commutative77.0%
associate-*l*77.0%
*-commutative77.0%
associate-*r*77.0%
Simplified77.0%
Taylor expanded in K around 0 64.6%
Final simplification58.7%
(FPCore (J l K U) :precision binary64 (if (<= l -3.7e+71) (+ U (* (* l 2.0) (* J (+ 1.0 (* -0.125 (* K K)))))) (if (<= l -720.0) (fabs (* U (+ U 8.0))) (fma (* l 2.0) J U))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -3.7e+71) {
tmp = U + ((l * 2.0) * (J * (1.0 + (-0.125 * (K * K)))));
} else if (l <= -720.0) {
tmp = fabs((U * (U + 8.0)));
} else {
tmp = fma((l * 2.0), J, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (l <= -3.7e+71) tmp = Float64(U + Float64(Float64(l * 2.0) * Float64(J * Float64(1.0 + Float64(-0.125 * Float64(K * K)))))); elseif (l <= -720.0) tmp = abs(Float64(U * Float64(U + 8.0))); else tmp = fma(Float64(l * 2.0), J, U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[l, -3.7e+71], N[(U + N[(N[(l * 2.0), $MachinePrecision] * N[(J * N[(1.0 + N[(-0.125 * N[(K * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -720.0], N[Abs[N[(U * N[(U + 8.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[(l * 2.0), $MachinePrecision] * J + U), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -3.7 \cdot 10^{+71}:\\
\;\;\;\;U + \left(\ell \cdot 2\right) \cdot \left(J \cdot \left(1 + -0.125 \cdot \left(K \cdot K\right)\right)\right)\\
\mathbf{elif}\;\ell \leq -720:\\
\;\;\;\;\left|U \cdot \left(U + 8\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\ell \cdot 2, J, U\right)\\
\end{array}
\end{array}
if l < -3.7e71Initial program 100.0%
Taylor expanded in l around 0 29.9%
*-commutative29.9%
associate-*l*29.9%
*-commutative29.9%
associate-*r*29.9%
Simplified29.9%
Taylor expanded in K around 0 39.3%
unpow239.3%
Simplified39.3%
if -3.7e71 < l < -720Initial program 100.0%
Applied egg-rr43.5%
add-sqr-sqrt43.2%
sqrt-unprod43.5%
pow243.5%
sub-neg43.5%
metadata-eval43.5%
Applied egg-rr43.5%
unpow243.5%
rem-sqrt-square43.6%
+-commutative43.6%
Simplified43.6%
if -720 < l Initial program 76.8%
Taylor expanded in l around 0 77.0%
*-commutative77.0%
associate-*l*77.0%
*-commutative77.0%
associate-*r*77.0%
Simplified77.0%
fma-def77.0%
*-commutative77.0%
*-commutative77.0%
Applied egg-rr77.0%
Taylor expanded in K around 0 64.6%
Final simplification58.7%
(FPCore (J l K U) :precision binary64 (if (<= l -3.3e+71) (+ U (* (* l 2.0) (* J (+ 1.0 (* -0.125 (* K K)))))) (if (<= l -980.0) (* U U) (+ U (* J (* l 2.0))))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -3.3e+71) {
tmp = U + ((l * 2.0) * (J * (1.0 + (-0.125 * (K * K)))));
} else if (l <= -980.0) {
tmp = U * U;
} else {
tmp = U + (J * (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) :: tmp
if (l <= (-3.3d+71)) then
tmp = u + ((l * 2.0d0) * (j * (1.0d0 + ((-0.125d0) * (k * k)))))
else if (l <= (-980.0d0)) then
tmp = u * u
else
tmp = u + (j * (l * 2.0d0))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (l <= -3.3e+71) {
tmp = U + ((l * 2.0) * (J * (1.0 + (-0.125 * (K * K)))));
} else if (l <= -980.0) {
tmp = U * U;
} else {
tmp = U + (J * (l * 2.0));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -3.3e+71: tmp = U + ((l * 2.0) * (J * (1.0 + (-0.125 * (K * K))))) elif l <= -980.0: tmp = U * U else: tmp = U + (J * (l * 2.0)) return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -3.3e+71) tmp = Float64(U + Float64(Float64(l * 2.0) * Float64(J * Float64(1.0 + Float64(-0.125 * Float64(K * K)))))); elseif (l <= -980.0) tmp = Float64(U * U); else tmp = Float64(U + Float64(J * Float64(l * 2.0))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -3.3e+71) tmp = U + ((l * 2.0) * (J * (1.0 + (-0.125 * (K * K))))); elseif (l <= -980.0) tmp = U * U; else tmp = U + (J * (l * 2.0)); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -3.3e+71], N[(U + N[(N[(l * 2.0), $MachinePrecision] * N[(J * N[(1.0 + N[(-0.125 * N[(K * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -980.0], N[(U * U), $MachinePrecision], N[(U + N[(J * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -3.3 \cdot 10^{+71}:\\
\;\;\;\;U + \left(\ell \cdot 2\right) \cdot \left(J \cdot \left(1 + -0.125 \cdot \left(K \cdot K\right)\right)\right)\\
\mathbf{elif}\;\ell \leq -980:\\
\;\;\;\;U \cdot U\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(\ell \cdot 2\right)\\
\end{array}
\end{array}
if l < -3.2999999999999998e71Initial program 100.0%
Taylor expanded in l around 0 29.9%
*-commutative29.9%
associate-*l*29.9%
*-commutative29.9%
associate-*r*29.9%
Simplified29.9%
Taylor expanded in K around 0 39.3%
unpow239.3%
Simplified39.3%
if -3.2999999999999998e71 < l < -980Initial program 100.0%
Applied egg-rr43.5%
if -980 < l Initial program 76.8%
Taylor expanded in l around 0 77.0%
*-commutative77.0%
associate-*l*77.0%
*-commutative77.0%
associate-*r*77.0%
Simplified77.0%
Taylor expanded in K around 0 64.6%
Final simplification58.7%
(FPCore (J l K U) :precision binary64 (if (<= l -850.0) (* U U) (if (<= l 1.45) U (* U (- U -8.0)))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -850.0) {
tmp = U * U;
} else if (l <= 1.45) {
tmp = U;
} else {
tmp = U * (U - -8.0);
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if (l <= (-850.0d0)) then
tmp = u * u
else if (l <= 1.45d0) then
tmp = u
else
tmp = u * (u - (-8.0d0))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (l <= -850.0) {
tmp = U * U;
} else if (l <= 1.45) {
tmp = U;
} else {
tmp = U * (U - -8.0);
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -850.0: tmp = U * U elif l <= 1.45: tmp = U else: tmp = U * (U - -8.0) return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -850.0) tmp = Float64(U * U); elseif (l <= 1.45) tmp = U; else tmp = Float64(U * Float64(U - -8.0)); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -850.0) tmp = U * U; elseif (l <= 1.45) tmp = U; else tmp = U * (U - -8.0); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -850.0], N[(U * U), $MachinePrecision], If[LessEqual[l, 1.45], U, N[(U * N[(U - -8.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -850:\\
\;\;\;\;U \cdot U\\
\mathbf{elif}\;\ell \leq 1.45:\\
\;\;\;\;U\\
\mathbf{else}:\\
\;\;\;\;U \cdot \left(U - -8\right)\\
\end{array}
\end{array}
if l < -850Initial program 100.0%
Applied egg-rr23.9%
if -850 < l < 1.44999999999999996Initial program 66.7%
Taylor expanded in J around 0 64.7%
if 1.44999999999999996 < l Initial program 100.0%
Applied egg-rr10.4%
Final simplification42.3%
(FPCore (J l K U) :precision binary64 (if (<= l -720.0) (* U U) (if (<= l 8.4e+51) U (- -8.0 (* U U)))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -720.0) {
tmp = U * U;
} else if (l <= 8.4e+51) {
tmp = U;
} else {
tmp = -8.0 - (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 <= (-720.0d0)) then
tmp = u * u
else if (l <= 8.4d+51) then
tmp = u
else
tmp = (-8.0d0) - (u * u)
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (l <= -720.0) {
tmp = U * U;
} else if (l <= 8.4e+51) {
tmp = U;
} else {
tmp = -8.0 - (U * U);
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -720.0: tmp = U * U elif l <= 8.4e+51: tmp = U else: tmp = -8.0 - (U * U) return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -720.0) tmp = Float64(U * U); elseif (l <= 8.4e+51) tmp = U; else tmp = Float64(-8.0 - Float64(U * U)); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -720.0) tmp = U * U; elseif (l <= 8.4e+51) tmp = U; else tmp = -8.0 - (U * U); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -720.0], N[(U * U), $MachinePrecision], If[LessEqual[l, 8.4e+51], U, N[(-8.0 - N[(U * U), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -720:\\
\;\;\;\;U \cdot U\\
\mathbf{elif}\;\ell \leq 8.4 \cdot 10^{+51}:\\
\;\;\;\;U\\
\mathbf{else}:\\
\;\;\;\;-8 - U \cdot U\\
\end{array}
\end{array}
if l < -720Initial program 100.0%
Applied egg-rr23.9%
if -720 < l < 8.4000000000000005e51Initial program 68.5%
Taylor expanded in J around 0 61.2%
if 8.4000000000000005e51 < l Initial program 100.0%
associate-*l*100.0%
fma-def100.0%
Simplified100.0%
Applied egg-rr15.4%
cancel-sign-sub-inv15.4%
Simplified15.4%
Final simplification43.1%
(FPCore (J l K U) :precision binary64 (if (<= l -720.0) (* U U) (if (<= l 1.8e+66) U (* U U))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -720.0) {
tmp = U * U;
} else if (l <= 1.8e+66) {
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 <= (-720.0d0)) then
tmp = u * u
else if (l <= 1.8d+66) 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 <= -720.0) {
tmp = U * U;
} else if (l <= 1.8e+66) {
tmp = U;
} else {
tmp = U * U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -720.0: tmp = U * U elif l <= 1.8e+66: tmp = U else: tmp = U * U return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -720.0) tmp = Float64(U * U); elseif (l <= 1.8e+66) tmp = U; else tmp = Float64(U * U); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -720.0) tmp = U * U; elseif (l <= 1.8e+66) tmp = U; else tmp = U * U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -720.0], N[(U * U), $MachinePrecision], If[LessEqual[l, 1.8e+66], U, N[(U * U), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -720:\\
\;\;\;\;U \cdot U\\
\mathbf{elif}\;\ell \leq 1.8 \cdot 10^{+66}:\\
\;\;\;\;U\\
\mathbf{else}:\\
\;\;\;\;U \cdot U\\
\end{array}
\end{array}
if l < -720 or 1.8e66 < l Initial program 100.0%
Applied egg-rr18.6%
if -720 < l < 1.8e66Initial program 68.9%
Taylor expanded in J around 0 60.4%
Final simplification42.3%
(FPCore (J l K U) :precision binary64 (+ U (* J (* l 2.0))))
double code(double J, double l, double K, double U) {
return U + (J * (l * 2.0));
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = u + (j * (l * 2.0d0))
end function
public static double code(double J, double l, double K, double U) {
return U + (J * (l * 2.0));
}
def code(J, l, K, U): return U + (J * (l * 2.0))
function code(J, l, K, U) return Float64(U + Float64(J * Float64(l * 2.0))) end
function tmp = code(J, l, K, U) tmp = U + (J * (l * 2.0)); end
code[J_, l_, K_, U_] := N[(U + N[(J * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + J \cdot \left(\ell \cdot 2\right)
\end{array}
Initial program 82.4%
Taylor expanded in l around 0 64.6%
*-commutative64.6%
associate-*l*64.6%
*-commutative64.6%
associate-*r*64.6%
Simplified64.6%
Taylor expanded in K around 0 53.9%
Final simplification53.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 82.4%
Taylor expanded in J around 0 35.2%
Final simplification35.2%
herbie shell --seed 2023299
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))