
(FPCore (J l K U) :precision binary64 (+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))
double code(double J, double l, double K, double U) {
return ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = ((j * (exp(l) - exp(-l))) * cos((k / 2.0d0))) + u
end function
public static double code(double J, double l, double K, double U) {
return ((J * (Math.exp(l) - Math.exp(-l))) * Math.cos((K / 2.0))) + U;
}
def code(J, l, K, U): return ((J * (math.exp(l) - math.exp(-l))) * math.cos((K / 2.0))) + U
function code(J, l, K, U) return Float64(Float64(Float64(J * Float64(exp(l) - exp(Float64(-l)))) * cos(Float64(K / 2.0))) + U) end
function tmp = code(J, l, K, U) tmp = ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U; end
code[J_, l_, K_, U_] := N[(N[(N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]
\begin{array}{l}
\\
\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 18 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (J l K U) :precision binary64 (+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))
double code(double J, double l, double K, double U) {
return ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = ((j * (exp(l) - exp(-l))) * cos((k / 2.0d0))) + u
end function
public static double code(double J, double l, double K, double U) {
return ((J * (Math.exp(l) - Math.exp(-l))) * Math.cos((K / 2.0))) + U;
}
def code(J, l, K, U): return ((J * (math.exp(l) - math.exp(-l))) * math.cos((K / 2.0))) + U
function code(J, l, K, U) return Float64(Float64(Float64(J * Float64(exp(l) - exp(Float64(-l)))) * cos(Float64(K / 2.0))) + U) end
function tmp = code(J, l, K, U) tmp = ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U; end
code[J_, l_, K_, U_] := N[(N[(N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]
\begin{array}{l}
\\
\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U
\end{array}
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))) (t_1 (- (exp l) (exp (- l)))))
(if (or (<= t_1 (- INFINITY)) (not (<= t_1 0.02)))
(+ (* (* t_1 J) t_0) U)
(+
U
(*
t_0
(*
J
(+
(* 0.016666666666666666 (pow l 5.0))
(+ (* 0.3333333333333333 (pow l 3.0)) (* l 2.0)))))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double t_1 = exp(l) - exp(-l);
double tmp;
if ((t_1 <= -((double) INFINITY)) || !(t_1 <= 0.02)) {
tmp = ((t_1 * J) * t_0) + U;
} else {
tmp = U + (t_0 * (J * ((0.016666666666666666 * pow(l, 5.0)) + ((0.3333333333333333 * pow(l, 3.0)) + (l * 2.0)))));
}
return tmp;
}
public static double code(double J, double l, double K, double U) {
double t_0 = Math.cos((K / 2.0));
double t_1 = Math.exp(l) - Math.exp(-l);
double tmp;
if ((t_1 <= -Double.POSITIVE_INFINITY) || !(t_1 <= 0.02)) {
tmp = ((t_1 * J) * t_0) + U;
} else {
tmp = U + (t_0 * (J * ((0.016666666666666666 * Math.pow(l, 5.0)) + ((0.3333333333333333 * Math.pow(l, 3.0)) + (l * 2.0)))));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K / 2.0)) t_1 = math.exp(l) - math.exp(-l) tmp = 0 if (t_1 <= -math.inf) or not (t_1 <= 0.02): tmp = ((t_1 * J) * t_0) + U else: tmp = U + (t_0 * (J * ((0.016666666666666666 * math.pow(l, 5.0)) + ((0.3333333333333333 * math.pow(l, 3.0)) + (l * 2.0))))) return tmp
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) t_1 = Float64(exp(l) - exp(Float64(-l))) tmp = 0.0 if ((t_1 <= Float64(-Inf)) || !(t_1 <= 0.02)) tmp = Float64(Float64(Float64(t_1 * J) * t_0) + U); else tmp = Float64(U + Float64(t_0 * Float64(J * Float64(Float64(0.016666666666666666 * (l ^ 5.0)) + Float64(Float64(0.3333333333333333 * (l ^ 3.0)) + Float64(l * 2.0)))))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = cos((K / 2.0)); t_1 = exp(l) - exp(-l); tmp = 0.0; if ((t_1 <= -Inf) || ~((t_1 <= 0.02))) tmp = ((t_1 * J) * t_0) + U; else tmp = U + (t_0 * (J * ((0.016666666666666666 * (l ^ 5.0)) + ((0.3333333333333333 * (l ^ 3.0)) + (l * 2.0))))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, (-Infinity)], N[Not[LessEqual[t$95$1, 0.02]], $MachinePrecision]], N[(N[(N[(t$95$1 * J), $MachinePrecision] * t$95$0), $MachinePrecision] + U), $MachinePrecision], N[(U + N[(t$95$0 * N[(J * N[(N[(0.016666666666666666 * N[Power[l, 5.0], $MachinePrecision]), $MachinePrecision] + N[(N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision] + N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
t_1 := e^{\ell} - e^{-\ell}\\
\mathbf{if}\;t_1 \leq -\infty \lor \neg \left(t_1 \leq 0.02\right):\\
\;\;\;\;\left(t_1 \cdot J\right) \cdot t_0 + U\\
\mathbf{else}:\\
\;\;\;\;U + t_0 \cdot \left(J \cdot \left(0.016666666666666666 \cdot {\ell}^{5} + \left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right)\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -inf.0 or 0.0200000000000000004 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 100.0%
if -inf.0 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 0.0200000000000000004Initial program 80.3%
Taylor expanded in l around 0 100.0%
Final simplification100.0%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))) (t_1 (- (exp l) (exp (- l)))))
(if (or (<= t_1 -0.002) (not (<= t_1 5e-6)))
(+ (* (* t_1 J) t_0) U)
(+ U (* t_0 (* J (+ (* 0.3333333333333333 (pow l 3.0)) (* l 2.0))))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double t_1 = exp(l) - exp(-l);
double tmp;
if ((t_1 <= -0.002) || !(t_1 <= 5e-6)) {
tmp = ((t_1 * J) * t_0) + U;
} else {
tmp = U + (t_0 * (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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = cos((k / 2.0d0))
t_1 = exp(l) - exp(-l)
if ((t_1 <= (-0.002d0)) .or. (.not. (t_1 <= 5d-6))) then
tmp = ((t_1 * j) * t_0) + u
else
tmp = u + (t_0 * (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 t_0 = Math.cos((K / 2.0));
double t_1 = Math.exp(l) - Math.exp(-l);
double tmp;
if ((t_1 <= -0.002) || !(t_1 <= 5e-6)) {
tmp = ((t_1 * J) * t_0) + U;
} else {
tmp = U + (t_0 * (J * ((0.3333333333333333 * Math.pow(l, 3.0)) + (l * 2.0))));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K / 2.0)) t_1 = math.exp(l) - math.exp(-l) tmp = 0 if (t_1 <= -0.002) or not (t_1 <= 5e-6): tmp = ((t_1 * J) * t_0) + U else: tmp = U + (t_0 * (J * ((0.3333333333333333 * math.pow(l, 3.0)) + (l * 2.0)))) return tmp
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) t_1 = Float64(exp(l) - exp(Float64(-l))) tmp = 0.0 if ((t_1 <= -0.002) || !(t_1 <= 5e-6)) tmp = Float64(Float64(Float64(t_1 * J) * t_0) + U); else tmp = Float64(U + Float64(t_0 * 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) t_0 = cos((K / 2.0)); t_1 = exp(l) - exp(-l); tmp = 0.0; if ((t_1 <= -0.002) || ~((t_1 <= 5e-6))) tmp = ((t_1 * J) * t_0) + U; else tmp = U + (t_0 * (J * ((0.3333333333333333 * (l ^ 3.0)) + (l * 2.0)))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -0.002], N[Not[LessEqual[t$95$1, 5e-6]], $MachinePrecision]], N[(N[(N[(t$95$1 * J), $MachinePrecision] * t$95$0), $MachinePrecision] + U), $MachinePrecision], N[(U + N[(t$95$0 * N[(J * N[(N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision] + N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
t_1 := e^{\ell} - e^{-\ell}\\
\mathbf{if}\;t_1 \leq -0.002 \lor \neg \left(t_1 \leq 5 \cdot 10^{-6}\right):\\
\;\;\;\;\left(t_1 \cdot J\right) \cdot t_0 + U\\
\mathbf{else}:\\
\;\;\;\;U + t_0 \cdot \left(J \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -2e-3 or 5.00000000000000041e-6 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 99.8%
if -2e-3 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 5.00000000000000041e-6Initial program 79.7%
Taylor expanded in l around 0 100.0%
Final simplification99.9%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))) (t_1 (+ U (* l (* 2.0 (* J (cos (* K 0.5))))))))
(if (<= t_0 -0.64)
t_1
(if (<= t_0 -0.45)
(+ U (* l (* 2.0 (+ J (* -0.125 (* J (* K K)))))))
(if (<= t_0 0.04)
t_1
(+ U (* J (+ (* 0.3333333333333333 (pow l 3.0)) (* l 2.0)))))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double t_1 = U + (l * (2.0 * (J * cos((K * 0.5)))));
double tmp;
if (t_0 <= -0.64) {
tmp = t_1;
} else if (t_0 <= -0.45) {
tmp = U + (l * (2.0 * (J + (-0.125 * (J * (K * K))))));
} else if (t_0 <= 0.04) {
tmp = t_1;
} 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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = cos((k / 2.0d0))
t_1 = u + (l * (2.0d0 * (j * cos((k * 0.5d0)))))
if (t_0 <= (-0.64d0)) then
tmp = t_1
else if (t_0 <= (-0.45d0)) then
tmp = u + (l * (2.0d0 * (j + ((-0.125d0) * (j * (k * k))))))
else if (t_0 <= 0.04d0) then
tmp = t_1
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 t_0 = Math.cos((K / 2.0));
double t_1 = U + (l * (2.0 * (J * Math.cos((K * 0.5)))));
double tmp;
if (t_0 <= -0.64) {
tmp = t_1;
} else if (t_0 <= -0.45) {
tmp = U + (l * (2.0 * (J + (-0.125 * (J * (K * K))))));
} else if (t_0 <= 0.04) {
tmp = t_1;
} else {
tmp = U + (J * ((0.3333333333333333 * Math.pow(l, 3.0)) + (l * 2.0)));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K / 2.0)) t_1 = U + (l * (2.0 * (J * math.cos((K * 0.5))))) tmp = 0 if t_0 <= -0.64: tmp = t_1 elif t_0 <= -0.45: tmp = U + (l * (2.0 * (J + (-0.125 * (J * (K * K)))))) elif t_0 <= 0.04: tmp = t_1 else: tmp = U + (J * ((0.3333333333333333 * math.pow(l, 3.0)) + (l * 2.0))) return tmp
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) t_1 = Float64(U + Float64(l * Float64(2.0 * Float64(J * cos(Float64(K * 0.5)))))) tmp = 0.0 if (t_0 <= -0.64) tmp = t_1; elseif (t_0 <= -0.45) tmp = Float64(U + Float64(l * Float64(2.0 * Float64(J + Float64(-0.125 * Float64(J * Float64(K * K))))))); elseif (t_0 <= 0.04) tmp = t_1; 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) t_0 = cos((K / 2.0)); t_1 = U + (l * (2.0 * (J * cos((K * 0.5))))); tmp = 0.0; if (t_0 <= -0.64) tmp = t_1; elseif (t_0 <= -0.45) tmp = U + (l * (2.0 * (J + (-0.125 * (J * (K * K)))))); elseif (t_0 <= 0.04) tmp = t_1; else tmp = U + (J * ((0.3333333333333333 * (l ^ 3.0)) + (l * 2.0))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(U + N[(l * N[(2.0 * N[(J * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -0.64], t$95$1, If[LessEqual[t$95$0, -0.45], N[(U + N[(l * N[(2.0 * N[(J + N[(-0.125 * N[(J * N[(K * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 0.04], t$95$1, 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}
t_0 := \cos \left(\frac{K}{2}\right)\\
t_1 := U + \ell \cdot \left(2 \cdot \left(J \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\mathbf{if}\;t_0 \leq -0.64:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t_0 \leq -0.45:\\
\;\;\;\;U + \ell \cdot \left(2 \cdot \left(J + -0.125 \cdot \left(J \cdot \left(K \cdot K\right)\right)\right)\right)\\
\mathbf{elif}\;t_0 \leq 0.04:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K 2)) < -0.640000000000000013 or -0.450000000000000011 < (cos.f64 (/.f64 K 2)) < 0.0400000000000000008Initial program 86.8%
Taylor expanded in l around 0 68.3%
associate-*r*68.3%
*-commutative68.3%
associate-*l*68.4%
*-commutative68.4%
associate-*l*68.4%
Simplified68.4%
if -0.640000000000000013 < (cos.f64 (/.f64 K 2)) < -0.450000000000000011Initial program 98.3%
Taylor expanded in l around 0 35.5%
associate-*r*35.5%
*-commutative35.5%
associate-*l*35.5%
*-commutative35.5%
associate-*l*35.5%
Simplified35.5%
Taylor expanded in K around 0 68.0%
unpow268.0%
Simplified68.0%
if 0.0400000000000000008 < (cos.f64 (/.f64 K 2)) Initial program 91.1%
Taylor expanded in K around 0 90.8%
Taylor expanded in l around 0 82.1%
Final simplification79.0%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))) (t_1 (+ U (* l (* 2.0 (* J (cos (* K 0.5))))))))
(if (<= t_0 -0.64)
t_1
(if (<= t_0 -0.45)
(+ U (* l (* 2.0 (+ J (* -0.125 (* J (* K K)))))))
(if (<= t_0 0.04)
t_1
(fma (* l J) (+ 2.0 (* 0.3333333333333333 (* l l))) U))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double t_1 = U + (l * (2.0 * (J * cos((K * 0.5)))));
double tmp;
if (t_0 <= -0.64) {
tmp = t_1;
} else if (t_0 <= -0.45) {
tmp = U + (l * (2.0 * (J + (-0.125 * (J * (K * K))))));
} else if (t_0 <= 0.04) {
tmp = t_1;
} else {
tmp = fma((l * J), (2.0 + (0.3333333333333333 * (l * l))), U);
}
return tmp;
}
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) t_1 = Float64(U + Float64(l * Float64(2.0 * Float64(J * cos(Float64(K * 0.5)))))) tmp = 0.0 if (t_0 <= -0.64) tmp = t_1; elseif (t_0 <= -0.45) tmp = Float64(U + Float64(l * Float64(2.0 * Float64(J + Float64(-0.125 * Float64(J * Float64(K * K))))))); elseif (t_0 <= 0.04) tmp = t_1; else tmp = fma(Float64(l * J), Float64(2.0 + Float64(0.3333333333333333 * Float64(l * l))), U); end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(U + N[(l * N[(2.0 * N[(J * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -0.64], t$95$1, If[LessEqual[t$95$0, -0.45], N[(U + N[(l * N[(2.0 * N[(J + N[(-0.125 * N[(J * N[(K * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 0.04], t$95$1, N[(N[(l * J), $MachinePrecision] * N[(2.0 + N[(0.3333333333333333 * N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
t_1 := U + \ell \cdot \left(2 \cdot \left(J \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\mathbf{if}\;t_0 \leq -0.64:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t_0 \leq -0.45:\\
\;\;\;\;U + \ell \cdot \left(2 \cdot \left(J + -0.125 \cdot \left(J \cdot \left(K \cdot K\right)\right)\right)\right)\\
\mathbf{elif}\;t_0 \leq 0.04:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\ell \cdot J, 2 + 0.3333333333333333 \cdot \left(\ell \cdot \ell\right), U\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K 2)) < -0.640000000000000013 or -0.450000000000000011 < (cos.f64 (/.f64 K 2)) < 0.0400000000000000008Initial program 86.8%
Taylor expanded in l around 0 68.3%
associate-*r*68.3%
*-commutative68.3%
associate-*l*68.4%
*-commutative68.4%
associate-*l*68.4%
Simplified68.4%
if -0.640000000000000013 < (cos.f64 (/.f64 K 2)) < -0.450000000000000011Initial program 98.3%
Taylor expanded in l around 0 35.5%
associate-*r*35.5%
*-commutative35.5%
associate-*l*35.5%
*-commutative35.5%
associate-*l*35.5%
Simplified35.5%
Taylor expanded in K around 0 68.0%
unpow268.0%
Simplified68.0%
if 0.0400000000000000008 < (cos.f64 (/.f64 K 2)) Initial program 91.1%
Taylor expanded in K around 0 90.8%
Taylor expanded in l around 0 82.1%
+-commutative82.1%
remove-double-neg82.1%
unsub-neg82.1%
*-commutative82.1%
cube-mult82.1%
associate-*r*75.5%
associate-*l*75.5%
*-commutative75.5%
distribute-lft-out75.5%
fma-neg75.5%
+-commutative75.5%
remove-double-neg75.5%
Simplified75.5%
Final simplification73.9%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (- (exp l) (exp (- l))))
(t_1 (cos (/ K 2.0)))
(t_2 (+ U (* t_1 (* (pow l 5.0) (* J 0.016666666666666666))))))
(if (<= l -2.15e+79)
t_2
(if (<= l -64.0)
(+ U (* t_0 (+ J (* J (* -0.125 (* K K))))))
(if (<= l 0.00166)
(+ U (* t_1 (* J (+ (* 0.3333333333333333 (pow l 3.0)) (* l 2.0)))))
(if (<= l 8e+53) (+ (* t_0 J) U) t_2))))))
double code(double J, double l, double K, double U) {
double t_0 = exp(l) - exp(-l);
double t_1 = cos((K / 2.0));
double t_2 = U + (t_1 * (pow(l, 5.0) * (J * 0.016666666666666666)));
double tmp;
if (l <= -2.15e+79) {
tmp = t_2;
} else if (l <= -64.0) {
tmp = U + (t_0 * (J + (J * (-0.125 * (K * K)))));
} else if (l <= 0.00166) {
tmp = U + (t_1 * (J * ((0.3333333333333333 * pow(l, 3.0)) + (l * 2.0))));
} else if (l <= 8e+53) {
tmp = (t_0 * J) + U;
} else {
tmp = t_2;
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = exp(l) - exp(-l)
t_1 = cos((k / 2.0d0))
t_2 = u + (t_1 * ((l ** 5.0d0) * (j * 0.016666666666666666d0)))
if (l <= (-2.15d+79)) then
tmp = t_2
else if (l <= (-64.0d0)) then
tmp = u + (t_0 * (j + (j * ((-0.125d0) * (k * k)))))
else if (l <= 0.00166d0) then
tmp = u + (t_1 * (j * ((0.3333333333333333d0 * (l ** 3.0d0)) + (l * 2.0d0))))
else if (l <= 8d+53) then
tmp = (t_0 * j) + u
else
tmp = t_2
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = Math.exp(l) - Math.exp(-l);
double t_1 = Math.cos((K / 2.0));
double t_2 = U + (t_1 * (Math.pow(l, 5.0) * (J * 0.016666666666666666)));
double tmp;
if (l <= -2.15e+79) {
tmp = t_2;
} else if (l <= -64.0) {
tmp = U + (t_0 * (J + (J * (-0.125 * (K * K)))));
} else if (l <= 0.00166) {
tmp = U + (t_1 * (J * ((0.3333333333333333 * Math.pow(l, 3.0)) + (l * 2.0))));
} else if (l <= 8e+53) {
tmp = (t_0 * J) + U;
} else {
tmp = t_2;
}
return tmp;
}
def code(J, l, K, U): t_0 = math.exp(l) - math.exp(-l) t_1 = math.cos((K / 2.0)) t_2 = U + (t_1 * (math.pow(l, 5.0) * (J * 0.016666666666666666))) tmp = 0 if l <= -2.15e+79: tmp = t_2 elif l <= -64.0: tmp = U + (t_0 * (J + (J * (-0.125 * (K * K))))) elif l <= 0.00166: tmp = U + (t_1 * (J * ((0.3333333333333333 * math.pow(l, 3.0)) + (l * 2.0)))) elif l <= 8e+53: tmp = (t_0 * J) + U else: tmp = t_2 return tmp
function code(J, l, K, U) t_0 = Float64(exp(l) - exp(Float64(-l))) t_1 = cos(Float64(K / 2.0)) t_2 = Float64(U + Float64(t_1 * Float64((l ^ 5.0) * Float64(J * 0.016666666666666666)))) tmp = 0.0 if (l <= -2.15e+79) tmp = t_2; elseif (l <= -64.0) tmp = Float64(U + Float64(t_0 * Float64(J + Float64(J * Float64(-0.125 * Float64(K * K)))))); elseif (l <= 0.00166) tmp = Float64(U + Float64(t_1 * Float64(J * Float64(Float64(0.3333333333333333 * (l ^ 3.0)) + Float64(l * 2.0))))); elseif (l <= 8e+53) tmp = Float64(Float64(t_0 * J) + U); else tmp = t_2; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = exp(l) - exp(-l); t_1 = cos((K / 2.0)); t_2 = U + (t_1 * ((l ^ 5.0) * (J * 0.016666666666666666))); tmp = 0.0; if (l <= -2.15e+79) tmp = t_2; elseif (l <= -64.0) tmp = U + (t_0 * (J + (J * (-0.125 * (K * K))))); elseif (l <= 0.00166) tmp = U + (t_1 * (J * ((0.3333333333333333 * (l ^ 3.0)) + (l * 2.0)))); elseif (l <= 8e+53) tmp = (t_0 * J) + U; else tmp = t_2; 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 / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(U + N[(t$95$1 * N[(N[Power[l, 5.0], $MachinePrecision] * N[(J * 0.016666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -2.15e+79], t$95$2, If[LessEqual[l, -64.0], N[(U + N[(t$95$0 * N[(J + N[(J * N[(-0.125 * N[(K * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 0.00166], N[(U + N[(t$95$1 * N[(J * N[(N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision] + N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 8e+53], N[(N[(t$95$0 * J), $MachinePrecision] + U), $MachinePrecision], t$95$2]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{\ell} - e^{-\ell}\\
t_1 := \cos \left(\frac{K}{2}\right)\\
t_2 := U + t_1 \cdot \left({\ell}^{5} \cdot \left(J \cdot 0.016666666666666666\right)\right)\\
\mathbf{if}\;\ell \leq -2.15 \cdot 10^{+79}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\ell \leq -64:\\
\;\;\;\;U + t_0 \cdot \left(J + J \cdot \left(-0.125 \cdot \left(K \cdot K\right)\right)\right)\\
\mathbf{elif}\;\ell \leq 0.00166:\\
\;\;\;\;U + t_1 \cdot \left(J \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right)\right)\\
\mathbf{elif}\;\ell \leq 8 \cdot 10^{+53}:\\
\;\;\;\;t_0 \cdot J + U\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if l < -2.1500000000000002e79 or 7.9999999999999999e53 < l Initial program 100.0%
Taylor expanded in l around 0 100.0%
Taylor expanded in l around inf 100.0%
associate-*r*100.0%
Simplified100.0%
if -2.1500000000000002e79 < l < -64Initial program 100.0%
Taylor expanded in K around 0 0.0%
+-commutative0.0%
associate-*r*0.0%
associate-*r*0.0%
distribute-rgt-out93.8%
associate-*r*93.8%
*-commutative93.8%
associate-*l*93.8%
unpow293.8%
Simplified93.8%
if -64 < l < 0.00166Initial program 80.1%
Taylor expanded in l around 0 99.8%
if 0.00166 < l < 7.9999999999999999e53Initial program 99.0%
Taylor expanded in K around 0 87.3%
Final simplification98.7%
(FPCore (J l K U)
:precision binary64
(let* ((t_0
(+ U (* (cos (/ K 2.0)) (* (pow l 5.0) (* J 0.016666666666666666)))))
(t_1 (+ (* (- (exp l) (exp (- l))) J) U)))
(if (<= l -4.6e+33)
t_0
(if (<= l -0.00086)
t_1
(if (<= l 4.2e-5)
(+ U (* l (* 2.0 (* J (cos (* K 0.5))))))
(if (<= l 8e+53) t_1 t_0))))))
double code(double J, double l, double K, double U) {
double t_0 = U + (cos((K / 2.0)) * (pow(l, 5.0) * (J * 0.016666666666666666)));
double t_1 = ((exp(l) - exp(-l)) * J) + U;
double tmp;
if (l <= -4.6e+33) {
tmp = t_0;
} else if (l <= -0.00086) {
tmp = t_1;
} else if (l <= 4.2e-5) {
tmp = U + (l * (2.0 * (J * cos((K * 0.5)))));
} else if (l <= 8e+53) {
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)) * ((l ** 5.0d0) * (j * 0.016666666666666666d0)))
t_1 = ((exp(l) - exp(-l)) * j) + u
if (l <= (-4.6d+33)) then
tmp = t_0
else if (l <= (-0.00086d0)) then
tmp = t_1
else if (l <= 4.2d-5) then
tmp = u + (l * (2.0d0 * (j * cos((k * 0.5d0)))))
else if (l <= 8d+53) 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)) * (Math.pow(l, 5.0) * (J * 0.016666666666666666)));
double t_1 = ((Math.exp(l) - Math.exp(-l)) * J) + U;
double tmp;
if (l <= -4.6e+33) {
tmp = t_0;
} else if (l <= -0.00086) {
tmp = t_1;
} else if (l <= 4.2e-5) {
tmp = U + (l * (2.0 * (J * Math.cos((K * 0.5)))));
} else if (l <= 8e+53) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(J, l, K, U): t_0 = U + (math.cos((K / 2.0)) * (math.pow(l, 5.0) * (J * 0.016666666666666666))) t_1 = ((math.exp(l) - math.exp(-l)) * J) + U tmp = 0 if l <= -4.6e+33: tmp = t_0 elif l <= -0.00086: tmp = t_1 elif l <= 4.2e-5: tmp = U + (l * (2.0 * (J * math.cos((K * 0.5))))) elif l <= 8e+53: 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((l ^ 5.0) * Float64(J * 0.016666666666666666)))) t_1 = Float64(Float64(Float64(exp(l) - exp(Float64(-l))) * J) + U) tmp = 0.0 if (l <= -4.6e+33) tmp = t_0; elseif (l <= -0.00086) tmp = t_1; elseif (l <= 4.2e-5) tmp = Float64(U + Float64(l * Float64(2.0 * Float64(J * cos(Float64(K * 0.5)))))); elseif (l <= 8e+53) 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)) * ((l ^ 5.0) * (J * 0.016666666666666666))); t_1 = ((exp(l) - exp(-l)) * J) + U; tmp = 0.0; if (l <= -4.6e+33) tmp = t_0; elseif (l <= -0.00086) tmp = t_1; elseif (l <= 4.2e-5) tmp = U + (l * (2.0 * (J * cos((K * 0.5))))); elseif (l <= 8e+53) 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[(N[Power[l, 5.0], $MachinePrecision] * N[(J * 0.016666666666666666), $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, -4.6e+33], t$95$0, If[LessEqual[l, -0.00086], t$95$1, If[LessEqual[l, 4.2e-5], N[(U + N[(l * N[(2.0 * N[(J * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 8e+53], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + \cos \left(\frac{K}{2}\right) \cdot \left({\ell}^{5} \cdot \left(J \cdot 0.016666666666666666\right)\right)\\
t_1 := \left(e^{\ell} - e^{-\ell}\right) \cdot J + U\\
\mathbf{if}\;\ell \leq -4.6 \cdot 10^{+33}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq -0.00086:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\ell \leq 4.2 \cdot 10^{-5}:\\
\;\;\;\;U + \ell \cdot \left(2 \cdot \left(J \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\mathbf{elif}\;\ell \leq 8 \cdot 10^{+53}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if l < -4.60000000000000021e33 or 7.9999999999999999e53 < l Initial program 100.0%
Taylor expanded in l around 0 97.4%
Taylor expanded in l around inf 97.4%
associate-*r*97.4%
Simplified97.4%
if -4.60000000000000021e33 < l < -8.59999999999999979e-4 or 4.19999999999999977e-5 < l < 7.9999999999999999e53Initial program 99.0%
Taylor expanded in K around 0 81.2%
if -8.59999999999999979e-4 < l < 4.19999999999999977e-5Initial program 79.7%
Taylor expanded in l around 0 99.5%
associate-*r*99.5%
*-commutative99.5%
associate-*l*99.5%
*-commutative99.5%
associate-*l*99.5%
Simplified99.5%
Final simplification96.6%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0)))
(t_1 (+ U (* t_0 (* (pow l 5.0) (* J 0.016666666666666666))))))
(if (<= l -1260000.0)
t_1
(if (<= l 0.0027)
(+ U (* t_0 (* J (+ (* 0.3333333333333333 (pow l 3.0)) (* l 2.0)))))
(if (<= l 8e+53) (+ (* (- (exp l) (exp (- l))) J) U) t_1)))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double t_1 = U + (t_0 * (pow(l, 5.0) * (J * 0.016666666666666666)));
double tmp;
if (l <= -1260000.0) {
tmp = t_1;
} else if (l <= 0.0027) {
tmp = U + (t_0 * (J * ((0.3333333333333333 * pow(l, 3.0)) + (l * 2.0))));
} else if (l <= 8e+53) {
tmp = ((exp(l) - exp(-l)) * J) + U;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = cos((k / 2.0d0))
t_1 = u + (t_0 * ((l ** 5.0d0) * (j * 0.016666666666666666d0)))
if (l <= (-1260000.0d0)) then
tmp = t_1
else if (l <= 0.0027d0) then
tmp = u + (t_0 * (j * ((0.3333333333333333d0 * (l ** 3.0d0)) + (l * 2.0d0))))
else if (l <= 8d+53) then
tmp = ((exp(l) - exp(-l)) * j) + u
else
tmp = t_1
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = Math.cos((K / 2.0));
double t_1 = U + (t_0 * (Math.pow(l, 5.0) * (J * 0.016666666666666666)));
double tmp;
if (l <= -1260000.0) {
tmp = t_1;
} else if (l <= 0.0027) {
tmp = U + (t_0 * (J * ((0.3333333333333333 * Math.pow(l, 3.0)) + (l * 2.0))));
} else if (l <= 8e+53) {
tmp = ((Math.exp(l) - Math.exp(-l)) * J) + U;
} else {
tmp = t_1;
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K / 2.0)) t_1 = U + (t_0 * (math.pow(l, 5.0) * (J * 0.016666666666666666))) tmp = 0 if l <= -1260000.0: tmp = t_1 elif l <= 0.0027: tmp = U + (t_0 * (J * ((0.3333333333333333 * math.pow(l, 3.0)) + (l * 2.0)))) elif l <= 8e+53: tmp = ((math.exp(l) - math.exp(-l)) * J) + U else: tmp = t_1 return tmp
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) t_1 = Float64(U + Float64(t_0 * Float64((l ^ 5.0) * Float64(J * 0.016666666666666666)))) tmp = 0.0 if (l <= -1260000.0) tmp = t_1; elseif (l <= 0.0027) tmp = Float64(U + Float64(t_0 * Float64(J * Float64(Float64(0.3333333333333333 * (l ^ 3.0)) + Float64(l * 2.0))))); elseif (l <= 8e+53) tmp = Float64(Float64(Float64(exp(l) - exp(Float64(-l))) * J) + U); else tmp = t_1; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = cos((K / 2.0)); t_1 = U + (t_0 * ((l ^ 5.0) * (J * 0.016666666666666666))); tmp = 0.0; if (l <= -1260000.0) tmp = t_1; elseif (l <= 0.0027) tmp = U + (t_0 * (J * ((0.3333333333333333 * (l ^ 3.0)) + (l * 2.0)))); elseif (l <= 8e+53) tmp = ((exp(l) - exp(-l)) * J) + U; else tmp = t_1; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(U + N[(t$95$0 * N[(N[Power[l, 5.0], $MachinePrecision] * N[(J * 0.016666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -1260000.0], t$95$1, If[LessEqual[l, 0.0027], N[(U + N[(t$95$0 * N[(J * N[(N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision] + N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 8e+53], N[(N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision] + U), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
t_1 := U + t_0 \cdot \left({\ell}^{5} \cdot \left(J \cdot 0.016666666666666666\right)\right)\\
\mathbf{if}\;\ell \leq -1260000:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\ell \leq 0.0027:\\
\;\;\;\;U + t_0 \cdot \left(J \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right)\right)\\
\mathbf{elif}\;\ell \leq 8 \cdot 10^{+53}:\\
\;\;\;\;\left(e^{\ell} - e^{-\ell}\right) \cdot J + U\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if l < -1.26e6 or 7.9999999999999999e53 < l Initial program 100.0%
Taylor expanded in l around 0 92.8%
Taylor expanded in l around inf 92.8%
associate-*r*92.8%
Simplified92.8%
if -1.26e6 < l < 0.0027000000000000001Initial program 80.2%
Taylor expanded in l around 0 99.0%
if 0.0027000000000000001 < l < 7.9999999999999999e53Initial program 99.0%
Taylor expanded in K around 0 87.3%
Final simplification95.3%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (+ (* (- (exp l) (exp (- l))) J) U)))
(if (<= l -0.000155)
t_0
(if (<= l 0.002)
(+ U (* l (* 2.0 (* J (cos (* K 0.5))))))
(if (<= l 5e+93)
t_0
(+
U
(*
(* J (pow l 5.0))
(+ 0.016666666666666666 (* (* K K) -0.0020833333333333333)))))))))
double code(double J, double l, double K, double U) {
double t_0 = ((exp(l) - exp(-l)) * J) + U;
double tmp;
if (l <= -0.000155) {
tmp = t_0;
} else if (l <= 0.002) {
tmp = U + (l * (2.0 * (J * cos((K * 0.5)))));
} else if (l <= 5e+93) {
tmp = t_0;
} else {
tmp = U + ((J * pow(l, 5.0)) * (0.016666666666666666 + ((K * K) * -0.0020833333333333333)));
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: t_0
real(8) :: tmp
t_0 = ((exp(l) - exp(-l)) * j) + u
if (l <= (-0.000155d0)) then
tmp = t_0
else if (l <= 0.002d0) then
tmp = u + (l * (2.0d0 * (j * cos((k * 0.5d0)))))
else if (l <= 5d+93) then
tmp = t_0
else
tmp = u + ((j * (l ** 5.0d0)) * (0.016666666666666666d0 + ((k * k) * (-0.0020833333333333333d0))))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = ((Math.exp(l) - Math.exp(-l)) * J) + U;
double tmp;
if (l <= -0.000155) {
tmp = t_0;
} else if (l <= 0.002) {
tmp = U + (l * (2.0 * (J * Math.cos((K * 0.5)))));
} else if (l <= 5e+93) {
tmp = t_0;
} else {
tmp = U + ((J * Math.pow(l, 5.0)) * (0.016666666666666666 + ((K * K) * -0.0020833333333333333)));
}
return tmp;
}
def code(J, l, K, U): t_0 = ((math.exp(l) - math.exp(-l)) * J) + U tmp = 0 if l <= -0.000155: tmp = t_0 elif l <= 0.002: tmp = U + (l * (2.0 * (J * math.cos((K * 0.5))))) elif l <= 5e+93: tmp = t_0 else: tmp = U + ((J * math.pow(l, 5.0)) * (0.016666666666666666 + ((K * K) * -0.0020833333333333333))) return tmp
function code(J, l, K, U) t_0 = Float64(Float64(Float64(exp(l) - exp(Float64(-l))) * J) + U) tmp = 0.0 if (l <= -0.000155) tmp = t_0; elseif (l <= 0.002) tmp = Float64(U + Float64(l * Float64(2.0 * Float64(J * cos(Float64(K * 0.5)))))); elseif (l <= 5e+93) tmp = t_0; else tmp = Float64(U + Float64(Float64(J * (l ^ 5.0)) * Float64(0.016666666666666666 + Float64(Float64(K * K) * -0.0020833333333333333)))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = ((exp(l) - exp(-l)) * J) + U; tmp = 0.0; if (l <= -0.000155) tmp = t_0; elseif (l <= 0.002) tmp = U + (l * (2.0 * (J * cos((K * 0.5))))); elseif (l <= 5e+93) tmp = t_0; else tmp = U + ((J * (l ^ 5.0)) * (0.016666666666666666 + ((K * K) * -0.0020833333333333333))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision] + U), $MachinePrecision]}, If[LessEqual[l, -0.000155], t$95$0, If[LessEqual[l, 0.002], N[(U + N[(l * N[(2.0 * N[(J * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 5e+93], t$95$0, N[(U + N[(N[(J * N[Power[l, 5.0], $MachinePrecision]), $MachinePrecision] * N[(0.016666666666666666 + N[(N[(K * K), $MachinePrecision] * -0.0020833333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(e^{\ell} - e^{-\ell}\right) \cdot J + U\\
\mathbf{if}\;\ell \leq -0.000155:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq 0.002:\\
\;\;\;\;U + \ell \cdot \left(2 \cdot \left(J \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\mathbf{elif}\;\ell \leq 5 \cdot 10^{+93}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;U + \left(J \cdot {\ell}^{5}\right) \cdot \left(0.016666666666666666 + \left(K \cdot K\right) \cdot -0.0020833333333333333\right)\\
\end{array}
\end{array}
if l < -1.55e-4 or 2e-3 < l < 5.0000000000000001e93Initial program 99.7%
Taylor expanded in K around 0 84.3%
if -1.55e-4 < l < 2e-3Initial program 79.7%
Taylor expanded in l around 0 99.5%
associate-*r*99.5%
*-commutative99.5%
associate-*l*99.5%
*-commutative99.5%
associate-*l*99.5%
Simplified99.5%
if 5.0000000000000001e93 < l Initial program 100.0%
Taylor expanded in l around 0 100.0%
Taylor expanded in l around inf 100.0%
associate-*r*100.0%
Simplified100.0%
Taylor expanded in K around 0 0.0%
+-commutative0.0%
*-commutative0.0%
*-commutative0.0%
*-commutative0.0%
associate-*r*0.0%
associate-*l*0.0%
distribute-lft-out82.0%
unpow282.0%
Simplified82.0%
Final simplification90.7%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (* (- (exp l) (exp (- l))) J)))
(if (<= l -1850000000000.0)
t_0
(if (<= l 230.0)
(+ U (* l (* 2.0 (* J (cos (* K 0.5))))))
(if (<= l 5e+93)
t_0
(+
U
(*
(* J (pow l 5.0))
(+ 0.016666666666666666 (* (* K K) -0.0020833333333333333)))))))))
double code(double J, double l, double K, double U) {
double t_0 = (exp(l) - exp(-l)) * J;
double tmp;
if (l <= -1850000000000.0) {
tmp = t_0;
} else if (l <= 230.0) {
tmp = U + (l * (2.0 * (J * cos((K * 0.5)))));
} else if (l <= 5e+93) {
tmp = t_0;
} else {
tmp = U + ((J * pow(l, 5.0)) * (0.016666666666666666 + ((K * K) * -0.0020833333333333333)));
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: t_0
real(8) :: tmp
t_0 = (exp(l) - exp(-l)) * j
if (l <= (-1850000000000.0d0)) then
tmp = t_0
else if (l <= 230.0d0) then
tmp = u + (l * (2.0d0 * (j * cos((k * 0.5d0)))))
else if (l <= 5d+93) then
tmp = t_0
else
tmp = u + ((j * (l ** 5.0d0)) * (0.016666666666666666d0 + ((k * k) * (-0.0020833333333333333d0))))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = (Math.exp(l) - Math.exp(-l)) * J;
double tmp;
if (l <= -1850000000000.0) {
tmp = t_0;
} else if (l <= 230.0) {
tmp = U + (l * (2.0 * (J * Math.cos((K * 0.5)))));
} else if (l <= 5e+93) {
tmp = t_0;
} else {
tmp = U + ((J * Math.pow(l, 5.0)) * (0.016666666666666666 + ((K * K) * -0.0020833333333333333)));
}
return tmp;
}
def code(J, l, K, U): t_0 = (math.exp(l) - math.exp(-l)) * J tmp = 0 if l <= -1850000000000.0: tmp = t_0 elif l <= 230.0: tmp = U + (l * (2.0 * (J * math.cos((K * 0.5))))) elif l <= 5e+93: tmp = t_0 else: tmp = U + ((J * math.pow(l, 5.0)) * (0.016666666666666666 + ((K * K) * -0.0020833333333333333))) return tmp
function code(J, l, K, U) t_0 = Float64(Float64(exp(l) - exp(Float64(-l))) * J) tmp = 0.0 if (l <= -1850000000000.0) tmp = t_0; elseif (l <= 230.0) tmp = Float64(U + Float64(l * Float64(2.0 * Float64(J * cos(Float64(K * 0.5)))))); elseif (l <= 5e+93) tmp = t_0; else tmp = Float64(U + Float64(Float64(J * (l ^ 5.0)) * Float64(0.016666666666666666 + Float64(Float64(K * K) * -0.0020833333333333333)))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = (exp(l) - exp(-l)) * J; tmp = 0.0; if (l <= -1850000000000.0) tmp = t_0; elseif (l <= 230.0) tmp = U + (l * (2.0 * (J * cos((K * 0.5))))); elseif (l <= 5e+93) tmp = t_0; else tmp = U + ((J * (l ^ 5.0)) * (0.016666666666666666 + ((K * K) * -0.0020833333333333333))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision]}, If[LessEqual[l, -1850000000000.0], t$95$0, If[LessEqual[l, 230.0], N[(U + N[(l * N[(2.0 * N[(J * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 5e+93], t$95$0, N[(U + N[(N[(J * N[Power[l, 5.0], $MachinePrecision]), $MachinePrecision] * N[(0.016666666666666666 + N[(N[(K * K), $MachinePrecision] * -0.0020833333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(e^{\ell} - e^{-\ell}\right) \cdot J\\
\mathbf{if}\;\ell \leq -1850000000000:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq 230:\\
\;\;\;\;U + \ell \cdot \left(2 \cdot \left(J \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\mathbf{elif}\;\ell \leq 5 \cdot 10^{+93}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;U + \left(J \cdot {\ell}^{5}\right) \cdot \left(0.016666666666666666 + \left(K \cdot K\right) \cdot -0.0020833333333333333\right)\\
\end{array}
\end{array}
if l < -1.85e12 or 230 < l < 5.0000000000000001e93Initial program 100.0%
Taylor expanded in K around 0 85.7%
Taylor expanded in J around inf 85.7%
if -1.85e12 < l < 230Initial program 80.6%
Taylor expanded in l around 0 96.7%
associate-*r*96.7%
*-commutative96.7%
associate-*l*96.7%
*-commutative96.7%
associate-*l*96.7%
Simplified96.7%
if 5.0000000000000001e93 < l Initial program 100.0%
Taylor expanded in l around 0 100.0%
Taylor expanded in l around inf 100.0%
associate-*r*100.0%
Simplified100.0%
Taylor expanded in K around 0 0.0%
+-commutative0.0%
*-commutative0.0%
*-commutative0.0%
*-commutative0.0%
associate-*r*0.0%
associate-*l*0.0%
distribute-lft-out82.0%
unpow282.0%
Simplified82.0%
Final simplification90.2%
(FPCore (J l K U)
:precision binary64
(if (<= l -8e+125)
(+ U (* J (+ (* 0.3333333333333333 (pow l 3.0)) (* l 2.0))))
(if (or (<= l -450.0) (not (<= l 1650000000000.0)))
(+
U
(*
(* J (pow l 5.0))
(+ 0.016666666666666666 (* (* K K) -0.0020833333333333333))))
(+ U (* l (* 2.0 (* J (cos (* K 0.5)))))))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -8e+125) {
tmp = U + (J * ((0.3333333333333333 * pow(l, 3.0)) + (l * 2.0)));
} else if ((l <= -450.0) || !(l <= 1650000000000.0)) {
tmp = U + ((J * pow(l, 5.0)) * (0.016666666666666666 + ((K * K) * -0.0020833333333333333)));
} else {
tmp = U + (l * (2.0 * (J * cos((K * 0.5)))));
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if (l <= (-8d+125)) then
tmp = u + (j * ((0.3333333333333333d0 * (l ** 3.0d0)) + (l * 2.0d0)))
else if ((l <= (-450.0d0)) .or. (.not. (l <= 1650000000000.0d0))) then
tmp = u + ((j * (l ** 5.0d0)) * (0.016666666666666666d0 + ((k * k) * (-0.0020833333333333333d0))))
else
tmp = u + (l * (2.0d0 * (j * cos((k * 0.5d0)))))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (l <= -8e+125) {
tmp = U + (J * ((0.3333333333333333 * Math.pow(l, 3.0)) + (l * 2.0)));
} else if ((l <= -450.0) || !(l <= 1650000000000.0)) {
tmp = U + ((J * Math.pow(l, 5.0)) * (0.016666666666666666 + ((K * K) * -0.0020833333333333333)));
} else {
tmp = U + (l * (2.0 * (J * Math.cos((K * 0.5)))));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -8e+125: tmp = U + (J * ((0.3333333333333333 * math.pow(l, 3.0)) + (l * 2.0))) elif (l <= -450.0) or not (l <= 1650000000000.0): tmp = U + ((J * math.pow(l, 5.0)) * (0.016666666666666666 + ((K * K) * -0.0020833333333333333))) else: tmp = U + (l * (2.0 * (J * math.cos((K * 0.5))))) return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -8e+125) tmp = Float64(U + Float64(J * Float64(Float64(0.3333333333333333 * (l ^ 3.0)) + Float64(l * 2.0)))); elseif ((l <= -450.0) || !(l <= 1650000000000.0)) tmp = Float64(U + Float64(Float64(J * (l ^ 5.0)) * Float64(0.016666666666666666 + Float64(Float64(K * K) * -0.0020833333333333333)))); else tmp = Float64(U + Float64(l * Float64(2.0 * Float64(J * cos(Float64(K * 0.5)))))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -8e+125) tmp = U + (J * ((0.3333333333333333 * (l ^ 3.0)) + (l * 2.0))); elseif ((l <= -450.0) || ~((l <= 1650000000000.0))) tmp = U + ((J * (l ^ 5.0)) * (0.016666666666666666 + ((K * K) * -0.0020833333333333333))); else tmp = U + (l * (2.0 * (J * cos((K * 0.5))))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -8e+125], N[(U + N[(J * N[(N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision] + N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[l, -450.0], N[Not[LessEqual[l, 1650000000000.0]], $MachinePrecision]], N[(U + N[(N[(J * N[Power[l, 5.0], $MachinePrecision]), $MachinePrecision] * N[(0.016666666666666666 + N[(N[(K * K), $MachinePrecision] * -0.0020833333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(l * N[(2.0 * N[(J * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -8 \cdot 10^{+125}:\\
\;\;\;\;U + J \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right)\\
\mathbf{elif}\;\ell \leq -450 \lor \neg \left(\ell \leq 1650000000000\right):\\
\;\;\;\;U + \left(J \cdot {\ell}^{5}\right) \cdot \left(0.016666666666666666 + \left(K \cdot K\right) \cdot -0.0020833333333333333\right)\\
\mathbf{else}:\\
\;\;\;\;U + \ell \cdot \left(2 \cdot \left(J \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\end{array}
\end{array}
if l < -7.9999999999999994e125Initial program 100.0%
Taylor expanded in K around 0 91.2%
Taylor expanded in l around 0 91.2%
if -7.9999999999999994e125 < l < -450 or 1.65e12 < l Initial program 100.0%
Taylor expanded in l around 0 82.2%
Taylor expanded in l around inf 82.2%
associate-*r*82.2%
Simplified82.2%
Taylor expanded in K around 0 6.7%
+-commutative6.7%
*-commutative6.7%
*-commutative6.7%
*-commutative6.7%
associate-*r*4.6%
associate-*l*4.6%
distribute-lft-out68.5%
unpow268.5%
Simplified68.5%
if -450 < l < 1.65e12Initial program 81.1%
Taylor expanded in l around 0 94.5%
associate-*r*94.5%
*-commutative94.5%
associate-*l*94.5%
*-commutative94.5%
associate-*l*94.5%
Simplified94.5%
Final simplification84.2%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.05) (+ U (* l (* 2.0 (+ J (* -0.125 (* J (* K K))))))) (+ U (* l (* J 2.0)))))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.05) {
tmp = U + (l * (2.0 * (J + (-0.125 * (J * (K * K))))));
} 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 (cos((k / 2.0d0)) <= (-0.05d0)) then
tmp = u + (l * (2.0d0 * (j + ((-0.125d0) * (j * (k * k))))))
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 (Math.cos((K / 2.0)) <= -0.05) {
tmp = U + (l * (2.0 * (J + (-0.125 * (J * (K * K))))));
} else {
tmp = U + (l * (J * 2.0));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if math.cos((K / 2.0)) <= -0.05: tmp = U + (l * (2.0 * (J + (-0.125 * (J * (K * K)))))) else: tmp = U + (l * (J * 2.0)) return tmp
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.05) tmp = Float64(U + Float64(l * Float64(2.0 * Float64(J + Float64(-0.125 * Float64(J * Float64(K * K))))))); 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 (cos((K / 2.0)) <= -0.05) tmp = U + (l * (2.0 * (J + (-0.125 * (J * (K * K)))))); else tmp = U + (l * (J * 2.0)); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.05], N[(U + N[(l * N[(2.0 * N[(J + N[(-0.125 * N[(J * N[(K * K), $MachinePrecision]), $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}\;\cos \left(\frac{K}{2}\right) \leq -0.05:\\
\;\;\;\;U + \ell \cdot \left(2 \cdot \left(J + -0.125 \cdot \left(J \cdot \left(K \cdot K\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + \ell \cdot \left(J \cdot 2\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K 2)) < -0.050000000000000003Initial program 90.6%
Taylor expanded in l around 0 59.4%
associate-*r*59.4%
*-commutative59.4%
associate-*l*59.5%
*-commutative59.5%
associate-*l*59.5%
Simplified59.5%
Taylor expanded in K around 0 50.7%
unpow250.7%
Simplified50.7%
if -0.050000000000000003 < (cos.f64 (/.f64 K 2)) Initial program 90.8%
Taylor expanded in l around 0 61.2%
associate-*r*61.2%
*-commutative61.2%
associate-*l*61.2%
*-commutative61.2%
associate-*l*61.2%
Simplified61.2%
Taylor expanded in K around 0 57.9%
Final simplification56.4%
(FPCore (J l K U) :precision binary64 (+ U (* 2.0 (* J (* l (cos (* K 0.5)))))))
double code(double J, double l, double K, double U) {
return U + (2.0 * (J * (l * cos((K * 0.5)))));
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = u + (2.0d0 * (j * (l * cos((k * 0.5d0)))))
end function
public static double code(double J, double l, double K, double U) {
return U + (2.0 * (J * (l * Math.cos((K * 0.5)))));
}
def code(J, l, K, U): return U + (2.0 * (J * (l * math.cos((K * 0.5)))))
function code(J, l, K, U) return Float64(U + Float64(2.0 * Float64(J * Float64(l * cos(Float64(K * 0.5)))))) end
function tmp = code(J, l, K, U) tmp = U + (2.0 * (J * (l * cos((K * 0.5))))); end
code[J_, l_, K_, U_] := N[(U + N[(2.0 * N[(J * N[(l * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + 2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(K \cdot 0.5\right)\right)\right)
\end{array}
Initial program 90.8%
Taylor expanded in l around 0 60.8%
Final simplification60.8%
(FPCore (J l K U) :precision binary64 (+ U (* l (* 2.0 (* J (cos (* K 0.5)))))))
double code(double J, double l, double K, double U) {
return U + (l * (2.0 * (J * cos((K * 0.5)))));
}
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 * (2.0d0 * (j * cos((k * 0.5d0)))))
end function
public static double code(double J, double l, double K, double U) {
return U + (l * (2.0 * (J * Math.cos((K * 0.5)))));
}
def code(J, l, K, U): return U + (l * (2.0 * (J * math.cos((K * 0.5)))))
function code(J, l, K, U) return Float64(U + Float64(l * Float64(2.0 * Float64(J * cos(Float64(K * 0.5)))))) end
function tmp = code(J, l, K, U) tmp = U + (l * (2.0 * (J * cos((K * 0.5))))); end
code[J_, l_, K_, U_] := N[(U + N[(l * N[(2.0 * N[(J * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + \ell \cdot \left(2 \cdot \left(J \cdot \cos \left(K \cdot 0.5\right)\right)\right)
\end{array}
Initial program 90.8%
Taylor expanded in l around 0 60.8%
associate-*r*60.8%
*-commutative60.8%
associate-*l*60.8%
*-commutative60.8%
associate-*l*60.8%
Simplified60.8%
Final simplification60.8%
(FPCore (J l K U) :precision binary64 (if (or (<= l -2.05e+17) (not (<= l 0.00166))) (* J (* l 2.0)) U))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -2.05e+17) || !(l <= 0.00166)) {
tmp = J * (l * 2.0);
} 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 <= (-2.05d+17)) .or. (.not. (l <= 0.00166d0))) then
tmp = j * (l * 2.0d0)
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 <= -2.05e+17) || !(l <= 0.00166)) {
tmp = J * (l * 2.0);
} else {
tmp = U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -2.05e+17) or not (l <= 0.00166): tmp = J * (l * 2.0) else: tmp = U return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -2.05e+17) || !(l <= 0.00166)) tmp = Float64(J * Float64(l * 2.0)); else tmp = U; end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -2.05e+17) || ~((l <= 0.00166))) tmp = J * (l * 2.0); else tmp = U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -2.05e+17], N[Not[LessEqual[l, 0.00166]], $MachinePrecision]], N[(J * N[(l * 2.0), $MachinePrecision]), $MachinePrecision], U]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2.05 \cdot 10^{+17} \lor \neg \left(\ell \leq 0.00166\right):\\
\;\;\;\;J \cdot \left(\ell \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\end{array}
if l < -2.05e17 or 0.00166 < l Initial program 99.9%
Taylor expanded in l around 0 28.8%
associate-*r*28.8%
*-commutative28.8%
associate-*l*28.8%
*-commutative28.8%
associate-*l*28.8%
Simplified28.8%
Taylor expanded in K around 0 24.7%
Taylor expanded in l around inf 24.5%
*-commutative24.5%
associate-*l*24.5%
Simplified24.5%
if -2.05e17 < l < 0.00166Initial program 80.7%
Taylor expanded in J around 0 75.4%
Final simplification48.8%
(FPCore (J l K U) :precision binary64 (if (<= l -2.5e+64) (* U U) (if (<= l 1.65e+38) U (* U U))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -2.5e+64) {
tmp = U * U;
} else if (l <= 1.65e+38) {
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 <= (-2.5d+64)) then
tmp = u * u
else if (l <= 1.65d+38) 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 <= -2.5e+64) {
tmp = U * U;
} else if (l <= 1.65e+38) {
tmp = U;
} else {
tmp = U * U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -2.5e+64: tmp = U * U elif l <= 1.65e+38: tmp = U else: tmp = U * U return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -2.5e+64) tmp = Float64(U * U); elseif (l <= 1.65e+38) tmp = U; else tmp = Float64(U * U); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -2.5e+64) tmp = U * U; elseif (l <= 1.65e+38) tmp = U; else tmp = U * U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -2.5e+64], N[(U * U), $MachinePrecision], If[LessEqual[l, 1.65e+38], U, N[(U * U), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2.5 \cdot 10^{+64}:\\
\;\;\;\;U \cdot U\\
\mathbf{elif}\;\ell \leq 1.65 \cdot 10^{+38}:\\
\;\;\;\;U\\
\mathbf{else}:\\
\;\;\;\;U \cdot U\\
\end{array}
\end{array}
if l < -2.5e64 or 1.65e38 < l Initial program 100.0%
Applied egg-rr19.8%
if -2.5e64 < l < 1.65e38Initial program 83.7%
Taylor expanded in J around 0 63.9%
Final simplification44.8%
(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 90.8%
Taylor expanded in l around 0 60.8%
associate-*r*60.8%
*-commutative60.8%
associate-*l*60.8%
*-commutative60.8%
associate-*l*60.8%
Simplified60.8%
Taylor expanded in K around 0 53.8%
Final simplification53.8%
(FPCore (J l K U) :precision binary64 1.0)
double code(double J, double l, double K, double U) {
return 1.0;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = 1.0d0
end function
public static double code(double J, double l, double K, double U) {
return 1.0;
}
def code(J, l, K, U): return 1.0
function code(J, l, K, U) return 1.0 end
function tmp = code(J, l, K, U) tmp = 1.0; end
code[J_, l_, K_, U_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 90.8%
Applied egg-rr2.6%
*-inverses2.6%
Simplified2.6%
Final simplification2.6%
(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 90.8%
Taylor expanded in J around 0 37.0%
Final simplification37.0%
herbie shell --seed 2023274
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))