
(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 (+ (* 2.0 (* J (log1p (expm1 (* l (cos (* 0.5 K))))))) U))
double code(double J, double l, double K, double U) {
return (2.0 * (J * log1p(expm1((l * cos((0.5 * K))))))) + U;
}
public static double code(double J, double l, double K, double U) {
return (2.0 * (J * Math.log1p(Math.expm1((l * Math.cos((0.5 * K))))))) + U;
}
def code(J, l, K, U): return (2.0 * (J * math.log1p(math.expm1((l * math.cos((0.5 * K))))))) + U
function code(J, l, K, U) return Float64(Float64(2.0 * Float64(J * log1p(expm1(Float64(l * cos(Float64(0.5 * K))))))) + U) end
code[J_, l_, K_, U_] := N[(N[(2.0 * N[(J * N[Log[1 + N[(Exp[N[(l * N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]
\begin{array}{l}
\\
2 \cdot \left(J \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(\ell \cdot \cos \left(0.5 \cdot K\right)\right)\right)\right) + U
\end{array}
Initial program 87.0%
Taylor expanded in l around 0 65.9%
log1p-expm1-u100.0%
Applied egg-rr100.0%
Final simplification100.0%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (- (exp l) (exp (- l)))))
(if (or (<= t_0 (- INFINITY)) (not (<= t_0 1e-9)))
(+ U (* J t_0))
(+ U (* 2.0 (* J (* l (cos (* 0.5 K)))))))))
double code(double J, double l, double K, double U) {
double t_0 = exp(l) - exp(-l);
double tmp;
if ((t_0 <= -((double) INFINITY)) || !(t_0 <= 1e-9)) {
tmp = U + (J * t_0);
} else {
tmp = U + (2.0 * (J * (l * cos((0.5 * K)))));
}
return tmp;
}
public static double code(double J, double l, double K, double U) {
double t_0 = Math.exp(l) - Math.exp(-l);
double tmp;
if ((t_0 <= -Double.POSITIVE_INFINITY) || !(t_0 <= 1e-9)) {
tmp = U + (J * t_0);
} else {
tmp = U + (2.0 * (J * (l * Math.cos((0.5 * K)))));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.exp(l) - math.exp(-l) tmp = 0 if (t_0 <= -math.inf) or not (t_0 <= 1e-9): tmp = U + (J * t_0) else: tmp = U + (2.0 * (J * (l * math.cos((0.5 * K))))) return tmp
function code(J, l, K, U) t_0 = Float64(exp(l) - exp(Float64(-l))) tmp = 0.0 if ((t_0 <= Float64(-Inf)) || !(t_0 <= 1e-9)) tmp = Float64(U + Float64(J * t_0)); else tmp = Float64(U + Float64(2.0 * Float64(J * Float64(l * cos(Float64(0.5 * K)))))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = exp(l) - exp(-l); tmp = 0.0; if ((t_0 <= -Inf) || ~((t_0 <= 1e-9))) tmp = U + (J * t_0); else tmp = U + (2.0 * (J * (l * cos((0.5 * K))))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, (-Infinity)], N[Not[LessEqual[t$95$0, 1e-9]], $MachinePrecision]], N[(U + N[(J * t$95$0), $MachinePrecision]), $MachinePrecision], N[(U + N[(2.0 * N[(J * N[(l * N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{\ell} - e^{-\ell}\\
\mathbf{if}\;t\_0 \leq -\infty \lor \neg \left(t\_0 \leq 10^{-9}\right):\\
\;\;\;\;U + J \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;U + 2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(0.5 \cdot K\right)\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -inf.0 or 1.00000000000000006e-9 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 100.0%
Taylor expanded in K around 0 74.6%
if -inf.0 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 1.00000000000000006e-9Initial program 75.2%
Taylor expanded in l around 0 99.9%
Final simplification87.8%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0)))
(t_1 (+ U (* t_0 (* J (* 0.3333333333333333 (pow l 3.0))))))
(t_2 (+ U (* J (- (exp l) (exp (- l)))))))
(if (<= l -2.8e+74)
t_1
(if (<= l -0.001)
t_2
(if (<= l 8e-7)
(fma J (* t_0 (* 2.0 l)) U)
(if (<= l 1.85e+90) t_2 t_1))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double t_1 = U + (t_0 * (J * (0.3333333333333333 * pow(l, 3.0))));
double t_2 = U + (J * (exp(l) - exp(-l)));
double tmp;
if (l <= -2.8e+74) {
tmp = t_1;
} else if (l <= -0.001) {
tmp = t_2;
} else if (l <= 8e-7) {
tmp = fma(J, (t_0 * (2.0 * l)), U);
} else if (l <= 1.85e+90) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) t_1 = Float64(U + Float64(t_0 * Float64(J * Float64(0.3333333333333333 * (l ^ 3.0))))) t_2 = Float64(U + Float64(J * Float64(exp(l) - exp(Float64(-l))))) tmp = 0.0 if (l <= -2.8e+74) tmp = t_1; elseif (l <= -0.001) tmp = t_2; elseif (l <= 8e-7) tmp = fma(J, Float64(t_0 * Float64(2.0 * l)), U); elseif (l <= 1.85e+90) tmp = t_2; else tmp = t_1; end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(U + N[(t$95$0 * N[(J * N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(U + N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -2.8e+74], t$95$1, If[LessEqual[l, -0.001], t$95$2, If[LessEqual[l, 8e-7], N[(J * N[(t$95$0 * N[(2.0 * l), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], If[LessEqual[l, 1.85e+90], t$95$2, t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
t_1 := U + t\_0 \cdot \left(J \cdot \left(0.3333333333333333 \cdot {\ell}^{3}\right)\right)\\
t_2 := U + J \cdot \left(e^{\ell} - e^{-\ell}\right)\\
\mathbf{if}\;\ell \leq -2.8 \cdot 10^{+74}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\ell \leq -0.001:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;\ell \leq 8 \cdot 10^{-7}:\\
\;\;\;\;\mathsf{fma}\left(J, t\_0 \cdot \left(2 \cdot \ell\right), U\right)\\
\mathbf{elif}\;\ell \leq 1.85 \cdot 10^{+90}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if l < -2.80000000000000002e74 or 1.85e90 < l Initial program 100.0%
Taylor expanded in l around 0 95.9%
Taylor expanded in l around inf 95.9%
associate-*r*95.9%
*-commutative95.9%
associate-*r*95.9%
Simplified95.9%
if -2.80000000000000002e74 < l < -1e-3 or 7.9999999999999996e-7 < l < 1.85e90Initial program 100.0%
Taylor expanded in K around 0 71.9%
if -1e-3 < l < 7.9999999999999996e-7Initial program 75.2%
associate-*l*75.2%
fma-define75.2%
Simplified75.2%
Taylor expanded in l around 0 99.9%
Final simplification95.0%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.06) (* U (+ 1.0 (/ (* (* l (cos (* 0.5 K))) (* 2.0 J)) U))) (+ U (* J (* l (+ 2.0 (* 0.3333333333333333 (pow l 2.0))))))))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.06) {
tmp = U * (1.0 + (((l * cos((0.5 * K))) * (2.0 * J)) / U));
} else {
tmp = U + (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) :: tmp
if (cos((k / 2.0d0)) <= (-0.06d0)) then
tmp = u * (1.0d0 + (((l * cos((0.5d0 * k))) * (2.0d0 * j)) / u))
else
tmp = u + (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 tmp;
if (Math.cos((K / 2.0)) <= -0.06) {
tmp = U * (1.0 + (((l * Math.cos((0.5 * K))) * (2.0 * J)) / U));
} else {
tmp = U + (J * (l * (2.0 + (0.3333333333333333 * Math.pow(l, 2.0)))));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if math.cos((K / 2.0)) <= -0.06: tmp = U * (1.0 + (((l * math.cos((0.5 * K))) * (2.0 * J)) / U)) else: tmp = U + (J * (l * (2.0 + (0.3333333333333333 * math.pow(l, 2.0))))) return tmp
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.06) tmp = Float64(U * Float64(1.0 + Float64(Float64(Float64(l * cos(Float64(0.5 * K))) * Float64(2.0 * J)) / U))); else tmp = Float64(U + 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) tmp = 0.0; if (cos((K / 2.0)) <= -0.06) tmp = U * (1.0 + (((l * cos((0.5 * K))) * (2.0 * J)) / U)); else tmp = U + (J * (l * (2.0 + (0.3333333333333333 * (l ^ 2.0))))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.06], N[(U * N[(1.0 + N[(N[(N[(l * N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(2.0 * J), $MachinePrecision]), $MachinePrecision] / U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * N[(l * N[(2.0 + N[(0.3333333333333333 * N[Power[l, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.06:\\
\;\;\;\;U \cdot \left(1 + \frac{\left(\ell \cdot \cos \left(0.5 \cdot K\right)\right) \cdot \left(2 \cdot J\right)}{U}\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(\ell \cdot \left(2 + 0.3333333333333333 \cdot {\ell}^{2}\right)\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.059999999999999998Initial program 85.6%
Taylor expanded in l around 0 65.5%
Taylor expanded in U around inf 70.0%
associate-*r/70.0%
associate-*r*70.0%
*-commutative70.0%
*-commutative70.0%
Simplified70.0%
if -0.059999999999999998 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 87.5%
Taylor expanded in l around 0 90.1%
Taylor expanded in K around 0 86.5%
Final simplification82.6%
(FPCore (J l K U) :precision binary64 (if (or (<= l -0.000115) (not (<= l 8e-7))) (+ U (* J (- (exp l) (exp (- l))))) (fma J (* (cos (/ K 2.0)) (* 2.0 l)) U)))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -0.000115) || !(l <= 8e-7)) {
tmp = U + (J * (exp(l) - exp(-l)));
} else {
tmp = fma(J, (cos((K / 2.0)) * (2.0 * l)), U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if ((l <= -0.000115) || !(l <= 8e-7)) tmp = Float64(U + Float64(J * Float64(exp(l) - exp(Float64(-l))))); else tmp = fma(J, Float64(cos(Float64(K / 2.0)) * Float64(2.0 * l)), U); end return tmp end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -0.000115], N[Not[LessEqual[l, 8e-7]], $MachinePrecision]], N[(U + N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(J * N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(2.0 * l), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -0.000115 \lor \neg \left(\ell \leq 8 \cdot 10^{-7}\right):\\
\;\;\;\;U + J \cdot \left(e^{\ell} - e^{-\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(J, \cos \left(\frac{K}{2}\right) \cdot \left(2 \cdot \ell\right), U\right)\\
\end{array}
\end{array}
if l < -1.15e-4 or 7.9999999999999996e-7 < l Initial program 100.0%
Taylor expanded in K around 0 74.6%
if -1.15e-4 < l < 7.9999999999999996e-7Initial program 75.2%
associate-*l*75.2%
fma-define75.2%
Simplified75.2%
Taylor expanded in l around 0 99.9%
Final simplification87.9%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.06) (+ U (* l (* (cos (* 0.5 K)) (* 2.0 J)))) (+ U (* J (* l (+ 2.0 (* 0.3333333333333333 (pow l 2.0))))))))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.06) {
tmp = U + (l * (cos((0.5 * K)) * (2.0 * J)));
} else {
tmp = U + (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) :: tmp
if (cos((k / 2.0d0)) <= (-0.06d0)) then
tmp = u + (l * (cos((0.5d0 * k)) * (2.0d0 * j)))
else
tmp = u + (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 tmp;
if (Math.cos((K / 2.0)) <= -0.06) {
tmp = U + (l * (Math.cos((0.5 * K)) * (2.0 * J)));
} else {
tmp = U + (J * (l * (2.0 + (0.3333333333333333 * Math.pow(l, 2.0)))));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if math.cos((K / 2.0)) <= -0.06: tmp = U + (l * (math.cos((0.5 * K)) * (2.0 * J))) else: tmp = U + (J * (l * (2.0 + (0.3333333333333333 * math.pow(l, 2.0))))) return tmp
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.06) tmp = Float64(U + Float64(l * Float64(cos(Float64(0.5 * K)) * Float64(2.0 * J)))); else tmp = Float64(U + 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) tmp = 0.0; if (cos((K / 2.0)) <= -0.06) tmp = U + (l * (cos((0.5 * K)) * (2.0 * J))); else tmp = U + (J * (l * (2.0 + (0.3333333333333333 * (l ^ 2.0))))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.06], N[(U + N[(l * N[(N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision] * N[(2.0 * J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * N[(l * N[(2.0 + N[(0.3333333333333333 * N[Power[l, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.06:\\
\;\;\;\;U + \ell \cdot \left(\cos \left(0.5 \cdot K\right) \cdot \left(2 \cdot J\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(\ell \cdot \left(2 + 0.3333333333333333 \cdot {\ell}^{2}\right)\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.059999999999999998Initial program 85.6%
Taylor expanded in l around 0 83.0%
*-commutative83.0%
associate-*r*83.0%
associate-*r*83.0%
*-commutative83.0%
associate-*r*83.0%
*-commutative83.0%
associate-*r*83.0%
distribute-rgt-out83.0%
associate-*r*83.0%
*-commutative83.0%
distribute-rgt-out83.0%
+-commutative83.0%
*-commutative83.0%
Simplified83.0%
Taylor expanded in l around 0 65.5%
*-commutative65.5%
*-commutative65.5%
associate-*l*65.5%
Simplified65.5%
if -0.059999999999999998 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 87.5%
Taylor expanded in l around 0 90.1%
Taylor expanded in K around 0 86.5%
Final simplification81.5%
(FPCore (J l K U) :precision binary64 (+ U (* (* J (* l (+ 2.0 (* 0.3333333333333333 (pow l 2.0))))) (cos (/ K 2.0)))))
double code(double J, double l, double K, double U) {
return U + ((J * (l * (2.0 + (0.3333333333333333 * pow(l, 2.0))))) * cos((K / 2.0)));
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = u + ((j * (l * (2.0d0 + (0.3333333333333333d0 * (l ** 2.0d0))))) * cos((k / 2.0d0)))
end function
public static double code(double J, double l, double K, double U) {
return U + ((J * (l * (2.0 + (0.3333333333333333 * Math.pow(l, 2.0))))) * Math.cos((K / 2.0)));
}
def code(J, l, K, U): return U + ((J * (l * (2.0 + (0.3333333333333333 * math.pow(l, 2.0))))) * math.cos((K / 2.0)))
function code(J, l, K, U) return Float64(U + Float64(Float64(J * Float64(l * Float64(2.0 + Float64(0.3333333333333333 * (l ^ 2.0))))) * cos(Float64(K / 2.0)))) end
function tmp = code(J, l, K, U) tmp = U + ((J * (l * (2.0 + (0.3333333333333333 * (l ^ 2.0))))) * cos((K / 2.0))); end
code[J_, l_, K_, U_] := N[(U + N[(N[(J * N[(l * N[(2.0 + N[(0.3333333333333333 * N[Power[l, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + \left(J \cdot \left(\ell \cdot \left(2 + 0.3333333333333333 \cdot {\ell}^{2}\right)\right)\right) \cdot \cos \left(\frac{K}{2}\right)
\end{array}
Initial program 87.0%
Taylor expanded in l around 0 88.8%
Final simplification88.8%
(FPCore (J l K U)
:precision binary64
(if (<= l -1.12e+104)
(+ U (* J (* 2.0 l)))
(if (<= l -4200000.0)
(/ (+ 0.25 (/ (+ (/ (+ 0.140625 (/ 0.10546875 U)) U) -0.1875) U)) U)
(if (<= l 700.0)
(fma l (* 2.0 J) U)
(/ (+ 0.25 (/ (+ 0.1875 (/ -0.140625 U)) U)) (- U))))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -1.12e+104) {
tmp = U + (J * (2.0 * l));
} else if (l <= -4200000.0) {
tmp = (0.25 + ((((0.140625 + (0.10546875 / U)) / U) + -0.1875) / U)) / U;
} else if (l <= 700.0) {
tmp = fma(l, (2.0 * J), U);
} else {
tmp = (0.25 + ((0.1875 + (-0.140625 / U)) / U)) / -U;
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (l <= -1.12e+104) tmp = Float64(U + Float64(J * Float64(2.0 * l))); elseif (l <= -4200000.0) tmp = Float64(Float64(0.25 + Float64(Float64(Float64(Float64(0.140625 + Float64(0.10546875 / U)) / U) + -0.1875) / U)) / U); elseif (l <= 700.0) tmp = fma(l, Float64(2.0 * J), U); else tmp = Float64(Float64(0.25 + Float64(Float64(0.1875 + Float64(-0.140625 / U)) / U)) / Float64(-U)); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[l, -1.12e+104], N[(U + N[(J * N[(2.0 * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -4200000.0], N[(N[(0.25 + N[(N[(N[(N[(0.140625 + N[(0.10546875 / U), $MachinePrecision]), $MachinePrecision] / U), $MachinePrecision] + -0.1875), $MachinePrecision] / U), $MachinePrecision]), $MachinePrecision] / U), $MachinePrecision], If[LessEqual[l, 700.0], N[(l * N[(2.0 * J), $MachinePrecision] + U), $MachinePrecision], N[(N[(0.25 + N[(N[(0.1875 + N[(-0.140625 / U), $MachinePrecision]), $MachinePrecision] / U), $MachinePrecision]), $MachinePrecision] / (-U)), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.12 \cdot 10^{+104}:\\
\;\;\;\;U + J \cdot \left(2 \cdot \ell\right)\\
\mathbf{elif}\;\ell \leq -4200000:\\
\;\;\;\;\frac{0.25 + \frac{\frac{0.140625 + \frac{0.10546875}{U}}{U} + -0.1875}{U}}{U}\\
\mathbf{elif}\;\ell \leq 700:\\
\;\;\;\;\mathsf{fma}\left(\ell, 2 \cdot J, U\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{0.25 + \frac{0.1875 + \frac{-0.140625}{U}}{U}}{-U}\\
\end{array}
\end{array}
if l < -1.12000000000000003e104Initial program 100.0%
Taylor expanded in l around 0 35.6%
Taylor expanded in K around 0 25.7%
associate-*r*25.7%
*-commutative25.7%
associate-*l*25.7%
Simplified25.7%
if -1.12000000000000003e104 < l < -4.2e6Initial program 100.0%
Applied egg-rr1.4%
associate-+r+1.4%
distribute-rgt1-in1.4%
metadata-eval1.4%
*-commutative1.4%
distribute-lft-out1.4%
associate-/r*1.4%
*-inverses1.4%
+-commutative1.4%
*-commutative1.4%
Simplified1.4%
Taylor expanded in U around -inf 50.5%
mul-1-neg50.5%
distribute-neg-frac250.5%
mul-1-neg50.5%
unsub-neg50.5%
mul-1-neg50.5%
unsub-neg50.5%
associate-*r/50.5%
metadata-eval50.5%
Simplified50.5%
add-sqr-sqrt36.7%
sqrt-unprod37.2%
sqr-neg37.2%
sqrt-unprod0.5%
add-sqr-sqrt14.6%
div-inv14.6%
Applied egg-rr50.6%
associate-*r/50.6%
*-rgt-identity50.6%
+-commutative50.6%
Simplified50.6%
if -4.2e6 < l < 700Initial program 75.6%
Taylor expanded in l around 0 99.2%
Taylor expanded in K around 0 87.6%
+-commutative87.6%
associate-*r*87.6%
*-commutative87.6%
fma-define87.6%
Simplified87.6%
if 700 < l Initial program 100.0%
Applied egg-rr1.9%
associate-+r+1.9%
distribute-rgt1-in1.9%
metadata-eval1.9%
*-commutative1.9%
distribute-lft-out1.9%
associate-/r*1.9%
*-inverses1.9%
+-commutative1.9%
*-commutative1.9%
Simplified1.9%
Taylor expanded in U around -inf 8.2%
*-un-lft-identity8.2%
add-sqr-sqrt7.9%
sqrt-unprod8.2%
mul-1-neg8.2%
mul-1-neg8.2%
sqr-neg8.2%
sqrt-unprod0.3%
add-sqr-sqrt28.1%
cancel-sign-sub-inv28.1%
un-div-inv28.1%
metadata-eval28.1%
Applied egg-rr28.1%
*-lft-identity28.1%
Simplified28.1%
Final simplification61.2%
(FPCore (J l K U) :precision binary64 (+ U (* 2.0 (* J (* l (cos (* 0.5 K)))))))
double code(double J, double l, double K, double U) {
return U + (2.0 * (J * (l * cos((0.5 * K)))));
}
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((0.5d0 * k)))))
end function
public static double code(double J, double l, double K, double U) {
return U + (2.0 * (J * (l * Math.cos((0.5 * K)))));
}
def code(J, l, K, U): return U + (2.0 * (J * (l * math.cos((0.5 * K)))))
function code(J, l, K, U) return Float64(U + Float64(2.0 * Float64(J * Float64(l * cos(Float64(0.5 * K)))))) end
function tmp = code(J, l, K, U) tmp = U + (2.0 * (J * (l * cos((0.5 * K))))); end
code[J_, l_, K_, U_] := N[(U + N[(2.0 * N[(J * N[(l * N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + 2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(0.5 \cdot K\right)\right)\right)
\end{array}
Initial program 87.0%
Taylor expanded in l around 0 65.9%
Final simplification65.9%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (+ U (* J (* 2.0 l)))))
(if (<= l -3.8e+101)
t_0
(if (<= l -9500000.0)
(/ (+ 0.25 (/ (+ (/ (+ 0.140625 (/ 0.10546875 U)) U) -0.1875) U)) U)
(if (<= l 520.0)
t_0
(/ (+ 0.25 (/ (+ 0.1875 (/ -0.140625 U)) U)) (- U)))))))
double code(double J, double l, double K, double U) {
double t_0 = U + (J * (2.0 * l));
double tmp;
if (l <= -3.8e+101) {
tmp = t_0;
} else if (l <= -9500000.0) {
tmp = (0.25 + ((((0.140625 + (0.10546875 / U)) / U) + -0.1875) / U)) / U;
} else if (l <= 520.0) {
tmp = t_0;
} else {
tmp = (0.25 + ((0.1875 + (-0.140625 / U)) / U)) / -U;
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: t_0
real(8) :: tmp
t_0 = u + (j * (2.0d0 * l))
if (l <= (-3.8d+101)) then
tmp = t_0
else if (l <= (-9500000.0d0)) then
tmp = (0.25d0 + ((((0.140625d0 + (0.10546875d0 / u)) / u) + (-0.1875d0)) / u)) / u
else if (l <= 520.0d0) then
tmp = t_0
else
tmp = (0.25d0 + ((0.1875d0 + ((-0.140625d0) / u)) / u)) / -u
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = U + (J * (2.0 * l));
double tmp;
if (l <= -3.8e+101) {
tmp = t_0;
} else if (l <= -9500000.0) {
tmp = (0.25 + ((((0.140625 + (0.10546875 / U)) / U) + -0.1875) / U)) / U;
} else if (l <= 520.0) {
tmp = t_0;
} else {
tmp = (0.25 + ((0.1875 + (-0.140625 / U)) / U)) / -U;
}
return tmp;
}
def code(J, l, K, U): t_0 = U + (J * (2.0 * l)) tmp = 0 if l <= -3.8e+101: tmp = t_0 elif l <= -9500000.0: tmp = (0.25 + ((((0.140625 + (0.10546875 / U)) / U) + -0.1875) / U)) / U elif l <= 520.0: tmp = t_0 else: tmp = (0.25 + ((0.1875 + (-0.140625 / U)) / U)) / -U return tmp
function code(J, l, K, U) t_0 = Float64(U + Float64(J * Float64(2.0 * l))) tmp = 0.0 if (l <= -3.8e+101) tmp = t_0; elseif (l <= -9500000.0) tmp = Float64(Float64(0.25 + Float64(Float64(Float64(Float64(0.140625 + Float64(0.10546875 / U)) / U) + -0.1875) / U)) / U); elseif (l <= 520.0) tmp = t_0; else tmp = Float64(Float64(0.25 + Float64(Float64(0.1875 + Float64(-0.140625 / U)) / U)) / Float64(-U)); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = U + (J * (2.0 * l)); tmp = 0.0; if (l <= -3.8e+101) tmp = t_0; elseif (l <= -9500000.0) tmp = (0.25 + ((((0.140625 + (0.10546875 / U)) / U) + -0.1875) / U)) / U; elseif (l <= 520.0) tmp = t_0; else tmp = (0.25 + ((0.1875 + (-0.140625 / U)) / U)) / -U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(U + N[(J * N[(2.0 * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -3.8e+101], t$95$0, If[LessEqual[l, -9500000.0], N[(N[(0.25 + N[(N[(N[(N[(0.140625 + N[(0.10546875 / U), $MachinePrecision]), $MachinePrecision] / U), $MachinePrecision] + -0.1875), $MachinePrecision] / U), $MachinePrecision]), $MachinePrecision] / U), $MachinePrecision], If[LessEqual[l, 520.0], t$95$0, N[(N[(0.25 + N[(N[(0.1875 + N[(-0.140625 / U), $MachinePrecision]), $MachinePrecision] / U), $MachinePrecision]), $MachinePrecision] / (-U)), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + J \cdot \left(2 \cdot \ell\right)\\
\mathbf{if}\;\ell \leq -3.8 \cdot 10^{+101}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq -9500000:\\
\;\;\;\;\frac{0.25 + \frac{\frac{0.140625 + \frac{0.10546875}{U}}{U} + -0.1875}{U}}{U}\\
\mathbf{elif}\;\ell \leq 520:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{0.25 + \frac{0.1875 + \frac{-0.140625}{U}}{U}}{-U}\\
\end{array}
\end{array}
if l < -3.7999999999999998e101 or -9.5e6 < l < 520Initial program 81.4%
Taylor expanded in l around 0 84.2%
Taylor expanded in K around 0 73.0%
associate-*r*73.0%
*-commutative73.0%
associate-*l*73.0%
Simplified73.0%
if -3.7999999999999998e101 < l < -9.5e6Initial program 100.0%
Applied egg-rr1.4%
associate-+r+1.4%
distribute-rgt1-in1.4%
metadata-eval1.4%
*-commutative1.4%
distribute-lft-out1.4%
associate-/r*1.4%
*-inverses1.4%
+-commutative1.4%
*-commutative1.4%
Simplified1.4%
Taylor expanded in U around -inf 50.5%
mul-1-neg50.5%
distribute-neg-frac250.5%
mul-1-neg50.5%
unsub-neg50.5%
mul-1-neg50.5%
unsub-neg50.5%
associate-*r/50.5%
metadata-eval50.5%
Simplified50.5%
add-sqr-sqrt36.7%
sqrt-unprod37.2%
sqr-neg37.2%
sqrt-unprod0.5%
add-sqr-sqrt14.6%
div-inv14.6%
Applied egg-rr50.6%
associate-*r/50.6%
*-rgt-identity50.6%
+-commutative50.6%
Simplified50.6%
if 520 < l Initial program 100.0%
Applied egg-rr1.9%
associate-+r+1.9%
distribute-rgt1-in1.9%
metadata-eval1.9%
*-commutative1.9%
distribute-lft-out1.9%
associate-/r*1.9%
*-inverses1.9%
+-commutative1.9%
*-commutative1.9%
Simplified1.9%
Taylor expanded in U around -inf 8.2%
*-un-lft-identity8.2%
add-sqr-sqrt7.9%
sqrt-unprod8.2%
mul-1-neg8.2%
mul-1-neg8.2%
sqr-neg8.2%
sqrt-unprod0.3%
add-sqr-sqrt28.1%
cancel-sign-sub-inv28.1%
un-div-inv28.1%
metadata-eval28.1%
Applied egg-rr28.1%
*-lft-identity28.1%
Simplified28.1%
Final simplification61.2%
(FPCore (J l K U) :precision binary64 (if (or (<= l -5.7e+23) (not (<= l 1220.0))) (* U (- 2.0 U)) U))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -5.7e+23) || !(l <= 1220.0)) {
tmp = U * (2.0 - 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 <= (-5.7d+23)) .or. (.not. (l <= 1220.0d0))) then
tmp = u * (2.0d0 - 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 <= -5.7e+23) || !(l <= 1220.0)) {
tmp = U * (2.0 - U);
} else {
tmp = U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -5.7e+23) or not (l <= 1220.0): tmp = U * (2.0 - U) else: tmp = U return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -5.7e+23) || !(l <= 1220.0)) tmp = Float64(U * Float64(2.0 - U)); else tmp = U; end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -5.7e+23) || ~((l <= 1220.0))) tmp = U * (2.0 - U); else tmp = U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -5.7e+23], N[Not[LessEqual[l, 1220.0]], $MachinePrecision]], N[(U * N[(2.0 - U), $MachinePrecision]), $MachinePrecision], U]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -5.7 \cdot 10^{+23} \lor \neg \left(\ell \leq 1220\right):\\
\;\;\;\;U \cdot \left(2 - U\right)\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\end{array}
if l < -5.7e23 or 1220 < l Initial program 100.0%
associate-*l*100.0%
fma-define100.0%
Simplified100.0%
Applied egg-rr15.2%
+-commutative15.2%
fma-undefine15.2%
associate-+l+15.2%
count-215.2%
distribute-rgt-out15.2%
Simplified15.2%
Taylor expanded in U around 0 15.2%
mul-1-neg15.2%
unsub-neg15.2%
Simplified15.2%
if -5.7e23 < l < 1220Initial program 76.0%
Taylor expanded in J around 0 73.3%
Final simplification46.5%
(FPCore (J l K U) :precision binary64 (if (or (<= l -1.05e+24) (not (<= l 580.0))) (- -4.0 (* U U)) U))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -1.05e+24) || !(l <= 580.0)) {
tmp = -4.0 - (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 <= (-1.05d+24)) .or. (.not. (l <= 580.0d0))) then
tmp = (-4.0d0) - (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 <= -1.05e+24) || !(l <= 580.0)) {
tmp = -4.0 - (U * U);
} else {
tmp = U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -1.05e+24) or not (l <= 580.0): tmp = -4.0 - (U * U) else: tmp = U return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -1.05e+24) || !(l <= 580.0)) tmp = Float64(-4.0 - Float64(U * U)); else tmp = U; end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -1.05e+24) || ~((l <= 580.0))) tmp = -4.0 - (U * U); else tmp = U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -1.05e+24], N[Not[LessEqual[l, 580.0]], $MachinePrecision]], N[(-4.0 - N[(U * U), $MachinePrecision]), $MachinePrecision], U]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.05 \cdot 10^{+24} \lor \neg \left(\ell \leq 580\right):\\
\;\;\;\;-4 - U \cdot U\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\end{array}
if l < -1.0500000000000001e24 or 580 < l Initial program 100.0%
associate-*l*100.0%
fma-define100.0%
Simplified100.0%
Applied egg-rr15.5%
cancel-sign-sub-inv15.5%
Simplified15.5%
if -1.0500000000000001e24 < l < 580Initial program 76.1%
Taylor expanded in J around 0 72.8%
Final simplification46.6%
(FPCore (J l K U) :precision binary64 (if (<= l -3.3e+84) (* U U) U))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -3.3e+84) {
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 <= (-3.3d+84)) 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 <= -3.3e+84) {
tmp = U * U;
} else {
tmp = U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -3.3e+84: tmp = U * U else: tmp = U return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -3.3e+84) tmp = Float64(U * U); else tmp = U; end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -3.3e+84) tmp = U * U; else tmp = U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -3.3e+84], N[(U * U), $MachinePrecision], U]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -3.3 \cdot 10^{+84}:\\
\;\;\;\;U \cdot U\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\end{array}
if l < -3.30000000000000017e84Initial program 100.0%
Applied egg-rr12.3%
if -3.30000000000000017e84 < l Initial program 84.3%
Taylor expanded in J around 0 48.7%
Final simplification42.3%
(FPCore (J l K U) :precision binary64 (+ U (* J (* 2.0 l))))
double code(double J, double l, double K, double U) {
return U + (J * (2.0 * l));
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = u + (j * (2.0d0 * l))
end function
public static double code(double J, double l, double K, double U) {
return U + (J * (2.0 * l));
}
def code(J, l, K, U): return U + (J * (2.0 * l))
function code(J, l, K, U) return Float64(U + Float64(J * Float64(2.0 * l))) end
function tmp = code(J, l, K, U) tmp = U + (J * (2.0 * l)); end
code[J_, l_, K_, U_] := N[(U + N[(J * N[(2.0 * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + J \cdot \left(2 \cdot \ell\right)
\end{array}
Initial program 87.0%
Taylor expanded in l around 0 65.9%
Taylor expanded in K around 0 56.3%
associate-*r*56.3%
*-commutative56.3%
associate-*l*56.3%
Simplified56.3%
Final simplification56.3%
(FPCore (J l K U) :precision binary64 -0.3333333333333333)
double code(double J, double l, double K, double U) {
return -0.3333333333333333;
}
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 = -0.3333333333333333d0
end function
public static double code(double J, double l, double K, double U) {
return -0.3333333333333333;
}
def code(J, l, K, U): return -0.3333333333333333
function code(J, l, K, U) return -0.3333333333333333 end
function tmp = code(J, l, K, U) tmp = -0.3333333333333333; end
code[J_, l_, K_, U_] := -0.3333333333333333
\begin{array}{l}
\\
-0.3333333333333333
\end{array}
Initial program 87.0%
Applied egg-rr2.4%
associate-+r+2.4%
distribute-rgt1-in2.4%
metadata-eval2.4%
*-commutative2.4%
distribute-lft-out2.4%
associate-/r*2.3%
*-inverses2.3%
+-commutative2.3%
*-commutative2.3%
Simplified2.3%
Taylor expanded in U around 0 2.9%
Final simplification2.9%
(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.0%
Taylor expanded in J around 0 40.5%
Final simplification40.5%
herbie shell --seed 2024061
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))