
(FPCore (J l K U) :precision binary64 (+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))
double code(double J, double l, double K, double U) {
return ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = ((j * (exp(l) - exp(-l))) * cos((k / 2.0d0))) + u
end function
public static double code(double J, double l, double K, double U) {
return ((J * (Math.exp(l) - Math.exp(-l))) * Math.cos((K / 2.0))) + U;
}
def code(J, l, K, U): return ((J * (math.exp(l) - math.exp(-l))) * math.cos((K / 2.0))) + U
function code(J, l, K, U) return Float64(Float64(Float64(J * Float64(exp(l) - exp(Float64(-l)))) * cos(Float64(K / 2.0))) + U) end
function tmp = code(J, l, K, U) tmp = ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U; end
code[J_, l_, K_, U_] := N[(N[(N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]
\begin{array}{l}
\\
\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 19 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (J l K U) :precision binary64 (+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))
double code(double J, double l, double K, double U) {
return ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = ((j * (exp(l) - exp(-l))) * cos((k / 2.0d0))) + u
end function
public static double code(double J, double l, double K, double U) {
return ((J * (Math.exp(l) - Math.exp(-l))) * Math.cos((K / 2.0))) + U;
}
def code(J, l, K, U): return ((J * (math.exp(l) - math.exp(-l))) * math.cos((K / 2.0))) + U
function code(J, l, K, U) return Float64(Float64(Float64(J * Float64(exp(l) - exp(Float64(-l)))) * cos(Float64(K / 2.0))) + U) end
function tmp = code(J, l, K, U) tmp = ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U; end
code[J_, l_, K_, U_] := N[(N[(N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]
\begin{array}{l}
\\
\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U
\end{array}
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (- (exp l) (exp (- l)))))
(if (or (<= t_0 -0.1) (not (<= t_0 4e-8)))
(+ (* J (* t_0 (cos (* 0.5 K)))) U)
(+
U
(*
(cos (/ K 2.0))
(*
J
(+
(* 0.016666666666666666 (pow l 5.0))
(+ (* 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.1) || !(t_0 <= 4e-8)) {
tmp = (J * (t_0 * cos((0.5 * K)))) + U;
} else {
tmp = U + (cos((K / 2.0)) * (J * ((0.016666666666666666 * pow(l, 5.0)) + ((0.3333333333333333 * pow(l, 3.0)) + (l * 2.0)))));
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: t_0
real(8) :: tmp
t_0 = exp(l) - exp(-l)
if ((t_0 <= (-0.1d0)) .or. (.not. (t_0 <= 4d-8))) then
tmp = (j * (t_0 * cos((0.5d0 * k)))) + u
else
tmp = u + (cos((k / 2.0d0)) * (j * ((0.016666666666666666d0 * (l ** 5.0d0)) + ((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.exp(l) - Math.exp(-l);
double tmp;
if ((t_0 <= -0.1) || !(t_0 <= 4e-8)) {
tmp = (J * (t_0 * Math.cos((0.5 * K)))) + U;
} else {
tmp = U + (Math.cos((K / 2.0)) * (J * ((0.016666666666666666 * Math.pow(l, 5.0)) + ((0.3333333333333333 * Math.pow(l, 3.0)) + (l * 2.0)))));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.exp(l) - math.exp(-l) tmp = 0 if (t_0 <= -0.1) or not (t_0 <= 4e-8): tmp = (J * (t_0 * math.cos((0.5 * K)))) + U else: tmp = U + (math.cos((K / 2.0)) * (J * ((0.016666666666666666 * math.pow(l, 5.0)) + ((0.3333333333333333 * math.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.1) || !(t_0 <= 4e-8)) tmp = Float64(Float64(J * Float64(t_0 * cos(Float64(0.5 * K)))) + U); else tmp = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(J * Float64(Float64(0.016666666666666666 * (l ^ 5.0)) + 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 = exp(l) - exp(-l); tmp = 0.0; if ((t_0 <= -0.1) || ~((t_0 <= 4e-8))) tmp = (J * (t_0 * cos((0.5 * K)))) + U; else tmp = U + (cos((K / 2.0)) * (J * ((0.016666666666666666 * (l ^ 5.0)) + ((0.3333333333333333 * (l ^ 3.0)) + (l * 2.0))))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, -0.1], N[Not[LessEqual[t$95$0, 4e-8]], $MachinePrecision]], N[(N[(J * N[(t$95$0 * N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(J * N[(N[(0.016666666666666666 * N[Power[l, 5.0], $MachinePrecision]), $MachinePrecision] + N[(N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision] + N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{\ell} - e^{-\ell}\\
\mathbf{if}\;t_0 \leq -0.1 \lor \neg \left(t_0 \leq 4 \cdot 10^{-8}\right):\\
\;\;\;\;J \cdot \left(t_0 \cdot \cos \left(0.5 \cdot K\right)\right) + U\\
\mathbf{else}:\\
\;\;\;\;U + \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(0.016666666666666666 \cdot {\ell}^{5} + \left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right)\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -0.10000000000000001 or 4.0000000000000001e-8 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 99.9%
Taylor expanded in J around 0 100.0%
if -0.10000000000000001 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 4.0000000000000001e-8Initial program 76.8%
Taylor expanded in l around 0 99.9%
Final simplification99.9%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (* 0.5 K))) (t_1 (- (exp l) (exp (- l)))))
(if (or (<= t_1 -0.02) (not (<= t_1 4e-8)))
(+ (* J (* t_1 t_0)) U)
(+ U (* (* l J) (* t_0 2.0))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((0.5 * K));
double t_1 = exp(l) - exp(-l);
double tmp;
if ((t_1 <= -0.02) || !(t_1 <= 4e-8)) {
tmp = (J * (t_1 * t_0)) + U;
} else {
tmp = U + ((l * J) * (t_0 * 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((0.5d0 * k))
t_1 = exp(l) - exp(-l)
if ((t_1 <= (-0.02d0)) .or. (.not. (t_1 <= 4d-8))) then
tmp = (j * (t_1 * t_0)) + u
else
tmp = u + ((l * j) * (t_0 * 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((0.5 * K));
double t_1 = Math.exp(l) - Math.exp(-l);
double tmp;
if ((t_1 <= -0.02) || !(t_1 <= 4e-8)) {
tmp = (J * (t_1 * t_0)) + U;
} else {
tmp = U + ((l * J) * (t_0 * 2.0));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((0.5 * K)) t_1 = math.exp(l) - math.exp(-l) tmp = 0 if (t_1 <= -0.02) or not (t_1 <= 4e-8): tmp = (J * (t_1 * t_0)) + U else: tmp = U + ((l * J) * (t_0 * 2.0)) return tmp
function code(J, l, K, U) t_0 = cos(Float64(0.5 * K)) t_1 = Float64(exp(l) - exp(Float64(-l))) tmp = 0.0 if ((t_1 <= -0.02) || !(t_1 <= 4e-8)) tmp = Float64(Float64(J * Float64(t_1 * t_0)) + U); else tmp = Float64(U + Float64(Float64(l * J) * Float64(t_0 * 2.0))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = cos((0.5 * K)); t_1 = exp(l) - exp(-l); tmp = 0.0; if ((t_1 <= -0.02) || ~((t_1 <= 4e-8))) tmp = (J * (t_1 * t_0)) + U; else tmp = U + ((l * J) * (t_0 * 2.0)); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -0.02], N[Not[LessEqual[t$95$1, 4e-8]], $MachinePrecision]], N[(N[(J * N[(t$95$1 * t$95$0), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], N[(U + N[(N[(l * J), $MachinePrecision] * N[(t$95$0 * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(0.5 \cdot K\right)\\
t_1 := e^{\ell} - e^{-\ell}\\
\mathbf{if}\;t_1 \leq -0.02 \lor \neg \left(t_1 \leq 4 \cdot 10^{-8}\right):\\
\;\;\;\;J \cdot \left(t_1 \cdot t_0\right) + U\\
\mathbf{else}:\\
\;\;\;\;U + \left(\ell \cdot J\right) \cdot \left(t_0 \cdot 2\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -0.0200000000000000004 or 4.0000000000000001e-8 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 99.9%
Taylor expanded in J around 0 99.9%
if -0.0200000000000000004 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 4.0000000000000001e-8Initial program 76.7%
Taylor expanded in l around 0 99.9%
*-commutative99.9%
associate-*r*100.0%
associate-*l*100.0%
*-commutative100.0%
Simplified100.0%
Final simplification99.9%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (- (exp l) (exp (- l)))))
(if (<= t_0 -0.1)
(+ (* J (* t_0 (cos (* 0.5 K)))) U)
(+
U
(*
(+
(* 0.0003968253968253968 (* J (pow l 7.0)))
(+
(* 0.016666666666666666 (* J (pow l 5.0)))
(+ (* 0.3333333333333333 (* J (pow l 3.0))) (* 2.0 (* l J)))))
(cos (/ K 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.1) {
tmp = (J * (t_0 * cos((0.5 * K)))) + U;
} else {
tmp = U + (((0.0003968253968253968 * (J * pow(l, 7.0))) + ((0.016666666666666666 * (J * pow(l, 5.0))) + ((0.3333333333333333 * (J * pow(l, 3.0))) + (2.0 * (l * J))))) * cos((K / 2.0)));
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: t_0
real(8) :: tmp
t_0 = exp(l) - exp(-l)
if (t_0 <= (-0.1d0)) then
tmp = (j * (t_0 * cos((0.5d0 * k)))) + u
else
tmp = u + (((0.0003968253968253968d0 * (j * (l ** 7.0d0))) + ((0.016666666666666666d0 * (j * (l ** 5.0d0))) + ((0.3333333333333333d0 * (j * (l ** 3.0d0))) + (2.0d0 * (l * j))))) * cos((k / 2.0d0)))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = Math.exp(l) - Math.exp(-l);
double tmp;
if (t_0 <= -0.1) {
tmp = (J * (t_0 * Math.cos((0.5 * K)))) + U;
} else {
tmp = U + (((0.0003968253968253968 * (J * Math.pow(l, 7.0))) + ((0.016666666666666666 * (J * Math.pow(l, 5.0))) + ((0.3333333333333333 * (J * Math.pow(l, 3.0))) + (2.0 * (l * J))))) * Math.cos((K / 2.0)));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.exp(l) - math.exp(-l) tmp = 0 if t_0 <= -0.1: tmp = (J * (t_0 * math.cos((0.5 * K)))) + U else: tmp = U + (((0.0003968253968253968 * (J * math.pow(l, 7.0))) + ((0.016666666666666666 * (J * math.pow(l, 5.0))) + ((0.3333333333333333 * (J * math.pow(l, 3.0))) + (2.0 * (l * J))))) * math.cos((K / 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.1) tmp = Float64(Float64(J * Float64(t_0 * cos(Float64(0.5 * K)))) + U); else tmp = Float64(U + Float64(Float64(Float64(0.0003968253968253968 * Float64(J * (l ^ 7.0))) + Float64(Float64(0.016666666666666666 * Float64(J * (l ^ 5.0))) + Float64(Float64(0.3333333333333333 * Float64(J * (l ^ 3.0))) + Float64(2.0 * Float64(l * J))))) * cos(Float64(K / 2.0)))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = exp(l) - exp(-l); tmp = 0.0; if (t_0 <= -0.1) tmp = (J * (t_0 * cos((0.5 * K)))) + U; else tmp = U + (((0.0003968253968253968 * (J * (l ^ 7.0))) + ((0.016666666666666666 * (J * (l ^ 5.0))) + ((0.3333333333333333 * (J * (l ^ 3.0))) + (2.0 * (l * J))))) * cos((K / 2.0))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -0.1], N[(N[(J * N[(t$95$0 * N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], N[(U + N[(N[(N[(0.0003968253968253968 * N[(J * N[Power[l, 7.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(0.016666666666666666 * N[(J * N[Power[l, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(0.3333333333333333 * N[(J * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(2.0 * N[(l * J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{\ell} - e^{-\ell}\\
\mathbf{if}\;t_0 \leq -0.1:\\
\;\;\;\;J \cdot \left(t_0 \cdot \cos \left(0.5 \cdot K\right)\right) + U\\
\mathbf{else}:\\
\;\;\;\;U + \left(0.0003968253968253968 \cdot \left(J \cdot {\ell}^{7}\right) + \left(0.016666666666666666 \cdot \left(J \cdot {\ell}^{5}\right) + \left(0.3333333333333333 \cdot \left(J \cdot {\ell}^{3}\right) + 2 \cdot \left(\ell \cdot J\right)\right)\right)\right) \cdot \cos \left(\frac{K}{2}\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -0.10000000000000001Initial program 99.9%
Taylor expanded in J around 0 100.0%
if -0.10000000000000001 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 83.4%
Taylor expanded in l around 0 97.9%
Taylor expanded in l around 0 97.9%
Final simplification98.5%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (- (exp l) (exp (- l)))))
(if (<= t_0 -0.1)
(+ (* J (* t_0 (cos (* 0.5 K)))) U)
(+
U
(*
(cos (/ K 2.0))
(*
J
(+
(* 0.0003968253968253968 (pow l 7.0))
(+
(* 0.016666666666666666 (pow l 5.0))
(+ (* 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.1) {
tmp = (J * (t_0 * cos((0.5 * K)))) + U;
} else {
tmp = U + (cos((K / 2.0)) * (J * ((0.0003968253968253968 * pow(l, 7.0)) + ((0.016666666666666666 * pow(l, 5.0)) + ((0.3333333333333333 * pow(l, 3.0)) + (l * 2.0))))));
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: t_0
real(8) :: tmp
t_0 = exp(l) - exp(-l)
if (t_0 <= (-0.1d0)) then
tmp = (j * (t_0 * cos((0.5d0 * k)))) + u
else
tmp = u + (cos((k / 2.0d0)) * (j * ((0.0003968253968253968d0 * (l ** 7.0d0)) + ((0.016666666666666666d0 * (l ** 5.0d0)) + ((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.exp(l) - Math.exp(-l);
double tmp;
if (t_0 <= -0.1) {
tmp = (J * (t_0 * Math.cos((0.5 * K)))) + U;
} else {
tmp = U + (Math.cos((K / 2.0)) * (J * ((0.0003968253968253968 * Math.pow(l, 7.0)) + ((0.016666666666666666 * Math.pow(l, 5.0)) + ((0.3333333333333333 * Math.pow(l, 3.0)) + (l * 2.0))))));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.exp(l) - math.exp(-l) tmp = 0 if t_0 <= -0.1: tmp = (J * (t_0 * math.cos((0.5 * K)))) + U else: tmp = U + (math.cos((K / 2.0)) * (J * ((0.0003968253968253968 * math.pow(l, 7.0)) + ((0.016666666666666666 * math.pow(l, 5.0)) + ((0.3333333333333333 * math.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.1) tmp = Float64(Float64(J * Float64(t_0 * cos(Float64(0.5 * K)))) + U); else tmp = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(J * Float64(Float64(0.0003968253968253968 * (l ^ 7.0)) + Float64(Float64(0.016666666666666666 * (l ^ 5.0)) + 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 = exp(l) - exp(-l); tmp = 0.0; if (t_0 <= -0.1) tmp = (J * (t_0 * cos((0.5 * K)))) + U; else tmp = U + (cos((K / 2.0)) * (J * ((0.0003968253968253968 * (l ^ 7.0)) + ((0.016666666666666666 * (l ^ 5.0)) + ((0.3333333333333333 * (l ^ 3.0)) + (l * 2.0)))))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -0.1], N[(N[(J * N[(t$95$0 * N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(J * N[(N[(0.0003968253968253968 * N[Power[l, 7.0], $MachinePrecision]), $MachinePrecision] + N[(N[(0.016666666666666666 * N[Power[l, 5.0], $MachinePrecision]), $MachinePrecision] + N[(N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision] + N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{\ell} - e^{-\ell}\\
\mathbf{if}\;t_0 \leq -0.1:\\
\;\;\;\;J \cdot \left(t_0 \cdot \cos \left(0.5 \cdot K\right)\right) + U\\
\mathbf{else}:\\
\;\;\;\;U + \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(0.0003968253968253968 \cdot {\ell}^{7} + \left(0.016666666666666666 \cdot {\ell}^{5} + \left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right)\right)\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -0.10000000000000001Initial program 99.9%
Taylor expanded in J around 0 100.0%
if -0.10000000000000001 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 83.4%
Taylor expanded in l around 0 97.9%
Final simplification98.5%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (* (- (exp l) (exp (- l))) J)))
(if (or (<= t_0 -2e-40) (not (<= t_0 2e+46)))
(+ U t_0)
(+ U (* (* l J) (* (cos (* 0.5 K)) 2.0))))))
double code(double J, double l, double K, double U) {
double t_0 = (exp(l) - exp(-l)) * J;
double tmp;
if ((t_0 <= -2e-40) || !(t_0 <= 2e+46)) {
tmp = U + t_0;
} else {
tmp = U + ((l * J) * (cos((0.5 * K)) * 2.0));
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: t_0
real(8) :: tmp
t_0 = (exp(l) - exp(-l)) * j
if ((t_0 <= (-2d-40)) .or. (.not. (t_0 <= 2d+46))) then
tmp = u + t_0
else
tmp = u + ((l * j) * (cos((0.5d0 * k)) * 2.0d0))
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 ((t_0 <= -2e-40) || !(t_0 <= 2e+46)) {
tmp = U + t_0;
} else {
tmp = U + ((l * J) * (Math.cos((0.5 * K)) * 2.0));
}
return tmp;
}
def code(J, l, K, U): t_0 = (math.exp(l) - math.exp(-l)) * J tmp = 0 if (t_0 <= -2e-40) or not (t_0 <= 2e+46): tmp = U + t_0 else: tmp = U + ((l * J) * (math.cos((0.5 * K)) * 2.0)) return tmp
function code(J, l, K, U) t_0 = Float64(Float64(exp(l) - exp(Float64(-l))) * J) tmp = 0.0 if ((t_0 <= -2e-40) || !(t_0 <= 2e+46)) tmp = Float64(U + t_0); else tmp = Float64(U + Float64(Float64(l * J) * Float64(cos(Float64(0.5 * K)) * 2.0))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = (exp(l) - exp(-l)) * J; tmp = 0.0; if ((t_0 <= -2e-40) || ~((t_0 <= 2e+46))) tmp = U + t_0; else tmp = U + ((l * J) * (cos((0.5 * K)) * 2.0)); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision]}, If[Or[LessEqual[t$95$0, -2e-40], N[Not[LessEqual[t$95$0, 2e+46]], $MachinePrecision]], N[(U + t$95$0), $MachinePrecision], N[(U + N[(N[(l * J), $MachinePrecision] * N[(N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(e^{\ell} - e^{-\ell}\right) \cdot J\\
\mathbf{if}\;t_0 \leq -2 \cdot 10^{-40} \lor \neg \left(t_0 \leq 2 \cdot 10^{+46}\right):\\
\;\;\;\;U + t_0\\
\mathbf{else}:\\
\;\;\;\;U + \left(\ell \cdot J\right) \cdot \left(\cos \left(0.5 \cdot K\right) \cdot 2\right)\\
\end{array}
\end{array}
if (*.f64 J (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l)))) < -1.9999999999999999e-40 or 2e46 < (*.f64 J (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l)))) Initial program 99.9%
Taylor expanded in K around 0 72.4%
if -1.9999999999999999e-40 < (*.f64 J (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l)))) < 2e46Initial program 76.9%
Taylor expanded in l around 0 99.4%
*-commutative99.4%
associate-*r*99.4%
associate-*l*99.4%
*-commutative99.4%
Simplified99.4%
Final simplification86.4%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0)))
(t_1 (+ U (* t_0 (* (pow l 7.0) (* J 0.0003968253968253968))))))
(if (<= l -2.15e+49)
t_1
(if (<= l -0.4)
(+ U (* (- (exp l) (exp (- l))) J))
(if (<= l 5.5)
(+ U (* t_0 (* J (+ (* 0.3333333333333333 (pow l 3.0)) (* l 2.0)))))
t_1)))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double t_1 = U + (t_0 * (pow(l, 7.0) * (J * 0.0003968253968253968)));
double tmp;
if (l <= -2.15e+49) {
tmp = t_1;
} else if (l <= -0.4) {
tmp = U + ((exp(l) - exp(-l)) * J);
} else if (l <= 5.5) {
tmp = U + (t_0 * (J * ((0.3333333333333333 * pow(l, 3.0)) + (l * 2.0))));
} 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 / 2.0d0))
t_1 = u + (t_0 * ((l ** 7.0d0) * (j * 0.0003968253968253968d0)))
if (l <= (-2.15d+49)) then
tmp = t_1
else if (l <= (-0.4d0)) then
tmp = u + ((exp(l) - exp(-l)) * j)
else if (l <= 5.5d0) then
tmp = u + (t_0 * (j * ((0.3333333333333333d0 * (l ** 3.0d0)) + (l * 2.0d0))))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = Math.cos((K / 2.0));
double t_1 = U + (t_0 * (Math.pow(l, 7.0) * (J * 0.0003968253968253968)));
double tmp;
if (l <= -2.15e+49) {
tmp = t_1;
} else if (l <= -0.4) {
tmp = U + ((Math.exp(l) - Math.exp(-l)) * J);
} else if (l <= 5.5) {
tmp = U + (t_0 * (J * ((0.3333333333333333 * Math.pow(l, 3.0)) + (l * 2.0))));
} else {
tmp = t_1;
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K / 2.0)) t_1 = U + (t_0 * (math.pow(l, 7.0) * (J * 0.0003968253968253968))) tmp = 0 if l <= -2.15e+49: tmp = t_1 elif l <= -0.4: tmp = U + ((math.exp(l) - math.exp(-l)) * J) elif l <= 5.5: tmp = U + (t_0 * (J * ((0.3333333333333333 * math.pow(l, 3.0)) + (l * 2.0)))) else: tmp = t_1 return tmp
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) t_1 = Float64(U + Float64(t_0 * Float64((l ^ 7.0) * Float64(J * 0.0003968253968253968)))) tmp = 0.0 if (l <= -2.15e+49) tmp = t_1; elseif (l <= -0.4) tmp = Float64(U + Float64(Float64(exp(l) - exp(Float64(-l))) * J)); elseif (l <= 5.5) tmp = Float64(U + Float64(t_0 * Float64(J * Float64(Float64(0.3333333333333333 * (l ^ 3.0)) + Float64(l * 2.0))))); else tmp = t_1; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = cos((K / 2.0)); t_1 = U + (t_0 * ((l ^ 7.0) * (J * 0.0003968253968253968))); tmp = 0.0; if (l <= -2.15e+49) tmp = t_1; elseif (l <= -0.4) tmp = U + ((exp(l) - exp(-l)) * J); elseif (l <= 5.5) tmp = U + (t_0 * (J * ((0.3333333333333333 * (l ^ 3.0)) + (l * 2.0)))); else tmp = t_1; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(U + N[(t$95$0 * N[(N[Power[l, 7.0], $MachinePrecision] * N[(J * 0.0003968253968253968), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -2.15e+49], t$95$1, If[LessEqual[l, -0.4], N[(U + N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 5.5], 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], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
t_1 := U + t_0 \cdot \left({\ell}^{7} \cdot \left(J \cdot 0.0003968253968253968\right)\right)\\
\mathbf{if}\;\ell \leq -2.15 \cdot 10^{+49}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\ell \leq -0.4:\\
\;\;\;\;U + \left(e^{\ell} - e^{-\ell}\right) \cdot J\\
\mathbf{elif}\;\ell \leq 5.5:\\
\;\;\;\;U + t_0 \cdot \left(J \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if l < -2.15e49 or 5.5 < l Initial program 100.0%
Taylor expanded in l around 0 96.3%
Taylor expanded in l around inf 96.3%
*-commutative96.3%
*-commutative96.3%
associate-*l*96.3%
Simplified96.3%
if -2.15e49 < l < -0.40000000000000002Initial program 100.0%
Taylor expanded in K around 0 75.0%
if -0.40000000000000002 < l < 5.5Initial program 77.8%
Taylor expanded in l around 0 98.7%
Final simplification96.3%
(FPCore (J l K U)
:precision binary64
(let* ((t_0
(+
U
(* (cos (/ K 2.0)) (* (pow l 7.0) (* J 0.0003968253968253968))))))
(if (<= l -2.15e+49)
t_0
(if (<= l -0.0024)
(+ U (* (- (exp l) (exp (- l))) J))
(if (<= l 4.2) (+ U (* (* l J) (* (cos (* 0.5 K)) 2.0))) t_0)))))
double code(double J, double l, double K, double U) {
double t_0 = U + (cos((K / 2.0)) * (pow(l, 7.0) * (J * 0.0003968253968253968)));
double tmp;
if (l <= -2.15e+49) {
tmp = t_0;
} else if (l <= -0.0024) {
tmp = U + ((exp(l) - exp(-l)) * J);
} else if (l <= 4.2) {
tmp = U + ((l * J) * (cos((0.5 * K)) * 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 + (cos((k / 2.0d0)) * ((l ** 7.0d0) * (j * 0.0003968253968253968d0)))
if (l <= (-2.15d+49)) then
tmp = t_0
else if (l <= (-0.0024d0)) then
tmp = u + ((exp(l) - exp(-l)) * j)
else if (l <= 4.2d0) then
tmp = u + ((l * j) * (cos((0.5d0 * k)) * 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 + (Math.cos((K / 2.0)) * (Math.pow(l, 7.0) * (J * 0.0003968253968253968)));
double tmp;
if (l <= -2.15e+49) {
tmp = t_0;
} else if (l <= -0.0024) {
tmp = U + ((Math.exp(l) - Math.exp(-l)) * J);
} else if (l <= 4.2) {
tmp = U + ((l * J) * (Math.cos((0.5 * K)) * 2.0));
} else {
tmp = t_0;
}
return tmp;
}
def code(J, l, K, U): t_0 = U + (math.cos((K / 2.0)) * (math.pow(l, 7.0) * (J * 0.0003968253968253968))) tmp = 0 if l <= -2.15e+49: tmp = t_0 elif l <= -0.0024: tmp = U + ((math.exp(l) - math.exp(-l)) * J) elif l <= 4.2: tmp = U + ((l * J) * (math.cos((0.5 * K)) * 2.0)) else: tmp = t_0 return tmp
function code(J, l, K, U) t_0 = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64((l ^ 7.0) * Float64(J * 0.0003968253968253968)))) tmp = 0.0 if (l <= -2.15e+49) tmp = t_0; elseif (l <= -0.0024) tmp = Float64(U + Float64(Float64(exp(l) - exp(Float64(-l))) * J)); elseif (l <= 4.2) tmp = Float64(U + Float64(Float64(l * J) * Float64(cos(Float64(0.5 * K)) * 2.0))); else tmp = t_0; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = U + (cos((K / 2.0)) * ((l ^ 7.0) * (J * 0.0003968253968253968))); tmp = 0.0; if (l <= -2.15e+49) tmp = t_0; elseif (l <= -0.0024) tmp = U + ((exp(l) - exp(-l)) * J); elseif (l <= 4.2) tmp = U + ((l * J) * (cos((0.5 * K)) * 2.0)); else tmp = t_0; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(N[Power[l, 7.0], $MachinePrecision] * N[(J * 0.0003968253968253968), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -2.15e+49], t$95$0, If[LessEqual[l, -0.0024], N[(U + N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 4.2], N[(U + N[(N[(l * J), $MachinePrecision] * N[(N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + \cos \left(\frac{K}{2}\right) \cdot \left({\ell}^{7} \cdot \left(J \cdot 0.0003968253968253968\right)\right)\\
\mathbf{if}\;\ell \leq -2.15 \cdot 10^{+49}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq -0.0024:\\
\;\;\;\;U + \left(e^{\ell} - e^{-\ell}\right) \cdot J\\
\mathbf{elif}\;\ell \leq 4.2:\\
\;\;\;\;U + \left(\ell \cdot J\right) \cdot \left(\cos \left(0.5 \cdot K\right) \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if l < -2.15e49 or 4.20000000000000018 < l Initial program 100.0%
Taylor expanded in l around 0 96.3%
Taylor expanded in l around inf 96.3%
*-commutative96.3%
*-commutative96.3%
associate-*l*96.3%
Simplified96.3%
if -2.15e49 < l < -0.00239999999999999979Initial program 99.4%
Taylor expanded in K around 0 70.0%
if -0.00239999999999999979 < l < 4.20000000000000018Initial program 77.4%
Taylor expanded in l around 0 99.5%
*-commutative99.5%
associate-*r*99.5%
associate-*l*99.5%
*-commutative99.5%
Simplified99.5%
Final simplification96.1%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (log1p (expm1 U)))
(t_1 (+ U (* J (+ (* l 2.0) (* (* l (pow K 2.0)) -0.25))))))
(if (<= l -7.8e+158)
t_1
(if (<= l -620000.0)
t_0
(if (<= l 550.0)
(+ U (* (* l J) (* (cos (* 0.5 K)) 2.0)))
(if (<= l 4e+141) t_0 t_1))))))
double code(double J, double l, double K, double U) {
double t_0 = log1p(expm1(U));
double t_1 = U + (J * ((l * 2.0) + ((l * pow(K, 2.0)) * -0.25)));
double tmp;
if (l <= -7.8e+158) {
tmp = t_1;
} else if (l <= -620000.0) {
tmp = t_0;
} else if (l <= 550.0) {
tmp = U + ((l * J) * (cos((0.5 * K)) * 2.0));
} else if (l <= 4e+141) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
public static double code(double J, double l, double K, double U) {
double t_0 = Math.log1p(Math.expm1(U));
double t_1 = U + (J * ((l * 2.0) + ((l * Math.pow(K, 2.0)) * -0.25)));
double tmp;
if (l <= -7.8e+158) {
tmp = t_1;
} else if (l <= -620000.0) {
tmp = t_0;
} else if (l <= 550.0) {
tmp = U + ((l * J) * (Math.cos((0.5 * K)) * 2.0));
} else if (l <= 4e+141) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(J, l, K, U): t_0 = math.log1p(math.expm1(U)) t_1 = U + (J * ((l * 2.0) + ((l * math.pow(K, 2.0)) * -0.25))) tmp = 0 if l <= -7.8e+158: tmp = t_1 elif l <= -620000.0: tmp = t_0 elif l <= 550.0: tmp = U + ((l * J) * (math.cos((0.5 * K)) * 2.0)) elif l <= 4e+141: tmp = t_0 else: tmp = t_1 return tmp
function code(J, l, K, U) t_0 = log1p(expm1(U)) t_1 = Float64(U + Float64(J * Float64(Float64(l * 2.0) + Float64(Float64(l * (K ^ 2.0)) * -0.25)))) tmp = 0.0 if (l <= -7.8e+158) tmp = t_1; elseif (l <= -620000.0) tmp = t_0; elseif (l <= 550.0) tmp = Float64(U + Float64(Float64(l * J) * Float64(cos(Float64(0.5 * K)) * 2.0))); elseif (l <= 4e+141) tmp = t_0; else tmp = t_1; end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Log[1 + N[(Exp[U] - 1), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(U + N[(J * N[(N[(l * 2.0), $MachinePrecision] + N[(N[(l * N[Power[K, 2.0], $MachinePrecision]), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -7.8e+158], t$95$1, If[LessEqual[l, -620000.0], t$95$0, If[LessEqual[l, 550.0], N[(U + N[(N[(l * J), $MachinePrecision] * N[(N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 4e+141], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{log1p}\left(\mathsf{expm1}\left(U\right)\right)\\
t_1 := U + J \cdot \left(\ell \cdot 2 + \left(\ell \cdot {K}^{2}\right) \cdot -0.25\right)\\
\mathbf{if}\;\ell \leq -7.8 \cdot 10^{+158}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\ell \leq -620000:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq 550:\\
\;\;\;\;U + \left(\ell \cdot J\right) \cdot \left(\cos \left(0.5 \cdot K\right) \cdot 2\right)\\
\mathbf{elif}\;\ell \leq 4 \cdot 10^{+141}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if l < -7.8e158 or 4.00000000000000007e141 < l Initial program 100.0%
Taylor expanded in l around 0 41.2%
+-commutative41.2%
*-commutative41.2%
associate-*r*41.2%
associate-*l*41.2%
fma-def41.2%
*-commutative41.2%
*-commutative41.2%
Simplified41.2%
Taylor expanded in K around 0 34.2%
+-commutative34.2%
*-commutative34.2%
associate-*l*34.2%
*-commutative34.2%
associate-*l*34.2%
distribute-lft-out52.1%
*-commutative52.1%
Simplified52.1%
if -7.8e158 < l < -6.2e5 or 550 < l < 4.00000000000000007e141Initial program 100.0%
Applied egg-rr40.8%
if -6.2e5 < l < 550Initial program 77.9%
Taylor expanded in l around 0 97.4%
*-commutative97.4%
associate-*r*97.4%
associate-*l*97.4%
*-commutative97.4%
Simplified97.4%
Final simplification74.2%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (+ U (* J (+ (* l 2.0) (* (* l (pow K 2.0)) -0.25))))))
(if (<= l -1.9e+58)
t_0
(if (<= l -2e+17)
(pow U -3.0)
(if (<= l 0.01) (+ U (* (* l J) (* (cos (* 0.5 K)) 2.0))) t_0)))))
double code(double J, double l, double K, double U) {
double t_0 = U + (J * ((l * 2.0) + ((l * pow(K, 2.0)) * -0.25)));
double tmp;
if (l <= -1.9e+58) {
tmp = t_0;
} else if (l <= -2e+17) {
tmp = pow(U, -3.0);
} else if (l <= 0.01) {
tmp = U + ((l * J) * (cos((0.5 * K)) * 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 * ((l * 2.0d0) + ((l * (k ** 2.0d0)) * (-0.25d0))))
if (l <= (-1.9d+58)) then
tmp = t_0
else if (l <= (-2d+17)) then
tmp = u ** (-3.0d0)
else if (l <= 0.01d0) then
tmp = u + ((l * j) * (cos((0.5d0 * k)) * 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 * ((l * 2.0) + ((l * Math.pow(K, 2.0)) * -0.25)));
double tmp;
if (l <= -1.9e+58) {
tmp = t_0;
} else if (l <= -2e+17) {
tmp = Math.pow(U, -3.0);
} else if (l <= 0.01) {
tmp = U + ((l * J) * (Math.cos((0.5 * K)) * 2.0));
} else {
tmp = t_0;
}
return tmp;
}
def code(J, l, K, U): t_0 = U + (J * ((l * 2.0) + ((l * math.pow(K, 2.0)) * -0.25))) tmp = 0 if l <= -1.9e+58: tmp = t_0 elif l <= -2e+17: tmp = math.pow(U, -3.0) elif l <= 0.01: tmp = U + ((l * J) * (math.cos((0.5 * K)) * 2.0)) else: tmp = t_0 return tmp
function code(J, l, K, U) t_0 = Float64(U + Float64(J * Float64(Float64(l * 2.0) + Float64(Float64(l * (K ^ 2.0)) * -0.25)))) tmp = 0.0 if (l <= -1.9e+58) tmp = t_0; elseif (l <= -2e+17) tmp = U ^ -3.0; elseif (l <= 0.01) tmp = Float64(U + Float64(Float64(l * J) * Float64(cos(Float64(0.5 * K)) * 2.0))); else tmp = t_0; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = U + (J * ((l * 2.0) + ((l * (K ^ 2.0)) * -0.25))); tmp = 0.0; if (l <= -1.9e+58) tmp = t_0; elseif (l <= -2e+17) tmp = U ^ -3.0; elseif (l <= 0.01) tmp = U + ((l * J) * (cos((0.5 * K)) * 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[(N[(l * 2.0), $MachinePrecision] + N[(N[(l * N[Power[K, 2.0], $MachinePrecision]), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -1.9e+58], t$95$0, If[LessEqual[l, -2e+17], N[Power[U, -3.0], $MachinePrecision], If[LessEqual[l, 0.01], N[(U + N[(N[(l * J), $MachinePrecision] * N[(N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + J \cdot \left(\ell \cdot 2 + \left(\ell \cdot {K}^{2}\right) \cdot -0.25\right)\\
\mathbf{if}\;\ell \leq -1.9 \cdot 10^{+58}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq -2 \cdot 10^{+17}:\\
\;\;\;\;{U}^{-3}\\
\mathbf{elif}\;\ell \leq 0.01:\\
\;\;\;\;U + \left(\ell \cdot J\right) \cdot \left(\cos \left(0.5 \cdot K\right) \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if l < -1.8999999999999999e58 or 0.0100000000000000002 < l Initial program 99.9%
Taylor expanded in l around 0 30.2%
+-commutative30.2%
*-commutative30.2%
associate-*r*30.2%
associate-*l*30.2%
fma-def30.2%
*-commutative30.2%
*-commutative30.2%
Simplified30.2%
Taylor expanded in K around 0 30.6%
+-commutative30.6%
*-commutative30.6%
associate-*l*30.6%
*-commutative30.6%
associate-*l*30.6%
distribute-lft-out40.3%
*-commutative40.3%
Simplified40.3%
if -1.8999999999999999e58 < l < -2e17Initial program 100.0%
Applied egg-rr62.0%
if -2e17 < l < 0.0100000000000000002Initial program 78.0%
Taylor expanded in l around 0 95.8%
*-commutative95.8%
associate-*r*95.8%
associate-*l*95.8%
*-commutative95.8%
Simplified95.8%
Final simplification71.8%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (* 2.0 (* l (+ J (* -0.125 (* J (pow K 2.0))))))))
(if (<= l -3.7e+86)
t_0
(if (<= l -2e+17)
(pow U -3.0)
(if (<= l 2450.0) (+ U (* (* l J) (* (cos (* 0.5 K)) 2.0))) t_0)))))
double code(double J, double l, double K, double U) {
double t_0 = 2.0 * (l * (J + (-0.125 * (J * pow(K, 2.0)))));
double tmp;
if (l <= -3.7e+86) {
tmp = t_0;
} else if (l <= -2e+17) {
tmp = pow(U, -3.0);
} else if (l <= 2450.0) {
tmp = U + ((l * J) * (cos((0.5 * K)) * 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 = 2.0d0 * (l * (j + ((-0.125d0) * (j * (k ** 2.0d0)))))
if (l <= (-3.7d+86)) then
tmp = t_0
else if (l <= (-2d+17)) then
tmp = u ** (-3.0d0)
else if (l <= 2450.0d0) then
tmp = u + ((l * j) * (cos((0.5d0 * k)) * 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 = 2.0 * (l * (J + (-0.125 * (J * Math.pow(K, 2.0)))));
double tmp;
if (l <= -3.7e+86) {
tmp = t_0;
} else if (l <= -2e+17) {
tmp = Math.pow(U, -3.0);
} else if (l <= 2450.0) {
tmp = U + ((l * J) * (Math.cos((0.5 * K)) * 2.0));
} else {
tmp = t_0;
}
return tmp;
}
def code(J, l, K, U): t_0 = 2.0 * (l * (J + (-0.125 * (J * math.pow(K, 2.0))))) tmp = 0 if l <= -3.7e+86: tmp = t_0 elif l <= -2e+17: tmp = math.pow(U, -3.0) elif l <= 2450.0: tmp = U + ((l * J) * (math.cos((0.5 * K)) * 2.0)) else: tmp = t_0 return tmp
function code(J, l, K, U) t_0 = Float64(2.0 * Float64(l * Float64(J + Float64(-0.125 * Float64(J * (K ^ 2.0)))))) tmp = 0.0 if (l <= -3.7e+86) tmp = t_0; elseif (l <= -2e+17) tmp = U ^ -3.0; elseif (l <= 2450.0) tmp = Float64(U + Float64(Float64(l * J) * Float64(cos(Float64(0.5 * K)) * 2.0))); else tmp = t_0; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = 2.0 * (l * (J + (-0.125 * (J * (K ^ 2.0))))); tmp = 0.0; if (l <= -3.7e+86) tmp = t_0; elseif (l <= -2e+17) tmp = U ^ -3.0; elseif (l <= 2450.0) tmp = U + ((l * J) * (cos((0.5 * K)) * 2.0)); else tmp = t_0; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(2.0 * N[(l * N[(J + N[(-0.125 * N[(J * N[Power[K, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -3.7e+86], t$95$0, If[LessEqual[l, -2e+17], N[Power[U, -3.0], $MachinePrecision], If[LessEqual[l, 2450.0], N[(U + N[(N[(l * J), $MachinePrecision] * N[(N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 2 \cdot \left(\ell \cdot \left(J + -0.125 \cdot \left(J \cdot {K}^{2}\right)\right)\right)\\
\mathbf{if}\;\ell \leq -3.7 \cdot 10^{+86}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq -2 \cdot 10^{+17}:\\
\;\;\;\;{U}^{-3}\\
\mathbf{elif}\;\ell \leq 2450:\\
\;\;\;\;U + \left(\ell \cdot J\right) \cdot \left(\cos \left(0.5 \cdot K\right) \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if l < -3.69999999999999992e86 or 2450 < l Initial program 100.0%
Taylor expanded in l around 0 30.0%
+-commutative30.0%
*-commutative30.0%
associate-*r*30.0%
associate-*l*30.0%
fma-def30.0%
*-commutative30.0%
*-commutative30.0%
Simplified30.0%
Taylor expanded in l around inf 29.9%
associate-*r*29.9%
Simplified29.9%
Taylor expanded in K around 0 30.4%
+-commutative30.4%
associate-*r*28.4%
associate-*r*28.4%
distribute-rgt-out39.0%
Simplified39.0%
if -3.69999999999999992e86 < l < -2e17Initial program 100.0%
Applied egg-rr47.7%
if -2e17 < l < 2450Initial program 78.5%
Taylor expanded in l around 0 94.8%
*-commutative94.8%
associate-*r*94.8%
associate-*l*94.8%
*-commutative94.8%
Simplified94.8%
Final simplification71.0%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (* 2.0 (* (cos (* 0.5 K)) (* l J)))))
(if (<= l -2.1e+62)
t_0
(if (<= l -2.2e+17)
(pow U -3.0)
(if (<= l 2450.0)
(+ U (* 2.0 (* l J)))
(if (<= l 1.9e+199) (pow U -3.0) t_0))))))
double code(double J, double l, double K, double U) {
double t_0 = 2.0 * (cos((0.5 * K)) * (l * J));
double tmp;
if (l <= -2.1e+62) {
tmp = t_0;
} else if (l <= -2.2e+17) {
tmp = pow(U, -3.0);
} else if (l <= 2450.0) {
tmp = U + (2.0 * (l * J));
} else if (l <= 1.9e+199) {
tmp = pow(U, -3.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 = 2.0d0 * (cos((0.5d0 * k)) * (l * j))
if (l <= (-2.1d+62)) then
tmp = t_0
else if (l <= (-2.2d+17)) then
tmp = u ** (-3.0d0)
else if (l <= 2450.0d0) then
tmp = u + (2.0d0 * (l * j))
else if (l <= 1.9d+199) then
tmp = u ** (-3.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 = 2.0 * (Math.cos((0.5 * K)) * (l * J));
double tmp;
if (l <= -2.1e+62) {
tmp = t_0;
} else if (l <= -2.2e+17) {
tmp = Math.pow(U, -3.0);
} else if (l <= 2450.0) {
tmp = U + (2.0 * (l * J));
} else if (l <= 1.9e+199) {
tmp = Math.pow(U, -3.0);
} else {
tmp = t_0;
}
return tmp;
}
def code(J, l, K, U): t_0 = 2.0 * (math.cos((0.5 * K)) * (l * J)) tmp = 0 if l <= -2.1e+62: tmp = t_0 elif l <= -2.2e+17: tmp = math.pow(U, -3.0) elif l <= 2450.0: tmp = U + (2.0 * (l * J)) elif l <= 1.9e+199: tmp = math.pow(U, -3.0) else: tmp = t_0 return tmp
function code(J, l, K, U) t_0 = Float64(2.0 * Float64(cos(Float64(0.5 * K)) * Float64(l * J))) tmp = 0.0 if (l <= -2.1e+62) tmp = t_0; elseif (l <= -2.2e+17) tmp = U ^ -3.0; elseif (l <= 2450.0) tmp = Float64(U + Float64(2.0 * Float64(l * J))); elseif (l <= 1.9e+199) tmp = U ^ -3.0; else tmp = t_0; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = 2.0 * (cos((0.5 * K)) * (l * J)); tmp = 0.0; if (l <= -2.1e+62) tmp = t_0; elseif (l <= -2.2e+17) tmp = U ^ -3.0; elseif (l <= 2450.0) tmp = U + (2.0 * (l * J)); elseif (l <= 1.9e+199) tmp = U ^ -3.0; else tmp = t_0; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(2.0 * N[(N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision] * N[(l * J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -2.1e+62], t$95$0, If[LessEqual[l, -2.2e+17], N[Power[U, -3.0], $MachinePrecision], If[LessEqual[l, 2450.0], N[(U + N[(2.0 * N[(l * J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.9e+199], N[Power[U, -3.0], $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 2 \cdot \left(\cos \left(0.5 \cdot K\right) \cdot \left(\ell \cdot J\right)\right)\\
\mathbf{if}\;\ell \leq -2.1 \cdot 10^{+62}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq -2.2 \cdot 10^{+17}:\\
\;\;\;\;{U}^{-3}\\
\mathbf{elif}\;\ell \leq 2450:\\
\;\;\;\;U + 2 \cdot \left(\ell \cdot J\right)\\
\mathbf{elif}\;\ell \leq 1.9 \cdot 10^{+199}:\\
\;\;\;\;{U}^{-3}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if l < -2.1e62 or 1.9e199 < l Initial program 100.0%
Taylor expanded in l around 0 36.5%
+-commutative36.5%
*-commutative36.5%
associate-*r*36.5%
associate-*l*36.5%
fma-def36.5%
*-commutative36.5%
*-commutative36.5%
Simplified36.5%
Taylor expanded in l around inf 36.3%
associate-*r*36.3%
Simplified36.3%
if -2.1e62 < l < -2.2e17 or 2450 < l < 1.9e199Initial program 100.0%
Applied egg-rr39.1%
if -2.2e17 < l < 2450Initial program 78.5%
Taylor expanded in l around 0 94.8%
*-commutative94.8%
associate-*r*94.8%
associate-*l*94.8%
*-commutative94.8%
Simplified94.8%
Taylor expanded in K around 0 81.0%
+-commutative81.0%
Simplified81.0%
Final simplification61.9%
(FPCore (J l K U) :precision binary64 (+ U (* l (* (cos (* 0.5 K)) (* J 2.0)))))
double code(double J, double l, double K, double U) {
return U + (l * (cos((0.5 * K)) * (J * 2.0)));
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = u + (l * (cos((0.5d0 * k)) * (j * 2.0d0)))
end function
public static double code(double J, double l, double K, double U) {
return U + (l * (Math.cos((0.5 * K)) * (J * 2.0)));
}
def code(J, l, K, U): return U + (l * (math.cos((0.5 * K)) * (J * 2.0)))
function code(J, l, K, U) return Float64(U + Float64(l * Float64(cos(Float64(0.5 * K)) * Float64(J * 2.0)))) end
function tmp = code(J, l, K, U) tmp = U + (l * (cos((0.5 * K)) * (J * 2.0))); end
code[J_, l_, K_, U_] := N[(U + N[(l * N[(N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision] * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + \ell \cdot \left(\cos \left(0.5 \cdot K\right) \cdot \left(J \cdot 2\right)\right)
\end{array}
Initial program 87.9%
Taylor expanded in l around 0 65.1%
associate-*r*65.1%
*-commutative65.1%
associate-*l*65.1%
Simplified65.1%
Final simplification65.1%
(FPCore (J l K U) :precision binary64 (+ U (* (* l J) (* (cos (* 0.5 K)) 2.0))))
double code(double J, double l, double K, double U) {
return U + ((l * J) * (cos((0.5 * K)) * 2.0));
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = u + ((l * j) * (cos((0.5d0 * k)) * 2.0d0))
end function
public static double code(double J, double l, double K, double U) {
return U + ((l * J) * (Math.cos((0.5 * K)) * 2.0));
}
def code(J, l, K, U): return U + ((l * J) * (math.cos((0.5 * K)) * 2.0))
function code(J, l, K, U) return Float64(U + Float64(Float64(l * J) * Float64(cos(Float64(0.5 * K)) * 2.0))) end
function tmp = code(J, l, K, U) tmp = U + ((l * J) * (cos((0.5 * K)) * 2.0)); end
code[J_, l_, K_, U_] := N[(U + N[(N[(l * J), $MachinePrecision] * N[(N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + \left(\ell \cdot J\right) \cdot \left(\cos \left(0.5 \cdot K\right) \cdot 2\right)
\end{array}
Initial program 87.9%
Taylor expanded in l around 0 65.1%
*-commutative65.1%
associate-*r*65.1%
associate-*l*65.1%
*-commutative65.1%
Simplified65.1%
Final simplification65.1%
(FPCore (J l K U)
:precision binary64
(if (<= l -2.9e+25)
(pow U -4.0)
(if (or (<= l 220000.0) (not (<= l 1.9e+243)))
(+ U (* 2.0 (* l J)))
(pow U -3.0))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -2.9e+25) {
tmp = pow(U, -4.0);
} else if ((l <= 220000.0) || !(l <= 1.9e+243)) {
tmp = U + (2.0 * (l * J));
} else {
tmp = pow(U, -3.0);
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if (l <= (-2.9d+25)) then
tmp = u ** (-4.0d0)
else if ((l <= 220000.0d0) .or. (.not. (l <= 1.9d+243))) then
tmp = u + (2.0d0 * (l * j))
else
tmp = u ** (-3.0d0)
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (l <= -2.9e+25) {
tmp = Math.pow(U, -4.0);
} else if ((l <= 220000.0) || !(l <= 1.9e+243)) {
tmp = U + (2.0 * (l * J));
} else {
tmp = Math.pow(U, -3.0);
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -2.9e+25: tmp = math.pow(U, -4.0) elif (l <= 220000.0) or not (l <= 1.9e+243): tmp = U + (2.0 * (l * J)) else: tmp = math.pow(U, -3.0) return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -2.9e+25) tmp = U ^ -4.0; elseif ((l <= 220000.0) || !(l <= 1.9e+243)) tmp = Float64(U + Float64(2.0 * Float64(l * J))); else tmp = U ^ -3.0; end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -2.9e+25) tmp = U ^ -4.0; elseif ((l <= 220000.0) || ~((l <= 1.9e+243))) tmp = U + (2.0 * (l * J)); else tmp = U ^ -3.0; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -2.9e+25], N[Power[U, -4.0], $MachinePrecision], If[Or[LessEqual[l, 220000.0], N[Not[LessEqual[l, 1.9e+243]], $MachinePrecision]], N[(U + N[(2.0 * N[(l * J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Power[U, -3.0], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2.9 \cdot 10^{+25}:\\
\;\;\;\;{U}^{-4}\\
\mathbf{elif}\;\ell \leq 220000 \lor \neg \left(\ell \leq 1.9 \cdot 10^{+243}\right):\\
\;\;\;\;U + 2 \cdot \left(\ell \cdot J\right)\\
\mathbf{else}:\\
\;\;\;\;{U}^{-3}\\
\end{array}
\end{array}
if l < -2.8999999999999999e25Initial program 100.0%
Applied egg-rr31.2%
if -2.8999999999999999e25 < l < 2.2e5 or 1.89999999999999999e243 < l Initial program 80.6%
Taylor expanded in l around 0 88.9%
*-commutative88.9%
associate-*r*88.9%
associate-*l*88.9%
*-commutative88.9%
Simplified88.9%
Taylor expanded in K around 0 75.6%
+-commutative75.6%
Simplified75.6%
if 2.2e5 < l < 1.89999999999999999e243Initial program 100.0%
Applied egg-rr31.2%
Final simplification58.8%
(FPCore (J l K U) :precision binary64 (if (or (<= l -0.0024) (not (<= l 0.016))) (* 2.0 (* l J)) U))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -0.0024) || !(l <= 0.016)) {
tmp = 2.0 * (l * J);
} 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 <= (-0.0024d0)) .or. (.not. (l <= 0.016d0))) then
tmp = 2.0d0 * (l * j)
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 <= -0.0024) || !(l <= 0.016)) {
tmp = 2.0 * (l * J);
} else {
tmp = U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -0.0024) or not (l <= 0.016): tmp = 2.0 * (l * J) else: tmp = U return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -0.0024) || !(l <= 0.016)) tmp = Float64(2.0 * Float64(l * J)); else tmp = U; end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -0.0024) || ~((l <= 0.016))) tmp = 2.0 * (l * J); else tmp = U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -0.0024], N[Not[LessEqual[l, 0.016]], $MachinePrecision]], N[(2.0 * N[(l * J), $MachinePrecision]), $MachinePrecision], U]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -0.0024 \lor \neg \left(\ell \leq 0.016\right):\\
\;\;\;\;2 \cdot \left(\ell \cdot J\right)\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\end{array}
if l < -0.00239999999999999979 or 0.016 < l Initial program 99.9%
Taylor expanded in l around 0 26.9%
+-commutative26.9%
*-commutative26.9%
associate-*r*26.9%
associate-*l*26.9%
fma-def26.9%
*-commutative26.9%
*-commutative26.9%
Simplified26.9%
Taylor expanded in l around inf 26.7%
associate-*r*26.7%
Simplified26.7%
Taylor expanded in K around 0 19.1%
if -0.00239999999999999979 < l < 0.016Initial program 77.1%
Taylor expanded in J around 0 76.3%
Final simplification49.0%
(FPCore (J l K U) :precision binary64 (+ U (* 2.0 (* l J))))
double code(double J, double l, double K, double U) {
return U + (2.0 * (l * J));
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = u + (2.0d0 * (l * j))
end function
public static double code(double J, double l, double K, double U) {
return U + (2.0 * (l * J));
}
def code(J, l, K, U): return U + (2.0 * (l * J))
function code(J, l, K, U) return Float64(U + Float64(2.0 * Float64(l * J))) end
function tmp = code(J, l, K, U) tmp = U + (2.0 * (l * J)); end
code[J_, l_, K_, U_] := N[(U + N[(2.0 * N[(l * J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + 2 \cdot \left(\ell \cdot J\right)
\end{array}
Initial program 87.9%
Taylor expanded in l around 0 65.1%
*-commutative65.1%
associate-*r*65.1%
associate-*l*65.1%
*-commutative65.1%
Simplified65.1%
Taylor expanded in K around 0 53.9%
+-commutative53.9%
Simplified53.9%
Final simplification53.9%
(FPCore (J l K U) :precision binary64 (if (<= l -0.072) (* U U) U))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -0.072) {
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 <= (-0.072d0)) 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 <= -0.072) {
tmp = U * U;
} else {
tmp = U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -0.072: tmp = U * U else: tmp = U return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -0.072) tmp = Float64(U * U); else tmp = U; end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -0.072) tmp = U * U; else tmp = U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -0.072], N[(U * U), $MachinePrecision], U]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -0.072:\\
\;\;\;\;U \cdot U\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\end{array}
if l < -0.0719999999999999946Initial program 99.9%
Applied egg-rr16.0%
if -0.0719999999999999946 < l Initial program 83.4%
Taylor expanded in J around 0 55.7%
Final simplification44.8%
(FPCore (J l K U) :precision binary64 1.0)
double code(double J, double l, double K, double U) {
return 1.0;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = 1.0d0
end function
public static double code(double J, double l, double K, double U) {
return 1.0;
}
def code(J, l, K, U): return 1.0
function code(J, l, K, U) return 1.0 end
function tmp = code(J, l, K, U) tmp = 1.0; end
code[J_, l_, K_, U_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 87.9%
Applied egg-rr3.0%
*-inverses3.0%
Simplified3.0%
Final simplification3.0%
(FPCore (J l K U) :precision binary64 U)
double code(double J, double l, double K, double U) {
return U;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = u
end function
public static double code(double J, double l, double K, double U) {
return U;
}
def code(J, l, K, U): return U
function code(J, l, K, U) return U end
function tmp = code(J, l, K, U) tmp = U; end
code[J_, l_, K_, U_] := U
\begin{array}{l}
\\
U
\end{array}
Initial program 87.9%
Taylor expanded in J around 0 41.1%
Final simplification41.1%
herbie shell --seed 2023319
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))