
(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 16 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))))
(if (or (<= l -0.14) (not (<= l 880.0)))
(+ U (* t_0 (* J (- (exp l) (exp (- l))))))
(+ U (* t_0 (* J (* l (+ 2.0 (* (pow l 2.0) 0.3333333333333333)))))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double tmp;
if ((l <= -0.14) || !(l <= 880.0)) {
tmp = U + (t_0 * (J * (exp(l) - exp(-l))));
} else {
tmp = U + (t_0 * (J * (l * (2.0 + (pow(l, 2.0) * 0.3333333333333333)))));
}
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 / 2.0d0))
if ((l <= (-0.14d0)) .or. (.not. (l <= 880.0d0))) then
tmp = u + (t_0 * (j * (exp(l) - exp(-l))))
else
tmp = u + (t_0 * (j * (l * (2.0d0 + ((l ** 2.0d0) * 0.3333333333333333d0)))))
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 tmp;
if ((l <= -0.14) || !(l <= 880.0)) {
tmp = U + (t_0 * (J * (Math.exp(l) - Math.exp(-l))));
} else {
tmp = U + (t_0 * (J * (l * (2.0 + (Math.pow(l, 2.0) * 0.3333333333333333)))));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K / 2.0)) tmp = 0 if (l <= -0.14) or not (l <= 880.0): tmp = U + (t_0 * (J * (math.exp(l) - math.exp(-l)))) else: tmp = U + (t_0 * (J * (l * (2.0 + (math.pow(l, 2.0) * 0.3333333333333333))))) return tmp
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) tmp = 0.0 if ((l <= -0.14) || !(l <= 880.0)) tmp = Float64(U + Float64(t_0 * Float64(J * Float64(exp(l) - exp(Float64(-l)))))); else tmp = Float64(U + Float64(t_0 * Float64(J * Float64(l * Float64(2.0 + Float64((l ^ 2.0) * 0.3333333333333333)))))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = cos((K / 2.0)); tmp = 0.0; if ((l <= -0.14) || ~((l <= 880.0))) tmp = U + (t_0 * (J * (exp(l) - exp(-l)))); else tmp = U + (t_0 * (J * (l * (2.0 + ((l ^ 2.0) * 0.3333333333333333))))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, If[Or[LessEqual[l, -0.14], N[Not[LessEqual[l, 880.0]], $MachinePrecision]], N[(U + N[(t$95$0 * N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(t$95$0 * N[(J * N[(l * N[(2.0 + N[(N[Power[l, 2.0], $MachinePrecision] * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;\ell \leq -0.14 \lor \neg \left(\ell \leq 880\right):\\
\;\;\;\;U + t\_0 \cdot \left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + t\_0 \cdot \left(J \cdot \left(\ell \cdot \left(2 + {\ell}^{2} \cdot 0.3333333333333333\right)\right)\right)\\
\end{array}
\end{array}
if l < -0.14000000000000001 or 880 < l Initial program 100.0%
if -0.14000000000000001 < l < 880Initial program 75.7%
Taylor expanded in l around 0 99.6%
Final simplification99.8%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))) (t_1 (- (exp l) (exp (- l)))))
(if (or (<= t_1 (- INFINITY)) (not (<= t_1 0.1)))
(+ U (* t_0 (* J (* 0.0003968253968253968 (pow l 7.0)))))
(+ U (* t_0 (* J (* l 2.0)))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double t_1 = exp(l) - exp(-l);
double tmp;
if ((t_1 <= -((double) INFINITY)) || !(t_1 <= 0.1)) {
tmp = U + (t_0 * (J * (0.0003968253968253968 * pow(l, 7.0))));
} else {
tmp = U + (t_0 * (J * (l * 2.0)));
}
return tmp;
}
public static double code(double J, double l, double K, double U) {
double t_0 = Math.cos((K / 2.0));
double t_1 = Math.exp(l) - Math.exp(-l);
double tmp;
if ((t_1 <= -Double.POSITIVE_INFINITY) || !(t_1 <= 0.1)) {
tmp = U + (t_0 * (J * (0.0003968253968253968 * Math.pow(l, 7.0))));
} else {
tmp = U + (t_0 * (J * (l * 2.0)));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K / 2.0)) t_1 = math.exp(l) - math.exp(-l) tmp = 0 if (t_1 <= -math.inf) or not (t_1 <= 0.1): tmp = U + (t_0 * (J * (0.0003968253968253968 * math.pow(l, 7.0)))) else: tmp = U + (t_0 * (J * (l * 2.0))) return tmp
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) t_1 = Float64(exp(l) - exp(Float64(-l))) tmp = 0.0 if ((t_1 <= Float64(-Inf)) || !(t_1 <= 0.1)) tmp = Float64(U + Float64(t_0 * Float64(J * Float64(0.0003968253968253968 * (l ^ 7.0))))); else tmp = Float64(U + Float64(t_0 * Float64(J * Float64(l * 2.0)))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = cos((K / 2.0)); t_1 = exp(l) - exp(-l); tmp = 0.0; if ((t_1 <= -Inf) || ~((t_1 <= 0.1))) tmp = U + (t_0 * (J * (0.0003968253968253968 * (l ^ 7.0)))); else tmp = U + (t_0 * (J * (l * 2.0))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, (-Infinity)], N[Not[LessEqual[t$95$1, 0.1]], $MachinePrecision]], N[(U + N[(t$95$0 * N[(J * N[(0.0003968253968253968 * N[Power[l, 7.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(t$95$0 * N[(J * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
t_1 := e^{\ell} - e^{-\ell}\\
\mathbf{if}\;t\_1 \leq -\infty \lor \neg \left(t\_1 \leq 0.1\right):\\
\;\;\;\;U + t\_0 \cdot \left(J \cdot \left(0.0003968253968253968 \cdot {\ell}^{7}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + t\_0 \cdot \left(J \cdot \left(\ell \cdot 2\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -inf.0 or 0.10000000000000001 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 99.3%
Taylor expanded in l around 0 93.8%
*-commutative93.8%
Simplified93.8%
Taylor expanded in l around inf 93.8%
associate-*r*93.8%
*-commutative93.8%
associate-*l*93.8%
Simplified93.8%
if -inf.0 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 0.10000000000000001Initial program 76.1%
Taylor expanded in l around 0 99.4%
*-commutative99.4%
associate-*r*99.4%
Simplified99.4%
Final simplification96.4%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= l 880.0)
(+
(*
(*
J
(*
l
(+
2.0
(*
(pow l 2.0)
(+
0.3333333333333333
(*
(pow l 2.0)
(+
0.016666666666666666
(* (pow l 2.0) 0.0003968253968253968))))))))
t_0)
U)
(+ U (* t_0 (* J (- (exp l) (exp (- l)))))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double tmp;
if (l <= 880.0) {
tmp = ((J * (l * (2.0 + (pow(l, 2.0) * (0.3333333333333333 + (pow(l, 2.0) * (0.016666666666666666 + (pow(l, 2.0) * 0.0003968253968253968)))))))) * t_0) + U;
} else {
tmp = U + (t_0 * (J * (exp(l) - exp(-l))));
}
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 / 2.0d0))
if (l <= 880.0d0) then
tmp = ((j * (l * (2.0d0 + ((l ** 2.0d0) * (0.3333333333333333d0 + ((l ** 2.0d0) * (0.016666666666666666d0 + ((l ** 2.0d0) * 0.0003968253968253968d0)))))))) * t_0) + u
else
tmp = u + (t_0 * (j * (exp(l) - exp(-l))))
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 tmp;
if (l <= 880.0) {
tmp = ((J * (l * (2.0 + (Math.pow(l, 2.0) * (0.3333333333333333 + (Math.pow(l, 2.0) * (0.016666666666666666 + (Math.pow(l, 2.0) * 0.0003968253968253968)))))))) * t_0) + U;
} else {
tmp = U + (t_0 * (J * (Math.exp(l) - Math.exp(-l))));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K / 2.0)) tmp = 0 if l <= 880.0: tmp = ((J * (l * (2.0 + (math.pow(l, 2.0) * (0.3333333333333333 + (math.pow(l, 2.0) * (0.016666666666666666 + (math.pow(l, 2.0) * 0.0003968253968253968)))))))) * t_0) + U else: tmp = U + (t_0 * (J * (math.exp(l) - math.exp(-l)))) return tmp
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) tmp = 0.0 if (l <= 880.0) tmp = Float64(Float64(Float64(J * Float64(l * Float64(2.0 + Float64((l ^ 2.0) * Float64(0.3333333333333333 + Float64((l ^ 2.0) * Float64(0.016666666666666666 + Float64((l ^ 2.0) * 0.0003968253968253968)))))))) * t_0) + U); else tmp = Float64(U + Float64(t_0 * Float64(J * Float64(exp(l) - exp(Float64(-l)))))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = cos((K / 2.0)); tmp = 0.0; if (l <= 880.0) tmp = ((J * (l * (2.0 + ((l ^ 2.0) * (0.3333333333333333 + ((l ^ 2.0) * (0.016666666666666666 + ((l ^ 2.0) * 0.0003968253968253968)))))))) * t_0) + U; else tmp = U + (t_0 * (J * (exp(l) - exp(-l)))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, 880.0], N[(N[(N[(J * N[(l * N[(2.0 + N[(N[Power[l, 2.0], $MachinePrecision] * N[(0.3333333333333333 + N[(N[Power[l, 2.0], $MachinePrecision] * N[(0.016666666666666666 + N[(N[Power[l, 2.0], $MachinePrecision] * 0.0003968253968253968), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] + U), $MachinePrecision], N[(U + N[(t$95$0 * N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;\ell \leq 880:\\
\;\;\;\;\left(J \cdot \left(\ell \cdot \left(2 + {\ell}^{2} \cdot \left(0.3333333333333333 + {\ell}^{2} \cdot \left(0.016666666666666666 + {\ell}^{2} \cdot 0.0003968253968253968\right)\right)\right)\right)\right) \cdot t\_0 + U\\
\mathbf{else}:\\
\;\;\;\;U + t\_0 \cdot \left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right)\\
\end{array}
\end{array}
if l < 880Initial program 84.1%
Taylor expanded in l around 0 97.9%
*-commutative97.9%
Simplified97.9%
if 880 < l Initial program 100.0%
Final simplification98.5%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (or (<= l -5.6) (not (<= l 2.2)))
(+ U (* t_0 (* J (* 0.0003968253968253968 (pow l 7.0)))))
(+ U (* t_0 (* J (* l (+ 2.0 (* (pow l 2.0) 0.3333333333333333)))))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double tmp;
if ((l <= -5.6) || !(l <= 2.2)) {
tmp = U + (t_0 * (J * (0.0003968253968253968 * pow(l, 7.0))));
} else {
tmp = U + (t_0 * (J * (l * (2.0 + (pow(l, 2.0) * 0.3333333333333333)))));
}
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 / 2.0d0))
if ((l <= (-5.6d0)) .or. (.not. (l <= 2.2d0))) then
tmp = u + (t_0 * (j * (0.0003968253968253968d0 * (l ** 7.0d0))))
else
tmp = u + (t_0 * (j * (l * (2.0d0 + ((l ** 2.0d0) * 0.3333333333333333d0)))))
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 tmp;
if ((l <= -5.6) || !(l <= 2.2)) {
tmp = U + (t_0 * (J * (0.0003968253968253968 * Math.pow(l, 7.0))));
} else {
tmp = U + (t_0 * (J * (l * (2.0 + (Math.pow(l, 2.0) * 0.3333333333333333)))));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K / 2.0)) tmp = 0 if (l <= -5.6) or not (l <= 2.2): tmp = U + (t_0 * (J * (0.0003968253968253968 * math.pow(l, 7.0)))) else: tmp = U + (t_0 * (J * (l * (2.0 + (math.pow(l, 2.0) * 0.3333333333333333))))) return tmp
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) tmp = 0.0 if ((l <= -5.6) || !(l <= 2.2)) tmp = Float64(U + Float64(t_0 * Float64(J * Float64(0.0003968253968253968 * (l ^ 7.0))))); else tmp = Float64(U + Float64(t_0 * Float64(J * Float64(l * Float64(2.0 + Float64((l ^ 2.0) * 0.3333333333333333)))))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = cos((K / 2.0)); tmp = 0.0; if ((l <= -5.6) || ~((l <= 2.2))) tmp = U + (t_0 * (J * (0.0003968253968253968 * (l ^ 7.0)))); else tmp = U + (t_0 * (J * (l * (2.0 + ((l ^ 2.0) * 0.3333333333333333))))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, If[Or[LessEqual[l, -5.6], N[Not[LessEqual[l, 2.2]], $MachinePrecision]], N[(U + N[(t$95$0 * N[(J * N[(0.0003968253968253968 * N[Power[l, 7.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(t$95$0 * N[(J * N[(l * N[(2.0 + N[(N[Power[l, 2.0], $MachinePrecision] * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;\ell \leq -5.6 \lor \neg \left(\ell \leq 2.2\right):\\
\;\;\;\;U + t\_0 \cdot \left(J \cdot \left(0.0003968253968253968 \cdot {\ell}^{7}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + t\_0 \cdot \left(J \cdot \left(\ell \cdot \left(2 + {\ell}^{2} \cdot 0.3333333333333333\right)\right)\right)\\
\end{array}
\end{array}
if l < -5.5999999999999996 or 2.2000000000000002 < l Initial program 99.3%
Taylor expanded in l around 0 93.8%
*-commutative93.8%
Simplified93.8%
Taylor expanded in l around inf 93.8%
associate-*r*93.8%
*-commutative93.8%
associate-*l*93.8%
Simplified93.8%
if -5.5999999999999996 < l < 2.2000000000000002Initial program 76.1%
Taylor expanded in l around 0 99.6%
Final simplification96.5%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.345) (+ U (* (* J (* l 2.0)) (+ (* (pow K 2.0) -8.0) 5.0))) (+ U (* J (* l (+ 2.0 (* (pow l 2.0) 0.3333333333333333)))))))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.345) {
tmp = U + ((J * (l * 2.0)) * ((pow(K, 2.0) * -8.0) + 5.0));
} else {
tmp = U + (J * (l * (2.0 + (pow(l, 2.0) * 0.3333333333333333))));
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if (cos((k / 2.0d0)) <= (-0.345d0)) then
tmp = u + ((j * (l * 2.0d0)) * (((k ** 2.0d0) * (-8.0d0)) + 5.0d0))
else
tmp = u + (j * (l * (2.0d0 + ((l ** 2.0d0) * 0.3333333333333333d0))))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (Math.cos((K / 2.0)) <= -0.345) {
tmp = U + ((J * (l * 2.0)) * ((Math.pow(K, 2.0) * -8.0) + 5.0));
} else {
tmp = U + (J * (l * (2.0 + (Math.pow(l, 2.0) * 0.3333333333333333))));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if math.cos((K / 2.0)) <= -0.345: tmp = U + ((J * (l * 2.0)) * ((math.pow(K, 2.0) * -8.0) + 5.0)) else: tmp = U + (J * (l * (2.0 + (math.pow(l, 2.0) * 0.3333333333333333)))) return tmp
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.345) tmp = Float64(U + Float64(Float64(J * Float64(l * 2.0)) * Float64(Float64((K ^ 2.0) * -8.0) + 5.0))); else tmp = Float64(U + Float64(J * Float64(l * Float64(2.0 + Float64((l ^ 2.0) * 0.3333333333333333))))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (cos((K / 2.0)) <= -0.345) tmp = U + ((J * (l * 2.0)) * (((K ^ 2.0) * -8.0) + 5.0)); else tmp = U + (J * (l * (2.0 + ((l ^ 2.0) * 0.3333333333333333)))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.345], N[(U + N[(N[(J * N[(l * 2.0), $MachinePrecision]), $MachinePrecision] * N[(N[(N[Power[K, 2.0], $MachinePrecision] * -8.0), $MachinePrecision] + 5.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * N[(l * N[(2.0 + N[(N[Power[l, 2.0], $MachinePrecision] * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.345:\\
\;\;\;\;U + \left(J \cdot \left(\ell \cdot 2\right)\right) \cdot \left({K}^{2} \cdot -8 + 5\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(\ell \cdot \left(2 + {\ell}^{2} \cdot 0.3333333333333333\right)\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.34499999999999997Initial program 93.7%
Taylor expanded in l around 0 63.3%
*-commutative63.3%
associate-*r*63.3%
Simplified63.3%
Applied egg-rr33.5%
log1p-undefine33.5%
rem-exp-log33.5%
+-commutative33.5%
associate--l+33.5%
*-commutative33.5%
metadata-eval33.5%
Simplified33.5%
Taylor expanded in K around 0 73.5%
+-commutative73.5%
*-commutative73.5%
Simplified73.5%
if -0.34499999999999997 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 87.2%
Taylor expanded in l around 0 96.6%
*-commutative96.6%
Simplified96.6%
Taylor expanded in K around 0 90.5%
Taylor expanded in l around 0 85.0%
*-commutative85.0%
Simplified85.0%
Final simplification82.5%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.345) (+ U (* (* J (* l 2.0)) (+ 1.0 (* (pow K 2.0) -0.125)))) (+ U (* J (* l (+ 2.0 (* (pow l 2.0) 0.3333333333333333)))))))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.345) {
tmp = U + ((J * (l * 2.0)) * (1.0 + (pow(K, 2.0) * -0.125)));
} else {
tmp = U + (J * (l * (2.0 + (pow(l, 2.0) * 0.3333333333333333))));
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if (cos((k / 2.0d0)) <= (-0.345d0)) then
tmp = u + ((j * (l * 2.0d0)) * (1.0d0 + ((k ** 2.0d0) * (-0.125d0))))
else
tmp = u + (j * (l * (2.0d0 + ((l ** 2.0d0) * 0.3333333333333333d0))))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (Math.cos((K / 2.0)) <= -0.345) {
tmp = U + ((J * (l * 2.0)) * (1.0 + (Math.pow(K, 2.0) * -0.125)));
} else {
tmp = U + (J * (l * (2.0 + (Math.pow(l, 2.0) * 0.3333333333333333))));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if math.cos((K / 2.0)) <= -0.345: tmp = U + ((J * (l * 2.0)) * (1.0 + (math.pow(K, 2.0) * -0.125))) else: tmp = U + (J * (l * (2.0 + (math.pow(l, 2.0) * 0.3333333333333333)))) return tmp
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.345) tmp = Float64(U + Float64(Float64(J * Float64(l * 2.0)) * Float64(1.0 + Float64((K ^ 2.0) * -0.125)))); else tmp = Float64(U + Float64(J * Float64(l * Float64(2.0 + Float64((l ^ 2.0) * 0.3333333333333333))))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (cos((K / 2.0)) <= -0.345) tmp = U + ((J * (l * 2.0)) * (1.0 + ((K ^ 2.0) * -0.125))); else tmp = U + (J * (l * (2.0 + ((l ^ 2.0) * 0.3333333333333333)))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.345], N[(U + N[(N[(J * N[(l * 2.0), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[Power[K, 2.0], $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * N[(l * N[(2.0 + N[(N[Power[l, 2.0], $MachinePrecision] * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.345:\\
\;\;\;\;U + \left(J \cdot \left(\ell \cdot 2\right)\right) \cdot \left(1 + {K}^{2} \cdot -0.125\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(\ell \cdot \left(2 + {\ell}^{2} \cdot 0.3333333333333333\right)\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.34499999999999997Initial program 93.7%
Taylor expanded in l around 0 63.3%
*-commutative63.3%
associate-*r*63.3%
Simplified63.3%
Taylor expanded in K around 0 73.5%
if -0.34499999999999997 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 87.2%
Taylor expanded in l around 0 96.6%
*-commutative96.6%
Simplified96.6%
Taylor expanded in K around 0 90.5%
Taylor expanded in l around 0 85.0%
*-commutative85.0%
Simplified85.0%
Final simplification82.5%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= t_0 0.22)
(+ U (* t_0 (* J (* l 2.0))))
(+ U (* J (* l (+ 2.0 (* (pow l 2.0) 0.3333333333333333))))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double tmp;
if (t_0 <= 0.22) {
tmp = U + (t_0 * (J * (l * 2.0)));
} else {
tmp = U + (J * (l * (2.0 + (pow(l, 2.0) * 0.3333333333333333))));
}
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 / 2.0d0))
if (t_0 <= 0.22d0) then
tmp = u + (t_0 * (j * (l * 2.0d0)))
else
tmp = u + (j * (l * (2.0d0 + ((l ** 2.0d0) * 0.3333333333333333d0))))
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 tmp;
if (t_0 <= 0.22) {
tmp = U + (t_0 * (J * (l * 2.0)));
} else {
tmp = U + (J * (l * (2.0 + (Math.pow(l, 2.0) * 0.3333333333333333))));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K / 2.0)) tmp = 0 if t_0 <= 0.22: tmp = U + (t_0 * (J * (l * 2.0))) else: tmp = U + (J * (l * (2.0 + (math.pow(l, 2.0) * 0.3333333333333333)))) return tmp
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) tmp = 0.0 if (t_0 <= 0.22) tmp = Float64(U + Float64(t_0 * Float64(J * Float64(l * 2.0)))); else tmp = Float64(U + Float64(J * Float64(l * Float64(2.0 + Float64((l ^ 2.0) * 0.3333333333333333))))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = cos((K / 2.0)); tmp = 0.0; if (t_0 <= 0.22) tmp = U + (t_0 * (J * (l * 2.0))); else tmp = U + (J * (l * (2.0 + ((l ^ 2.0) * 0.3333333333333333)))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, 0.22], N[(U + N[(t$95$0 * N[(J * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * N[(l * N[(2.0 + N[(N[Power[l, 2.0], $MachinePrecision] * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;t\_0 \leq 0.22:\\
\;\;\;\;U + t\_0 \cdot \left(J \cdot \left(\ell \cdot 2\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(\ell \cdot \left(2 + {\ell}^{2} \cdot 0.3333333333333333\right)\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < 0.220000000000000001Initial program 92.1%
Taylor expanded in l around 0 69.0%
*-commutative69.0%
associate-*r*69.0%
Simplified69.0%
if 0.220000000000000001 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 87.0%
Taylor expanded in l around 0 96.2%
*-commutative96.2%
Simplified96.2%
Taylor expanded in K around 0 94.0%
Taylor expanded in l around 0 87.7%
*-commutative87.7%
Simplified87.7%
Final simplification81.8%
(FPCore (J l K U) :precision binary64 (if (or (<= l -4.9e+20) (not (<= l 880.0))) (+ U (* J (- (exp l) (exp (- l))))) (+ U (* (cos (/ K 2.0)) (* J (* l 2.0))))))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -4.9e+20) || !(l <= 880.0)) {
tmp = U + (J * (exp(l) - exp(-l)));
} else {
tmp = U + (cos((K / 2.0)) * (J * (l * 2.0)));
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if ((l <= (-4.9d+20)) .or. (.not. (l <= 880.0d0))) then
tmp = u + (j * (exp(l) - exp(-l)))
else
tmp = u + (cos((k / 2.0d0)) * (j * (l * 2.0d0)))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -4.9e+20) || !(l <= 880.0)) {
tmp = U + (J * (Math.exp(l) - Math.exp(-l)));
} else {
tmp = U + (Math.cos((K / 2.0)) * (J * (l * 2.0)));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -4.9e+20) or not (l <= 880.0): tmp = U + (J * (math.exp(l) - math.exp(-l))) else: tmp = U + (math.cos((K / 2.0)) * (J * (l * 2.0))) return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -4.9e+20) || !(l <= 880.0)) tmp = Float64(U + Float64(J * Float64(exp(l) - exp(Float64(-l))))); else tmp = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(J * Float64(l * 2.0)))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -4.9e+20) || ~((l <= 880.0))) tmp = U + (J * (exp(l) - exp(-l))); else tmp = U + (cos((K / 2.0)) * (J * (l * 2.0))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -4.9e+20], N[Not[LessEqual[l, 880.0]], $MachinePrecision]], N[(U + N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(J * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -4.9 \cdot 10^{+20} \lor \neg \left(\ell \leq 880\right):\\
\;\;\;\;U + J \cdot \left(e^{\ell} - e^{-\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;U + \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(\ell \cdot 2\right)\right)\\
\end{array}
\end{array}
if l < -4.9e20 or 880 < l Initial program 100.0%
Taylor expanded in K around 0 72.4%
if -4.9e20 < l < 880Initial program 76.1%
Taylor expanded in l around 0 97.9%
*-commutative97.9%
associate-*r*97.9%
Simplified97.9%
Final simplification84.5%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.005) (+ U (* J (* l -6.0))) (+ U (* 0.0003968253968253968 (* J (pow l 7.0))))))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.005) {
tmp = U + (J * (l * -6.0));
} else {
tmp = U + (0.0003968253968253968 * (J * pow(l, 7.0)));
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if (cos((k / 2.0d0)) <= (-0.005d0)) then
tmp = u + (j * (l * (-6.0d0)))
else
tmp = u + (0.0003968253968253968d0 * (j * (l ** 7.0d0)))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (Math.cos((K / 2.0)) <= -0.005) {
tmp = U + (J * (l * -6.0));
} else {
tmp = U + (0.0003968253968253968 * (J * Math.pow(l, 7.0)));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if math.cos((K / 2.0)) <= -0.005: tmp = U + (J * (l * -6.0)) else: tmp = U + (0.0003968253968253968 * (J * math.pow(l, 7.0))) return tmp
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.005) tmp = Float64(U + Float64(J * Float64(l * -6.0))); else tmp = Float64(U + Float64(0.0003968253968253968 * Float64(J * (l ^ 7.0)))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (cos((K / 2.0)) <= -0.005) tmp = U + (J * (l * -6.0)); else tmp = U + (0.0003968253968253968 * (J * (l ^ 7.0))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.005], N[(U + N[(J * N[(l * -6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(0.0003968253968253968 * N[(J * N[Power[l, 7.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.005:\\
\;\;\;\;U + J \cdot \left(\ell \cdot -6\right)\\
\mathbf{else}:\\
\;\;\;\;U + 0.0003968253968253968 \cdot \left(J \cdot {\ell}^{7}\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0050000000000000001Initial program 94.9%
Taylor expanded in l around 0 66.7%
*-commutative66.7%
associate-*r*66.7%
Simplified66.7%
Applied egg-rr49.4%
*-commutative49.4%
Simplified49.4%
Taylor expanded in K around 0 61.9%
*-commutative61.9%
associate-*l*61.9%
Simplified61.9%
if -0.0050000000000000001 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 86.3%
Taylor expanded in l around 0 96.4%
*-commutative96.4%
Simplified96.4%
Taylor expanded in K around 0 93.0%
Taylor expanded in l around inf 82.7%
Final simplification77.1%
(FPCore (J l K U) :precision binary64 (if (or (<= l -4.9e+20) (not (<= l 1.12e+31))) (+ U (* 0.0003968253968253968 (* J (pow l 7.0)))) (+ U (* (cos (/ K 2.0)) (* J (* l 2.0))))))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -4.9e+20) || !(l <= 1.12e+31)) {
tmp = U + (0.0003968253968253968 * (J * pow(l, 7.0)));
} else {
tmp = U + (cos((K / 2.0)) * (J * (l * 2.0)));
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if ((l <= (-4.9d+20)) .or. (.not. (l <= 1.12d+31))) then
tmp = u + (0.0003968253968253968d0 * (j * (l ** 7.0d0)))
else
tmp = u + (cos((k / 2.0d0)) * (j * (l * 2.0d0)))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -4.9e+20) || !(l <= 1.12e+31)) {
tmp = U + (0.0003968253968253968 * (J * Math.pow(l, 7.0)));
} else {
tmp = U + (Math.cos((K / 2.0)) * (J * (l * 2.0)));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -4.9e+20) or not (l <= 1.12e+31): tmp = U + (0.0003968253968253968 * (J * math.pow(l, 7.0))) else: tmp = U + (math.cos((K / 2.0)) * (J * (l * 2.0))) return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -4.9e+20) || !(l <= 1.12e+31)) tmp = Float64(U + Float64(0.0003968253968253968 * Float64(J * (l ^ 7.0)))); else tmp = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(J * Float64(l * 2.0)))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -4.9e+20) || ~((l <= 1.12e+31))) tmp = U + (0.0003968253968253968 * (J * (l ^ 7.0))); else tmp = U + (cos((K / 2.0)) * (J * (l * 2.0))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -4.9e+20], N[Not[LessEqual[l, 1.12e+31]], $MachinePrecision]], N[(U + N[(0.0003968253968253968 * N[(J * N[Power[l, 7.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(J * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -4.9 \cdot 10^{+20} \lor \neg \left(\ell \leq 1.12 \cdot 10^{+31}\right):\\
\;\;\;\;U + 0.0003968253968253968 \cdot \left(J \cdot {\ell}^{7}\right)\\
\mathbf{else}:\\
\;\;\;\;U + \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(\ell \cdot 2\right)\right)\\
\end{array}
\end{array}
if l < -4.9e20 or 1.11999999999999993e31 < l Initial program 100.0%
Taylor expanded in l around 0 97.1%
*-commutative97.1%
Simplified97.1%
Taylor expanded in K around 0 69.9%
Taylor expanded in l around inf 69.9%
if -4.9e20 < l < 1.11999999999999993e31Initial program 77.0%
Taylor expanded in l around 0 94.9%
*-commutative94.9%
associate-*r*94.9%
Simplified94.9%
Final simplification82.3%
(FPCore (J l K U) :precision binary64 (if (or (<= l -4.9e+20) (not (<= l 1.6e+30))) (+ U (* 0.0003968253968253968 (* J (pow l 7.0)))) (+ U (* 2.0 (* J (* l (cos (* K 0.5))))))))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -4.9e+20) || !(l <= 1.6e+30)) {
tmp = U + (0.0003968253968253968 * (J * pow(l, 7.0)));
} else {
tmp = U + (2.0 * (J * (l * cos((K * 0.5)))));
}
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+20)) .or. (.not. (l <= 1.6d+30))) then
tmp = u + (0.0003968253968253968d0 * (j * (l ** 7.0d0)))
else
tmp = u + (2.0d0 * (j * (l * cos((k * 0.5d0)))))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -4.9e+20) || !(l <= 1.6e+30)) {
tmp = U + (0.0003968253968253968 * (J * Math.pow(l, 7.0)));
} else {
tmp = U + (2.0 * (J * (l * Math.cos((K * 0.5)))));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -4.9e+20) or not (l <= 1.6e+30): tmp = U + (0.0003968253968253968 * (J * math.pow(l, 7.0))) else: tmp = U + (2.0 * (J * (l * math.cos((K * 0.5))))) return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -4.9e+20) || !(l <= 1.6e+30)) tmp = Float64(U + Float64(0.0003968253968253968 * Float64(J * (l ^ 7.0)))); else tmp = Float64(U + Float64(2.0 * Float64(J * Float64(l * cos(Float64(K * 0.5)))))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -4.9e+20) || ~((l <= 1.6e+30))) tmp = U + (0.0003968253968253968 * (J * (l ^ 7.0))); else tmp = U + (2.0 * (J * (l * cos((K * 0.5))))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -4.9e+20], N[Not[LessEqual[l, 1.6e+30]], $MachinePrecision]], N[(U + N[(0.0003968253968253968 * N[(J * N[Power[l, 7.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(2.0 * N[(J * N[(l * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -4.9 \cdot 10^{+20} \lor \neg \left(\ell \leq 1.6 \cdot 10^{+30}\right):\\
\;\;\;\;U + 0.0003968253968253968 \cdot \left(J \cdot {\ell}^{7}\right)\\
\mathbf{else}:\\
\;\;\;\;U + 2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\end{array}
\end{array}
if l < -4.9e20 or 1.59999999999999986e30 < l Initial program 100.0%
Taylor expanded in l around 0 97.1%
*-commutative97.1%
Simplified97.1%
Taylor expanded in K around 0 69.9%
Taylor expanded in l around inf 69.9%
if -4.9e20 < l < 1.59999999999999986e30Initial program 77.0%
Taylor expanded in l around 0 94.9%
Final simplification82.3%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.005) (+ U (* J (* l -6.0))) (* U (+ 1.0 (* 10.0 (* J (/ l U)))))))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.005) {
tmp = U + (J * (l * -6.0));
} else {
tmp = U * (1.0 + (10.0 * (J * (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 (cos((k / 2.0d0)) <= (-0.005d0)) then
tmp = u + (j * (l * (-6.0d0)))
else
tmp = u * (1.0d0 + (10.0d0 * (j * (l / u))))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (Math.cos((K / 2.0)) <= -0.005) {
tmp = U + (J * (l * -6.0));
} else {
tmp = U * (1.0 + (10.0 * (J * (l / U))));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if math.cos((K / 2.0)) <= -0.005: tmp = U + (J * (l * -6.0)) else: tmp = U * (1.0 + (10.0 * (J * (l / U)))) return tmp
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.005) tmp = Float64(U + Float64(J * Float64(l * -6.0))); else tmp = Float64(U * Float64(1.0 + Float64(10.0 * Float64(J * Float64(l / U))))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (cos((K / 2.0)) <= -0.005) tmp = U + (J * (l * -6.0)); else tmp = U * (1.0 + (10.0 * (J * (l / U)))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.005], N[(U + N[(J * N[(l * -6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U * N[(1.0 + N[(10.0 * N[(J * N[(l / U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.005:\\
\;\;\;\;U + J \cdot \left(\ell \cdot -6\right)\\
\mathbf{else}:\\
\;\;\;\;U \cdot \left(1 + 10 \cdot \left(J \cdot \frac{\ell}{U}\right)\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.0050000000000000001Initial program 94.9%
Taylor expanded in l around 0 66.7%
*-commutative66.7%
associate-*r*66.7%
Simplified66.7%
Applied egg-rr49.4%
*-commutative49.4%
Simplified49.4%
Taylor expanded in K around 0 61.9%
*-commutative61.9%
associate-*l*61.9%
Simplified61.9%
if -0.0050000000000000001 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 86.3%
Taylor expanded in l around 0 62.4%
*-commutative62.4%
associate-*r*62.4%
Simplified62.4%
Applied egg-rr50.7%
log1p-undefine50.7%
rem-exp-log50.7%
+-commutative50.7%
associate--l+50.7%
*-commutative50.7%
metadata-eval50.7%
Simplified50.7%
Taylor expanded in K around 0 50.7%
associate-*r*50.7%
Simplified50.7%
Taylor expanded in U around inf 58.6%
associate-/l*64.8%
Simplified64.8%
Final simplification64.0%
(FPCore (J l K U) :precision binary64 (if (<= K 2.05e+34) (+ U (* J (* l 2.0))) (+ U (* J (* l -6.0)))))
double code(double J, double l, double K, double U) {
double tmp;
if (K <= 2.05e+34) {
tmp = U + (J * (l * 2.0));
} else {
tmp = U + (J * (l * -6.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 (k <= 2.05d+34) then
tmp = u + (j * (l * 2.0d0))
else
tmp = u + (j * (l * (-6.0d0)))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (K <= 2.05e+34) {
tmp = U + (J * (l * 2.0));
} else {
tmp = U + (J * (l * -6.0));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if K <= 2.05e+34: tmp = U + (J * (l * 2.0)) else: tmp = U + (J * (l * -6.0)) return tmp
function code(J, l, K, U) tmp = 0.0 if (K <= 2.05e+34) tmp = Float64(U + Float64(J * Float64(l * 2.0))); else tmp = Float64(U + Float64(J * Float64(l * -6.0))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (K <= 2.05e+34) tmp = U + (J * (l * 2.0)); else tmp = U + (J * (l * -6.0)); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[K, 2.05e+34], N[(U + N[(J * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * N[(l * -6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;K \leq 2.05 \cdot 10^{+34}:\\
\;\;\;\;U + J \cdot \left(\ell \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(\ell \cdot -6\right)\\
\end{array}
\end{array}
if K < 2.0499999999999999e34Initial program 87.7%
Taylor expanded in l around 0 61.1%
*-commutative61.1%
associate-*r*61.1%
Simplified61.1%
Taylor expanded in K around 0 54.6%
if 2.0499999999999999e34 < K Initial program 91.5%
Taylor expanded in l around 0 71.2%
*-commutative71.2%
associate-*r*71.2%
Simplified71.2%
Applied egg-rr54.8%
*-commutative54.8%
Simplified54.8%
Taylor expanded in K around 0 55.8%
*-commutative55.8%
associate-*l*55.8%
Simplified55.8%
Final simplification54.9%
(FPCore (J l K U) :precision binary64 (if (<= K 2.05e+34) (+ U (* 10.0 (* l J))) (+ U (* J (* l -6.0)))))
double code(double J, double l, double K, double U) {
double tmp;
if (K <= 2.05e+34) {
tmp = U + (10.0 * (l * J));
} else {
tmp = U + (J * (l * -6.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 (k <= 2.05d+34) then
tmp = u + (10.0d0 * (l * j))
else
tmp = u + (j * (l * (-6.0d0)))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (K <= 2.05e+34) {
tmp = U + (10.0 * (l * J));
} else {
tmp = U + (J * (l * -6.0));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if K <= 2.05e+34: tmp = U + (10.0 * (l * J)) else: tmp = U + (J * (l * -6.0)) return tmp
function code(J, l, K, U) tmp = 0.0 if (K <= 2.05e+34) tmp = Float64(U + Float64(10.0 * Float64(l * J))); else tmp = Float64(U + Float64(J * Float64(l * -6.0))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (K <= 2.05e+34) tmp = U + (10.0 * (l * J)); else tmp = U + (J * (l * -6.0)); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[K, 2.05e+34], N[(U + N[(10.0 * N[(l * J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * N[(l * -6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;K \leq 2.05 \cdot 10^{+34}:\\
\;\;\;\;U + 10 \cdot \left(\ell \cdot J\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(\ell \cdot -6\right)\\
\end{array}
\end{array}
if K < 2.0499999999999999e34Initial program 87.7%
Taylor expanded in l around 0 61.1%
*-commutative61.1%
associate-*r*61.1%
Simplified61.1%
Applied egg-rr46.6%
log1p-undefine46.6%
rem-exp-log46.6%
+-commutative46.6%
associate--l+46.6%
*-commutative46.6%
metadata-eval46.6%
Simplified46.6%
Taylor expanded in K around 0 46.6%
if 2.0499999999999999e34 < K Initial program 91.5%
Taylor expanded in l around 0 71.2%
*-commutative71.2%
associate-*r*71.2%
Simplified71.2%
Applied egg-rr54.8%
*-commutative54.8%
Simplified54.8%
Taylor expanded in K around 0 55.8%
*-commutative55.8%
associate-*l*55.8%
Simplified55.8%
Final simplification48.9%
(FPCore (J l K U) :precision binary64 (+ U (* 10.0 (* l J))))
double code(double J, double l, double K, double U) {
return U + (10.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 + (10.0d0 * (l * j))
end function
public static double code(double J, double l, double K, double U) {
return U + (10.0 * (l * J));
}
def code(J, l, K, U): return U + (10.0 * (l * J))
function code(J, l, K, U) return Float64(U + Float64(10.0 * Float64(l * J))) end
function tmp = code(J, l, K, U) tmp = U + (10.0 * (l * J)); end
code[J_, l_, K_, U_] := N[(U + N[(10.0 * N[(l * J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + 10 \cdot \left(\ell \cdot J\right)
\end{array}
Initial program 88.6%
Taylor expanded in l around 0 63.5%
*-commutative63.5%
associate-*r*63.5%
Simplified63.5%
Applied egg-rr47.4%
log1p-undefine47.4%
rem-exp-log47.4%
+-commutative47.4%
associate--l+47.4%
*-commutative47.4%
metadata-eval47.4%
Simplified47.4%
Taylor expanded in K around 0 47.4%
Final simplification47.4%
(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 88.6%
Applied egg-rr27.2%
Taylor expanded in J around 0 36.4%
herbie shell --seed 2024110
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))