
(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 20 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (J l K U) :precision binary64 (+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))
double code(double J, double l, double K, double U) {
return ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = ((j * (exp(l) - exp(-l))) * cos((k / 2.0d0))) + u
end function
public static double code(double J, double l, double K, double U) {
return ((J * (Math.exp(l) - Math.exp(-l))) * Math.cos((K / 2.0))) + U;
}
def code(J, l, K, U): return ((J * (math.exp(l) - math.exp(-l))) * math.cos((K / 2.0))) + U
function code(J, l, K, U) return Float64(Float64(Float64(J * Float64(exp(l) - exp(Float64(-l)))) * cos(Float64(K / 2.0))) + U) end
function tmp = code(J, l, K, U) tmp = ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U; end
code[J_, l_, K_, U_] := N[(N[(N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]
\begin{array}{l}
\\
\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U
\end{array}
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (- (exp l) (exp (- l)))) (t_1 (cos (* K 0.5))))
(if (<= t_0 (- INFINITY))
(+ (* (* t_0 J) (cos (/ K 2.0))) U)
(if (<= t_0 2e-15)
(+ U (* l (* J (* 2.0 t_1))))
(+ U (* t_0 (* J t_1)))))))
double code(double J, double l, double K, double U) {
double t_0 = exp(l) - exp(-l);
double t_1 = cos((K * 0.5));
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = ((t_0 * J) * cos((K / 2.0))) + U;
} else if (t_0 <= 2e-15) {
tmp = U + (l * (J * (2.0 * t_1)));
} else {
tmp = U + (t_0 * (J * t_1));
}
return tmp;
}
public static double code(double J, double l, double K, double U) {
double t_0 = Math.exp(l) - Math.exp(-l);
double t_1 = Math.cos((K * 0.5));
double tmp;
if (t_0 <= -Double.POSITIVE_INFINITY) {
tmp = ((t_0 * J) * Math.cos((K / 2.0))) + U;
} else if (t_0 <= 2e-15) {
tmp = U + (l * (J * (2.0 * t_1)));
} else {
tmp = U + (t_0 * (J * t_1));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.exp(l) - math.exp(-l) t_1 = math.cos((K * 0.5)) tmp = 0 if t_0 <= -math.inf: tmp = ((t_0 * J) * math.cos((K / 2.0))) + U elif t_0 <= 2e-15: tmp = U + (l * (J * (2.0 * t_1))) else: tmp = U + (t_0 * (J * t_1)) return tmp
function code(J, l, K, U) t_0 = Float64(exp(l) - exp(Float64(-l))) t_1 = cos(Float64(K * 0.5)) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = Float64(Float64(Float64(t_0 * J) * cos(Float64(K / 2.0))) + U); elseif (t_0 <= 2e-15) tmp = Float64(U + Float64(l * Float64(J * Float64(2.0 * t_1)))); else tmp = Float64(U + Float64(t_0 * Float64(J * t_1))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = exp(l) - exp(-l); t_1 = cos((K * 0.5)); tmp = 0.0; if (t_0 <= -Inf) tmp = ((t_0 * J) * cos((K / 2.0))) + U; elseif (t_0 <= 2e-15) tmp = U + (l * (J * (2.0 * t_1))); else tmp = U + (t_0 * (J * t_1)); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(N[(N[(t$95$0 * J), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], If[LessEqual[t$95$0, 2e-15], N[(U + N[(l * N[(J * N[(2.0 * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(t$95$0 * N[(J * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{\ell} - e^{-\ell}\\
t_1 := \cos \left(K \cdot 0.5\right)\\
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;\left(t\_0 \cdot J\right) \cdot \cos \left(\frac{K}{2}\right) + U\\
\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{-15}:\\
\;\;\;\;U + \ell \cdot \left(J \cdot \left(2 \cdot t\_1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + t\_0 \cdot \left(J \cdot t\_1\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -inf.0Initial program 100.0%
if -inf.0 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 2.0000000000000002e-15Initial program 68.6%
Taylor expanded in l around 0 99.9%
*-commutative99.9%
associate-*r*100.0%
associate-*l*100.0%
*-commutative100.0%
*-commutative100.0%
associate-*l*100.0%
*-commutative100.0%
Simplified100.0%
if 2.0000000000000002e-15 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 100.0%
Taylor expanded in J around 0 100.0%
associate-*r*100.0%
*-commutative100.0%
Simplified100.0%
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 2e-15)))
(+ (* (* 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 <= 2e-15)) {
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 <= 2e-15)) {
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 <= 2e-15): 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 <= 2e-15)) tmp = Float64(Float64(Float64(t_0 * J) * cos(Float64(K / 2.0))) + U); else tmp = Float64(U + Float64(l * Float64(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 <= 2e-15))) 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, 2e-15]], $MachinePrecision]], N[(N[(N[(t$95$0 * J), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], N[(U + N[(l * N[(J * N[(2.0 * 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^{-15}\right):\\
\;\;\;\;\left(t\_0 \cdot J\right) \cdot \cos \left(\frac{K}{2}\right) + U\\
\mathbf{else}:\\
\;\;\;\;U + \ell \cdot \left(J \cdot \left(2 \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.0000000000000002e-15 < (-.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.0000000000000002e-15Initial program 68.6%
Taylor expanded in l around 0 99.9%
*-commutative99.9%
associate-*r*100.0%
associate-*l*100.0%
*-commutative100.0%
*-commutative100.0%
associate-*l*100.0%
*-commutative100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (* K 0.5))) (t_1 (cos (/ K 2.0))))
(if (<= t_1 -0.955)
(+ U (* l (* J (* 2.0 t_0))))
(if (<= t_1 -0.92)
(+ U (* (* l J) (+ 2.0 (* -0.25 (pow K 2.0)))))
(if (<= t_1 0.15)
(+ U (* 2.0 (* J (* l t_0))))
(+ U (* J (* l (+ 2.0 (* 0.3333333333333333 (pow l 2.0)))))))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K * 0.5));
double t_1 = cos((K / 2.0));
double tmp;
if (t_1 <= -0.955) {
tmp = U + (l * (J * (2.0 * t_0)));
} else if (t_1 <= -0.92) {
tmp = U + ((l * J) * (2.0 + (-0.25 * pow(K, 2.0))));
} else if (t_1 <= 0.15) {
tmp = U + (2.0 * (J * (l * t_0)));
} else {
tmp = U + (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 = cos((k * 0.5d0))
t_1 = cos((k / 2.0d0))
if (t_1 <= (-0.955d0)) then
tmp = u + (l * (j * (2.0d0 * t_0)))
else if (t_1 <= (-0.92d0)) then
tmp = u + ((l * j) * (2.0d0 + ((-0.25d0) * (k ** 2.0d0))))
else if (t_1 <= 0.15d0) then
tmp = u + (2.0d0 * (j * (l * t_0)))
else
tmp = u + (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.cos((K * 0.5));
double t_1 = Math.cos((K / 2.0));
double tmp;
if (t_1 <= -0.955) {
tmp = U + (l * (J * (2.0 * t_0)));
} else if (t_1 <= -0.92) {
tmp = U + ((l * J) * (2.0 + (-0.25 * Math.pow(K, 2.0))));
} else if (t_1 <= 0.15) {
tmp = U + (2.0 * (J * (l * t_0)));
} else {
tmp = U + (J * (l * (2.0 + (0.3333333333333333 * Math.pow(l, 2.0)))));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K * 0.5)) t_1 = math.cos((K / 2.0)) tmp = 0 if t_1 <= -0.955: tmp = U + (l * (J * (2.0 * t_0))) elif t_1 <= -0.92: tmp = U + ((l * J) * (2.0 + (-0.25 * math.pow(K, 2.0)))) elif t_1 <= 0.15: tmp = U + (2.0 * (J * (l * t_0))) else: tmp = U + (J * (l * (2.0 + (0.3333333333333333 * math.pow(l, 2.0))))) return tmp
function code(J, l, K, U) t_0 = cos(Float64(K * 0.5)) t_1 = cos(Float64(K / 2.0)) tmp = 0.0 if (t_1 <= -0.955) tmp = Float64(U + Float64(l * Float64(J * Float64(2.0 * t_0)))); elseif (t_1 <= -0.92) tmp = Float64(U + Float64(Float64(l * J) * Float64(2.0 + Float64(-0.25 * (K ^ 2.0))))); elseif (t_1 <= 0.15) tmp = Float64(U + Float64(2.0 * Float64(J * Float64(l * t_0)))); else tmp = Float64(U + 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 = cos((K * 0.5)); t_1 = cos((K / 2.0)); tmp = 0.0; if (t_1 <= -0.955) tmp = U + (l * (J * (2.0 * t_0))); elseif (t_1 <= -0.92) tmp = U + ((l * J) * (2.0 + (-0.25 * (K ^ 2.0)))); elseif (t_1 <= 0.15) tmp = U + (2.0 * (J * (l * t_0))); else tmp = U + (J * (l * (2.0 + (0.3333333333333333 * (l ^ 2.0))))); 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[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$1, -0.955], N[(U + N[(l * N[(J * N[(2.0 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, -0.92], N[(U + N[(N[(l * J), $MachinePrecision] * N[(2.0 + N[(-0.25 * N[Power[K, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.15], N[(U + N[(2.0 * N[(J * N[(l * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * N[(l * N[(2.0 + N[(0.3333333333333333 * N[Power[l, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(K \cdot 0.5\right)\\
t_1 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;t\_1 \leq -0.955:\\
\;\;\;\;U + \ell \cdot \left(J \cdot \left(2 \cdot t\_0\right)\right)\\
\mathbf{elif}\;t\_1 \leq -0.92:\\
\;\;\;\;U + \left(\ell \cdot J\right) \cdot \left(2 + -0.25 \cdot {K}^{2}\right)\\
\mathbf{elif}\;t\_1 \leq 0.15:\\
\;\;\;\;U + 2 \cdot \left(J \cdot \left(\ell \cdot t\_0\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(\ell \cdot \left(2 + 0.3333333333333333 \cdot {\ell}^{2}\right)\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.95499999999999996Initial program 65.8%
Taylor expanded in l around 0 59.7%
*-commutative59.7%
associate-*r*59.8%
associate-*l*59.8%
*-commutative59.8%
*-commutative59.8%
associate-*l*59.8%
*-commutative59.8%
Simplified59.8%
if -0.95499999999999996 < (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.92000000000000004Initial program 100.0%
Taylor expanded in J around 0 100.0%
associate-*r*100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in l around 0 2.5%
Taylor expanded in K around 0 100.0%
+-commutative100.0%
*-commutative100.0%
*-commutative100.0%
associate-*r*84.2%
associate-*l*84.2%
*-commutative84.2%
associate-*l*84.2%
distribute-lft-out84.2%
Simplified84.2%
if -0.92000000000000004 < (cos.f64 (/.f64 K #s(literal 2 binary64))) < 0.149999999999999994Initial program 91.4%
Taylor expanded in l around 0 65.1%
if 0.149999999999999994 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 83.9%
Taylor expanded in l around 0 90.0%
Taylor expanded in K around 0 87.6%
Final simplification81.2%
(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) U)))
(if (<= l -1.8e+83)
t_0
(if (<= l -0.135)
t_1
(if (<= l 0.55)
(+ U (* l (* J (* 2.0 (cos (* K 0.5))))))
(if (<= l 2.4e+84) 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) + U;
double tmp;
if (l <= -1.8e+83) {
tmp = t_0;
} else if (l <= -0.135) {
tmp = t_1;
} else if (l <= 0.55) {
tmp = U + (l * (J * (2.0 * cos((K * 0.5)))));
} else if (l <= 2.4e+84) {
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) + u
if (l <= (-1.8d+83)) then
tmp = t_0
else if (l <= (-0.135d0)) then
tmp = t_1
else if (l <= 0.55d0) then
tmp = u + (l * (j * (2.0d0 * cos((k * 0.5d0)))))
else if (l <= 2.4d+84) 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) + U;
double tmp;
if (l <= -1.8e+83) {
tmp = t_0;
} else if (l <= -0.135) {
tmp = t_1;
} else if (l <= 0.55) {
tmp = U + (l * (J * (2.0 * Math.cos((K * 0.5)))));
} else if (l <= 2.4e+84) {
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) + U tmp = 0 if l <= -1.8e+83: tmp = t_0 elif l <= -0.135: tmp = t_1 elif l <= 0.55: tmp = U + (l * (J * (2.0 * math.cos((K * 0.5))))) elif l <= 2.4e+84: 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(Float64(exp(l) - exp(Float64(-l))) * J) + U) tmp = 0.0 if (l <= -1.8e+83) tmp = t_0; elseif (l <= -0.135) tmp = t_1; elseif (l <= 0.55) tmp = Float64(U + Float64(l * Float64(J * Float64(2.0 * cos(Float64(K * 0.5)))))); elseif (l <= 2.4e+84) 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) + U; tmp = 0.0; if (l <= -1.8e+83) tmp = t_0; elseif (l <= -0.135) tmp = t_1; elseif (l <= 0.55) tmp = U + (l * (J * (2.0 * cos((K * 0.5))))); elseif (l <= 2.4e+84) 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[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision] + U), $MachinePrecision]}, If[LessEqual[l, -1.8e+83], t$95$0, If[LessEqual[l, -0.135], t$95$1, If[LessEqual[l, 0.55], N[(U + N[(l * N[(J * N[(2.0 * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.4e+84], 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 + U\\
\mathbf{if}\;\ell \leq -1.8 \cdot 10^{+83}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq -0.135:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\ell \leq 0.55:\\
\;\;\;\;U + \ell \cdot \left(J \cdot \left(2 \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\mathbf{elif}\;\ell \leq 2.4 \cdot 10^{+84}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if l < -1.7999999999999999e83 or 2.4e84 < l Initial program 100.0%
Taylor expanded in l around 0 98.9%
Taylor expanded in l around inf 98.9%
associate-*r*98.9%
*-commutative98.9%
associate-*r*98.9%
Simplified98.9%
if -1.7999999999999999e83 < l < -0.13500000000000001 or 0.55000000000000004 < l < 2.4e84Initial program 100.0%
Taylor expanded in K around 0 65.8%
if -0.13500000000000001 < l < 0.55000000000000004Initial program 69.1%
Taylor expanded in l around 0 99.3%
*-commutative99.3%
associate-*r*99.4%
associate-*l*99.4%
*-commutative99.4%
*-commutative99.4%
associate-*l*99.4%
*-commutative99.4%
Simplified99.4%
Final simplification94.2%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= l -3.7e+84)
(+ U (* t_0 (* J (* 0.3333333333333333 (pow l 3.0)))))
(if (<= l -0.135)
(+ (* (- (exp l) (exp (- l))) J) U)
(+ U (* t_0 (* J (* l (+ 2.0 (* 0.3333333333333333 (pow l 2.0)))))))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double tmp;
if (l <= -3.7e+84) {
tmp = U + (t_0 * (J * (0.3333333333333333 * pow(l, 3.0))));
} else if (l <= -0.135) {
tmp = ((exp(l) - exp(-l)) * J) + U;
} else {
tmp = U + (t_0 * (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) :: tmp
t_0 = cos((k / 2.0d0))
if (l <= (-3.7d+84)) then
tmp = u + (t_0 * (j * (0.3333333333333333d0 * (l ** 3.0d0))))
else if (l <= (-0.135d0)) then
tmp = ((exp(l) - exp(-l)) * j) + u
else
tmp = u + (t_0 * (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.cos((K / 2.0));
double tmp;
if (l <= -3.7e+84) {
tmp = U + (t_0 * (J * (0.3333333333333333 * Math.pow(l, 3.0))));
} else if (l <= -0.135) {
tmp = ((Math.exp(l) - Math.exp(-l)) * J) + U;
} else {
tmp = U + (t_0 * (J * (l * (2.0 + (0.3333333333333333 * Math.pow(l, 2.0))))));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K / 2.0)) tmp = 0 if l <= -3.7e+84: tmp = U + (t_0 * (J * (0.3333333333333333 * math.pow(l, 3.0)))) elif l <= -0.135: tmp = ((math.exp(l) - math.exp(-l)) * J) + U else: tmp = U + (t_0 * (J * (l * (2.0 + (0.3333333333333333 * math.pow(l, 2.0)))))) return tmp
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) tmp = 0.0 if (l <= -3.7e+84) tmp = Float64(U + Float64(t_0 * Float64(J * Float64(0.3333333333333333 * (l ^ 3.0))))); elseif (l <= -0.135) tmp = Float64(Float64(Float64(exp(l) - exp(Float64(-l))) * J) + U); else tmp = Float64(U + Float64(t_0 * 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 = cos((K / 2.0)); tmp = 0.0; if (l <= -3.7e+84) tmp = U + (t_0 * (J * (0.3333333333333333 * (l ^ 3.0)))); elseif (l <= -0.135) tmp = ((exp(l) - exp(-l)) * J) + U; else tmp = U + (t_0 * (J * (l * (2.0 + (0.3333333333333333 * (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]}, If[LessEqual[l, -3.7e+84], N[(U + N[(t$95$0 * N[(J * N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -0.135], N[(N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision] + U), $MachinePrecision], N[(U + N[(t$95$0 * 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 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;\ell \leq -3.7 \cdot 10^{+84}:\\
\;\;\;\;U + t\_0 \cdot \left(J \cdot \left(0.3333333333333333 \cdot {\ell}^{3}\right)\right)\\
\mathbf{elif}\;\ell \leq -0.135:\\
\;\;\;\;\left(e^{\ell} - e^{-\ell}\right) \cdot J + U\\
\mathbf{else}:\\
\;\;\;\;U + t\_0 \cdot \left(J \cdot \left(\ell \cdot \left(2 + 0.3333333333333333 \cdot {\ell}^{2}\right)\right)\right)\\
\end{array}
\end{array}
if l < -3.7e84Initial program 100.0%
Taylor expanded in l around 0 98.1%
Taylor expanded in l around inf 98.1%
associate-*r*98.1%
*-commutative98.1%
associate-*r*98.1%
Simplified98.1%
if -3.7e84 < l < -0.13500000000000001Initial program 100.0%
Taylor expanded in K around 0 65.0%
if -0.13500000000000001 < l Initial program 78.8%
Taylor expanded in l around 0 93.3%
Final simplification92.1%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) 0.15) (+ U (* l (* J (* 2.0 (cos (* K 0.5)))))) (+ U (* J (* l (+ 2.0 (* 0.3333333333333333 (pow l 2.0))))))))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= 0.15) {
tmp = U + (l * (J * (2.0 * cos((K * 0.5)))));
} else {
tmp = U + (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) :: tmp
if (cos((k / 2.0d0)) <= 0.15d0) then
tmp = u + (l * (j * (2.0d0 * cos((k * 0.5d0)))))
else
tmp = u + (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 tmp;
if (Math.cos((K / 2.0)) <= 0.15) {
tmp = U + (l * (J * (2.0 * Math.cos((K * 0.5)))));
} else {
tmp = U + (J * (l * (2.0 + (0.3333333333333333 * Math.pow(l, 2.0)))));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if math.cos((K / 2.0)) <= 0.15: tmp = U + (l * (J * (2.0 * math.cos((K * 0.5))))) else: tmp = U + (J * (l * (2.0 + (0.3333333333333333 * math.pow(l, 2.0))))) return tmp
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= 0.15) tmp = Float64(U + Float64(l * Float64(J * Float64(2.0 * cos(Float64(K * 0.5)))))); else tmp = Float64(U + 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) tmp = 0.0; if (cos((K / 2.0)) <= 0.15) tmp = U + (l * (J * (2.0 * cos((K * 0.5))))); else tmp = U + (J * (l * (2.0 + (0.3333333333333333 * (l ^ 2.0))))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], 0.15], N[(U + N[(l * N[(J * N[(2.0 * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * N[(l * N[(2.0 + N[(0.3333333333333333 * N[Power[l, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq 0.15:\\
\;\;\;\;U + \ell \cdot \left(J \cdot \left(2 \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(\ell \cdot \left(2 + 0.3333333333333333 \cdot {\ell}^{2}\right)\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < 0.149999999999999994Initial program 86.6%
Taylor expanded in l around 0 58.9%
*-commutative58.9%
associate-*r*58.9%
associate-*l*58.9%
*-commutative58.9%
*-commutative58.9%
associate-*l*58.9%
*-commutative58.9%
Simplified58.9%
if 0.149999999999999994 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 83.9%
Taylor expanded in l around 0 90.0%
Taylor expanded in K around 0 87.6%
Final simplification79.3%
(FPCore (J l K U) :precision binary64 (if (or (<= l -0.14) (not (<= l 0.84))) (+ (* (- (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.14) || !(l <= 0.84)) {
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.14d0)) .or. (.not. (l <= 0.84d0))) 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.14) || !(l <= 0.84)) {
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.14) or not (l <= 0.84): 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.14) || !(l <= 0.84)) tmp = Float64(Float64(Float64(exp(l) - exp(Float64(-l))) * J) + U); else tmp = Float64(U + Float64(l * Float64(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.14) || ~((l <= 0.84))) 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.14], N[Not[LessEqual[l, 0.84]], $MachinePrecision]], N[(N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision] + U), $MachinePrecision], N[(U + N[(l * N[(J * N[(2.0 * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -0.14 \lor \neg \left(\ell \leq 0.84\right):\\
\;\;\;\;\left(e^{\ell} - e^{-\ell}\right) \cdot J + U\\
\mathbf{else}:\\
\;\;\;\;U + \ell \cdot \left(J \cdot \left(2 \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\end{array}
\end{array}
if l < -0.14000000000000001 or 0.839999999999999969 < l Initial program 100.0%
Taylor expanded in K around 0 72.1%
if -0.14000000000000001 < l < 0.839999999999999969Initial program 69.1%
Taylor expanded in l around 0 99.3%
*-commutative99.3%
associate-*r*99.4%
associate-*l*99.4%
*-commutative99.4%
*-commutative99.4%
associate-*l*99.4%
*-commutative99.4%
Simplified99.4%
Final simplification85.6%
(FPCore (J l K U)
:precision binary64
(let* ((t_0
(*
U
(+
1.0
(/ (* J (* l (+ 2.0 (* 0.3333333333333333 (pow l 2.0))))) U)))))
(if (<= l -1.05e+22)
t_0
(if (<= l 2.7e+41)
(+ U (* l (* J (* 2.0 (cos (* K 0.5))))))
(if (<= l 3.35e+61)
(+ U (+ (* -0.25 (* J (* l (pow K 2.0)))) (* 2.0 (* l J))))
t_0)))))
double code(double J, double l, double K, double U) {
double t_0 = U * (1.0 + ((J * (l * (2.0 + (0.3333333333333333 * pow(l, 2.0))))) / U));
double tmp;
if (l <= -1.05e+22) {
tmp = t_0;
} else if (l <= 2.7e+41) {
tmp = U + (l * (J * (2.0 * cos((K * 0.5)))));
} else if (l <= 3.35e+61) {
tmp = U + ((-0.25 * (J * (l * pow(K, 2.0)))) + (2.0 * (l * J)));
} 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 * (1.0d0 + ((j * (l * (2.0d0 + (0.3333333333333333d0 * (l ** 2.0d0))))) / u))
if (l <= (-1.05d+22)) then
tmp = t_0
else if (l <= 2.7d+41) then
tmp = u + (l * (j * (2.0d0 * cos((k * 0.5d0)))))
else if (l <= 3.35d+61) then
tmp = u + (((-0.25d0) * (j * (l * (k ** 2.0d0)))) + (2.0d0 * (l * j)))
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 * (1.0 + ((J * (l * (2.0 + (0.3333333333333333 * Math.pow(l, 2.0))))) / U));
double tmp;
if (l <= -1.05e+22) {
tmp = t_0;
} else if (l <= 2.7e+41) {
tmp = U + (l * (J * (2.0 * Math.cos((K * 0.5)))));
} else if (l <= 3.35e+61) {
tmp = U + ((-0.25 * (J * (l * Math.pow(K, 2.0)))) + (2.0 * (l * J)));
} else {
tmp = t_0;
}
return tmp;
}
def code(J, l, K, U): t_0 = U * (1.0 + ((J * (l * (2.0 + (0.3333333333333333 * math.pow(l, 2.0))))) / U)) tmp = 0 if l <= -1.05e+22: tmp = t_0 elif l <= 2.7e+41: tmp = U + (l * (J * (2.0 * math.cos((K * 0.5))))) elif l <= 3.35e+61: tmp = U + ((-0.25 * (J * (l * math.pow(K, 2.0)))) + (2.0 * (l * J))) else: tmp = t_0 return tmp
function code(J, l, K, U) t_0 = Float64(U * Float64(1.0 + Float64(Float64(J * Float64(l * Float64(2.0 + Float64(0.3333333333333333 * (l ^ 2.0))))) / U))) tmp = 0.0 if (l <= -1.05e+22) tmp = t_0; elseif (l <= 2.7e+41) tmp = Float64(U + Float64(l * Float64(J * Float64(2.0 * cos(Float64(K * 0.5)))))); elseif (l <= 3.35e+61) tmp = Float64(U + Float64(Float64(-0.25 * Float64(J * Float64(l * (K ^ 2.0)))) + Float64(2.0 * Float64(l * J)))); else tmp = t_0; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = U * (1.0 + ((J * (l * (2.0 + (0.3333333333333333 * (l ^ 2.0))))) / U)); tmp = 0.0; if (l <= -1.05e+22) tmp = t_0; elseif (l <= 2.7e+41) tmp = U + (l * (J * (2.0 * cos((K * 0.5))))); elseif (l <= 3.35e+61) tmp = U + ((-0.25 * (J * (l * (K ^ 2.0)))) + (2.0 * (l * J))); else tmp = t_0; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(U * N[(1.0 + N[(N[(J * N[(l * N[(2.0 + N[(0.3333333333333333 * N[Power[l, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -1.05e+22], t$95$0, If[LessEqual[l, 2.7e+41], N[(U + N[(l * N[(J * N[(2.0 * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 3.35e+61], N[(U + N[(N[(-0.25 * N[(J * N[(l * N[Power[K, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(2.0 * N[(l * J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U \cdot \left(1 + \frac{J \cdot \left(\ell \cdot \left(2 + 0.3333333333333333 \cdot {\ell}^{2}\right)\right)}{U}\right)\\
\mathbf{if}\;\ell \leq -1.05 \cdot 10^{+22}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq 2.7 \cdot 10^{+41}:\\
\;\;\;\;U + \ell \cdot \left(J \cdot \left(2 \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\mathbf{elif}\;\ell \leq 3.35 \cdot 10^{+61}:\\
\;\;\;\;U + \left(-0.25 \cdot \left(J \cdot \left(\ell \cdot {K}^{2}\right)\right) + 2 \cdot \left(\ell \cdot J\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if l < -1.0499999999999999e22 or 3.34999999999999972e61 < l Initial program 100.0%
Taylor expanded in l around 0 85.3%
Taylor expanded in K around 0 64.5%
Taylor expanded in U around inf 67.1%
if -1.0499999999999999e22 < l < 2.7e41Initial program 71.8%
Taylor expanded in l around 0 92.6%
*-commutative92.6%
associate-*r*92.6%
associate-*l*92.6%
*-commutative92.6%
*-commutative92.6%
associate-*l*92.6%
*-commutative92.6%
Simplified92.6%
if 2.7e41 < l < 3.34999999999999972e61Initial program 100.0%
Taylor expanded in J around 0 100.0%
associate-*r*100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in l around 0 4.8%
Taylor expanded in K around 0 83.4%
Final simplification81.3%
(FPCore (J l K U) :precision binary64 (if (or (<= l -3e+21) (not (<= l 13.8))) (* U (+ 1.0 (/ (* J (* l (+ 2.0 (* 0.3333333333333333 (pow l 2.0))))) U))) (+ U (* l (* J (* 2.0 (cos (* K 0.5))))))))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -3e+21) || !(l <= 13.8)) {
tmp = U * (1.0 + ((J * (l * (2.0 + (0.3333333333333333 * pow(l, 2.0))))) / 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 <= (-3d+21)) .or. (.not. (l <= 13.8d0))) then
tmp = u * (1.0d0 + ((j * (l * (2.0d0 + (0.3333333333333333d0 * (l ** 2.0d0))))) / 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 <= -3e+21) || !(l <= 13.8)) {
tmp = U * (1.0 + ((J * (l * (2.0 + (0.3333333333333333 * Math.pow(l, 2.0))))) / 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 <= -3e+21) or not (l <= 13.8): tmp = U * (1.0 + ((J * (l * (2.0 + (0.3333333333333333 * math.pow(l, 2.0))))) / 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 <= -3e+21) || !(l <= 13.8)) tmp = Float64(U * Float64(1.0 + Float64(Float64(J * Float64(l * Float64(2.0 + Float64(0.3333333333333333 * (l ^ 2.0))))) / U))); else tmp = Float64(U + Float64(l * Float64(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 <= -3e+21) || ~((l <= 13.8))) tmp = U * (1.0 + ((J * (l * (2.0 + (0.3333333333333333 * (l ^ 2.0))))) / 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, -3e+21], N[Not[LessEqual[l, 13.8]], $MachinePrecision]], N[(U * N[(1.0 + N[(N[(J * N[(l * N[(2.0 + N[(0.3333333333333333 * N[Power[l, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(l * N[(J * N[(2.0 * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -3 \cdot 10^{+21} \lor \neg \left(\ell \leq 13.8\right):\\
\;\;\;\;U \cdot \left(1 + \frac{J \cdot \left(\ell \cdot \left(2 + 0.3333333333333333 \cdot {\ell}^{2}\right)\right)}{U}\right)\\
\mathbf{else}:\\
\;\;\;\;U + \ell \cdot \left(J \cdot \left(2 \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\end{array}
\end{array}
if l < -3e21 or 13.800000000000001 < l Initial program 100.0%
Taylor expanded in l around 0 80.6%
Taylor expanded in K around 0 60.3%
Taylor expanded in U around inf 62.6%
if -3e21 < l < 13.800000000000001Initial program 70.3%
Taylor expanded in l around 0 95.8%
*-commutative95.8%
associate-*r*95.8%
associate-*l*95.8%
*-commutative95.8%
*-commutative95.8%
associate-*l*95.8%
*-commutative95.8%
Simplified95.8%
Final simplification79.7%
(FPCore (J l K U)
:precision binary64
(if (<= l -5.8e+32)
(* 0.3333333333333333 (* J (pow l 3.0)))
(if (<= l 95.0)
(+ U (* l (* J (* 2.0 (cos (* K 0.5))))))
(* J (* 0.3333333333333333 (pow l 3.0))))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -5.8e+32) {
tmp = 0.3333333333333333 * (J * pow(l, 3.0));
} else if (l <= 95.0) {
tmp = U + (l * (J * (2.0 * cos((K * 0.5)))));
} else {
tmp = J * (0.3333333333333333 * pow(l, 3.0));
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if (l <= (-5.8d+32)) then
tmp = 0.3333333333333333d0 * (j * (l ** 3.0d0))
else if (l <= 95.0d0) then
tmp = u + (l * (j * (2.0d0 * cos((k * 0.5d0)))))
else
tmp = j * (0.3333333333333333d0 * (l ** 3.0d0))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (l <= -5.8e+32) {
tmp = 0.3333333333333333 * (J * Math.pow(l, 3.0));
} else if (l <= 95.0) {
tmp = U + (l * (J * (2.0 * Math.cos((K * 0.5)))));
} else {
tmp = J * (0.3333333333333333 * Math.pow(l, 3.0));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -5.8e+32: tmp = 0.3333333333333333 * (J * math.pow(l, 3.0)) elif l <= 95.0: tmp = U + (l * (J * (2.0 * math.cos((K * 0.5))))) else: tmp = J * (0.3333333333333333 * math.pow(l, 3.0)) return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -5.8e+32) tmp = Float64(0.3333333333333333 * Float64(J * (l ^ 3.0))); elseif (l <= 95.0) tmp = Float64(U + Float64(l * Float64(J * Float64(2.0 * cos(Float64(K * 0.5)))))); else tmp = Float64(J * Float64(0.3333333333333333 * (l ^ 3.0))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -5.8e+32) tmp = 0.3333333333333333 * (J * (l ^ 3.0)); elseif (l <= 95.0) tmp = U + (l * (J * (2.0 * cos((K * 0.5))))); else tmp = J * (0.3333333333333333 * (l ^ 3.0)); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -5.8e+32], N[(0.3333333333333333 * N[(J * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 95.0], N[(U + N[(l * N[(J * N[(2.0 * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(J * N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -5.8 \cdot 10^{+32}:\\
\;\;\;\;0.3333333333333333 \cdot \left(J \cdot {\ell}^{3}\right)\\
\mathbf{elif}\;\ell \leq 95:\\
\;\;\;\;U + \ell \cdot \left(J \cdot \left(2 \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;J \cdot \left(0.3333333333333333 \cdot {\ell}^{3}\right)\\
\end{array}
\end{array}
if l < -5.80000000000000006e32Initial program 100.0%
Taylor expanded in l around 0 86.0%
Taylor expanded in K around 0 61.6%
Taylor expanded in l around inf 61.7%
if -5.80000000000000006e32 < l < 95Initial program 71.4%
Taylor expanded in l around 0 93.2%
*-commutative93.2%
associate-*r*93.2%
associate-*l*93.2%
*-commutative93.2%
*-commutative93.2%
associate-*l*93.2%
*-commutative93.2%
Simplified93.2%
if 95 < l Initial program 100.0%
Taylor expanded in l around 0 79.7%
Taylor expanded in K around 0 62.0%
Taylor expanded in l around inf 62.1%
associate-*r*62.1%
*-commutative62.1%
associate-*l*62.1%
Simplified62.1%
Final simplification78.6%
(FPCore (J l K U)
:precision binary64
(if (<= l -6.8e+32)
(* 0.3333333333333333 (* J (pow l 3.0)))
(if (<= l 95.0)
(+ U (* 2.0 (* J (* l (cos (* K 0.5))))))
(* J (* 0.3333333333333333 (pow l 3.0))))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -6.8e+32) {
tmp = 0.3333333333333333 * (J * pow(l, 3.0));
} else if (l <= 95.0) {
tmp = U + (2.0 * (J * (l * cos((K * 0.5)))));
} else {
tmp = J * (0.3333333333333333 * pow(l, 3.0));
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if (l <= (-6.8d+32)) then
tmp = 0.3333333333333333d0 * (j * (l ** 3.0d0))
else if (l <= 95.0d0) then
tmp = u + (2.0d0 * (j * (l * cos((k * 0.5d0)))))
else
tmp = j * (0.3333333333333333d0 * (l ** 3.0d0))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (l <= -6.8e+32) {
tmp = 0.3333333333333333 * (J * Math.pow(l, 3.0));
} else if (l <= 95.0) {
tmp = U + (2.0 * (J * (l * Math.cos((K * 0.5)))));
} else {
tmp = J * (0.3333333333333333 * Math.pow(l, 3.0));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -6.8e+32: tmp = 0.3333333333333333 * (J * math.pow(l, 3.0)) elif l <= 95.0: tmp = U + (2.0 * (J * (l * math.cos((K * 0.5))))) else: tmp = J * (0.3333333333333333 * math.pow(l, 3.0)) return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -6.8e+32) tmp = Float64(0.3333333333333333 * Float64(J * (l ^ 3.0))); elseif (l <= 95.0) tmp = Float64(U + Float64(2.0 * Float64(J * Float64(l * cos(Float64(K * 0.5)))))); else tmp = Float64(J * Float64(0.3333333333333333 * (l ^ 3.0))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -6.8e+32) tmp = 0.3333333333333333 * (J * (l ^ 3.0)); elseif (l <= 95.0) tmp = U + (2.0 * (J * (l * cos((K * 0.5))))); else tmp = J * (0.3333333333333333 * (l ^ 3.0)); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -6.8e+32], N[(0.3333333333333333 * N[(J * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 95.0], N[(U + N[(2.0 * N[(J * N[(l * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(J * N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -6.8 \cdot 10^{+32}:\\
\;\;\;\;0.3333333333333333 \cdot \left(J \cdot {\ell}^{3}\right)\\
\mathbf{elif}\;\ell \leq 95:\\
\;\;\;\;U + 2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;J \cdot \left(0.3333333333333333 \cdot {\ell}^{3}\right)\\
\end{array}
\end{array}
if l < -6.79999999999999957e32Initial program 100.0%
Taylor expanded in l around 0 86.0%
Taylor expanded in K around 0 61.6%
Taylor expanded in l around inf 61.7%
if -6.79999999999999957e32 < l < 95Initial program 71.4%
Taylor expanded in l around 0 93.2%
if 95 < l Initial program 100.0%
Taylor expanded in l around 0 79.7%
Taylor expanded in K around 0 62.0%
Taylor expanded in l around inf 62.1%
associate-*r*62.1%
*-commutative62.1%
associate-*l*62.1%
Simplified62.1%
Final simplification78.6%
(FPCore (J l K U) :precision binary64 (if (or (<= l -5.8e+32) (not (<= l 95.0))) (* 0.3333333333333333 (* J (pow l 3.0))) (fma J (* l 2.0) U)))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -5.8e+32) || !(l <= 95.0)) {
tmp = 0.3333333333333333 * (J * pow(l, 3.0));
} else {
tmp = fma(J, (l * 2.0), U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if ((l <= -5.8e+32) || !(l <= 95.0)) tmp = Float64(0.3333333333333333 * Float64(J * (l ^ 3.0))); else tmp = fma(J, Float64(l * 2.0), U); end return tmp end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -5.8e+32], N[Not[LessEqual[l, 95.0]], $MachinePrecision]], N[(0.3333333333333333 * N[(J * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(J * N[(l * 2.0), $MachinePrecision] + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -5.8 \cdot 10^{+32} \lor \neg \left(\ell \leq 95\right):\\
\;\;\;\;0.3333333333333333 \cdot \left(J \cdot {\ell}^{3}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(J, \ell \cdot 2, U\right)\\
\end{array}
\end{array}
if l < -5.80000000000000006e32 or 95 < l Initial program 100.0%
Taylor expanded in l around 0 83.0%
Taylor expanded in K around 0 61.8%
Taylor expanded in l around inf 61.9%
if -5.80000000000000006e32 < l < 95Initial program 71.4%
Taylor expanded in l around 0 93.9%
Taylor expanded in K around 0 82.5%
Taylor expanded in l around 0 82.5%
+-commutative82.5%
*-commutative82.5%
associate-*r*82.5%
fma-define82.5%
Simplified82.5%
Final simplification72.9%
(FPCore (J l K U)
:precision binary64
(if (<= l -5.7e+32)
(* 0.3333333333333333 (* J (pow l 3.0)))
(if (<= l 95.0)
(fma J (* l 2.0) U)
(* J (* 0.3333333333333333 (pow l 3.0))))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -5.7e+32) {
tmp = 0.3333333333333333 * (J * pow(l, 3.0));
} else if (l <= 95.0) {
tmp = fma(J, (l * 2.0), U);
} else {
tmp = J * (0.3333333333333333 * pow(l, 3.0));
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (l <= -5.7e+32) tmp = Float64(0.3333333333333333 * Float64(J * (l ^ 3.0))); elseif (l <= 95.0) tmp = fma(J, Float64(l * 2.0), U); else tmp = Float64(J * Float64(0.3333333333333333 * (l ^ 3.0))); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[l, -5.7e+32], N[(0.3333333333333333 * N[(J * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 95.0], N[(J * N[(l * 2.0), $MachinePrecision] + U), $MachinePrecision], N[(J * N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -5.7 \cdot 10^{+32}:\\
\;\;\;\;0.3333333333333333 \cdot \left(J \cdot {\ell}^{3}\right)\\
\mathbf{elif}\;\ell \leq 95:\\
\;\;\;\;\mathsf{fma}\left(J, \ell \cdot 2, U\right)\\
\mathbf{else}:\\
\;\;\;\;J \cdot \left(0.3333333333333333 \cdot {\ell}^{3}\right)\\
\end{array}
\end{array}
if l < -5.7e32Initial program 100.0%
Taylor expanded in l around 0 86.0%
Taylor expanded in K around 0 61.6%
Taylor expanded in l around inf 61.7%
if -5.7e32 < l < 95Initial program 71.4%
Taylor expanded in l around 0 93.9%
Taylor expanded in K around 0 82.5%
Taylor expanded in l around 0 82.5%
+-commutative82.5%
*-commutative82.5%
associate-*r*82.5%
fma-define82.5%
Simplified82.5%
if 95 < l Initial program 100.0%
Taylor expanded in l around 0 79.7%
Taylor expanded in K around 0 62.0%
Taylor expanded in l around inf 62.1%
associate-*r*62.1%
*-commutative62.1%
associate-*l*62.1%
Simplified62.1%
(FPCore (J l K U) :precision binary64 (if (<= l -850.0) (pow U -16.0) (fma J (* l 2.0) U)))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -850.0) {
tmp = pow(U, -16.0);
} else {
tmp = fma(J, (l * 2.0), U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (l <= -850.0) tmp = U ^ -16.0; else tmp = fma(J, Float64(l * 2.0), U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[l, -850.0], N[Power[U, -16.0], $MachinePrecision], N[(J * N[(l * 2.0), $MachinePrecision] + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -850:\\
\;\;\;\;{U}^{-16}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(J, \ell \cdot 2, U\right)\\
\end{array}
\end{array}
if l < -850Initial program 100.0%
Taylor expanded in J around 0 100.0%
associate-*r*100.0%
*-commutative100.0%
Simplified100.0%
Applied egg-rr24.6%
if -850 < l Initial program 78.8%
Taylor expanded in l around 0 93.3%
Taylor expanded in K around 0 80.0%
Taylor expanded in l around 0 67.8%
+-commutative67.8%
*-commutative67.8%
associate-*r*67.8%
fma-define67.9%
Simplified67.9%
(FPCore (J l K U) :precision binary64 (if (<= l -640.0) (pow U -16.0) (+ U (* J (* l 2.0)))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -640.0) {
tmp = pow(U, -16.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 <= (-640.0d0)) then
tmp = u ** (-16.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 <= -640.0) {
tmp = Math.pow(U, -16.0);
} else {
tmp = U + (J * (l * 2.0));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -640.0: tmp = math.pow(U, -16.0) else: tmp = U + (J * (l * 2.0)) return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -640.0) tmp = U ^ -16.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 <= -640.0) tmp = U ^ -16.0; else tmp = U + (J * (l * 2.0)); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -640.0], N[Power[U, -16.0], $MachinePrecision], N[(U + N[(J * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -640:\\
\;\;\;\;{U}^{-16}\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(\ell \cdot 2\right)\\
\end{array}
\end{array}
if l < -640Initial program 100.0%
Taylor expanded in J around 0 100.0%
associate-*r*100.0%
*-commutative100.0%
Simplified100.0%
Applied egg-rr24.6%
if -640 < l Initial program 78.8%
Taylor expanded in J around 0 78.8%
associate-*r*78.8%
*-commutative78.8%
Simplified78.8%
Taylor expanded in l around 0 77.0%
Taylor expanded in K around 0 67.8%
Final simplification55.9%
(FPCore (J l K U) :precision binary64 (if (<= l -1.1e+173) (- -4.0 (* U U)) (if (or (<= l -63000000.0) (not (<= l 1250.0))) (* U U) U)))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -1.1e+173) {
tmp = -4.0 - (U * U);
} else if ((l <= -63000000.0) || !(l <= 1250.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.1d+173)) then
tmp = (-4.0d0) - (u * u)
else if ((l <= (-63000000.0d0)) .or. (.not. (l <= 1250.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.1e+173) {
tmp = -4.0 - (U * U);
} else if ((l <= -63000000.0) || !(l <= 1250.0)) {
tmp = U * U;
} else {
tmp = U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -1.1e+173: tmp = -4.0 - (U * U) elif (l <= -63000000.0) or not (l <= 1250.0): tmp = U * U else: tmp = U return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -1.1e+173) tmp = Float64(-4.0 - Float64(U * U)); elseif ((l <= -63000000.0) || !(l <= 1250.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.1e+173) tmp = -4.0 - (U * U); elseif ((l <= -63000000.0) || ~((l <= 1250.0))) tmp = U * U; else tmp = U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -1.1e+173], N[(-4.0 - N[(U * U), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[l, -63000000.0], N[Not[LessEqual[l, 1250.0]], $MachinePrecision]], N[(U * U), $MachinePrecision], U]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.1 \cdot 10^{+173}:\\
\;\;\;\;-4 - U \cdot U\\
\mathbf{elif}\;\ell \leq -63000000 \lor \neg \left(\ell \leq 1250\right):\\
\;\;\;\;U \cdot U\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\end{array}
if l < -1.1e173Initial program 100.0%
associate-*l*100.0%
fma-define100.0%
Simplified100.0%
Applied egg-rr20.2%
cancel-sign-sub-inv20.2%
Simplified20.2%
if -1.1e173 < l < -6.3e7 or 1250 < l Initial program 100.0%
Applied egg-rr20.1%
if -6.3e7 < l < 1250Initial program 70.0%
Taylor expanded in J around 0 66.4%
Final simplification43.8%
(FPCore (J l K U) :precision binary64 (if (or (<= l -7200000.0) (not (<= l 960.0))) (* U U) U))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -7200000.0) || !(l <= 960.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 <= (-7200000.0d0)) .or. (.not. (l <= 960.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 <= -7200000.0) || !(l <= 960.0)) {
tmp = U * U;
} else {
tmp = U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -7200000.0) or not (l <= 960.0): tmp = U * U else: tmp = U return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -7200000.0) || !(l <= 960.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 <= -7200000.0) || ~((l <= 960.0))) tmp = U * U; else tmp = U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -7200000.0], N[Not[LessEqual[l, 960.0]], $MachinePrecision]], N[(U * U), $MachinePrecision], U]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -7200000 \lor \neg \left(\ell \leq 960\right):\\
\;\;\;\;U \cdot U\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\end{array}
if l < -7.2e6 or 960 < l Initial program 100.0%
Applied egg-rr16.6%
if -7.2e6 < l < 960Initial program 70.0%
Taylor expanded in J around 0 66.4%
Final simplification42.1%
(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 84.7%
Taylor expanded in J around 0 84.7%
associate-*r*84.7%
*-commutative84.7%
Simplified84.7%
Taylor expanded in l around 0 61.4%
Taylor expanded in K around 0 53.5%
Final simplification53.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 84.7%
Taylor expanded in J around 0 35.1%
(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 84.7%
Applied egg-rr2.7%
*-inverses2.7%
Simplified2.7%
herbie shell --seed 2024101
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))