
(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 2.0))))
(if (<= t_0 -400.0)
(+ (* t_1 (* t_0 J)) U)
(if (<= t_0 5e-6)
(+ U (* t_1 (* J (+ (* 0.3333333333333333 (pow l 3.0)) (* l 2.0)))))
(fma t_0 (* J t_1) U)))))
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 tmp;
if (t_0 <= -400.0) {
tmp = (t_1 * (t_0 * J)) + U;
} else if (t_0 <= 5e-6) {
tmp = U + (t_1 * (J * ((0.3333333333333333 * pow(l, 3.0)) + (l * 2.0))));
} else {
tmp = fma(t_0, (J * t_1), U);
}
return tmp;
}
function code(J, l, K, U) t_0 = Float64(exp(l) - exp(Float64(-l))) t_1 = cos(Float64(K / 2.0)) tmp = 0.0 if (t_0 <= -400.0) tmp = Float64(Float64(t_1 * Float64(t_0 * J)) + U); elseif (t_0 <= 5e-6) tmp = Float64(U + Float64(t_1 * Float64(J * Float64(Float64(0.3333333333333333 * (l ^ 3.0)) + Float64(l * 2.0))))); else tmp = fma(t_0, Float64(J * t_1), U); end return 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]}, If[LessEqual[t$95$0, -400.0], N[(N[(t$95$1 * N[(t$95$0 * J), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], If[LessEqual[t$95$0, 5e-6], 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], N[(t$95$0 * N[(J * t$95$1), $MachinePrecision] + U), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{\ell} - e^{-\ell}\\
t_1 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;t_0 \leq -400:\\
\;\;\;\;t_1 \cdot \left(t_0 \cdot J\right) + U\\
\mathbf{elif}\;t_0 \leq 5 \cdot 10^{-6}:\\
\;\;\;\;U + t_1 \cdot \left(J \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t_0, J \cdot t_1, U\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -400Initial program 100.0%
if -400 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 5.00000000000000041e-6Initial program 69.6%
Taylor expanded in l around 0 99.9%
if 5.00000000000000041e-6 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 99.9%
*-commutative99.9%
associate-*l*100.0%
fma-def100.0%
Simplified100.0%
Final simplification99.9%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))) (t_1 (- (exp l) (exp (- l)))))
(if (or (<= t_1 -400.0) (not (<= t_1 5e-6)))
(+ (* t_0 (* t_1 J)) 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 <= -400.0) || !(t_1 <= 5e-6)) {
tmp = (t_0 * (t_1 * J)) + 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 <= (-400.0d0)) .or. (.not. (t_1 <= 5d-6))) then
tmp = (t_0 * (t_1 * j)) + 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 <= -400.0) || !(t_1 <= 5e-6)) {
tmp = (t_0 * (t_1 * J)) + 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 <= -400.0) or not (t_1 <= 5e-6): tmp = (t_0 * (t_1 * J)) + 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 <= -400.0) || !(t_1 <= 5e-6)) tmp = Float64(Float64(t_0 * Float64(t_1 * J)) + 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 <= -400.0) || ~((t_1 <= 5e-6))) tmp = (t_0 * (t_1 * J)) + 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, -400.0], N[Not[LessEqual[t$95$1, 5e-6]], $MachinePrecision]], N[(N[(t$95$0 * N[(t$95$1 * J), $MachinePrecision]), $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 -400 \lor \neg \left(t_1 \leq 5 \cdot 10^{-6}\right):\\
\;\;\;\;t_0 \cdot \left(t_1 \cdot J\right) + 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))) < -400 or 5.00000000000000041e-6 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 100.0%
if -400 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 5.00000000000000041e-6Initial program 69.6%
Taylor expanded in l around 0 99.9%
Final simplification99.9%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))) (t_1 (+ U (* 2.0 (* l (* J (cos (* K 0.5))))))))
(if (<= t_0 -0.95)
t_1
(if (<= t_0 -0.35)
(+ U (* J (* l (fma -0.25 (* K K) 2.0))))
(if (<= t_0 0.05)
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 + (2.0 * (l * (J * cos((K * 0.5)))));
double tmp;
if (t_0 <= -0.95) {
tmp = t_1;
} else if (t_0 <= -0.35) {
tmp = U + (J * (l * fma(-0.25, (K * K), 2.0)));
} else if (t_0 <= 0.05) {
tmp = t_1;
} else {
tmp = U + (J * ((0.3333333333333333 * 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(2.0 * Float64(l * Float64(J * cos(Float64(K * 0.5)))))) tmp = 0.0 if (t_0 <= -0.95) tmp = t_1; elseif (t_0 <= -0.35) tmp = Float64(U + Float64(J * Float64(l * fma(-0.25, Float64(K * K), 2.0)))); elseif (t_0 <= 0.05) tmp = t_1; else tmp = Float64(U + Float64(J * Float64(Float64(0.3333333333333333 * (l ^ 3.0)) + Float64(l * 2.0)))); 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[(2.0 * N[(l * N[(J * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -0.95], t$95$1, If[LessEqual[t$95$0, -0.35], N[(U + N[(J * N[(l * N[(-0.25 * N[(K * K), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 0.05], 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 + 2 \cdot \left(\ell \cdot \left(J \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\mathbf{if}\;t_0 \leq -0.95:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t_0 \leq -0.35:\\
\;\;\;\;U + J \cdot \left(\ell \cdot \mathsf{fma}\left(-0.25, K \cdot K, 2\right)\right)\\
\mathbf{elif}\;t_0 \leq 0.05:\\
\;\;\;\;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.94999999999999996 or -0.34999999999999998 < (cos.f64 (/.f64 K 2)) < 0.050000000000000003Initial program 83.2%
Taylor expanded in l around 0 77.1%
*-commutative77.1%
associate-*l*77.2%
*-commutative77.2%
Simplified77.2%
if -0.94999999999999996 < (cos.f64 (/.f64 K 2)) < -0.34999999999999998Initial program 90.6%
Taylor expanded in l around 0 50.1%
associate-*r*50.1%
*-commutative50.1%
associate-*l*50.1%
Simplified50.1%
Taylor expanded in K around 0 44.0%
+-commutative44.0%
associate-*r*44.0%
distribute-rgt-out64.0%
*-commutative64.0%
unpow264.0%
Simplified64.0%
Taylor expanded in l around 0 64.1%
associate-*r*68.8%
*-commutative68.8%
fma-def68.8%
unpow268.8%
Simplified68.8%
if 0.050000000000000003 < (cos.f64 (/.f64 K 2)) Initial program 82.8%
Taylor expanded in K around 0 82.3%
Taylor expanded in l around 0 88.2%
Final simplification83.2%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= t_0 -0.95)
(+ U (fabs (* l (* J 2.0))))
(if (<= t_0 -0.04)
(+ U (* (* l J) (* (* K K) -0.25)))
(+ U (* 0.3333333333333333 (* J (pow l 3.0))))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double tmp;
if (t_0 <= -0.95) {
tmp = U + fabs((l * (J * 2.0)));
} else if (t_0 <= -0.04) {
tmp = U + ((l * J) * ((K * K) * -0.25));
} else {
tmp = U + (0.3333333333333333 * (J * 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) :: t_0
real(8) :: tmp
t_0 = cos((k / 2.0d0))
if (t_0 <= (-0.95d0)) then
tmp = u + abs((l * (j * 2.0d0)))
else if (t_0 <= (-0.04d0)) then
tmp = u + ((l * j) * ((k * k) * (-0.25d0)))
else
tmp = u + (0.3333333333333333d0 * (j * (l ** 3.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 (t_0 <= -0.95) {
tmp = U + Math.abs((l * (J * 2.0)));
} else if (t_0 <= -0.04) {
tmp = U + ((l * J) * ((K * K) * -0.25));
} else {
tmp = U + (0.3333333333333333 * (J * Math.pow(l, 3.0)));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K / 2.0)) tmp = 0 if t_0 <= -0.95: tmp = U + math.fabs((l * (J * 2.0))) elif t_0 <= -0.04: tmp = U + ((l * J) * ((K * K) * -0.25)) else: tmp = U + (0.3333333333333333 * (J * math.pow(l, 3.0))) return tmp
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) tmp = 0.0 if (t_0 <= -0.95) tmp = Float64(U + abs(Float64(l * Float64(J * 2.0)))); elseif (t_0 <= -0.04) tmp = Float64(U + Float64(Float64(l * J) * Float64(Float64(K * K) * -0.25))); else tmp = Float64(U + Float64(0.3333333333333333 * Float64(J * (l ^ 3.0)))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = cos((K / 2.0)); tmp = 0.0; if (t_0 <= -0.95) tmp = U + abs((l * (J * 2.0))); elseif (t_0 <= -0.04) tmp = U + ((l * J) * ((K * K) * -0.25)); else tmp = U + (0.3333333333333333 * (J * (l ^ 3.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[t$95$0, -0.95], N[(U + N[Abs[N[(l * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, -0.04], N[(U + N[(N[(l * J), $MachinePrecision] * N[(N[(K * K), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(0.3333333333333333 * N[(J * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;t_0 \leq -0.95:\\
\;\;\;\;U + \left|\ell \cdot \left(J \cdot 2\right)\right|\\
\mathbf{elif}\;t_0 \leq -0.04:\\
\;\;\;\;U + \left(\ell \cdot J\right) \cdot \left(\left(K \cdot K\right) \cdot -0.25\right)\\
\mathbf{else}:\\
\;\;\;\;U + 0.3333333333333333 \cdot \left(J \cdot {\ell}^{3}\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K 2)) < -0.94999999999999996Initial program 90.2%
Taylor expanded in l around 0 76.1%
associate-*r*76.1%
*-commutative76.1%
associate-*l*76.1%
Simplified76.1%
Taylor expanded in K around 0 65.2%
add-sqr-sqrt50.1%
sqrt-unprod75.3%
*-commutative75.3%
*-commutative75.3%
swap-sqr75.3%
pow275.3%
metadata-eval75.3%
Applied egg-rr75.3%
unpow275.3%
metadata-eval75.3%
swap-sqr75.3%
associate-*r*75.3%
associate-*r*75.3%
rem-sqrt-square65.8%
Simplified65.8%
if -0.94999999999999996 < (cos.f64 (/.f64 K 2)) < -0.0400000000000000008Initial program 90.1%
Taylor expanded in l around 0 59.9%
associate-*r*59.9%
*-commutative59.9%
associate-*l*59.9%
Simplified59.9%
Taylor expanded in K around 0 38.2%
+-commutative38.2%
associate-*r*38.2%
distribute-rgt-out61.0%
*-commutative61.0%
unpow261.0%
Simplified61.0%
Taylor expanded in K around inf 61.0%
associate-*r*61.0%
*-commutative61.0%
unpow261.0%
Simplified61.0%
if -0.0400000000000000008 < (cos.f64 (/.f64 K 2)) Initial program 81.5%
Taylor expanded in l around 0 90.4%
Taylor expanded in l around inf 71.8%
associate-*r*71.8%
*-commutative71.8%
associate-*l*71.8%
Simplified71.8%
Taylor expanded in K around 0 71.2%
Final simplification68.5%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0)))
(t_1 (+ U (* t_0 (* (pow l 3.0) (* J 0.3333333333333333)))))
(t_2
(+ U (* (+ (* -0.125 (* K K)) 1.0) (* (- (exp l) (exp (- l))) J)))))
(if (<= l -1.56e+91)
t_1
(if (<= l -2.4)
t_2
(if (<= l 170000.0)
(+ U (* t_0 (* J (+ (* 0.3333333333333333 (pow l 3.0)) (* l 2.0)))))
(if (<= l 4.6e+86) t_2 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, 3.0) * (J * 0.3333333333333333)));
double t_2 = U + (((-0.125 * (K * K)) + 1.0) * ((exp(l) - exp(-l)) * J));
double tmp;
if (l <= -1.56e+91) {
tmp = t_1;
} else if (l <= -2.4) {
tmp = t_2;
} else if (l <= 170000.0) {
tmp = U + (t_0 * (J * ((0.3333333333333333 * pow(l, 3.0)) + (l * 2.0))));
} else if (l <= 4.6e+86) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = cos((k / 2.0d0))
t_1 = u + (t_0 * ((l ** 3.0d0) * (j * 0.3333333333333333d0)))
t_2 = u + ((((-0.125d0) * (k * k)) + 1.0d0) * ((exp(l) - exp(-l)) * j))
if (l <= (-1.56d+91)) then
tmp = t_1
else if (l <= (-2.4d0)) then
tmp = t_2
else if (l <= 170000.0d0) then
tmp = u + (t_0 * (j * ((0.3333333333333333d0 * (l ** 3.0d0)) + (l * 2.0d0))))
else if (l <= 4.6d+86) then
tmp = t_2
else
tmp = t_1
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = Math.cos((K / 2.0));
double t_1 = U + (t_0 * (Math.pow(l, 3.0) * (J * 0.3333333333333333)));
double t_2 = U + (((-0.125 * (K * K)) + 1.0) * ((Math.exp(l) - Math.exp(-l)) * J));
double tmp;
if (l <= -1.56e+91) {
tmp = t_1;
} else if (l <= -2.4) {
tmp = t_2;
} else if (l <= 170000.0) {
tmp = U + (t_0 * (J * ((0.3333333333333333 * Math.pow(l, 3.0)) + (l * 2.0))));
} else if (l <= 4.6e+86) {
tmp = t_2;
} 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, 3.0) * (J * 0.3333333333333333))) t_2 = U + (((-0.125 * (K * K)) + 1.0) * ((math.exp(l) - math.exp(-l)) * J)) tmp = 0 if l <= -1.56e+91: tmp = t_1 elif l <= -2.4: tmp = t_2 elif l <= 170000.0: tmp = U + (t_0 * (J * ((0.3333333333333333 * math.pow(l, 3.0)) + (l * 2.0)))) elif l <= 4.6e+86: tmp = t_2 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 ^ 3.0) * Float64(J * 0.3333333333333333)))) t_2 = Float64(U + Float64(Float64(Float64(-0.125 * Float64(K * K)) + 1.0) * Float64(Float64(exp(l) - exp(Float64(-l))) * J))) tmp = 0.0 if (l <= -1.56e+91) tmp = t_1; elseif (l <= -2.4) tmp = t_2; elseif (l <= 170000.0) tmp = Float64(U + Float64(t_0 * Float64(J * Float64(Float64(0.3333333333333333 * (l ^ 3.0)) + Float64(l * 2.0))))); elseif (l <= 4.6e+86) tmp = t_2; 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 ^ 3.0) * (J * 0.3333333333333333))); t_2 = U + (((-0.125 * (K * K)) + 1.0) * ((exp(l) - exp(-l)) * J)); tmp = 0.0; if (l <= -1.56e+91) tmp = t_1; elseif (l <= -2.4) tmp = t_2; elseif (l <= 170000.0) tmp = U + (t_0 * (J * ((0.3333333333333333 * (l ^ 3.0)) + (l * 2.0)))); elseif (l <= 4.6e+86) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(U + N[(t$95$0 * N[(N[Power[l, 3.0], $MachinePrecision] * N[(J * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(U + N[(N[(N[(-0.125 * N[(K * K), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -1.56e+91], t$95$1, If[LessEqual[l, -2.4], t$95$2, If[LessEqual[l, 170000.0], 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, 4.6e+86], t$95$2, 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}^{3} \cdot \left(J \cdot 0.3333333333333333\right)\right)\\
t_2 := U + \left(-0.125 \cdot \left(K \cdot K\right) + 1\right) \cdot \left(\left(e^{\ell} - e^{-\ell}\right) \cdot J\right)\\
\mathbf{if}\;\ell \leq -1.56 \cdot 10^{+91}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\ell \leq -2.4:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\ell \leq 170000:\\
\;\;\;\;U + t_0 \cdot \left(J \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right)\right)\\
\mathbf{elif}\;\ell \leq 4.6 \cdot 10^{+86}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if l < -1.5600000000000001e91 or 4.59999999999999979e86 < 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-*l*98.9%
Simplified98.9%
if -1.5600000000000001e91 < l < -2.39999999999999991 or 1.7e5 < l < 4.59999999999999979e86Initial program 100.0%
Taylor expanded in K around 0 3.8%
associate-*r*3.8%
distribute-rgt1-in92.3%
unpow292.3%
Simplified92.3%
if -2.39999999999999991 < l < 1.7e5Initial program 70.3%
Taylor expanded in l around 0 98.1%
Final simplification97.8%
(FPCore (J l K U)
:precision binary64
(let* ((t_0
(+ U (* (cos (/ K 2.0)) (* (pow l 3.0) (* J 0.3333333333333333)))))
(t_1 (+ U (* (- (exp l) (exp (- l))) J))))
(if (<= l -1.28e+112)
t_0
(if (<= l -0.0044)
t_1
(if (<= l 0.25)
(+ U (* 2.0 (* l (* J (cos (* K 0.5))))))
(if (<= l 2.5e+86) t_1 t_0))))))
double code(double J, double l, double K, double U) {
double t_0 = U + (cos((K / 2.0)) * (pow(l, 3.0) * (J * 0.3333333333333333)));
double t_1 = U + ((exp(l) - exp(-l)) * J);
double tmp;
if (l <= -1.28e+112) {
tmp = t_0;
} else if (l <= -0.0044) {
tmp = t_1;
} else if (l <= 0.25) {
tmp = U + (2.0 * (l * (J * cos((K * 0.5)))));
} else if (l <= 2.5e+86) {
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 ** 3.0d0) * (j * 0.3333333333333333d0)))
t_1 = u + ((exp(l) - exp(-l)) * j)
if (l <= (-1.28d+112)) then
tmp = t_0
else if (l <= (-0.0044d0)) then
tmp = t_1
else if (l <= 0.25d0) then
tmp = u + (2.0d0 * (l * (j * cos((k * 0.5d0)))))
else if (l <= 2.5d+86) 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, 3.0) * (J * 0.3333333333333333)));
double t_1 = U + ((Math.exp(l) - Math.exp(-l)) * J);
double tmp;
if (l <= -1.28e+112) {
tmp = t_0;
} else if (l <= -0.0044) {
tmp = t_1;
} else if (l <= 0.25) {
tmp = U + (2.0 * (l * (J * Math.cos((K * 0.5)))));
} else if (l <= 2.5e+86) {
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, 3.0) * (J * 0.3333333333333333))) t_1 = U + ((math.exp(l) - math.exp(-l)) * J) tmp = 0 if l <= -1.28e+112: tmp = t_0 elif l <= -0.0044: tmp = t_1 elif l <= 0.25: tmp = U + (2.0 * (l * (J * math.cos((K * 0.5))))) elif l <= 2.5e+86: 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 ^ 3.0) * Float64(J * 0.3333333333333333)))) t_1 = Float64(U + Float64(Float64(exp(l) - exp(Float64(-l))) * J)) tmp = 0.0 if (l <= -1.28e+112) tmp = t_0; elseif (l <= -0.0044) tmp = t_1; elseif (l <= 0.25) tmp = Float64(U + Float64(2.0 * Float64(l * Float64(J * cos(Float64(K * 0.5)))))); elseif (l <= 2.5e+86) 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 ^ 3.0) * (J * 0.3333333333333333))); t_1 = U + ((exp(l) - exp(-l)) * J); tmp = 0.0; if (l <= -1.28e+112) tmp = t_0; elseif (l <= -0.0044) tmp = t_1; elseif (l <= 0.25) tmp = U + (2.0 * (l * (J * cos((K * 0.5))))); elseif (l <= 2.5e+86) 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, 3.0], $MachinePrecision] * N[(J * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(U + N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -1.28e+112], t$95$0, If[LessEqual[l, -0.0044], t$95$1, If[LessEqual[l, 0.25], N[(U + N[(2.0 * N[(l * N[(J * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.5e+86], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + \cos \left(\frac{K}{2}\right) \cdot \left({\ell}^{3} \cdot \left(J \cdot 0.3333333333333333\right)\right)\\
t_1 := U + \left(e^{\ell} - e^{-\ell}\right) \cdot J\\
\mathbf{if}\;\ell \leq -1.28 \cdot 10^{+112}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq -0.0044:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\ell \leq 0.25:\\
\;\;\;\;U + 2 \cdot \left(\ell \cdot \left(J \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\mathbf{elif}\;\ell \leq 2.5 \cdot 10^{+86}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if l < -1.28e112 or 2.4999999999999999e86 < l Initial program 100.0%
Taylor expanded in l around 0 100.0%
Taylor expanded in l around inf 100.0%
associate-*r*100.0%
*-commutative100.0%
associate-*l*100.0%
Simplified100.0%
if -1.28e112 < l < -0.00440000000000000027 or 0.25 < l < 2.4999999999999999e86Initial program 100.0%
Taylor expanded in K around 0 74.0%
if -0.00440000000000000027 < l < 0.25Initial program 69.8%
Taylor expanded in l around 0 99.2%
*-commutative99.2%
associate-*l*99.3%
*-commutative99.3%
Simplified99.3%
Final simplification96.2%
(FPCore (J l K U)
:precision binary64
(let* ((t_0
(+
U
(*
(* J (pow l 3.0))
(+ 0.3333333333333333 (* (* K K) -0.041666666666666664)))))
(t_1 (+ U (* (- (exp l) (exp (- l))) J))))
(if (<= l -1.52e+112)
t_0
(if (<= l -0.0265)
t_1
(if (<= l 0.25)
(+ U (* 2.0 (* l (* J (cos (* K 0.5))))))
(if (<= l 5e+119) t_1 t_0))))))
double code(double J, double l, double K, double U) {
double t_0 = U + ((J * pow(l, 3.0)) * (0.3333333333333333 + ((K * K) * -0.041666666666666664)));
double t_1 = U + ((exp(l) - exp(-l)) * J);
double tmp;
if (l <= -1.52e+112) {
tmp = t_0;
} else if (l <= -0.0265) {
tmp = t_1;
} else if (l <= 0.25) {
tmp = U + (2.0 * (l * (J * cos((K * 0.5)))));
} else if (l <= 5e+119) {
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 + ((j * (l ** 3.0d0)) * (0.3333333333333333d0 + ((k * k) * (-0.041666666666666664d0))))
t_1 = u + ((exp(l) - exp(-l)) * j)
if (l <= (-1.52d+112)) then
tmp = t_0
else if (l <= (-0.0265d0)) then
tmp = t_1
else if (l <= 0.25d0) then
tmp = u + (2.0d0 * (l * (j * cos((k * 0.5d0)))))
else if (l <= 5d+119) 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 + ((J * Math.pow(l, 3.0)) * (0.3333333333333333 + ((K * K) * -0.041666666666666664)));
double t_1 = U + ((Math.exp(l) - Math.exp(-l)) * J);
double tmp;
if (l <= -1.52e+112) {
tmp = t_0;
} else if (l <= -0.0265) {
tmp = t_1;
} else if (l <= 0.25) {
tmp = U + (2.0 * (l * (J * Math.cos((K * 0.5)))));
} else if (l <= 5e+119) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(J, l, K, U): t_0 = U + ((J * math.pow(l, 3.0)) * (0.3333333333333333 + ((K * K) * -0.041666666666666664))) t_1 = U + ((math.exp(l) - math.exp(-l)) * J) tmp = 0 if l <= -1.52e+112: tmp = t_0 elif l <= -0.0265: tmp = t_1 elif l <= 0.25: tmp = U + (2.0 * (l * (J * math.cos((K * 0.5))))) elif l <= 5e+119: tmp = t_1 else: tmp = t_0 return tmp
function code(J, l, K, U) t_0 = Float64(U + Float64(Float64(J * (l ^ 3.0)) * Float64(0.3333333333333333 + Float64(Float64(K * K) * -0.041666666666666664)))) t_1 = Float64(U + Float64(Float64(exp(l) - exp(Float64(-l))) * J)) tmp = 0.0 if (l <= -1.52e+112) tmp = t_0; elseif (l <= -0.0265) tmp = t_1; elseif (l <= 0.25) tmp = Float64(U + Float64(2.0 * Float64(l * Float64(J * cos(Float64(K * 0.5)))))); elseif (l <= 5e+119) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = U + ((J * (l ^ 3.0)) * (0.3333333333333333 + ((K * K) * -0.041666666666666664))); t_1 = U + ((exp(l) - exp(-l)) * J); tmp = 0.0; if (l <= -1.52e+112) tmp = t_0; elseif (l <= -0.0265) tmp = t_1; elseif (l <= 0.25) tmp = U + (2.0 * (l * (J * cos((K * 0.5))))); elseif (l <= 5e+119) 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[(J * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision] * N[(0.3333333333333333 + N[(N[(K * K), $MachinePrecision] * -0.041666666666666664), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(U + N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -1.52e+112], t$95$0, If[LessEqual[l, -0.0265], t$95$1, If[LessEqual[l, 0.25], N[(U + N[(2.0 * N[(l * N[(J * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 5e+119], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + \left(J \cdot {\ell}^{3}\right) \cdot \left(0.3333333333333333 + \left(K \cdot K\right) \cdot -0.041666666666666664\right)\\
t_1 := U + \left(e^{\ell} - e^{-\ell}\right) \cdot J\\
\mathbf{if}\;\ell \leq -1.52 \cdot 10^{+112}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq -0.0265:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\ell \leq 0.25:\\
\;\;\;\;U + 2 \cdot \left(\ell \cdot \left(J \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\mathbf{elif}\;\ell \leq 5 \cdot 10^{+119}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if l < -1.5199999999999999e112 or 4.9999999999999999e119 < l Initial program 100.0%
Taylor expanded in l around 0 100.0%
Taylor expanded in l around inf 100.0%
associate-*r*100.0%
*-commutative100.0%
associate-*l*100.0%
Simplified100.0%
Taylor expanded in K around 0 0.0%
associate-*r*0.0%
distribute-rgt-out79.0%
unpow279.0%
Simplified79.0%
if -1.5199999999999999e112 < l < -0.0264999999999999993 or 0.25 < l < 4.9999999999999999e119Initial program 100.0%
Taylor expanded in K around 0 77.9%
if -0.0264999999999999993 < l < 0.25Initial program 69.8%
Taylor expanded in l around 0 99.2%
*-commutative99.2%
associate-*l*99.3%
*-commutative99.3%
Simplified99.3%
Final simplification89.6%
(FPCore (J l K U) :precision binary64 (+ U (* (cos (/ K 2.0)) (* J (+ (* 0.3333333333333333 (pow l 3.0)) (* l 2.0))))))
double code(double J, double l, double K, double U) {
return U + (cos((K / 2.0)) * (J * ((0.3333333333333333 * pow(l, 3.0)) + (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 + (cos((k / 2.0d0)) * (j * ((0.3333333333333333d0 * (l ** 3.0d0)) + (l * 2.0d0))))
end function
public static double code(double J, double l, double K, double U) {
return U + (Math.cos((K / 2.0)) * (J * ((0.3333333333333333 * Math.pow(l, 3.0)) + (l * 2.0))));
}
def code(J, l, K, U): return U + (math.cos((K / 2.0)) * (J * ((0.3333333333333333 * math.pow(l, 3.0)) + (l * 2.0))))
function code(J, l, K, U) return Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(J * Float64(Float64(0.3333333333333333 * (l ^ 3.0)) + Float64(l * 2.0))))) end
function tmp = code(J, l, K, U) tmp = U + (cos((K / 2.0)) * (J * ((0.3333333333333333 * (l ^ 3.0)) + (l * 2.0)))); end
code[J_, l_, K_, U_] := N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * 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}
\\
U + \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right)\right)
\end{array}
Initial program 84.1%
Taylor expanded in l around 0 90.5%
Final simplification90.5%
(FPCore (J l K U)
:precision binary64
(let* ((t_0
(+
U
(*
(* J (pow l 3.0))
(+ 0.3333333333333333 (* (* K K) -0.041666666666666664)))))
(t_1 (+ U (log1p (expm1 (* l (* J 2.0)))))))
(if (<= l -6.6e+68)
t_0
(if (<= l -60000000000.0)
t_1
(if (<= l 98.0)
(+ U (* 2.0 (* l (* J (cos (* K 0.5))))))
(if (<= l 8.5e+119) t_1 t_0))))))
double code(double J, double l, double K, double U) {
double t_0 = U + ((J * pow(l, 3.0)) * (0.3333333333333333 + ((K * K) * -0.041666666666666664)));
double t_1 = U + log1p(expm1((l * (J * 2.0))));
double tmp;
if (l <= -6.6e+68) {
tmp = t_0;
} else if (l <= -60000000000.0) {
tmp = t_1;
} else if (l <= 98.0) {
tmp = U + (2.0 * (l * (J * cos((K * 0.5)))));
} else if (l <= 8.5e+119) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
public static double code(double J, double l, double K, double U) {
double t_0 = U + ((J * Math.pow(l, 3.0)) * (0.3333333333333333 + ((K * K) * -0.041666666666666664)));
double t_1 = U + Math.log1p(Math.expm1((l * (J * 2.0))));
double tmp;
if (l <= -6.6e+68) {
tmp = t_0;
} else if (l <= -60000000000.0) {
tmp = t_1;
} else if (l <= 98.0) {
tmp = U + (2.0 * (l * (J * Math.cos((K * 0.5)))));
} else if (l <= 8.5e+119) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(J, l, K, U): t_0 = U + ((J * math.pow(l, 3.0)) * (0.3333333333333333 + ((K * K) * -0.041666666666666664))) t_1 = U + math.log1p(math.expm1((l * (J * 2.0)))) tmp = 0 if l <= -6.6e+68: tmp = t_0 elif l <= -60000000000.0: tmp = t_1 elif l <= 98.0: tmp = U + (2.0 * (l * (J * math.cos((K * 0.5))))) elif l <= 8.5e+119: tmp = t_1 else: tmp = t_0 return tmp
function code(J, l, K, U) t_0 = Float64(U + Float64(Float64(J * (l ^ 3.0)) * Float64(0.3333333333333333 + Float64(Float64(K * K) * -0.041666666666666664)))) t_1 = Float64(U + log1p(expm1(Float64(l * Float64(J * 2.0))))) tmp = 0.0 if (l <= -6.6e+68) tmp = t_0; elseif (l <= -60000000000.0) tmp = t_1; elseif (l <= 98.0) tmp = Float64(U + Float64(2.0 * Float64(l * Float64(J * cos(Float64(K * 0.5)))))); elseif (l <= 8.5e+119) tmp = t_1; else tmp = t_0; end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(U + N[(N[(J * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision] * N[(0.3333333333333333 + N[(N[(K * K), $MachinePrecision] * -0.041666666666666664), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(U + N[Log[1 + N[(Exp[N[(l * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -6.6e+68], t$95$0, If[LessEqual[l, -60000000000.0], t$95$1, If[LessEqual[l, 98.0], N[(U + N[(2.0 * N[(l * N[(J * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 8.5e+119], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + \left(J \cdot {\ell}^{3}\right) \cdot \left(0.3333333333333333 + \left(K \cdot K\right) \cdot -0.041666666666666664\right)\\
t_1 := U + \mathsf{log1p}\left(\mathsf{expm1}\left(\ell \cdot \left(J \cdot 2\right)\right)\right)\\
\mathbf{if}\;\ell \leq -6.6 \cdot 10^{+68}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq -60000000000:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\ell \leq 98:\\
\;\;\;\;U + 2 \cdot \left(\ell \cdot \left(J \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\mathbf{elif}\;\ell \leq 8.5 \cdot 10^{+119}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if l < -6.6000000000000001e68 or 8.49999999999999997e119 < l Initial program 100.0%
Taylor expanded in l around 0 92.0%
Taylor expanded in l around inf 92.0%
associate-*r*92.0%
*-commutative92.0%
associate-*l*92.0%
Simplified92.0%
Taylor expanded in K around 0 4.4%
associate-*r*4.4%
distribute-rgt-out76.0%
unpow276.0%
Simplified76.0%
if -6.6000000000000001e68 < l < -6e10 or 98 < l < 8.49999999999999997e119Initial program 99.9%
Taylor expanded in l around 0 12.3%
associate-*r*12.3%
*-commutative12.3%
associate-*l*12.3%
Simplified12.3%
Taylor expanded in K around 0 12.1%
log1p-expm1-u67.4%
*-commutative67.4%
associate-*l*67.4%
Applied egg-rr67.4%
if -6e10 < l < 98Initial program 70.3%
Taylor expanded in l around 0 97.9%
*-commutative97.9%
associate-*l*98.0%
*-commutative98.0%
Simplified98.0%
Final simplification87.0%
(FPCore (J l K U)
:precision binary64
(if (or (<= l -6.0) (not (<= l 170000.0)))
(+
U
(*
(* J (pow l 3.0))
(+ 0.3333333333333333 (* (* K K) -0.041666666666666664))))
(+ U (* 2.0 (* l (* J (cos (* K 0.5))))))))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -6.0) || !(l <= 170000.0)) {
tmp = U + ((J * pow(l, 3.0)) * (0.3333333333333333 + ((K * K) * -0.041666666666666664)));
} else {
tmp = U + (2.0 * (l * (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 <= (-6.0d0)) .or. (.not. (l <= 170000.0d0))) then
tmp = u + ((j * (l ** 3.0d0)) * (0.3333333333333333d0 + ((k * k) * (-0.041666666666666664d0))))
else
tmp = u + (2.0d0 * (l * (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 <= -6.0) || !(l <= 170000.0)) {
tmp = U + ((J * Math.pow(l, 3.0)) * (0.3333333333333333 + ((K * K) * -0.041666666666666664)));
} else {
tmp = U + (2.0 * (l * (J * Math.cos((K * 0.5)))));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -6.0) or not (l <= 170000.0): tmp = U + ((J * math.pow(l, 3.0)) * (0.3333333333333333 + ((K * K) * -0.041666666666666664))) else: tmp = U + (2.0 * (l * (J * math.cos((K * 0.5))))) return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -6.0) || !(l <= 170000.0)) tmp = Float64(U + Float64(Float64(J * (l ^ 3.0)) * Float64(0.3333333333333333 + Float64(Float64(K * K) * -0.041666666666666664)))); else tmp = Float64(U + Float64(2.0 * Float64(l * Float64(J * cos(Float64(K * 0.5)))))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -6.0) || ~((l <= 170000.0))) tmp = U + ((J * (l ^ 3.0)) * (0.3333333333333333 + ((K * K) * -0.041666666666666664))); else tmp = U + (2.0 * (l * (J * cos((K * 0.5))))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -6.0], N[Not[LessEqual[l, 170000.0]], $MachinePrecision]], N[(U + N[(N[(J * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision] * N[(0.3333333333333333 + N[(N[(K * K), $MachinePrecision] * -0.041666666666666664), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(2.0 * N[(l * N[(J * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -6 \lor \neg \left(\ell \leq 170000\right):\\
\;\;\;\;U + \left(J \cdot {\ell}^{3}\right) \cdot \left(0.3333333333333333 + \left(K \cdot K\right) \cdot -0.041666666666666664\right)\\
\mathbf{else}:\\
\;\;\;\;U + 2 \cdot \left(\ell \cdot \left(J \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\end{array}
\end{array}
if l < -6 or 1.7e5 < l Initial program 100.0%
Taylor expanded in l around 0 81.7%
Taylor expanded in l around inf 81.7%
associate-*r*81.7%
*-commutative81.7%
associate-*l*81.7%
Simplified81.7%
Taylor expanded in K around 0 5.0%
associate-*r*5.0%
distribute-rgt-out65.5%
unpow265.5%
Simplified65.5%
if -6 < l < 1.7e5Initial program 70.3%
Taylor expanded in l around 0 97.9%
*-commutative97.9%
associate-*l*97.9%
*-commutative97.9%
Simplified97.9%
Final simplification82.9%
(FPCore (J l K U) :precision binary64 (if (or (<= J -7.8e+56) (not (<= J 6.5e-31))) (+ U (* 2.0 (* l (* J (cos (* K 0.5)))))) (+ U (* 0.3333333333333333 (* J (pow l 3.0))))))
double code(double J, double l, double K, double U) {
double tmp;
if ((J <= -7.8e+56) || !(J <= 6.5e-31)) {
tmp = U + (2.0 * (l * (J * cos((K * 0.5)))));
} else {
tmp = U + (0.3333333333333333 * (J * 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 ((j <= (-7.8d+56)) .or. (.not. (j <= 6.5d-31))) then
tmp = u + (2.0d0 * (l * (j * cos((k * 0.5d0)))))
else
tmp = u + (0.3333333333333333d0 * (j * (l ** 3.0d0)))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if ((J <= -7.8e+56) || !(J <= 6.5e-31)) {
tmp = U + (2.0 * (l * (J * Math.cos((K * 0.5)))));
} else {
tmp = U + (0.3333333333333333 * (J * Math.pow(l, 3.0)));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (J <= -7.8e+56) or not (J <= 6.5e-31): tmp = U + (2.0 * (l * (J * math.cos((K * 0.5))))) else: tmp = U + (0.3333333333333333 * (J * math.pow(l, 3.0))) return tmp
function code(J, l, K, U) tmp = 0.0 if ((J <= -7.8e+56) || !(J <= 6.5e-31)) tmp = Float64(U + Float64(2.0 * Float64(l * Float64(J * cos(Float64(K * 0.5)))))); else tmp = Float64(U + Float64(0.3333333333333333 * Float64(J * (l ^ 3.0)))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((J <= -7.8e+56) || ~((J <= 6.5e-31))) tmp = U + (2.0 * (l * (J * cos((K * 0.5))))); else tmp = U + (0.3333333333333333 * (J * (l ^ 3.0))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[J, -7.8e+56], N[Not[LessEqual[J, 6.5e-31]], $MachinePrecision]], N[(U + N[(2.0 * N[(l * N[(J * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(0.3333333333333333 * N[(J * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;J \leq -7.8 \cdot 10^{+56} \lor \neg \left(J \leq 6.5 \cdot 10^{-31}\right):\\
\;\;\;\;U + 2 \cdot \left(\ell \cdot \left(J \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + 0.3333333333333333 \cdot \left(J \cdot {\ell}^{3}\right)\\
\end{array}
\end{array}
if J < -7.79999999999999989e56 or 6.49999999999999967e-31 < J Initial program 70.2%
Taylor expanded in l around 0 78.6%
*-commutative78.6%
associate-*l*78.6%
*-commutative78.6%
Simplified78.6%
if -7.79999999999999989e56 < J < 6.49999999999999967e-31Initial program 97.8%
Taylor expanded in l around 0 88.9%
Taylor expanded in l around inf 86.7%
associate-*r*86.7%
*-commutative86.7%
associate-*l*86.7%
Simplified86.7%
Taylor expanded in K around 0 75.6%
Final simplification77.1%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (* (* K K) -0.25)) (t_1 (+ U (* (* l J) (+ 2.0 t_0)))))
(if (<= l -1.28e+112)
t_1
(if (<= l -8.5e+29)
(pow U -3.0)
(if (<= l -470.0)
(+ U (* (* l J) t_0))
(if (<= l 5.4e+119) (+ U (* 2.0 (* l J))) t_1))))))
double code(double J, double l, double K, double U) {
double t_0 = (K * K) * -0.25;
double t_1 = U + ((l * J) * (2.0 + t_0));
double tmp;
if (l <= -1.28e+112) {
tmp = t_1;
} else if (l <= -8.5e+29) {
tmp = pow(U, -3.0);
} else if (l <= -470.0) {
tmp = U + ((l * J) * t_0);
} else if (l <= 5.4e+119) {
tmp = U + (2.0 * (l * J));
} 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 = (k * k) * (-0.25d0)
t_1 = u + ((l * j) * (2.0d0 + t_0))
if (l <= (-1.28d+112)) then
tmp = t_1
else if (l <= (-8.5d+29)) then
tmp = u ** (-3.0d0)
else if (l <= (-470.0d0)) then
tmp = u + ((l * j) * t_0)
else if (l <= 5.4d+119) then
tmp = u + (2.0d0 * (l * j))
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 = (K * K) * -0.25;
double t_1 = U + ((l * J) * (2.0 + t_0));
double tmp;
if (l <= -1.28e+112) {
tmp = t_1;
} else if (l <= -8.5e+29) {
tmp = Math.pow(U, -3.0);
} else if (l <= -470.0) {
tmp = U + ((l * J) * t_0);
} else if (l <= 5.4e+119) {
tmp = U + (2.0 * (l * J));
} else {
tmp = t_1;
}
return tmp;
}
def code(J, l, K, U): t_0 = (K * K) * -0.25 t_1 = U + ((l * J) * (2.0 + t_0)) tmp = 0 if l <= -1.28e+112: tmp = t_1 elif l <= -8.5e+29: tmp = math.pow(U, -3.0) elif l <= -470.0: tmp = U + ((l * J) * t_0) elif l <= 5.4e+119: tmp = U + (2.0 * (l * J)) else: tmp = t_1 return tmp
function code(J, l, K, U) t_0 = Float64(Float64(K * K) * -0.25) t_1 = Float64(U + Float64(Float64(l * J) * Float64(2.0 + t_0))) tmp = 0.0 if (l <= -1.28e+112) tmp = t_1; elseif (l <= -8.5e+29) tmp = U ^ -3.0; elseif (l <= -470.0) tmp = Float64(U + Float64(Float64(l * J) * t_0)); elseif (l <= 5.4e+119) tmp = Float64(U + Float64(2.0 * Float64(l * J))); else tmp = t_1; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = (K * K) * -0.25; t_1 = U + ((l * J) * (2.0 + t_0)); tmp = 0.0; if (l <= -1.28e+112) tmp = t_1; elseif (l <= -8.5e+29) tmp = U ^ -3.0; elseif (l <= -470.0) tmp = U + ((l * J) * t_0); elseif (l <= 5.4e+119) tmp = U + (2.0 * (l * J)); else tmp = t_1; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[(K * K), $MachinePrecision] * -0.25), $MachinePrecision]}, Block[{t$95$1 = N[(U + N[(N[(l * J), $MachinePrecision] * N[(2.0 + t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -1.28e+112], t$95$1, If[LessEqual[l, -8.5e+29], N[Power[U, -3.0], $MachinePrecision], If[LessEqual[l, -470.0], N[(U + N[(N[(l * J), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 5.4e+119], N[(U + N[(2.0 * N[(l * J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(K \cdot K\right) \cdot -0.25\\
t_1 := U + \left(\ell \cdot J\right) \cdot \left(2 + t_0\right)\\
\mathbf{if}\;\ell \leq -1.28 \cdot 10^{+112}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\ell \leq -8.5 \cdot 10^{+29}:\\
\;\;\;\;{U}^{-3}\\
\mathbf{elif}\;\ell \leq -470:\\
\;\;\;\;U + \left(\ell \cdot J\right) \cdot t_0\\
\mathbf{elif}\;\ell \leq 5.4 \cdot 10^{+119}:\\
\;\;\;\;U + 2 \cdot \left(\ell \cdot J\right)\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if l < -1.28e112 or 5.3999999999999997e119 < l Initial program 100.0%
Taylor expanded in l around 0 39.9%
associate-*r*39.9%
*-commutative39.9%
associate-*l*39.9%
Simplified39.9%
Taylor expanded in K around 0 23.5%
+-commutative23.5%
associate-*r*23.5%
distribute-rgt-out54.3%
*-commutative54.3%
unpow254.3%
Simplified54.3%
if -1.28e112 < l < -8.5000000000000006e29Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
fma-def100.0%
Simplified100.0%
Applied egg-rr32.7%
if -8.5000000000000006e29 < l < -470Initial program 100.0%
Taylor expanded in l around 0 5.5%
associate-*r*5.5%
*-commutative5.5%
associate-*l*5.5%
Simplified5.5%
Taylor expanded in K around 0 100.0%
+-commutative100.0%
associate-*r*100.0%
distribute-rgt-out100.0%
*-commutative100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in K around inf 100.0%
associate-*r*100.0%
*-commutative100.0%
unpow2100.0%
Simplified100.0%
if -470 < l < 5.3999999999999997e119Initial program 73.2%
Taylor expanded in l around 0 90.0%
associate-*r*90.0%
*-commutative90.0%
associate-*l*90.0%
Simplified90.0%
Taylor expanded in K around 0 79.7%
Final simplification67.7%
(FPCore (J l K U) :precision binary64 (if (or (<= l -320.0) (not (<= l 4.4e+119))) (+ U (* (* l J) (+ 2.0 (* (* K K) -0.25)))) (+ U (* 2.0 (* l J)))))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -320.0) || !(l <= 4.4e+119)) {
tmp = U + ((l * J) * (2.0 + ((K * K) * -0.25)));
} else {
tmp = U + (2.0 * (l * J));
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if ((l <= (-320.0d0)) .or. (.not. (l <= 4.4d+119))) then
tmp = u + ((l * j) * (2.0d0 + ((k * k) * (-0.25d0))))
else
tmp = u + (2.0d0 * (l * j))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -320.0) || !(l <= 4.4e+119)) {
tmp = U + ((l * J) * (2.0 + ((K * K) * -0.25)));
} else {
tmp = U + (2.0 * (l * J));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -320.0) or not (l <= 4.4e+119): tmp = U + ((l * J) * (2.0 + ((K * K) * -0.25))) else: tmp = U + (2.0 * (l * J)) return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -320.0) || !(l <= 4.4e+119)) tmp = Float64(U + Float64(Float64(l * J) * Float64(2.0 + Float64(Float64(K * K) * -0.25)))); else tmp = Float64(U + Float64(2.0 * Float64(l * J))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -320.0) || ~((l <= 4.4e+119))) tmp = U + ((l * J) * (2.0 + ((K * K) * -0.25))); else tmp = U + (2.0 * (l * J)); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -320.0], N[Not[LessEqual[l, 4.4e+119]], $MachinePrecision]], N[(U + N[(N[(l * J), $MachinePrecision] * N[(2.0 + N[(N[(K * K), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(2.0 * N[(l * J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -320 \lor \neg \left(\ell \leq 4.4 \cdot 10^{+119}\right):\\
\;\;\;\;U + \left(\ell \cdot J\right) \cdot \left(2 + \left(K \cdot K\right) \cdot -0.25\right)\\
\mathbf{else}:\\
\;\;\;\;U + 2 \cdot \left(\ell \cdot J\right)\\
\end{array}
\end{array}
if l < -320 or 4.4000000000000003e119 < l Initial program 100.0%
Taylor expanded in l around 0 32.7%
associate-*r*32.7%
*-commutative32.7%
associate-*l*32.7%
Simplified32.7%
Taylor expanded in K around 0 20.7%
+-commutative20.7%
associate-*r*20.7%
distribute-rgt-out45.7%
*-commutative45.7%
unpow245.7%
Simplified45.7%
if -320 < l < 4.4000000000000003e119Initial program 73.2%
Taylor expanded in l around 0 90.0%
associate-*r*90.0%
*-commutative90.0%
associate-*l*90.0%
Simplified90.0%
Taylor expanded in K around 0 79.7%
Final simplification65.9%
(FPCore (J l K U) :precision binary64 (if (<= l 1.7e+121) (+ U (* 2.0 (* l J))) (+ U (* J (+ (* (* K K) -0.015625) 0.125)))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= 1.7e+121) {
tmp = U + (2.0 * (l * J));
} else {
tmp = U + (J * (((K * K) * -0.015625) + 0.125));
}
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.7d+121) then
tmp = u + (2.0d0 * (l * j))
else
tmp = u + (j * (((k * k) * (-0.015625d0)) + 0.125d0))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (l <= 1.7e+121) {
tmp = U + (2.0 * (l * J));
} else {
tmp = U + (J * (((K * K) * -0.015625) + 0.125));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= 1.7e+121: tmp = U + (2.0 * (l * J)) else: tmp = U + (J * (((K * K) * -0.015625) + 0.125)) return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= 1.7e+121) tmp = Float64(U + Float64(2.0 * Float64(l * J))); else tmp = Float64(U + Float64(J * Float64(Float64(Float64(K * K) * -0.015625) + 0.125))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= 1.7e+121) tmp = U + (2.0 * (l * J)); else tmp = U + (J * (((K * K) * -0.015625) + 0.125)); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, 1.7e+121], N[(U + N[(2.0 * N[(l * J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * N[(N[(N[(K * K), $MachinePrecision] * -0.015625), $MachinePrecision] + 0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 1.7 \cdot 10^{+121}:\\
\;\;\;\;U + 2 \cdot \left(\ell \cdot J\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(\left(K \cdot K\right) \cdot -0.015625 + 0.125\right)\\
\end{array}
\end{array}
if l < 1.70000000000000005e121Initial program 81.8%
Taylor expanded in l around 0 70.5%
associate-*r*70.5%
*-commutative70.5%
associate-*l*70.5%
Simplified70.5%
Taylor expanded in K around 0 61.5%
if 1.70000000000000005e121 < l Initial program 100.0%
Applied egg-rr3.6%
Taylor expanded in K around 0 27.1%
+-commutative27.1%
associate-*r*27.1%
distribute-rgt-out27.1%
*-commutative27.1%
unpow227.1%
Simplified27.1%
Final simplification57.2%
(FPCore (J l K U) :precision binary64 (if (<= l 1.45e+121) (+ U (* 2.0 (* l J))) (+ U (* (* l J) (* (* K K) -0.25)))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= 1.45e+121) {
tmp = U + (2.0 * (l * J));
} else {
tmp = U + ((l * J) * ((K * K) * -0.25));
}
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.45d+121) then
tmp = u + (2.0d0 * (l * j))
else
tmp = u + ((l * j) * ((k * k) * (-0.25d0)))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (l <= 1.45e+121) {
tmp = U + (2.0 * (l * J));
} else {
tmp = U + ((l * J) * ((K * K) * -0.25));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= 1.45e+121: tmp = U + (2.0 * (l * J)) else: tmp = U + ((l * J) * ((K * K) * -0.25)) return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= 1.45e+121) tmp = Float64(U + Float64(2.0 * Float64(l * J))); else tmp = Float64(U + Float64(Float64(l * J) * Float64(Float64(K * K) * -0.25))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= 1.45e+121) tmp = U + (2.0 * (l * J)); else tmp = U + ((l * J) * ((K * K) * -0.25)); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, 1.45e+121], N[(U + N[(2.0 * N[(l * J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(N[(l * J), $MachinePrecision] * N[(N[(K * K), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 1.45 \cdot 10^{+121}:\\
\;\;\;\;U + 2 \cdot \left(\ell \cdot J\right)\\
\mathbf{else}:\\
\;\;\;\;U + \left(\ell \cdot J\right) \cdot \left(\left(K \cdot K\right) \cdot -0.25\right)\\
\end{array}
\end{array}
if l < 1.45e121Initial program 81.8%
Taylor expanded in l around 0 70.5%
associate-*r*70.5%
*-commutative70.5%
associate-*l*70.5%
Simplified70.5%
Taylor expanded in K around 0 61.5%
if 1.45e121 < l Initial program 100.0%
Taylor expanded in l around 0 40.4%
associate-*r*40.4%
*-commutative40.4%
associate-*l*40.4%
Simplified40.4%
Taylor expanded in K around 0 17.0%
+-commutative17.0%
associate-*r*17.0%
distribute-rgt-out51.4%
*-commutative51.4%
unpow251.4%
Simplified51.4%
Taylor expanded in K around inf 44.5%
associate-*r*44.5%
*-commutative44.5%
unpow244.5%
Simplified44.5%
Final simplification59.4%
(FPCore (J l K U) :precision binary64 (if (or (<= J -8.9e+74) (not (<= J 1.95e+176))) (* l (* J 2.0)) U))
double code(double J, double l, double K, double U) {
double tmp;
if ((J <= -8.9e+74) || !(J <= 1.95e+176)) {
tmp = l * (J * 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 ((j <= (-8.9d+74)) .or. (.not. (j <= 1.95d+176))) then
tmp = l * (j * 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 ((J <= -8.9e+74) || !(J <= 1.95e+176)) {
tmp = l * (J * 2.0);
} else {
tmp = U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (J <= -8.9e+74) or not (J <= 1.95e+176): tmp = l * (J * 2.0) else: tmp = U return tmp
function code(J, l, K, U) tmp = 0.0 if ((J <= -8.9e+74) || !(J <= 1.95e+176)) tmp = Float64(l * Float64(J * 2.0)); else tmp = U; end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((J <= -8.9e+74) || ~((J <= 1.95e+176))) tmp = l * (J * 2.0); else tmp = U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[J, -8.9e+74], N[Not[LessEqual[J, 1.95e+176]], $MachinePrecision]], N[(l * N[(J * 2.0), $MachinePrecision]), $MachinePrecision], U]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;J \leq -8.9 \cdot 10^{+74} \lor \neg \left(J \leq 1.95 \cdot 10^{+176}\right):\\
\;\;\;\;\ell \cdot \left(J \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\end{array}
if J < -8.9000000000000002e74 or 1.9500000000000001e176 < J Initial program 65.4%
Taylor expanded in l around 0 88.7%
associate-*r*88.7%
*-commutative88.7%
associate-*l*88.7%
Simplified88.7%
Taylor expanded in K around 0 62.4%
Taylor expanded in l around inf 48.1%
*-commutative48.1%
associate-*r*48.1%
Simplified48.1%
if -8.9000000000000002e74 < J < 1.9500000000000001e176Initial program 92.9%
*-commutative92.9%
associate-*l*92.9%
fma-def92.9%
Simplified92.9%
Taylor expanded in l around 0 46.7%
Final simplification47.1%
(FPCore (J l K U) :precision binary64 (+ U (* 2.0 (* l J))))
double code(double J, double l, double K, double U) {
return U + (2.0 * (l * J));
}
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 * (l * j))
end function
public static double code(double J, double l, double K, double U) {
return U + (2.0 * (l * J));
}
def code(J, l, K, U): return U + (2.0 * (l * J))
function code(J, l, K, U) return Float64(U + Float64(2.0 * Float64(l * J))) end
function tmp = code(J, l, K, U) tmp = U + (2.0 * (l * J)); end
code[J_, l_, K_, U_] := N[(U + N[(2.0 * N[(l * J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + 2 \cdot \left(\ell \cdot J\right)
\end{array}
Initial program 84.1%
Taylor expanded in l around 0 66.7%
associate-*r*66.7%
*-commutative66.7%
associate-*l*66.7%
Simplified66.7%
Taylor expanded in K around 0 55.2%
Final simplification55.2%
(FPCore (J l K U) :precision binary64 (if (<= l -6.0) (* U U) U))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -6.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 <= (-6.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 <= -6.0) {
tmp = U * U;
} else {
tmp = U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -6.0: tmp = U * U else: tmp = U return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -6.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 <= -6.0) tmp = U * U; else tmp = U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -6.0], N[(U * U), $MachinePrecision], U]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -6:\\
\;\;\;\;U \cdot U\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\end{array}
if l < -6Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
fma-def100.0%
Simplified100.0%
Applied egg-rr13.2%
if -6 < l Initial program 77.9%
*-commutative77.9%
associate-*l*77.9%
fma-def77.9%
Simplified77.9%
Taylor expanded in l around 0 50.9%
Final simplification40.3%
(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.1%
*-commutative84.1%
associate-*l*84.1%
fma-def84.1%
Simplified84.1%
Applied egg-rr2.8%
*-inverses2.8%
Simplified2.8%
Final simplification2.8%
(FPCore (J l K U) :precision binary64 U)
double code(double J, double l, double K, double U) {
return U;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = u
end function
public static double code(double J, double l, double K, double U) {
return U;
}
def code(J, l, K, U): return U
function code(J, l, K, U) return U end
function tmp = code(J, l, K, U) tmp = U; end
code[J_, l_, K_, U_] := U
\begin{array}{l}
\\
U
\end{array}
Initial program 84.1%
*-commutative84.1%
associate-*l*84.1%
fma-def84.1%
Simplified84.1%
Taylor expanded in l around 0 37.2%
Final simplification37.2%
herbie shell --seed 2023238
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))