
(FPCore (J l K U) :precision binary64 (+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))
double code(double J, double l, double K, double U) {
return ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = ((j * (exp(l) - exp(-l))) * cos((k / 2.0d0))) + u
end function
public static double code(double J, double l, double K, double U) {
return ((J * (Math.exp(l) - Math.exp(-l))) * Math.cos((K / 2.0))) + U;
}
def code(J, l, K, U): return ((J * (math.exp(l) - math.exp(-l))) * math.cos((K / 2.0))) + U
function code(J, l, K, U) return Float64(Float64(Float64(J * Float64(exp(l) - exp(Float64(-l)))) * cos(Float64(K / 2.0))) + U) end
function tmp = code(J, l, K, U) tmp = ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U; end
code[J_, l_, K_, U_] := N[(N[(N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]
\begin{array}{l}
\\
\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 15 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (J l K U) :precision binary64 (+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))
double code(double J, double l, double K, double U) {
return ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = ((j * (exp(l) - exp(-l))) * cos((k / 2.0d0))) + u
end function
public static double code(double J, double l, double K, double U) {
return ((J * (Math.exp(l) - Math.exp(-l))) * Math.cos((K / 2.0))) + U;
}
def code(J, l, K, U): return ((J * (math.exp(l) - math.exp(-l))) * math.cos((K / 2.0))) + U
function code(J, l, K, U) return Float64(Float64(Float64(J * Float64(exp(l) - exp(Float64(-l)))) * cos(Float64(K / 2.0))) + U) end
function tmp = code(J, l, K, U) tmp = ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U; end
code[J_, l_, K_, U_] := N[(N[(N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]
\begin{array}{l}
\\
\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U
\end{array}
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (* J (- (exp l) (exp (- l))))) (t_1 (cos (/ K 2.0))))
(if (<= t_0 1e+139)
(+
(*
(*
J
(*
l
(+
2.0
(*
(* l l)
(+ 0.3333333333333333 (* (* l l) 0.016666666666666666))))))
t_1)
U)
(+ U (* t_0 t_1)))))
double code(double J, double l, double K, double U) {
double t_0 = J * (exp(l) - exp(-l));
double t_1 = cos((K / 2.0));
double tmp;
if (t_0 <= 1e+139) {
tmp = ((J * (l * (2.0 + ((l * l) * (0.3333333333333333 + ((l * l) * 0.016666666666666666)))))) * t_1) + U;
} else {
tmp = U + (t_0 * 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 = j * (exp(l) - exp(-l))
t_1 = cos((k / 2.0d0))
if (t_0 <= 1d+139) then
tmp = ((j * (l * (2.0d0 + ((l * l) * (0.3333333333333333d0 + ((l * l) * 0.016666666666666666d0)))))) * t_1) + u
else
tmp = u + (t_0 * t_1)
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = J * (Math.exp(l) - Math.exp(-l));
double t_1 = Math.cos((K / 2.0));
double tmp;
if (t_0 <= 1e+139) {
tmp = ((J * (l * (2.0 + ((l * l) * (0.3333333333333333 + ((l * l) * 0.016666666666666666)))))) * t_1) + U;
} else {
tmp = U + (t_0 * t_1);
}
return tmp;
}
def code(J, l, K, U): t_0 = J * (math.exp(l) - math.exp(-l)) t_1 = math.cos((K / 2.0)) tmp = 0 if t_0 <= 1e+139: tmp = ((J * (l * (2.0 + ((l * l) * (0.3333333333333333 + ((l * l) * 0.016666666666666666)))))) * t_1) + U else: tmp = U + (t_0 * t_1) return tmp
function code(J, l, K, U) t_0 = Float64(J * Float64(exp(l) - exp(Float64(-l)))) t_1 = cos(Float64(K / 2.0)) tmp = 0.0 if (t_0 <= 1e+139) tmp = Float64(Float64(Float64(J * Float64(l * Float64(2.0 + Float64(Float64(l * l) * Float64(0.3333333333333333 + Float64(Float64(l * l) * 0.016666666666666666)))))) * t_1) + U); else tmp = Float64(U + Float64(t_0 * t_1)); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = J * (exp(l) - exp(-l)); t_1 = cos((K / 2.0)); tmp = 0.0; if (t_0 <= 1e+139) tmp = ((J * (l * (2.0 + ((l * l) * (0.3333333333333333 + ((l * l) * 0.016666666666666666)))))) * t_1) + U; else tmp = U + (t_0 * t_1); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, 1e+139], N[(N[(N[(J * N[(l * N[(2.0 + N[(N[(l * l), $MachinePrecision] * N[(0.3333333333333333 + N[(N[(l * l), $MachinePrecision] * 0.016666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision] + U), $MachinePrecision], N[(U + N[(t$95$0 * t$95$1), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := J \cdot \left(e^{\ell} - e^{-\ell}\right)\\
t_1 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;t\_0 \leq 10^{+139}:\\
\;\;\;\;\left(J \cdot \left(\ell \cdot \left(2 + \left(\ell \cdot \ell\right) \cdot \left(0.3333333333333333 + \left(\ell \cdot \ell\right) \cdot 0.016666666666666666\right)\right)\right)\right) \cdot t\_1 + U\\
\mathbf{else}:\\
\;\;\;\;U + t\_0 \cdot t\_1\\
\end{array}
\end{array}
if (*.f64 J (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l)))) < 1.00000000000000003e139Initial program 81.2%
Taylor expanded in l around 0 98.0%
*-commutative98.0%
Simplified98.0%
unpow298.0%
Applied egg-rr98.0%
unpow298.0%
Applied egg-rr98.0%
if 1.00000000000000003e139 < (*.f64 J (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l)))) Initial program 100.0%
Final simplification98.5%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (exp (- l))) (t_1 (cos (/ K 2.0))))
(if (<= l -4.6)
(+ U (* t_1 (* J (- 27.0 t_0))))
(if (or (<= l 4.9e-14) (not (<= l 5.4e+45)))
(+
(*
(*
J
(*
l
(+
2.0
(*
(* l l)
(+ 0.3333333333333333 (* (* l l) 0.016666666666666666))))))
t_1)
U)
(+ (* J (- (exp l) t_0)) U)))))
double code(double J, double l, double K, double U) {
double t_0 = exp(-l);
double t_1 = cos((K / 2.0));
double tmp;
if (l <= -4.6) {
tmp = U + (t_1 * (J * (27.0 - t_0)));
} else if ((l <= 4.9e-14) || !(l <= 5.4e+45)) {
tmp = ((J * (l * (2.0 + ((l * l) * (0.3333333333333333 + ((l * l) * 0.016666666666666666)))))) * t_1) + U;
} else {
tmp = (J * (exp(l) - t_0)) + U;
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = exp(-l)
t_1 = cos((k / 2.0d0))
if (l <= (-4.6d0)) then
tmp = u + (t_1 * (j * (27.0d0 - t_0)))
else if ((l <= 4.9d-14) .or. (.not. (l <= 5.4d+45))) then
tmp = ((j * (l * (2.0d0 + ((l * l) * (0.3333333333333333d0 + ((l * l) * 0.016666666666666666d0)))))) * t_1) + u
else
tmp = (j * (exp(l) - t_0)) + u
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = Math.exp(-l);
double t_1 = Math.cos((K / 2.0));
double tmp;
if (l <= -4.6) {
tmp = U + (t_1 * (J * (27.0 - t_0)));
} else if ((l <= 4.9e-14) || !(l <= 5.4e+45)) {
tmp = ((J * (l * (2.0 + ((l * l) * (0.3333333333333333 + ((l * l) * 0.016666666666666666)))))) * t_1) + U;
} else {
tmp = (J * (Math.exp(l) - t_0)) + U;
}
return tmp;
}
def code(J, l, K, U): t_0 = math.exp(-l) t_1 = math.cos((K / 2.0)) tmp = 0 if l <= -4.6: tmp = U + (t_1 * (J * (27.0 - t_0))) elif (l <= 4.9e-14) or not (l <= 5.4e+45): tmp = ((J * (l * (2.0 + ((l * l) * (0.3333333333333333 + ((l * l) * 0.016666666666666666)))))) * t_1) + U else: tmp = (J * (math.exp(l) - t_0)) + U return tmp
function code(J, l, K, U) t_0 = exp(Float64(-l)) t_1 = cos(Float64(K / 2.0)) tmp = 0.0 if (l <= -4.6) tmp = Float64(U + Float64(t_1 * Float64(J * Float64(27.0 - t_0)))); elseif ((l <= 4.9e-14) || !(l <= 5.4e+45)) tmp = Float64(Float64(Float64(J * Float64(l * Float64(2.0 + Float64(Float64(l * l) * Float64(0.3333333333333333 + Float64(Float64(l * l) * 0.016666666666666666)))))) * t_1) + U); else tmp = Float64(Float64(J * Float64(exp(l) - t_0)) + U); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = exp(-l); t_1 = cos((K / 2.0)); tmp = 0.0; if (l <= -4.6) tmp = U + (t_1 * (J * (27.0 - t_0))); elseif ((l <= 4.9e-14) || ~((l <= 5.4e+45))) tmp = ((J * (l * (2.0 + ((l * l) * (0.3333333333333333 + ((l * l) * 0.016666666666666666)))))) * t_1) + U; else tmp = (J * (exp(l) - t_0)) + U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Exp[(-l)], $MachinePrecision]}, Block[{t$95$1 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -4.6], N[(U + N[(t$95$1 * N[(J * N[(27.0 - t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[l, 4.9e-14], N[Not[LessEqual[l, 5.4e+45]], $MachinePrecision]], N[(N[(N[(J * N[(l * N[(2.0 + N[(N[(l * l), $MachinePrecision] * N[(0.3333333333333333 + N[(N[(l * l), $MachinePrecision] * 0.016666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision] + U), $MachinePrecision], N[(N[(J * N[(N[Exp[l], $MachinePrecision] - t$95$0), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-\ell}\\
t_1 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;\ell \leq -4.6:\\
\;\;\;\;U + t\_1 \cdot \left(J \cdot \left(27 - t\_0\right)\right)\\
\mathbf{elif}\;\ell \leq 4.9 \cdot 10^{-14} \lor \neg \left(\ell \leq 5.4 \cdot 10^{+45}\right):\\
\;\;\;\;\left(J \cdot \left(\ell \cdot \left(2 + \left(\ell \cdot \ell\right) \cdot \left(0.3333333333333333 + \left(\ell \cdot \ell\right) \cdot 0.016666666666666666\right)\right)\right)\right) \cdot t\_1 + U\\
\mathbf{else}:\\
\;\;\;\;J \cdot \left(e^{\ell} - t\_0\right) + U\\
\end{array}
\end{array}
if l < -4.5999999999999996Initial program 100.0%
Applied egg-rr98.5%
if -4.5999999999999996 < l < 4.89999999999999995e-14 or 5.39999999999999968e45 < l Initial program 80.7%
Taylor expanded in l around 0 99.0%
*-commutative99.0%
Simplified99.0%
unpow299.0%
Applied egg-rr99.0%
unpow299.0%
Applied egg-rr99.0%
if 4.89999999999999995e-14 < l < 5.39999999999999968e45Initial program 100.0%
Taylor expanded in K around 0 88.2%
Final simplification98.2%
(FPCore (J l K U)
:precision binary64
(if (or (<= l 4.9e-14) (not (<= l 5.6e+46)))
(+
(*
(*
J
(*
l
(+
2.0
(* (* l l) (+ 0.3333333333333333 (* (* l l) 0.016666666666666666))))))
(cos (/ K 2.0)))
U)
(+ (* J (- (exp l) (exp (- l)))) U)))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= 4.9e-14) || !(l <= 5.6e+46)) {
tmp = ((J * (l * (2.0 + ((l * l) * (0.3333333333333333 + ((l * l) * 0.016666666666666666)))))) * cos((K / 2.0))) + U;
} else {
tmp = (J * (exp(l) - exp(-l))) + 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 <= 4.9d-14) .or. (.not. (l <= 5.6d+46))) then
tmp = ((j * (l * (2.0d0 + ((l * l) * (0.3333333333333333d0 + ((l * l) * 0.016666666666666666d0)))))) * cos((k / 2.0d0))) + u
else
tmp = (j * (exp(l) - exp(-l))) + u
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if ((l <= 4.9e-14) || !(l <= 5.6e+46)) {
tmp = ((J * (l * (2.0 + ((l * l) * (0.3333333333333333 + ((l * l) * 0.016666666666666666)))))) * Math.cos((K / 2.0))) + U;
} else {
tmp = (J * (Math.exp(l) - Math.exp(-l))) + U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= 4.9e-14) or not (l <= 5.6e+46): tmp = ((J * (l * (2.0 + ((l * l) * (0.3333333333333333 + ((l * l) * 0.016666666666666666)))))) * math.cos((K / 2.0))) + U else: tmp = (J * (math.exp(l) - math.exp(-l))) + U return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= 4.9e-14) || !(l <= 5.6e+46)) tmp = Float64(Float64(Float64(J * Float64(l * Float64(2.0 + Float64(Float64(l * l) * Float64(0.3333333333333333 + Float64(Float64(l * l) * 0.016666666666666666)))))) * cos(Float64(K / 2.0))) + U); else tmp = Float64(Float64(J * Float64(exp(l) - exp(Float64(-l)))) + U); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= 4.9e-14) || ~((l <= 5.6e+46))) tmp = ((J * (l * (2.0 + ((l * l) * (0.3333333333333333 + ((l * l) * 0.016666666666666666)))))) * cos((K / 2.0))) + U; else tmp = (J * (exp(l) - exp(-l))) + U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, 4.9e-14], N[Not[LessEqual[l, 5.6e+46]], $MachinePrecision]], N[(N[(N[(J * N[(l * N[(2.0 + N[(N[(l * l), $MachinePrecision] * N[(0.3333333333333333 + N[(N[(l * l), $MachinePrecision] * 0.016666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], N[(N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 4.9 \cdot 10^{-14} \lor \neg \left(\ell \leq 5.6 \cdot 10^{+46}\right):\\
\;\;\;\;\left(J \cdot \left(\ell \cdot \left(2 + \left(\ell \cdot \ell\right) \cdot \left(0.3333333333333333 + \left(\ell \cdot \ell\right) \cdot 0.016666666666666666\right)\right)\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U\\
\mathbf{else}:\\
\;\;\;\;J \cdot \left(e^{\ell} - e^{-\ell}\right) + U\\
\end{array}
\end{array}
if l < 4.89999999999999995e-14 or 5.60000000000000037e46 < l Initial program 84.9%
Taylor expanded in l around 0 96.8%
*-commutative96.8%
Simplified96.8%
unpow296.8%
Applied egg-rr96.8%
unpow296.8%
Applied egg-rr96.8%
if 4.89999999999999995e-14 < l < 5.60000000000000037e46Initial program 100.0%
Taylor expanded in K around 0 88.2%
Final simplification96.3%
(FPCore (J l K U)
:precision binary64
(+
(*
(*
J
(*
l
(+
2.0
(* (* l l) (+ 0.3333333333333333 (* (* l l) 0.016666666666666666))))))
(cos (/ K 2.0)))
U))
double code(double J, double l, double K, double U) {
return ((J * (l * (2.0 + ((l * l) * (0.3333333333333333 + ((l * l) * 0.016666666666666666)))))) * 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 * (l * (2.0d0 + ((l * l) * (0.3333333333333333d0 + ((l * l) * 0.016666666666666666d0)))))) * cos((k / 2.0d0))) + u
end function
public static double code(double J, double l, double K, double U) {
return ((J * (l * (2.0 + ((l * l) * (0.3333333333333333 + ((l * l) * 0.016666666666666666)))))) * Math.cos((K / 2.0))) + U;
}
def code(J, l, K, U): return ((J * (l * (2.0 + ((l * l) * (0.3333333333333333 + ((l * l) * 0.016666666666666666)))))) * math.cos((K / 2.0))) + U
function code(J, l, K, U) return Float64(Float64(Float64(J * Float64(l * Float64(2.0 + Float64(Float64(l * l) * Float64(0.3333333333333333 + Float64(Float64(l * l) * 0.016666666666666666)))))) * cos(Float64(K / 2.0))) + U) end
function tmp = code(J, l, K, U) tmp = ((J * (l * (2.0 + ((l * l) * (0.3333333333333333 + ((l * l) * 0.016666666666666666)))))) * cos((K / 2.0))) + U; end
code[J_, l_, K_, U_] := N[(N[(N[(J * N[(l * N[(2.0 + N[(N[(l * l), $MachinePrecision] * N[(0.3333333333333333 + N[(N[(l * l), $MachinePrecision] * 0.016666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]
\begin{array}{l}
\\
\left(J \cdot \left(\ell \cdot \left(2 + \left(\ell \cdot \ell\right) \cdot \left(0.3333333333333333 + \left(\ell \cdot \ell\right) \cdot 0.016666666666666666\right)\right)\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U
\end{array}
Initial program 85.9%
Taylor expanded in l around 0 92.5%
*-commutative92.5%
Simplified92.5%
unpow292.5%
Applied egg-rr92.5%
unpow292.5%
Applied egg-rr92.5%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (+ U (* (* J (* l 2.0)) (+ 5.0 (* -8.0 (* K K)))))))
(if (<= l -6e+170)
t_0
(if (<= l -920.0)
(/ (- 16.0 (* U U)) (+ U -4.0))
(if (<= l 10500.0)
(+ U (* l (* J 2.0)))
(if (<= l 2.05e+195) (pow U -4.0) t_0))))))
double code(double J, double l, double K, double U) {
double t_0 = U + ((J * (l * 2.0)) * (5.0 + (-8.0 * (K * K))));
double tmp;
if (l <= -6e+170) {
tmp = t_0;
} else if (l <= -920.0) {
tmp = (16.0 - (U * U)) / (U + -4.0);
} else if (l <= 10500.0) {
tmp = U + (l * (J * 2.0));
} else if (l <= 2.05e+195) {
tmp = pow(U, -4.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)) * (5.0d0 + ((-8.0d0) * (k * k))))
if (l <= (-6d+170)) then
tmp = t_0
else if (l <= (-920.0d0)) then
tmp = (16.0d0 - (u * u)) / (u + (-4.0d0))
else if (l <= 10500.0d0) then
tmp = u + (l * (j * 2.0d0))
else if (l <= 2.05d+195) then
tmp = u ** (-4.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)) * (5.0 + (-8.0 * (K * K))));
double tmp;
if (l <= -6e+170) {
tmp = t_0;
} else if (l <= -920.0) {
tmp = (16.0 - (U * U)) / (U + -4.0);
} else if (l <= 10500.0) {
tmp = U + (l * (J * 2.0));
} else if (l <= 2.05e+195) {
tmp = Math.pow(U, -4.0);
} else {
tmp = t_0;
}
return tmp;
}
def code(J, l, K, U): t_0 = U + ((J * (l * 2.0)) * (5.0 + (-8.0 * (K * K)))) tmp = 0 if l <= -6e+170: tmp = t_0 elif l <= -920.0: tmp = (16.0 - (U * U)) / (U + -4.0) elif l <= 10500.0: tmp = U + (l * (J * 2.0)) elif l <= 2.05e+195: tmp = math.pow(U, -4.0) else: tmp = t_0 return tmp
function code(J, l, K, U) t_0 = Float64(U + Float64(Float64(J * Float64(l * 2.0)) * Float64(5.0 + Float64(-8.0 * Float64(K * K))))) tmp = 0.0 if (l <= -6e+170) tmp = t_0; elseif (l <= -920.0) tmp = Float64(Float64(16.0 - Float64(U * U)) / Float64(U + -4.0)); elseif (l <= 10500.0) tmp = Float64(U + Float64(l * Float64(J * 2.0))); elseif (l <= 2.05e+195) tmp = U ^ -4.0; else tmp = t_0; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = U + ((J * (l * 2.0)) * (5.0 + (-8.0 * (K * K)))); tmp = 0.0; if (l <= -6e+170) tmp = t_0; elseif (l <= -920.0) tmp = (16.0 - (U * U)) / (U + -4.0); elseif (l <= 10500.0) tmp = U + (l * (J * 2.0)); elseif (l <= 2.05e+195) tmp = U ^ -4.0; else tmp = t_0; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(U + N[(N[(J * N[(l * 2.0), $MachinePrecision]), $MachinePrecision] * N[(5.0 + N[(-8.0 * N[(K * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -6e+170], t$95$0, If[LessEqual[l, -920.0], N[(N[(16.0 - N[(U * U), $MachinePrecision]), $MachinePrecision] / N[(U + -4.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 10500.0], N[(U + N[(l * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.05e+195], N[Power[U, -4.0], $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + \left(J \cdot \left(\ell \cdot 2\right)\right) \cdot \left(5 + -8 \cdot \left(K \cdot K\right)\right)\\
\mathbf{if}\;\ell \leq -6 \cdot 10^{+170}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq -920:\\
\;\;\;\;\frac{16 - U \cdot U}{U + -4}\\
\mathbf{elif}\;\ell \leq 10500:\\
\;\;\;\;U + \ell \cdot \left(J \cdot 2\right)\\
\mathbf{elif}\;\ell \leq 2.05 \cdot 10^{+195}:\\
\;\;\;\;{U}^{-4}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if l < -5.99999999999999994e170 or 2.05e195 < l Initial program 100.0%
Taylor expanded in l around 0 53.1%
*-commutative53.1%
associate-*l*53.1%
Simplified53.1%
Applied egg-rr33.1%
log1p-undefine33.1%
rem-exp-log33.1%
+-commutative33.1%
associate--l+33.1%
*-commutative33.1%
metadata-eval33.1%
Simplified33.1%
Taylor expanded in K around 0 52.2%
unpow252.2%
Applied egg-rr52.2%
if -5.99999999999999994e170 < l < -920Initial program 100.0%
Applied egg-rr3.2%
sub-neg3.2%
flip-+34.2%
metadata-eval34.2%
Applied egg-rr34.2%
if -920 < l < 10500Initial program 75.1%
Taylor expanded in l around 0 98.3%
*-commutative98.3%
associate-*l*98.3%
Simplified98.3%
Taylor expanded in K around 0 84.2%
associate-*r*84.2%
*-commutative84.2%
Simplified84.2%
if 10500 < l < 2.05e195Initial program 100.0%
Applied egg-rr31.7%
Final simplification65.8%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (* K 0.5))))
(if (<= l -2.4e-33)
(* J (+ (* 2.0 (* l t_0)) (/ U J)))
(if (<= l 5.4e+17)
(+ U (* l (* t_0 (* J 2.0))))
(if (<= l 1.95e+195)
(pow U -4.0)
(+ U (* (* J (* l 2.0)) (+ 5.0 (* -8.0 (* K K))))))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K * 0.5));
double tmp;
if (l <= -2.4e-33) {
tmp = J * ((2.0 * (l * t_0)) + (U / J));
} else if (l <= 5.4e+17) {
tmp = U + (l * (t_0 * (J * 2.0)));
} else if (l <= 1.95e+195) {
tmp = pow(U, -4.0);
} else {
tmp = U + ((J * (l * 2.0)) * (5.0 + (-8.0 * (K * K))));
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: t_0
real(8) :: tmp
t_0 = cos((k * 0.5d0))
if (l <= (-2.4d-33)) then
tmp = j * ((2.0d0 * (l * t_0)) + (u / j))
else if (l <= 5.4d+17) then
tmp = u + (l * (t_0 * (j * 2.0d0)))
else if (l <= 1.95d+195) then
tmp = u ** (-4.0d0)
else
tmp = u + ((j * (l * 2.0d0)) * (5.0d0 + ((-8.0d0) * (k * k))))
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 tmp;
if (l <= -2.4e-33) {
tmp = J * ((2.0 * (l * t_0)) + (U / J));
} else if (l <= 5.4e+17) {
tmp = U + (l * (t_0 * (J * 2.0)));
} else if (l <= 1.95e+195) {
tmp = Math.pow(U, -4.0);
} else {
tmp = U + ((J * (l * 2.0)) * (5.0 + (-8.0 * (K * K))));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K * 0.5)) tmp = 0 if l <= -2.4e-33: tmp = J * ((2.0 * (l * t_0)) + (U / J)) elif l <= 5.4e+17: tmp = U + (l * (t_0 * (J * 2.0))) elif l <= 1.95e+195: tmp = math.pow(U, -4.0) else: tmp = U + ((J * (l * 2.0)) * (5.0 + (-8.0 * (K * K)))) return tmp
function code(J, l, K, U) t_0 = cos(Float64(K * 0.5)) tmp = 0.0 if (l <= -2.4e-33) tmp = Float64(J * Float64(Float64(2.0 * Float64(l * t_0)) + Float64(U / J))); elseif (l <= 5.4e+17) tmp = Float64(U + Float64(l * Float64(t_0 * Float64(J * 2.0)))); elseif (l <= 1.95e+195) tmp = U ^ -4.0; else tmp = Float64(U + Float64(Float64(J * Float64(l * 2.0)) * Float64(5.0 + Float64(-8.0 * Float64(K * K))))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = cos((K * 0.5)); tmp = 0.0; if (l <= -2.4e-33) tmp = J * ((2.0 * (l * t_0)) + (U / J)); elseif (l <= 5.4e+17) tmp = U + (l * (t_0 * (J * 2.0))); elseif (l <= 1.95e+195) tmp = U ^ -4.0; else tmp = U + ((J * (l * 2.0)) * (5.0 + (-8.0 * (K * K)))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -2.4e-33], N[(J * N[(N[(2.0 * N[(l * t$95$0), $MachinePrecision]), $MachinePrecision] + N[(U / J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 5.4e+17], N[(U + N[(l * N[(t$95$0 * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.95e+195], N[Power[U, -4.0], $MachinePrecision], N[(U + N[(N[(J * N[(l * 2.0), $MachinePrecision]), $MachinePrecision] * N[(5.0 + N[(-8.0 * N[(K * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(K \cdot 0.5\right)\\
\mathbf{if}\;\ell \leq -2.4 \cdot 10^{-33}:\\
\;\;\;\;J \cdot \left(2 \cdot \left(\ell \cdot t\_0\right) + \frac{U}{J}\right)\\
\mathbf{elif}\;\ell \leq 5.4 \cdot 10^{+17}:\\
\;\;\;\;U + \ell \cdot \left(t\_0 \cdot \left(J \cdot 2\right)\right)\\
\mathbf{elif}\;\ell \leq 1.95 \cdot 10^{+195}:\\
\;\;\;\;{U}^{-4}\\
\mathbf{else}:\\
\;\;\;\;U + \left(J \cdot \left(\ell \cdot 2\right)\right) \cdot \left(5 + -8 \cdot \left(K \cdot K\right)\right)\\
\end{array}
\end{array}
if l < -2.4e-33Initial program 95.9%
Taylor expanded in l around 0 36.7%
*-commutative36.7%
associate-*l*36.7%
Simplified36.7%
Taylor expanded in J around inf 45.0%
if -2.4e-33 < l < 5.4e17Initial program 76.5%
Taylor expanded in l around 0 96.0%
*-commutative96.0%
associate-*r*96.0%
associate-*l*96.0%
*-commutative96.0%
*-commutative96.0%
*-commutative96.0%
associate-*l*96.0%
Simplified96.0%
if 5.4e17 < l < 1.9499999999999999e195Initial program 100.0%
Applied egg-rr36.3%
if 1.9499999999999999e195 < l Initial program 100.0%
Taylor expanded in l around 0 55.8%
*-commutative55.8%
associate-*l*55.8%
Simplified55.8%
Applied egg-rr34.4%
log1p-undefine34.4%
rem-exp-log34.4%
+-commutative34.4%
associate--l+34.4%
*-commutative34.4%
metadata-eval34.4%
Simplified34.4%
Taylor expanded in K around 0 59.5%
unpow259.5%
Applied egg-rr59.5%
Final simplification74.0%
(FPCore (J l K U)
:precision binary64
(if (<= l 3.4e+20)
(+ U (* 2.0 (* J (* l (cos (* K 0.5))))))
(if (<= l 5.5e+195)
(pow U -4.0)
(+ U (* (* J (* l 2.0)) (+ 5.0 (* -8.0 (* K K))))))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= 3.4e+20) {
tmp = U + (2.0 * (J * (l * cos((K * 0.5)))));
} else if (l <= 5.5e+195) {
tmp = pow(U, -4.0);
} else {
tmp = U + ((J * (l * 2.0)) * (5.0 + (-8.0 * (K * K))));
}
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 <= 3.4d+20) then
tmp = u + (2.0d0 * (j * (l * cos((k * 0.5d0)))))
else if (l <= 5.5d+195) then
tmp = u ** (-4.0d0)
else
tmp = u + ((j * (l * 2.0d0)) * (5.0d0 + ((-8.0d0) * (k * k))))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (l <= 3.4e+20) {
tmp = U + (2.0 * (J * (l * Math.cos((K * 0.5)))));
} else if (l <= 5.5e+195) {
tmp = Math.pow(U, -4.0);
} else {
tmp = U + ((J * (l * 2.0)) * (5.0 + (-8.0 * (K * K))));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= 3.4e+20: tmp = U + (2.0 * (J * (l * math.cos((K * 0.5))))) elif l <= 5.5e+195: tmp = math.pow(U, -4.0) else: tmp = U + ((J * (l * 2.0)) * (5.0 + (-8.0 * (K * K)))) return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= 3.4e+20) tmp = Float64(U + Float64(2.0 * Float64(J * Float64(l * cos(Float64(K * 0.5)))))); elseif (l <= 5.5e+195) tmp = U ^ -4.0; else tmp = Float64(U + Float64(Float64(J * Float64(l * 2.0)) * Float64(5.0 + Float64(-8.0 * Float64(K * K))))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= 3.4e+20) tmp = U + (2.0 * (J * (l * cos((K * 0.5))))); elseif (l <= 5.5e+195) tmp = U ^ -4.0; else tmp = U + ((J * (l * 2.0)) * (5.0 + (-8.0 * (K * K)))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, 3.4e+20], N[(U + N[(2.0 * N[(J * N[(l * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 5.5e+195], N[Power[U, -4.0], $MachinePrecision], N[(U + N[(N[(J * N[(l * 2.0), $MachinePrecision]), $MachinePrecision] * N[(5.0 + N[(-8.0 * N[(K * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 3.4 \cdot 10^{+20}:\\
\;\;\;\;U + 2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\mathbf{elif}\;\ell \leq 5.5 \cdot 10^{+195}:\\
\;\;\;\;{U}^{-4}\\
\mathbf{else}:\\
\;\;\;\;U + \left(J \cdot \left(\ell \cdot 2\right)\right) \cdot \left(5 + -8 \cdot \left(K \cdot K\right)\right)\\
\end{array}
\end{array}
if l < 3.4e20Initial program 82.0%
Taylor expanded in l around 0 79.2%
if 3.4e20 < l < 5.49999999999999994e195Initial program 100.0%
Applied egg-rr36.3%
if 5.49999999999999994e195 < l Initial program 100.0%
Taylor expanded in l around 0 55.8%
*-commutative55.8%
associate-*l*55.8%
Simplified55.8%
Applied egg-rr34.4%
log1p-undefine34.4%
rem-exp-log34.4%
+-commutative34.4%
associate--l+34.4%
*-commutative34.4%
metadata-eval34.4%
Simplified34.4%
Taylor expanded in K around 0 59.5%
unpow259.5%
Applied egg-rr59.5%
Final simplification72.1%
(FPCore (J l K U) :precision binary64 (* U (+ (* 2.0 (* J (/ (* l (cos (* K 0.5))) U))) 1.0)))
double code(double J, double l, double K, double U) {
return U * ((2.0 * (J * ((l * cos((K * 0.5))) / U))) + 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 = u * ((2.0d0 * (j * ((l * cos((k * 0.5d0))) / u))) + 1.0d0)
end function
public static double code(double J, double l, double K, double U) {
return U * ((2.0 * (J * ((l * Math.cos((K * 0.5))) / U))) + 1.0);
}
def code(J, l, K, U): return U * ((2.0 * (J * ((l * math.cos((K * 0.5))) / U))) + 1.0)
function code(J, l, K, U) return Float64(U * Float64(Float64(2.0 * Float64(J * Float64(Float64(l * cos(Float64(K * 0.5))) / U))) + 1.0)) end
function tmp = code(J, l, K, U) tmp = U * ((2.0 * (J * ((l * cos((K * 0.5))) / U))) + 1.0); end
code[J_, l_, K_, U_] := N[(U * N[(N[(2.0 * N[(J * N[(N[(l * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U \cdot \left(2 \cdot \left(J \cdot \frac{\ell \cdot \cos \left(K \cdot 0.5\right)}{U}\right) + 1\right)
\end{array}
Initial program 85.9%
Taylor expanded in l around 0 68.6%
*-commutative68.6%
associate-*l*68.6%
Simplified68.6%
Taylor expanded in U around inf 71.5%
associate-/l*74.9%
Simplified74.9%
Final simplification74.9%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (+ U (* (* J (* l 2.0)) (+ 5.0 (* -8.0 (* K K)))))))
(if (<= l -3.6e+170)
t_0
(if (<= l -1350000.0)
(/ (- 16.0 (* U U)) (+ U -4.0))
(if (<= l 245.0) (+ U (* l (* J 2.0))) t_0)))))
double code(double J, double l, double K, double U) {
double t_0 = U + ((J * (l * 2.0)) * (5.0 + (-8.0 * (K * K))));
double tmp;
if (l <= -3.6e+170) {
tmp = t_0;
} else if (l <= -1350000.0) {
tmp = (16.0 - (U * U)) / (U + -4.0);
} else if (l <= 245.0) {
tmp = U + (l * (J * 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)) * (5.0d0 + ((-8.0d0) * (k * k))))
if (l <= (-3.6d+170)) then
tmp = t_0
else if (l <= (-1350000.0d0)) then
tmp = (16.0d0 - (u * u)) / (u + (-4.0d0))
else if (l <= 245.0d0) then
tmp = u + (l * (j * 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)) * (5.0 + (-8.0 * (K * K))));
double tmp;
if (l <= -3.6e+170) {
tmp = t_0;
} else if (l <= -1350000.0) {
tmp = (16.0 - (U * U)) / (U + -4.0);
} else if (l <= 245.0) {
tmp = U + (l * (J * 2.0));
} else {
tmp = t_0;
}
return tmp;
}
def code(J, l, K, U): t_0 = U + ((J * (l * 2.0)) * (5.0 + (-8.0 * (K * K)))) tmp = 0 if l <= -3.6e+170: tmp = t_0 elif l <= -1350000.0: tmp = (16.0 - (U * U)) / (U + -4.0) elif l <= 245.0: tmp = U + (l * (J * 2.0)) else: tmp = t_0 return tmp
function code(J, l, K, U) t_0 = Float64(U + Float64(Float64(J * Float64(l * 2.0)) * Float64(5.0 + Float64(-8.0 * Float64(K * K))))) tmp = 0.0 if (l <= -3.6e+170) tmp = t_0; elseif (l <= -1350000.0) tmp = Float64(Float64(16.0 - Float64(U * U)) / Float64(U + -4.0)); elseif (l <= 245.0) tmp = Float64(U + Float64(l * Float64(J * 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)) * (5.0 + (-8.0 * (K * K)))); tmp = 0.0; if (l <= -3.6e+170) tmp = t_0; elseif (l <= -1350000.0) tmp = (16.0 - (U * U)) / (U + -4.0); elseif (l <= 245.0) tmp = U + (l * (J * 2.0)); else tmp = t_0; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(U + N[(N[(J * N[(l * 2.0), $MachinePrecision]), $MachinePrecision] * N[(5.0 + N[(-8.0 * N[(K * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -3.6e+170], t$95$0, If[LessEqual[l, -1350000.0], N[(N[(16.0 - N[(U * U), $MachinePrecision]), $MachinePrecision] / N[(U + -4.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 245.0], N[(U + N[(l * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + \left(J \cdot \left(\ell \cdot 2\right)\right) \cdot \left(5 + -8 \cdot \left(K \cdot K\right)\right)\\
\mathbf{if}\;\ell \leq -3.6 \cdot 10^{+170}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq -1350000:\\
\;\;\;\;\frac{16 - U \cdot U}{U + -4}\\
\mathbf{elif}\;\ell \leq 245:\\
\;\;\;\;U + \ell \cdot \left(J \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if l < -3.6e170 or 245 < l Initial program 100.0%
Taylor expanded in l around 0 34.7%
*-commutative34.7%
associate-*l*34.7%
Simplified34.7%
Applied egg-rr23.0%
log1p-undefine23.0%
rem-exp-log23.0%
+-commutative23.0%
associate--l+23.0%
*-commutative23.0%
metadata-eval23.0%
Simplified23.0%
Taylor expanded in K around 0 36.2%
unpow236.2%
Applied egg-rr36.2%
if -3.6e170 < l < -1.35e6Initial program 100.0%
Applied egg-rr3.2%
sub-neg3.2%
flip-+34.2%
metadata-eval34.2%
Applied egg-rr34.2%
if -1.35e6 < l < 245Initial program 74.9%
Taylor expanded in l around 0 98.9%
*-commutative98.9%
associate-*l*98.9%
Simplified98.9%
Taylor expanded in K around 0 84.7%
associate-*r*84.7%
*-commutative84.7%
Simplified84.7%
Final simplification63.3%
(FPCore (J l K U) :precision binary64 (if (or (<= l -980.0) (not (<= l 265000000.0))) (* U U) U))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -980.0) || !(l <= 265000000.0)) {
tmp = U * U;
} else {
tmp = U;
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if ((l <= (-980.0d0)) .or. (.not. (l <= 265000000.0d0))) then
tmp = u * u
else
tmp = u
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -980.0) || !(l <= 265000000.0)) {
tmp = U * U;
} else {
tmp = U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -980.0) or not (l <= 265000000.0): tmp = U * U else: tmp = U return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -980.0) || !(l <= 265000000.0)) tmp = Float64(U * U); else tmp = U; end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -980.0) || ~((l <= 265000000.0))) tmp = U * U; else tmp = U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -980.0], N[Not[LessEqual[l, 265000000.0]], $MachinePrecision]], N[(U * U), $MachinePrecision], U]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -980 \lor \neg \left(\ell \leq 265000000\right):\\
\;\;\;\;U \cdot U\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\end{array}
if l < -980 or 2.65e8 < l Initial program 100.0%
Applied egg-rr15.1%
if -980 < l < 2.65e8Initial program 75.2%
Taylor expanded in J around 0 72.2%
Final simplification47.7%
(FPCore (J l K U) :precision binary64 (if (<= l -4.2e-24) (* J (- -4.0 (/ U J))) (if (<= l 66000000.0) U (* U U))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -4.2e-24) {
tmp = J * (-4.0 - (U / J));
} else if (l <= 66000000.0) {
tmp = U;
} else {
tmp = U * U;
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if (l <= (-4.2d-24)) then
tmp = j * ((-4.0d0) - (u / j))
else if (l <= 66000000.0d0) then
tmp = u
else
tmp = u * u
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (l <= -4.2e-24) {
tmp = J * (-4.0 - (U / J));
} else if (l <= 66000000.0) {
tmp = U;
} else {
tmp = U * U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -4.2e-24: tmp = J * (-4.0 - (U / J)) elif l <= 66000000.0: tmp = U else: tmp = U * U return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -4.2e-24) tmp = Float64(J * Float64(-4.0 - Float64(U / J))); elseif (l <= 66000000.0) tmp = U; else tmp = Float64(U * U); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -4.2e-24) tmp = J * (-4.0 - (U / J)); elseif (l <= 66000000.0) tmp = U; else tmp = U * U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -4.2e-24], N[(J * N[(-4.0 - N[(U / J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 66000000.0], U, N[(U * U), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -4.2 \cdot 10^{-24}:\\
\;\;\;\;J \cdot \left(-4 - \frac{U}{J}\right)\\
\mathbf{elif}\;\ell \leq 66000000:\\
\;\;\;\;U\\
\mathbf{else}:\\
\;\;\;\;U \cdot U\\
\end{array}
\end{array}
if l < -4.1999999999999999e-24Initial program 97.5%
Applied egg-rr4.0%
fmm-undef4.0%
Simplified4.0%
Taylor expanded in J around inf 12.4%
sub-neg12.4%
metadata-eval12.4%
+-commutative12.4%
mul-1-neg12.4%
unsub-neg12.4%
Simplified12.4%
if -4.1999999999999999e-24 < l < 6.6e7Initial program 75.5%
Taylor expanded in J around 0 74.2%
if 6.6e7 < l Initial program 100.0%
Applied egg-rr16.9%
(FPCore (J l K U) :precision binary64 (+ U (* l (* J 2.0))))
double code(double J, double l, double K, double U) {
return U + (l * (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 * (j * 2.0d0))
end function
public static double code(double J, double l, double K, double U) {
return U + (l * (J * 2.0));
}
def code(J, l, K, U): return U + (l * (J * 2.0))
function code(J, l, K, U) return Float64(U + Float64(l * Float64(J * 2.0))) end
function tmp = code(J, l, K, U) tmp = U + (l * (J * 2.0)); end
code[J_, l_, K_, U_] := N[(U + N[(l * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + \ell \cdot \left(J \cdot 2\right)
\end{array}
Initial program 85.9%
Taylor expanded in l around 0 68.6%
*-commutative68.6%
associate-*l*68.6%
Simplified68.6%
Taylor expanded in K around 0 56.5%
associate-*r*56.5%
*-commutative56.5%
Simplified56.5%
Final simplification56.5%
(FPCore (J l K U) :precision binary64 (+ U (* 10.0 (* J l))))
double code(double J, double l, double K, double U) {
return U + (10.0 * (J * l));
}
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 + (10.0d0 * (j * l))
end function
public static double code(double J, double l, double K, double U) {
return U + (10.0 * (J * l));
}
def code(J, l, K, U): return U + (10.0 * (J * l))
function code(J, l, K, U) return Float64(U + Float64(10.0 * Float64(J * l))) end
function tmp = code(J, l, K, U) tmp = U + (10.0 * (J * l)); end
code[J_, l_, K_, U_] := N[(U + N[(10.0 * N[(J * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + 10 \cdot \left(J \cdot \ell\right)
\end{array}
Initial program 85.9%
Taylor expanded in l around 0 68.6%
*-commutative68.6%
associate-*l*68.6%
Simplified68.6%
Applied egg-rr51.1%
log1p-undefine51.1%
rem-exp-log51.1%
+-commutative51.1%
associate--l+51.1%
*-commutative51.1%
metadata-eval51.1%
Simplified51.1%
Taylor expanded in K around 0 51.1%
*-commutative51.1%
Simplified51.1%
Final simplification51.1%
(FPCore (J l K U) :precision binary64 U)
double code(double J, double l, double K, double U) {
return U;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = u
end function
public static double code(double J, double l, double K, double U) {
return U;
}
def code(J, l, K, U): return U
function code(J, l, K, U) return U end
function tmp = code(J, l, K, U) tmp = U; end
code[J_, l_, K_, U_] := U
\begin{array}{l}
\\
U
\end{array}
Initial program 85.9%
Taylor expanded in J around 0 42.0%
(FPCore (J l K U) :precision binary64 -4.0)
double code(double J, double l, double K, double U) {
return -4.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 = -4.0d0
end function
public static double code(double J, double l, double K, double U) {
return -4.0;
}
def code(J, l, K, U): return -4.0
function code(J, l, K, U) return -4.0 end
function tmp = code(J, l, K, U) tmp = -4.0; end
code[J_, l_, K_, U_] := -4.0
\begin{array}{l}
\\
-4
\end{array}
Initial program 85.9%
Applied egg-rr2.6%
Taylor expanded in U around 0 3.0%
herbie shell --seed 2024186
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))