
(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 19 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (J l K U) :precision binary64 (+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))
double code(double J, double l, double K, double U) {
return ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = ((j * (exp(l) - exp(-l))) * cos((k / 2.0d0))) + u
end function
public static double code(double J, double l, double K, double U) {
return ((J * (Math.exp(l) - Math.exp(-l))) * Math.cos((K / 2.0))) + U;
}
def code(J, l, K, U): return ((J * (math.exp(l) - math.exp(-l))) * math.cos((K / 2.0))) + U
function code(J, l, K, U) return Float64(Float64(Float64(J * Float64(exp(l) - exp(Float64(-l)))) * cos(Float64(K / 2.0))) + U) end
function tmp = code(J, l, K, U) tmp = ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U; end
code[J_, l_, K_, U_] := N[(N[(N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]
\begin{array}{l}
\\
\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U
\end{array}
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (- (exp l) (exp (- l)))))
(if (or (<= t_0 (- INFINITY)) (not (<= t_0 0.0)))
(+ (* (cos (/ K 2.0)) (* t_0 J)) U)
(+ U (* J (* (cos (* K 0.5)) (* l 2.0)))))))
double code(double J, double l, double K, double U) {
double t_0 = exp(l) - exp(-l);
double tmp;
if ((t_0 <= -((double) INFINITY)) || !(t_0 <= 0.0)) {
tmp = (cos((K / 2.0)) * (t_0 * J)) + U;
} else {
tmp = U + (J * (cos((K * 0.5)) * (l * 2.0)));
}
return tmp;
}
public static double code(double J, double l, double K, double U) {
double t_0 = Math.exp(l) - Math.exp(-l);
double tmp;
if ((t_0 <= -Double.POSITIVE_INFINITY) || !(t_0 <= 0.0)) {
tmp = (Math.cos((K / 2.0)) * (t_0 * J)) + U;
} else {
tmp = U + (J * (Math.cos((K * 0.5)) * (l * 2.0)));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.exp(l) - math.exp(-l) tmp = 0 if (t_0 <= -math.inf) or not (t_0 <= 0.0): tmp = (math.cos((K / 2.0)) * (t_0 * J)) + U else: tmp = U + (J * (math.cos((K * 0.5)) * (l * 2.0))) return tmp
function code(J, l, K, U) t_0 = Float64(exp(l) - exp(Float64(-l))) tmp = 0.0 if ((t_0 <= Float64(-Inf)) || !(t_0 <= 0.0)) tmp = Float64(Float64(cos(Float64(K / 2.0)) * Float64(t_0 * J)) + U); else tmp = Float64(U + Float64(J * Float64(cos(Float64(K * 0.5)) * Float64(l * 2.0)))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = exp(l) - exp(-l); tmp = 0.0; if ((t_0 <= -Inf) || ~((t_0 <= 0.0))) tmp = (cos((K / 2.0)) * (t_0 * J)) + U; else tmp = U + (J * (cos((K * 0.5)) * (l * 2.0))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, (-Infinity)], N[Not[LessEqual[t$95$0, 0.0]], $MachinePrecision]], N[(N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(t$95$0 * J), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], N[(U + N[(J * N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{\ell} - e^{-\ell}\\
\mathbf{if}\;t_0 \leq -\infty \lor \neg \left(t_0 \leq 0\right):\\
\;\;\;\;\cos \left(\frac{K}{2}\right) \cdot \left(t_0 \cdot J\right) + U\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(\cos \left(K \cdot 0.5\right) \cdot \left(\ell \cdot 2\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -inf.0 or 0.0 < (-.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.0Initial program 74.7%
Taylor expanded in l around 0 99.9%
associate-*r*100.0%
associate-*r*100.0%
associate-*r*100.0%
associate-*r*100.0%
distribute-rgt-out100.0%
*-commutative100.0%
associate-*r*100.0%
*-commutative100.0%
associate-*r*100.0%
distribute-rgt-out100.0%
+-commutative100.0%
fma-def100.0%
Simplified100.0%
Taylor expanded in l around 0 100.0%
*-commutative100.0%
associate-*r*100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= t_0 -0.66)
(+ U (* J (* (cos (* K 0.5)) (* l 2.0))))
(if (<= t_0 -0.056)
(+
U
(*
(* J (pow l 3.0))
(+ 0.3333333333333333 (* (* K K) -0.041666666666666664))))
(+ 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 tmp;
if (t_0 <= -0.66) {
tmp = U + (J * (cos((K * 0.5)) * (l * 2.0)));
} else if (t_0 <= -0.056) {
tmp = U + ((J * pow(l, 3.0)) * (0.3333333333333333 + ((K * K) * -0.041666666666666664)));
} 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) :: tmp
t_0 = cos((k / 2.0d0))
if (t_0 <= (-0.66d0)) then
tmp = u + (j * (cos((k * 0.5d0)) * (l * 2.0d0)))
else if (t_0 <= (-0.056d0)) then
tmp = u + ((j * (l ** 3.0d0)) * (0.3333333333333333d0 + ((k * k) * (-0.041666666666666664d0))))
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 tmp;
if (t_0 <= -0.66) {
tmp = U + (J * (Math.cos((K * 0.5)) * (l * 2.0)));
} else if (t_0 <= -0.056) {
tmp = U + ((J * Math.pow(l, 3.0)) * (0.3333333333333333 + ((K * K) * -0.041666666666666664)));
} 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)) tmp = 0 if t_0 <= -0.66: tmp = U + (J * (math.cos((K * 0.5)) * (l * 2.0))) elif t_0 <= -0.056: tmp = U + ((J * math.pow(l, 3.0)) * (0.3333333333333333 + ((K * K) * -0.041666666666666664))) 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)) tmp = 0.0 if (t_0 <= -0.66) tmp = Float64(U + Float64(J * Float64(cos(Float64(K * 0.5)) * Float64(l * 2.0)))); elseif (t_0 <= -0.056) tmp = Float64(U + Float64(Float64(J * (l ^ 3.0)) * Float64(0.3333333333333333 + Float64(Float64(K * K) * -0.041666666666666664)))); 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)); tmp = 0.0; if (t_0 <= -0.66) tmp = U + (J * (cos((K * 0.5)) * (l * 2.0))); elseif (t_0 <= -0.056) tmp = U + ((J * (l ^ 3.0)) * (0.3333333333333333 + ((K * K) * -0.041666666666666664))); 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]}, If[LessEqual[t$95$0, -0.66], N[(U + N[(J * N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, -0.056], 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[(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)\\
\mathbf{if}\;t_0 \leq -0.66:\\
\;\;\;\;U + J \cdot \left(\cos \left(K \cdot 0.5\right) \cdot \left(\ell \cdot 2\right)\right)\\
\mathbf{elif}\;t_0 \leq -0.056:\\
\;\;\;\;U + \left(J \cdot {\ell}^{3}\right) \cdot \left(0.3333333333333333 + \left(K \cdot K\right) \cdot -0.041666666666666664\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K 2)) < -0.660000000000000031Initial program 85.0%
Taylor expanded in l around 0 77.9%
associate-*r*77.9%
associate-*r*77.9%
associate-*r*77.9%
associate-*r*77.9%
distribute-rgt-out77.9%
*-commutative77.9%
associate-*r*77.9%
*-commutative77.9%
associate-*r*77.9%
distribute-rgt-out77.9%
+-commutative77.9%
fma-def77.9%
Simplified77.9%
Taylor expanded in l around 0 60.5%
*-commutative60.5%
associate-*r*60.5%
Simplified60.5%
if -0.660000000000000031 < (cos.f64 (/.f64 K 2)) < -0.0560000000000000012Initial program 98.1%
Taylor expanded in l around 0 83.4%
associate-*r*83.4%
associate-*r*83.4%
associate-*r*83.4%
associate-*r*83.4%
distribute-rgt-out83.4%
*-commutative83.4%
associate-*r*83.4%
*-commutative83.4%
associate-*r*83.4%
distribute-rgt-out83.4%
+-commutative83.4%
fma-def83.4%
Simplified83.4%
Taylor expanded in l around inf 81.5%
associate-*r*81.5%
Simplified81.5%
Taylor expanded in K around 0 77.4%
unpow277.4%
Simplified77.4%
if -0.0560000000000000012 < (cos.f64 (/.f64 K 2)) Initial program 86.2%
Taylor expanded in l around 0 88.9%
associate-*r*88.9%
associate-*r*88.9%
associate-*r*88.9%
associate-*r*88.9%
distribute-rgt-out88.9%
*-commutative88.9%
associate-*r*88.9%
*-commutative88.9%
associate-*r*88.9%
distribute-rgt-out88.9%
+-commutative88.9%
fma-def88.9%
Simplified88.9%
Taylor expanded in K around 0 84.8%
Final simplification80.1%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= t_0 -0.66)
(+ U (* J (* (cos (* K 0.5)) (* l 2.0))))
(if (<= t_0 -0.015)
(+ U (* K (* -0.25 (* K (* l J)))))
(+ 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 tmp;
if (t_0 <= -0.66) {
tmp = U + (J * (cos((K * 0.5)) * (l * 2.0)));
} else if (t_0 <= -0.015) {
tmp = U + (K * (-0.25 * (K * (l * J))));
} 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) :: tmp
t_0 = cos((k / 2.0d0))
if (t_0 <= (-0.66d0)) then
tmp = u + (j * (cos((k * 0.5d0)) * (l * 2.0d0)))
else if (t_0 <= (-0.015d0)) then
tmp = u + (k * ((-0.25d0) * (k * (l * j))))
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 tmp;
if (t_0 <= -0.66) {
tmp = U + (J * (Math.cos((K * 0.5)) * (l * 2.0)));
} else if (t_0 <= -0.015) {
tmp = U + (K * (-0.25 * (K * (l * J))));
} 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)) tmp = 0 if t_0 <= -0.66: tmp = U + (J * (math.cos((K * 0.5)) * (l * 2.0))) elif t_0 <= -0.015: tmp = U + (K * (-0.25 * (K * (l * J)))) 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)) tmp = 0.0 if (t_0 <= -0.66) tmp = Float64(U + Float64(J * Float64(cos(Float64(K * 0.5)) * Float64(l * 2.0)))); elseif (t_0 <= -0.015) tmp = Float64(U + Float64(K * Float64(-0.25 * Float64(K * Float64(l * J))))); 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)); tmp = 0.0; if (t_0 <= -0.66) tmp = U + (J * (cos((K * 0.5)) * (l * 2.0))); elseif (t_0 <= -0.015) tmp = U + (K * (-0.25 * (K * (l * J)))); 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]}, If[LessEqual[t$95$0, -0.66], N[(U + N[(J * N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, -0.015], N[(U + N[(K * N[(-0.25 * N[(K * N[(l * J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * N[(N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision] + N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;t_0 \leq -0.66:\\
\;\;\;\;U + J \cdot \left(\cos \left(K \cdot 0.5\right) \cdot \left(\ell \cdot 2\right)\right)\\
\mathbf{elif}\;t_0 \leq -0.015:\\
\;\;\;\;U + K \cdot \left(-0.25 \cdot \left(K \cdot \left(\ell \cdot J\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K 2)) < -0.660000000000000031Initial program 85.0%
Taylor expanded in l around 0 77.9%
associate-*r*77.9%
associate-*r*77.9%
associate-*r*77.9%
associate-*r*77.9%
distribute-rgt-out77.9%
*-commutative77.9%
associate-*r*77.9%
*-commutative77.9%
associate-*r*77.9%
distribute-rgt-out77.9%
+-commutative77.9%
fma-def77.9%
Simplified77.9%
Taylor expanded in l around 0 60.5%
*-commutative60.5%
associate-*r*60.5%
Simplified60.5%
if -0.660000000000000031 < (cos.f64 (/.f64 K 2)) < -0.014999999999999999Initial program 98.2%
Taylor expanded in l around 0 40.3%
Taylor expanded in K around 0 45.3%
+-commutative45.3%
associate-*r*45.3%
distribute-rgt-out53.5%
*-commutative53.5%
unpow253.5%
Simplified53.5%
Taylor expanded in K around inf 53.5%
associate-*r*53.5%
*-commutative53.5%
unpow253.5%
associate-*r*53.5%
associate-*l*61.7%
*-commutative61.7%
associate-*l*61.7%
Simplified61.7%
if -0.014999999999999999 < (cos.f64 (/.f64 K 2)) Initial program 86.1%
Taylor expanded in l around 0 88.7%
associate-*r*88.8%
associate-*r*88.8%
associate-*r*88.8%
associate-*r*88.8%
distribute-rgt-out88.8%
*-commutative88.8%
associate-*r*88.8%
*-commutative88.8%
associate-*r*88.8%
distribute-rgt-out88.8%
+-commutative88.8%
fma-def88.8%
Simplified88.8%
Taylor expanded in K around 0 85.2%
Final simplification78.0%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (* K 0.5)))
(t_1 (+ U (* (* t_0 0.3333333333333333) (* J (pow l 3.0)))))
(t_2
(+ U (* (+ (* -0.125 (* K K)) 1.0) (* (- (exp l) (exp (- l))) J)))))
(if (<= l -5.6e+102)
t_1
(if (<= l -1.35e+19)
t_2
(if (<= l 11.2)
(+ U (* J (* t_0 (* l 2.0))))
(if (<= l 5.6e+102) t_2 t_1))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K * 0.5));
double t_1 = U + ((t_0 * 0.3333333333333333) * (J * pow(l, 3.0)));
double t_2 = U + (((-0.125 * (K * K)) + 1.0) * ((exp(l) - exp(-l)) * J));
double tmp;
if (l <= -5.6e+102) {
tmp = t_1;
} else if (l <= -1.35e+19) {
tmp = t_2;
} else if (l <= 11.2) {
tmp = U + (J * (t_0 * (l * 2.0)));
} else if (l <= 5.6e+102) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = cos((k * 0.5d0))
t_1 = u + ((t_0 * 0.3333333333333333d0) * (j * (l ** 3.0d0)))
t_2 = u + ((((-0.125d0) * (k * k)) + 1.0d0) * ((exp(l) - exp(-l)) * j))
if (l <= (-5.6d+102)) then
tmp = t_1
else if (l <= (-1.35d+19)) then
tmp = t_2
else if (l <= 11.2d0) then
tmp = u + (j * (t_0 * (l * 2.0d0)))
else if (l <= 5.6d+102) then
tmp = t_2
else
tmp = t_1
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = Math.cos((K * 0.5));
double t_1 = U + ((t_0 * 0.3333333333333333) * (J * Math.pow(l, 3.0)));
double t_2 = U + (((-0.125 * (K * K)) + 1.0) * ((Math.exp(l) - Math.exp(-l)) * J));
double tmp;
if (l <= -5.6e+102) {
tmp = t_1;
} else if (l <= -1.35e+19) {
tmp = t_2;
} else if (l <= 11.2) {
tmp = U + (J * (t_0 * (l * 2.0)));
} else if (l <= 5.6e+102) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K * 0.5)) t_1 = U + ((t_0 * 0.3333333333333333) * (J * math.pow(l, 3.0))) t_2 = U + (((-0.125 * (K * K)) + 1.0) * ((math.exp(l) - math.exp(-l)) * J)) tmp = 0 if l <= -5.6e+102: tmp = t_1 elif l <= -1.35e+19: tmp = t_2 elif l <= 11.2: tmp = U + (J * (t_0 * (l * 2.0))) elif l <= 5.6e+102: tmp = t_2 else: tmp = t_1 return tmp
function code(J, l, K, U) t_0 = cos(Float64(K * 0.5)) t_1 = Float64(U + Float64(Float64(t_0 * 0.3333333333333333) * Float64(J * (l ^ 3.0)))) 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 <= -5.6e+102) tmp = t_1; elseif (l <= -1.35e+19) tmp = t_2; elseif (l <= 11.2) tmp = Float64(U + Float64(J * Float64(t_0 * Float64(l * 2.0)))); elseif (l <= 5.6e+102) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = cos((K * 0.5)); t_1 = U + ((t_0 * 0.3333333333333333) * (J * (l ^ 3.0))); t_2 = U + (((-0.125 * (K * K)) + 1.0) * ((exp(l) - exp(-l)) * J)); tmp = 0.0; if (l <= -5.6e+102) tmp = t_1; elseif (l <= -1.35e+19) tmp = t_2; elseif (l <= 11.2) tmp = U + (J * (t_0 * (l * 2.0))); elseif (l <= 5.6e+102) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(U + N[(N[(t$95$0 * 0.3333333333333333), $MachinePrecision] * N[(J * N[Power[l, 3.0], $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, -5.6e+102], t$95$1, If[LessEqual[l, -1.35e+19], t$95$2, If[LessEqual[l, 11.2], N[(U + N[(J * N[(t$95$0 * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 5.6e+102], t$95$2, t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(K \cdot 0.5\right)\\
t_1 := U + \left(t_0 \cdot 0.3333333333333333\right) \cdot \left(J \cdot {\ell}^{3}\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 -5.6 \cdot 10^{+102}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\ell \leq -1.35 \cdot 10^{+19}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\ell \leq 11.2:\\
\;\;\;\;U + J \cdot \left(t_0 \cdot \left(\ell \cdot 2\right)\right)\\
\mathbf{elif}\;\ell \leq 5.6 \cdot 10^{+102}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if l < -5.60000000000000037e102 or 5.60000000000000037e102 < l Initial program 100.0%
Taylor expanded in l around 0 100.0%
associate-*r*100.0%
associate-*r*100.0%
associate-*r*100.0%
associate-*r*100.0%
distribute-rgt-out100.0%
*-commutative100.0%
associate-*r*100.0%
*-commutative100.0%
associate-*r*100.0%
distribute-rgt-out100.0%
+-commutative100.0%
fma-def100.0%
Simplified100.0%
Taylor expanded in l around inf 100.0%
associate-*r*100.0%
Simplified100.0%
if -5.60000000000000037e102 < l < -1.35e19 or 11.199999999999999 < l < 5.60000000000000037e102Initial program 100.0%
Taylor expanded in K around 0 0.0%
associate-*r*0.0%
distribute-rgt1-in90.5%
unpow290.5%
Simplified90.5%
if -1.35e19 < l < 11.199999999999999Initial program 75.3%
Taylor expanded in l around 0 99.9%
associate-*r*100.0%
associate-*r*100.0%
associate-*r*100.0%
associate-*r*100.0%
distribute-rgt-out100.0%
*-commutative100.0%
associate-*r*100.0%
*-commutative100.0%
associate-*r*100.0%
distribute-rgt-out100.0%
+-commutative100.0%
fma-def100.0%
Simplified100.0%
Taylor expanded in l around 0 100.0%
*-commutative100.0%
associate-*r*100.0%
Simplified100.0%
Final simplification98.4%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (* K 0.5)))
(t_1 (+ U (* (* t_0 0.3333333333333333) (* J (pow l 3.0)))))
(t_2 (* (- (exp l) (exp (- l))) J)))
(if (<= l -4e+120)
t_1
(if (<= l -1.35e+19)
t_2
(if (<= l 1.5e-38)
(+ U (* J (* t_0 (* l 2.0))))
(if (<= l 1.15e+67) (+ U t_2) t_1))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K * 0.5));
double t_1 = U + ((t_0 * 0.3333333333333333) * (J * pow(l, 3.0)));
double t_2 = (exp(l) - exp(-l)) * J;
double tmp;
if (l <= -4e+120) {
tmp = t_1;
} else if (l <= -1.35e+19) {
tmp = t_2;
} else if (l <= 1.5e-38) {
tmp = U + (J * (t_0 * (l * 2.0)));
} else if (l <= 1.15e+67) {
tmp = U + t_2;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = cos((k * 0.5d0))
t_1 = u + ((t_0 * 0.3333333333333333d0) * (j * (l ** 3.0d0)))
t_2 = (exp(l) - exp(-l)) * j
if (l <= (-4d+120)) then
tmp = t_1
else if (l <= (-1.35d+19)) then
tmp = t_2
else if (l <= 1.5d-38) then
tmp = u + (j * (t_0 * (l * 2.0d0)))
else if (l <= 1.15d+67) then
tmp = u + t_2
else
tmp = t_1
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = Math.cos((K * 0.5));
double t_1 = U + ((t_0 * 0.3333333333333333) * (J * Math.pow(l, 3.0)));
double t_2 = (Math.exp(l) - Math.exp(-l)) * J;
double tmp;
if (l <= -4e+120) {
tmp = t_1;
} else if (l <= -1.35e+19) {
tmp = t_2;
} else if (l <= 1.5e-38) {
tmp = U + (J * (t_0 * (l * 2.0)));
} else if (l <= 1.15e+67) {
tmp = U + t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K * 0.5)) t_1 = U + ((t_0 * 0.3333333333333333) * (J * math.pow(l, 3.0))) t_2 = (math.exp(l) - math.exp(-l)) * J tmp = 0 if l <= -4e+120: tmp = t_1 elif l <= -1.35e+19: tmp = t_2 elif l <= 1.5e-38: tmp = U + (J * (t_0 * (l * 2.0))) elif l <= 1.15e+67: tmp = U + t_2 else: tmp = t_1 return tmp
function code(J, l, K, U) t_0 = cos(Float64(K * 0.5)) t_1 = Float64(U + Float64(Float64(t_0 * 0.3333333333333333) * Float64(J * (l ^ 3.0)))) t_2 = Float64(Float64(exp(l) - exp(Float64(-l))) * J) tmp = 0.0 if (l <= -4e+120) tmp = t_1; elseif (l <= -1.35e+19) tmp = t_2; elseif (l <= 1.5e-38) tmp = Float64(U + Float64(J * Float64(t_0 * Float64(l * 2.0)))); elseif (l <= 1.15e+67) tmp = Float64(U + t_2); else tmp = t_1; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = cos((K * 0.5)); t_1 = U + ((t_0 * 0.3333333333333333) * (J * (l ^ 3.0))); t_2 = (exp(l) - exp(-l)) * J; tmp = 0.0; if (l <= -4e+120) tmp = t_1; elseif (l <= -1.35e+19) tmp = t_2; elseif (l <= 1.5e-38) tmp = U + (J * (t_0 * (l * 2.0))); elseif (l <= 1.15e+67) tmp = U + t_2; else tmp = t_1; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(U + N[(N[(t$95$0 * 0.3333333333333333), $MachinePrecision] * N[(J * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision]}, If[LessEqual[l, -4e+120], t$95$1, If[LessEqual[l, -1.35e+19], t$95$2, If[LessEqual[l, 1.5e-38], N[(U + N[(J * N[(t$95$0 * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.15e+67], N[(U + t$95$2), $MachinePrecision], t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(K \cdot 0.5\right)\\
t_1 := U + \left(t_0 \cdot 0.3333333333333333\right) \cdot \left(J \cdot {\ell}^{3}\right)\\
t_2 := \left(e^{\ell} - e^{-\ell}\right) \cdot J\\
\mathbf{if}\;\ell \leq -4 \cdot 10^{+120}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\ell \leq -1.35 \cdot 10^{+19}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\ell \leq 1.5 \cdot 10^{-38}:\\
\;\;\;\;U + J \cdot \left(t_0 \cdot \left(\ell \cdot 2\right)\right)\\
\mathbf{elif}\;\ell \leq 1.15 \cdot 10^{+67}:\\
\;\;\;\;U + t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if l < -3.9999999999999999e120 or 1.1499999999999999e67 < l Initial program 100.0%
Taylor expanded in l around 0 95.7%
associate-*r*95.7%
associate-*r*95.7%
associate-*r*95.7%
associate-*r*95.7%
distribute-rgt-out95.7%
*-commutative95.7%
associate-*r*95.7%
*-commutative95.7%
associate-*r*95.7%
distribute-rgt-out95.7%
+-commutative95.7%
fma-def95.7%
Simplified95.7%
Taylor expanded in l around inf 95.7%
associate-*r*95.7%
Simplified95.7%
if -3.9999999999999999e120 < l < -1.35e19Initial program 100.0%
Taylor expanded in K around 0 71.4%
Taylor expanded in J around inf 71.4%
if -1.35e19 < l < 1.49999999999999994e-38Initial program 73.9%
Taylor expanded in l around 0 99.9%
associate-*r*100.0%
associate-*r*100.0%
associate-*r*100.0%
associate-*r*100.0%
distribute-rgt-out100.0%
*-commutative100.0%
associate-*r*100.0%
*-commutative100.0%
associate-*r*100.0%
distribute-rgt-out100.0%
+-commutative100.0%
fma-def100.0%
Simplified100.0%
Taylor expanded in l around 0 100.0%
*-commutative100.0%
associate-*r*100.0%
Simplified100.0%
if 1.49999999999999994e-38 < l < 1.1499999999999999e67Initial program 100.0%
Taylor expanded in K around 0 75.0%
Final simplification93.4%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (* J (pow l 3.0)))
(t_1
(+
U
(* t_0 (+ 0.3333333333333333 (* (* K K) -0.041666666666666664)))))
(t_2 (* (- (exp l) (exp (- l))) J)))
(if (<= l -1e+136)
t_1
(if (<= l -1.35e+19)
t_2
(if (<= l 1.5e-38)
(+ U (* J (* (cos (* K 0.5)) (* l 2.0))))
(if (<= l 2.95e+25)
(+ U t_2)
(if (or (<= l 2e+199) (not (<= l 1.7e+267)))
t_1
(+ U (* 0.3333333333333333 t_0)))))))))
double code(double J, double l, double K, double U) {
double t_0 = J * pow(l, 3.0);
double t_1 = U + (t_0 * (0.3333333333333333 + ((K * K) * -0.041666666666666664)));
double t_2 = (exp(l) - exp(-l)) * J;
double tmp;
if (l <= -1e+136) {
tmp = t_1;
} else if (l <= -1.35e+19) {
tmp = t_2;
} else if (l <= 1.5e-38) {
tmp = U + (J * (cos((K * 0.5)) * (l * 2.0)));
} else if (l <= 2.95e+25) {
tmp = U + t_2;
} else if ((l <= 2e+199) || !(l <= 1.7e+267)) {
tmp = t_1;
} else {
tmp = U + (0.3333333333333333 * 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) :: t_2
real(8) :: tmp
t_0 = j * (l ** 3.0d0)
t_1 = u + (t_0 * (0.3333333333333333d0 + ((k * k) * (-0.041666666666666664d0))))
t_2 = (exp(l) - exp(-l)) * j
if (l <= (-1d+136)) then
tmp = t_1
else if (l <= (-1.35d+19)) then
tmp = t_2
else if (l <= 1.5d-38) then
tmp = u + (j * (cos((k * 0.5d0)) * (l * 2.0d0)))
else if (l <= 2.95d+25) then
tmp = u + t_2
else if ((l <= 2d+199) .or. (.not. (l <= 1.7d+267))) then
tmp = t_1
else
tmp = u + (0.3333333333333333d0 * t_0)
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = J * Math.pow(l, 3.0);
double t_1 = U + (t_0 * (0.3333333333333333 + ((K * K) * -0.041666666666666664)));
double t_2 = (Math.exp(l) - Math.exp(-l)) * J;
double tmp;
if (l <= -1e+136) {
tmp = t_1;
} else if (l <= -1.35e+19) {
tmp = t_2;
} else if (l <= 1.5e-38) {
tmp = U + (J * (Math.cos((K * 0.5)) * (l * 2.0)));
} else if (l <= 2.95e+25) {
tmp = U + t_2;
} else if ((l <= 2e+199) || !(l <= 1.7e+267)) {
tmp = t_1;
} else {
tmp = U + (0.3333333333333333 * t_0);
}
return tmp;
}
def code(J, l, K, U): t_0 = J * math.pow(l, 3.0) t_1 = U + (t_0 * (0.3333333333333333 + ((K * K) * -0.041666666666666664))) t_2 = (math.exp(l) - math.exp(-l)) * J tmp = 0 if l <= -1e+136: tmp = t_1 elif l <= -1.35e+19: tmp = t_2 elif l <= 1.5e-38: tmp = U + (J * (math.cos((K * 0.5)) * (l * 2.0))) elif l <= 2.95e+25: tmp = U + t_2 elif (l <= 2e+199) or not (l <= 1.7e+267): tmp = t_1 else: tmp = U + (0.3333333333333333 * t_0) return tmp
function code(J, l, K, U) t_0 = Float64(J * (l ^ 3.0)) t_1 = Float64(U + Float64(t_0 * Float64(0.3333333333333333 + Float64(Float64(K * K) * -0.041666666666666664)))) t_2 = Float64(Float64(exp(l) - exp(Float64(-l))) * J) tmp = 0.0 if (l <= -1e+136) tmp = t_1; elseif (l <= -1.35e+19) tmp = t_2; elseif (l <= 1.5e-38) tmp = Float64(U + Float64(J * Float64(cos(Float64(K * 0.5)) * Float64(l * 2.0)))); elseif (l <= 2.95e+25) tmp = Float64(U + t_2); elseif ((l <= 2e+199) || !(l <= 1.7e+267)) tmp = t_1; else tmp = Float64(U + Float64(0.3333333333333333 * t_0)); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = J * (l ^ 3.0); t_1 = U + (t_0 * (0.3333333333333333 + ((K * K) * -0.041666666666666664))); t_2 = (exp(l) - exp(-l)) * J; tmp = 0.0; if (l <= -1e+136) tmp = t_1; elseif (l <= -1.35e+19) tmp = t_2; elseif (l <= 1.5e-38) tmp = U + (J * (cos((K * 0.5)) * (l * 2.0))); elseif (l <= 2.95e+25) tmp = U + t_2; elseif ((l <= 2e+199) || ~((l <= 1.7e+267))) tmp = t_1; else tmp = U + (0.3333333333333333 * t_0); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(J * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(U + N[(t$95$0 * N[(0.3333333333333333 + N[(N[(K * K), $MachinePrecision] * -0.041666666666666664), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision]}, If[LessEqual[l, -1e+136], t$95$1, If[LessEqual[l, -1.35e+19], t$95$2, If[LessEqual[l, 1.5e-38], N[(U + N[(J * N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.95e+25], N[(U + t$95$2), $MachinePrecision], If[Or[LessEqual[l, 2e+199], N[Not[LessEqual[l, 1.7e+267]], $MachinePrecision]], t$95$1, N[(U + N[(0.3333333333333333 * t$95$0), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := J \cdot {\ell}^{3}\\
t_1 := U + t_0 \cdot \left(0.3333333333333333 + \left(K \cdot K\right) \cdot -0.041666666666666664\right)\\
t_2 := \left(e^{\ell} - e^{-\ell}\right) \cdot J\\
\mathbf{if}\;\ell \leq -1 \cdot 10^{+136}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\ell \leq -1.35 \cdot 10^{+19}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\ell \leq 1.5 \cdot 10^{-38}:\\
\;\;\;\;U + J \cdot \left(\cos \left(K \cdot 0.5\right) \cdot \left(\ell \cdot 2\right)\right)\\
\mathbf{elif}\;\ell \leq 2.95 \cdot 10^{+25}:\\
\;\;\;\;U + t_2\\
\mathbf{elif}\;\ell \leq 2 \cdot 10^{+199} \lor \neg \left(\ell \leq 1.7 \cdot 10^{+267}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;U + 0.3333333333333333 \cdot t_0\\
\end{array}
\end{array}
if l < -1.00000000000000006e136 or 2.95e25 < l < 2.00000000000000019e199 or 1.69999999999999991e267 < l Initial program 100.0%
Taylor expanded in l around 0 85.3%
associate-*r*85.3%
associate-*r*85.3%
associate-*r*85.3%
associate-*r*85.3%
distribute-rgt-out85.3%
*-commutative85.3%
associate-*r*85.3%
*-commutative85.3%
associate-*r*85.3%
distribute-rgt-out85.3%
+-commutative85.3%
fma-def85.3%
Simplified85.3%
Taylor expanded in l around inf 85.3%
associate-*r*85.3%
Simplified85.3%
Taylor expanded in K around 0 77.3%
unpow277.3%
Simplified77.3%
if -1.00000000000000006e136 < l < -1.35e19Initial program 100.0%
Taylor expanded in K around 0 68.8%
Taylor expanded in J around inf 68.8%
if -1.35e19 < l < 1.49999999999999994e-38Initial program 73.9%
Taylor expanded in l around 0 99.9%
associate-*r*100.0%
associate-*r*100.0%
associate-*r*100.0%
associate-*r*100.0%
distribute-rgt-out100.0%
*-commutative100.0%
associate-*r*100.0%
*-commutative100.0%
associate-*r*100.0%
distribute-rgt-out100.0%
+-commutative100.0%
fma-def100.0%
Simplified100.0%
Taylor expanded in l around 0 100.0%
*-commutative100.0%
associate-*r*100.0%
Simplified100.0%
if 1.49999999999999994e-38 < l < 2.95e25Initial program 100.0%
Taylor expanded in K around 0 100.0%
if 2.00000000000000019e199 < l < 1.69999999999999991e267Initial program 100.0%
Taylor expanded in l around 0 100.0%
associate-*r*100.0%
associate-*r*100.0%
associate-*r*100.0%
associate-*r*100.0%
distribute-rgt-out100.0%
*-commutative100.0%
associate-*r*100.0%
*-commutative100.0%
associate-*r*100.0%
distribute-rgt-out100.0%
+-commutative100.0%
fma-def100.0%
Simplified100.0%
Taylor expanded in l around inf 100.0%
associate-*r*100.0%
Simplified100.0%
Taylor expanded in K around 0 84.6%
Final simplification88.4%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (* J (pow l 3.0)))
(t_1
(+
U
(* t_0 (+ 0.3333333333333333 (* (* K K) -0.041666666666666664)))))
(t_2 (* (- (exp l) (exp (- l))) J)))
(if (<= l -1.7e+132)
t_1
(if (<= l -1.35e+19)
t_2
(if (<= l 250.0)
(+ U (* J (* (cos (* K 0.5)) (* l 2.0))))
(if (<= l 2.95e+25)
t_2
(if (or (<= l 1e+195) (not (<= l 9.2e+268)))
t_1
(+ U (* 0.3333333333333333 t_0)))))))))
double code(double J, double l, double K, double U) {
double t_0 = J * pow(l, 3.0);
double t_1 = U + (t_0 * (0.3333333333333333 + ((K * K) * -0.041666666666666664)));
double t_2 = (exp(l) - exp(-l)) * J;
double tmp;
if (l <= -1.7e+132) {
tmp = t_1;
} else if (l <= -1.35e+19) {
tmp = t_2;
} else if (l <= 250.0) {
tmp = U + (J * (cos((K * 0.5)) * (l * 2.0)));
} else if (l <= 2.95e+25) {
tmp = t_2;
} else if ((l <= 1e+195) || !(l <= 9.2e+268)) {
tmp = t_1;
} else {
tmp = U + (0.3333333333333333 * 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) :: t_2
real(8) :: tmp
t_0 = j * (l ** 3.0d0)
t_1 = u + (t_0 * (0.3333333333333333d0 + ((k * k) * (-0.041666666666666664d0))))
t_2 = (exp(l) - exp(-l)) * j
if (l <= (-1.7d+132)) then
tmp = t_1
else if (l <= (-1.35d+19)) then
tmp = t_2
else if (l <= 250.0d0) then
tmp = u + (j * (cos((k * 0.5d0)) * (l * 2.0d0)))
else if (l <= 2.95d+25) then
tmp = t_2
else if ((l <= 1d+195) .or. (.not. (l <= 9.2d+268))) then
tmp = t_1
else
tmp = u + (0.3333333333333333d0 * t_0)
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = J * Math.pow(l, 3.0);
double t_1 = U + (t_0 * (0.3333333333333333 + ((K * K) * -0.041666666666666664)));
double t_2 = (Math.exp(l) - Math.exp(-l)) * J;
double tmp;
if (l <= -1.7e+132) {
tmp = t_1;
} else if (l <= -1.35e+19) {
tmp = t_2;
} else if (l <= 250.0) {
tmp = U + (J * (Math.cos((K * 0.5)) * (l * 2.0)));
} else if (l <= 2.95e+25) {
tmp = t_2;
} else if ((l <= 1e+195) || !(l <= 9.2e+268)) {
tmp = t_1;
} else {
tmp = U + (0.3333333333333333 * t_0);
}
return tmp;
}
def code(J, l, K, U): t_0 = J * math.pow(l, 3.0) t_1 = U + (t_0 * (0.3333333333333333 + ((K * K) * -0.041666666666666664))) t_2 = (math.exp(l) - math.exp(-l)) * J tmp = 0 if l <= -1.7e+132: tmp = t_1 elif l <= -1.35e+19: tmp = t_2 elif l <= 250.0: tmp = U + (J * (math.cos((K * 0.5)) * (l * 2.0))) elif l <= 2.95e+25: tmp = t_2 elif (l <= 1e+195) or not (l <= 9.2e+268): tmp = t_1 else: tmp = U + (0.3333333333333333 * t_0) return tmp
function code(J, l, K, U) t_0 = Float64(J * (l ^ 3.0)) t_1 = Float64(U + Float64(t_0 * Float64(0.3333333333333333 + Float64(Float64(K * K) * -0.041666666666666664)))) t_2 = Float64(Float64(exp(l) - exp(Float64(-l))) * J) tmp = 0.0 if (l <= -1.7e+132) tmp = t_1; elseif (l <= -1.35e+19) tmp = t_2; elseif (l <= 250.0) tmp = Float64(U + Float64(J * Float64(cos(Float64(K * 0.5)) * Float64(l * 2.0)))); elseif (l <= 2.95e+25) tmp = t_2; elseif ((l <= 1e+195) || !(l <= 9.2e+268)) tmp = t_1; else tmp = Float64(U + Float64(0.3333333333333333 * t_0)); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = J * (l ^ 3.0); t_1 = U + (t_0 * (0.3333333333333333 + ((K * K) * -0.041666666666666664))); t_2 = (exp(l) - exp(-l)) * J; tmp = 0.0; if (l <= -1.7e+132) tmp = t_1; elseif (l <= -1.35e+19) tmp = t_2; elseif (l <= 250.0) tmp = U + (J * (cos((K * 0.5)) * (l * 2.0))); elseif (l <= 2.95e+25) tmp = t_2; elseif ((l <= 1e+195) || ~((l <= 9.2e+268))) tmp = t_1; else tmp = U + (0.3333333333333333 * t_0); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(J * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(U + N[(t$95$0 * N[(0.3333333333333333 + N[(N[(K * K), $MachinePrecision] * -0.041666666666666664), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision]}, If[LessEqual[l, -1.7e+132], t$95$1, If[LessEqual[l, -1.35e+19], t$95$2, If[LessEqual[l, 250.0], N[(U + N[(J * N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.95e+25], t$95$2, If[Or[LessEqual[l, 1e+195], N[Not[LessEqual[l, 9.2e+268]], $MachinePrecision]], t$95$1, N[(U + N[(0.3333333333333333 * t$95$0), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := J \cdot {\ell}^{3}\\
t_1 := U + t_0 \cdot \left(0.3333333333333333 + \left(K \cdot K\right) \cdot -0.041666666666666664\right)\\
t_2 := \left(e^{\ell} - e^{-\ell}\right) \cdot J\\
\mathbf{if}\;\ell \leq -1.7 \cdot 10^{+132}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\ell \leq -1.35 \cdot 10^{+19}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\ell \leq 250:\\
\;\;\;\;U + J \cdot \left(\cos \left(K \cdot 0.5\right) \cdot \left(\ell \cdot 2\right)\right)\\
\mathbf{elif}\;\ell \leq 2.95 \cdot 10^{+25}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\ell \leq 10^{+195} \lor \neg \left(\ell \leq 9.2 \cdot 10^{+268}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;U + 0.3333333333333333 \cdot t_0\\
\end{array}
\end{array}
if l < -1.70000000000000013e132 or 2.95e25 < l < 9.99999999999999977e194 or 9.20000000000000049e268 < l Initial program 100.0%
Taylor expanded in l around 0 85.3%
associate-*r*85.3%
associate-*r*85.3%
associate-*r*85.3%
associate-*r*85.3%
distribute-rgt-out85.3%
*-commutative85.3%
associate-*r*85.3%
*-commutative85.3%
associate-*r*85.3%
distribute-rgt-out85.3%
+-commutative85.3%
fma-def85.3%
Simplified85.3%
Taylor expanded in l around inf 85.3%
associate-*r*85.3%
Simplified85.3%
Taylor expanded in K around 0 77.3%
unpow277.3%
Simplified77.3%
if -1.70000000000000013e132 < l < -1.35e19 or 250 < l < 2.95e25Initial program 100.0%
Taylor expanded in K around 0 73.0%
Taylor expanded in J around inf 73.0%
if -1.35e19 < l < 250Initial program 75.3%
Taylor expanded in l around 0 99.9%
associate-*r*100.0%
associate-*r*100.0%
associate-*r*100.0%
associate-*r*100.0%
distribute-rgt-out100.0%
*-commutative100.0%
associate-*r*100.0%
*-commutative100.0%
associate-*r*100.0%
distribute-rgt-out100.0%
+-commutative100.0%
fma-def100.0%
Simplified100.0%
Taylor expanded in l around 0 100.0%
*-commutative100.0%
associate-*r*100.0%
Simplified100.0%
if 9.99999999999999977e194 < l < 9.20000000000000049e268Initial program 100.0%
Taylor expanded in l around 0 100.0%
associate-*r*100.0%
associate-*r*100.0%
associate-*r*100.0%
associate-*r*100.0%
distribute-rgt-out100.0%
*-commutative100.0%
associate-*r*100.0%
*-commutative100.0%
associate-*r*100.0%
distribute-rgt-out100.0%
+-commutative100.0%
fma-def100.0%
Simplified100.0%
Taylor expanded in l around inf 100.0%
associate-*r*100.0%
Simplified100.0%
Taylor expanded in K around 0 84.6%
Final simplification88.4%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.015) (+ U (* K (* -0.25 (* K (* l J))))) (+ U (* 0.3333333333333333 (* J (pow l 3.0))))))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.015) {
tmp = U + (K * (-0.25 * (K * (l * J))));
} 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 (cos((k / 2.0d0)) <= (-0.015d0)) then
tmp = u + (k * ((-0.25d0) * (k * (l * j))))
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 (Math.cos((K / 2.0)) <= -0.015) {
tmp = U + (K * (-0.25 * (K * (l * J))));
} else {
tmp = U + (0.3333333333333333 * (J * Math.pow(l, 3.0)));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if math.cos((K / 2.0)) <= -0.015: tmp = U + (K * (-0.25 * (K * (l * J)))) else: tmp = U + (0.3333333333333333 * (J * math.pow(l, 3.0))) return tmp
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.015) tmp = Float64(U + Float64(K * Float64(-0.25 * Float64(K * Float64(l * J))))); 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 (cos((K / 2.0)) <= -0.015) tmp = U + (K * (-0.25 * (K * (l * J)))); else tmp = U + (0.3333333333333333 * (J * (l ^ 3.0))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.015], N[(U + N[(K * N[(-0.25 * N[(K * N[(l * J), $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}\;\cos \left(\frac{K}{2}\right) \leq -0.015:\\
\;\;\;\;U + K \cdot \left(-0.25 \cdot \left(K \cdot \left(\ell \cdot J\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + 0.3333333333333333 \cdot \left(J \cdot {\ell}^{3}\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K 2)) < -0.014999999999999999Initial program 91.4%
Taylor expanded in l around 0 50.7%
Taylor expanded in K around 0 35.1%
+-commutative35.1%
associate-*r*35.1%
distribute-rgt-out45.7%
*-commutative45.7%
unpow245.7%
Simplified45.7%
Taylor expanded in K around inf 45.7%
associate-*r*45.7%
*-commutative45.7%
unpow245.7%
associate-*r*45.7%
associate-*l*53.7%
*-commutative53.7%
associate-*l*53.7%
Simplified53.7%
if -0.014999999999999999 < (cos.f64 (/.f64 K 2)) Initial program 86.1%
Taylor expanded in l around 0 88.7%
associate-*r*88.8%
associate-*r*88.8%
associate-*r*88.8%
associate-*r*88.8%
distribute-rgt-out88.8%
*-commutative88.8%
associate-*r*88.8%
*-commutative88.8%
associate-*r*88.8%
distribute-rgt-out88.8%
+-commutative88.8%
fma-def88.8%
Simplified88.8%
Taylor expanded in l around inf 75.0%
associate-*r*75.0%
Simplified75.0%
Taylor expanded in K around 0 75.0%
Final simplification68.7%
(FPCore (J l K U) :precision binary64 (if (or (<= J -3.2e-18) (not (<= J 7.2e+96))) (+ U (* J (* (cos (* K 0.5)) (* l 2.0)))) (+ U (* 0.3333333333333333 (* J (pow l 3.0))))))
double code(double J, double l, double K, double U) {
double tmp;
if ((J <= -3.2e-18) || !(J <= 7.2e+96)) {
tmp = U + (J * (cos((K * 0.5)) * (l * 2.0)));
} 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 <= (-3.2d-18)) .or. (.not. (j <= 7.2d+96))) then
tmp = u + (j * (cos((k * 0.5d0)) * (l * 2.0d0)))
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 <= -3.2e-18) || !(J <= 7.2e+96)) {
tmp = U + (J * (Math.cos((K * 0.5)) * (l * 2.0)));
} else {
tmp = U + (0.3333333333333333 * (J * Math.pow(l, 3.0)));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (J <= -3.2e-18) or not (J <= 7.2e+96): tmp = U + (J * (math.cos((K * 0.5)) * (l * 2.0))) else: tmp = U + (0.3333333333333333 * (J * math.pow(l, 3.0))) return tmp
function code(J, l, K, U) tmp = 0.0 if ((J <= -3.2e-18) || !(J <= 7.2e+96)) tmp = Float64(U + Float64(J * Float64(cos(Float64(K * 0.5)) * Float64(l * 2.0)))); 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 <= -3.2e-18) || ~((J <= 7.2e+96))) tmp = U + (J * (cos((K * 0.5)) * (l * 2.0))); else tmp = U + (0.3333333333333333 * (J * (l ^ 3.0))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[J, -3.2e-18], N[Not[LessEqual[J, 7.2e+96]], $MachinePrecision]], N[(U + N[(J * N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * N[(l * 2.0), $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 -3.2 \cdot 10^{-18} \lor \neg \left(J \leq 7.2 \cdot 10^{+96}\right):\\
\;\;\;\;U + J \cdot \left(\cos \left(K \cdot 0.5\right) \cdot \left(\ell \cdot 2\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + 0.3333333333333333 \cdot \left(J \cdot {\ell}^{3}\right)\\
\end{array}
\end{array}
if J < -3.1999999999999999e-18 or 7.20000000000000026e96 < J Initial program 72.8%
Taylor expanded in l around 0 96.3%
associate-*r*96.4%
associate-*r*96.4%
associate-*r*96.4%
associate-*r*96.4%
distribute-rgt-out96.4%
*-commutative96.4%
associate-*r*96.4%
*-commutative96.4%
associate-*r*96.4%
distribute-rgt-out96.4%
+-commutative96.4%
fma-def96.4%
Simplified96.4%
Taylor expanded in l around 0 88.1%
*-commutative88.1%
associate-*r*88.1%
Simplified88.1%
if -3.1999999999999999e-18 < J < 7.20000000000000026e96Initial program 97.7%
Taylor expanded in l around 0 79.8%
associate-*r*79.8%
associate-*r*79.8%
associate-*r*79.8%
associate-*r*79.8%
distribute-rgt-out79.8%
*-commutative79.8%
associate-*r*79.8%
*-commutative79.8%
associate-*r*79.8%
distribute-rgt-out79.8%
+-commutative79.8%
fma-def79.8%
Simplified79.8%
Taylor expanded in l around inf 77.5%
associate-*r*77.5%
Simplified77.5%
Taylor expanded in K around 0 64.3%
Final simplification73.9%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (+ U (* (* l J) (+ 2.0 (* (* K K) -0.25))))))
(if (<= l -6.5e+20)
t_0
(if (<= l 1e+25)
(fma l (* J 2.0) U)
(if (or (<= l 1.75e+202) (not (<= l 1.1e+263)))
t_0
(+ U (* J (+ (* (* K K) 0.0625) -0.5))))))))
double code(double J, double l, double K, double U) {
double t_0 = U + ((l * J) * (2.0 + ((K * K) * -0.25)));
double tmp;
if (l <= -6.5e+20) {
tmp = t_0;
} else if (l <= 1e+25) {
tmp = fma(l, (J * 2.0), U);
} else if ((l <= 1.75e+202) || !(l <= 1.1e+263)) {
tmp = t_0;
} else {
tmp = U + (J * (((K * K) * 0.0625) + -0.5));
}
return tmp;
}
function code(J, l, K, U) t_0 = Float64(U + Float64(Float64(l * J) * Float64(2.0 + Float64(Float64(K * K) * -0.25)))) tmp = 0.0 if (l <= -6.5e+20) tmp = t_0; elseif (l <= 1e+25) tmp = fma(l, Float64(J * 2.0), U); elseif ((l <= 1.75e+202) || !(l <= 1.1e+263)) tmp = t_0; else tmp = Float64(U + Float64(J * Float64(Float64(Float64(K * K) * 0.0625) + -0.5))); end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(U + N[(N[(l * J), $MachinePrecision] * N[(2.0 + N[(N[(K * K), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -6.5e+20], t$95$0, If[LessEqual[l, 1e+25], N[(l * N[(J * 2.0), $MachinePrecision] + U), $MachinePrecision], If[Or[LessEqual[l, 1.75e+202], N[Not[LessEqual[l, 1.1e+263]], $MachinePrecision]], t$95$0, N[(U + N[(J * N[(N[(N[(K * K), $MachinePrecision] * 0.0625), $MachinePrecision] + -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + \left(\ell \cdot J\right) \cdot \left(2 + \left(K \cdot K\right) \cdot -0.25\right)\\
\mathbf{if}\;\ell \leq -6.5 \cdot 10^{+20}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq 10^{+25}:\\
\;\;\;\;\mathsf{fma}\left(\ell, J \cdot 2, U\right)\\
\mathbf{elif}\;\ell \leq 1.75 \cdot 10^{+202} \lor \neg \left(\ell \leq 1.1 \cdot 10^{+263}\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(\left(K \cdot K\right) \cdot 0.0625 + -0.5\right)\\
\end{array}
\end{array}
if l < -6.5e20 or 1.00000000000000009e25 < l < 1.74999999999999994e202 or 1.1e263 < l Initial program 100.0%
Taylor expanded in l around 0 23.2%
Taylor expanded in K around 0 20.6%
+-commutative20.6%
associate-*r*20.6%
distribute-rgt-out34.3%
*-commutative34.3%
unpow234.3%
Simplified34.3%
if -6.5e20 < l < 1.00000000000000009e25Initial program 76.4%
Taylor expanded in l around 0 95.6%
Taylor expanded in K around 0 85.8%
*-commutative85.8%
associate-*r*85.8%
fma-def85.8%
*-commutative85.8%
Simplified85.8%
if 1.74999999999999994e202 < l < 1.1e263Initial program 100.0%
Applied egg-rr1.5%
Taylor expanded in K around 0 47.1%
associate-*r*47.1%
distribute-rgt-out47.1%
*-commutative47.1%
unpow247.1%
Simplified47.1%
Final simplification61.9%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (+ U (* (* l J) (+ 2.0 (* (* K K) -0.25))))))
(if (<= l -8.2e+20)
t_0
(if (<= l 7.3e+24)
(+ U (* l (* J 2.0)))
(if (or (<= l 1.72e+202) (not (<= l 1.1e+263)))
t_0
(+ U (* J (+ (* (* K K) 0.0625) -0.5))))))))
double code(double J, double l, double K, double U) {
double t_0 = U + ((l * J) * (2.0 + ((K * K) * -0.25)));
double tmp;
if (l <= -8.2e+20) {
tmp = t_0;
} else if (l <= 7.3e+24) {
tmp = U + (l * (J * 2.0));
} else if ((l <= 1.72e+202) || !(l <= 1.1e+263)) {
tmp = t_0;
} else {
tmp = U + (J * (((K * K) * 0.0625) + -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) :: t_0
real(8) :: tmp
t_0 = u + ((l * j) * (2.0d0 + ((k * k) * (-0.25d0))))
if (l <= (-8.2d+20)) then
tmp = t_0
else if (l <= 7.3d+24) then
tmp = u + (l * (j * 2.0d0))
else if ((l <= 1.72d+202) .or. (.not. (l <= 1.1d+263))) then
tmp = t_0
else
tmp = u + (j * (((k * k) * 0.0625d0) + (-0.5d0)))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = U + ((l * J) * (2.0 + ((K * K) * -0.25)));
double tmp;
if (l <= -8.2e+20) {
tmp = t_0;
} else if (l <= 7.3e+24) {
tmp = U + (l * (J * 2.0));
} else if ((l <= 1.72e+202) || !(l <= 1.1e+263)) {
tmp = t_0;
} else {
tmp = U + (J * (((K * K) * 0.0625) + -0.5));
}
return tmp;
}
def code(J, l, K, U): t_0 = U + ((l * J) * (2.0 + ((K * K) * -0.25))) tmp = 0 if l <= -8.2e+20: tmp = t_0 elif l <= 7.3e+24: tmp = U + (l * (J * 2.0)) elif (l <= 1.72e+202) or not (l <= 1.1e+263): tmp = t_0 else: tmp = U + (J * (((K * K) * 0.0625) + -0.5)) return tmp
function code(J, l, K, U) t_0 = Float64(U + Float64(Float64(l * J) * Float64(2.0 + Float64(Float64(K * K) * -0.25)))) tmp = 0.0 if (l <= -8.2e+20) tmp = t_0; elseif (l <= 7.3e+24) tmp = Float64(U + Float64(l * Float64(J * 2.0))); elseif ((l <= 1.72e+202) || !(l <= 1.1e+263)) tmp = t_0; else tmp = Float64(U + Float64(J * Float64(Float64(Float64(K * K) * 0.0625) + -0.5))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = U + ((l * J) * (2.0 + ((K * K) * -0.25))); tmp = 0.0; if (l <= -8.2e+20) tmp = t_0; elseif (l <= 7.3e+24) tmp = U + (l * (J * 2.0)); elseif ((l <= 1.72e+202) || ~((l <= 1.1e+263))) tmp = t_0; else tmp = U + (J * (((K * K) * 0.0625) + -0.5)); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(U + N[(N[(l * J), $MachinePrecision] * N[(2.0 + N[(N[(K * K), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -8.2e+20], t$95$0, If[LessEqual[l, 7.3e+24], N[(U + N[(l * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[l, 1.72e+202], N[Not[LessEqual[l, 1.1e+263]], $MachinePrecision]], t$95$0, N[(U + N[(J * N[(N[(N[(K * K), $MachinePrecision] * 0.0625), $MachinePrecision] + -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + \left(\ell \cdot J\right) \cdot \left(2 + \left(K \cdot K\right) \cdot -0.25\right)\\
\mathbf{if}\;\ell \leq -8.2 \cdot 10^{+20}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq 7.3 \cdot 10^{+24}:\\
\;\;\;\;U + \ell \cdot \left(J \cdot 2\right)\\
\mathbf{elif}\;\ell \leq 1.72 \cdot 10^{+202} \lor \neg \left(\ell \leq 1.1 \cdot 10^{+263}\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(\left(K \cdot K\right) \cdot 0.0625 + -0.5\right)\\
\end{array}
\end{array}
if l < -8.2e20 or 7.29999999999999982e24 < l < 1.71999999999999996e202 or 1.1e263 < l Initial program 100.0%
Taylor expanded in l around 0 23.2%
Taylor expanded in K around 0 20.6%
+-commutative20.6%
associate-*r*20.6%
distribute-rgt-out34.3%
*-commutative34.3%
unpow234.3%
Simplified34.3%
if -8.2e20 < l < 7.29999999999999982e24Initial program 76.4%
Taylor expanded in l around 0 95.6%
Taylor expanded in K around 0 85.8%
*-commutative85.8%
associate-*r*85.8%
*-commutative85.8%
Simplified85.8%
if 1.71999999999999996e202 < l < 1.1e263Initial program 100.0%
Applied egg-rr1.5%
Taylor expanded in K around 0 47.1%
associate-*r*47.1%
distribute-rgt-out47.1%
*-commutative47.1%
unpow247.1%
Simplified47.1%
Final simplification61.9%
(FPCore (J l K U) :precision binary64 (if (or (<= J 1.1e-308) (not (<= J 1.7e-232))) (+ U (* l (* J 2.0))) (+ U (* J (+ (* (* K K) 0.0625) -0.5)))))
double code(double J, double l, double K, double U) {
double tmp;
if ((J <= 1.1e-308) || !(J <= 1.7e-232)) {
tmp = U + (l * (J * 2.0));
} else {
tmp = U + (J * (((K * K) * 0.0625) + -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 ((j <= 1.1d-308) .or. (.not. (j <= 1.7d-232))) then
tmp = u + (l * (j * 2.0d0))
else
tmp = u + (j * (((k * k) * 0.0625d0) + (-0.5d0)))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if ((J <= 1.1e-308) || !(J <= 1.7e-232)) {
tmp = U + (l * (J * 2.0));
} else {
tmp = U + (J * (((K * K) * 0.0625) + -0.5));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (J <= 1.1e-308) or not (J <= 1.7e-232): tmp = U + (l * (J * 2.0)) else: tmp = U + (J * (((K * K) * 0.0625) + -0.5)) return tmp
function code(J, l, K, U) tmp = 0.0 if ((J <= 1.1e-308) || !(J <= 1.7e-232)) tmp = Float64(U + Float64(l * Float64(J * 2.0))); else tmp = Float64(U + Float64(J * Float64(Float64(Float64(K * K) * 0.0625) + -0.5))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((J <= 1.1e-308) || ~((J <= 1.7e-232))) tmp = U + (l * (J * 2.0)); else tmp = U + (J * (((K * K) * 0.0625) + -0.5)); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[J, 1.1e-308], N[Not[LessEqual[J, 1.7e-232]], $MachinePrecision]], N[(U + N[(l * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * N[(N[(N[(K * K), $MachinePrecision] * 0.0625), $MachinePrecision] + -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;J \leq 1.1 \cdot 10^{-308} \lor \neg \left(J \leq 1.7 \cdot 10^{-232}\right):\\
\;\;\;\;U + \ell \cdot \left(J \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(\left(K \cdot K\right) \cdot 0.0625 + -0.5\right)\\
\end{array}
\end{array}
if J < 1.1000000000000001e-308 or 1.7000000000000001e-232 < J Initial program 86.7%
Taylor expanded in l around 0 64.9%
Taylor expanded in K around 0 55.7%
*-commutative55.7%
associate-*r*55.7%
*-commutative55.7%
Simplified55.7%
if 1.1000000000000001e-308 < J < 1.7000000000000001e-232Initial program 100.0%
Applied egg-rr19.0%
Taylor expanded in K around 0 57.1%
associate-*r*57.1%
distribute-rgt-out57.1%
*-commutative57.1%
unpow257.1%
Simplified57.1%
Final simplification55.8%
(FPCore (J l K U) :precision binary64 (if (or (<= J -9e-210) (not (<= J 5.4e+59))) (+ U (* l (* J 2.0))) (+ U (* K (* -0.25 (* K (* l J)))))))
double code(double J, double l, double K, double U) {
double tmp;
if ((J <= -9e-210) || !(J <= 5.4e+59)) {
tmp = U + (l * (J * 2.0));
} else {
tmp = U + (K * (-0.25 * (K * (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 ((j <= (-9d-210)) .or. (.not. (j <= 5.4d+59))) then
tmp = u + (l * (j * 2.0d0))
else
tmp = u + (k * ((-0.25d0) * (k * (l * j))))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if ((J <= -9e-210) || !(J <= 5.4e+59)) {
tmp = U + (l * (J * 2.0));
} else {
tmp = U + (K * (-0.25 * (K * (l * J))));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (J <= -9e-210) or not (J <= 5.4e+59): tmp = U + (l * (J * 2.0)) else: tmp = U + (K * (-0.25 * (K * (l * J)))) return tmp
function code(J, l, K, U) tmp = 0.0 if ((J <= -9e-210) || !(J <= 5.4e+59)) tmp = Float64(U + Float64(l * Float64(J * 2.0))); else tmp = Float64(U + Float64(K * Float64(-0.25 * Float64(K * Float64(l * J))))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((J <= -9e-210) || ~((J <= 5.4e+59))) tmp = U + (l * (J * 2.0)); else tmp = U + (K * (-0.25 * (K * (l * J)))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[J, -9e-210], N[Not[LessEqual[J, 5.4e+59]], $MachinePrecision]], N[(U + N[(l * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(K * N[(-0.25 * N[(K * N[(l * J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;J \leq -9 \cdot 10^{-210} \lor \neg \left(J \leq 5.4 \cdot 10^{+59}\right):\\
\;\;\;\;U + \ell \cdot \left(J \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;U + K \cdot \left(-0.25 \cdot \left(K \cdot \left(\ell \cdot J\right)\right)\right)\\
\end{array}
\end{array}
if J < -9.00000000000000039e-210 or 5.4000000000000002e59 < J Initial program 80.6%
Taylor expanded in l around 0 76.5%
Taylor expanded in K around 0 63.7%
*-commutative63.7%
associate-*r*63.7%
*-commutative63.7%
Simplified63.7%
if -9.00000000000000039e-210 < J < 5.4000000000000002e59Initial program 97.7%
Taylor expanded in l around 0 40.7%
Taylor expanded in K around 0 44.7%
+-commutative44.7%
associate-*r*44.7%
distribute-rgt-out44.7%
*-commutative44.7%
unpow244.7%
Simplified44.7%
Taylor expanded in K around inf 44.5%
associate-*r*44.5%
*-commutative44.5%
unpow244.5%
associate-*r*44.5%
associate-*l*50.2%
*-commutative50.2%
associate-*l*50.2%
Simplified50.2%
Final simplification58.1%
(FPCore (J l K U) :precision binary64 (if (or (<= l -980.0) (not (<= l 700.0))) (+ U (* (* U U) 18014398509481984.0)) U))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -980.0) || !(l <= 700.0)) {
tmp = U + ((U * U) * 18014398509481984.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 <= (-980.0d0)) .or. (.not. (l <= 700.0d0))) then
tmp = u + ((u * u) * 18014398509481984.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 <= -980.0) || !(l <= 700.0)) {
tmp = U + ((U * U) * 18014398509481984.0);
} else {
tmp = U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -980.0) or not (l <= 700.0): tmp = U + ((U * U) * 18014398509481984.0) else: tmp = U return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -980.0) || !(l <= 700.0)) tmp = Float64(U + Float64(Float64(U * U) * 18014398509481984.0)); else tmp = U; end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -980.0) || ~((l <= 700.0))) tmp = U + ((U * U) * 18014398509481984.0); else tmp = U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -980.0], N[Not[LessEqual[l, 700.0]], $MachinePrecision]], N[(U + N[(N[(U * U), $MachinePrecision] * 18014398509481984.0), $MachinePrecision]), $MachinePrecision], U]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -980 \lor \neg \left(\ell \leq 700\right):\\
\;\;\;\;U + \left(U \cdot U\right) \cdot 18014398509481984\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\end{array}
if l < -980 or 700 < l Initial program 100.0%
Taylor expanded in K around 0 63.6%
Applied egg-rr15.0%
fma-udef15.0%
+-commutative15.0%
swap-sqr15.0%
*-commutative15.0%
metadata-eval15.0%
Simplified15.0%
if -980 < l < 700Initial program 75.1%
Taylor expanded in J around 0 75.1%
Final simplification44.8%
(FPCore (J l K U) :precision binary64 (if (<= l -1000.0) (* U U) (if (<= l 70000000000.0) U (* U U))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -1000.0) {
tmp = U * U;
} else if (l <= 70000000000.0) {
tmp = U;
} else {
tmp = U * U;
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if (l <= (-1000.0d0)) then
tmp = u * u
else if (l <= 70000000000.0d0) then
tmp = u
else
tmp = u * u
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (l <= -1000.0) {
tmp = U * U;
} else if (l <= 70000000000.0) {
tmp = U;
} else {
tmp = U * U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -1000.0: tmp = U * U elif l <= 70000000000.0: tmp = U else: tmp = U * U return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -1000.0) tmp = Float64(U * U); elseif (l <= 70000000000.0) tmp = U; else tmp = Float64(U * U); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -1000.0) tmp = U * U; elseif (l <= 70000000000.0) tmp = U; else tmp = U * U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -1000.0], N[(U * U), $MachinePrecision], If[LessEqual[l, 70000000000.0], U, N[(U * U), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1000:\\
\;\;\;\;U \cdot U\\
\mathbf{elif}\;\ell \leq 70000000000:\\
\;\;\;\;U\\
\mathbf{else}:\\
\;\;\;\;U \cdot U\\
\end{array}
\end{array}
if l < -1e3 or 7e10 < l Initial program 100.0%
Applied egg-rr13.7%
if -1e3 < l < 7e10Initial program 75.5%
Taylor expanded in J around 0 74.0%
Final simplification44.1%
(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 87.7%
Taylor expanded in l around 0 61.6%
Taylor expanded in K around 0 53.1%
*-commutative53.1%
associate-*r*53.1%
*-commutative53.1%
Simplified53.1%
Final simplification53.1%
(FPCore (J l K U) :precision binary64 -3.725290312339702e-9)
double code(double J, double l, double K, double U) {
return -3.725290312339702e-9;
}
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 = -3.725290312339702d-9
end function
public static double code(double J, double l, double K, double U) {
return -3.725290312339702e-9;
}
def code(J, l, K, U): return -3.725290312339702e-9
function code(J, l, K, U) return -3.725290312339702e-9 end
function tmp = code(J, l, K, U) tmp = -3.725290312339702e-9; end
code[J_, l_, K_, U_] := -3.725290312339702e-9
\begin{array}{l}
\\
-3.725290312339702 \cdot 10^{-9}
\end{array}
Initial program 87.7%
Taylor expanded in K around 0 69.3%
Applied egg-rr2.7%
associate-+r+2.7%
distribute-rgt1-in2.7%
distribute-rgt-out2.7%
associate-/r*2.7%
*-inverses2.7%
metadata-eval2.7%
metadata-eval2.7%
metadata-eval2.7%
Simplified2.7%
Final simplification2.7%
(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 87.7%
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 87.7%
Taylor expanded in J around 0 38.4%
Final simplification38.4%
herbie shell --seed 2023252
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))