
(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))) (t_1 (- (exp l) (exp (- l)))))
(if (or (<= t_1 -1.0) (not (<= t_1 1e-11)))
(+ (* (* t_1 J) t_0) U)
(+ U (* t_0 (* J (+ (* 0.3333333333333333 (pow l 3.0)) (* 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 <= -1.0) || !(t_1 <= 1e-11)) {
tmp = ((t_1 * J) * t_0) + U;
} else {
tmp = U + (t_0 * (J * ((0.3333333333333333 * pow(l, 3.0)) + (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 <= (-1.0d0)) .or. (.not. (t_1 <= 1d-11))) then
tmp = ((t_1 * j) * t_0) + u
else
tmp = u + (t_0 * (j * ((0.3333333333333333d0 * (l ** 3.0d0)) + (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 <= -1.0) || !(t_1 <= 1e-11)) {
tmp = ((t_1 * J) * t_0) + U;
} else {
tmp = U + (t_0 * (J * ((0.3333333333333333 * Math.pow(l, 3.0)) + (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 <= -1.0) or not (t_1 <= 1e-11): tmp = ((t_1 * J) * t_0) + U else: tmp = U + (t_0 * (J * ((0.3333333333333333 * math.pow(l, 3.0)) + (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 <= -1.0) || !(t_1 <= 1e-11)) tmp = Float64(Float64(Float64(t_1 * J) * t_0) + U); else tmp = Float64(U + Float64(t_0 * Float64(J * Float64(Float64(0.3333333333333333 * (l ^ 3.0)) + 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 <= -1.0) || ~((t_1 <= 1e-11))) tmp = ((t_1 * J) * t_0) + U; else tmp = U + (t_0 * (J * ((0.3333333333333333 * (l ^ 3.0)) + (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, -1.0], N[Not[LessEqual[t$95$1, 1e-11]], $MachinePrecision]], N[(N[(N[(t$95$1 * J), $MachinePrecision] * t$95$0), $MachinePrecision] + U), $MachinePrecision], N[(U + N[(t$95$0 * N[(J * N[(N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision] + N[(l * 2.0), $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 -1 \lor \neg \left(t_1 \leq 10^{-11}\right):\\
\;\;\;\;\left(t_1 \cdot J\right) \cdot t_0 + U\\
\mathbf{else}:\\
\;\;\;\;U + t_0 \cdot \left(J \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -1 or 9.99999999999999939e-12 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 100.0%
if -1 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 9.99999999999999939e-12Initial program 73.8%
Taylor expanded in l around 0 99.9%
Final simplification100.0%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (- (exp l) (exp (- l)))))
(if (or (<= t_0 -1.0) (not (<= t_0 1e-11)))
(+ (* t_0 J) U)
(+ U (* (* l J) (* 2.0 (cos (* K 0.5))))))))
double code(double J, double l, double K, double U) {
double t_0 = exp(l) - exp(-l);
double tmp;
if ((t_0 <= -1.0) || !(t_0 <= 1e-11)) {
tmp = (t_0 * J) + U;
} else {
tmp = U + ((l * J) * (2.0 * 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) :: t_0
real(8) :: tmp
t_0 = exp(l) - exp(-l)
if ((t_0 <= (-1.0d0)) .or. (.not. (t_0 <= 1d-11))) then
tmp = (t_0 * j) + u
else
tmp = u + ((l * j) * (2.0d0 * cos((k * 0.5d0))))
end if
code = tmp
end function
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 <= -1.0) || !(t_0 <= 1e-11)) {
tmp = (t_0 * J) + U;
} else {
tmp = U + ((l * J) * (2.0 * Math.cos((K * 0.5))));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.exp(l) - math.exp(-l) tmp = 0 if (t_0 <= -1.0) or not (t_0 <= 1e-11): tmp = (t_0 * J) + U else: tmp = U + ((l * J) * (2.0 * math.cos((K * 0.5)))) return tmp
function code(J, l, K, U) t_0 = Float64(exp(l) - exp(Float64(-l))) tmp = 0.0 if ((t_0 <= -1.0) || !(t_0 <= 1e-11)) tmp = Float64(Float64(t_0 * J) + U); else tmp = Float64(U + Float64(Float64(l * J) * Float64(2.0 * cos(Float64(K * 0.5))))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = exp(l) - exp(-l); tmp = 0.0; if ((t_0 <= -1.0) || ~((t_0 <= 1e-11))) tmp = (t_0 * J) + U; else tmp = U + ((l * J) * (2.0 * cos((K * 0.5)))); 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, -1.0], N[Not[LessEqual[t$95$0, 1e-11]], $MachinePrecision]], N[(N[(t$95$0 * J), $MachinePrecision] + U), $MachinePrecision], N[(U + N[(N[(l * J), $MachinePrecision] * N[(2.0 * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{\ell} - e^{-\ell}\\
\mathbf{if}\;t_0 \leq -1 \lor \neg \left(t_0 \leq 10^{-11}\right):\\
\;\;\;\;t_0 \cdot J + U\\
\mathbf{else}:\\
\;\;\;\;U + \left(\ell \cdot J\right) \cdot \left(2 \cdot \cos \left(K \cdot 0.5\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -1 or 9.99999999999999939e-12 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 100.0%
Taylor expanded in K around 0 70.0%
if -1 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 9.99999999999999939e-12Initial program 73.8%
Taylor expanded in l around 0 99.9%
associate-*r*99.9%
associate-*r*99.9%
*-commutative99.9%
associate-*l*99.9%
*-commutative99.9%
Simplified99.9%
Final simplification83.5%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (+ (* (- (exp l) (exp (- l))) J) U)) (t_1 (cos (* K 0.5))))
(if (<= l -4.2e+75)
(* (* J 0.3333333333333333) (* (pow l 3.0) t_1))
(if (<= l -0.0265)
t_0
(if (<= l 0.000118)
(fma (* l J) (* 2.0 t_1) U)
(if (<= l 1e+67)
t_0
(+
U
(* (cos (/ K 2.0)) (* 0.3333333333333333 (* J (pow l 3.0)))))))))))
double code(double J, double l, double K, double U) {
double t_0 = ((exp(l) - exp(-l)) * J) + U;
double t_1 = cos((K * 0.5));
double tmp;
if (l <= -4.2e+75) {
tmp = (J * 0.3333333333333333) * (pow(l, 3.0) * t_1);
} else if (l <= -0.0265) {
tmp = t_0;
} else if (l <= 0.000118) {
tmp = fma((l * J), (2.0 * t_1), U);
} else if (l <= 1e+67) {
tmp = t_0;
} else {
tmp = U + (cos((K / 2.0)) * (0.3333333333333333 * (J * pow(l, 3.0))));
}
return tmp;
}
function code(J, l, K, U) t_0 = Float64(Float64(Float64(exp(l) - exp(Float64(-l))) * J) + U) t_1 = cos(Float64(K * 0.5)) tmp = 0.0 if (l <= -4.2e+75) tmp = Float64(Float64(J * 0.3333333333333333) * Float64((l ^ 3.0) * t_1)); elseif (l <= -0.0265) tmp = t_0; elseif (l <= 0.000118) tmp = fma(Float64(l * J), Float64(2.0 * t_1), U); elseif (l <= 1e+67) tmp = t_0; else tmp = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(0.3333333333333333 * Float64(J * (l ^ 3.0))))); end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision] + U), $MachinePrecision]}, Block[{t$95$1 = N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -4.2e+75], N[(N[(J * 0.3333333333333333), $MachinePrecision] * N[(N[Power[l, 3.0], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -0.0265], t$95$0, If[LessEqual[l, 0.000118], N[(N[(l * J), $MachinePrecision] * N[(2.0 * t$95$1), $MachinePrecision] + U), $MachinePrecision], If[LessEqual[l, 1e+67], t$95$0, N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(0.3333333333333333 * N[(J * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(e^{\ell} - e^{-\ell}\right) \cdot J + U\\
t_1 := \cos \left(K \cdot 0.5\right)\\
\mathbf{if}\;\ell \leq -4.2 \cdot 10^{+75}:\\
\;\;\;\;\left(J \cdot 0.3333333333333333\right) \cdot \left({\ell}^{3} \cdot t_1\right)\\
\mathbf{elif}\;\ell \leq -0.0265:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq 0.000118:\\
\;\;\;\;\mathsf{fma}\left(\ell \cdot J, 2 \cdot t_1, U\right)\\
\mathbf{elif}\;\ell \leq 10^{+67}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;U + \cos \left(\frac{K}{2}\right) \cdot \left(0.3333333333333333 \cdot \left(J \cdot {\ell}^{3}\right)\right)\\
\end{array}
\end{array}
if l < -4.19999999999999997e75Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
fma-def100.0%
Simplified100.0%
Taylor expanded in l around 0 96.7%
Taylor expanded in l around inf 96.8%
associate-*r*96.8%
*-commutative96.8%
Simplified96.8%
if -4.19999999999999997e75 < l < -0.0264999999999999993 or 1.18e-4 < l < 9.99999999999999983e66Initial program 99.9%
Taylor expanded in K around 0 85.2%
if -0.0264999999999999993 < l < 1.18e-4Initial program 73.8%
Taylor expanded in l around 0 99.9%
+-commutative99.9%
*-commutative99.9%
associate-*r*99.9%
associate-*l*99.9%
fma-def99.9%
*-commutative99.9%
*-commutative99.9%
Simplified99.9%
if 9.99999999999999983e66 < l Initial program 100.0%
Taylor expanded in l around 0 92.9%
Taylor expanded in l around inf 92.9%
Final simplification96.2%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (+ (* (- (exp l) (exp (- l))) J) U))
(t_1 (cos (* K 0.5)))
(t_2 (* (* J 0.3333333333333333) (* (pow l 3.0) t_1))))
(if (<= l -4.2e+75)
t_2
(if (<= l -0.0055)
t_0
(if (<= l 0.00062)
(fma (* l J) (* 2.0 t_1) U)
(if (<= l 8.8e+66) t_0 t_2))))))
double code(double J, double l, double K, double U) {
double t_0 = ((exp(l) - exp(-l)) * J) + U;
double t_1 = cos((K * 0.5));
double t_2 = (J * 0.3333333333333333) * (pow(l, 3.0) * t_1);
double tmp;
if (l <= -4.2e+75) {
tmp = t_2;
} else if (l <= -0.0055) {
tmp = t_0;
} else if (l <= 0.00062) {
tmp = fma((l * J), (2.0 * t_1), U);
} else if (l <= 8.8e+66) {
tmp = t_0;
} else {
tmp = t_2;
}
return tmp;
}
function code(J, l, K, U) t_0 = Float64(Float64(Float64(exp(l) - exp(Float64(-l))) * J) + U) t_1 = cos(Float64(K * 0.5)) t_2 = Float64(Float64(J * 0.3333333333333333) * Float64((l ^ 3.0) * t_1)) tmp = 0.0 if (l <= -4.2e+75) tmp = t_2; elseif (l <= -0.0055) tmp = t_0; elseif (l <= 0.00062) tmp = fma(Float64(l * J), Float64(2.0 * t_1), U); elseif (l <= 8.8e+66) tmp = t_0; else tmp = t_2; end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision] + U), $MachinePrecision]}, Block[{t$95$1 = N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(J * 0.3333333333333333), $MachinePrecision] * N[(N[Power[l, 3.0], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -4.2e+75], t$95$2, If[LessEqual[l, -0.0055], t$95$0, If[LessEqual[l, 0.00062], N[(N[(l * J), $MachinePrecision] * N[(2.0 * t$95$1), $MachinePrecision] + U), $MachinePrecision], If[LessEqual[l, 8.8e+66], t$95$0, t$95$2]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(e^{\ell} - e^{-\ell}\right) \cdot J + U\\
t_1 := \cos \left(K \cdot 0.5\right)\\
t_2 := \left(J \cdot 0.3333333333333333\right) \cdot \left({\ell}^{3} \cdot t_1\right)\\
\mathbf{if}\;\ell \leq -4.2 \cdot 10^{+75}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\ell \leq -0.0055:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq 0.00062:\\
\;\;\;\;\mathsf{fma}\left(\ell \cdot J, 2 \cdot t_1, U\right)\\
\mathbf{elif}\;\ell \leq 8.8 \cdot 10^{+66}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if l < -4.19999999999999997e75 or 8.7999999999999994e66 < l Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
fma-def100.0%
Simplified100.0%
Taylor expanded in l around 0 94.2%
Taylor expanded in l around inf 94.2%
associate-*r*94.2%
*-commutative94.2%
Simplified94.2%
if -4.19999999999999997e75 < l < -0.0054999999999999997 or 6.2e-4 < l < 8.7999999999999994e66Initial program 99.9%
Taylor expanded in K around 0 85.2%
if -0.0054999999999999997 < l < 6.2e-4Initial program 73.8%
Taylor expanded in l around 0 99.9%
+-commutative99.9%
*-commutative99.9%
associate-*r*99.9%
associate-*l*99.9%
fma-def99.9%
*-commutative99.9%
*-commutative99.9%
Simplified99.9%
Final simplification95.8%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.02) (+ U (* (* l 2.0) (+ J (* -0.125 (* J (pow K 2.0)))))) (+ U (* J (+ (* 0.3333333333333333 (pow l 3.0)) (* l 2.0))))))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.02) {
tmp = U + ((l * 2.0) * (J + (-0.125 * (J * pow(K, 2.0)))));
} else {
tmp = U + (J * ((0.3333333333333333 * pow(l, 3.0)) + (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.02d0)) then
tmp = u + ((l * 2.0d0) * (j + ((-0.125d0) * (j * (k ** 2.0d0)))))
else
tmp = u + (j * ((0.3333333333333333d0 * (l ** 3.0d0)) + (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.02) {
tmp = U + ((l * 2.0) * (J + (-0.125 * (J * Math.pow(K, 2.0)))));
} else {
tmp = U + (J * ((0.3333333333333333 * Math.pow(l, 3.0)) + (l * 2.0)));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if math.cos((K / 2.0)) <= -0.02: tmp = U + ((l * 2.0) * (J + (-0.125 * (J * math.pow(K, 2.0))))) else: tmp = U + (J * ((0.3333333333333333 * math.pow(l, 3.0)) + (l * 2.0))) return tmp
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.02) tmp = Float64(U + Float64(Float64(l * 2.0) * Float64(J + Float64(-0.125 * Float64(J * (K ^ 2.0)))))); else tmp = Float64(U + Float64(J * Float64(Float64(0.3333333333333333 * (l ^ 3.0)) + Float64(l * 2.0)))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (cos((K / 2.0)) <= -0.02) tmp = U + ((l * 2.0) * (J + (-0.125 * (J * (K ^ 2.0))))); else tmp = U + (J * ((0.3333333333333333 * (l ^ 3.0)) + (l * 2.0))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.02], N[(U + N[(N[(l * 2.0), $MachinePrecision] * N[(J + N[(-0.125 * N[(J * N[Power[K, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * N[(N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision] + N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.02:\\
\;\;\;\;U + \left(\ell \cdot 2\right) \cdot \left(J + -0.125 \cdot \left(J \cdot {K}^{2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K 2)) < -0.0200000000000000004Initial program 91.8%
Taylor expanded in l around 0 59.0%
*-commutative59.0%
associate-*l*59.0%
*-commutative59.0%
associate-*r*59.0%
Simplified59.0%
Taylor expanded in K around 0 60.8%
if -0.0200000000000000004 < (cos.f64 (/.f64 K 2)) Initial program 86.7%
Taylor expanded in l around 0 90.7%
Taylor expanded in K around 0 88.3%
Final simplification80.5%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.02) (+ U (* (* l J) (* 2.0 (cos (* K 0.5))))) (+ U (* J (+ (* 0.3333333333333333 (pow l 3.0)) (* l 2.0))))))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.02) {
tmp = U + ((l * J) * (2.0 * cos((K * 0.5))));
} else {
tmp = U + (J * ((0.3333333333333333 * pow(l, 3.0)) + (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.02d0)) then
tmp = u + ((l * j) * (2.0d0 * cos((k * 0.5d0))))
else
tmp = u + (j * ((0.3333333333333333d0 * (l ** 3.0d0)) + (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.02) {
tmp = U + ((l * J) * (2.0 * Math.cos((K * 0.5))));
} else {
tmp = U + (J * ((0.3333333333333333 * Math.pow(l, 3.0)) + (l * 2.0)));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if math.cos((K / 2.0)) <= -0.02: tmp = U + ((l * J) * (2.0 * math.cos((K * 0.5)))) else: tmp = U + (J * ((0.3333333333333333 * math.pow(l, 3.0)) + (l * 2.0))) return tmp
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.02) tmp = Float64(U + Float64(Float64(l * J) * Float64(2.0 * cos(Float64(K * 0.5))))); else tmp = Float64(U + Float64(J * Float64(Float64(0.3333333333333333 * (l ^ 3.0)) + Float64(l * 2.0)))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (cos((K / 2.0)) <= -0.02) tmp = U + ((l * J) * (2.0 * cos((K * 0.5)))); else tmp = U + (J * ((0.3333333333333333 * (l ^ 3.0)) + (l * 2.0))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.02], N[(U + N[(N[(l * J), $MachinePrecision] * N[(2.0 * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * N[(N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision] + N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.02:\\
\;\;\;\;U + \left(\ell \cdot J\right) \cdot \left(2 \cdot \cos \left(K \cdot 0.5\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K 2)) < -0.0200000000000000004Initial program 91.8%
Taylor expanded in l around 0 59.0%
associate-*r*59.0%
associate-*r*59.0%
*-commutative59.0%
associate-*l*59.0%
*-commutative59.0%
Simplified59.0%
if -0.0200000000000000004 < (cos.f64 (/.f64 K 2)) Initial program 86.7%
Taylor expanded in l around 0 90.7%
Taylor expanded in K around 0 88.3%
Final simplification80.0%
(FPCore (J l K U) :precision binary64 (+ U (* (cos (/ K 2.0)) (* J (+ (* 0.3333333333333333 (pow l 3.0)) (* l 2.0))))))
double code(double J, double l, double K, double U) {
return U + (cos((K / 2.0)) * (J * ((0.3333333333333333 * pow(l, 3.0)) + (l * 2.0))));
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = u + (cos((k / 2.0d0)) * (j * ((0.3333333333333333d0 * (l ** 3.0d0)) + (l * 2.0d0))))
end function
public static double code(double J, double l, double K, double U) {
return U + (Math.cos((K / 2.0)) * (J * ((0.3333333333333333 * Math.pow(l, 3.0)) + (l * 2.0))));
}
def code(J, l, K, U): return U + (math.cos((K / 2.0)) * (J * ((0.3333333333333333 * math.pow(l, 3.0)) + (l * 2.0))))
function code(J, l, K, U) return Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(J * Float64(Float64(0.3333333333333333 * (l ^ 3.0)) + Float64(l * 2.0))))) end
function tmp = code(J, l, K, U) tmp = U + (cos((K / 2.0)) * (J * ((0.3333333333333333 * (l ^ 3.0)) + (l * 2.0)))); end
code[J_, l_, K_, U_] := N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(J * N[(N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision] + N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right)\right)
\end{array}
Initial program 88.1%
Taylor expanded in l around 0 90.7%
Final simplification90.7%
(FPCore (J l K U) :precision binary64 (if (or (<= l -0.0245) (not (<= l 0.0023))) (+ (* (- (exp l) (exp (- l))) J) U) (fma (* l J) (* 2.0 (cos (* K 0.5))) U)))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -0.0245) || !(l <= 0.0023)) {
tmp = ((exp(l) - exp(-l)) * J) + U;
} else {
tmp = fma((l * J), (2.0 * cos((K * 0.5))), U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if ((l <= -0.0245) || !(l <= 0.0023)) tmp = Float64(Float64(Float64(exp(l) - exp(Float64(-l))) * J) + U); else tmp = fma(Float64(l * J), Float64(2.0 * cos(Float64(K * 0.5))), U); end return tmp end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -0.0245], N[Not[LessEqual[l, 0.0023]], $MachinePrecision]], N[(N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision] + U), $MachinePrecision], N[(N[(l * J), $MachinePrecision] * N[(2.0 * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -0.0245 \lor \neg \left(\ell \leq 0.0023\right):\\
\;\;\;\;\left(e^{\ell} - e^{-\ell}\right) \cdot J + U\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\ell \cdot J, 2 \cdot \cos \left(K \cdot 0.5\right), U\right)\\
\end{array}
\end{array}
if l < -0.024500000000000001 or 0.0023 < l Initial program 100.0%
Taylor expanded in K around 0 70.0%
if -0.024500000000000001 < l < 0.0023Initial program 73.8%
Taylor expanded in l around 0 99.9%
+-commutative99.9%
*-commutative99.9%
associate-*r*99.9%
associate-*l*99.9%
fma-def99.9%
*-commutative99.9%
*-commutative99.9%
Simplified99.9%
Final simplification83.5%
(FPCore (J l K U) :precision binary64 (+ U (* (* l 2.0) (* J (cos (* K 0.5))))))
double code(double J, double l, double K, double U) {
return U + ((l * 2.0) * (J * cos((K * 0.5))));
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = u + ((l * 2.0d0) * (j * cos((k * 0.5d0))))
end function
public static double code(double J, double l, double K, double U) {
return U + ((l * 2.0) * (J * Math.cos((K * 0.5))));
}
def code(J, l, K, U): return U + ((l * 2.0) * (J * math.cos((K * 0.5))))
function code(J, l, K, U) return Float64(U + Float64(Float64(l * 2.0) * Float64(J * cos(Float64(K * 0.5))))) end
function tmp = code(J, l, K, U) tmp = U + ((l * 2.0) * (J * cos((K * 0.5)))); end
code[J_, l_, K_, U_] := N[(U + N[(N[(l * 2.0), $MachinePrecision] * N[(J * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + \left(\ell \cdot 2\right) \cdot \left(J \cdot \cos \left(K \cdot 0.5\right)\right)
\end{array}
Initial program 88.1%
Taylor expanded in l around 0 62.3%
*-commutative62.3%
associate-*l*62.3%
*-commutative62.3%
associate-*r*62.3%
Simplified62.3%
Final simplification62.3%
(FPCore (J l K U) :precision binary64 (+ U (* (* l J) (* 2.0 (cos (* K 0.5))))))
double code(double J, double l, double K, double U) {
return U + ((l * J) * (2.0 * cos((K * 0.5))));
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = u + ((l * j) * (2.0d0 * cos((k * 0.5d0))))
end function
public static double code(double J, double l, double K, double U) {
return U + ((l * J) * (2.0 * Math.cos((K * 0.5))));
}
def code(J, l, K, U): return U + ((l * J) * (2.0 * math.cos((K * 0.5))))
function code(J, l, K, U) return Float64(U + Float64(Float64(l * J) * Float64(2.0 * cos(Float64(K * 0.5))))) end
function tmp = code(J, l, K, U) tmp = U + ((l * J) * (2.0 * cos((K * 0.5)))); end
code[J_, l_, K_, U_] := N[(U + N[(N[(l * J), $MachinePrecision] * N[(2.0 * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + \left(\ell \cdot J\right) \cdot \left(2 \cdot \cos \left(K \cdot 0.5\right)\right)
\end{array}
Initial program 88.1%
Taylor expanded in l around 0 62.3%
associate-*r*62.3%
associate-*r*62.3%
*-commutative62.3%
associate-*l*62.3%
*-commutative62.3%
Simplified62.3%
Final simplification62.3%
(FPCore (J l K U)
:precision binary64
(if (<= l -1.02e+50)
(pow U -3.0)
(if (<= l 760.0)
(+ U (* J (* l 2.0)))
(/ (- (* (/ -4.0 U) (/ -4.0 U)) (* U U)) (+ U (/ -4.0 U))))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -1.02e+50) {
tmp = pow(U, -3.0);
} else if (l <= 760.0) {
tmp = U + (J * (l * 2.0));
} else {
tmp = (((-4.0 / U) * (-4.0 / U)) - (U * U)) / (U + (-4.0 / U));
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if (l <= (-1.02d+50)) then
tmp = u ** (-3.0d0)
else if (l <= 760.0d0) then
tmp = u + (j * (l * 2.0d0))
else
tmp = ((((-4.0d0) / u) * ((-4.0d0) / u)) - (u * u)) / (u + ((-4.0d0) / u))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (l <= -1.02e+50) {
tmp = Math.pow(U, -3.0);
} else if (l <= 760.0) {
tmp = U + (J * (l * 2.0));
} else {
tmp = (((-4.0 / U) * (-4.0 / U)) - (U * U)) / (U + (-4.0 / U));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -1.02e+50: tmp = math.pow(U, -3.0) elif l <= 760.0: tmp = U + (J * (l * 2.0)) else: tmp = (((-4.0 / U) * (-4.0 / U)) - (U * U)) / (U + (-4.0 / U)) return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -1.02e+50) tmp = U ^ -3.0; elseif (l <= 760.0) tmp = Float64(U + Float64(J * Float64(l * 2.0))); else tmp = Float64(Float64(Float64(Float64(-4.0 / U) * Float64(-4.0 / U)) - Float64(U * U)) / Float64(U + Float64(-4.0 / U))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -1.02e+50) tmp = U ^ -3.0; elseif (l <= 760.0) tmp = U + (J * (l * 2.0)); else tmp = (((-4.0 / U) * (-4.0 / U)) - (U * U)) / (U + (-4.0 / U)); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -1.02e+50], N[Power[U, -3.0], $MachinePrecision], If[LessEqual[l, 760.0], N[(U + N[(J * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(-4.0 / U), $MachinePrecision] * N[(-4.0 / U), $MachinePrecision]), $MachinePrecision] - N[(U * U), $MachinePrecision]), $MachinePrecision] / N[(U + N[(-4.0 / U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.02 \cdot 10^{+50}:\\
\;\;\;\;{U}^{-3}\\
\mathbf{elif}\;\ell \leq 760:\\
\;\;\;\;U + J \cdot \left(\ell \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{-4}{U} \cdot \frac{-4}{U} - U \cdot U}{U + \frac{-4}{U}}\\
\end{array}
\end{array}
if l < -1.01999999999999991e50Initial program 100.0%
Applied egg-rr33.4%
if -1.01999999999999991e50 < l < 760Initial program 75.9%
Taylor expanded in l around 0 94.0%
*-commutative94.0%
associate-*l*94.0%
*-commutative94.0%
associate-*r*94.0%
Simplified94.0%
Taylor expanded in K around 0 84.1%
if 760 < l Initial program 100.0%
Applied egg-rr3.2%
sub-neg3.2%
flip-+28.8%
frac-times28.8%
metadata-eval28.8%
pow228.8%
Applied egg-rr28.8%
metadata-eval28.8%
unpow228.8%
frac-times28.8%
Applied egg-rr28.8%
Final simplification57.2%
(FPCore (J l K U) :precision binary64 (if (or (<= l -2.1e+53) (not (<= l 8500000000.0))) (* U U) U))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -2.1e+53) || !(l <= 8500000000.0)) {
tmp = U * U;
} else {
tmp = U;
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if ((l <= (-2.1d+53)) .or. (.not. (l <= 8500000000.0d0))) then
tmp = u * u
else
tmp = u
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -2.1e+53) || !(l <= 8500000000.0)) {
tmp = U * U;
} else {
tmp = U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -2.1e+53) or not (l <= 8500000000.0): tmp = U * U else: tmp = U return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -2.1e+53) || !(l <= 8500000000.0)) tmp = Float64(U * U); else tmp = U; end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -2.1e+53) || ~((l <= 8500000000.0))) tmp = U * U; else tmp = U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -2.1e+53], N[Not[LessEqual[l, 8500000000.0]], $MachinePrecision]], N[(U * U), $MachinePrecision], U]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2.1 \cdot 10^{+53} \lor \neg \left(\ell \leq 8500000000\right):\\
\;\;\;\;U \cdot U\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\end{array}
if l < -2.1000000000000002e53 or 8.5e9 < l Initial program 100.0%
Applied egg-rr14.3%
if -2.1000000000000002e53 < l < 8.5e9Initial program 76.6%
Taylor expanded in J around 0 64.6%
Final simplification39.9%
(FPCore (J l K U) :precision binary64 (if (<= l -7.5e-26) (* U (- 2.0 U)) (if (<= l 23000000000.0) U (* U U))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -7.5e-26) {
tmp = U * (2.0 - U);
} else if (l <= 23000000000.0) {
tmp = U;
} else {
tmp = U * U;
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if (l <= (-7.5d-26)) then
tmp = u * (2.0d0 - u)
else if (l <= 23000000000.0d0) then
tmp = u
else
tmp = u * u
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (l <= -7.5e-26) {
tmp = U * (2.0 - U);
} else if (l <= 23000000000.0) {
tmp = U;
} else {
tmp = U * U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -7.5e-26: tmp = U * (2.0 - U) elif l <= 23000000000.0: tmp = U else: tmp = U * U return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -7.5e-26) tmp = Float64(U * Float64(2.0 - U)); elseif (l <= 23000000000.0) tmp = U; else tmp = Float64(U * U); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -7.5e-26) tmp = U * (2.0 - U); elseif (l <= 23000000000.0) tmp = U; else tmp = U * U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -7.5e-26], N[(U * N[(2.0 - U), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 23000000000.0], U, N[(U * U), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -7.5 \cdot 10^{-26}:\\
\;\;\;\;U \cdot \left(2 - U\right)\\
\mathbf{elif}\;\ell \leq 23000000000:\\
\;\;\;\;U\\
\mathbf{else}:\\
\;\;\;\;U \cdot U\\
\end{array}
\end{array}
if l < -7.4999999999999994e-26Initial program 95.0%
*-commutative95.0%
associate-*l*95.0%
fma-def95.0%
Simplified95.0%
Applied egg-rr13.1%
fma-udef13.1%
+-commutative13.1%
associate-+r+13.1%
count-213.1%
distribute-rgt-out13.1%
unsub-neg13.1%
Simplified13.1%
if -7.4999999999999994e-26 < l < 2.3e10Initial program 76.6%
Taylor expanded in J around 0 74.0%
if 2.3e10 < l Initial program 100.0%
Applied egg-rr15.8%
Final simplification40.6%
(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 88.1%
Taylor expanded in l around 0 62.3%
*-commutative62.3%
associate-*l*62.3%
*-commutative62.3%
associate-*r*62.3%
Simplified62.3%
Taylor expanded in K around 0 53.2%
Final simplification53.2%
(FPCore (J l K U) :precision binary64 1.0)
double code(double J, double l, double K, double U) {
return 1.0;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = 1.0d0
end function
public static double code(double J, double l, double K, double U) {
return 1.0;
}
def code(J, l, K, U): return 1.0
function code(J, l, K, U) return 1.0 end
function tmp = code(J, l, K, U) tmp = 1.0; end
code[J_, l_, K_, U_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 88.1%
Applied egg-rr2.5%
*-inverses2.5%
Simplified2.5%
Final simplification2.5%
(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.1%
Taylor expanded in J around 0 33.8%
Final simplification33.8%
herbie shell --seed 2023309
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))