
(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 15 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.0002)))
(+ (* (* t_0 J) (cos (/ K 2.0))) U)
(+
U
(*
l
(* (* J (cos (* K 0.5))) (fma 0.3333333333333333 (pow l 2.0) 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.0002)) {
tmp = ((t_0 * J) * cos((K / 2.0))) + U;
} else {
tmp = U + (l * ((J * cos((K * 0.5))) * fma(0.3333333333333333, pow(l, 2.0), 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.0002)) tmp = Float64(Float64(Float64(t_0 * J) * cos(Float64(K / 2.0))) + U); else tmp = Float64(U + Float64(l * Float64(Float64(J * cos(Float64(K * 0.5))) * fma(0.3333333333333333, (l ^ 2.0), 2.0)))); end return 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.0002]], $MachinePrecision]], N[(N[(N[(t$95$0 * J), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], N[(U + N[(l * N[(N[(J * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(0.3333333333333333 * N[Power[l, 2.0], $MachinePrecision] + 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.0002\right):\\
\;\;\;\;\left(t\_0 \cdot J\right) \cdot \cos \left(\frac{K}{2}\right) + U\\
\mathbf{else}:\\
\;\;\;\;U + \ell \cdot \left(\left(J \cdot \cos \left(K \cdot 0.5\right)\right) \cdot \mathsf{fma}\left(0.3333333333333333, {\ell}^{2}, 2\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -inf.0 or 2.0000000000000001e-4 < (-.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))) < 2.0000000000000001e-4Initial program 69.3%
Taylor expanded in l around 0 99.9%
*-commutative99.9%
*-commutative99.9%
associate-*r*99.9%
associate-*r*99.9%
*-commutative99.9%
*-commutative99.9%
distribute-lft-out99.9%
fma-define99.9%
Simplified99.9%
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 0.0002)))
(+ (* (* t_1 J) t_0) U)
(+ U (* t_0 (* J (+ (* 0.3333333333333333 (pow l 3.0)) (* l 2.0))))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double t_1 = exp(l) - exp(-l);
double tmp;
if ((t_1 <= -((double) INFINITY)) || !(t_1 <= 0.0002)) {
tmp = ((t_1 * J) * t_0) + 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 <= 0.0002)) {
tmp = ((t_1 * J) * t_0) + U;
} else {
tmp = U + (t_0 * (J * ((0.3333333333333333 * Math.pow(l, 3.0)) + (l * 2.0))));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K / 2.0)) t_1 = math.exp(l) - math.exp(-l) tmp = 0 if (t_1 <= -math.inf) or not (t_1 <= 0.0002): tmp = ((t_1 * J) * t_0) + U else: tmp = U + (t_0 * (J * ((0.3333333333333333 * math.pow(l, 3.0)) + (l * 2.0)))) return tmp
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) t_1 = Float64(exp(l) - exp(Float64(-l))) tmp = 0.0 if ((t_1 <= Float64(-Inf)) || !(t_1 <= 0.0002)) tmp = Float64(Float64(Float64(t_1 * J) * t_0) + U); else tmp = Float64(U + Float64(t_0 * Float64(J * Float64(Float64(0.3333333333333333 * (l ^ 3.0)) + Float64(l * 2.0))))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = cos((K / 2.0)); t_1 = exp(l) - exp(-l); tmp = 0.0; if ((t_1 <= -Inf) || ~((t_1 <= 0.0002))) tmp = ((t_1 * J) * t_0) + U; else tmp = U + (t_0 * (J * ((0.3333333333333333 * (l ^ 3.0)) + (l * 2.0)))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, (-Infinity)], N[Not[LessEqual[t$95$1, 0.0002]], $MachinePrecision]], N[(N[(N[(t$95$1 * J), $MachinePrecision] * t$95$0), $MachinePrecision] + U), $MachinePrecision], N[(U + N[(t$95$0 * N[(J * N[(N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision] + N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
t_1 := e^{\ell} - e^{-\ell}\\
\mathbf{if}\;t\_1 \leq -\infty \lor \neg \left(t\_1 \leq 0.0002\right):\\
\;\;\;\;\left(t\_1 \cdot J\right) \cdot t\_0 + U\\
\mathbf{else}:\\
\;\;\;\;U + t\_0 \cdot \left(J \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -inf.0 or 2.0000000000000001e-4 < (-.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))) < 2.0000000000000001e-4Initial program 69.3%
Taylor expanded in l around 0 99.9%
distribute-rgt-in99.9%
*-commutative99.9%
associate-*l*99.9%
unpow299.9%
pow399.9%
Applied egg-rr99.9%
Final simplification100.0%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (- (exp l) (exp (- l)))))
(if (or (<= t_0 (- INFINITY)) (not (<= t_0 0.0002)))
(* t_0 J)
(+ U (* l (* 2.0 (* J (cos (* K 0.5)))))))))
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.0002)) {
tmp = t_0 * J;
} else {
tmp = U + (l * (2.0 * (J * cos((K * 0.5)))));
}
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.0002)) {
tmp = t_0 * J;
} else {
tmp = U + (l * (2.0 * (J * Math.cos((K * 0.5)))));
}
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.0002): tmp = t_0 * J else: tmp = U + (l * (2.0 * (J * math.cos((K * 0.5))))) 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.0002)) tmp = Float64(t_0 * J); else tmp = Float64(U + Float64(l * Float64(2.0 * Float64(J * cos(Float64(K * 0.5)))))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = exp(l) - exp(-l); tmp = 0.0; if ((t_0 <= -Inf) || ~((t_0 <= 0.0002))) tmp = t_0 * J; else tmp = U + (l * (2.0 * (J * cos((K * 0.5))))); 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.0002]], $MachinePrecision]], N[(t$95$0 * J), $MachinePrecision], N[(U + N[(l * N[(2.0 * N[(J * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{\ell} - e^{-\ell}\\
\mathbf{if}\;t\_0 \leq -\infty \lor \neg \left(t\_0 \leq 0.0002\right):\\
\;\;\;\;t\_0 \cdot J\\
\mathbf{else}:\\
\;\;\;\;U + \ell \cdot \left(2 \cdot \left(J \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -inf.0 or 2.0000000000000001e-4 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 100.0%
Taylor expanded in K around 0 79.6%
Taylor expanded in J around inf 79.6%
if -inf.0 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 2.0000000000000001e-4Initial program 69.3%
Taylor expanded in l around 0 99.9%
*-commutative99.9%
*-commutative99.9%
associate-*r*99.9%
associate-*r*99.9%
*-commutative99.9%
*-commutative99.9%
distribute-lft-out99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in l around 0 99.7%
Final simplification91.2%
(FPCore (J l K U)
:precision binary64
(let* ((t_0
(+ U (* (cos (/ K 2.0)) (* J (* 0.3333333333333333 (pow l 3.0))))))
(t_1 (* (- (exp l) (exp (- l))) J)))
(if (<= l -8.2e+139)
t_0
(if (<= l -36.0)
t_1
(if (<= l 0.0115)
(+ U (* l (* 2.0 (* J (cos (* K 0.5))))))
(if (<= l 3e+102) (+ t_1 U) t_0))))))
double code(double J, double l, double K, double U) {
double t_0 = U + (cos((K / 2.0)) * (J * (0.3333333333333333 * pow(l, 3.0))));
double t_1 = (exp(l) - exp(-l)) * J;
double tmp;
if (l <= -8.2e+139) {
tmp = t_0;
} else if (l <= -36.0) {
tmp = t_1;
} else if (l <= 0.0115) {
tmp = U + (l * (2.0 * (J * cos((K * 0.5)))));
} else if (l <= 3e+102) {
tmp = t_1 + U;
} 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)) * (j * (0.3333333333333333d0 * (l ** 3.0d0))))
t_1 = (exp(l) - exp(-l)) * j
if (l <= (-8.2d+139)) then
tmp = t_0
else if (l <= (-36.0d0)) then
tmp = t_1
else if (l <= 0.0115d0) then
tmp = u + (l * (2.0d0 * (j * cos((k * 0.5d0)))))
else if (l <= 3d+102) then
tmp = t_1 + u
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)) * (J * (0.3333333333333333 * Math.pow(l, 3.0))));
double t_1 = (Math.exp(l) - Math.exp(-l)) * J;
double tmp;
if (l <= -8.2e+139) {
tmp = t_0;
} else if (l <= -36.0) {
tmp = t_1;
} else if (l <= 0.0115) {
tmp = U + (l * (2.0 * (J * Math.cos((K * 0.5)))));
} else if (l <= 3e+102) {
tmp = t_1 + U;
} else {
tmp = t_0;
}
return tmp;
}
def code(J, l, K, U): t_0 = U + (math.cos((K / 2.0)) * (J * (0.3333333333333333 * math.pow(l, 3.0)))) t_1 = (math.exp(l) - math.exp(-l)) * J tmp = 0 if l <= -8.2e+139: tmp = t_0 elif l <= -36.0: tmp = t_1 elif l <= 0.0115: tmp = U + (l * (2.0 * (J * math.cos((K * 0.5))))) elif l <= 3e+102: tmp = t_1 + U else: tmp = t_0 return tmp
function code(J, l, K, U) t_0 = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(J * Float64(0.3333333333333333 * (l ^ 3.0))))) t_1 = Float64(Float64(exp(l) - exp(Float64(-l))) * J) tmp = 0.0 if (l <= -8.2e+139) tmp = t_0; elseif (l <= -36.0) tmp = t_1; elseif (l <= 0.0115) tmp = Float64(U + Float64(l * Float64(2.0 * Float64(J * cos(Float64(K * 0.5)))))); elseif (l <= 3e+102) tmp = Float64(t_1 + U); else tmp = t_0; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = U + (cos((K / 2.0)) * (J * (0.3333333333333333 * (l ^ 3.0)))); t_1 = (exp(l) - exp(-l)) * J; tmp = 0.0; if (l <= -8.2e+139) tmp = t_0; elseif (l <= -36.0) tmp = t_1; elseif (l <= 0.0115) tmp = U + (l * (2.0 * (J * cos((K * 0.5))))); elseif (l <= 3e+102) tmp = t_1 + U; 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[(J * N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision]}, If[LessEqual[l, -8.2e+139], t$95$0, If[LessEqual[l, -36.0], t$95$1, If[LessEqual[l, 0.0115], N[(U + N[(l * N[(2.0 * N[(J * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 3e+102], N[(t$95$1 + U), $MachinePrecision], t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(0.3333333333333333 \cdot {\ell}^{3}\right)\right)\\
t_1 := \left(e^{\ell} - e^{-\ell}\right) \cdot J\\
\mathbf{if}\;\ell \leq -8.2 \cdot 10^{+139}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq -36:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\ell \leq 0.0115:\\
\;\;\;\;U + \ell \cdot \left(2 \cdot \left(J \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\mathbf{elif}\;\ell \leq 3 \cdot 10^{+102}:\\
\;\;\;\;t\_1 + U\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if l < -8.2000000000000004e139 or 2.9999999999999998e102 < l Initial program 100.0%
Taylor expanded in l around 0 100.0%
Taylor expanded in l around inf 100.0%
associate-*r*75.0%
*-commutative75.0%
associate-*r*75.0%
Simplified100.0%
if -8.2000000000000004e139 < l < -36Initial program 100.0%
Taylor expanded in K around 0 87.5%
Taylor expanded in J around inf 87.5%
if -36 < l < 0.0115Initial program 69.3%
Taylor expanded in l around 0 99.9%
*-commutative99.9%
*-commutative99.9%
associate-*r*99.9%
associate-*r*99.9%
*-commutative99.9%
*-commutative99.9%
distribute-lft-out99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in l around 0 99.7%
if 0.0115 < l < 2.9999999999999998e102Initial program 100.0%
Taylor expanded in K around 0 83.3%
Final simplification97.5%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0)))
(t_1 (+ U (* t_0 (* J (* 0.3333333333333333 (pow l 3.0))))))
(t_2 (* (- (exp l) (exp (- l))) J)))
(if (<= l -8.2e+139)
t_1
(if (<= l -200.0)
t_2
(if (<= l 0.16)
(+ U (* t_0 (* J (* l (+ 2.0 (* 0.3333333333333333 (pow l 2.0)))))))
(if (<= l 5.5e+102) (+ t_2 U) t_1))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double t_1 = U + (t_0 * (J * (0.3333333333333333 * pow(l, 3.0))));
double t_2 = (exp(l) - exp(-l)) * J;
double tmp;
if (l <= -8.2e+139) {
tmp = t_1;
} else if (l <= -200.0) {
tmp = t_2;
} else if (l <= 0.16) {
tmp = U + (t_0 * (J * (l * (2.0 + (0.3333333333333333 * pow(l, 2.0))))));
} else if (l <= 5.5e+102) {
tmp = t_2 + U;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = cos((k / 2.0d0))
t_1 = u + (t_0 * (j * (0.3333333333333333d0 * (l ** 3.0d0))))
t_2 = (exp(l) - exp(-l)) * j
if (l <= (-8.2d+139)) then
tmp = t_1
else if (l <= (-200.0d0)) then
tmp = t_2
else if (l <= 0.16d0) then
tmp = u + (t_0 * (j * (l * (2.0d0 + (0.3333333333333333d0 * (l ** 2.0d0))))))
else if (l <= 5.5d+102) then
tmp = t_2 + u
else
tmp = t_1
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = Math.cos((K / 2.0));
double t_1 = U + (t_0 * (J * (0.3333333333333333 * Math.pow(l, 3.0))));
double t_2 = (Math.exp(l) - Math.exp(-l)) * J;
double tmp;
if (l <= -8.2e+139) {
tmp = t_1;
} else if (l <= -200.0) {
tmp = t_2;
} else if (l <= 0.16) {
tmp = U + (t_0 * (J * (l * (2.0 + (0.3333333333333333 * Math.pow(l, 2.0))))));
} else if (l <= 5.5e+102) {
tmp = t_2 + U;
} else {
tmp = t_1;
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K / 2.0)) t_1 = U + (t_0 * (J * (0.3333333333333333 * math.pow(l, 3.0)))) t_2 = (math.exp(l) - math.exp(-l)) * J tmp = 0 if l <= -8.2e+139: tmp = t_1 elif l <= -200.0: tmp = t_2 elif l <= 0.16: tmp = U + (t_0 * (J * (l * (2.0 + (0.3333333333333333 * math.pow(l, 2.0)))))) elif l <= 5.5e+102: tmp = t_2 + U else: tmp = t_1 return tmp
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) t_1 = Float64(U + Float64(t_0 * Float64(J * Float64(0.3333333333333333 * (l ^ 3.0))))) t_2 = Float64(Float64(exp(l) - exp(Float64(-l))) * J) tmp = 0.0 if (l <= -8.2e+139) tmp = t_1; elseif (l <= -200.0) tmp = t_2; elseif (l <= 0.16) tmp = Float64(U + Float64(t_0 * Float64(J * Float64(l * Float64(2.0 + Float64(0.3333333333333333 * (l ^ 2.0))))))); elseif (l <= 5.5e+102) tmp = Float64(t_2 + U); else tmp = t_1; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = cos((K / 2.0)); t_1 = U + (t_0 * (J * (0.3333333333333333 * (l ^ 3.0)))); t_2 = (exp(l) - exp(-l)) * J; tmp = 0.0; if (l <= -8.2e+139) tmp = t_1; elseif (l <= -200.0) tmp = t_2; elseif (l <= 0.16) tmp = U + (t_0 * (J * (l * (2.0 + (0.3333333333333333 * (l ^ 2.0)))))); elseif (l <= 5.5e+102) tmp = t_2 + U; else tmp = t_1; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(U + N[(t$95$0 * N[(J * N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision]}, If[LessEqual[l, -8.2e+139], t$95$1, If[LessEqual[l, -200.0], t$95$2, If[LessEqual[l, 0.16], N[(U + N[(t$95$0 * N[(J * N[(l * N[(2.0 + N[(0.3333333333333333 * N[Power[l, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 5.5e+102], N[(t$95$2 + U), $MachinePrecision], t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
t_1 := U + t\_0 \cdot \left(J \cdot \left(0.3333333333333333 \cdot {\ell}^{3}\right)\right)\\
t_2 := \left(e^{\ell} - e^{-\ell}\right) \cdot J\\
\mathbf{if}\;\ell \leq -8.2 \cdot 10^{+139}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\ell \leq -200:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;\ell \leq 0.16:\\
\;\;\;\;U + t\_0 \cdot \left(J \cdot \left(\ell \cdot \left(2 + 0.3333333333333333 \cdot {\ell}^{2}\right)\right)\right)\\
\mathbf{elif}\;\ell \leq 5.5 \cdot 10^{+102}:\\
\;\;\;\;t\_2 + U\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if l < -8.2000000000000004e139 or 5.49999999999999981e102 < l Initial program 100.0%
Taylor expanded in l around 0 100.0%
Taylor expanded in l around inf 100.0%
associate-*r*75.0%
*-commutative75.0%
associate-*r*75.0%
Simplified100.0%
if -8.2000000000000004e139 < l < -200Initial program 100.0%
Taylor expanded in K around 0 87.5%
Taylor expanded in J around inf 87.5%
if -200 < l < 0.160000000000000003Initial program 69.3%
Taylor expanded in l around 0 99.9%
if 0.160000000000000003 < l < 5.49999999999999981e102Initial program 100.0%
Taylor expanded in K around 0 83.3%
Final simplification97.6%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (* 0.3333333333333333 (pow l 3.0)))
(t_1 (cos (/ K 2.0)))
(t_2 (+ U (* t_1 (* J t_0))))
(t_3 (* (- (exp l) (exp (- l))) J)))
(if (<= l -8.2e+139)
t_2
(if (<= l -310.0)
t_3
(if (<= l 0.19)
(+ U (* t_1 (* J (+ t_0 (* l 2.0)))))
(if (<= l 5.5e+102) (+ t_3 U) t_2))))))
double code(double J, double l, double K, double U) {
double t_0 = 0.3333333333333333 * pow(l, 3.0);
double t_1 = cos((K / 2.0));
double t_2 = U + (t_1 * (J * t_0));
double t_3 = (exp(l) - exp(-l)) * J;
double tmp;
if (l <= -8.2e+139) {
tmp = t_2;
} else if (l <= -310.0) {
tmp = t_3;
} else if (l <= 0.19) {
tmp = U + (t_1 * (J * (t_0 + (l * 2.0))));
} else if (l <= 5.5e+102) {
tmp = t_3 + U;
} else {
tmp = t_2;
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_0 = 0.3333333333333333d0 * (l ** 3.0d0)
t_1 = cos((k / 2.0d0))
t_2 = u + (t_1 * (j * t_0))
t_3 = (exp(l) - exp(-l)) * j
if (l <= (-8.2d+139)) then
tmp = t_2
else if (l <= (-310.0d0)) then
tmp = t_3
else if (l <= 0.19d0) then
tmp = u + (t_1 * (j * (t_0 + (l * 2.0d0))))
else if (l <= 5.5d+102) then
tmp = t_3 + u
else
tmp = t_2
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = 0.3333333333333333 * Math.pow(l, 3.0);
double t_1 = Math.cos((K / 2.0));
double t_2 = U + (t_1 * (J * t_0));
double t_3 = (Math.exp(l) - Math.exp(-l)) * J;
double tmp;
if (l <= -8.2e+139) {
tmp = t_2;
} else if (l <= -310.0) {
tmp = t_3;
} else if (l <= 0.19) {
tmp = U + (t_1 * (J * (t_0 + (l * 2.0))));
} else if (l <= 5.5e+102) {
tmp = t_3 + U;
} else {
tmp = t_2;
}
return tmp;
}
def code(J, l, K, U): t_0 = 0.3333333333333333 * math.pow(l, 3.0) t_1 = math.cos((K / 2.0)) t_2 = U + (t_1 * (J * t_0)) t_3 = (math.exp(l) - math.exp(-l)) * J tmp = 0 if l <= -8.2e+139: tmp = t_2 elif l <= -310.0: tmp = t_3 elif l <= 0.19: tmp = U + (t_1 * (J * (t_0 + (l * 2.0)))) elif l <= 5.5e+102: tmp = t_3 + U else: tmp = t_2 return tmp
function code(J, l, K, U) t_0 = Float64(0.3333333333333333 * (l ^ 3.0)) t_1 = cos(Float64(K / 2.0)) t_2 = Float64(U + Float64(t_1 * Float64(J * t_0))) t_3 = Float64(Float64(exp(l) - exp(Float64(-l))) * J) tmp = 0.0 if (l <= -8.2e+139) tmp = t_2; elseif (l <= -310.0) tmp = t_3; elseif (l <= 0.19) tmp = Float64(U + Float64(t_1 * Float64(J * Float64(t_0 + Float64(l * 2.0))))); elseif (l <= 5.5e+102) tmp = Float64(t_3 + U); else tmp = t_2; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = 0.3333333333333333 * (l ^ 3.0); t_1 = cos((K / 2.0)); t_2 = U + (t_1 * (J * t_0)); t_3 = (exp(l) - exp(-l)) * J; tmp = 0.0; if (l <= -8.2e+139) tmp = t_2; elseif (l <= -310.0) tmp = t_3; elseif (l <= 0.19) tmp = U + (t_1 * (J * (t_0 + (l * 2.0)))); elseif (l <= 5.5e+102) tmp = t_3 + U; else tmp = t_2; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(0.3333333333333333 * N[Power[l, 3.0], $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[(J * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision]}, If[LessEqual[l, -8.2e+139], t$95$2, If[LessEqual[l, -310.0], t$95$3, If[LessEqual[l, 0.19], N[(U + N[(t$95$1 * N[(J * N[(t$95$0 + N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 5.5e+102], N[(t$95$3 + U), $MachinePrecision], t$95$2]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.3333333333333333 \cdot {\ell}^{3}\\
t_1 := \cos \left(\frac{K}{2}\right)\\
t_2 := U + t\_1 \cdot \left(J \cdot t\_0\right)\\
t_3 := \left(e^{\ell} - e^{-\ell}\right) \cdot J\\
\mathbf{if}\;\ell \leq -8.2 \cdot 10^{+139}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;\ell \leq -310:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;\ell \leq 0.19:\\
\;\;\;\;U + t\_1 \cdot \left(J \cdot \left(t\_0 + \ell \cdot 2\right)\right)\\
\mathbf{elif}\;\ell \leq 5.5 \cdot 10^{+102}:\\
\;\;\;\;t\_3 + U\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if l < -8.2000000000000004e139 or 5.49999999999999981e102 < l Initial program 100.0%
Taylor expanded in l around 0 100.0%
Taylor expanded in l around inf 100.0%
associate-*r*75.0%
*-commutative75.0%
associate-*r*75.0%
Simplified100.0%
if -8.2000000000000004e139 < l < -310Initial program 100.0%
Taylor expanded in K around 0 87.5%
Taylor expanded in J around inf 87.5%
if -310 < l < 0.19Initial program 69.3%
Taylor expanded in l around 0 99.9%
distribute-rgt-in99.9%
*-commutative99.9%
associate-*l*99.9%
unpow299.9%
pow399.9%
Applied egg-rr99.9%
if 0.19 < l < 5.49999999999999981e102Initial program 100.0%
Taylor expanded in K around 0 83.3%
Final simplification97.6%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.005) (+ U (* (cos (* K 0.5)) (* l (* J 2.0)))) (+ U (* J (* l (+ 2.0 (* 0.3333333333333333 (pow l 2.0))))))))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.005) {
tmp = U + (cos((K * 0.5)) * (l * (J * 2.0)));
} else {
tmp = U + (J * (l * (2.0 + (0.3333333333333333 * pow(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.005d0)) then
tmp = u + (cos((k * 0.5d0)) * (l * (j * 2.0d0)))
else
tmp = u + (j * (l * (2.0d0 + (0.3333333333333333d0 * (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.005) {
tmp = U + (Math.cos((K * 0.5)) * (l * (J * 2.0)));
} else {
tmp = U + (J * (l * (2.0 + (0.3333333333333333 * Math.pow(l, 2.0)))));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if math.cos((K / 2.0)) <= -0.005: tmp = U + (math.cos((K * 0.5)) * (l * (J * 2.0))) else: tmp = U + (J * (l * (2.0 + (0.3333333333333333 * math.pow(l, 2.0))))) return tmp
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.005) tmp = Float64(U + Float64(cos(Float64(K * 0.5)) * Float64(l * Float64(J * 2.0)))); else tmp = Float64(U + Float64(J * Float64(l * Float64(2.0 + Float64(0.3333333333333333 * (l ^ 2.0)))))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (cos((K / 2.0)) <= -0.005) tmp = U + (cos((K * 0.5)) * (l * (J * 2.0))); else tmp = U + (J * (l * (2.0 + (0.3333333333333333 * (l ^ 2.0))))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.005], N[(U + N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * N[(l * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * N[(l * N[(2.0 + N[(0.3333333333333333 * N[Power[l, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.005:\\
\;\;\;\;U + \cos \left(K \cdot 0.5\right) \cdot \left(\ell \cdot \left(J \cdot 2\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(\ell \cdot \left(2 + 0.3333333333333333 \cdot {\ell}^{2}\right)\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0050000000000000001Initial program 80.5%
Taylor expanded in l around 0 72.1%
associate-*r*72.1%
associate-*r*73.6%
Simplified73.6%
if -0.0050000000000000001 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 82.7%
Taylor expanded in l around 0 88.9%
Taylor expanded in K around 0 84.7%
Final simplification82.3%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (* (- (exp l) (exp (- l))) J)))
(if (<= l -360.0)
t_0
(if (<= l 0.012) (+ U (* l (* 2.0 (* J (cos (* K 0.5)))))) (+ t_0 U)))))
double code(double J, double l, double K, double U) {
double t_0 = (exp(l) - exp(-l)) * J;
double tmp;
if (l <= -360.0) {
tmp = t_0;
} else if (l <= 0.012) {
tmp = U + (l * (2.0 * (J * cos((K * 0.5)))));
} else {
tmp = t_0 + 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) :: t_0
real(8) :: tmp
t_0 = (exp(l) - exp(-l)) * j
if (l <= (-360.0d0)) then
tmp = t_0
else if (l <= 0.012d0) then
tmp = u + (l * (2.0d0 * (j * cos((k * 0.5d0)))))
else
tmp = t_0 + u
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 <= -360.0) {
tmp = t_0;
} else if (l <= 0.012) {
tmp = U + (l * (2.0 * (J * Math.cos((K * 0.5)))));
} else {
tmp = t_0 + U;
}
return tmp;
}
def code(J, l, K, U): t_0 = (math.exp(l) - math.exp(-l)) * J tmp = 0 if l <= -360.0: tmp = t_0 elif l <= 0.012: tmp = U + (l * (2.0 * (J * math.cos((K * 0.5))))) else: tmp = t_0 + U return tmp
function code(J, l, K, U) t_0 = Float64(Float64(exp(l) - exp(Float64(-l))) * J) tmp = 0.0 if (l <= -360.0) tmp = t_0; elseif (l <= 0.012) tmp = Float64(U + Float64(l * Float64(2.0 * Float64(J * cos(Float64(K * 0.5)))))); else tmp = Float64(t_0 + U); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = (exp(l) - exp(-l)) * J; tmp = 0.0; if (l <= -360.0) tmp = t_0; elseif (l <= 0.012) tmp = U + (l * (2.0 * (J * cos((K * 0.5))))); else tmp = t_0 + U; 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, -360.0], t$95$0, If[LessEqual[l, 0.012], N[(U + N[(l * N[(2.0 * N[(J * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 + U), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(e^{\ell} - e^{-\ell}\right) \cdot J\\
\mathbf{if}\;\ell \leq -360:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq 0.012:\\
\;\;\;\;U + \ell \cdot \left(2 \cdot \left(J \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0 + U\\
\end{array}
\end{array}
if l < -360Initial program 100.0%
Taylor expanded in K around 0 83.9%
Taylor expanded in J around inf 83.9%
if -360 < l < 0.012Initial program 69.3%
Taylor expanded in l around 0 99.9%
*-commutative99.9%
*-commutative99.9%
associate-*r*99.9%
associate-*r*99.9%
*-commutative99.9%
*-commutative99.9%
distribute-lft-out99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in l around 0 99.7%
if 0.012 < l Initial program 100.0%
Taylor expanded in K around 0 75.0%
Final simplification91.2%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (+ U (* J (* 0.3333333333333333 (pow l 3.0))))))
(if (<= l -4.5e+60)
t_0
(if (<= l -1800.0)
(pow U -4.0)
(if (<= l 145000.0) (+ U (* 2.0 (* J (* l (cos (* K 0.5)))))) t_0)))))
double code(double J, double l, double K, double U) {
double t_0 = U + (J * (0.3333333333333333 * pow(l, 3.0)));
double tmp;
if (l <= -4.5e+60) {
tmp = t_0;
} else if (l <= -1800.0) {
tmp = pow(U, -4.0);
} else if (l <= 145000.0) {
tmp = U + (2.0 * (J * (l * cos((K * 0.5)))));
} 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) :: tmp
t_0 = u + (j * (0.3333333333333333d0 * (l ** 3.0d0)))
if (l <= (-4.5d+60)) then
tmp = t_0
else if (l <= (-1800.0d0)) then
tmp = u ** (-4.0d0)
else if (l <= 145000.0d0) then
tmp = u + (2.0d0 * (j * (l * cos((k * 0.5d0)))))
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 * (0.3333333333333333 * Math.pow(l, 3.0)));
double tmp;
if (l <= -4.5e+60) {
tmp = t_0;
} else if (l <= -1800.0) {
tmp = Math.pow(U, -4.0);
} else if (l <= 145000.0) {
tmp = U + (2.0 * (J * (l * Math.cos((K * 0.5)))));
} else {
tmp = t_0;
}
return tmp;
}
def code(J, l, K, U): t_0 = U + (J * (0.3333333333333333 * math.pow(l, 3.0))) tmp = 0 if l <= -4.5e+60: tmp = t_0 elif l <= -1800.0: tmp = math.pow(U, -4.0) elif l <= 145000.0: tmp = U + (2.0 * (J * (l * math.cos((K * 0.5))))) else: tmp = t_0 return tmp
function code(J, l, K, U) t_0 = Float64(U + Float64(J * Float64(0.3333333333333333 * (l ^ 3.0)))) tmp = 0.0 if (l <= -4.5e+60) tmp = t_0; elseif (l <= -1800.0) tmp = U ^ -4.0; elseif (l <= 145000.0) tmp = Float64(U + Float64(2.0 * Float64(J * Float64(l * cos(Float64(K * 0.5)))))); else tmp = t_0; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = U + (J * (0.3333333333333333 * (l ^ 3.0))); tmp = 0.0; if (l <= -4.5e+60) tmp = t_0; elseif (l <= -1800.0) tmp = U ^ -4.0; elseif (l <= 145000.0) tmp = U + (2.0 * (J * (l * cos((K * 0.5))))); else tmp = t_0; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(U + N[(J * N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -4.5e+60], t$95$0, If[LessEqual[l, -1800.0], N[Power[U, -4.0], $MachinePrecision], If[LessEqual[l, 145000.0], N[(U + N[(2.0 * N[(J * N[(l * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + J \cdot \left(0.3333333333333333 \cdot {\ell}^{3}\right)\\
\mathbf{if}\;\ell \leq -4.5 \cdot 10^{+60}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq -1800:\\
\;\;\;\;{U}^{-4}\\
\mathbf{elif}\;\ell \leq 145000:\\
\;\;\;\;U + 2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if l < -4.50000000000000013e60 or 145000 < l Initial program 100.0%
Taylor expanded in l around 0 84.6%
Taylor expanded in K around 0 66.4%
Taylor expanded in l around inf 66.4%
associate-*r*66.4%
*-commutative66.4%
associate-*r*66.4%
Simplified66.4%
if -4.50000000000000013e60 < l < -1800Initial program 100.0%
Applied egg-rr1.4%
Applied egg-rr43.8%
if -1800 < l < 145000Initial program 69.3%
Taylor expanded in l around 0 99.7%
Final simplification84.4%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (+ U (* J (* 0.3333333333333333 (pow l 3.0))))))
(if (<= l -3.8e+60)
t_0
(if (<= l -720.0)
(pow U -4.0)
(if (<= l 26000.0) (+ U (* l (* 2.0 (* J (cos (* K 0.5)))))) t_0)))))
double code(double J, double l, double K, double U) {
double t_0 = U + (J * (0.3333333333333333 * pow(l, 3.0)));
double tmp;
if (l <= -3.8e+60) {
tmp = t_0;
} else if (l <= -720.0) {
tmp = pow(U, -4.0);
} else if (l <= 26000.0) {
tmp = U + (l * (2.0 * (J * cos((K * 0.5)))));
} 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) :: tmp
t_0 = u + (j * (0.3333333333333333d0 * (l ** 3.0d0)))
if (l <= (-3.8d+60)) then
tmp = t_0
else if (l <= (-720.0d0)) then
tmp = u ** (-4.0d0)
else if (l <= 26000.0d0) then
tmp = u + (l * (2.0d0 * (j * cos((k * 0.5d0)))))
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 * (0.3333333333333333 * Math.pow(l, 3.0)));
double tmp;
if (l <= -3.8e+60) {
tmp = t_0;
} else if (l <= -720.0) {
tmp = Math.pow(U, -4.0);
} else if (l <= 26000.0) {
tmp = U + (l * (2.0 * (J * Math.cos((K * 0.5)))));
} else {
tmp = t_0;
}
return tmp;
}
def code(J, l, K, U): t_0 = U + (J * (0.3333333333333333 * math.pow(l, 3.0))) tmp = 0 if l <= -3.8e+60: tmp = t_0 elif l <= -720.0: tmp = math.pow(U, -4.0) elif l <= 26000.0: tmp = U + (l * (2.0 * (J * math.cos((K * 0.5))))) else: tmp = t_0 return tmp
function code(J, l, K, U) t_0 = Float64(U + Float64(J * Float64(0.3333333333333333 * (l ^ 3.0)))) tmp = 0.0 if (l <= -3.8e+60) tmp = t_0; elseif (l <= -720.0) tmp = U ^ -4.0; elseif (l <= 26000.0) tmp = Float64(U + Float64(l * Float64(2.0 * Float64(J * cos(Float64(K * 0.5)))))); else tmp = t_0; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = U + (J * (0.3333333333333333 * (l ^ 3.0))); tmp = 0.0; if (l <= -3.8e+60) tmp = t_0; elseif (l <= -720.0) tmp = U ^ -4.0; elseif (l <= 26000.0) tmp = U + (l * (2.0 * (J * cos((K * 0.5))))); else tmp = t_0; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(U + N[(J * N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -3.8e+60], t$95$0, If[LessEqual[l, -720.0], N[Power[U, -4.0], $MachinePrecision], If[LessEqual[l, 26000.0], N[(U + N[(l * N[(2.0 * N[(J * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + J \cdot \left(0.3333333333333333 \cdot {\ell}^{3}\right)\\
\mathbf{if}\;\ell \leq -3.8 \cdot 10^{+60}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq -720:\\
\;\;\;\;{U}^{-4}\\
\mathbf{elif}\;\ell \leq 26000:\\
\;\;\;\;U + \ell \cdot \left(2 \cdot \left(J \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if l < -3.80000000000000009e60 or 26000 < l Initial program 100.0%
Taylor expanded in l around 0 84.6%
Taylor expanded in K around 0 66.4%
Taylor expanded in l around inf 66.4%
associate-*r*66.4%
*-commutative66.4%
associate-*r*66.4%
Simplified66.4%
if -3.80000000000000009e60 < l < -720Initial program 100.0%
Applied egg-rr1.4%
Applied egg-rr43.8%
if -720 < l < 26000Initial program 69.3%
Taylor expanded in l around 0 99.9%
*-commutative99.9%
*-commutative99.9%
associate-*r*99.9%
associate-*r*99.9%
*-commutative99.9%
*-commutative99.9%
distribute-lft-out99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in l around 0 99.7%
Final simplification84.4%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (+ U (* J (* 0.3333333333333333 (pow l 3.0))))))
(if (<= l -3.5e+60)
t_0
(if (<= l -860.0)
(pow U -4.0)
(if (<= l 1.3e-23) (+ U (* J (* l 2.0))) t_0)))))
double code(double J, double l, double K, double U) {
double t_0 = U + (J * (0.3333333333333333 * pow(l, 3.0)));
double tmp;
if (l <= -3.5e+60) {
tmp = t_0;
} else if (l <= -860.0) {
tmp = pow(U, -4.0);
} else if (l <= 1.3e-23) {
tmp = U + (J * (l * 2.0));
} 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) :: tmp
t_0 = u + (j * (0.3333333333333333d0 * (l ** 3.0d0)))
if (l <= (-3.5d+60)) then
tmp = t_0
else if (l <= (-860.0d0)) then
tmp = u ** (-4.0d0)
else if (l <= 1.3d-23) then
tmp = u + (j * (l * 2.0d0))
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 * (0.3333333333333333 * Math.pow(l, 3.0)));
double tmp;
if (l <= -3.5e+60) {
tmp = t_0;
} else if (l <= -860.0) {
tmp = Math.pow(U, -4.0);
} else if (l <= 1.3e-23) {
tmp = U + (J * (l * 2.0));
} else {
tmp = t_0;
}
return tmp;
}
def code(J, l, K, U): t_0 = U + (J * (0.3333333333333333 * math.pow(l, 3.0))) tmp = 0 if l <= -3.5e+60: tmp = t_0 elif l <= -860.0: tmp = math.pow(U, -4.0) elif l <= 1.3e-23: tmp = U + (J * (l * 2.0)) else: tmp = t_0 return tmp
function code(J, l, K, U) t_0 = Float64(U + Float64(J * Float64(0.3333333333333333 * (l ^ 3.0)))) tmp = 0.0 if (l <= -3.5e+60) tmp = t_0; elseif (l <= -860.0) tmp = U ^ -4.0; elseif (l <= 1.3e-23) tmp = Float64(U + Float64(J * Float64(l * 2.0))); else tmp = t_0; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = U + (J * (0.3333333333333333 * (l ^ 3.0))); tmp = 0.0; if (l <= -3.5e+60) tmp = t_0; elseif (l <= -860.0) tmp = U ^ -4.0; elseif (l <= 1.3e-23) tmp = U + (J * (l * 2.0)); else tmp = t_0; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(U + N[(J * N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -3.5e+60], t$95$0, If[LessEqual[l, -860.0], N[Power[U, -4.0], $MachinePrecision], If[LessEqual[l, 1.3e-23], N[(U + N[(J * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + J \cdot \left(0.3333333333333333 \cdot {\ell}^{3}\right)\\
\mathbf{if}\;\ell \leq -3.5 \cdot 10^{+60}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq -860:\\
\;\;\;\;{U}^{-4}\\
\mathbf{elif}\;\ell \leq 1.3 \cdot 10^{-23}:\\
\;\;\;\;U + J \cdot \left(\ell \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if l < -3.5000000000000002e60 or 1.3e-23 < l Initial program 98.9%
Taylor expanded in l around 0 85.4%
Taylor expanded in K around 0 66.1%
Taylor expanded in l around inf 66.1%
associate-*r*66.1%
*-commutative66.1%
associate-*r*66.1%
Simplified66.1%
if -3.5000000000000002e60 < l < -860Initial program 100.0%
Applied egg-rr1.4%
Applied egg-rr43.8%
if -860 < l < 1.3e-23Initial program 69.0%
Taylor expanded in l around 0 99.9%
Taylor expanded in K around 0 87.0%
Taylor expanded in l around 0 87.0%
Final simplification76.6%
(FPCore (J l K U) :precision binary64 (if (or (<= l -1.55e-13) (not (<= l 16500000000000.0))) (* U (+ U -1.0)) U))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -1.55e-13) || !(l <= 16500000000000.0)) {
tmp = U * (U + -1.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 <= (-1.55d-13)) .or. (.not. (l <= 16500000000000.0d0))) then
tmp = u * (u + (-1.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 <= -1.55e-13) || !(l <= 16500000000000.0)) {
tmp = U * (U + -1.0);
} else {
tmp = U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -1.55e-13) or not (l <= 16500000000000.0): tmp = U * (U + -1.0) else: tmp = U return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -1.55e-13) || !(l <= 16500000000000.0)) tmp = Float64(U * Float64(U + -1.0)); else tmp = U; end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -1.55e-13) || ~((l <= 16500000000000.0))) tmp = U * (U + -1.0); else tmp = U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -1.55e-13], N[Not[LessEqual[l, 16500000000000.0]], $MachinePrecision]], N[(U * N[(U + -1.0), $MachinePrecision]), $MachinePrecision], U]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.55 \cdot 10^{-13} \lor \neg \left(\ell \leq 16500000000000\right):\\
\;\;\;\;U \cdot \left(U + -1\right)\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\end{array}
if l < -1.55e-13 or 1.65e13 < l Initial program 99.4%
Applied egg-rr2.7%
Applied egg-rr22.9%
fma-undefine22.9%
neg-mul-122.9%
distribute-rgt-out22.9%
Simplified22.9%
if -1.55e-13 < l < 1.65e13Initial program 69.7%
Applied egg-rr41.8%
Taylor expanded in J around 0 68.4%
Final simplification49.2%
(FPCore (J l K U) :precision binary64 (if (or (<= l -1.55e-13) (not (<= l 20000000000000.0))) (* U U) U))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -1.55e-13) || !(l <= 20000000000000.0)) {
tmp = U * U;
} else {
tmp = U;
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if ((l <= (-1.55d-13)) .or. (.not. (l <= 20000000000000.0d0))) then
tmp = u * u
else
tmp = u
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -1.55e-13) || !(l <= 20000000000000.0)) {
tmp = U * U;
} else {
tmp = U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -1.55e-13) or not (l <= 20000000000000.0): tmp = U * U else: tmp = U return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -1.55e-13) || !(l <= 20000000000000.0)) tmp = Float64(U * U); else tmp = U; end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -1.55e-13) || ~((l <= 20000000000000.0))) tmp = U * U; else tmp = U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -1.55e-13], N[Not[LessEqual[l, 20000000000000.0]], $MachinePrecision]], N[(U * U), $MachinePrecision], U]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.55 \cdot 10^{-13} \lor \neg \left(\ell \leq 20000000000000\right):\\
\;\;\;\;U \cdot U\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\end{array}
if l < -1.55e-13 or 2e13 < l Initial program 99.4%
Applied egg-rr2.7%
Applied egg-rr22.8%
if -1.55e-13 < l < 2e13Initial program 69.7%
Applied egg-rr41.8%
Taylor expanded in J around 0 68.4%
Final simplification49.2%
(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 82.3%
Taylor expanded in l around 0 89.8%
Taylor expanded in K around 0 74.8%
Taylor expanded in l around 0 58.5%
Final simplification58.5%
(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 82.3%
Applied egg-rr25.3%
Taylor expanded in J around 0 40.5%
Final simplification40.5%
herbie shell --seed 2024059
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))