
(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 (cos (/ K 2.0))) (t_1 (- (exp l) (exp (- l)))))
(if (or (<= t_1 (- INFINITY)) (not (<= t_1 1e-10)))
(+ (* t_0 (* t_1 J)) U)
(+
U
(*
t_0
(+
(* 2.0 (* l J))
(+
(* 0.3333333333333333 (* J (pow l 3.0)))
(* 0.016666666666666666 (* J (pow l 5.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 <= 1e-10)) {
tmp = (t_0 * (t_1 * J)) + U;
} else {
tmp = U + (t_0 * ((2.0 * (l * J)) + ((0.3333333333333333 * (J * pow(l, 3.0))) + (0.016666666666666666 * (J * pow(l, 5.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 <= 1e-10)) {
tmp = (t_0 * (t_1 * J)) + U;
} else {
tmp = U + (t_0 * ((2.0 * (l * J)) + ((0.3333333333333333 * (J * Math.pow(l, 3.0))) + (0.016666666666666666 * (J * Math.pow(l, 5.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 <= 1e-10): tmp = (t_0 * (t_1 * J)) + U else: tmp = U + (t_0 * ((2.0 * (l * J)) + ((0.3333333333333333 * (J * math.pow(l, 3.0))) + (0.016666666666666666 * (J * math.pow(l, 5.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 <= 1e-10)) tmp = Float64(Float64(t_0 * Float64(t_1 * J)) + U); else tmp = Float64(U + Float64(t_0 * Float64(Float64(2.0 * Float64(l * J)) + Float64(Float64(0.3333333333333333 * Float64(J * (l ^ 3.0))) + Float64(0.016666666666666666 * Float64(J * (l ^ 5.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 <= 1e-10))) tmp = (t_0 * (t_1 * J)) + U; else tmp = U + (t_0 * ((2.0 * (l * J)) + ((0.3333333333333333 * (J * (l ^ 3.0))) + (0.016666666666666666 * (J * (l ^ 5.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, 1e-10]], $MachinePrecision]], N[(N[(t$95$0 * N[(t$95$1 * J), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], N[(U + N[(t$95$0 * N[(N[(2.0 * N[(l * J), $MachinePrecision]), $MachinePrecision] + N[(N[(0.3333333333333333 * N[(J * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.016666666666666666 * N[(J * N[Power[l, 5.0], $MachinePrecision]), $MachinePrecision]), $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 10^{-10}\right):\\
\;\;\;\;t_0 \cdot \left(t_1 \cdot J\right) + U\\
\mathbf{else}:\\
\;\;\;\;U + t_0 \cdot \left(2 \cdot \left(\ell \cdot J\right) + \left(0.3333333333333333 \cdot \left(J \cdot {\ell}^{3}\right) + 0.016666666666666666 \cdot \left(J \cdot {\ell}^{5}\right)\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -inf.0 or 1.00000000000000004e-10 < (-.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))) < 1.00000000000000004e-10Initial program 69.6%
Taylor expanded in l around 0 99.9%
associate-+r+99.9%
+-commutative99.9%
fma-def99.9%
fma-def99.9%
Simplified99.9%
Taylor expanded in l around 0 99.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 1e-10)))
(+ (* t_0 (* t_1 J)) U)
(+
U
(*
t_0
(*
J
(+
(* 0.3333333333333333 (pow l 3.0))
(+ (* 0.016666666666666666 (pow l 5.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 <= 1e-10)) {
tmp = (t_0 * (t_1 * J)) + U;
} else {
tmp = U + (t_0 * (J * ((0.3333333333333333 * pow(l, 3.0)) + ((0.016666666666666666 * pow(l, 5.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 <= 1e-10)) {
tmp = (t_0 * (t_1 * J)) + U;
} else {
tmp = U + (t_0 * (J * ((0.3333333333333333 * Math.pow(l, 3.0)) + ((0.016666666666666666 * Math.pow(l, 5.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 <= 1e-10): tmp = (t_0 * (t_1 * J)) + U else: tmp = U + (t_0 * (J * ((0.3333333333333333 * math.pow(l, 3.0)) + ((0.016666666666666666 * math.pow(l, 5.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 <= 1e-10)) 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(Float64(0.016666666666666666 * (l ^ 5.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 <= 1e-10))) tmp = (t_0 * (t_1 * J)) + U; else tmp = U + (t_0 * (J * ((0.3333333333333333 * (l ^ 3.0)) + ((0.016666666666666666 * (l ^ 5.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, 1e-10]], $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[(N[(0.016666666666666666 * N[Power[l, 5.0], $MachinePrecision]), $MachinePrecision] + N[(l * 2.0), $MachinePrecision]), $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 10^{-10}\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} + \left(0.016666666666666666 \cdot {\ell}^{5} + \ell \cdot 2\right)\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -inf.0 or 1.00000000000000004e-10 < (-.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))) < 1.00000000000000004e-10Initial program 69.6%
Taylor expanded in l around 0 99.9%
Final simplification100.0%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (- (exp l) (exp (- l)))))
(if (or (<= t_0 -0.002) (not (<= t_0 1e-10)))
(+ (* (cos (/ K 2.0)) (* t_0 J)) U)
(+
U
(*
J
(* (cos (* K 0.5)) (fma 0.3333333333333333 (pow l 3.0) (* l 2.0))))))))
double code(double J, double l, double K, double U) {
double t_0 = exp(l) - exp(-l);
double tmp;
if ((t_0 <= -0.002) || !(t_0 <= 1e-10)) {
tmp = (cos((K / 2.0)) * (t_0 * J)) + U;
} else {
tmp = U + (J * (cos((K * 0.5)) * fma(0.3333333333333333, pow(l, 3.0), (l * 2.0))));
}
return tmp;
}
function code(J, l, K, U) t_0 = Float64(exp(l) - exp(Float64(-l))) tmp = 0.0 if ((t_0 <= -0.002) || !(t_0 <= 1e-10)) tmp = Float64(Float64(cos(Float64(K / 2.0)) * Float64(t_0 * J)) + U); else tmp = Float64(U + Float64(J * Float64(cos(Float64(K * 0.5)) * fma(0.3333333333333333, (l ^ 3.0), Float64(l * 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, -0.002], N[Not[LessEqual[t$95$0, 1e-10]], $MachinePrecision]], N[(N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(t$95$0 * J), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], N[(U + N[(J * N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision] + N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{\ell} - e^{-\ell}\\
\mathbf{if}\;t_0 \leq -0.002 \lor \neg \left(t_0 \leq 10^{-10}\right):\\
\;\;\;\;\cos \left(\frac{K}{2}\right) \cdot \left(t_0 \cdot J\right) + U\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(\cos \left(K \cdot 0.5\right) \cdot \mathsf{fma}\left(0.3333333333333333, {\ell}^{3}, \ell \cdot 2\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -2e-3 or 1.00000000000000004e-10 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 99.9%
if -2e-3 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 1.00000000000000004e-10Initial program 69.2%
Taylor expanded in l around 0 99.9%
associate-*r*100.0%
associate-*r*100.0%
associate-*r*100.0%
associate-*r*100.0%
distribute-rgt-out100.0%
*-commutative100.0%
associate-*r*99.9%
*-commutative99.9%
associate-*r*99.9%
distribute-rgt-out99.9%
+-commutative99.9%
fma-def99.9%
Simplified99.9%
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 -0.002) (not (<= t_1 1e-10)))
(+ (* 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 <= -0.002) || !(t_1 <= 1e-10)) {
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 <= (-0.002d0)) .or. (.not. (t_1 <= 1d-10))) 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 <= -0.002) || !(t_1 <= 1e-10)) {
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 <= -0.002) or not (t_1 <= 1e-10): 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 <= -0.002) || !(t_1 <= 1e-10)) 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 <= -0.002) || ~((t_1 <= 1e-10))) 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, -0.002], N[Not[LessEqual[t$95$1, 1e-10]], $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 -0.002 \lor \neg \left(t_1 \leq 10^{-10}\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))) < -2e-3 or 1.00000000000000004e-10 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 99.9%
if -2e-3 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 1.00000000000000004e-10Initial program 69.2%
Taylor expanded in l around 0 99.9%
Final simplification99.9%
(FPCore (J l K U)
:precision binary64
(let* ((t_0
(+ U (* (* J (pow l 5.0)) (* 0.016666666666666666 (cos (* K 0.5)))))))
(if (<= l -5.0)
t_0
(if (<= l 3.3)
(+
U
(*
(cos (/ K 2.0))
(* J (+ (* 0.3333333333333333 (pow l 3.0)) (* l 2.0)))))
(if (<= l 4.2e+61)
(+ U (* (+ (* -0.125 (* K K)) 1.0) (* (- (exp l) (exp (- l))) J)))
t_0)))))
double code(double J, double l, double K, double U) {
double t_0 = U + ((J * pow(l, 5.0)) * (0.016666666666666666 * cos((K * 0.5))));
double tmp;
if (l <= -5.0) {
tmp = t_0;
} else if (l <= 3.3) {
tmp = U + (cos((K / 2.0)) * (J * ((0.3333333333333333 * pow(l, 3.0)) + (l * 2.0))));
} else if (l <= 4.2e+61) {
tmp = U + (((-0.125 * (K * K)) + 1.0) * ((exp(l) - exp(-l)) * J));
} 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 * (l ** 5.0d0)) * (0.016666666666666666d0 * cos((k * 0.5d0))))
if (l <= (-5.0d0)) then
tmp = t_0
else if (l <= 3.3d0) then
tmp = u + (cos((k / 2.0d0)) * (j * ((0.3333333333333333d0 * (l ** 3.0d0)) + (l * 2.0d0))))
else if (l <= 4.2d+61) then
tmp = u + ((((-0.125d0) * (k * k)) + 1.0d0) * ((exp(l) - exp(-l)) * j))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = U + ((J * Math.pow(l, 5.0)) * (0.016666666666666666 * Math.cos((K * 0.5))));
double tmp;
if (l <= -5.0) {
tmp = t_0;
} else if (l <= 3.3) {
tmp = U + (Math.cos((K / 2.0)) * (J * ((0.3333333333333333 * Math.pow(l, 3.0)) + (l * 2.0))));
} else if (l <= 4.2e+61) {
tmp = U + (((-0.125 * (K * K)) + 1.0) * ((Math.exp(l) - Math.exp(-l)) * J));
} else {
tmp = t_0;
}
return tmp;
}
def code(J, l, K, U): t_0 = U + ((J * math.pow(l, 5.0)) * (0.016666666666666666 * math.cos((K * 0.5)))) tmp = 0 if l <= -5.0: tmp = t_0 elif l <= 3.3: tmp = U + (math.cos((K / 2.0)) * (J * ((0.3333333333333333 * math.pow(l, 3.0)) + (l * 2.0)))) elif l <= 4.2e+61: tmp = U + (((-0.125 * (K * K)) + 1.0) * ((math.exp(l) - math.exp(-l)) * J)) else: tmp = t_0 return tmp
function code(J, l, K, U) t_0 = Float64(U + Float64(Float64(J * (l ^ 5.0)) * Float64(0.016666666666666666 * cos(Float64(K * 0.5))))) tmp = 0.0 if (l <= -5.0) tmp = t_0; elseif (l <= 3.3) tmp = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(J * Float64(Float64(0.3333333333333333 * (l ^ 3.0)) + Float64(l * 2.0))))); elseif (l <= 4.2e+61) tmp = Float64(U + Float64(Float64(Float64(-0.125 * Float64(K * K)) + 1.0) * Float64(Float64(exp(l) - exp(Float64(-l))) * J))); else tmp = t_0; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = U + ((J * (l ^ 5.0)) * (0.016666666666666666 * cos((K * 0.5)))); tmp = 0.0; if (l <= -5.0) tmp = t_0; elseif (l <= 3.3) tmp = U + (cos((K / 2.0)) * (J * ((0.3333333333333333 * (l ^ 3.0)) + (l * 2.0)))); elseif (l <= 4.2e+61) tmp = U + (((-0.125 * (K * K)) + 1.0) * ((exp(l) - exp(-l)) * J)); else tmp = t_0; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(U + N[(N[(J * N[Power[l, 5.0], $MachinePrecision]), $MachinePrecision] * N[(0.016666666666666666 * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -5.0], t$95$0, If[LessEqual[l, 3.3], N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(J * N[(N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision] + N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 4.2e+61], N[(U + N[(N[(N[(-0.125 * N[(K * K), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + \left(J \cdot {\ell}^{5}\right) \cdot \left(0.016666666666666666 \cdot \cos \left(K \cdot 0.5\right)\right)\\
\mathbf{if}\;\ell \leq -5:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq 3.3:\\
\;\;\;\;U + \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right)\right)\\
\mathbf{elif}\;\ell \leq 4.2 \cdot 10^{+61}:\\
\;\;\;\;U + \left(-0.125 \cdot \left(K \cdot K\right) + 1\right) \cdot \left(\left(e^{\ell} - e^{-\ell}\right) \cdot J\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if l < -5 or 4.2000000000000002e61 < l Initial program 100.0%
Taylor expanded in l around 0 96.1%
associate-+r+96.1%
+-commutative96.1%
fma-def96.1%
fma-def96.1%
Simplified96.1%
Taylor expanded in l around inf 96.1%
associate-*r*96.1%
*-commutative96.1%
Simplified96.1%
if -5 < l < 3.2999999999999998Initial program 69.6%
Taylor expanded in l around 0 99.8%
if 3.2999999999999998 < l < 4.2000000000000002e61Initial program 100.0%
Taylor expanded in K around 0 0.0%
associate-*r*0.0%
distribute-rgt1-in86.7%
unpow286.7%
Simplified86.7%
Final simplification97.3%
(FPCore (J l K U)
:precision binary64
(let* ((t_0
(+ U (* (* J (pow l 5.0)) (* 0.016666666666666666 (cos (* K 0.5)))))))
(if (<= l -5.0)
t_0
(if (<= l 0.21)
(+
U
(*
(cos (/ K 2.0))
(* J (+ (* 0.3333333333333333 (pow l 3.0)) (* l 2.0)))))
(if (<= l 1.65e+53) (+ U (* (- (exp l) (exp (- l))) J)) t_0)))))
double code(double J, double l, double K, double U) {
double t_0 = U + ((J * pow(l, 5.0)) * (0.016666666666666666 * cos((K * 0.5))));
double tmp;
if (l <= -5.0) {
tmp = t_0;
} else if (l <= 0.21) {
tmp = U + (cos((K / 2.0)) * (J * ((0.3333333333333333 * pow(l, 3.0)) + (l * 2.0))));
} else if (l <= 1.65e+53) {
tmp = U + ((exp(l) - exp(-l)) * J);
} 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 * (l ** 5.0d0)) * (0.016666666666666666d0 * cos((k * 0.5d0))))
if (l <= (-5.0d0)) then
tmp = t_0
else if (l <= 0.21d0) then
tmp = u + (cos((k / 2.0d0)) * (j * ((0.3333333333333333d0 * (l ** 3.0d0)) + (l * 2.0d0))))
else if (l <= 1.65d+53) then
tmp = u + ((exp(l) - exp(-l)) * j)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = U + ((J * Math.pow(l, 5.0)) * (0.016666666666666666 * Math.cos((K * 0.5))));
double tmp;
if (l <= -5.0) {
tmp = t_0;
} else if (l <= 0.21) {
tmp = U + (Math.cos((K / 2.0)) * (J * ((0.3333333333333333 * Math.pow(l, 3.0)) + (l * 2.0))));
} else if (l <= 1.65e+53) {
tmp = U + ((Math.exp(l) - Math.exp(-l)) * J);
} else {
tmp = t_0;
}
return tmp;
}
def code(J, l, K, U): t_0 = U + ((J * math.pow(l, 5.0)) * (0.016666666666666666 * math.cos((K * 0.5)))) tmp = 0 if l <= -5.0: tmp = t_0 elif l <= 0.21: tmp = U + (math.cos((K / 2.0)) * (J * ((0.3333333333333333 * math.pow(l, 3.0)) + (l * 2.0)))) elif l <= 1.65e+53: tmp = U + ((math.exp(l) - math.exp(-l)) * J) else: tmp = t_0 return tmp
function code(J, l, K, U) t_0 = Float64(U + Float64(Float64(J * (l ^ 5.0)) * Float64(0.016666666666666666 * cos(Float64(K * 0.5))))) tmp = 0.0 if (l <= -5.0) tmp = t_0; elseif (l <= 0.21) tmp = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(J * Float64(Float64(0.3333333333333333 * (l ^ 3.0)) + Float64(l * 2.0))))); elseif (l <= 1.65e+53) tmp = Float64(U + Float64(Float64(exp(l) - exp(Float64(-l))) * J)); else tmp = t_0; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = U + ((J * (l ^ 5.0)) * (0.016666666666666666 * cos((K * 0.5)))); tmp = 0.0; if (l <= -5.0) tmp = t_0; elseif (l <= 0.21) tmp = U + (cos((K / 2.0)) * (J * ((0.3333333333333333 * (l ^ 3.0)) + (l * 2.0)))); elseif (l <= 1.65e+53) tmp = U + ((exp(l) - exp(-l)) * J); else tmp = t_0; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(U + N[(N[(J * N[Power[l, 5.0], $MachinePrecision]), $MachinePrecision] * N[(0.016666666666666666 * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -5.0], t$95$0, If[LessEqual[l, 0.21], N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(J * N[(N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision] + N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.65e+53], N[(U + N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + \left(J \cdot {\ell}^{5}\right) \cdot \left(0.016666666666666666 \cdot \cos \left(K \cdot 0.5\right)\right)\\
\mathbf{if}\;\ell \leq -5:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq 0.21:\\
\;\;\;\;U + \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right)\right)\\
\mathbf{elif}\;\ell \leq 1.65 \cdot 10^{+53}:\\
\;\;\;\;U + \left(e^{\ell} - e^{-\ell}\right) \cdot J\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if l < -5 or 1.6500000000000001e53 < l Initial program 100.0%
Taylor expanded in l around 0 94.8%
associate-+r+94.8%
+-commutative94.8%
fma-def94.8%
fma-def94.8%
Simplified94.8%
Taylor expanded in l around inf 94.8%
associate-*r*94.8%
*-commutative94.8%
Simplified94.8%
if -5 < l < 0.209999999999999992Initial program 69.6%
Taylor expanded in l around 0 99.8%
if 0.209999999999999992 < l < 1.6500000000000001e53Initial program 100.0%
Taylor expanded in K around 0 72.7%
Final simplification96.1%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (* K 0.5)))
(t_1 (+ U (* (* J (pow l 5.0)) (* 0.016666666666666666 t_0)))))
(if (<= l -3.3)
t_1
(if (<= l 0.00039)
(+ U (* J (* 2.0 (* l t_0))))
(if (<= l 1.65e+53) (+ U (* (- (exp l) (exp (- l))) J)) t_1)))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K * 0.5));
double t_1 = U + ((J * pow(l, 5.0)) * (0.016666666666666666 * t_0));
double tmp;
if (l <= -3.3) {
tmp = t_1;
} else if (l <= 0.00039) {
tmp = U + (J * (2.0 * (l * t_0)));
} else if (l <= 1.65e+53) {
tmp = U + ((exp(l) - exp(-l)) * J);
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = cos((k * 0.5d0))
t_1 = u + ((j * (l ** 5.0d0)) * (0.016666666666666666d0 * t_0))
if (l <= (-3.3d0)) then
tmp = t_1
else if (l <= 0.00039d0) then
tmp = u + (j * (2.0d0 * (l * t_0)))
else if (l <= 1.65d+53) then
tmp = u + ((exp(l) - exp(-l)) * j)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = Math.cos((K * 0.5));
double t_1 = U + ((J * Math.pow(l, 5.0)) * (0.016666666666666666 * t_0));
double tmp;
if (l <= -3.3) {
tmp = t_1;
} else if (l <= 0.00039) {
tmp = U + (J * (2.0 * (l * t_0)));
} else if (l <= 1.65e+53) {
tmp = U + ((Math.exp(l) - Math.exp(-l)) * J);
} else {
tmp = t_1;
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K * 0.5)) t_1 = U + ((J * math.pow(l, 5.0)) * (0.016666666666666666 * t_0)) tmp = 0 if l <= -3.3: tmp = t_1 elif l <= 0.00039: tmp = U + (J * (2.0 * (l * t_0))) elif l <= 1.65e+53: tmp = U + ((math.exp(l) - math.exp(-l)) * J) else: tmp = t_1 return tmp
function code(J, l, K, U) t_0 = cos(Float64(K * 0.5)) t_1 = Float64(U + Float64(Float64(J * (l ^ 5.0)) * Float64(0.016666666666666666 * t_0))) tmp = 0.0 if (l <= -3.3) tmp = t_1; elseif (l <= 0.00039) tmp = Float64(U + Float64(J * Float64(2.0 * Float64(l * t_0)))); elseif (l <= 1.65e+53) tmp = Float64(U + Float64(Float64(exp(l) - exp(Float64(-l))) * J)); else tmp = t_1; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = cos((K * 0.5)); t_1 = U + ((J * (l ^ 5.0)) * (0.016666666666666666 * t_0)); tmp = 0.0; if (l <= -3.3) tmp = t_1; elseif (l <= 0.00039) tmp = U + (J * (2.0 * (l * t_0))); elseif (l <= 1.65e+53) tmp = U + ((exp(l) - exp(-l)) * J); else tmp = t_1; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(U + N[(N[(J * N[Power[l, 5.0], $MachinePrecision]), $MachinePrecision] * N[(0.016666666666666666 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -3.3], t$95$1, If[LessEqual[l, 0.00039], N[(U + N[(J * N[(2.0 * N[(l * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.65e+53], N[(U + N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(K \cdot 0.5\right)\\
t_1 := U + \left(J \cdot {\ell}^{5}\right) \cdot \left(0.016666666666666666 \cdot t_0\right)\\
\mathbf{if}\;\ell \leq -3.3:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\ell \leq 0.00039:\\
\;\;\;\;U + J \cdot \left(2 \cdot \left(\ell \cdot t_0\right)\right)\\
\mathbf{elif}\;\ell \leq 1.65 \cdot 10^{+53}:\\
\;\;\;\;U + \left(e^{\ell} - e^{-\ell}\right) \cdot J\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if l < -3.2999999999999998 or 1.6500000000000001e53 < l Initial program 100.0%
Taylor expanded in l around 0 94.8%
associate-+r+94.8%
+-commutative94.8%
fma-def94.8%
fma-def94.8%
Simplified94.8%
Taylor expanded in l around inf 94.8%
associate-*r*94.8%
*-commutative94.8%
Simplified94.8%
if -3.2999999999999998 < l < 3.89999999999999993e-4Initial program 69.6%
Taylor expanded in l around 0 99.8%
associate-*r*99.9%
associate-*r*99.9%
associate-*r*99.9%
associate-*r*99.9%
distribute-rgt-out99.9%
*-commutative99.9%
associate-*r*99.9%
*-commutative99.9%
associate-*r*99.9%
distribute-rgt-out99.9%
+-commutative99.9%
fma-def99.9%
Simplified99.9%
Taylor expanded in l around 0 99.3%
if 3.89999999999999993e-4 < l < 1.6500000000000001e53Initial program 100.0%
Taylor expanded in K around 0 72.7%
Final simplification95.9%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) 0.235) (+ U (* J (* 2.0 (* l (cos (* K 0.5)))))) (+ U (* J (+ (* 0.3333333333333333 (pow l 3.0)) (* l 2.0))))))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= 0.235) {
tmp = U + (J * (2.0 * (l * cos((K * 0.5)))));
} else {
tmp = U + (J * ((0.3333333333333333 * pow(l, 3.0)) + (l * 2.0)));
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if (cos((k / 2.0d0)) <= 0.235d0) then
tmp = u + (j * (2.0d0 * (l * cos((k * 0.5d0)))))
else
tmp = u + (j * ((0.3333333333333333d0 * (l ** 3.0d0)) + (l * 2.0d0)))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (Math.cos((K / 2.0)) <= 0.235) {
tmp = U + (J * (2.0 * (l * Math.cos((K * 0.5)))));
} else {
tmp = U + (J * ((0.3333333333333333 * Math.pow(l, 3.0)) + (l * 2.0)));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if math.cos((K / 2.0)) <= 0.235: tmp = U + (J * (2.0 * (l * math.cos((K * 0.5))))) else: tmp = U + (J * ((0.3333333333333333 * math.pow(l, 3.0)) + (l * 2.0))) return tmp
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= 0.235) tmp = Float64(U + Float64(J * Float64(2.0 * Float64(l * cos(Float64(K * 0.5)))))); else tmp = Float64(U + Float64(J * Float64(Float64(0.3333333333333333 * (l ^ 3.0)) + Float64(l * 2.0)))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (cos((K / 2.0)) <= 0.235) tmp = U + (J * (2.0 * (l * cos((K * 0.5))))); else tmp = U + (J * ((0.3333333333333333 * (l ^ 3.0)) + (l * 2.0))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], 0.235], N[(U + N[(J * N[(2.0 * N[(l * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * N[(N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision] + N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq 0.235:\\
\;\;\;\;U + J \cdot \left(2 \cdot \left(\ell \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K 2)) < 0.23499999999999999Initial program 91.0%
Taylor expanded in l around 0 87.2%
associate-*r*87.3%
associate-*r*87.3%
associate-*r*87.3%
associate-*r*87.3%
distribute-rgt-out87.3%
*-commutative87.3%
associate-*r*87.2%
*-commutative87.2%
associate-*r*87.2%
distribute-rgt-out87.2%
+-commutative87.2%
fma-def87.2%
Simplified87.2%
Taylor expanded in l around 0 62.1%
if 0.23499999999999999 < (cos.f64 (/.f64 K 2)) Initial program 84.1%
Taylor expanded in l around 0 90.9%
associate-*r*90.9%
associate-*r*90.9%
associate-*r*90.9%
associate-*r*90.9%
distribute-rgt-out90.9%
*-commutative90.9%
associate-*r*90.9%
*-commutative90.9%
associate-*r*90.9%
distribute-rgt-out90.9%
+-commutative90.9%
fma-def90.9%
Simplified90.9%
Taylor expanded in K around 0 87.6%
Final simplification80.1%
(FPCore (J l K U) :precision binary64 (if (or (<= J -2.2e+107) (not (<= J 3250000.0))) (+ U (* J (* 2.0 (* l (cos (* K 0.5)))))) (+ U (* (- (exp l) (exp (- l))) J))))
double code(double J, double l, double K, double U) {
double tmp;
if ((J <= -2.2e+107) || !(J <= 3250000.0)) {
tmp = U + (J * (2.0 * (l * cos((K * 0.5)))));
} else {
tmp = U + ((exp(l) - exp(-l)) * J);
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if ((j <= (-2.2d+107)) .or. (.not. (j <= 3250000.0d0))) then
tmp = u + (j * (2.0d0 * (l * cos((k * 0.5d0)))))
else
tmp = u + ((exp(l) - exp(-l)) * j)
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if ((J <= -2.2e+107) || !(J <= 3250000.0)) {
tmp = U + (J * (2.0 * (l * Math.cos((K * 0.5)))));
} else {
tmp = U + ((Math.exp(l) - Math.exp(-l)) * J);
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (J <= -2.2e+107) or not (J <= 3250000.0): tmp = U + (J * (2.0 * (l * math.cos((K * 0.5))))) else: tmp = U + ((math.exp(l) - math.exp(-l)) * J) return tmp
function code(J, l, K, U) tmp = 0.0 if ((J <= -2.2e+107) || !(J <= 3250000.0)) tmp = Float64(U + Float64(J * Float64(2.0 * Float64(l * cos(Float64(K * 0.5)))))); else tmp = Float64(U + Float64(Float64(exp(l) - exp(Float64(-l))) * J)); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((J <= -2.2e+107) || ~((J <= 3250000.0))) tmp = U + (J * (2.0 * (l * cos((K * 0.5))))); else tmp = U + ((exp(l) - exp(-l)) * J); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[J, -2.2e+107], N[Not[LessEqual[J, 3250000.0]], $MachinePrecision]], N[(U + N[(J * N[(2.0 * N[(l * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;J \leq -2.2 \cdot 10^{+107} \lor \neg \left(J \leq 3250000\right):\\
\;\;\;\;U + J \cdot \left(2 \cdot \left(\ell \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + \left(e^{\ell} - e^{-\ell}\right) \cdot J\\
\end{array}
\end{array}
if J < -2.2e107 or 3.25e6 < J Initial program 72.0%
Taylor expanded in l around 0 94.9%
associate-*r*94.9%
associate-*r*94.9%
associate-*r*94.9%
associate-*r*94.9%
distribute-rgt-out94.9%
*-commutative94.9%
associate-*r*94.9%
*-commutative94.9%
associate-*r*94.9%
distribute-rgt-out94.9%
+-commutative94.9%
fma-def94.9%
Simplified94.9%
Taylor expanded in l around 0 89.0%
if -2.2e107 < J < 3.25e6Initial program 96.9%
Taylor expanded in K around 0 83.1%
Final simplification85.7%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (+ U (* (pow K 4.0) (* J -0.0013020833333333333)))))
(if (<= l -1.7e+271)
t_0
(if (<= l -650.0) (pow U -8.0) (if (<= l 420.0) U t_0)))))
double code(double J, double l, double K, double U) {
double t_0 = U + (pow(K, 4.0) * (J * -0.0013020833333333333));
double tmp;
if (l <= -1.7e+271) {
tmp = t_0;
} else if (l <= -650.0) {
tmp = pow(U, -8.0);
} else if (l <= 420.0) {
tmp = 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) :: tmp
t_0 = u + ((k ** 4.0d0) * (j * (-0.0013020833333333333d0)))
if (l <= (-1.7d+271)) then
tmp = t_0
else if (l <= (-650.0d0)) then
tmp = u ** (-8.0d0)
else if (l <= 420.0d0) then
tmp = 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.pow(K, 4.0) * (J * -0.0013020833333333333));
double tmp;
if (l <= -1.7e+271) {
tmp = t_0;
} else if (l <= -650.0) {
tmp = Math.pow(U, -8.0);
} else if (l <= 420.0) {
tmp = U;
} else {
tmp = t_0;
}
return tmp;
}
def code(J, l, K, U): t_0 = U + (math.pow(K, 4.0) * (J * -0.0013020833333333333)) tmp = 0 if l <= -1.7e+271: tmp = t_0 elif l <= -650.0: tmp = math.pow(U, -8.0) elif l <= 420.0: tmp = U else: tmp = t_0 return tmp
function code(J, l, K, U) t_0 = Float64(U + Float64((K ^ 4.0) * Float64(J * -0.0013020833333333333))) tmp = 0.0 if (l <= -1.7e+271) tmp = t_0; elseif (l <= -650.0) tmp = U ^ -8.0; elseif (l <= 420.0) tmp = U; else tmp = t_0; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = U + ((K ^ 4.0) * (J * -0.0013020833333333333)); tmp = 0.0; if (l <= -1.7e+271) tmp = t_0; elseif (l <= -650.0) tmp = U ^ -8.0; elseif (l <= 420.0) tmp = U; else tmp = t_0; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(U + N[(N[Power[K, 4.0], $MachinePrecision] * N[(J * -0.0013020833333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -1.7e+271], t$95$0, If[LessEqual[l, -650.0], N[Power[U, -8.0], $MachinePrecision], If[LessEqual[l, 420.0], U, t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + {K}^{4} \cdot \left(J \cdot -0.0013020833333333333\right)\\
\mathbf{if}\;\ell \leq -1.7 \cdot 10^{+271}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq -650:\\
\;\;\;\;{U}^{-8}\\
\mathbf{elif}\;\ell \leq 420:\\
\;\;\;\;U\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if l < -1.70000000000000013e271 or 420 < l Initial program 100.0%
Applied egg-rr2.0%
Taylor expanded in K around 0 8.9%
+-commutative8.9%
associate-*r*8.9%
distribute-rgt-out8.9%
associate-*r*8.0%
*-commutative8.0%
distribute-lft-out13.5%
*-commutative13.5%
unpow213.5%
*-commutative13.5%
Simplified13.5%
Taylor expanded in K around inf 33.2%
*-commutative33.2%
associate-*r*32.3%
Simplified32.3%
if -1.70000000000000013e271 < l < -650Initial program 100.0%
Applied egg-rr38.1%
if -650 < l < 420Initial program 69.6%
Taylor expanded in J around 0 67.4%
Final simplification49.5%
(FPCore (J l K U) :precision binary64 (+ U (* 2.0 (* l (* J (cos (* K 0.5)))))))
double code(double J, double l, double K, double U) {
return U + (2.0 * (l * (J * cos((K * 0.5)))));
}
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 * cos((k * 0.5d0)))))
end function
public static double code(double J, double l, double K, double U) {
return U + (2.0 * (l * (J * Math.cos((K * 0.5)))));
}
def code(J, l, K, U): return U + (2.0 * (l * (J * math.cos((K * 0.5)))))
function code(J, l, K, U) return Float64(U + Float64(2.0 * Float64(l * Float64(J * cos(Float64(K * 0.5)))))) end
function tmp = code(J, l, K, U) tmp = U + (2.0 * (l * (J * cos((K * 0.5))))); end
code[J_, l_, K_, U_] := N[(U + N[(2.0 * N[(l * N[(J * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + 2 \cdot \left(\ell \cdot \left(J \cdot \cos \left(K \cdot 0.5\right)\right)\right)
\end{array}
Initial program 86.1%
Taylor expanded in l around 0 93.6%
associate-+r+93.6%
+-commutative93.6%
fma-def93.6%
fma-def93.6%
Simplified93.6%
Taylor expanded in l around 0 65.6%
*-commutative65.6%
*-commutative65.6%
associate-*l*65.6%
*-commutative65.6%
Simplified65.6%
Final simplification65.6%
(FPCore (J l K U) :precision binary64 (+ U (* J (* 2.0 (* l (cos (* K 0.5)))))))
double code(double J, double l, double K, double U) {
return U + (J * (2.0 * (l * cos((K * 0.5)))));
}
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 * (2.0d0 * (l * cos((k * 0.5d0)))))
end function
public static double code(double J, double l, double K, double U) {
return U + (J * (2.0 * (l * Math.cos((K * 0.5)))));
}
def code(J, l, K, U): return U + (J * (2.0 * (l * math.cos((K * 0.5)))))
function code(J, l, K, U) return Float64(U + Float64(J * Float64(2.0 * Float64(l * cos(Float64(K * 0.5)))))) end
function tmp = code(J, l, K, U) tmp = U + (J * (2.0 * (l * cos((K * 0.5))))); end
code[J_, l_, K_, U_] := N[(U + N[(J * N[(2.0 * N[(l * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + J \cdot \left(2 \cdot \left(\ell \cdot \cos \left(K \cdot 0.5\right)\right)\right)
\end{array}
Initial program 86.1%
Taylor expanded in l around 0 89.8%
associate-*r*89.9%
associate-*r*89.9%
associate-*r*89.9%
associate-*r*89.9%
distribute-rgt-out89.9%
*-commutative89.9%
associate-*r*89.9%
*-commutative89.9%
associate-*r*89.9%
distribute-rgt-out89.9%
+-commutative89.9%
fma-def89.9%
Simplified89.9%
Taylor expanded in l around 0 65.6%
Final simplification65.6%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (+ U (* J (+ (* (* K K) -64.0) 512.0)))))
(if (<= l -1.45e+269)
t_0
(if (<= l -510.0) (pow U -8.0) (if (<= l 7.4e-19) U t_0)))))
double code(double J, double l, double K, double U) {
double t_0 = U + (J * (((K * K) * -64.0) + 512.0));
double tmp;
if (l <= -1.45e+269) {
tmp = t_0;
} else if (l <= -510.0) {
tmp = pow(U, -8.0);
} else if (l <= 7.4e-19) {
tmp = 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) :: tmp
t_0 = u + (j * (((k * k) * (-64.0d0)) + 512.0d0))
if (l <= (-1.45d+269)) then
tmp = t_0
else if (l <= (-510.0d0)) then
tmp = u ** (-8.0d0)
else if (l <= 7.4d-19) then
tmp = 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 + (J * (((K * K) * -64.0) + 512.0));
double tmp;
if (l <= -1.45e+269) {
tmp = t_0;
} else if (l <= -510.0) {
tmp = Math.pow(U, -8.0);
} else if (l <= 7.4e-19) {
tmp = U;
} else {
tmp = t_0;
}
return tmp;
}
def code(J, l, K, U): t_0 = U + (J * (((K * K) * -64.0) + 512.0)) tmp = 0 if l <= -1.45e+269: tmp = t_0 elif l <= -510.0: tmp = math.pow(U, -8.0) elif l <= 7.4e-19: tmp = U else: tmp = t_0 return tmp
function code(J, l, K, U) t_0 = Float64(U + Float64(J * Float64(Float64(Float64(K * K) * -64.0) + 512.0))) tmp = 0.0 if (l <= -1.45e+269) tmp = t_0; elseif (l <= -510.0) tmp = U ^ -8.0; elseif (l <= 7.4e-19) tmp = U; else tmp = t_0; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = U + (J * (((K * K) * -64.0) + 512.0)); tmp = 0.0; if (l <= -1.45e+269) tmp = t_0; elseif (l <= -510.0) tmp = U ^ -8.0; elseif (l <= 7.4e-19) tmp = U; else tmp = t_0; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(U + N[(J * N[(N[(N[(K * K), $MachinePrecision] * -64.0), $MachinePrecision] + 512.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -1.45e+269], t$95$0, If[LessEqual[l, -510.0], N[Power[U, -8.0], $MachinePrecision], If[LessEqual[l, 7.4e-19], U, t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + J \cdot \left(\left(K \cdot K\right) \cdot -64 + 512\right)\\
\mathbf{if}\;\ell \leq -1.45 \cdot 10^{+269}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq -510:\\
\;\;\;\;{U}^{-8}\\
\mathbf{elif}\;\ell \leq 7.4 \cdot 10^{-19}:\\
\;\;\;\;U\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if l < -1.45000000000000013e269 or 7.40000000000000011e-19 < l Initial program 99.4%
Applied egg-rr5.0%
Taylor expanded in K around 0 27.5%
associate-*r*27.5%
distribute-rgt-out27.5%
*-commutative27.5%
unpow227.5%
Simplified27.5%
if -1.45000000000000013e269 < l < -510Initial program 100.0%
Applied egg-rr38.1%
if -510 < l < 7.40000000000000011e-19Initial program 69.5%
Taylor expanded in J around 0 67.7%
Final simplification47.5%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (+ U (* J (+ (* (* K K) -64.0) 512.0)))))
(if (<= l -1.3e+269)
t_0
(if (<= l -1850000000000.0)
(+ U (* J (+ (* (* K K) 0.0625) -0.5)))
(if (<= l 7.4e-19) U t_0)))))
double code(double J, double l, double K, double U) {
double t_0 = U + (J * (((K * K) * -64.0) + 512.0));
double tmp;
if (l <= -1.3e+269) {
tmp = t_0;
} else if (l <= -1850000000000.0) {
tmp = U + (J * (((K * K) * 0.0625) + -0.5));
} else if (l <= 7.4e-19) {
tmp = 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) :: tmp
t_0 = u + (j * (((k * k) * (-64.0d0)) + 512.0d0))
if (l <= (-1.3d+269)) then
tmp = t_0
else if (l <= (-1850000000000.0d0)) then
tmp = u + (j * (((k * k) * 0.0625d0) + (-0.5d0)))
else if (l <= 7.4d-19) then
tmp = 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 + (J * (((K * K) * -64.0) + 512.0));
double tmp;
if (l <= -1.3e+269) {
tmp = t_0;
} else if (l <= -1850000000000.0) {
tmp = U + (J * (((K * K) * 0.0625) + -0.5));
} else if (l <= 7.4e-19) {
tmp = U;
} else {
tmp = t_0;
}
return tmp;
}
def code(J, l, K, U): t_0 = U + (J * (((K * K) * -64.0) + 512.0)) tmp = 0 if l <= -1.3e+269: tmp = t_0 elif l <= -1850000000000.0: tmp = U + (J * (((K * K) * 0.0625) + -0.5)) elif l <= 7.4e-19: tmp = U else: tmp = t_0 return tmp
function code(J, l, K, U) t_0 = Float64(U + Float64(J * Float64(Float64(Float64(K * K) * -64.0) + 512.0))) tmp = 0.0 if (l <= -1.3e+269) tmp = t_0; elseif (l <= -1850000000000.0) tmp = Float64(U + Float64(J * Float64(Float64(Float64(K * K) * 0.0625) + -0.5))); elseif (l <= 7.4e-19) tmp = U; else tmp = t_0; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = U + (J * (((K * K) * -64.0) + 512.0)); tmp = 0.0; if (l <= -1.3e+269) tmp = t_0; elseif (l <= -1850000000000.0) tmp = U + (J * (((K * K) * 0.0625) + -0.5)); elseif (l <= 7.4e-19) tmp = U; else tmp = t_0; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(U + N[(J * N[(N[(N[(K * K), $MachinePrecision] * -64.0), $MachinePrecision] + 512.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -1.3e+269], t$95$0, If[LessEqual[l, -1850000000000.0], N[(U + N[(J * N[(N[(N[(K * K), $MachinePrecision] * 0.0625), $MachinePrecision] + -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 7.4e-19], U, t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + J \cdot \left(\left(K \cdot K\right) \cdot -64 + 512\right)\\
\mathbf{if}\;\ell \leq -1.3 \cdot 10^{+269}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq -1850000000000:\\
\;\;\;\;U + J \cdot \left(\left(K \cdot K\right) \cdot 0.0625 + -0.5\right)\\
\mathbf{elif}\;\ell \leq 7.4 \cdot 10^{-19}:\\
\;\;\;\;U\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if l < -1.3e269 or 7.40000000000000011e-19 < l Initial program 99.4%
Applied egg-rr5.0%
Taylor expanded in K around 0 27.5%
associate-*r*27.5%
distribute-rgt-out27.5%
*-commutative27.5%
unpow227.5%
Simplified27.5%
if -1.3e269 < l < -1.85e12Initial program 100.0%
Applied egg-rr3.6%
Taylor expanded in K around 0 26.2%
associate-*r*26.2%
distribute-rgt-out26.2%
*-commutative26.2%
unpow226.2%
Simplified26.2%
if -1.85e12 < l < 7.40000000000000011e-19Initial program 70.1%
Taylor expanded in J around 0 66.6%
Final simplification45.1%
(FPCore (J l K U) :precision binary64 (if (or (<= l -120000000.0) (not (<= l 7.4e-19))) (+ U (* J (+ (* (* K K) -64.0) 512.0))) U))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -120000000.0) || !(l <= 7.4e-19)) {
tmp = U + (J * (((K * K) * -64.0) + 512.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 <= (-120000000.0d0)) .or. (.not. (l <= 7.4d-19))) then
tmp = u + (j * (((k * k) * (-64.0d0)) + 512.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 <= -120000000.0) || !(l <= 7.4e-19)) {
tmp = U + (J * (((K * K) * -64.0) + 512.0));
} else {
tmp = U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -120000000.0) or not (l <= 7.4e-19): tmp = U + (J * (((K * K) * -64.0) + 512.0)) else: tmp = U return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -120000000.0) || !(l <= 7.4e-19)) tmp = Float64(U + Float64(J * Float64(Float64(Float64(K * K) * -64.0) + 512.0))); else tmp = U; end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -120000000.0) || ~((l <= 7.4e-19))) tmp = U + (J * (((K * K) * -64.0) + 512.0)); else tmp = U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -120000000.0], N[Not[LessEqual[l, 7.4e-19]], $MachinePrecision]], N[(U + N[(J * N[(N[(N[(K * K), $MachinePrecision] * -64.0), $MachinePrecision] + 512.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], U]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -120000000 \lor \neg \left(\ell \leq 7.4 \cdot 10^{-19}\right):\\
\;\;\;\;U + J \cdot \left(\left(K \cdot K\right) \cdot -64 + 512\right)\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\end{array}
if l < -1.2e8 or 7.40000000000000011e-19 < l Initial program 99.6%
Applied egg-rr3.7%
Taylor expanded in K around 0 21.5%
associate-*r*21.5%
distribute-rgt-out21.5%
*-commutative21.5%
unpow221.5%
Simplified21.5%
if -1.2e8 < l < 7.40000000000000011e-19Initial program 69.8%
Taylor expanded in J around 0 67.2%
Final simplification42.2%
(FPCore (J l K U) :precision binary64 (if (<= l -135000000.0) (* U U) (if (<= l 2.6e-11) U (* U U))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -135000000.0) {
tmp = U * U;
} else if (l <= 2.6e-11) {
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 <= (-135000000.0d0)) then
tmp = u * u
else if (l <= 2.6d-11) 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 <= -135000000.0) {
tmp = U * U;
} else if (l <= 2.6e-11) {
tmp = U;
} else {
tmp = U * U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -135000000.0: tmp = U * U elif l <= 2.6e-11: tmp = U else: tmp = U * U return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -135000000.0) tmp = Float64(U * U); elseif (l <= 2.6e-11) tmp = U; else tmp = Float64(U * U); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -135000000.0) tmp = U * U; elseif (l <= 2.6e-11) tmp = U; else tmp = U * U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -135000000.0], N[(U * U), $MachinePrecision], If[LessEqual[l, 2.6e-11], U, N[(U * U), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -135000000:\\
\;\;\;\;U \cdot U\\
\mathbf{elif}\;\ell \leq 2.6 \cdot 10^{-11}:\\
\;\;\;\;U\\
\mathbf{else}:\\
\;\;\;\;U \cdot U\\
\end{array}
\end{array}
if l < -1.35e8 or 2.6000000000000001e-11 < l Initial program 99.6%
Applied egg-rr11.7%
if -1.35e8 < l < 2.6000000000000001e-11Initial program 70.1%
Taylor expanded in J around 0 67.4%
Final simplification37.2%
(FPCore (J l K U) :precision binary64 (if (<= l -8.6e+15) (* U (- U -8.0)) (if (<= l 2.6e-11) U (* U U))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -8.6e+15) {
tmp = U * (U - -8.0);
} else if (l <= 2.6e-11) {
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.6d+15)) then
tmp = u * (u - (-8.0d0))
else if (l <= 2.6d-11) 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.6e+15) {
tmp = U * (U - -8.0);
} else if (l <= 2.6e-11) {
tmp = U;
} else {
tmp = U * U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -8.6e+15: tmp = U * (U - -8.0) elif l <= 2.6e-11: tmp = U else: tmp = U * U return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -8.6e+15) tmp = Float64(U * Float64(U - -8.0)); elseif (l <= 2.6e-11) 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.6e+15) tmp = U * (U - -8.0); elseif (l <= 2.6e-11) tmp = U; else tmp = U * U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -8.6e+15], N[(U * N[(U - -8.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.6e-11], U, N[(U * U), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -8.6 \cdot 10^{+15}:\\
\;\;\;\;U \cdot \left(U - -8\right)\\
\mathbf{elif}\;\ell \leq 2.6 \cdot 10^{-11}:\\
\;\;\;\;U\\
\mathbf{else}:\\
\;\;\;\;U \cdot U\\
\end{array}
\end{array}
if l < -8.6e15Initial program 100.0%
Applied egg-rr11.3%
if -8.6e15 < l < 2.6000000000000001e-11Initial program 70.6%
Taylor expanded in J around 0 66.3%
if 2.6000000000000001e-11 < l Initial program 99.3%
Applied egg-rr12.3%
Final simplification37.2%
(FPCore (J l K U) :precision binary64 1.0)
double code(double J, double l, double K, double U) {
return 1.0;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = 1.0d0
end function
public static double code(double J, double l, double K, double U) {
return 1.0;
}
def code(J, l, K, U): return 1.0
function code(J, l, K, U) return 1.0 end
function tmp = code(J, l, K, U) tmp = 1.0; end
code[J_, l_, K_, U_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 86.1%
Applied egg-rr2.7%
*-inverses2.7%
Simplified2.7%
Final simplification2.7%
(FPCore (J l K U) :precision binary64 U)
double code(double J, double l, double K, double U) {
return U;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = u
end function
public static double code(double J, double l, double K, double U) {
return U;
}
def code(J, l, K, U): return U
function code(J, l, K, U) return U end
function tmp = code(J, l, K, U) tmp = U; end
code[J_, l_, K_, U_] := U
\begin{array}{l}
\\
U
\end{array}
Initial program 86.1%
Taylor expanded in J around 0 32.0%
Final simplification32.0%
herbie shell --seed 2023255
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))