
(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)))) (t_1 (cos (/ K 2.0))))
(if (<= t_0 -1e+50)
(+ (* t_1 (* t_0 J)) U)
(if (<= t_0 0.0005)
(+ 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 <= -1e+50) {
tmp = (t_1 * (t_0 * J)) + U;
} else if (t_0 <= 0.0005) {
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 <= -1e+50) tmp = Float64(Float64(t_1 * Float64(t_0 * J)) + U); elseif (t_0 <= 0.0005) 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, -1e+50], N[(N[(t$95$1 * N[(t$95$0 * J), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], If[LessEqual[t$95$0, 0.0005], 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 -1 \cdot 10^{+50}:\\
\;\;\;\;t_1 \cdot \left(t_0 \cdot J\right) + U\\
\mathbf{elif}\;t_0 \leq 0.0005:\\
\;\;\;\;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))) < -1.0000000000000001e50Initial program 100.0%
if -1.0000000000000001e50 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 5.0000000000000001e-4Initial program 69.6%
Taylor expanded in l around 0 99.9%
if 5.0000000000000001e-4 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 100.0%
associate-*l*100.0%
fma-def100.0%
Simplified100.0%
Final simplification99.9%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))) (t_1 (- (exp l) (exp (- l)))))
(if (or (<= t_1 -1e+50) (not (<= t_1 0.0005)))
(+ (* 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 <= -1e+50) || !(t_1 <= 0.0005)) {
tmp = (t_0 * (t_1 * J)) + U;
} else {
tmp = U + (t_0 * (J * ((0.3333333333333333 * pow(l, 3.0)) + (l * 2.0))));
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = cos((k / 2.0d0))
t_1 = exp(l) - exp(-l)
if ((t_1 <= (-1d+50)) .or. (.not. (t_1 <= 0.0005d0))) then
tmp = (t_0 * (t_1 * j)) + u
else
tmp = u + (t_0 * (j * ((0.3333333333333333d0 * (l ** 3.0d0)) + (l * 2.0d0))))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = Math.cos((K / 2.0));
double t_1 = Math.exp(l) - Math.exp(-l);
double tmp;
if ((t_1 <= -1e+50) || !(t_1 <= 0.0005)) {
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 <= -1e+50) or not (t_1 <= 0.0005): 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 <= -1e+50) || !(t_1 <= 0.0005)) 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 <= -1e+50) || ~((t_1 <= 0.0005))) 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, -1e+50], N[Not[LessEqual[t$95$1, 0.0005]], $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 -1 \cdot 10^{+50} \lor \neg \left(t_1 \leq 0.0005\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))) < -1.0000000000000001e50 or 5.0000000000000001e-4 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 100.0%
if -1.0000000000000001e50 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 5.0000000000000001e-4Initial program 69.6%
Taylor expanded in l around 0 99.9%
Final simplification99.9%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0)))
(t_1 (+ U (* t_0 (* (pow l 3.0) (* J 0.3333333333333333)))))
(t_2 (* (- (exp l) (exp (- l))) J)))
(if (<= l -2.3e+97)
t_1
(if (<= l -180.0)
t_2
(if (<= l 6400000000.0)
(+ U (* t_0 (* J (+ (* 0.3333333333333333 (pow l 3.0)) (* l 2.0)))))
(if (<= l 1.55e+94) (+ U t_2) t_1))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double t_1 = U + (t_0 * (pow(l, 3.0) * (J * 0.3333333333333333)));
double t_2 = (exp(l) - exp(-l)) * J;
double tmp;
if (l <= -2.3e+97) {
tmp = t_1;
} else if (l <= -180.0) {
tmp = t_2;
} else if (l <= 6400000000.0) {
tmp = U + (t_0 * (J * ((0.3333333333333333 * pow(l, 3.0)) + (l * 2.0))));
} else if (l <= 1.55e+94) {
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 / 2.0d0))
t_1 = u + (t_0 * ((l ** 3.0d0) * (j * 0.3333333333333333d0)))
t_2 = (exp(l) - exp(-l)) * j
if (l <= (-2.3d+97)) then
tmp = t_1
else if (l <= (-180.0d0)) then
tmp = t_2
else if (l <= 6400000000.0d0) then
tmp = u + (t_0 * (j * ((0.3333333333333333d0 * (l ** 3.0d0)) + (l * 2.0d0))))
else if (l <= 1.55d+94) 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 / 2.0));
double t_1 = U + (t_0 * (Math.pow(l, 3.0) * (J * 0.3333333333333333)));
double t_2 = (Math.exp(l) - Math.exp(-l)) * J;
double tmp;
if (l <= -2.3e+97) {
tmp = t_1;
} else if (l <= -180.0) {
tmp = t_2;
} else if (l <= 6400000000.0) {
tmp = U + (t_0 * (J * ((0.3333333333333333 * Math.pow(l, 3.0)) + (l * 2.0))));
} else if (l <= 1.55e+94) {
tmp = U + t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K / 2.0)) t_1 = U + (t_0 * (math.pow(l, 3.0) * (J * 0.3333333333333333))) t_2 = (math.exp(l) - math.exp(-l)) * J tmp = 0 if l <= -2.3e+97: tmp = t_1 elif l <= -180.0: tmp = t_2 elif l <= 6400000000.0: tmp = U + (t_0 * (J * ((0.3333333333333333 * math.pow(l, 3.0)) + (l * 2.0)))) elif l <= 1.55e+94: tmp = U + t_2 else: tmp = t_1 return tmp
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) t_1 = Float64(U + Float64(t_0 * Float64((l ^ 3.0) * Float64(J * 0.3333333333333333)))) t_2 = Float64(Float64(exp(l) - exp(Float64(-l))) * J) tmp = 0.0 if (l <= -2.3e+97) tmp = t_1; elseif (l <= -180.0) tmp = t_2; elseif (l <= 6400000000.0) tmp = Float64(U + Float64(t_0 * Float64(J * Float64(Float64(0.3333333333333333 * (l ^ 3.0)) + Float64(l * 2.0))))); elseif (l <= 1.55e+94) 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 / 2.0)); t_1 = U + (t_0 * ((l ^ 3.0) * (J * 0.3333333333333333))); t_2 = (exp(l) - exp(-l)) * J; tmp = 0.0; if (l <= -2.3e+97) tmp = t_1; elseif (l <= -180.0) tmp = t_2; elseif (l <= 6400000000.0) tmp = U + (t_0 * (J * ((0.3333333333333333 * (l ^ 3.0)) + (l * 2.0)))); elseif (l <= 1.55e+94) 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 / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(U + N[(t$95$0 * N[(N[Power[l, 3.0], $MachinePrecision] * N[(J * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision]}, If[LessEqual[l, -2.3e+97], t$95$1, If[LessEqual[l, -180.0], t$95$2, If[LessEqual[l, 6400000000.0], N[(U + N[(t$95$0 * N[(J * N[(N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision] + N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.55e+94], N[(U + t$95$2), $MachinePrecision], t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
t_1 := U + t_0 \cdot \left({\ell}^{3} \cdot \left(J \cdot 0.3333333333333333\right)\right)\\
t_2 := \left(e^{\ell} - e^{-\ell}\right) \cdot J\\
\mathbf{if}\;\ell \leq -2.3 \cdot 10^{+97}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\ell \leq -180:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\ell \leq 6400000000:\\
\;\;\;\;U + t_0 \cdot \left(J \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right)\right)\\
\mathbf{elif}\;\ell \leq 1.55 \cdot 10^{+94}:\\
\;\;\;\;U + t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if l < -2.30000000000000006e97 or 1.54999999999999996e94 < l Initial program 100.0%
Taylor expanded in l around 0 98.7%
Taylor expanded in l around inf 98.7%
associate-*r*98.7%
*-commutative98.7%
associate-*r*98.7%
Simplified98.7%
if -2.30000000000000006e97 < l < -180Initial program 100.0%
Taylor expanded in K around 0 73.1%
Taylor expanded in J around inf 73.1%
if -180 < l < 6.4e9Initial program 70.2%
Taylor expanded in l around 0 97.9%
if 6.4e9 < l < 1.54999999999999996e94Initial program 100.0%
Taylor expanded in K around 0 93.3%
Final simplification95.3%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0)))
(t_1 (+ U (* t_0 (* (pow l 3.0) (* J 0.3333333333333333)))))
(t_2 (* (- (exp l) (exp (- l))) J)))
(if (<= l -2.3e+97)
t_1
(if (<= l -200.0)
t_2
(if (<= l 6400000000.0)
(fma J (* t_0 (* l 2.0)) U)
(if (<= l 1.55e+94) (+ U t_2) t_1))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double t_1 = U + (t_0 * (pow(l, 3.0) * (J * 0.3333333333333333)));
double t_2 = (exp(l) - exp(-l)) * J;
double tmp;
if (l <= -2.3e+97) {
tmp = t_1;
} else if (l <= -200.0) {
tmp = t_2;
} else if (l <= 6400000000.0) {
tmp = fma(J, (t_0 * (l * 2.0)), U);
} else if (l <= 1.55e+94) {
tmp = U + t_2;
} else {
tmp = t_1;
}
return tmp;
}
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) t_1 = Float64(U + Float64(t_0 * Float64((l ^ 3.0) * Float64(J * 0.3333333333333333)))) t_2 = Float64(Float64(exp(l) - exp(Float64(-l))) * J) tmp = 0.0 if (l <= -2.3e+97) tmp = t_1; elseif (l <= -200.0) tmp = t_2; elseif (l <= 6400000000.0) tmp = fma(J, Float64(t_0 * Float64(l * 2.0)), U); elseif (l <= 1.55e+94) tmp = Float64(U + t_2); else tmp = t_1; end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(U + N[(t$95$0 * N[(N[Power[l, 3.0], $MachinePrecision] * N[(J * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision]}, If[LessEqual[l, -2.3e+97], t$95$1, If[LessEqual[l, -200.0], t$95$2, If[LessEqual[l, 6400000000.0], N[(J * N[(t$95$0 * N[(l * 2.0), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], If[LessEqual[l, 1.55e+94], N[(U + t$95$2), $MachinePrecision], t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
t_1 := U + t_0 \cdot \left({\ell}^{3} \cdot \left(J \cdot 0.3333333333333333\right)\right)\\
t_2 := \left(e^{\ell} - e^{-\ell}\right) \cdot J\\
\mathbf{if}\;\ell \leq -2.3 \cdot 10^{+97}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\ell \leq -200:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\ell \leq 6400000000:\\
\;\;\;\;\mathsf{fma}\left(J, t_0 \cdot \left(\ell \cdot 2\right), U\right)\\
\mathbf{elif}\;\ell \leq 1.55 \cdot 10^{+94}:\\
\;\;\;\;U + t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if l < -2.30000000000000006e97 or 1.54999999999999996e94 < l Initial program 100.0%
Taylor expanded in l around 0 98.7%
Taylor expanded in l around inf 98.7%
associate-*r*98.7%
*-commutative98.7%
associate-*r*98.7%
Simplified98.7%
if -2.30000000000000006e97 < l < -200Initial program 100.0%
Taylor expanded in K around 0 73.1%
Taylor expanded in J around inf 73.1%
if -200 < l < 6.4e9Initial program 70.2%
associate-*l*70.2%
fma-def70.2%
Simplified70.2%
Taylor expanded in l around 0 97.6%
if 6.4e9 < l < 1.54999999999999996e94Initial program 100.0%
Taylor expanded in K around 0 93.3%
Final simplification95.2%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= t_0 0.28)
(+ U (* t_0 (* l (* J 2.0))))
(+ 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.28) {
tmp = U + (t_0 * (l * (J * 2.0)));
} 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.28d0) then
tmp = u + (t_0 * (l * (j * 2.0d0)))
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.28) {
tmp = U + (t_0 * (l * (J * 2.0)));
} 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.28: tmp = U + (t_0 * (l * (J * 2.0))) 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.28) tmp = Float64(U + Float64(t_0 * Float64(l * Float64(J * 2.0)))); 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.28) tmp = U + (t_0 * (l * (J * 2.0))); 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.28], N[(U + N[(t$95$0 * N[(l * N[(J * 2.0), $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.28:\\
\;\;\;\;U + t_0 \cdot \left(\ell \cdot \left(J \cdot 2\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.28000000000000003Initial program 79.6%
Taylor expanded in l around 0 69.2%
associate-*r*69.2%
*-commutative69.2%
associate-*l*69.2%
Simplified69.2%
if 0.28000000000000003 < (cos.f64 (/.f64 K 2)) Initial program 85.3%
Taylor expanded in l around 0 87.7%
Taylor expanded in K around 0 85.0%
Final simplification80.2%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (* (- (exp l) (exp (- l))) J)))
(if (<= l -390.0)
t_0
(if (<= l 6400000000.0)
(fma J (* (cos (/ K 2.0)) (* l 2.0)) U)
(+ U t_0)))))
double code(double J, double l, double K, double U) {
double t_0 = (exp(l) - exp(-l)) * J;
double tmp;
if (l <= -390.0) {
tmp = t_0;
} else if (l <= 6400000000.0) {
tmp = fma(J, (cos((K / 2.0)) * (l * 2.0)), U);
} else {
tmp = U + t_0;
}
return tmp;
}
function code(J, l, K, U) t_0 = Float64(Float64(exp(l) - exp(Float64(-l))) * J) tmp = 0.0 if (l <= -390.0) tmp = t_0; elseif (l <= 6400000000.0) tmp = fma(J, Float64(cos(Float64(K / 2.0)) * Float64(l * 2.0)), U); else tmp = Float64(U + t_0); end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision]}, If[LessEqual[l, -390.0], t$95$0, If[LessEqual[l, 6400000000.0], N[(J * N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(l * 2.0), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], N[(U + t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(e^{\ell} - e^{-\ell}\right) \cdot J\\
\mathbf{if}\;\ell \leq -390:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq 6400000000:\\
\;\;\;\;\mathsf{fma}\left(J, \cos \left(\frac{K}{2}\right) \cdot \left(\ell \cdot 2\right), U\right)\\
\mathbf{else}:\\
\;\;\;\;U + t_0\\
\end{array}
\end{array}
if l < -390Initial program 100.0%
Taylor expanded in K around 0 78.2%
Taylor expanded in J around inf 78.2%
if -390 < l < 6.4e9Initial program 70.2%
associate-*l*70.2%
fma-def70.2%
Simplified70.2%
Taylor expanded in l around 0 97.6%
if 6.4e9 < l Initial program 100.0%
Taylor expanded in K around 0 88.3%
Final simplification91.2%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (* (- (exp l) (exp (- l))) J)))
(if (<= l -255.0)
t_0
(if (<= l 6400000000.0)
(+ U (* (cos (/ K 2.0)) (* l (* J 2.0))))
(+ U t_0)))))
double code(double J, double l, double K, double U) {
double t_0 = (exp(l) - exp(-l)) * J;
double tmp;
if (l <= -255.0) {
tmp = t_0;
} else if (l <= 6400000000.0) {
tmp = U + (cos((K / 2.0)) * (l * (J * 2.0)));
} else {
tmp = U + t_0;
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: t_0
real(8) :: tmp
t_0 = (exp(l) - exp(-l)) * j
if (l <= (-255.0d0)) then
tmp = t_0
else if (l <= 6400000000.0d0) then
tmp = u + (cos((k / 2.0d0)) * (l * (j * 2.0d0)))
else
tmp = u + t_0
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = (Math.exp(l) - Math.exp(-l)) * J;
double tmp;
if (l <= -255.0) {
tmp = t_0;
} else if (l <= 6400000000.0) {
tmp = U + (Math.cos((K / 2.0)) * (l * (J * 2.0)));
} else {
tmp = U + t_0;
}
return tmp;
}
def code(J, l, K, U): t_0 = (math.exp(l) - math.exp(-l)) * J tmp = 0 if l <= -255.0: tmp = t_0 elif l <= 6400000000.0: tmp = U + (math.cos((K / 2.0)) * (l * (J * 2.0))) else: tmp = U + t_0 return tmp
function code(J, l, K, U) t_0 = Float64(Float64(exp(l) - exp(Float64(-l))) * J) tmp = 0.0 if (l <= -255.0) tmp = t_0; elseif (l <= 6400000000.0) tmp = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(l * Float64(J * 2.0)))); else tmp = Float64(U + t_0); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = (exp(l) - exp(-l)) * J; tmp = 0.0; if (l <= -255.0) tmp = t_0; elseif (l <= 6400000000.0) tmp = U + (cos((K / 2.0)) * (l * (J * 2.0))); else tmp = U + t_0; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision]}, If[LessEqual[l, -255.0], t$95$0, If[LessEqual[l, 6400000000.0], N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(l * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(e^{\ell} - e^{-\ell}\right) \cdot J\\
\mathbf{if}\;\ell \leq -255:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq 6400000000:\\
\;\;\;\;U + \cos \left(\frac{K}{2}\right) \cdot \left(\ell \cdot \left(J \cdot 2\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + t_0\\
\end{array}
\end{array}
if l < -255Initial program 100.0%
Taylor expanded in K around 0 78.2%
Taylor expanded in J around inf 78.2%
if -255 < l < 6.4e9Initial program 70.2%
Taylor expanded in l around 0 97.5%
associate-*r*97.5%
*-commutative97.5%
associate-*l*97.5%
Simplified97.5%
if 6.4e9 < l Initial program 100.0%
Taylor expanded in K around 0 88.3%
Final simplification91.2%
(FPCore (J l K U) :precision binary64 (if (or (<= l -340.0) (not (<= l 6400000000.0))) (* (- (exp l) (exp (- l))) J) (+ U (* (cos (/ K 2.0)) (* l (* J 2.0))))))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -340.0) || !(l <= 6400000000.0)) {
tmp = (exp(l) - exp(-l)) * J;
} else {
tmp = U + (cos((K / 2.0)) * (l * (J * 2.0)));
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if ((l <= (-340.0d0)) .or. (.not. (l <= 6400000000.0d0))) then
tmp = (exp(l) - exp(-l)) * j
else
tmp = u + (cos((k / 2.0d0)) * (l * (j * 2.0d0)))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -340.0) || !(l <= 6400000000.0)) {
tmp = (Math.exp(l) - Math.exp(-l)) * J;
} else {
tmp = U + (Math.cos((K / 2.0)) * (l * (J * 2.0)));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -340.0) or not (l <= 6400000000.0): tmp = (math.exp(l) - math.exp(-l)) * J else: tmp = U + (math.cos((K / 2.0)) * (l * (J * 2.0))) return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -340.0) || !(l <= 6400000000.0)) tmp = Float64(Float64(exp(l) - exp(Float64(-l))) * J); else tmp = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(l * Float64(J * 2.0)))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -340.0) || ~((l <= 6400000000.0))) tmp = (exp(l) - exp(-l)) * J; else tmp = U + (cos((K / 2.0)) * (l * (J * 2.0))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -340.0], N[Not[LessEqual[l, 6400000000.0]], $MachinePrecision]], N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision], N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(l * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -340 \lor \neg \left(\ell \leq 6400000000\right):\\
\;\;\;\;\left(e^{\ell} - e^{-\ell}\right) \cdot J\\
\mathbf{else}:\\
\;\;\;\;U + \cos \left(\frac{K}{2}\right) \cdot \left(\ell \cdot \left(J \cdot 2\right)\right)\\
\end{array}
\end{array}
if l < -340 or 6.4e9 < l Initial program 100.0%
Taylor expanded in K around 0 83.5%
Taylor expanded in J around inf 83.5%
if -340 < l < 6.4e9Initial program 70.2%
Taylor expanded in l around 0 97.5%
associate-*r*97.5%
*-commutative97.5%
associate-*l*97.5%
Simplified97.5%
Final simplification91.2%
(FPCore (J l K U) :precision binary64 (if (or (<= l -5.8e+38) (not (<= l 4800000.0))) (+ U (* J (* 0.3333333333333333 (pow l 3.0)))) (+ U (* l (* (* J 2.0) (cos (* K 0.5)))))))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -5.8e+38) || !(l <= 4800000.0)) {
tmp = U + (J * (0.3333333333333333 * pow(l, 3.0)));
} else {
tmp = U + (l * ((J * 2.0) * cos((K * 0.5))));
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if ((l <= (-5.8d+38)) .or. (.not. (l <= 4800000.0d0))) then
tmp = u + (j * (0.3333333333333333d0 * (l ** 3.0d0)))
else
tmp = u + (l * ((j * 2.0d0) * cos((k * 0.5d0))))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -5.8e+38) || !(l <= 4800000.0)) {
tmp = U + (J * (0.3333333333333333 * Math.pow(l, 3.0)));
} else {
tmp = U + (l * ((J * 2.0) * Math.cos((K * 0.5))));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -5.8e+38) or not (l <= 4800000.0): tmp = U + (J * (0.3333333333333333 * math.pow(l, 3.0))) else: tmp = U + (l * ((J * 2.0) * math.cos((K * 0.5)))) return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -5.8e+38) || !(l <= 4800000.0)) tmp = Float64(U + Float64(J * Float64(0.3333333333333333 * (l ^ 3.0)))); else tmp = Float64(U + Float64(l * Float64(Float64(J * 2.0) * cos(Float64(K * 0.5))))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -5.8e+38) || ~((l <= 4800000.0))) tmp = U + (J * (0.3333333333333333 * (l ^ 3.0))); else tmp = U + (l * ((J * 2.0) * cos((K * 0.5)))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -5.8e+38], N[Not[LessEqual[l, 4800000.0]], $MachinePrecision]], N[(U + N[(J * N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(l * N[(N[(J * 2.0), $MachinePrecision] * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -5.8 \cdot 10^{+38} \lor \neg \left(\ell \leq 4800000\right):\\
\;\;\;\;U + J \cdot \left(0.3333333333333333 \cdot {\ell}^{3}\right)\\
\mathbf{else}:\\
\;\;\;\;U + \ell \cdot \left(\left(J \cdot 2\right) \cdot \cos \left(K \cdot 0.5\right)\right)\\
\end{array}
\end{array}
if l < -5.80000000000000013e38 or 4.8e6 < l Initial program 100.0%
Taylor expanded in l around 0 77.1%
Taylor expanded in K around 0 67.4%
Taylor expanded in l around inf 67.4%
if -5.80000000000000013e38 < l < 4.8e6Initial program 72.2%
Taylor expanded in l around 0 92.4%
+-commutative92.4%
distribute-lft-in92.4%
*-commutative92.4%
Applied egg-rr92.4%
Taylor expanded in l around 0 92.0%
associate-*r*92.0%
*-commutative92.0%
*-commutative92.0%
associate-*r*92.0%
*-commutative92.0%
*-commutative92.0%
associate-*l*92.0%
*-commutative92.0%
*-commutative92.0%
Simplified92.0%
Final simplification81.9%
(FPCore (J l K U) :precision binary64 (if (or (<= l -2.65e+38) (not (<= l 1900000000.0))) (+ U (* J (* 0.3333333333333333 (pow l 3.0)))) (+ U (* (cos (/ K 2.0)) (* l (* J 2.0))))))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -2.65e+38) || !(l <= 1900000000.0)) {
tmp = U + (J * (0.3333333333333333 * pow(l, 3.0)));
} else {
tmp = U + (cos((K / 2.0)) * (l * (J * 2.0)));
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if ((l <= (-2.65d+38)) .or. (.not. (l <= 1900000000.0d0))) then
tmp = u + (j * (0.3333333333333333d0 * (l ** 3.0d0)))
else
tmp = u + (cos((k / 2.0d0)) * (l * (j * 2.0d0)))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -2.65e+38) || !(l <= 1900000000.0)) {
tmp = U + (J * (0.3333333333333333 * Math.pow(l, 3.0)));
} else {
tmp = U + (Math.cos((K / 2.0)) * (l * (J * 2.0)));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -2.65e+38) or not (l <= 1900000000.0): tmp = U + (J * (0.3333333333333333 * math.pow(l, 3.0))) else: tmp = U + (math.cos((K / 2.0)) * (l * (J * 2.0))) return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -2.65e+38) || !(l <= 1900000000.0)) tmp = Float64(U + Float64(J * Float64(0.3333333333333333 * (l ^ 3.0)))); else tmp = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(l * Float64(J * 2.0)))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -2.65e+38) || ~((l <= 1900000000.0))) tmp = U + (J * (0.3333333333333333 * (l ^ 3.0))); else tmp = U + (cos((K / 2.0)) * (l * (J * 2.0))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -2.65e+38], N[Not[LessEqual[l, 1900000000.0]], $MachinePrecision]], N[(U + N[(J * N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(l * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2.65 \cdot 10^{+38} \lor \neg \left(\ell \leq 1900000000\right):\\
\;\;\;\;U + J \cdot \left(0.3333333333333333 \cdot {\ell}^{3}\right)\\
\mathbf{else}:\\
\;\;\;\;U + \cos \left(\frac{K}{2}\right) \cdot \left(\ell \cdot \left(J \cdot 2\right)\right)\\
\end{array}
\end{array}
if l < -2.65000000000000012e38 or 1.9e9 < l Initial program 100.0%
Taylor expanded in l around 0 77.1%
Taylor expanded in K around 0 67.4%
Taylor expanded in l around inf 67.4%
if -2.65000000000000012e38 < l < 1.9e9Initial program 72.2%
Taylor expanded in l around 0 92.0%
associate-*r*92.0%
*-commutative92.0%
associate-*l*92.0%
Simplified92.0%
Final simplification81.9%
(FPCore (J l K U) :precision binary64 (if (or (<= l -116.0) (not (<= l 0.00013))) (+ U (* J (* 0.3333333333333333 (pow l 3.0)))) (+ U (* 2.0 (* l J)))))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -116.0) || !(l <= 0.00013)) {
tmp = U + (J * (0.3333333333333333 * pow(l, 3.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) :: tmp
if ((l <= (-116.0d0)) .or. (.not. (l <= 0.00013d0))) then
tmp = u + (j * (0.3333333333333333d0 * (l ** 3.0d0)))
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 <= -116.0) || !(l <= 0.00013)) {
tmp = U + (J * (0.3333333333333333 * Math.pow(l, 3.0)));
} else {
tmp = U + (2.0 * (l * J));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -116.0) or not (l <= 0.00013): tmp = U + (J * (0.3333333333333333 * math.pow(l, 3.0))) else: tmp = U + (2.0 * (l * J)) return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -116.0) || !(l <= 0.00013)) tmp = Float64(U + Float64(J * Float64(0.3333333333333333 * (l ^ 3.0)))); 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 <= -116.0) || ~((l <= 0.00013))) tmp = U + (J * (0.3333333333333333 * (l ^ 3.0))); else tmp = U + (2.0 * (l * J)); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -116.0], N[Not[LessEqual[l, 0.00013]], $MachinePrecision]], N[(U + N[(J * N[(0.3333333333333333 * N[Power[l, 3.0], $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 -116 \lor \neg \left(\ell \leq 0.00013\right):\\
\;\;\;\;U + J \cdot \left(0.3333333333333333 \cdot {\ell}^{3}\right)\\
\mathbf{else}:\\
\;\;\;\;U + 2 \cdot \left(\ell \cdot J\right)\\
\end{array}
\end{array}
if l < -116 or 1.29999999999999989e-4 < l Initial program 99.9%
Taylor expanded in l around 0 70.8%
Taylor expanded in K around 0 60.4%
Taylor expanded in l around inf 60.4%
if -116 < l < 1.29999999999999989e-4Initial program 69.7%
Taylor expanded in l around 0 99.2%
associate-*r*99.2%
*-commutative99.2%
associate-*l*99.2%
Simplified99.2%
Taylor expanded in K around 0 84.3%
Final simplification73.3%
(FPCore (J l K U)
:precision binary64
(if (<= l -2.3e+18)
(+ U (* (* l J) (+ 2.0 (* (* K K) -0.25))))
(if (or (<= l 0.00013) (not (<= l 1.45e+109)))
(+ U (* 2.0 (* l J)))
(- (* U U) U))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -2.3e+18) {
tmp = U + ((l * J) * (2.0 + ((K * K) * -0.25)));
} else if ((l <= 0.00013) || !(l <= 1.45e+109)) {
tmp = U + (2.0 * (l * J));
} else {
tmp = (U * U) - U;
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if (l <= (-2.3d+18)) then
tmp = u + ((l * j) * (2.0d0 + ((k * k) * (-0.25d0))))
else if ((l <= 0.00013d0) .or. (.not. (l <= 1.45d+109))) then
tmp = u + (2.0d0 * (l * j))
else
tmp = (u * u) - u
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (l <= -2.3e+18) {
tmp = U + ((l * J) * (2.0 + ((K * K) * -0.25)));
} else if ((l <= 0.00013) || !(l <= 1.45e+109)) {
tmp = U + (2.0 * (l * J));
} else {
tmp = (U * U) - U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -2.3e+18: tmp = U + ((l * J) * (2.0 + ((K * K) * -0.25))) elif (l <= 0.00013) or not (l <= 1.45e+109): tmp = U + (2.0 * (l * J)) else: tmp = (U * U) - U return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -2.3e+18) tmp = Float64(U + Float64(Float64(l * J) * Float64(2.0 + Float64(Float64(K * K) * -0.25)))); elseif ((l <= 0.00013) || !(l <= 1.45e+109)) tmp = Float64(U + Float64(2.0 * Float64(l * J))); else tmp = Float64(Float64(U * U) - U); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -2.3e+18) tmp = U + ((l * J) * (2.0 + ((K * K) * -0.25))); elseif ((l <= 0.00013) || ~((l <= 1.45e+109))) tmp = U + (2.0 * (l * J)); else tmp = (U * U) - U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -2.3e+18], N[(U + N[(N[(l * J), $MachinePrecision] * N[(2.0 + N[(N[(K * K), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[l, 0.00013], N[Not[LessEqual[l, 1.45e+109]], $MachinePrecision]], N[(U + N[(2.0 * N[(l * J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(U * U), $MachinePrecision] - U), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2.3 \cdot 10^{+18}:\\
\;\;\;\;U + \left(\ell \cdot J\right) \cdot \left(2 + \left(K \cdot K\right) \cdot -0.25\right)\\
\mathbf{elif}\;\ell \leq 0.00013 \lor \neg \left(\ell \leq 1.45 \cdot 10^{+109}\right):\\
\;\;\;\;U + 2 \cdot \left(\ell \cdot J\right)\\
\mathbf{else}:\\
\;\;\;\;U \cdot U - U\\
\end{array}
\end{array}
if l < -2.3e18Initial program 100.0%
Taylor expanded in l around 0 22.4%
associate-*r*24.1%
*-commutative24.1%
associate-*l*22.4%
Simplified22.4%
Taylor expanded in K around 0 11.8%
+-commutative11.8%
associate-*r*11.8%
distribute-rgt-out29.1%
*-commutative29.1%
unpow229.1%
Simplified29.1%
if -2.3e18 < l < 1.29999999999999989e-4 or 1.45e109 < l Initial program 77.0%
Taylor expanded in l around 0 83.6%
associate-*r*83.6%
*-commutative83.6%
associate-*l*83.6%
Simplified83.6%
Taylor expanded in K around 0 72.2%
if 1.29999999999999989e-4 < l < 1.45e109Initial program 99.3%
Taylor expanded in K around 0 72.7%
Applied egg-rr37.5%
fma-neg37.5%
Simplified37.5%
Final simplification60.5%
(FPCore (J l K U) :precision binary64 (if (<= l -8.4e+20) (* U U) (if (<= l 0.00013) U (* U U))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -8.4e+20) {
tmp = U * U;
} else if (l <= 0.00013) {
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 <= (-8.4d+20)) then
tmp = u * u
else if (l <= 0.00013d0) 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 <= -8.4e+20) {
tmp = U * U;
} else if (l <= 0.00013) {
tmp = U;
} else {
tmp = U * U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -8.4e+20: tmp = U * U elif l <= 0.00013: tmp = U else: tmp = U * U return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -8.4e+20) tmp = Float64(U * U); elseif (l <= 0.00013) tmp = U; else tmp = Float64(U * U); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -8.4e+20) tmp = U * U; elseif (l <= 0.00013) tmp = U; else tmp = U * U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -8.4e+20], N[(U * U), $MachinePrecision], If[LessEqual[l, 0.00013], U, N[(U * U), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -8.4 \cdot 10^{+20}:\\
\;\;\;\;U \cdot U\\
\mathbf{elif}\;\ell \leq 0.00013:\\
\;\;\;\;U\\
\mathbf{else}:\\
\;\;\;\;U \cdot U\\
\end{array}
\end{array}
if l < -8.4e20 or 1.29999999999999989e-4 < l Initial program 99.9%
Applied egg-rr20.1%
if -8.4e20 < l < 1.29999999999999989e-4Initial program 70.7%
Taylor expanded in J around 0 64.9%
Final simplification45.2%
(FPCore (J l K U) :precision binary64 (if (<= l -2.25e+20) (- (* U U) U) (if (<= l 0.00013) U (* U U))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -2.25e+20) {
tmp = (U * U) - U;
} else if (l <= 0.00013) {
tmp = U;
} else {
tmp = U * U;
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if (l <= (-2.25d+20)) then
tmp = (u * u) - u
else if (l <= 0.00013d0) then
tmp = u
else
tmp = u * u
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (l <= -2.25e+20) {
tmp = (U * U) - U;
} else if (l <= 0.00013) {
tmp = U;
} else {
tmp = U * U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -2.25e+20: tmp = (U * U) - U elif l <= 0.00013: tmp = U else: tmp = U * U return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -2.25e+20) tmp = Float64(Float64(U * U) - U); elseif (l <= 0.00013) tmp = U; else tmp = Float64(U * U); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -2.25e+20) tmp = (U * U) - U; elseif (l <= 0.00013) tmp = U; else tmp = U * U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -2.25e+20], N[(N[(U * U), $MachinePrecision] - U), $MachinePrecision], If[LessEqual[l, 0.00013], U, N[(U * U), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2.25 \cdot 10^{+20}:\\
\;\;\;\;U \cdot U - U\\
\mathbf{elif}\;\ell \leq 0.00013:\\
\;\;\;\;U\\
\mathbf{else}:\\
\;\;\;\;U \cdot U\\
\end{array}
\end{array}
if l < -2.25e20Initial program 100.0%
Taylor expanded in K around 0 78.0%
Applied egg-rr19.6%
fma-neg19.6%
Simplified19.6%
if -2.25e20 < l < 1.29999999999999989e-4Initial program 70.7%
Taylor expanded in J around 0 64.9%
if 1.29999999999999989e-4 < l Initial program 99.8%
Applied egg-rr20.6%
Final simplification45.2%
(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 83.6%
Taylor expanded in l around 0 65.2%
associate-*r*65.6%
*-commutative65.6%
associate-*l*65.2%
Simplified65.2%
Taylor expanded in K around 0 55.3%
Final simplification55.3%
(FPCore (J l K U) :precision binary64 (+ U (* J (* l 2.0))))
double code(double J, double l, double K, double U) {
return U + (J * (l * 2.0));
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = u + (j * (l * 2.0d0))
end function
public static double code(double J, double l, double K, double U) {
return U + (J * (l * 2.0));
}
def code(J, l, K, U): return U + (J * (l * 2.0))
function code(J, l, K, U) return Float64(U + Float64(J * Float64(l * 2.0))) end
function tmp = code(J, l, K, U) tmp = U + (J * (l * 2.0)); end
code[J_, l_, K_, U_] := N[(U + N[(J * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + J \cdot \left(\ell \cdot 2\right)
\end{array}
Initial program 83.6%
Taylor expanded in l around 0 86.1%
Taylor expanded in K around 0 73.3%
Taylor expanded in l around 0 55.6%
Final simplification55.6%
(FPCore (J l K U) :precision binary64 0.0)
double code(double J, double l, double K, double U) {
return 0.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 = 0.0d0
end function
public static double code(double J, double l, double K, double U) {
return 0.0;
}
def code(J, l, K, U): return 0.0
function code(J, l, K, U) return 0.0 end
function tmp = code(J, l, K, U) tmp = 0.0; end
code[J_, l_, K_, U_] := 0.0
\begin{array}{l}
\\
0
\end{array}
Initial program 83.6%
Taylor expanded in K around 0 74.3%
Applied egg-rr2.3%
+-inverses2.3%
Simplified2.3%
Final simplification2.3%
(FPCore (J l K U) :precision binary64 1.0)
double code(double J, double l, double K, double U) {
return 1.0;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = 1.0d0
end function
public static double code(double J, double l, double K, double U) {
return 1.0;
}
def code(J, l, K, U): return 1.0
function code(J, l, K, U) return 1.0 end
function tmp = code(J, l, K, U) tmp = 1.0; end
code[J_, l_, K_, U_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 83.6%
Applied egg-rr3.1%
*-inverses3.1%
Simplified3.1%
Final simplification3.1%
(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 83.6%
Taylor expanded in J around 0 37.2%
Final simplification37.2%
herbie shell --seed 2023230
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))