
(FPCore (J l K U) :precision binary64 (+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))
double code(double J, double l, double K, double U) {
return ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = ((j * (exp(l) - exp(-l))) * cos((k / 2.0d0))) + u
end function
public static double code(double J, double l, double K, double U) {
return ((J * (Math.exp(l) - Math.exp(-l))) * Math.cos((K / 2.0))) + U;
}
def code(J, l, K, U): return ((J * (math.exp(l) - math.exp(-l))) * math.cos((K / 2.0))) + U
function code(J, l, K, U) return Float64(Float64(Float64(J * Float64(exp(l) - exp(Float64(-l)))) * cos(Float64(K / 2.0))) + U) end
function tmp = code(J, l, K, U) tmp = ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U; end
code[J_, l_, K_, U_] := N[(N[(N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]
\begin{array}{l}
\\
\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (J l K U) :precision binary64 (+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))
double code(double J, double l, double K, double U) {
return ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = ((j * (exp(l) - exp(-l))) * cos((k / 2.0d0))) + u
end function
public static double code(double J, double l, double K, double U) {
return ((J * (Math.exp(l) - Math.exp(-l))) * Math.cos((K / 2.0))) + U;
}
def code(J, l, K, U): return ((J * (math.exp(l) - math.exp(-l))) * math.cos((K / 2.0))) + U
function code(J, l, K, U) return Float64(Float64(Float64(J * Float64(exp(l) - exp(Float64(-l)))) * cos(Float64(K / 2.0))) + U) end
function tmp = code(J, l, K, U) tmp = ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U; end
code[J_, l_, K_, U_] := N[(N[(N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]
\begin{array}{l}
\\
\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U
\end{array}
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (- (exp l) (exp (- l)))))
(if (or (<= t_0 (- INFINITY)) (not (<= t_0 5e-7)))
(+ (* J (* t_0 (cos (* 0.5 K)))) U)
(+
U
(*
(* J (+ (* 0.3333333333333333 (pow l 3.0)) (* l 2.0)))
(cos (/ K 2.0)))))))
double code(double J, double l, double K, double U) {
double t_0 = exp(l) - exp(-l);
double tmp;
if ((t_0 <= -((double) INFINITY)) || !(t_0 <= 5e-7)) {
tmp = (J * (t_0 * cos((0.5 * K)))) + U;
} else {
tmp = U + ((J * ((0.3333333333333333 * pow(l, 3.0)) + (l * 2.0))) * cos((K / 2.0)));
}
return tmp;
}
public static double code(double J, double l, double K, double U) {
double t_0 = Math.exp(l) - Math.exp(-l);
double tmp;
if ((t_0 <= -Double.POSITIVE_INFINITY) || !(t_0 <= 5e-7)) {
tmp = (J * (t_0 * Math.cos((0.5 * K)))) + U;
} else {
tmp = U + ((J * ((0.3333333333333333 * Math.pow(l, 3.0)) + (l * 2.0))) * Math.cos((K / 2.0)));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.exp(l) - math.exp(-l) tmp = 0 if (t_0 <= -math.inf) or not (t_0 <= 5e-7): tmp = (J * (t_0 * math.cos((0.5 * K)))) + U else: tmp = U + ((J * ((0.3333333333333333 * math.pow(l, 3.0)) + (l * 2.0))) * math.cos((K / 2.0))) return tmp
function code(J, l, K, U) t_0 = Float64(exp(l) - exp(Float64(-l))) tmp = 0.0 if ((t_0 <= Float64(-Inf)) || !(t_0 <= 5e-7)) tmp = Float64(Float64(J * Float64(t_0 * cos(Float64(0.5 * K)))) + U); else tmp = Float64(U + Float64(Float64(J * Float64(Float64(0.3333333333333333 * (l ^ 3.0)) + Float64(l * 2.0))) * cos(Float64(K / 2.0)))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = exp(l) - exp(-l); tmp = 0.0; if ((t_0 <= -Inf) || ~((t_0 <= 5e-7))) tmp = (J * (t_0 * cos((0.5 * K)))) + U; else tmp = U + ((J * ((0.3333333333333333 * (l ^ 3.0)) + (l * 2.0))) * cos((K / 2.0))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, (-Infinity)], N[Not[LessEqual[t$95$0, 5e-7]], $MachinePrecision]], N[(N[(J * N[(t$95$0 * N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], N[(U + N[(N[(J * N[(N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision] + N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $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 5 \cdot 10^{-7}\right):\\
\;\;\;\;J \cdot \left(t_0 \cdot \cos \left(0.5 \cdot K\right)\right) + U\\
\mathbf{else}:\\
\;\;\;\;U + \left(J \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right)\right) \cdot \cos \left(\frac{K}{2}\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -inf.0 or 4.99999999999999977e-7 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 100.0%
Taylor expanded in J around 0 100.0%
if -inf.0 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 4.99999999999999977e-7Initial program 73.9%
Taylor expanded in l around 0 99.9%
Final simplification100.0%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (- (exp l) (exp (- l)))))
(if (or (<= t_0 (- INFINITY)) (not (<= t_0 5e-7)))
(+ U (* t_0 J))
(+ U (* l (* 2.0 (* J (cos (* 0.5 K)))))))))
double code(double J, double l, double K, double U) {
double t_0 = exp(l) - exp(-l);
double tmp;
if ((t_0 <= -((double) INFINITY)) || !(t_0 <= 5e-7)) {
tmp = U + (t_0 * J);
} else {
tmp = U + (l * (2.0 * (J * cos((0.5 * K)))));
}
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 <= 5e-7)) {
tmp = U + (t_0 * J);
} else {
tmp = U + (l * (2.0 * (J * Math.cos((0.5 * K)))));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.exp(l) - math.exp(-l) tmp = 0 if (t_0 <= -math.inf) or not (t_0 <= 5e-7): tmp = U + (t_0 * J) else: tmp = U + (l * (2.0 * (J * math.cos((0.5 * K))))) return tmp
function code(J, l, K, U) t_0 = Float64(exp(l) - exp(Float64(-l))) tmp = 0.0 if ((t_0 <= Float64(-Inf)) || !(t_0 <= 5e-7)) tmp = Float64(U + Float64(t_0 * J)); else tmp = Float64(U + Float64(l * Float64(2.0 * Float64(J * cos(Float64(0.5 * K)))))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = exp(l) - exp(-l); tmp = 0.0; if ((t_0 <= -Inf) || ~((t_0 <= 5e-7))) tmp = U + (t_0 * J); else tmp = U + (l * (2.0 * (J * cos((0.5 * K))))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, (-Infinity)], N[Not[LessEqual[t$95$0, 5e-7]], $MachinePrecision]], N[(U + N[(t$95$0 * J), $MachinePrecision]), $MachinePrecision], N[(U + N[(l * N[(2.0 * N[(J * N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{\ell} - e^{-\ell}\\
\mathbf{if}\;t_0 \leq -\infty \lor \neg \left(t_0 \leq 5 \cdot 10^{-7}\right):\\
\;\;\;\;U + t_0 \cdot J\\
\mathbf{else}:\\
\;\;\;\;U + \ell \cdot \left(2 \cdot \left(J \cdot \cos \left(0.5 \cdot K\right)\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -inf.0 or 4.99999999999999977e-7 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 100.0%
Taylor expanded in K around 0 72.1%
if -inf.0 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 4.99999999999999977e-7Initial program 73.9%
Taylor expanded in l around 0 99.9%
*-commutative99.9%
*-commutative99.9%
associate-*l*99.9%
*-commutative99.9%
associate-*l*99.9%
Simplified99.9%
Final simplification86.8%
(FPCore (J l K U)
:precision binary64
(let* ((t_0
(+
U
(*
(* J (+ (* 0.3333333333333333 (pow l 3.0)) (* l 2.0)))
(cos (/ K 2.0)))))
(t_1 (- (exp l) (exp (- l)))))
(if (<= l -4.5e+76)
t_0
(if (<= l -350.0)
(+ U (* t_1 (+ J (* J (* K (* K -0.125))))))
(if (or (<= l 0.21) (not (<= l 4.5e+68))) t_0 (+ U (* t_1 J)))))))
double code(double J, double l, double K, double U) {
double t_0 = U + ((J * ((0.3333333333333333 * pow(l, 3.0)) + (l * 2.0))) * cos((K / 2.0)));
double t_1 = exp(l) - exp(-l);
double tmp;
if (l <= -4.5e+76) {
tmp = t_0;
} else if (l <= -350.0) {
tmp = U + (t_1 * (J + (J * (K * (K * -0.125)))));
} else if ((l <= 0.21) || !(l <= 4.5e+68)) {
tmp = t_0;
} else {
tmp = U + (t_1 * J);
}
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 + ((j * ((0.3333333333333333d0 * (l ** 3.0d0)) + (l * 2.0d0))) * cos((k / 2.0d0)))
t_1 = exp(l) - exp(-l)
if (l <= (-4.5d+76)) then
tmp = t_0
else if (l <= (-350.0d0)) then
tmp = u + (t_1 * (j + (j * (k * (k * (-0.125d0))))))
else if ((l <= 0.21d0) .or. (.not. (l <= 4.5d+68))) then
tmp = t_0
else
tmp = u + (t_1 * j)
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = U + ((J * ((0.3333333333333333 * Math.pow(l, 3.0)) + (l * 2.0))) * Math.cos((K / 2.0)));
double t_1 = Math.exp(l) - Math.exp(-l);
double tmp;
if (l <= -4.5e+76) {
tmp = t_0;
} else if (l <= -350.0) {
tmp = U + (t_1 * (J + (J * (K * (K * -0.125)))));
} else if ((l <= 0.21) || !(l <= 4.5e+68)) {
tmp = t_0;
} else {
tmp = U + (t_1 * J);
}
return tmp;
}
def code(J, l, K, U): t_0 = U + ((J * ((0.3333333333333333 * math.pow(l, 3.0)) + (l * 2.0))) * math.cos((K / 2.0))) t_1 = math.exp(l) - math.exp(-l) tmp = 0 if l <= -4.5e+76: tmp = t_0 elif l <= -350.0: tmp = U + (t_1 * (J + (J * (K * (K * -0.125))))) elif (l <= 0.21) or not (l <= 4.5e+68): tmp = t_0 else: tmp = U + (t_1 * J) return tmp
function code(J, l, K, U) t_0 = Float64(U + Float64(Float64(J * Float64(Float64(0.3333333333333333 * (l ^ 3.0)) + Float64(l * 2.0))) * cos(Float64(K / 2.0)))) t_1 = Float64(exp(l) - exp(Float64(-l))) tmp = 0.0 if (l <= -4.5e+76) tmp = t_0; elseif (l <= -350.0) tmp = Float64(U + Float64(t_1 * Float64(J + Float64(J * Float64(K * Float64(K * -0.125)))))); elseif ((l <= 0.21) || !(l <= 4.5e+68)) tmp = t_0; else tmp = Float64(U + Float64(t_1 * J)); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = U + ((J * ((0.3333333333333333 * (l ^ 3.0)) + (l * 2.0))) * cos((K / 2.0))); t_1 = exp(l) - exp(-l); tmp = 0.0; if (l <= -4.5e+76) tmp = t_0; elseif (l <= -350.0) tmp = U + (t_1 * (J + (J * (K * (K * -0.125))))); elseif ((l <= 0.21) || ~((l <= 4.5e+68))) tmp = t_0; else tmp = U + (t_1 * J); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(U + N[(N[(J * N[(N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision] + N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -4.5e+76], t$95$0, If[LessEqual[l, -350.0], N[(U + N[(t$95$1 * N[(J + N[(J * N[(K * N[(K * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[l, 0.21], N[Not[LessEqual[l, 4.5e+68]], $MachinePrecision]], t$95$0, N[(U + N[(t$95$1 * J), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + \left(J \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right)\right) \cdot \cos \left(\frac{K}{2}\right)\\
t_1 := e^{\ell} - e^{-\ell}\\
\mathbf{if}\;\ell \leq -4.5 \cdot 10^{+76}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq -350:\\
\;\;\;\;U + t_1 \cdot \left(J + J \cdot \left(K \cdot \left(K \cdot -0.125\right)\right)\right)\\
\mathbf{elif}\;\ell \leq 0.21 \lor \neg \left(\ell \leq 4.5 \cdot 10^{+68}\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;U + t_1 \cdot J\\
\end{array}
\end{array}
if l < -4.4999999999999997e76 or -350 < l < 0.209999999999999992 or 4.5000000000000003e68 < l Initial program 84.5%
Taylor expanded in l around 0 98.3%
if -4.4999999999999997e76 < l < -350Initial program 100.0%
Taylor expanded in K around 0 0.0%
+-commutative0.0%
associate-*r*0.0%
associate-*r*0.0%
distribute-rgt-out85.7%
associate-*r*85.7%
*-commutative85.7%
associate-*l*85.7%
*-commutative85.7%
unpow285.7%
associate-*l*85.7%
Simplified85.7%
if 0.209999999999999992 < l < 4.5000000000000003e68Initial program 99.9%
Taylor expanded in K around 0 74.8%
Final simplification96.2%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.002) (+ U (* l (* 2.0 (* J (cos (* 0.5 K)))))) (+ 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.002) {
tmp = U + (l * (2.0 * (J * cos((0.5 * K)))));
} 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.002d0)) then
tmp = u + (l * (2.0d0 * (j * cos((0.5d0 * k)))))
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.002) {
tmp = U + (l * (2.0 * (J * Math.cos((0.5 * K)))));
} 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.002: tmp = U + (l * (2.0 * (J * math.cos((0.5 * K))))) 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.002) tmp = Float64(U + Float64(l * Float64(2.0 * Float64(J * cos(Float64(0.5 * K)))))); 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.002) tmp = U + (l * (2.0 * (J * cos((0.5 * K))))); 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.002], N[(U + N[(l * N[(2.0 * N[(J * N[Cos[N[(0.5 * K), $MachinePrecision]], $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.002:\\
\;\;\;\;U + \ell \cdot \left(2 \cdot \left(J \cdot \cos \left(0.5 \cdot K\right)\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)) < -2e-3Initial program 86.4%
Taylor expanded in l around 0 69.0%
*-commutative69.0%
*-commutative69.0%
associate-*l*69.0%
*-commutative69.0%
associate-*l*69.0%
Simplified69.0%
if -2e-3 < (cos.f64 (/.f64 K 2)) Initial program 86.2%
Taylor expanded in l around 0 90.2%
Taylor expanded in K around 0 86.4%
Final simplification81.6%
(FPCore (J l K U) :precision binary64 (+ U (* (* J (+ (* 0.3333333333333333 (pow l 3.0)) (* l 2.0))) (cos (/ K 2.0)))))
double code(double J, double l, double K, double U) {
return U + ((J * ((0.3333333333333333 * pow(l, 3.0)) + (l * 2.0))) * cos((K / 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 * ((0.3333333333333333d0 * (l ** 3.0d0)) + (l * 2.0d0))) * cos((k / 2.0d0)))
end function
public static double code(double J, double l, double K, double U) {
return U + ((J * ((0.3333333333333333 * Math.pow(l, 3.0)) + (l * 2.0))) * Math.cos((K / 2.0)));
}
def code(J, l, K, U): return U + ((J * ((0.3333333333333333 * math.pow(l, 3.0)) + (l * 2.0))) * math.cos((K / 2.0)))
function code(J, l, K, U) return Float64(U + Float64(Float64(J * Float64(Float64(0.3333333333333333 * (l ^ 3.0)) + Float64(l * 2.0))) * cos(Float64(K / 2.0)))) end
function tmp = code(J, l, K, U) tmp = U + ((J * ((0.3333333333333333 * (l ^ 3.0)) + (l * 2.0))) * cos((K / 2.0))); end
code[J_, l_, K_, U_] := N[(U + N[(N[(J * N[(N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision] + N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + \left(J \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right)\right) \cdot \cos \left(\frac{K}{2}\right)
\end{array}
Initial program 86.2%
Taylor expanded in l around 0 89.6%
Final simplification89.6%
(FPCore (J l K U) :precision binary64 (if (or (<= l -2.8e+44) (not (<= l 9e+50))) (+ U (* 0.3333333333333333 (* J (pow l 3.0)))) (+ U (* l (* 2.0 (* J (cos (* 0.5 K))))))))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -2.8e+44) || !(l <= 9e+50)) {
tmp = U + (0.3333333333333333 * (J * pow(l, 3.0)));
} else {
tmp = U + (l * (2.0 * (J * cos((0.5 * K)))));
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if ((l <= (-2.8d+44)) .or. (.not. (l <= 9d+50))) then
tmp = u + (0.3333333333333333d0 * (j * (l ** 3.0d0)))
else
tmp = u + (l * (2.0d0 * (j * cos((0.5d0 * k)))))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -2.8e+44) || !(l <= 9e+50)) {
tmp = U + (0.3333333333333333 * (J * Math.pow(l, 3.0)));
} else {
tmp = U + (l * (2.0 * (J * Math.cos((0.5 * K)))));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -2.8e+44) or not (l <= 9e+50): tmp = U + (0.3333333333333333 * (J * math.pow(l, 3.0))) else: tmp = U + (l * (2.0 * (J * math.cos((0.5 * K))))) return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -2.8e+44) || !(l <= 9e+50)) tmp = Float64(U + Float64(0.3333333333333333 * Float64(J * (l ^ 3.0)))); else tmp = Float64(U + Float64(l * Float64(2.0 * Float64(J * cos(Float64(0.5 * K)))))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -2.8e+44) || ~((l <= 9e+50))) tmp = U + (0.3333333333333333 * (J * (l ^ 3.0))); else tmp = U + (l * (2.0 * (J * cos((0.5 * K))))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -2.8e+44], N[Not[LessEqual[l, 9e+50]], $MachinePrecision]], N[(U + N[(0.3333333333333333 * N[(J * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(l * N[(2.0 * N[(J * N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2.8 \cdot 10^{+44} \lor \neg \left(\ell \leq 9 \cdot 10^{+50}\right):\\
\;\;\;\;U + 0.3333333333333333 \cdot \left(J \cdot {\ell}^{3}\right)\\
\mathbf{else}:\\
\;\;\;\;U + \ell \cdot \left(2 \cdot \left(J \cdot \cos \left(0.5 \cdot K\right)\right)\right)\\
\end{array}
\end{array}
if l < -2.8000000000000001e44 or 9.00000000000000027e50 < l Initial program 100.0%
Taylor expanded in l around 0 87.1%
Taylor expanded in K around 0 65.9%
Taylor expanded in l around inf 65.9%
if -2.8000000000000001e44 < l < 9.00000000000000027e50Initial program 76.8%
Taylor expanded in l around 0 89.9%
*-commutative89.9%
*-commutative89.9%
associate-*l*89.9%
*-commutative89.9%
associate-*l*89.9%
Simplified89.9%
Final simplification80.1%
(FPCore (J l K U) :precision binary64 (if (or (<= l -340.0) (not (<= l 2.5))) (+ U (* 0.3333333333333333 (* J (pow l 3.0)))) (+ U (* l (* J 2.0)))))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -340.0) || !(l <= 2.5)) {
tmp = U + (0.3333333333333333 * (J * pow(l, 3.0)));
} else {
tmp = U + (l * (J * 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 <= (-340.0d0)) .or. (.not. (l <= 2.5d0))) then
tmp = u + (0.3333333333333333d0 * (j * (l ** 3.0d0)))
else
tmp = u + (l * (j * 2.0d0))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -340.0) || !(l <= 2.5)) {
tmp = U + (0.3333333333333333 * (J * Math.pow(l, 3.0)));
} else {
tmp = U + (l * (J * 2.0));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -340.0) or not (l <= 2.5): tmp = U + (0.3333333333333333 * (J * math.pow(l, 3.0))) else: tmp = U + (l * (J * 2.0)) return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -340.0) || !(l <= 2.5)) tmp = Float64(U + Float64(0.3333333333333333 * Float64(J * (l ^ 3.0)))); else tmp = Float64(U + Float64(l * Float64(J * 2.0))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -340.0) || ~((l <= 2.5))) tmp = U + (0.3333333333333333 * (J * (l ^ 3.0))); else tmp = U + (l * (J * 2.0)); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -340.0], N[Not[LessEqual[l, 2.5]], $MachinePrecision]], N[(U + N[(0.3333333333333333 * N[(J * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(l * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -340 \lor \neg \left(\ell \leq 2.5\right):\\
\;\;\;\;U + 0.3333333333333333 \cdot \left(J \cdot {\ell}^{3}\right)\\
\mathbf{else}:\\
\;\;\;\;U + \ell \cdot \left(J \cdot 2\right)\\
\end{array}
\end{array}
if l < -340 or 2.5 < l Initial program 100.0%
Taylor expanded in l around 0 78.0%
Taylor expanded in K around 0 58.0%
Taylor expanded in l around inf 58.0%
if -340 < l < 2.5Initial program 73.9%
Taylor expanded in l around 0 99.9%
*-commutative99.9%
*-commutative99.9%
associate-*l*99.9%
*-commutative99.9%
associate-*l*99.9%
Simplified99.9%
Taylor expanded in K around 0 87.3%
Final simplification73.4%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (* K (* l (* K -0.25))))
(t_1 (+ U (* J (* l (+ 2.0 (* K (* K -0.25))))))))
(if (<= l -2.2e+34)
t_1
(if (<= l 200.0)
(+ U (* l (* J 2.0)))
(if (or (<= l 7e+153) (not (<= l 4.6e+238)))
t_1
(+
U
(*
J
(/ (- (* t_0 t_0) (* (* l 2.0) (* l 2.0))) (- t_0 (* l 2.0))))))))))
double code(double J, double l, double K, double U) {
double t_0 = K * (l * (K * -0.25));
double t_1 = U + (J * (l * (2.0 + (K * (K * -0.25)))));
double tmp;
if (l <= -2.2e+34) {
tmp = t_1;
} else if (l <= 200.0) {
tmp = U + (l * (J * 2.0));
} else if ((l <= 7e+153) || !(l <= 4.6e+238)) {
tmp = t_1;
} else {
tmp = U + (J * (((t_0 * t_0) - ((l * 2.0) * (l * 2.0))) / (t_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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = k * (l * (k * (-0.25d0)))
t_1 = u + (j * (l * (2.0d0 + (k * (k * (-0.25d0))))))
if (l <= (-2.2d+34)) then
tmp = t_1
else if (l <= 200.0d0) then
tmp = u + (l * (j * 2.0d0))
else if ((l <= 7d+153) .or. (.not. (l <= 4.6d+238))) then
tmp = t_1
else
tmp = u + (j * (((t_0 * t_0) - ((l * 2.0d0) * (l * 2.0d0))) / (t_0 - (l * 2.0d0))))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = K * (l * (K * -0.25));
double t_1 = U + (J * (l * (2.0 + (K * (K * -0.25)))));
double tmp;
if (l <= -2.2e+34) {
tmp = t_1;
} else if (l <= 200.0) {
tmp = U + (l * (J * 2.0));
} else if ((l <= 7e+153) || !(l <= 4.6e+238)) {
tmp = t_1;
} else {
tmp = U + (J * (((t_0 * t_0) - ((l * 2.0) * (l * 2.0))) / (t_0 - (l * 2.0))));
}
return tmp;
}
def code(J, l, K, U): t_0 = K * (l * (K * -0.25)) t_1 = U + (J * (l * (2.0 + (K * (K * -0.25))))) tmp = 0 if l <= -2.2e+34: tmp = t_1 elif l <= 200.0: tmp = U + (l * (J * 2.0)) elif (l <= 7e+153) or not (l <= 4.6e+238): tmp = t_1 else: tmp = U + (J * (((t_0 * t_0) - ((l * 2.0) * (l * 2.0))) / (t_0 - (l * 2.0)))) return tmp
function code(J, l, K, U) t_0 = Float64(K * Float64(l * Float64(K * -0.25))) t_1 = Float64(U + Float64(J * Float64(l * Float64(2.0 + Float64(K * Float64(K * -0.25)))))) tmp = 0.0 if (l <= -2.2e+34) tmp = t_1; elseif (l <= 200.0) tmp = Float64(U + Float64(l * Float64(J * 2.0))); elseif ((l <= 7e+153) || !(l <= 4.6e+238)) tmp = t_1; else tmp = Float64(U + Float64(J * Float64(Float64(Float64(t_0 * t_0) - Float64(Float64(l * 2.0) * Float64(l * 2.0))) / Float64(t_0 - Float64(l * 2.0))))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = K * (l * (K * -0.25)); t_1 = U + (J * (l * (2.0 + (K * (K * -0.25))))); tmp = 0.0; if (l <= -2.2e+34) tmp = t_1; elseif (l <= 200.0) tmp = U + (l * (J * 2.0)); elseif ((l <= 7e+153) || ~((l <= 4.6e+238))) tmp = t_1; else tmp = U + (J * (((t_0 * t_0) - ((l * 2.0) * (l * 2.0))) / (t_0 - (l * 2.0)))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(K * N[(l * N[(K * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(U + N[(J * N[(l * N[(2.0 + N[(K * N[(K * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -2.2e+34], t$95$1, If[LessEqual[l, 200.0], N[(U + N[(l * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[l, 7e+153], N[Not[LessEqual[l, 4.6e+238]], $MachinePrecision]], t$95$1, N[(U + N[(J * N[(N[(N[(t$95$0 * t$95$0), $MachinePrecision] - N[(N[(l * 2.0), $MachinePrecision] * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$0 - N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := K \cdot \left(\ell \cdot \left(K \cdot -0.25\right)\right)\\
t_1 := U + J \cdot \left(\ell \cdot \left(2 + K \cdot \left(K \cdot -0.25\right)\right)\right)\\
\mathbf{if}\;\ell \leq -2.2 \cdot 10^{+34}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\ell \leq 200:\\
\;\;\;\;U + \ell \cdot \left(J \cdot 2\right)\\
\mathbf{elif}\;\ell \leq 7 \cdot 10^{+153} \lor \neg \left(\ell \leq 4.6 \cdot 10^{+238}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \frac{t_0 \cdot t_0 - \left(\ell \cdot 2\right) \cdot \left(\ell \cdot 2\right)}{t_0 - \ell \cdot 2}\\
\end{array}
\end{array}
if l < -2.2000000000000002e34 or 200 < l < 6.9999999999999998e153 or 4.60000000000000005e238 < l Initial program 100.0%
Taylor expanded in l around 0 25.7%
*-commutative25.7%
*-commutative25.7%
associate-*l*25.7%
*-commutative25.7%
associate-*l*25.7%
Simplified25.7%
Taylor expanded in K around 0 26.8%
Taylor expanded in J around 0 39.9%
associate-*r*39.9%
distribute-rgt-out39.9%
unpow239.9%
associate-*r*39.9%
Simplified39.9%
if -2.2000000000000002e34 < l < 200Initial program 74.8%
Taylor expanded in l around 0 97.2%
*-commutative97.2%
*-commutative97.2%
associate-*l*97.2%
*-commutative97.2%
associate-*l*97.2%
Simplified97.2%
Taylor expanded in K around 0 85.1%
if 6.9999999999999998e153 < l < 4.60000000000000005e238Initial program 100.0%
Taylor expanded in l around 0 27.4%
*-commutative27.4%
*-commutative27.4%
associate-*l*27.4%
*-commutative27.4%
associate-*l*27.4%
Simplified27.4%
Taylor expanded in K around 0 21.1%
Taylor expanded in J around 0 32.8%
associate-*r*32.8%
distribute-rgt-out32.8%
unpow232.8%
associate-*r*32.8%
Simplified32.8%
distribute-lft-in32.8%
flip-+58.8%
*-commutative58.8%
*-commutative58.8%
associate-*l*58.8%
*-commutative58.8%
*-commutative58.8%
associate-*l*58.8%
*-commutative58.8%
*-commutative58.8%
associate-*l*58.8%
Applied egg-rr58.8%
Final simplification65.9%
(FPCore (J l K U) :precision binary64 (if (or (<= l -2.2e+34) (not (<= l 490.0))) (+ U (* J (* l (+ 2.0 (* K (* K -0.25)))))) (+ U (* l (* J 2.0)))))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -2.2e+34) || !(l <= 490.0)) {
tmp = U + (J * (l * (2.0 + (K * (K * -0.25)))));
} else {
tmp = U + (l * (J * 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 <= (-2.2d+34)) .or. (.not. (l <= 490.0d0))) then
tmp = u + (j * (l * (2.0d0 + (k * (k * (-0.25d0))))))
else
tmp = u + (l * (j * 2.0d0))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -2.2e+34) || !(l <= 490.0)) {
tmp = U + (J * (l * (2.0 + (K * (K * -0.25)))));
} else {
tmp = U + (l * (J * 2.0));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -2.2e+34) or not (l <= 490.0): tmp = U + (J * (l * (2.0 + (K * (K * -0.25))))) else: tmp = U + (l * (J * 2.0)) return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -2.2e+34) || !(l <= 490.0)) tmp = Float64(U + Float64(J * Float64(l * Float64(2.0 + Float64(K * Float64(K * -0.25)))))); else tmp = Float64(U + Float64(l * Float64(J * 2.0))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -2.2e+34) || ~((l <= 490.0))) tmp = U + (J * (l * (2.0 + (K * (K * -0.25))))); else tmp = U + (l * (J * 2.0)); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -2.2e+34], N[Not[LessEqual[l, 490.0]], $MachinePrecision]], N[(U + N[(J * N[(l * N[(2.0 + N[(K * N[(K * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(l * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2.2 \cdot 10^{+34} \lor \neg \left(\ell \leq 490\right):\\
\;\;\;\;U + J \cdot \left(\ell \cdot \left(2 + K \cdot \left(K \cdot -0.25\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + \ell \cdot \left(J \cdot 2\right)\\
\end{array}
\end{array}
if l < -2.2000000000000002e34 or 490 < l Initial program 100.0%
Taylor expanded in l around 0 25.9%
*-commutative25.9%
*-commutative25.9%
associate-*l*25.9%
*-commutative25.9%
associate-*l*25.9%
Simplified25.9%
Taylor expanded in K around 0 25.9%
Taylor expanded in J around 0 38.9%
associate-*r*38.9%
distribute-rgt-out38.9%
unpow238.9%
associate-*r*38.9%
Simplified38.9%
if -2.2000000000000002e34 < l < 490Initial program 74.8%
Taylor expanded in l around 0 97.2%
*-commutative97.2%
*-commutative97.2%
associate-*l*97.2%
*-commutative97.2%
associate-*l*97.2%
Simplified97.2%
Taylor expanded in K around 0 85.1%
Final simplification64.2%
(FPCore (J l K U) :precision binary64 (if (<= U 3.6e+182) (+ U (* l (* J 2.0))) (+ U (* -0.25 (* J (* l (* K K)))))))
double code(double J, double l, double K, double U) {
double tmp;
if (U <= 3.6e+182) {
tmp = U + (l * (J * 2.0));
} else {
tmp = U + (-0.25 * (J * (l * (K * K))));
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if (u <= 3.6d+182) then
tmp = u + (l * (j * 2.0d0))
else
tmp = u + ((-0.25d0) * (j * (l * (k * k))))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (U <= 3.6e+182) {
tmp = U + (l * (J * 2.0));
} else {
tmp = U + (-0.25 * (J * (l * (K * K))));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if U <= 3.6e+182: tmp = U + (l * (J * 2.0)) else: tmp = U + (-0.25 * (J * (l * (K * K)))) return tmp
function code(J, l, K, U) tmp = 0.0 if (U <= 3.6e+182) tmp = Float64(U + Float64(l * Float64(J * 2.0))); else tmp = Float64(U + Float64(-0.25 * Float64(J * Float64(l * Float64(K * K))))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (U <= 3.6e+182) tmp = U + (l * (J * 2.0)); else tmp = U + (-0.25 * (J * (l * (K * K)))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[U, 3.6e+182], N[(U + N[(l * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(-0.25 * N[(J * N[(l * N[(K * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;U \leq 3.6 \cdot 10^{+182}:\\
\;\;\;\;U + \ell \cdot \left(J \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;U + -0.25 \cdot \left(J \cdot \left(\ell \cdot \left(K \cdot K\right)\right)\right)\\
\end{array}
\end{array}
if U < 3.6e182Initial program 84.6%
Taylor expanded in l around 0 65.0%
*-commutative65.0%
*-commutative65.0%
associate-*l*65.0%
*-commutative65.0%
associate-*l*65.0%
Simplified65.0%
Taylor expanded in K around 0 54.7%
if 3.6e182 < U Initial program 100.0%
Taylor expanded in l around 0 64.1%
*-commutative64.1%
*-commutative64.1%
associate-*l*64.1%
*-commutative64.1%
associate-*l*64.1%
Simplified64.1%
Taylor expanded in K around 0 59.8%
Taylor expanded in K around inf 71.1%
*-commutative71.1%
unpow271.1%
Simplified71.1%
Final simplification56.4%
(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 86.2%
Taylor expanded in l around 0 64.9%
*-commutative64.9%
*-commutative64.9%
associate-*l*64.9%
*-commutative64.9%
associate-*l*64.9%
Simplified64.9%
Taylor expanded in K around 0 54.1%
Final simplification54.1%
(FPCore (J l K U) :precision binary64 (if (<= l 280000.0) U (* U U)))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= 280000.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 <= 280000.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 <= 280000.0) {
tmp = U;
} else {
tmp = U * U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= 280000.0: tmp = U else: tmp = U * U return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= 280000.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 <= 280000.0) tmp = U; else tmp = U * U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, 280000.0], U, N[(U * U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 280000:\\
\;\;\;\;U\\
\mathbf{else}:\\
\;\;\;\;U \cdot U\\
\end{array}
\end{array}
if l < 2.8e5Initial program 82.4%
associate-*l*82.4%
fma-def82.4%
Simplified82.4%
Taylor expanded in J around 0 49.8%
if 2.8e5 < l Initial program 100.0%
associate-*l*100.0%
fma-def100.0%
Simplified100.0%
Applied egg-rr15.7%
Final simplification42.4%
(FPCore (J l K U) :precision binary64 1.0)
double code(double J, double l, double K, double U) {
return 1.0;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = 1.0d0
end function
public static double code(double J, double l, double K, double U) {
return 1.0;
}
def code(J, l, K, U): return 1.0
function code(J, l, K, U) return 1.0 end
function tmp = code(J, l, K, U) tmp = 1.0; end
code[J_, l_, K_, U_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 86.2%
associate-*l*86.2%
fma-def86.2%
Simplified86.2%
Applied egg-rr2.8%
*-inverses2.8%
Simplified2.8%
Final simplification2.8%
(FPCore (J l K U) :precision binary64 U)
double code(double J, double l, double K, double U) {
return U;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = u
end function
public static double code(double J, double l, double K, double U) {
return U;
}
def code(J, l, K, U): return U
function code(J, l, K, U) return U end
function tmp = code(J, l, K, U) tmp = U; end
code[J_, l_, K_, U_] := U
\begin{array}{l}
\\
U
\end{array}
Initial program 86.2%
associate-*l*86.2%
fma-def86.2%
Simplified86.2%
Taylor expanded in J around 0 39.5%
Final simplification39.5%
herbie shell --seed 2023279
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))