
(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 (- (exp l) (exp (- l)))))
(if (or (<= t_0 -0.04) (not (<= t_0 6e-5)))
(+ (* (* t_0 J) (cos (/ K 2.0))) U)
(+
U
(*
l
(* (cos (* K 0.5)) (* J (fma 0.3333333333333333 (pow l 2.0) 2.0))))))))
double code(double J, double l, double K, double U) {
double t_0 = exp(l) - exp(-l);
double tmp;
if ((t_0 <= -0.04) || !(t_0 <= 6e-5)) {
tmp = ((t_0 * J) * cos((K / 2.0))) + U;
} else {
tmp = U + (l * (cos((K * 0.5)) * (J * fma(0.3333333333333333, pow(l, 2.0), 2.0))));
}
return tmp;
}
function code(J, l, K, U) t_0 = Float64(exp(l) - exp(Float64(-l))) tmp = 0.0 if ((t_0 <= -0.04) || !(t_0 <= 6e-5)) tmp = Float64(Float64(Float64(t_0 * J) * cos(Float64(K / 2.0))) + U); else tmp = Float64(U + Float64(l * Float64(cos(Float64(K * 0.5)) * Float64(J * fma(0.3333333333333333, (l ^ 2.0), 2.0))))); end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, -0.04], N[Not[LessEqual[t$95$0, 6e-5]], $MachinePrecision]], N[(N[(N[(t$95$0 * J), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], N[(U + N[(l * N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * N[(J * N[(0.3333333333333333 * N[Power[l, 2.0], $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{\ell} - e^{-\ell}\\
\mathbf{if}\;t\_0 \leq -0.04 \lor \neg \left(t\_0 \leq 6 \cdot 10^{-5}\right):\\
\;\;\;\;\left(t\_0 \cdot J\right) \cdot \cos \left(\frac{K}{2}\right) + U\\
\mathbf{else}:\\
\;\;\;\;U + \ell \cdot \left(\cos \left(K \cdot 0.5\right) \cdot \left(J \cdot \mathsf{fma}\left(0.3333333333333333, {\ell}^{2}, 2\right)\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -0.0400000000000000008 or 6.00000000000000015e-5 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 99.1%
if -0.0400000000000000008 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 6.00000000000000015e-5Initial program 74.6%
Taylor expanded in l around 0 99.9%
associate-*r*99.9%
associate-*r*99.9%
associate-*r*99.9%
distribute-rgt-out99.9%
*-commutative99.9%
associate-*l*99.9%
*-commutative99.9%
*-commutative99.9%
distribute-lft-out99.9%
fma-define99.9%
Simplified99.9%
Final simplification99.6%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))) (t_1 (- (exp l) (exp (- l)))))
(if (or (<= t_1 -0.04) (not (<= t_1 6e-5)))
(+ (* (* t_1 J) t_0) U)
(+ U (* t_0 (* J (* l (+ 2.0 (* 0.3333333333333333 (pow l 2.0))))))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double t_1 = exp(l) - exp(-l);
double tmp;
if ((t_1 <= -0.04) || !(t_1 <= 6e-5)) {
tmp = ((t_1 * J) * t_0) + U;
} else {
tmp = U + (t_0 * (J * (l * (2.0 + (0.3333333333333333 * pow(l, 2.0))))));
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = cos((k / 2.0d0))
t_1 = exp(l) - exp(-l)
if ((t_1 <= (-0.04d0)) .or. (.not. (t_1 <= 6d-5))) then
tmp = ((t_1 * j) * t_0) + u
else
tmp = u + (t_0 * (j * (l * (2.0d0 + (0.3333333333333333d0 * (l ** 2.0d0))))))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = Math.cos((K / 2.0));
double t_1 = Math.exp(l) - Math.exp(-l);
double tmp;
if ((t_1 <= -0.04) || !(t_1 <= 6e-5)) {
tmp = ((t_1 * J) * t_0) + U;
} else {
tmp = U + (t_0 * (J * (l * (2.0 + (0.3333333333333333 * Math.pow(l, 2.0))))));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K / 2.0)) t_1 = math.exp(l) - math.exp(-l) tmp = 0 if (t_1 <= -0.04) or not (t_1 <= 6e-5): tmp = ((t_1 * J) * t_0) + U else: tmp = U + (t_0 * (J * (l * (2.0 + (0.3333333333333333 * math.pow(l, 2.0)))))) return tmp
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) t_1 = Float64(exp(l) - exp(Float64(-l))) tmp = 0.0 if ((t_1 <= -0.04) || !(t_1 <= 6e-5)) tmp = Float64(Float64(Float64(t_1 * J) * t_0) + U); else tmp = Float64(U + Float64(t_0 * Float64(J * Float64(l * Float64(2.0 + Float64(0.3333333333333333 * (l ^ 2.0))))))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = cos((K / 2.0)); t_1 = exp(l) - exp(-l); tmp = 0.0; if ((t_1 <= -0.04) || ~((t_1 <= 6e-5))) tmp = ((t_1 * J) * t_0) + U; else tmp = U + (t_0 * (J * (l * (2.0 + (0.3333333333333333 * (l ^ 2.0)))))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -0.04], N[Not[LessEqual[t$95$1, 6e-5]], $MachinePrecision]], N[(N[(N[(t$95$1 * J), $MachinePrecision] * t$95$0), $MachinePrecision] + U), $MachinePrecision], N[(U + N[(t$95$0 * N[(J * N[(l * N[(2.0 + N[(0.3333333333333333 * N[Power[l, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
t_1 := e^{\ell} - e^{-\ell}\\
\mathbf{if}\;t\_1 \leq -0.04 \lor \neg \left(t\_1 \leq 6 \cdot 10^{-5}\right):\\
\;\;\;\;\left(t\_1 \cdot J\right) \cdot t\_0 + U\\
\mathbf{else}:\\
\;\;\;\;U + t\_0 \cdot \left(J \cdot \left(\ell \cdot \left(2 + 0.3333333333333333 \cdot {\ell}^{2}\right)\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -0.0400000000000000008 or 6.00000000000000015e-5 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 99.1%
if -0.0400000000000000008 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 6.00000000000000015e-5Initial program 74.6%
Taylor expanded in l around 0 99.9%
Final simplification99.5%
(FPCore (J l K U) :precision binary64 (if (or (<= l -4.1) (not (<= l 4.0))) (+ U (* (cos (/ K 2.0)) (* 0.0003968253968253968 (* J (pow l 7.0))))) (+ U (* l (* 2.0 (* J (cos (* K 0.5))))))))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -4.1) || !(l <= 4.0)) {
tmp = U + (cos((K / 2.0)) * (0.0003968253968253968 * (J * pow(l, 7.0))));
} else {
tmp = U + (l * (2.0 * (J * 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.1d0)) .or. (.not. (l <= 4.0d0))) then
tmp = u + (cos((k / 2.0d0)) * (0.0003968253968253968d0 * (j * (l ** 7.0d0))))
else
tmp = u + (l * (2.0d0 * (j * 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.1) || !(l <= 4.0)) {
tmp = U + (Math.cos((K / 2.0)) * (0.0003968253968253968 * (J * Math.pow(l, 7.0))));
} else {
tmp = U + (l * (2.0 * (J * Math.cos((K * 0.5)))));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -4.1) or not (l <= 4.0): tmp = U + (math.cos((K / 2.0)) * (0.0003968253968253968 * (J * math.pow(l, 7.0)))) else: tmp = U + (l * (2.0 * (J * math.cos((K * 0.5))))) return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -4.1) || !(l <= 4.0)) tmp = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(0.0003968253968253968 * Float64(J * (l ^ 7.0))))); else tmp = Float64(U + Float64(l * Float64(2.0 * Float64(J * cos(Float64(K * 0.5)))))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -4.1) || ~((l <= 4.0))) tmp = U + (cos((K / 2.0)) * (0.0003968253968253968 * (J * (l ^ 7.0)))); else tmp = U + (l * (2.0 * (J * cos((K * 0.5))))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -4.1], N[Not[LessEqual[l, 4.0]], $MachinePrecision]], N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(0.0003968253968253968 * N[(J * N[Power[l, 7.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(l * N[(2.0 * N[(J * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -4.1 \lor \neg \left(\ell \leq 4\right):\\
\;\;\;\;U + \cos \left(\frac{K}{2}\right) \cdot \left(0.0003968253968253968 \cdot \left(J \cdot {\ell}^{7}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + \ell \cdot \left(2 \cdot \left(J \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\end{array}
\end{array}
if l < -4.0999999999999996 or 4 < l Initial program 99.1%
Taylor expanded in l around 0 87.3%
*-commutative87.3%
Simplified87.3%
Taylor expanded in l around inf 87.3%
if -4.0999999999999996 < l < 4Initial program 75.0%
Taylor expanded in l around 0 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in l around inf 99.0%
Taylor expanded in l around 0 99.0%
Taylor expanded in l around 0 99.1%
*-commutative99.1%
*-commutative99.1%
associate-*r*99.1%
*-commutative99.1%
associate-*l*99.1%
*-commutative99.1%
Simplified99.1%
Final simplification94.2%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.1) (* U (+ 1.0 (* (/ (cos (* K 0.5)) U) (* J (* l 2.0))))) (+ U (* J (* l (+ 2.0 (* 0.0003968253968253968 (pow l 6.0))))))))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.1) {
tmp = U * (1.0 + ((cos((K * 0.5)) / U) * (J * (l * 2.0))));
} else {
tmp = U + (J * (l * (2.0 + (0.0003968253968253968 * pow(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 (cos((k / 2.0d0)) <= (-0.1d0)) then
tmp = u * (1.0d0 + ((cos((k * 0.5d0)) / u) * (j * (l * 2.0d0))))
else
tmp = u + (j * (l * (2.0d0 + (0.0003968253968253968d0 * (l ** 6.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.1) {
tmp = U * (1.0 + ((Math.cos((K * 0.5)) / U) * (J * (l * 2.0))));
} else {
tmp = U + (J * (l * (2.0 + (0.0003968253968253968 * Math.pow(l, 6.0)))));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if math.cos((K / 2.0)) <= -0.1: tmp = U * (1.0 + ((math.cos((K * 0.5)) / U) * (J * (l * 2.0)))) else: tmp = U + (J * (l * (2.0 + (0.0003968253968253968 * math.pow(l, 6.0))))) return tmp
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.1) tmp = Float64(U * Float64(1.0 + Float64(Float64(cos(Float64(K * 0.5)) / U) * Float64(J * Float64(l * 2.0))))); else tmp = Float64(U + Float64(J * Float64(l * Float64(2.0 + Float64(0.0003968253968253968 * (l ^ 6.0)))))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (cos((K / 2.0)) <= -0.1) tmp = U * (1.0 + ((cos((K * 0.5)) / U) * (J * (l * 2.0)))); else tmp = U + (J * (l * (2.0 + (0.0003968253968253968 * (l ^ 6.0))))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.1], N[(U * N[(1.0 + N[(N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] / U), $MachinePrecision] * N[(J * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * N[(l * N[(2.0 + N[(0.0003968253968253968 * N[Power[l, 6.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.1:\\
\;\;\;\;U \cdot \left(1 + \frac{\cos \left(K \cdot 0.5\right)}{U} \cdot \left(J \cdot \left(\ell \cdot 2\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(\ell \cdot \left(2 + 0.0003968253968253968 \cdot {\ell}^{6}\right)\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.10000000000000001Initial program 79.3%
Taylor expanded in l around 0 73.4%
*-commutative73.4%
associate-*r*73.4%
Simplified73.4%
Taylor expanded in U around inf 76.2%
associate-*r/76.2%
associate-*r*76.2%
*-commutative76.2%
Simplified76.2%
associate-*r*76.2%
*-un-lft-identity76.2%
times-frac76.2%
*-commutative76.2%
Applied egg-rr76.2%
/-rgt-identity76.2%
associate-*l*76.2%
*-commutative76.2%
Simplified76.2%
if -0.10000000000000001 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 86.7%
Taylor expanded in l around 0 94.6%
*-commutative94.6%
Simplified94.6%
Taylor expanded in l around inf 93.9%
Taylor expanded in K around 0 90.6%
Final simplification87.2%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.1) (+ U (* U (* (* J 2.0) (/ (* l (cos (* K 0.5))) U)))) (+ U (* J (* l (+ 2.0 (* 0.0003968253968253968 (pow l 6.0))))))))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.1) {
tmp = U + (U * ((J * 2.0) * ((l * cos((K * 0.5))) / U)));
} else {
tmp = U + (J * (l * (2.0 + (0.0003968253968253968 * pow(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 (cos((k / 2.0d0)) <= (-0.1d0)) then
tmp = u + (u * ((j * 2.0d0) * ((l * cos((k * 0.5d0))) / u)))
else
tmp = u + (j * (l * (2.0d0 + (0.0003968253968253968d0 * (l ** 6.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.1) {
tmp = U + (U * ((J * 2.0) * ((l * Math.cos((K * 0.5))) / U)));
} else {
tmp = U + (J * (l * (2.0 + (0.0003968253968253968 * Math.pow(l, 6.0)))));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if math.cos((K / 2.0)) <= -0.1: tmp = U + (U * ((J * 2.0) * ((l * math.cos((K * 0.5))) / U))) else: tmp = U + (J * (l * (2.0 + (0.0003968253968253968 * math.pow(l, 6.0))))) return tmp
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.1) tmp = Float64(U + Float64(U * Float64(Float64(J * 2.0) * Float64(Float64(l * cos(Float64(K * 0.5))) / U)))); else tmp = Float64(U + Float64(J * Float64(l * Float64(2.0 + Float64(0.0003968253968253968 * (l ^ 6.0)))))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (cos((K / 2.0)) <= -0.1) tmp = U + (U * ((J * 2.0) * ((l * cos((K * 0.5))) / U))); else tmp = U + (J * (l * (2.0 + (0.0003968253968253968 * (l ^ 6.0))))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.1], N[(U + N[(U * N[(N[(J * 2.0), $MachinePrecision] * N[(N[(l * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * N[(l * N[(2.0 + N[(0.0003968253968253968 * N[Power[l, 6.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.1:\\
\;\;\;\;U + U \cdot \left(\left(J \cdot 2\right) \cdot \frac{\ell \cdot \cos \left(K \cdot 0.5\right)}{U}\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(\ell \cdot \left(2 + 0.0003968253968253968 \cdot {\ell}^{6}\right)\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.10000000000000001Initial program 79.3%
Taylor expanded in l around 0 73.4%
*-commutative73.4%
associate-*r*73.4%
Simplified73.4%
Taylor expanded in U around inf 76.2%
associate-*r/76.2%
associate-*r*76.2%
*-commutative76.2%
Simplified76.2%
distribute-rgt-in76.2%
*-un-lft-identity76.2%
associate-/l*80.9%
*-commutative80.9%
Applied egg-rr80.9%
if -0.10000000000000001 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 86.7%
Taylor expanded in l around 0 94.6%
*-commutative94.6%
Simplified94.6%
Taylor expanded in l around inf 93.9%
Taylor expanded in K around 0 90.6%
Final simplification88.3%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.1) (+ U (* l (* 2.0 (* J (cos (* K 0.5)))))) (+ U (* J (* l (+ 2.0 (* 0.0003968253968253968 (pow l 6.0))))))))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.1) {
tmp = U + (l * (2.0 * (J * cos((K * 0.5)))));
} else {
tmp = U + (J * (l * (2.0 + (0.0003968253968253968 * pow(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 (cos((k / 2.0d0)) <= (-0.1d0)) then
tmp = u + (l * (2.0d0 * (j * cos((k * 0.5d0)))))
else
tmp = u + (j * (l * (2.0d0 + (0.0003968253968253968d0 * (l ** 6.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.1) {
tmp = U + (l * (2.0 * (J * Math.cos((K * 0.5)))));
} else {
tmp = U + (J * (l * (2.0 + (0.0003968253968253968 * Math.pow(l, 6.0)))));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if math.cos((K / 2.0)) <= -0.1: tmp = U + (l * (2.0 * (J * math.cos((K * 0.5))))) else: tmp = U + (J * (l * (2.0 + (0.0003968253968253968 * math.pow(l, 6.0))))) return tmp
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.1) tmp = Float64(U + Float64(l * Float64(2.0 * Float64(J * cos(Float64(K * 0.5)))))); else tmp = Float64(U + Float64(J * Float64(l * Float64(2.0 + Float64(0.0003968253968253968 * (l ^ 6.0)))))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (cos((K / 2.0)) <= -0.1) tmp = U + (l * (2.0 * (J * cos((K * 0.5))))); else tmp = U + (J * (l * (2.0 + (0.0003968253968253968 * (l ^ 6.0))))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.1], N[(U + N[(l * N[(2.0 * N[(J * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * N[(l * N[(2.0 + N[(0.0003968253968253968 * N[Power[l, 6.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.1:\\
\;\;\;\;U + \ell \cdot \left(2 \cdot \left(J \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(\ell \cdot \left(2 + 0.0003968253968253968 \cdot {\ell}^{6}\right)\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.10000000000000001Initial program 79.3%
Taylor expanded in l around 0 95.0%
*-commutative95.0%
Simplified95.0%
Taylor expanded in l around inf 95.0%
Taylor expanded in l around 0 91.9%
Taylor expanded in l around 0 73.4%
*-commutative73.4%
*-commutative73.4%
associate-*r*73.4%
*-commutative73.4%
associate-*l*73.4%
*-commutative73.4%
Simplified73.4%
if -0.10000000000000001 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 86.7%
Taylor expanded in l around 0 94.6%
*-commutative94.6%
Simplified94.6%
Taylor expanded in l around inf 93.9%
Taylor expanded in K around 0 90.6%
Final simplification86.5%
(FPCore (J l K U) :precision binary64 (+ U (* (cos (/ K 2.0)) (* J (* l (+ 2.0 (* 0.0003968253968253968 (pow l 6.0))))))))
double code(double J, double l, double K, double U) {
return U + (cos((K / 2.0)) * (J * (l * (2.0 + (0.0003968253968253968 * pow(l, 6.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 + (0.0003968253968253968d0 * (l ** 6.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 + (0.0003968253968253968 * Math.pow(l, 6.0))))));
}
def code(J, l, K, U): return U + (math.cos((K / 2.0)) * (J * (l * (2.0 + (0.0003968253968253968 * math.pow(l, 6.0))))))
function code(J, l, K, U) return Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(J * Float64(l * Float64(2.0 + Float64(0.0003968253968253968 * (l ^ 6.0))))))) end
function tmp = code(J, l, K, U) tmp = U + (cos((K / 2.0)) * (J * (l * (2.0 + (0.0003968253968253968 * (l ^ 6.0)))))); 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[(0.0003968253968253968 * N[Power[l, 6.0], $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 + 0.0003968253968253968 \cdot {\ell}^{6}\right)\right)\right)
\end{array}
Initial program 85.0%
Taylor expanded in l around 0 94.7%
*-commutative94.7%
Simplified94.7%
Taylor expanded in l around inf 94.2%
Final simplification94.2%
(FPCore (J l K U) :precision binary64 (if (or (<= l -2.5e+48) (not (<= l 9.5))) (+ U (* (pow l 7.0) (* J 0.0003968253968253968))) (+ U (* 2.0 (* J (* l (cos (* K 0.5))))))))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -2.5e+48) || !(l <= 9.5)) {
tmp = U + (pow(l, 7.0) * (J * 0.0003968253968253968));
} 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 <= (-2.5d+48)) .or. (.not. (l <= 9.5d0))) then
tmp = u + ((l ** 7.0d0) * (j * 0.0003968253968253968d0))
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 <= -2.5e+48) || !(l <= 9.5)) {
tmp = U + (Math.pow(l, 7.0) * (J * 0.0003968253968253968));
} else {
tmp = U + (2.0 * (J * (l * Math.cos((K * 0.5)))));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -2.5e+48) or not (l <= 9.5): tmp = U + (math.pow(l, 7.0) * (J * 0.0003968253968253968)) 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 <= -2.5e+48) || !(l <= 9.5)) tmp = Float64(U + Float64((l ^ 7.0) * Float64(J * 0.0003968253968253968))); 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 <= -2.5e+48) || ~((l <= 9.5))) tmp = U + ((l ^ 7.0) * (J * 0.0003968253968253968)); 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, -2.5e+48], N[Not[LessEqual[l, 9.5]], $MachinePrecision]], N[(U + N[(N[Power[l, 7.0], $MachinePrecision] * N[(J * 0.0003968253968253968), $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 -2.5 \cdot 10^{+48} \lor \neg \left(\ell \leq 9.5\right):\\
\;\;\;\;U + {\ell}^{7} \cdot \left(J \cdot 0.0003968253968253968\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 < -2.49999999999999987e48 or 9.5 < l Initial program 99.1%
Taylor expanded in l around 0 93.1%
*-commutative93.1%
Simplified93.1%
Taylor expanded in l around inf 93.1%
Taylor expanded in l around inf 93.1%
associate-*r*93.1%
*-commutative93.1%
Simplified93.1%
Taylor expanded in K around 0 73.6%
if -2.49999999999999987e48 < l < 9.5Initial program 76.2%
Taylor expanded in l around 0 94.3%
Final simplification86.4%
(FPCore (J l K U) :precision binary64 (if (or (<= l -2.5e+48) (not (<= l 960.0))) (+ U (* (pow l 7.0) (* J 0.0003968253968253968))) (+ U (* l (* 2.0 (* J (cos (* K 0.5))))))))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -2.5e+48) || !(l <= 960.0)) {
tmp = U + (pow(l, 7.0) * (J * 0.0003968253968253968));
} else {
tmp = U + (l * (2.0 * (J * 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 <= (-2.5d+48)) .or. (.not. (l <= 960.0d0))) then
tmp = u + ((l ** 7.0d0) * (j * 0.0003968253968253968d0))
else
tmp = u + (l * (2.0d0 * (j * 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 <= -2.5e+48) || !(l <= 960.0)) {
tmp = U + (Math.pow(l, 7.0) * (J * 0.0003968253968253968));
} else {
tmp = U + (l * (2.0 * (J * Math.cos((K * 0.5)))));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -2.5e+48) or not (l <= 960.0): tmp = U + (math.pow(l, 7.0) * (J * 0.0003968253968253968)) else: tmp = U + (l * (2.0 * (J * math.cos((K * 0.5))))) return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -2.5e+48) || !(l <= 960.0)) tmp = Float64(U + Float64((l ^ 7.0) * Float64(J * 0.0003968253968253968))); else tmp = Float64(U + Float64(l * Float64(2.0 * Float64(J * cos(Float64(K * 0.5)))))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -2.5e+48) || ~((l <= 960.0))) tmp = U + ((l ^ 7.0) * (J * 0.0003968253968253968)); else tmp = U + (l * (2.0 * (J * cos((K * 0.5))))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -2.5e+48], N[Not[LessEqual[l, 960.0]], $MachinePrecision]], N[(U + N[(N[Power[l, 7.0], $MachinePrecision] * N[(J * 0.0003968253968253968), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(l * N[(2.0 * N[(J * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2.5 \cdot 10^{+48} \lor \neg \left(\ell \leq 960\right):\\
\;\;\;\;U + {\ell}^{7} \cdot \left(J \cdot 0.0003968253968253968\right)\\
\mathbf{else}:\\
\;\;\;\;U + \ell \cdot \left(2 \cdot \left(J \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\end{array}
\end{array}
if l < -2.49999999999999987e48 or 960 < l Initial program 99.1%
Taylor expanded in l around 0 93.1%
*-commutative93.1%
Simplified93.1%
Taylor expanded in l around inf 93.1%
Taylor expanded in l around inf 93.1%
associate-*r*93.1%
*-commutative93.1%
Simplified93.1%
Taylor expanded in K around 0 73.6%
if -2.49999999999999987e48 < l < 960Initial program 76.2%
Taylor expanded in l around 0 95.7%
*-commutative95.7%
Simplified95.7%
Taylor expanded in l around inf 94.9%
Taylor expanded in l around 0 94.3%
Taylor expanded in l around 0 94.3%
*-commutative94.3%
*-commutative94.3%
associate-*r*94.3%
*-commutative94.3%
associate-*l*94.3%
*-commutative94.3%
Simplified94.3%
Final simplification86.4%
(FPCore (J l K U) :precision binary64 (if (or (<= l -2.5e+48) (not (<= l 4.0))) (+ U (* (pow l 7.0) (* J 0.0003968253968253968))) (+ U (* J (* l 2.0)))))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -2.5e+48) || !(l <= 4.0)) {
tmp = U + (pow(l, 7.0) * (J * 0.0003968253968253968));
} else {
tmp = U + (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 <= (-2.5d+48)) .or. (.not. (l <= 4.0d0))) then
tmp = u + ((l ** 7.0d0) * (j * 0.0003968253968253968d0))
else
tmp = u + (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 <= -2.5e+48) || !(l <= 4.0)) {
tmp = U + (Math.pow(l, 7.0) * (J * 0.0003968253968253968));
} else {
tmp = U + (J * (l * 2.0));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -2.5e+48) or not (l <= 4.0): tmp = U + (math.pow(l, 7.0) * (J * 0.0003968253968253968)) else: tmp = U + (J * (l * 2.0)) return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -2.5e+48) || !(l <= 4.0)) tmp = Float64(U + Float64((l ^ 7.0) * Float64(J * 0.0003968253968253968))); else tmp = Float64(U + Float64(J * Float64(l * 2.0))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -2.5e+48) || ~((l <= 4.0))) tmp = U + ((l ^ 7.0) * (J * 0.0003968253968253968)); else tmp = U + (J * (l * 2.0)); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -2.5e+48], N[Not[LessEqual[l, 4.0]], $MachinePrecision]], N[(U + N[(N[Power[l, 7.0], $MachinePrecision] * N[(J * 0.0003968253968253968), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2.5 \cdot 10^{+48} \lor \neg \left(\ell \leq 4\right):\\
\;\;\;\;U + {\ell}^{7} \cdot \left(J \cdot 0.0003968253968253968\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(\ell \cdot 2\right)\\
\end{array}
\end{array}
if l < -2.49999999999999987e48 or 4 < l Initial program 99.1%
Taylor expanded in l around 0 93.1%
*-commutative93.1%
Simplified93.1%
Taylor expanded in l around inf 93.1%
Taylor expanded in l around inf 93.1%
associate-*r*93.1%
*-commutative93.1%
Simplified93.1%
Taylor expanded in K around 0 73.6%
if -2.49999999999999987e48 < l < 4Initial program 76.2%
Taylor expanded in l around 0 94.2%
*-commutative94.2%
associate-*r*94.2%
Simplified94.2%
Taylor expanded in K around 0 82.1%
*-commutative82.1%
associate-*r*82.1%
Simplified82.1%
Final simplification78.9%
(FPCore (J l K U) :precision binary64 (if (or (<= l -3100000000.0) (not (<= l 2.8e+95))) (* J (/ U J)) U))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -3100000000.0) || !(l <= 2.8e+95)) {
tmp = J * (U / J);
} else {
tmp = U;
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if ((l <= (-3100000000.0d0)) .or. (.not. (l <= 2.8d+95))) then
tmp = j * (u / j)
else
tmp = u
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -3100000000.0) || !(l <= 2.8e+95)) {
tmp = J * (U / J);
} else {
tmp = U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -3100000000.0) or not (l <= 2.8e+95): tmp = J * (U / J) else: tmp = U return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -3100000000.0) || !(l <= 2.8e+95)) tmp = Float64(J * Float64(U / J)); else tmp = U; end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -3100000000.0) || ~((l <= 2.8e+95))) tmp = J * (U / J); else tmp = U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -3100000000.0], N[Not[LessEqual[l, 2.8e+95]], $MachinePrecision]], N[(J * N[(U / J), $MachinePrecision]), $MachinePrecision], U]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -3100000000 \lor \neg \left(\ell \leq 2.8 \cdot 10^{+95}\right):\\
\;\;\;\;J \cdot \frac{U}{J}\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\end{array}
if l < -3.1e9 or 2.7999999999999998e95 < l Initial program 100.0%
Applied egg-rr2.9%
Taylor expanded in J around inf 18.8%
Taylor expanded in U around inf 18.5%
if -3.1e9 < l < 2.7999999999999998e95Initial program 77.1%
Applied egg-rr45.8%
Taylor expanded in J around 0 65.0%
Final simplification49.1%
(FPCore (J l K U) :precision binary64 (* U (+ 1.0 (* (* J 2.0) (/ l U)))))
double code(double J, double l, double K, double U) {
return U * (1.0 + ((J * 2.0) * (l / 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 * (1.0d0 + ((j * 2.0d0) * (l / u)))
end function
public static double code(double J, double l, double K, double U) {
return U * (1.0 + ((J * 2.0) * (l / U)));
}
def code(J, l, K, U): return U * (1.0 + ((J * 2.0) * (l / U)))
function code(J, l, K, U) return Float64(U * Float64(1.0 + Float64(Float64(J * 2.0) * Float64(l / U)))) end
function tmp = code(J, l, K, U) tmp = U * (1.0 + ((J * 2.0) * (l / U))); end
code[J_, l_, K_, U_] := N[(U * N[(1.0 + N[(N[(J * 2.0), $MachinePrecision] * N[(l / U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U \cdot \left(1 + \left(J \cdot 2\right) \cdot \frac{\ell}{U}\right)
\end{array}
Initial program 85.0%
Taylor expanded in l around 0 68.2%
*-commutative68.2%
associate-*r*68.2%
Simplified68.2%
Taylor expanded in U around inf 71.0%
associate-*r/71.0%
associate-*r*71.0%
*-commutative71.0%
Simplified71.0%
Taylor expanded in K around 0 60.5%
associate-*r/60.5%
associate-*r*60.5%
*-commutative60.5%
associate-/l*62.0%
*-commutative62.0%
Simplified62.0%
Final simplification62.0%
(FPCore (J l K U) :precision binary64 (+ U (* J (* l 2.0))))
double code(double J, double l, double K, double U) {
return U + (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 + (j * (l * 2.0d0))
end function
public static double code(double J, double l, double K, double U) {
return U + (J * (l * 2.0));
}
def code(J, l, K, U): return U + (J * (l * 2.0))
function code(J, l, K, U) return Float64(U + Float64(J * Float64(l * 2.0))) end
function tmp = code(J, l, K, U) tmp = U + (J * (l * 2.0)); end
code[J_, l_, K_, U_] := N[(U + N[(J * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + J \cdot \left(\ell \cdot 2\right)
\end{array}
Initial program 85.0%
Taylor expanded in l around 0 68.2%
*-commutative68.2%
associate-*r*68.2%
Simplified68.2%
Taylor expanded in K around 0 58.1%
*-commutative58.1%
associate-*r*58.1%
Simplified58.1%
Final simplification58.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.0%
Applied egg-rr31.1%
Taylor expanded in J around 0 43.6%
Final simplification43.6%
herbie shell --seed 2024115
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))