
(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 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (J l K U) :precision binary64 (+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))
double code(double J, double l, double K, double U) {
return ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = ((j * (exp(l) - exp(-l))) * cos((k / 2.0d0))) + u
end function
public static double code(double J, double l, double K, double U) {
return ((J * (Math.exp(l) - Math.exp(-l))) * Math.cos((K / 2.0))) + U;
}
def code(J, l, K, U): return ((J * (math.exp(l) - math.exp(-l))) * math.cos((K / 2.0))) + U
function code(J, l, K, U) return Float64(Float64(Float64(J * Float64(exp(l) - exp(Float64(-l)))) * cos(Float64(K / 2.0))) + U) end
function tmp = code(J, l, K, U) tmp = ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U; end
code[J_, l_, K_, U_] := N[(N[(N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]
\begin{array}{l}
\\
\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U
\end{array}
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))) (t_1 (exp (- l))) (t_2 (- (exp l) t_1)))
(if (<= t_2 (- INFINITY))
(+ (* (* J (- 27.0 t_1)) t_0) U)
(if (<= t_2 0.0001)
(+
U
(* t_0 (* l (+ (* 0.3333333333333333 (* J (pow l 2.0))) (* J 2.0)))))
(+ U (* t_0 (* t_2 J)))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double t_1 = exp(-l);
double t_2 = exp(l) - t_1;
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = ((J * (27.0 - t_1)) * t_0) + U;
} else if (t_2 <= 0.0001) {
tmp = U + (t_0 * (l * ((0.3333333333333333 * (J * pow(l, 2.0))) + (J * 2.0))));
} else {
tmp = U + (t_0 * (t_2 * J));
}
return tmp;
}
public static double code(double J, double l, double K, double U) {
double t_0 = Math.cos((K / 2.0));
double t_1 = Math.exp(-l);
double t_2 = Math.exp(l) - t_1;
double tmp;
if (t_2 <= -Double.POSITIVE_INFINITY) {
tmp = ((J * (27.0 - t_1)) * t_0) + U;
} else if (t_2 <= 0.0001) {
tmp = U + (t_0 * (l * ((0.3333333333333333 * (J * Math.pow(l, 2.0))) + (J * 2.0))));
} else {
tmp = U + (t_0 * (t_2 * J));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K / 2.0)) t_1 = math.exp(-l) t_2 = math.exp(l) - t_1 tmp = 0 if t_2 <= -math.inf: tmp = ((J * (27.0 - t_1)) * t_0) + U elif t_2 <= 0.0001: tmp = U + (t_0 * (l * ((0.3333333333333333 * (J * math.pow(l, 2.0))) + (J * 2.0)))) else: tmp = U + (t_0 * (t_2 * J)) return tmp
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) t_1 = exp(Float64(-l)) t_2 = Float64(exp(l) - t_1) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = Float64(Float64(Float64(J * Float64(27.0 - t_1)) * t_0) + U); elseif (t_2 <= 0.0001) tmp = Float64(U + Float64(t_0 * Float64(l * Float64(Float64(0.3333333333333333 * Float64(J * (l ^ 2.0))) + Float64(J * 2.0))))); else tmp = Float64(U + Float64(t_0 * Float64(t_2 * J))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = cos((K / 2.0)); t_1 = exp(-l); t_2 = exp(l) - t_1; tmp = 0.0; if (t_2 <= -Inf) tmp = ((J * (27.0 - t_1)) * t_0) + U; elseif (t_2 <= 0.0001) tmp = U + (t_0 * (l * ((0.3333333333333333 * (J * (l ^ 2.0))) + (J * 2.0)))); else tmp = U + (t_0 * (t_2 * J)); 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[Exp[(-l)], $MachinePrecision]}, Block[{t$95$2 = N[(N[Exp[l], $MachinePrecision] - t$95$1), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], N[(N[(N[(J * N[(27.0 - t$95$1), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] + U), $MachinePrecision], If[LessEqual[t$95$2, 0.0001], N[(U + N[(t$95$0 * N[(l * N[(N[(0.3333333333333333 * N[(J * N[Power[l, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(t$95$0 * N[(t$95$2 * J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
t_1 := e^{-\ell}\\
t_2 := e^{\ell} - t\_1\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;\left(J \cdot \left(27 - t\_1\right)\right) \cdot t\_0 + U\\
\mathbf{elif}\;t\_2 \leq 0.0001:\\
\;\;\;\;U + t\_0 \cdot \left(\ell \cdot \left(0.3333333333333333 \cdot \left(J \cdot {\ell}^{2}\right) + J \cdot 2\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + t\_0 \cdot \left(t\_2 \cdot J\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -inf.0Initial program 100.0%
Applied egg-rr100.0%
if -inf.0 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 1.00000000000000005e-4Initial program 71.9%
Taylor expanded in l around 0 99.9%
if 1.00000000000000005e-4 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 100.0%
Final simplification100.0%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))) (t_1 (exp (- l))))
(if (<= l -5.5)
(+ (* (* J (- 27.0 t_1)) t_0) U)
(if (or (<= l 1.3) (not (<= l 3.6e+39)))
(+
U
(*
t_0
(*
J
(*
l
(+
2.0
(*
(* l l)
(+
0.3333333333333333
(*
(* l l)
(+
0.016666666666666666
(* (* l l) 0.0003968253968253968))))))))))
(+ U (* (- (exp l) t_1) J))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double t_1 = exp(-l);
double tmp;
if (l <= -5.5) {
tmp = ((J * (27.0 - t_1)) * t_0) + U;
} else if ((l <= 1.3) || !(l <= 3.6e+39)) {
tmp = U + (t_0 * (J * (l * (2.0 + ((l * l) * (0.3333333333333333 + ((l * l) * (0.016666666666666666 + ((l * l) * 0.0003968253968253968)))))))));
} else {
tmp = U + ((exp(l) - t_1) * J);
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = cos((k / 2.0d0))
t_1 = exp(-l)
if (l <= (-5.5d0)) then
tmp = ((j * (27.0d0 - t_1)) * t_0) + u
else if ((l <= 1.3d0) .or. (.not. (l <= 3.6d+39))) then
tmp = u + (t_0 * (j * (l * (2.0d0 + ((l * l) * (0.3333333333333333d0 + ((l * l) * (0.016666666666666666d0 + ((l * l) * 0.0003968253968253968d0)))))))))
else
tmp = u + ((exp(l) - t_1) * j)
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = Math.cos((K / 2.0));
double t_1 = Math.exp(-l);
double tmp;
if (l <= -5.5) {
tmp = ((J * (27.0 - t_1)) * t_0) + U;
} else if ((l <= 1.3) || !(l <= 3.6e+39)) {
tmp = U + (t_0 * (J * (l * (2.0 + ((l * l) * (0.3333333333333333 + ((l * l) * (0.016666666666666666 + ((l * l) * 0.0003968253968253968)))))))));
} else {
tmp = U + ((Math.exp(l) - t_1) * J);
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K / 2.0)) t_1 = math.exp(-l) tmp = 0 if l <= -5.5: tmp = ((J * (27.0 - t_1)) * t_0) + U elif (l <= 1.3) or not (l <= 3.6e+39): tmp = U + (t_0 * (J * (l * (2.0 + ((l * l) * (0.3333333333333333 + ((l * l) * (0.016666666666666666 + ((l * l) * 0.0003968253968253968))))))))) else: tmp = U + ((math.exp(l) - t_1) * J) return tmp
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) t_1 = exp(Float64(-l)) tmp = 0.0 if (l <= -5.5) tmp = Float64(Float64(Float64(J * Float64(27.0 - t_1)) * t_0) + U); elseif ((l <= 1.3) || !(l <= 3.6e+39)) tmp = Float64(U + Float64(t_0 * Float64(J * Float64(l * Float64(2.0 + Float64(Float64(l * l) * Float64(0.3333333333333333 + Float64(Float64(l * l) * Float64(0.016666666666666666 + Float64(Float64(l * l) * 0.0003968253968253968)))))))))); else tmp = Float64(U + Float64(Float64(exp(l) - t_1) * J)); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = cos((K / 2.0)); t_1 = exp(-l); tmp = 0.0; if (l <= -5.5) tmp = ((J * (27.0 - t_1)) * t_0) + U; elseif ((l <= 1.3) || ~((l <= 3.6e+39))) tmp = U + (t_0 * (J * (l * (2.0 + ((l * l) * (0.3333333333333333 + ((l * l) * (0.016666666666666666 + ((l * l) * 0.0003968253968253968))))))))); else tmp = U + ((exp(l) - t_1) * J); 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[Exp[(-l)], $MachinePrecision]}, If[LessEqual[l, -5.5], N[(N[(N[(J * N[(27.0 - t$95$1), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] + U), $MachinePrecision], If[Or[LessEqual[l, 1.3], N[Not[LessEqual[l, 3.6e+39]], $MachinePrecision]], N[(U + N[(t$95$0 * N[(J * N[(l * N[(2.0 + N[(N[(l * l), $MachinePrecision] * N[(0.3333333333333333 + N[(N[(l * l), $MachinePrecision] * N[(0.016666666666666666 + N[(N[(l * l), $MachinePrecision] * 0.0003968253968253968), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(N[(N[Exp[l], $MachinePrecision] - t$95$1), $MachinePrecision] * J), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
t_1 := e^{-\ell}\\
\mathbf{if}\;\ell \leq -5.5:\\
\;\;\;\;\left(J \cdot \left(27 - t\_1\right)\right) \cdot t\_0 + U\\
\mathbf{elif}\;\ell \leq 1.3 \lor \neg \left(\ell \leq 3.6 \cdot 10^{+39}\right):\\
\;\;\;\;U + t\_0 \cdot \left(J \cdot \left(\ell \cdot \left(2 + \left(\ell \cdot \ell\right) \cdot \left(0.3333333333333333 + \left(\ell \cdot \ell\right) \cdot \left(0.016666666666666666 + \left(\ell \cdot \ell\right) \cdot 0.0003968253968253968\right)\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + \left(e^{\ell} - t\_1\right) \cdot J\\
\end{array}
\end{array}
if l < -5.5Initial program 100.0%
Applied egg-rr100.0%
if -5.5 < l < 1.30000000000000004 or 3.59999999999999984e39 < l Initial program 80.9%
Taylor expanded in l around 0 99.9%
*-commutative99.9%
Simplified99.9%
unpow299.9%
Applied egg-rr99.9%
unpow299.9%
Applied egg-rr99.9%
unpow299.9%
Applied egg-rr99.9%
if 1.30000000000000004 < l < 3.59999999999999984e39Initial program 100.0%
Taylor expanded in K around 0 83.3%
Final simplification98.8%
(FPCore (J l K U)
:precision binary64
(if (or (<= l 0.43) (not (<= l 3.6e+39)))
(+
U
(*
(cos (/ K 2.0))
(*
J
(*
l
(+
2.0
(*
(* l l)
(+
0.3333333333333333
(*
(* l l)
(+ 0.016666666666666666 (* (* l l) 0.0003968253968253968))))))))))
(+ U (* (- (exp l) (exp (- l))) J))))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= 0.43) || !(l <= 3.6e+39)) {
tmp = U + (cos((K / 2.0)) * (J * (l * (2.0 + ((l * l) * (0.3333333333333333 + ((l * l) * (0.016666666666666666 + ((l * l) * 0.0003968253968253968)))))))));
} else {
tmp = U + ((exp(l) - exp(-l)) * J);
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if ((l <= 0.43d0) .or. (.not. (l <= 3.6d+39))) then
tmp = u + (cos((k / 2.0d0)) * (j * (l * (2.0d0 + ((l * l) * (0.3333333333333333d0 + ((l * l) * (0.016666666666666666d0 + ((l * l) * 0.0003968253968253968d0)))))))))
else
tmp = u + ((exp(l) - exp(-l)) * j)
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if ((l <= 0.43) || !(l <= 3.6e+39)) {
tmp = U + (Math.cos((K / 2.0)) * (J * (l * (2.0 + ((l * l) * (0.3333333333333333 + ((l * l) * (0.016666666666666666 + ((l * l) * 0.0003968253968253968)))))))));
} else {
tmp = U + ((Math.exp(l) - Math.exp(-l)) * J);
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= 0.43) or not (l <= 3.6e+39): tmp = U + (math.cos((K / 2.0)) * (J * (l * (2.0 + ((l * l) * (0.3333333333333333 + ((l * l) * (0.016666666666666666 + ((l * l) * 0.0003968253968253968))))))))) else: tmp = U + ((math.exp(l) - math.exp(-l)) * J) return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= 0.43) || !(l <= 3.6e+39)) tmp = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(J * Float64(l * Float64(2.0 + Float64(Float64(l * l) * Float64(0.3333333333333333 + Float64(Float64(l * l) * Float64(0.016666666666666666 + Float64(Float64(l * l) * 0.0003968253968253968)))))))))); else tmp = Float64(U + Float64(Float64(exp(l) - exp(Float64(-l))) * J)); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= 0.43) || ~((l <= 3.6e+39))) tmp = U + (cos((K / 2.0)) * (J * (l * (2.0 + ((l * l) * (0.3333333333333333 + ((l * l) * (0.016666666666666666 + ((l * l) * 0.0003968253968253968))))))))); else tmp = U + ((exp(l) - exp(-l)) * J); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, 0.43], N[Not[LessEqual[l, 3.6e+39]], $MachinePrecision]], N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(J * N[(l * N[(2.0 + N[(N[(l * l), $MachinePrecision] * N[(0.3333333333333333 + N[(N[(l * l), $MachinePrecision] * N[(0.016666666666666666 + N[(N[(l * l), $MachinePrecision] * 0.0003968253968253968), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 0.43 \lor \neg \left(\ell \leq 3.6 \cdot 10^{+39}\right):\\
\;\;\;\;U + \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(\ell \cdot \left(2 + \left(\ell \cdot \ell\right) \cdot \left(0.3333333333333333 + \left(\ell \cdot \ell\right) \cdot \left(0.016666666666666666 + \left(\ell \cdot \ell\right) \cdot 0.0003968253968253968\right)\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + \left(e^{\ell} - e^{-\ell}\right) \cdot J\\
\end{array}
\end{array}
if l < 0.429999999999999993 or 3.59999999999999984e39 < l Initial program 86.2%
Taylor expanded in l around 0 95.5%
*-commutative95.5%
Simplified95.5%
unpow295.5%
Applied egg-rr95.5%
unpow295.5%
Applied egg-rr95.5%
unpow295.5%
Applied egg-rr95.5%
if 0.429999999999999993 < l < 3.59999999999999984e39Initial program 100.0%
Taylor expanded in K around 0 83.3%
Final simplification94.7%
(FPCore (J l K U)
:precision binary64
(let* ((t_0
(+
U
(*
J
(*
l
(+
2.0
(*
(pow l 2.0)
(+
0.3333333333333333
(*
(* l l)
(+
0.016666666666666666
(* (* l l) 0.0003968253968253968)))))))))))
(if (<= l -1.15e-5)
t_0
(if (<= l 820.0)
(+ U (* (cos (/ K 2.0)) (* J (* l 2.0))))
(if (<= l 14500000000000.0) (pow U -4.0) t_0)))))
double code(double J, double l, double K, double U) {
double t_0 = U + (J * (l * (2.0 + (pow(l, 2.0) * (0.3333333333333333 + ((l * l) * (0.016666666666666666 + ((l * l) * 0.0003968253968253968))))))));
double tmp;
if (l <= -1.15e-5) {
tmp = t_0;
} else if (l <= 820.0) {
tmp = U + (cos((K / 2.0)) * (J * (l * 2.0)));
} else if (l <= 14500000000000.0) {
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 + ((l ** 2.0d0) * (0.3333333333333333d0 + ((l * l) * (0.016666666666666666d0 + ((l * l) * 0.0003968253968253968d0))))))))
if (l <= (-1.15d-5)) then
tmp = t_0
else if (l <= 820.0d0) then
tmp = u + (cos((k / 2.0d0)) * (j * (l * 2.0d0)))
else if (l <= 14500000000000.0d0) 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 + (Math.pow(l, 2.0) * (0.3333333333333333 + ((l * l) * (0.016666666666666666 + ((l * l) * 0.0003968253968253968))))))));
double tmp;
if (l <= -1.15e-5) {
tmp = t_0;
} else if (l <= 820.0) {
tmp = U + (Math.cos((K / 2.0)) * (J * (l * 2.0)));
} else if (l <= 14500000000000.0) {
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 + (math.pow(l, 2.0) * (0.3333333333333333 + ((l * l) * (0.016666666666666666 + ((l * l) * 0.0003968253968253968)))))))) tmp = 0 if l <= -1.15e-5: tmp = t_0 elif l <= 820.0: tmp = U + (math.cos((K / 2.0)) * (J * (l * 2.0))) elif l <= 14500000000000.0: tmp = math.pow(U, -4.0) else: tmp = t_0 return tmp
function code(J, l, K, U) t_0 = Float64(U + Float64(J * Float64(l * Float64(2.0 + Float64((l ^ 2.0) * Float64(0.3333333333333333 + Float64(Float64(l * l) * Float64(0.016666666666666666 + Float64(Float64(l * l) * 0.0003968253968253968))))))))) tmp = 0.0 if (l <= -1.15e-5) tmp = t_0; elseif (l <= 820.0) tmp = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(J * Float64(l * 2.0)))); elseif (l <= 14500000000000.0) 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 + ((l ^ 2.0) * (0.3333333333333333 + ((l * l) * (0.016666666666666666 + ((l * l) * 0.0003968253968253968)))))))); tmp = 0.0; if (l <= -1.15e-5) tmp = t_0; elseif (l <= 820.0) tmp = U + (cos((K / 2.0)) * (J * (l * 2.0))); elseif (l <= 14500000000000.0) 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[(J * N[(l * N[(2.0 + N[(N[Power[l, 2.0], $MachinePrecision] * N[(0.3333333333333333 + N[(N[(l * l), $MachinePrecision] * N[(0.016666666666666666 + N[(N[(l * l), $MachinePrecision] * 0.0003968253968253968), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -1.15e-5], t$95$0, If[LessEqual[l, 820.0], N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(J * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 14500000000000.0], N[Power[U, -4.0], $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + J \cdot \left(\ell \cdot \left(2 + {\ell}^{2} \cdot \left(0.3333333333333333 + \left(\ell \cdot \ell\right) \cdot \left(0.016666666666666666 + \left(\ell \cdot \ell\right) \cdot 0.0003968253968253968\right)\right)\right)\right)\\
\mathbf{if}\;\ell \leq -1.15 \cdot 10^{-5}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq 820:\\
\;\;\;\;U + \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(\ell \cdot 2\right)\right)\\
\mathbf{elif}\;\ell \leq 14500000000000:\\
\;\;\;\;{U}^{-4}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if l < -1.15e-5 or 1.45e13 < l Initial program 99.9%
Taylor expanded in l around 0 85.7%
*-commutative85.7%
Simplified85.7%
unpow285.7%
Applied egg-rr85.7%
unpow285.7%
Applied egg-rr85.7%
Taylor expanded in K around 0 67.5%
if -1.15e-5 < l < 820Initial program 72.1%
Taylor expanded in l around 0 99.1%
if 820 < l < 1.45e13Initial program 100.0%
Applied egg-rr83.6%
Final simplification82.3%
(FPCore (J l K U)
:precision binary64
(+
U
(*
(cos (/ K 2.0))
(*
J
(*
l
(+
2.0
(*
(* l l)
(+
0.3333333333333333
(*
(* l l)
(+ 0.016666666666666666 (* (* l l) 0.0003968253968253968)))))))))))
double code(double J, double l, double K, double U) {
return U + (cos((K / 2.0)) * (J * (l * (2.0 + ((l * l) * (0.3333333333333333 + ((l * l) * (0.016666666666666666 + ((l * l) * 0.0003968253968253968)))))))));
}
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 + (cos((k / 2.0d0)) * (j * (l * (2.0d0 + ((l * l) * (0.3333333333333333d0 + ((l * l) * (0.016666666666666666d0 + ((l * l) * 0.0003968253968253968d0)))))))))
end function
public static double code(double J, double l, double K, double U) {
return U + (Math.cos((K / 2.0)) * (J * (l * (2.0 + ((l * l) * (0.3333333333333333 + ((l * l) * (0.016666666666666666 + ((l * l) * 0.0003968253968253968)))))))));
}
def code(J, l, K, U): return U + (math.cos((K / 2.0)) * (J * (l * (2.0 + ((l * l) * (0.3333333333333333 + ((l * l) * (0.016666666666666666 + ((l * l) * 0.0003968253968253968)))))))))
function code(J, l, K, U) return Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(J * Float64(l * Float64(2.0 + Float64(Float64(l * l) * Float64(0.3333333333333333 + Float64(Float64(l * l) * Float64(0.016666666666666666 + Float64(Float64(l * l) * 0.0003968253968253968)))))))))) end
function tmp = code(J, l, K, U) tmp = U + (cos((K / 2.0)) * (J * (l * (2.0 + ((l * l) * (0.3333333333333333 + ((l * l) * (0.016666666666666666 + ((l * l) * 0.0003968253968253968))))))))); end
code[J_, l_, K_, U_] := N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(J * N[(l * N[(2.0 + N[(N[(l * l), $MachinePrecision] * N[(0.3333333333333333 + N[(N[(l * l), $MachinePrecision] * N[(0.016666666666666666 + N[(N[(l * l), $MachinePrecision] * 0.0003968253968253968), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(\ell \cdot \left(2 + \left(\ell \cdot \ell\right) \cdot \left(0.3333333333333333 + \left(\ell \cdot \ell\right) \cdot \left(0.016666666666666666 + \left(\ell \cdot \ell\right) \cdot 0.0003968253968253968\right)\right)\right)\right)\right)
\end{array}
Initial program 87.2%
Taylor expanded in l around 0 90.2%
*-commutative90.2%
Simplified90.2%
unpow290.2%
Applied egg-rr90.2%
unpow290.2%
Applied egg-rr90.2%
unpow290.2%
Applied egg-rr90.2%
Final simplification90.2%
(FPCore (J l K U)
:precision binary64
(if (<= l -4500.0)
(pow U -4.0)
(if (<= l 900.0)
U
(if (<= l 5.6e+94)
(pow U -4.0)
(+ U (* -0.008333333333333333 (pow U 5.0)))))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -4500.0) {
tmp = pow(U, -4.0);
} else if (l <= 900.0) {
tmp = U;
} else if (l <= 5.6e+94) {
tmp = pow(U, -4.0);
} else {
tmp = U + (-0.008333333333333333 * pow(U, 5.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 <= (-4500.0d0)) then
tmp = u ** (-4.0d0)
else if (l <= 900.0d0) then
tmp = u
else if (l <= 5.6d+94) then
tmp = u ** (-4.0d0)
else
tmp = u + ((-0.008333333333333333d0) * (u ** 5.0d0))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (l <= -4500.0) {
tmp = Math.pow(U, -4.0);
} else if (l <= 900.0) {
tmp = U;
} else if (l <= 5.6e+94) {
tmp = Math.pow(U, -4.0);
} else {
tmp = U + (-0.008333333333333333 * Math.pow(U, 5.0));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -4500.0: tmp = math.pow(U, -4.0) elif l <= 900.0: tmp = U elif l <= 5.6e+94: tmp = math.pow(U, -4.0) else: tmp = U + (-0.008333333333333333 * math.pow(U, 5.0)) return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -4500.0) tmp = U ^ -4.0; elseif (l <= 900.0) tmp = U; elseif (l <= 5.6e+94) tmp = U ^ -4.0; else tmp = Float64(U + Float64(-0.008333333333333333 * (U ^ 5.0))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -4500.0) tmp = U ^ -4.0; elseif (l <= 900.0) tmp = U; elseif (l <= 5.6e+94) tmp = U ^ -4.0; else tmp = U + (-0.008333333333333333 * (U ^ 5.0)); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -4500.0], N[Power[U, -4.0], $MachinePrecision], If[LessEqual[l, 900.0], U, If[LessEqual[l, 5.6e+94], N[Power[U, -4.0], $MachinePrecision], N[(U + N[(-0.008333333333333333 * N[Power[U, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -4500:\\
\;\;\;\;{U}^{-4}\\
\mathbf{elif}\;\ell \leq 900:\\
\;\;\;\;U\\
\mathbf{elif}\;\ell \leq 5.6 \cdot 10^{+94}:\\
\;\;\;\;{U}^{-4}\\
\mathbf{else}:\\
\;\;\;\;U + -0.008333333333333333 \cdot {U}^{5}\\
\end{array}
\end{array}
if l < -4500 or 900 < l < 5.59999999999999997e94Initial program 100.0%
Applied egg-rr27.7%
if -4500 < l < 900Initial program 72.4%
Taylor expanded in J around 0 70.1%
if 5.59999999999999997e94 < l Initial program 100.0%
Applied egg-rr22.2%
Taylor expanded in U around 0 22.3%
*-commutative22.3%
Simplified22.3%
Taylor expanded in U around 0 28.7%
distribute-rgt-in28.7%
*-lft-identity28.7%
associate-*l*28.7%
pow-plus28.7%
metadata-eval28.7%
Simplified28.7%
(FPCore (J l K U) :precision binary64 (if (or (<= l -920.0) (not (<= l 920.0))) (pow U -4.0) U))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -920.0) || !(l <= 920.0)) {
tmp = pow(U, -4.0);
} else {
tmp = U;
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if ((l <= (-920.0d0)) .or. (.not. (l <= 920.0d0))) then
tmp = u ** (-4.0d0)
else
tmp = u
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -920.0) || !(l <= 920.0)) {
tmp = Math.pow(U, -4.0);
} else {
tmp = U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -920.0) or not (l <= 920.0): tmp = math.pow(U, -4.0) else: tmp = U return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -920.0) || !(l <= 920.0)) tmp = U ^ -4.0; else tmp = U; end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -920.0) || ~((l <= 920.0))) tmp = U ^ -4.0; else tmp = U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -920.0], N[Not[LessEqual[l, 920.0]], $MachinePrecision]], N[Power[U, -4.0], $MachinePrecision], U]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -920 \lor \neg \left(\ell \leq 920\right):\\
\;\;\;\;{U}^{-4}\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\end{array}
if l < -920 or 920 < l Initial program 100.0%
Applied egg-rr23.7%
if -920 < l < 920Initial program 72.4%
Taylor expanded in J around 0 70.1%
Final simplification45.3%
(FPCore (J l K U) :precision binary64 (if (<= l -750.0) (pow U -4.0) (if (<= l 1350.0) U (pow U -3.0))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -750.0) {
tmp = pow(U, -4.0);
} else if (l <= 1350.0) {
tmp = U;
} 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 <= (-750.0d0)) then
tmp = u ** (-4.0d0)
else if (l <= 1350.0d0) then
tmp = u
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 <= -750.0) {
tmp = Math.pow(U, -4.0);
} else if (l <= 1350.0) {
tmp = U;
} else {
tmp = Math.pow(U, -3.0);
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -750.0: tmp = math.pow(U, -4.0) elif l <= 1350.0: tmp = U else: tmp = math.pow(U, -3.0) return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -750.0) tmp = U ^ -4.0; elseif (l <= 1350.0) tmp = U; else tmp = U ^ -3.0; end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -750.0) tmp = U ^ -4.0; elseif (l <= 1350.0) tmp = U; else tmp = U ^ -3.0; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -750.0], N[Power[U, -4.0], $MachinePrecision], If[LessEqual[l, 1350.0], U, N[Power[U, -3.0], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -750:\\
\;\;\;\;{U}^{-4}\\
\mathbf{elif}\;\ell \leq 1350:\\
\;\;\;\;U\\
\mathbf{else}:\\
\;\;\;\;{U}^{-3}\\
\end{array}
\end{array}
if l < -750Initial program 100.0%
Applied egg-rr25.4%
if -750 < l < 1350Initial program 72.4%
Taylor expanded in J around 0 70.1%
if 1350 < l Initial program 100.0%
Applied egg-rr24.1%
(FPCore (J l K U) :precision binary64 (+ U (* (cos (/ K 2.0)) (* J (* l 2.0)))))
double code(double J, double l, double K, double U) {
return U + (cos((K / 2.0)) * (J * (l * 2.0)));
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = u + (cos((k / 2.0d0)) * (j * (l * 2.0d0)))
end function
public static double code(double J, double l, double K, double U) {
return U + (Math.cos((K / 2.0)) * (J * (l * 2.0)));
}
def code(J, l, K, U): return U + (math.cos((K / 2.0)) * (J * (l * 2.0)))
function code(J, l, K, U) return Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(J * Float64(l * 2.0)))) end
function tmp = code(J, l, K, U) tmp = U + (cos((K / 2.0)) * (J * (l * 2.0))); end
code[J_, l_, K_, U_] := N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(J * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(\ell \cdot 2\right)\right)
\end{array}
Initial program 87.2%
Taylor expanded in l around 0 60.6%
Final simplification60.6%
(FPCore (J l K U) :precision binary64 (+ U (* 2.0 (* J (* l (cos (* K 0.5)))))))
double code(double J, double l, double K, double U) {
return U + (2.0 * (J * (l * cos((K * 0.5)))));
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = u + (2.0d0 * (j * (l * cos((k * 0.5d0)))))
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)))));
}
def code(J, l, K, U): return U + (2.0 * (J * (l * math.cos((K * 0.5)))))
function code(J, l, K, U) return Float64(U + Float64(2.0 * Float64(J * Float64(l * cos(Float64(K * 0.5)))))) end
function tmp = code(J, l, K, U) tmp = U + (2.0 * (J * (l * cos((K * 0.5))))); end
code[J_, l_, K_, U_] := N[(U + N[(2.0 * N[(J * N[(l * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + 2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(K \cdot 0.5\right)\right)\right)
\end{array}
Initial program 87.2%
Taylor expanded in l around 0 60.6%
Final simplification60.6%
(FPCore (J l K U) :precision binary64 (if (or (<= l -850.0) (not (<= l 5200000000.0))) (* U (- U -4.0)) U))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -850.0) || !(l <= 5200000000.0)) {
tmp = U * (U - -4.0);
} else {
tmp = U;
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if ((l <= (-850.0d0)) .or. (.not. (l <= 5200000000.0d0))) then
tmp = u * (u - (-4.0d0))
else
tmp = u
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -850.0) || !(l <= 5200000000.0)) {
tmp = U * (U - -4.0);
} else {
tmp = U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -850.0) or not (l <= 5200000000.0): tmp = U * (U - -4.0) else: tmp = U return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -850.0) || !(l <= 5200000000.0)) tmp = Float64(U * Float64(U - -4.0)); else tmp = U; end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -850.0) || ~((l <= 5200000000.0))) tmp = U * (U - -4.0); else tmp = U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -850.0], N[Not[LessEqual[l, 5200000000.0]], $MachinePrecision]], N[(U * N[(U - -4.0), $MachinePrecision]), $MachinePrecision], U]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -850 \lor \neg \left(\ell \leq 5200000000\right):\\
\;\;\;\;U \cdot \left(U - -4\right)\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\end{array}
if l < -850 or 5.2e9 < l Initial program 100.0%
Applied egg-rr13.1%
if -850 < l < 5.2e9Initial program 73.3%
Taylor expanded in J around 0 67.8%
Final simplification39.4%
(FPCore (J l K U) :precision binary64 (if (<= l -1.2e-25) (* U (+ 1.0 (* -4.0 (/ J U)))) (if (<= l 2300000000.0) U (* U (- U -4.0)))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -1.2e-25) {
tmp = U * (1.0 + (-4.0 * (J / U)));
} else if (l <= 2300000000.0) {
tmp = U;
} else {
tmp = U * (U - -4.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 <= (-1.2d-25)) then
tmp = u * (1.0d0 + ((-4.0d0) * (j / u)))
else if (l <= 2300000000.0d0) then
tmp = u
else
tmp = u * (u - (-4.0d0))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (l <= -1.2e-25) {
tmp = U * (1.0 + (-4.0 * (J / U)));
} else if (l <= 2300000000.0) {
tmp = U;
} else {
tmp = U * (U - -4.0);
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -1.2e-25: tmp = U * (1.0 + (-4.0 * (J / U))) elif l <= 2300000000.0: tmp = U else: tmp = U * (U - -4.0) return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -1.2e-25) tmp = Float64(U * Float64(1.0 + Float64(-4.0 * Float64(J / U)))); elseif (l <= 2300000000.0) tmp = U; else tmp = Float64(U * Float64(U - -4.0)); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -1.2e-25) tmp = U * (1.0 + (-4.0 * (J / U))); elseif (l <= 2300000000.0) tmp = U; else tmp = U * (U - -4.0); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -1.2e-25], N[(U * N[(1.0 + N[(-4.0 * N[(J / U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2300000000.0], U, N[(U * N[(U - -4.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.2 \cdot 10^{-25}:\\
\;\;\;\;U \cdot \left(1 + -4 \cdot \frac{J}{U}\right)\\
\mathbf{elif}\;\ell \leq 2300000000:\\
\;\;\;\;U\\
\mathbf{else}:\\
\;\;\;\;U \cdot \left(U - -4\right)\\
\end{array}
\end{array}
if l < -1.20000000000000005e-25Initial program 94.8%
Applied egg-rr6.8%
Taylor expanded in U around inf 21.0%
if -1.20000000000000005e-25 < l < 2.3e9Initial program 75.0%
Taylor expanded in J around 0 70.1%
if 2.3e9 < l Initial program 100.0%
Applied egg-rr13.8%
(FPCore (J l K U) :precision binary64 (if (or (<= l -800.0) (not (<= l 1.6e+15))) (* U U) U))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -800.0) || !(l <= 1.6e+15)) {
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 <= (-800.0d0)) .or. (.not. (l <= 1.6d+15))) 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 <= -800.0) || !(l <= 1.6e+15)) {
tmp = U * U;
} else {
tmp = U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -800.0) or not (l <= 1.6e+15): tmp = U * U else: tmp = U return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -800.0) || !(l <= 1.6e+15)) tmp = Float64(U * U); else tmp = U; end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -800.0) || ~((l <= 1.6e+15))) tmp = U * U; else tmp = U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -800.0], N[Not[LessEqual[l, 1.6e+15]], $MachinePrecision]], N[(U * U), $MachinePrecision], U]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -800 \lor \neg \left(\ell \leq 1.6 \cdot 10^{+15}\right):\\
\;\;\;\;U \cdot U\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\end{array}
if l < -800 or 1.6e15 < l Initial program 100.0%
Applied egg-rr13.2%
if -800 < l < 1.6e15Initial program 73.9%
Taylor expanded in J around 0 66.3%
Final simplification39.3%
(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.2%
Taylor expanded in J around 0 33.9%
herbie shell --seed 2024116
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))