
(FPCore (J l K U) :precision binary64 (+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))
double code(double J, double l, double K, double U) {
return ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = ((j * (exp(l) - exp(-l))) * cos((k / 2.0d0))) + u
end function
public static double code(double J, double l, double K, double U) {
return ((J * (Math.exp(l) - Math.exp(-l))) * Math.cos((K / 2.0))) + U;
}
def code(J, l, K, U): return ((J * (math.exp(l) - math.exp(-l))) * math.cos((K / 2.0))) + U
function code(J, l, K, U) return Float64(Float64(Float64(J * Float64(exp(l) - exp(Float64(-l)))) * cos(Float64(K / 2.0))) + U) end
function tmp = code(J, l, K, U) tmp = ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U; end
code[J_, l_, K_, U_] := N[(N[(N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]
\begin{array}{l}
\\
\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (J l K U) :precision binary64 (+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))
double code(double J, double l, double K, double U) {
return ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = ((j * (exp(l) - exp(-l))) * cos((k / 2.0d0))) + u
end function
public static double code(double J, double l, double K, double U) {
return ((J * (Math.exp(l) - Math.exp(-l))) * Math.cos((K / 2.0))) + U;
}
def code(J, l, K, U): return ((J * (math.exp(l) - math.exp(-l))) * math.cos((K / 2.0))) + U
function code(J, l, K, U) return Float64(Float64(Float64(J * Float64(exp(l) - exp(Float64(-l)))) * cos(Float64(K / 2.0))) + U) end
function tmp = code(J, l, K, U) tmp = ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U; end
code[J_, l_, K_, U_] := N[(N[(N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]
\begin{array}{l}
\\
\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U
\end{array}
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (- (exp l) (exp (- l)))) (t_1 (cos (/ K 2.0))))
(if (<= t_0 (- INFINITY))
(+ (* t_1 (* t_0 J)) U)
(if (<= t_0 5e-7)
(+ U (* t_1 (* J (+ (* 0.3333333333333333 (pow l 3.0)) (* l 2.0)))))
(fma J (* t_0 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 <= -((double) INFINITY)) {
tmp = (t_1 * (t_0 * J)) + U;
} else if (t_0 <= 5e-7) {
tmp = U + (t_1 * (J * ((0.3333333333333333 * pow(l, 3.0)) + (l * 2.0))));
} else {
tmp = fma(J, (t_0 * 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 <= Float64(-Inf)) tmp = Float64(Float64(t_1 * Float64(t_0 * J)) + U); elseif (t_0 <= 5e-7) tmp = Float64(U + Float64(t_1 * Float64(J * Float64(Float64(0.3333333333333333 * (l ^ 3.0)) + Float64(l * 2.0))))); else tmp = fma(J, Float64(t_0 * 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, (-Infinity)], N[(N[(t$95$1 * N[(t$95$0 * J), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], If[LessEqual[t$95$0, 5e-7], 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[(J * N[(t$95$0 * 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 -\infty:\\
\;\;\;\;t_1 \cdot \left(t_0 \cdot J\right) + U\\
\mathbf{elif}\;t_0 \leq 5 \cdot 10^{-7}:\\
\;\;\;\;U + t_1 \cdot \left(J \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(J, t_0 \cdot t_1, U\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -inf.0Initial program 100.0%
if -inf.0 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 4.99999999999999977e-7Initial program 73.9%
Taylor expanded in l around 0 99.9%
if 4.99999999999999977e-7 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 100.0%
associate-*l*100.0%
fma-def100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))) (t_1 (- (exp l) (exp (- l)))))
(if (or (<= t_1 (- INFINITY)) (not (<= t_1 5e-7)))
(+ (* 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 <= -((double) INFINITY)) || !(t_1 <= 5e-7)) {
tmp = (t_0 * (t_1 * J)) + U;
} else {
tmp = U + (t_0 * (J * ((0.3333333333333333 * pow(l, 3.0)) + (l * 2.0))));
}
return tmp;
}
public static double code(double J, double l, double K, double U) {
double t_0 = Math.cos((K / 2.0));
double t_1 = Math.exp(l) - Math.exp(-l);
double tmp;
if ((t_1 <= -Double.POSITIVE_INFINITY) || !(t_1 <= 5e-7)) {
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 <= -math.inf) or not (t_1 <= 5e-7): 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 <= Float64(-Inf)) || !(t_1 <= 5e-7)) 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 <= -Inf) || ~((t_1 <= 5e-7))) 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, (-Infinity)], N[Not[LessEqual[t$95$1, 5e-7]], $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 -\infty \lor \neg \left(t_1 \leq 5 \cdot 10^{-7}\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))) < -inf.0 or 4.99999999999999977e-7 < (-.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))) < 4.99999999999999977e-7Initial program 73.9%
Taylor expanded in l around 0 99.9%
Final simplification100.0%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (- (exp l) (exp (- l))))
(t_1 (cos (/ K 2.0)))
(t_2 (+ U (* t_1 (* (pow l 3.0) (* J 0.3333333333333333))))))
(if (<= l -4.5e+76)
t_2
(if (<= l -350.0)
(+ U (* t_0 (+ J (* -0.125 (* K (* J K))))))
(if (<= l 0.21)
(+ U (* t_1 (* J (+ (* 0.3333333333333333 (pow l 3.0)) (* l 2.0)))))
(if (<= l 4.5e+68) (+ U (* t_0 J)) t_2))))))
double code(double J, double l, double K, double U) {
double t_0 = exp(l) - exp(-l);
double t_1 = cos((K / 2.0));
double t_2 = U + (t_1 * (pow(l, 3.0) * (J * 0.3333333333333333)));
double tmp;
if (l <= -4.5e+76) {
tmp = t_2;
} else if (l <= -350.0) {
tmp = U + (t_0 * (J + (-0.125 * (K * (J * K)))));
} else if (l <= 0.21) {
tmp = U + (t_1 * (J * ((0.3333333333333333 * pow(l, 3.0)) + (l * 2.0))));
} else if (l <= 4.5e+68) {
tmp = U + (t_0 * J);
} else {
tmp = t_2;
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = exp(l) - exp(-l)
t_1 = cos((k / 2.0d0))
t_2 = u + (t_1 * ((l ** 3.0d0) * (j * 0.3333333333333333d0)))
if (l <= (-4.5d+76)) then
tmp = t_2
else if (l <= (-350.0d0)) then
tmp = u + (t_0 * (j + ((-0.125d0) * (k * (j * k)))))
else if (l <= 0.21d0) then
tmp = u + (t_1 * (j * ((0.3333333333333333d0 * (l ** 3.0d0)) + (l * 2.0d0))))
else if (l <= 4.5d+68) then
tmp = u + (t_0 * j)
else
tmp = t_2
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = Math.exp(l) - Math.exp(-l);
double t_1 = Math.cos((K / 2.0));
double t_2 = U + (t_1 * (Math.pow(l, 3.0) * (J * 0.3333333333333333)));
double tmp;
if (l <= -4.5e+76) {
tmp = t_2;
} else if (l <= -350.0) {
tmp = U + (t_0 * (J + (-0.125 * (K * (J * K)))));
} else if (l <= 0.21) {
tmp = U + (t_1 * (J * ((0.3333333333333333 * Math.pow(l, 3.0)) + (l * 2.0))));
} else if (l <= 4.5e+68) {
tmp = U + (t_0 * J);
} else {
tmp = t_2;
}
return tmp;
}
def code(J, l, K, U): t_0 = math.exp(l) - math.exp(-l) t_1 = math.cos((K / 2.0)) t_2 = U + (t_1 * (math.pow(l, 3.0) * (J * 0.3333333333333333))) tmp = 0 if l <= -4.5e+76: tmp = t_2 elif l <= -350.0: tmp = U + (t_0 * (J + (-0.125 * (K * (J * K))))) elif l <= 0.21: tmp = U + (t_1 * (J * ((0.3333333333333333 * math.pow(l, 3.0)) + (l * 2.0)))) elif l <= 4.5e+68: tmp = U + (t_0 * J) else: tmp = t_2 return tmp
function code(J, l, K, U) t_0 = Float64(exp(l) - exp(Float64(-l))) t_1 = cos(Float64(K / 2.0)) t_2 = Float64(U + Float64(t_1 * Float64((l ^ 3.0) * Float64(J * 0.3333333333333333)))) tmp = 0.0 if (l <= -4.5e+76) tmp = t_2; elseif (l <= -350.0) tmp = Float64(U + Float64(t_0 * Float64(J + Float64(-0.125 * Float64(K * Float64(J * K)))))); elseif (l <= 0.21) tmp = Float64(U + Float64(t_1 * Float64(J * Float64(Float64(0.3333333333333333 * (l ^ 3.0)) + Float64(l * 2.0))))); elseif (l <= 4.5e+68) tmp = Float64(U + Float64(t_0 * J)); else tmp = t_2; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = exp(l) - exp(-l); t_1 = cos((K / 2.0)); t_2 = U + (t_1 * ((l ^ 3.0) * (J * 0.3333333333333333))); tmp = 0.0; if (l <= -4.5e+76) tmp = t_2; elseif (l <= -350.0) tmp = U + (t_0 * (J + (-0.125 * (K * (J * K))))); elseif (l <= 0.21) tmp = U + (t_1 * (J * ((0.3333333333333333 * (l ^ 3.0)) + (l * 2.0)))); elseif (l <= 4.5e+68) tmp = U + (t_0 * J); else tmp = t_2; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(U + N[(t$95$1 * N[(N[Power[l, 3.0], $MachinePrecision] * N[(J * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -4.5e+76], t$95$2, If[LessEqual[l, -350.0], N[(U + N[(t$95$0 * N[(J + N[(-0.125 * N[(K * N[(J * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 0.21], N[(U + N[(t$95$1 * N[(J * N[(N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision] + N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 4.5e+68], N[(U + N[(t$95$0 * J), $MachinePrecision]), $MachinePrecision], t$95$2]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{\ell} - e^{-\ell}\\
t_1 := \cos \left(\frac{K}{2}\right)\\
t_2 := U + t_1 \cdot \left({\ell}^{3} \cdot \left(J \cdot 0.3333333333333333\right)\right)\\
\mathbf{if}\;\ell \leq -4.5 \cdot 10^{+76}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\ell \leq -350:\\
\;\;\;\;U + t_0 \cdot \left(J + -0.125 \cdot \left(K \cdot \left(J \cdot K\right)\right)\right)\\
\mathbf{elif}\;\ell \leq 0.21:\\
\;\;\;\;U + t_1 \cdot \left(J \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right)\right)\\
\mathbf{elif}\;\ell \leq 4.5 \cdot 10^{+68}:\\
\;\;\;\;U + t_0 \cdot J\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if l < -4.4999999999999997e76 or 4.5000000000000003e68 < l Initial program 100.0%
Taylor expanded in l around 0 95.8%
Taylor expanded in l around inf 95.8%
associate-*r*95.8%
*-commutative95.8%
associate-*r*95.8%
Simplified95.8%
if -4.4999999999999997e76 < l < -350Initial program 100.0%
Taylor expanded in K around 0 0.0%
*-commutative0.0%
associate-*r*0.0%
*-commutative0.0%
associate-*r*0.0%
distribute-rgt-out85.7%
associate-*l*85.7%
unpow285.7%
associate-*l*85.7%
Simplified85.7%
if -350 < l < 0.209999999999999992Initial program 73.9%
Taylor expanded in l around 0 99.9%
if 0.209999999999999992 < l < 4.5000000000000003e68Initial program 99.9%
Taylor expanded in K around 0 74.8%
Final simplification96.2%
(FPCore (J l K U)
:precision binary64
(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 -2.7e+99)
t_0
(if (<= l -340.0)
t_1
(if (<= l 0.0062)
(+ U (* 2.0 (* l (* J (cos (* K 0.5))))))
(if (<= l 4.5e+68) 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 <= -2.7e+99) {
tmp = t_0;
} else if (l <= -340.0) {
tmp = t_1;
} else if (l <= 0.0062) {
tmp = U + (2.0 * (l * (J * cos((K * 0.5)))));
} else if (l <= 4.5e+68) {
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 <= (-2.7d+99)) then
tmp = t_0
else if (l <= (-340.0d0)) then
tmp = t_1
else if (l <= 0.0062d0) then
tmp = u + (2.0d0 * (l * (j * cos((k * 0.5d0)))))
else if (l <= 4.5d+68) 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 <= -2.7e+99) {
tmp = t_0;
} else if (l <= -340.0) {
tmp = t_1;
} else if (l <= 0.0062) {
tmp = U + (2.0 * (l * (J * Math.cos((K * 0.5)))));
} else if (l <= 4.5e+68) {
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 <= -2.7e+99: tmp = t_0 elif l <= -340.0: tmp = t_1 elif l <= 0.0062: tmp = U + (2.0 * (l * (J * math.cos((K * 0.5))))) elif l <= 4.5e+68: 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 <= -2.7e+99) tmp = t_0; elseif (l <= -340.0) tmp = t_1; elseif (l <= 0.0062) tmp = Float64(U + Float64(2.0 * Float64(l * Float64(J * cos(Float64(K * 0.5)))))); elseif (l <= 4.5e+68) 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 <= -2.7e+99) tmp = t_0; elseif (l <= -340.0) tmp = t_1; elseif (l <= 0.0062) tmp = U + (2.0 * (l * (J * cos((K * 0.5))))); elseif (l <= 4.5e+68) 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, -2.7e+99], t$95$0, If[LessEqual[l, -340.0], t$95$1, If[LessEqual[l, 0.0062], N[(U + N[(2.0 * N[(l * N[(J * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 4.5e+68], 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 -2.7 \cdot 10^{+99}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq -340:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\ell \leq 0.0062:\\
\;\;\;\;U + 2 \cdot \left(\ell \cdot \left(J \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\mathbf{elif}\;\ell \leq 4.5 \cdot 10^{+68}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if l < -2.69999999999999989e99 or 4.5000000000000003e68 < l Initial program 100.0%
Taylor expanded in l around 0 96.6%
Taylor expanded in l around inf 96.6%
associate-*r*96.6%
*-commutative96.6%
associate-*r*96.6%
Simplified96.6%
if -2.69999999999999989e99 < l < -340 or 0.00619999999999999978 < l < 4.5000000000000003e68Initial program 100.0%
Taylor expanded in K around 0 74.2%
if -340 < l < 0.00619999999999999978Initial program 73.9%
Taylor expanded in l around 0 99.9%
associate-*r*99.9%
*-commutative99.9%
associate-*l*99.9%
Simplified99.9%
Final simplification95.4%
(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 -6e+244)
t_0
(if (<= l -340.0)
t_1
(if (<= l 0.0033)
(+ U (* 2.0 (* l (* J (cos (* K 0.5))))))
(if (<= l 2e+137) 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 <= -6e+244) {
tmp = t_0;
} else if (l <= -340.0) {
tmp = t_1;
} else if (l <= 0.0033) {
tmp = U + (2.0 * (l * (J * cos((K * 0.5)))));
} else if (l <= 2e+137) {
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 <= (-6d+244)) then
tmp = t_0
else if (l <= (-340.0d0)) then
tmp = t_1
else if (l <= 0.0033d0) then
tmp = u + (2.0d0 * (l * (j * cos((k * 0.5d0)))))
else if (l <= 2d+137) 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 <= -6e+244) {
tmp = t_0;
} else if (l <= -340.0) {
tmp = t_1;
} else if (l <= 0.0033) {
tmp = U + (2.0 * (l * (J * Math.cos((K * 0.5)))));
} else if (l <= 2e+137) {
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 <= -6e+244: tmp = t_0 elif l <= -340.0: tmp = t_1 elif l <= 0.0033: tmp = U + (2.0 * (l * (J * math.cos((K * 0.5))))) elif l <= 2e+137: 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(K * Float64(K * -0.041666666666666664))))) t_1 = Float64(U + Float64(Float64(exp(l) - exp(Float64(-l))) * J)) tmp = 0.0 if (l <= -6e+244) tmp = t_0; elseif (l <= -340.0) tmp = t_1; elseif (l <= 0.0033) tmp = Float64(U + Float64(2.0 * Float64(l * Float64(J * cos(Float64(K * 0.5)))))); elseif (l <= 2e+137) 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 <= -6e+244) tmp = t_0; elseif (l <= -340.0) tmp = t_1; elseif (l <= 0.0033) tmp = U + (2.0 * (l * (J * cos((K * 0.5))))); elseif (l <= 2e+137) 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[(K * N[(K * -0.041666666666666664), $MachinePrecision]), $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, -6e+244], t$95$0, If[LessEqual[l, -340.0], t$95$1, If[LessEqual[l, 0.0033], N[(U + N[(2.0 * N[(l * N[(J * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2e+137], 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 + K \cdot \left(K \cdot -0.041666666666666664\right)\right)\\
t_1 := U + \left(e^{\ell} - e^{-\ell}\right) \cdot J\\
\mathbf{if}\;\ell \leq -6 \cdot 10^{+244}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq -340:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\ell \leq 0.0033:\\
\;\;\;\;U + 2 \cdot \left(\ell \cdot \left(J \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\mathbf{elif}\;\ell \leq 2 \cdot 10^{+137}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if l < -5.9999999999999995e244 or 2.0000000000000001e137 < 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-*r*100.0%
Simplified100.0%
Taylor expanded in K around 0 0.0%
+-commutative0.0%
unpow20.0%
associate-*r*0.0%
distribute-rgt-out86.4%
associate-*r*86.4%
Simplified86.4%
if -5.9999999999999995e244 < l < -340 or 0.0033 < l < 2.0000000000000001e137Initial program 100.0%
Taylor expanded in K around 0 76.9%
if -340 < l < 0.0033Initial program 73.9%
Taylor expanded in l around 0 99.9%
associate-*r*99.9%
*-commutative99.9%
associate-*l*99.9%
Simplified99.9%
Final simplification90.7%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.002) (+ U (* 2.0 (* l (* J (cos (* K 0.5)))))) (+ U (* J (+ (* 0.3333333333333333 (pow l 3.0)) (* l 2.0))))))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.002) {
tmp = U + (2.0 * (l * (J * cos((K * 0.5)))));
} else {
tmp = U + (J * ((0.3333333333333333 * pow(l, 3.0)) + (l * 2.0)));
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if (cos((k / 2.0d0)) <= (-0.002d0)) then
tmp = u + (2.0d0 * (l * (j * cos((k * 0.5d0)))))
else
tmp = u + (j * ((0.3333333333333333d0 * (l ** 3.0d0)) + (l * 2.0d0)))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (Math.cos((K / 2.0)) <= -0.002) {
tmp = U + (2.0 * (l * (J * Math.cos((K * 0.5)))));
} else {
tmp = U + (J * ((0.3333333333333333 * Math.pow(l, 3.0)) + (l * 2.0)));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if math.cos((K / 2.0)) <= -0.002: tmp = U + (2.0 * (l * (J * math.cos((K * 0.5))))) else: tmp = U + (J * ((0.3333333333333333 * math.pow(l, 3.0)) + (l * 2.0))) return tmp
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.002) tmp = Float64(U + Float64(2.0 * Float64(l * Float64(J * cos(Float64(K * 0.5)))))); else tmp = Float64(U + Float64(J * Float64(Float64(0.3333333333333333 * (l ^ 3.0)) + Float64(l * 2.0)))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (cos((K / 2.0)) <= -0.002) tmp = U + (2.0 * (l * (J * cos((K * 0.5))))); else tmp = U + (J * ((0.3333333333333333 * (l ^ 3.0)) + (l * 2.0))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.002], N[(U + N[(2.0 * N[(l * N[(J * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * N[(N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision] + N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.002:\\
\;\;\;\;U + 2 \cdot \left(\ell \cdot \left(J \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K 2)) < -2e-3Initial program 86.4%
Taylor expanded in l around 0 69.0%
associate-*r*69.0%
*-commutative69.0%
associate-*l*69.0%
Simplified69.0%
if -2e-3 < (cos.f64 (/.f64 K 2)) Initial program 86.2%
Taylor expanded in K around 0 85.6%
Taylor expanded in l around 0 86.4%
Final simplification81.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 86.2%
Taylor expanded in l around 0 89.6%
Final simplification89.6%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (+ U (* 2.0 (* l (* J (cos (* K 0.5))))))))
(if (<= l -9.6e+242)
t_0
(if (<= l -1.02e+39)
(+ U (fabs (* K (* J K))))
(if (<= l 620.0) t_0 (+ U (* (* l J) (+ 2.0 (* (* K K) -0.25)))))))))
double code(double J, double l, double K, double U) {
double t_0 = U + (2.0 * (l * (J * cos((K * 0.5)))));
double tmp;
if (l <= -9.6e+242) {
tmp = t_0;
} else if (l <= -1.02e+39) {
tmp = U + fabs((K * (J * K)));
} else if (l <= 620.0) {
tmp = t_0;
} else {
tmp = U + ((l * J) * (2.0 + ((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) :: t_0
real(8) :: tmp
t_0 = u + (2.0d0 * (l * (j * cos((k * 0.5d0)))))
if (l <= (-9.6d+242)) then
tmp = t_0
else if (l <= (-1.02d+39)) then
tmp = u + abs((k * (j * k)))
else if (l <= 620.0d0) then
tmp = t_0
else
tmp = u + ((l * j) * (2.0d0 + ((k * k) * (-0.25d0))))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = U + (2.0 * (l * (J * Math.cos((K * 0.5)))));
double tmp;
if (l <= -9.6e+242) {
tmp = t_0;
} else if (l <= -1.02e+39) {
tmp = U + Math.abs((K * (J * K)));
} else if (l <= 620.0) {
tmp = t_0;
} else {
tmp = U + ((l * J) * (2.0 + ((K * K) * -0.25)));
}
return tmp;
}
def code(J, l, K, U): t_0 = U + (2.0 * (l * (J * math.cos((K * 0.5))))) tmp = 0 if l <= -9.6e+242: tmp = t_0 elif l <= -1.02e+39: tmp = U + math.fabs((K * (J * K))) elif l <= 620.0: tmp = t_0 else: tmp = U + ((l * J) * (2.0 + ((K * K) * -0.25))) return tmp
function code(J, l, K, U) t_0 = Float64(U + Float64(2.0 * Float64(l * Float64(J * cos(Float64(K * 0.5)))))) tmp = 0.0 if (l <= -9.6e+242) tmp = t_0; elseif (l <= -1.02e+39) tmp = Float64(U + abs(Float64(K * Float64(J * K)))); elseif (l <= 620.0) tmp = t_0; else tmp = Float64(U + Float64(Float64(l * J) * Float64(2.0 + Float64(Float64(K * K) * -0.25)))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = U + (2.0 * (l * (J * cos((K * 0.5))))); tmp = 0.0; if (l <= -9.6e+242) tmp = t_0; elseif (l <= -1.02e+39) tmp = U + abs((K * (J * K))); elseif (l <= 620.0) tmp = t_0; else tmp = U + ((l * J) * (2.0 + ((K * K) * -0.25))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$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, -9.6e+242], t$95$0, If[LessEqual[l, -1.02e+39], N[(U + N[Abs[N[(K * N[(J * K), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 620.0], t$95$0, N[(U + N[(N[(l * J), $MachinePrecision] * N[(2.0 + N[(N[(K * K), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + 2 \cdot \left(\ell \cdot \left(J \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\mathbf{if}\;\ell \leq -9.6 \cdot 10^{+242}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq -1.02 \cdot 10^{+39}:\\
\;\;\;\;U + \left|K \cdot \left(J \cdot K\right)\right|\\
\mathbf{elif}\;\ell \leq 620:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;U + \left(\ell \cdot J\right) \cdot \left(2 + \left(K \cdot K\right) \cdot -0.25\right)\\
\end{array}
\end{array}
if l < -9.60000000000000049e242 or -1.02e39 < l < 620Initial program 77.6%
Taylor expanded in l around 0 92.7%
associate-*r*92.7%
*-commutative92.7%
associate-*l*92.8%
Simplified92.8%
if -9.60000000000000049e242 < l < -1.02e39Initial program 100.0%
Applied egg-rr3.6%
Taylor expanded in K around 0 16.1%
distribute-rgt-out16.1%
unpow216.1%
Simplified16.1%
Taylor expanded in K around inf 16.0%
unpow216.0%
*-commutative16.0%
Simplified16.0%
add-sqr-sqrt13.2%
sqrt-unprod34.8%
swap-sqr27.2%
pow227.2%
pow227.2%
pow-prod-up27.2%
metadata-eval27.2%
Applied egg-rr27.2%
metadata-eval27.2%
pow-sqr27.2%
unswap-sqr34.8%
unpow234.8%
associate-*r*34.8%
*-commutative34.8%
unpow234.8%
associate-*r*32.4%
*-commutative32.4%
rem-sqrt-square32.5%
*-commutative32.5%
Simplified32.5%
if 620 < l Initial program 100.0%
Taylor expanded in l around 0 22.9%
associate-*r*22.9%
*-commutative22.9%
associate-*l*22.9%
Simplified22.9%
Taylor expanded in K around 0 16.5%
+-commutative16.5%
associate-*r*16.5%
distribute-rgt-out34.1%
*-commutative34.1%
unpow234.1%
Simplified34.1%
Final simplification69.8%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (+ U (* (* l J) (+ 2.0 (* (* K K) -0.25))))))
(if (<= l -7.5e+242)
t_0
(if (<= l -9e+67)
(+ U (fabs (* K (* J K))))
(if (or (<= l -3.2e+34) (not (<= l 360.0)))
t_0
(+ U (* 2.0 (* l J))))))))
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 <= -7.5e+242) {
tmp = t_0;
} else if (l <= -9e+67) {
tmp = U + fabs((K * (J * K)));
} else if ((l <= -3.2e+34) || !(l <= 360.0)) {
tmp = t_0;
} 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) :: t_0
real(8) :: tmp
t_0 = u + ((l * j) * (2.0d0 + ((k * k) * (-0.25d0))))
if (l <= (-7.5d+242)) then
tmp = t_0
else if (l <= (-9d+67)) then
tmp = u + abs((k * (j * k)))
else if ((l <= (-3.2d+34)) .or. (.not. (l <= 360.0d0))) then
tmp = t_0
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 t_0 = U + ((l * J) * (2.0 + ((K * K) * -0.25)));
double tmp;
if (l <= -7.5e+242) {
tmp = t_0;
} else if (l <= -9e+67) {
tmp = U + Math.abs((K * (J * K)));
} else if ((l <= -3.2e+34) || !(l <= 360.0)) {
tmp = t_0;
} else {
tmp = U + (2.0 * (l * J));
}
return tmp;
}
def code(J, l, K, U): t_0 = U + ((l * J) * (2.0 + ((K * K) * -0.25))) tmp = 0 if l <= -7.5e+242: tmp = t_0 elif l <= -9e+67: tmp = U + math.fabs((K * (J * K))) elif (l <= -3.2e+34) or not (l <= 360.0): tmp = t_0 else: tmp = U + (2.0 * (l * J)) 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 <= -7.5e+242) tmp = t_0; elseif (l <= -9e+67) tmp = Float64(U + abs(Float64(K * Float64(J * K)))); elseif ((l <= -3.2e+34) || !(l <= 360.0)) tmp = t_0; else tmp = Float64(U + Float64(2.0 * Float64(l * J))); 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 <= -7.5e+242) tmp = t_0; elseif (l <= -9e+67) tmp = U + abs((K * (J * K))); elseif ((l <= -3.2e+34) || ~((l <= 360.0))) tmp = t_0; else tmp = U + (2.0 * (l * J)); 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, -7.5e+242], t$95$0, If[LessEqual[l, -9e+67], N[(U + N[Abs[N[(K * N[(J * K), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[l, -3.2e+34], N[Not[LessEqual[l, 360.0]], $MachinePrecision]], t$95$0, N[(U + N[(2.0 * N[(l * J), $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 -7.5 \cdot 10^{+242}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq -9 \cdot 10^{+67}:\\
\;\;\;\;U + \left|K \cdot \left(J \cdot K\right)\right|\\
\mathbf{elif}\;\ell \leq -3.2 \cdot 10^{+34} \lor \neg \left(\ell \leq 360\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;U + 2 \cdot \left(\ell \cdot J\right)\\
\end{array}
\end{array}
if l < -7.49999999999999961e242 or -8.9999999999999997e67 < l < -3.1999999999999998e34 or 360 < l Initial program 100.0%
Taylor expanded in l around 0 29.4%
associate-*r*29.4%
*-commutative29.4%
associate-*l*29.4%
Simplified29.4%
Taylor expanded in K around 0 17.3%
+-commutative17.3%
associate-*r*17.3%
distribute-rgt-out40.7%
*-commutative40.7%
unpow240.7%
Simplified40.7%
if -7.49999999999999961e242 < l < -8.9999999999999997e67Initial program 100.0%
Applied egg-rr3.5%
Taylor expanded in K around 0 13.0%
distribute-rgt-out13.0%
unpow213.0%
Simplified13.0%
Taylor expanded in K around inf 12.9%
unpow212.9%
*-commutative12.9%
Simplified12.9%
add-sqr-sqrt9.7%
sqrt-unprod35.6%
swap-sqr26.7%
pow226.7%
pow226.7%
pow-prod-up26.7%
metadata-eval26.7%
Applied egg-rr26.7%
metadata-eval26.7%
pow-sqr26.7%
unswap-sqr35.6%
unpow235.6%
associate-*r*35.6%
*-commutative35.6%
unpow235.6%
associate-*r*32.8%
*-commutative32.8%
rem-sqrt-square32.8%
*-commutative32.8%
Simplified32.8%
if -3.1999999999999998e34 < l < 360Initial program 74.8%
Taylor expanded in l around 0 97.2%
associate-*r*97.2%
*-commutative97.2%
associate-*l*97.2%
Simplified97.2%
Taylor expanded in K around 0 85.1%
Final simplification63.9%
(FPCore (J l K U) :precision binary64 (if (or (<= l -2.3e+34) (not (<= l 255.0))) (+ 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 <= -2.3e+34) || !(l <= 255.0)) {
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 <= (-2.3d+34)) .or. (.not. (l <= 255.0d0))) 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 <= -2.3e+34) || !(l <= 255.0)) {
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 <= -2.3e+34) or not (l <= 255.0): 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 <= -2.3e+34) || !(l <= 255.0)) 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 <= -2.3e+34) || ~((l <= 255.0))) 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, -2.3e+34], N[Not[LessEqual[l, 255.0]], $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 -2.3 \cdot 10^{+34} \lor \neg \left(\ell \leq 255\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 < -2.2999999999999998e34 or 255 < l Initial program 100.0%
Taylor expanded in l around 0 25.9%
associate-*r*25.9%
*-commutative25.9%
associate-*l*25.9%
Simplified25.9%
Taylor expanded in K around 0 14.1%
+-commutative14.1%
associate-*r*14.1%
distribute-rgt-out34.0%
*-commutative34.0%
unpow234.0%
Simplified34.0%
if -2.2999999999999998e34 < l < 255Initial program 74.8%
Taylor expanded in l around 0 97.2%
associate-*r*97.2%
*-commutative97.2%
associate-*l*97.2%
Simplified97.2%
Taylor expanded in K around 0 85.1%
Final simplification61.9%
(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 86.2%
Taylor expanded in l around 0 64.9%
associate-*r*64.9%
*-commutative64.9%
associate-*l*64.9%
Simplified64.9%
Taylor expanded in K around 0 54.1%
Final simplification54.1%
(FPCore (J l K U) :precision binary64 (if (<= l 280000.0) U (* U U)))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= 280000.0) {
tmp = U;
} else {
tmp = U * U;
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if (l <= 280000.0d0) then
tmp = u
else
tmp = u * u
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (l <= 280000.0) {
tmp = U;
} else {
tmp = U * U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= 280000.0: tmp = U else: tmp = U * U return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= 280000.0) tmp = U; else tmp = Float64(U * U); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= 280000.0) tmp = U; else tmp = U * U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, 280000.0], U, N[(U * U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 280000:\\
\;\;\;\;U\\
\mathbf{else}:\\
\;\;\;\;U \cdot U\\
\end{array}
\end{array}
if l < 2.8e5Initial program 82.4%
associate-*l*82.4%
fma-def82.4%
Simplified82.4%
Taylor expanded in J around 0 49.8%
if 2.8e5 < l Initial program 100.0%
associate-*l*100.0%
fma-def100.0%
Simplified100.0%
Applied egg-rr15.7%
Final simplification42.4%
(FPCore (J l K U) :precision binary64 1.0)
double code(double J, double l, double K, double U) {
return 1.0;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = 1.0d0
end function
public static double code(double J, double l, double K, double U) {
return 1.0;
}
def code(J, l, K, U): return 1.0
function code(J, l, K, U) return 1.0 end
function tmp = code(J, l, K, U) tmp = 1.0; end
code[J_, l_, K_, U_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 86.2%
associate-*l*86.2%
fma-def86.2%
Simplified86.2%
Applied egg-rr2.8%
*-inverses2.8%
Simplified2.8%
Final simplification2.8%
(FPCore (J l K U) :precision binary64 U)
double code(double J, double l, double K, double U) {
return U;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = u
end function
public static double code(double J, double l, double K, double U) {
return U;
}
def code(J, l, K, U): return U
function code(J, l, K, U) return U end
function tmp = code(J, l, K, U) tmp = U; end
code[J_, l_, K_, U_] := U
\begin{array}{l}
\\
U
\end{array}
Initial program 86.2%
associate-*l*86.2%
fma-def86.2%
Simplified86.2%
Taylor expanded in J around 0 39.5%
Final simplification39.5%
herbie shell --seed 2023279
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))