
(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 (+ (* (* J (log1p (expm1 (* l 2.0)))) (cos (/ K 2.0))) U))
double code(double J, double l, double K, double U) {
return ((J * log1p(expm1((l * 2.0)))) * cos((K / 2.0))) + U;
}
public static double code(double J, double l, double K, double U) {
return ((J * Math.log1p(Math.expm1((l * 2.0)))) * Math.cos((K / 2.0))) + U;
}
def code(J, l, K, U): return ((J * math.log1p(math.expm1((l * 2.0)))) * math.cos((K / 2.0))) + U
function code(J, l, K, U) return Float64(Float64(Float64(J * log1p(expm1(Float64(l * 2.0)))) * cos(Float64(K / 2.0))) + U) end
code[J_, l_, K_, U_] := N[(N[(N[(J * N[Log[1 + N[(Exp[N[(l * 2.0), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]
\begin{array}{l}
\\
\left(J \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(\ell \cdot 2\right)\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U
\end{array}
Initial program 87.7%
Taylor expanded in l around 0 64.7%
*-commutative64.7%
associate-*l*64.7%
Simplified64.7%
log1p-expm1-u99.6%
Applied egg-rr99.6%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (* K 0.5)))
(t_1 (+ U (* 0.0003968253968253968 (* (* J (pow l 7.0)) t_0)))))
(if (<= l -2.6e+29)
t_1
(if (<= l -1.3)
(+ U (* J (- (exp l) (exp (- l)))))
(if (<= l 820.0)
(+ U (* 2.0 (* J (* l t_0))))
(if (<= l 1.7e+43) (log1p (expm1 (- (/ -4.0 U) U))) t_1))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K * 0.5));
double t_1 = U + (0.0003968253968253968 * ((J * pow(l, 7.0)) * t_0));
double tmp;
if (l <= -2.6e+29) {
tmp = t_1;
} else if (l <= -1.3) {
tmp = U + (J * (exp(l) - exp(-l)));
} else if (l <= 820.0) {
tmp = U + (2.0 * (J * (l * t_0)));
} else if (l <= 1.7e+43) {
tmp = log1p(expm1(((-4.0 / U) - U)));
} else {
tmp = t_1;
}
return tmp;
}
public static double code(double J, double l, double K, double U) {
double t_0 = Math.cos((K * 0.5));
double t_1 = U + (0.0003968253968253968 * ((J * Math.pow(l, 7.0)) * t_0));
double tmp;
if (l <= -2.6e+29) {
tmp = t_1;
} else if (l <= -1.3) {
tmp = U + (J * (Math.exp(l) - Math.exp(-l)));
} else if (l <= 820.0) {
tmp = U + (2.0 * (J * (l * t_0)));
} else if (l <= 1.7e+43) {
tmp = Math.log1p(Math.expm1(((-4.0 / U) - U)));
} else {
tmp = t_1;
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K * 0.5)) t_1 = U + (0.0003968253968253968 * ((J * math.pow(l, 7.0)) * t_0)) tmp = 0 if l <= -2.6e+29: tmp = t_1 elif l <= -1.3: tmp = U + (J * (math.exp(l) - math.exp(-l))) elif l <= 820.0: tmp = U + (2.0 * (J * (l * t_0))) elif l <= 1.7e+43: tmp = math.log1p(math.expm1(((-4.0 / U) - U))) else: tmp = t_1 return tmp
function code(J, l, K, U) t_0 = cos(Float64(K * 0.5)) t_1 = Float64(U + Float64(0.0003968253968253968 * Float64(Float64(J * (l ^ 7.0)) * t_0))) tmp = 0.0 if (l <= -2.6e+29) tmp = t_1; elseif (l <= -1.3) tmp = Float64(U + Float64(J * Float64(exp(l) - exp(Float64(-l))))); elseif (l <= 820.0) tmp = Float64(U + Float64(2.0 * Float64(J * Float64(l * t_0)))); elseif (l <= 1.7e+43) tmp = log1p(expm1(Float64(Float64(-4.0 / U) - U))); else tmp = t_1; end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(U + N[(0.0003968253968253968 * N[(N[(J * N[Power[l, 7.0], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -2.6e+29], t$95$1, If[LessEqual[l, -1.3], N[(U + N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 820.0], N[(U + N[(2.0 * N[(J * N[(l * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.7e+43], N[Log[1 + N[(Exp[N[(N[(-4.0 / U), $MachinePrecision] - U), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(K \cdot 0.5\right)\\
t_1 := U + 0.0003968253968253968 \cdot \left(\left(J \cdot {\ell}^{7}\right) \cdot t\_0\right)\\
\mathbf{if}\;\ell \leq -2.6 \cdot 10^{+29}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\ell \leq -1.3:\\
\;\;\;\;U + J \cdot \left(e^{\ell} - e^{-\ell}\right)\\
\mathbf{elif}\;\ell \leq 820:\\
\;\;\;\;U + 2 \cdot \left(J \cdot \left(\ell \cdot t\_0\right)\right)\\
\mathbf{elif}\;\ell \leq 1.7 \cdot 10^{+43}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{-4}{U} - U\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if l < -2.6e29 or 1.70000000000000006e43 < l Initial program 100.0%
Taylor expanded in l around 0 97.4%
Taylor expanded in l around inf 100.0%
associate-*r*100.0%
Simplified100.0%
if -2.6e29 < l < -1.30000000000000004Initial program 100.0%
Taylor expanded in K around 0 81.8%
if -1.30000000000000004 < l < 820Initial program 74.2%
Taylor expanded in l around 0 99.1%
if 820 < l < 1.70000000000000006e43Initial program 100.0%
Applied egg-rr3.4%
log1p-expm1-u66.7%
Applied egg-rr66.7%
Final simplification96.8%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= l -1.05)
(+ U (* t_0 (* J (- 0.3333333333333333 (exp (- l))))))
(if (<= l 500.0)
(+ U (* t_0 (* J (* l (+ 2.0 (* 0.3333333333333333 (pow l 2.0)))))))
(if (<= l 2.4e+43)
(log1p (expm1 (- (/ -4.0 U) U)))
(+
U
(* 0.0003968253968253968 (* (* J (pow l 7.0)) (cos (* K 0.5))))))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double tmp;
if (l <= -1.05) {
tmp = U + (t_0 * (J * (0.3333333333333333 - exp(-l))));
} else if (l <= 500.0) {
tmp = U + (t_0 * (J * (l * (2.0 + (0.3333333333333333 * pow(l, 2.0))))));
} else if (l <= 2.4e+43) {
tmp = log1p(expm1(((-4.0 / U) - U)));
} else {
tmp = U + (0.0003968253968253968 * ((J * pow(l, 7.0)) * cos((K * 0.5))));
}
return tmp;
}
public static double code(double J, double l, double K, double U) {
double t_0 = Math.cos((K / 2.0));
double tmp;
if (l <= -1.05) {
tmp = U + (t_0 * (J * (0.3333333333333333 - Math.exp(-l))));
} else if (l <= 500.0) {
tmp = U + (t_0 * (J * (l * (2.0 + (0.3333333333333333 * Math.pow(l, 2.0))))));
} else if (l <= 2.4e+43) {
tmp = Math.log1p(Math.expm1(((-4.0 / U) - U)));
} else {
tmp = U + (0.0003968253968253968 * ((J * Math.pow(l, 7.0)) * Math.cos((K * 0.5))));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K / 2.0)) tmp = 0 if l <= -1.05: tmp = U + (t_0 * (J * (0.3333333333333333 - math.exp(-l)))) elif l <= 500.0: tmp = U + (t_0 * (J * (l * (2.0 + (0.3333333333333333 * math.pow(l, 2.0)))))) elif l <= 2.4e+43: tmp = math.log1p(math.expm1(((-4.0 / U) - U))) else: tmp = U + (0.0003968253968253968 * ((J * math.pow(l, 7.0)) * math.cos((K * 0.5)))) return tmp
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) tmp = 0.0 if (l <= -1.05) tmp = Float64(U + Float64(t_0 * Float64(J * Float64(0.3333333333333333 - exp(Float64(-l)))))); elseif (l <= 500.0) tmp = Float64(U + Float64(t_0 * Float64(J * Float64(l * Float64(2.0 + Float64(0.3333333333333333 * (l ^ 2.0))))))); elseif (l <= 2.4e+43) tmp = log1p(expm1(Float64(Float64(-4.0 / U) - U))); else tmp = Float64(U + Float64(0.0003968253968253968 * Float64(Float64(J * (l ^ 7.0)) * cos(Float64(K * 0.5))))); end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -1.05], N[(U + N[(t$95$0 * N[(J * N[(0.3333333333333333 - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 500.0], 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], If[LessEqual[l, 2.4e+43], N[Log[1 + N[(Exp[N[(N[(-4.0 / U), $MachinePrecision] - U), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision], N[(U + N[(0.0003968253968253968 * N[(N[(J * N[Power[l, 7.0], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;\ell \leq -1.05:\\
\;\;\;\;U + t\_0 \cdot \left(J \cdot \left(0.3333333333333333 - e^{-\ell}\right)\right)\\
\mathbf{elif}\;\ell \leq 500:\\
\;\;\;\;U + t\_0 \cdot \left(J \cdot \left(\ell \cdot \left(2 + 0.3333333333333333 \cdot {\ell}^{2}\right)\right)\right)\\
\mathbf{elif}\;\ell \leq 2.4 \cdot 10^{+43}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{-4}{U} - U\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + 0.0003968253968253968 \cdot \left(\left(J \cdot {\ell}^{7}\right) \cdot \cos \left(K \cdot 0.5\right)\right)\\
\end{array}
\end{array}
if l < -1.05000000000000004Initial program 100.0%
Applied egg-rr99.4%
if -1.05000000000000004 < l < 500Initial program 74.0%
Taylor expanded in l around 0 99.6%
if 500 < l < 2.40000000000000023e43Initial program 100.0%
Applied egg-rr3.4%
log1p-expm1-u66.7%
Applied egg-rr66.7%
if 2.40000000000000023e43 < l Initial program 100.0%
Taylor expanded in l around 0 95.2%
Taylor expanded in l around inf 100.0%
associate-*r*100.0%
Simplified100.0%
Final simplification97.7%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (* K 0.5))))
(if (<= l -0.72)
(+ U (* (cos (/ K 2.0)) (* J (- 0.3333333333333333 (exp (- l))))))
(if (<= l 780.0)
(+ U (* 2.0 (* J (* l t_0))))
(if (<= l 9.5e+43)
(log1p (expm1 (- (/ -4.0 U) U)))
(+ U (* 0.0003968253968253968 (* (* J (pow l 7.0)) t_0))))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K * 0.5));
double tmp;
if (l <= -0.72) {
tmp = U + (cos((K / 2.0)) * (J * (0.3333333333333333 - exp(-l))));
} else if (l <= 780.0) {
tmp = U + (2.0 * (J * (l * t_0)));
} else if (l <= 9.5e+43) {
tmp = log1p(expm1(((-4.0 / U) - U)));
} else {
tmp = U + (0.0003968253968253968 * ((J * pow(l, 7.0)) * t_0));
}
return tmp;
}
public static double code(double J, double l, double K, double U) {
double t_0 = Math.cos((K * 0.5));
double tmp;
if (l <= -0.72) {
tmp = U + (Math.cos((K / 2.0)) * (J * (0.3333333333333333 - Math.exp(-l))));
} else if (l <= 780.0) {
tmp = U + (2.0 * (J * (l * t_0)));
} else if (l <= 9.5e+43) {
tmp = Math.log1p(Math.expm1(((-4.0 / U) - U)));
} else {
tmp = U + (0.0003968253968253968 * ((J * Math.pow(l, 7.0)) * t_0));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K * 0.5)) tmp = 0 if l <= -0.72: tmp = U + (math.cos((K / 2.0)) * (J * (0.3333333333333333 - math.exp(-l)))) elif l <= 780.0: tmp = U + (2.0 * (J * (l * t_0))) elif l <= 9.5e+43: tmp = math.log1p(math.expm1(((-4.0 / U) - U))) else: tmp = U + (0.0003968253968253968 * ((J * math.pow(l, 7.0)) * t_0)) return tmp
function code(J, l, K, U) t_0 = cos(Float64(K * 0.5)) tmp = 0.0 if (l <= -0.72) tmp = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(J * Float64(0.3333333333333333 - exp(Float64(-l)))))); elseif (l <= 780.0) tmp = Float64(U + Float64(2.0 * Float64(J * Float64(l * t_0)))); elseif (l <= 9.5e+43) tmp = log1p(expm1(Float64(Float64(-4.0 / U) - U))); else tmp = Float64(U + Float64(0.0003968253968253968 * Float64(Float64(J * (l ^ 7.0)) * t_0))); end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -0.72], N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(J * N[(0.3333333333333333 - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 780.0], N[(U + N[(2.0 * N[(J * N[(l * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 9.5e+43], N[Log[1 + N[(Exp[N[(N[(-4.0 / U), $MachinePrecision] - U), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision], N[(U + N[(0.0003968253968253968 * N[(N[(J * N[Power[l, 7.0], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(K \cdot 0.5\right)\\
\mathbf{if}\;\ell \leq -0.72:\\
\;\;\;\;U + \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(0.3333333333333333 - e^{-\ell}\right)\right)\\
\mathbf{elif}\;\ell \leq 780:\\
\;\;\;\;U + 2 \cdot \left(J \cdot \left(\ell \cdot t\_0\right)\right)\\
\mathbf{elif}\;\ell \leq 9.5 \cdot 10^{+43}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{-4}{U} - U\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + 0.0003968253968253968 \cdot \left(\left(J \cdot {\ell}^{7}\right) \cdot t\_0\right)\\
\end{array}
\end{array}
if l < -0.71999999999999997Initial program 100.0%
Applied egg-rr99.4%
if -0.71999999999999997 < l < 780Initial program 74.0%
Taylor expanded in l around 0 99.4%
if 780 < l < 9.5000000000000004e43Initial program 100.0%
Applied egg-rr3.4%
log1p-expm1-u66.7%
Applied egg-rr66.7%
if 9.5000000000000004e43 < l Initial program 100.0%
Taylor expanded in l around 0 95.2%
Taylor expanded in l around inf 100.0%
associate-*r*100.0%
Simplified100.0%
Final simplification97.6%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (* l (cos (* K 0.5))))
(t_1 (* U (+ 1.0 (* 2.0 (* J (/ t_0 U))))))
(t_2 (log1p (expm1 (- (/ -4.0 U) U)))))
(if (<= l -2.8e+244)
t_1
(if (<= l -54000000.0)
t_2
(if (<= l 520.0) (+ U (* 2.0 (* J t_0))) (if (<= l 1e+157) t_2 t_1))))))
double code(double J, double l, double K, double U) {
double t_0 = l * cos((K * 0.5));
double t_1 = U * (1.0 + (2.0 * (J * (t_0 / U))));
double t_2 = log1p(expm1(((-4.0 / U) - U)));
double tmp;
if (l <= -2.8e+244) {
tmp = t_1;
} else if (l <= -54000000.0) {
tmp = t_2;
} else if (l <= 520.0) {
tmp = U + (2.0 * (J * t_0));
} else if (l <= 1e+157) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
public static double code(double J, double l, double K, double U) {
double t_0 = l * Math.cos((K * 0.5));
double t_1 = U * (1.0 + (2.0 * (J * (t_0 / U))));
double t_2 = Math.log1p(Math.expm1(((-4.0 / U) - U)));
double tmp;
if (l <= -2.8e+244) {
tmp = t_1;
} else if (l <= -54000000.0) {
tmp = t_2;
} else if (l <= 520.0) {
tmp = U + (2.0 * (J * t_0));
} else if (l <= 1e+157) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(J, l, K, U): t_0 = l * math.cos((K * 0.5)) t_1 = U * (1.0 + (2.0 * (J * (t_0 / U)))) t_2 = math.log1p(math.expm1(((-4.0 / U) - U))) tmp = 0 if l <= -2.8e+244: tmp = t_1 elif l <= -54000000.0: tmp = t_2 elif l <= 520.0: tmp = U + (2.0 * (J * t_0)) elif l <= 1e+157: tmp = t_2 else: tmp = t_1 return tmp
function code(J, l, K, U) t_0 = Float64(l * cos(Float64(K * 0.5))) t_1 = Float64(U * Float64(1.0 + Float64(2.0 * Float64(J * Float64(t_0 / U))))) t_2 = log1p(expm1(Float64(Float64(-4.0 / U) - U))) tmp = 0.0 if (l <= -2.8e+244) tmp = t_1; elseif (l <= -54000000.0) tmp = t_2; elseif (l <= 520.0) tmp = Float64(U + Float64(2.0 * Float64(J * t_0))); elseif (l <= 1e+157) tmp = t_2; else tmp = t_1; end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(l * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(U * N[(1.0 + N[(2.0 * N[(J * N[(t$95$0 / U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Log[1 + N[(Exp[N[(N[(-4.0 / U), $MachinePrecision] - U), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -2.8e+244], t$95$1, If[LessEqual[l, -54000000.0], t$95$2, If[LessEqual[l, 520.0], N[(U + N[(2.0 * N[(J * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1e+157], t$95$2, t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \ell \cdot \cos \left(K \cdot 0.5\right)\\
t_1 := U \cdot \left(1 + 2 \cdot \left(J \cdot \frac{t\_0}{U}\right)\right)\\
t_2 := \mathsf{log1p}\left(\mathsf{expm1}\left(\frac{-4}{U} - U\right)\right)\\
\mathbf{if}\;\ell \leq -2.8 \cdot 10^{+244}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\ell \leq -54000000:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;\ell \leq 520:\\
\;\;\;\;U + 2 \cdot \left(J \cdot t\_0\right)\\
\mathbf{elif}\;\ell \leq 10^{+157}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if l < -2.79999999999999991e244 or 9.99999999999999983e156 < l Initial program 100.0%
Taylor expanded in l around 0 58.5%
*-commutative58.5%
associate-*l*58.5%
Simplified58.5%
log1p-expm1-u100.0%
Applied egg-rr100.0%
Taylor expanded in U around inf 65.7%
associate-/l*71.1%
Simplified71.1%
if -2.79999999999999991e244 < l < -5.4e7 or 520 < l < 9.99999999999999983e156Initial program 100.0%
Applied egg-rr3.1%
log1p-expm1-u58.8%
Applied egg-rr58.8%
if -5.4e7 < l < 520Initial program 74.4%
Taylor expanded in l around 0 98.3%
Final simplification80.3%
(FPCore (J l K U) :precision binary64 (if (or (<= l -1.35) (not (<= l 0.45))) (+ U (* J (- (exp l) (exp (- l))))) (+ U (* 2.0 (* J (* l (cos (* K 0.5))))))))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -1.35) || !(l <= 0.45)) {
tmp = U + (J * (exp(l) - exp(-l)));
} 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 <= (-1.35d0)) .or. (.not. (l <= 0.45d0))) then
tmp = u + (j * (exp(l) - exp(-l)))
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 <= -1.35) || !(l <= 0.45)) {
tmp = U + (J * (Math.exp(l) - Math.exp(-l)));
} else {
tmp = U + (2.0 * (J * (l * Math.cos((K * 0.5)))));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -1.35) or not (l <= 0.45): tmp = U + (J * (math.exp(l) - math.exp(-l))) 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 <= -1.35) || !(l <= 0.45)) tmp = Float64(U + Float64(J * Float64(exp(l) - exp(Float64(-l))))); 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 <= -1.35) || ~((l <= 0.45))) tmp = U + (J * (exp(l) - exp(-l))); 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, -1.35], N[Not[LessEqual[l, 0.45]], $MachinePrecision]], N[(U + N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(2.0 * N[(J * N[(l * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.35 \lor \neg \left(\ell \leq 0.45\right):\\
\;\;\;\;U + J \cdot \left(e^{\ell} - e^{-\ell}\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 < -1.3500000000000001 or 0.450000000000000011 < l Initial program 100.0%
Taylor expanded in K around 0 68.7%
if -1.3500000000000001 < l < 0.450000000000000011Initial program 74.2%
Taylor expanded in l around 0 99.1%
Final simplification83.2%
(FPCore (J l K U) :precision binary64 (if (or (<= l -54000000.0) (not (<= l 7600000000000.0))) (+ U (* (* J (* l 2.0)) (+ 5.0 (* (pow K 2.0) -8.0)))) (+ U (* 2.0 (* J (* l (cos (* K 0.5))))))))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -54000000.0) || !(l <= 7600000000000.0)) {
tmp = U + ((J * (l * 2.0)) * (5.0 + (pow(K, 2.0) * -8.0)));
} else {
tmp = U + (2.0 * (J * (l * cos((K * 0.5)))));
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if ((l <= (-54000000.0d0)) .or. (.not. (l <= 7600000000000.0d0))) then
tmp = u + ((j * (l * 2.0d0)) * (5.0d0 + ((k ** 2.0d0) * (-8.0d0))))
else
tmp = u + (2.0d0 * (j * (l * cos((k * 0.5d0)))))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -54000000.0) || !(l <= 7600000000000.0)) {
tmp = U + ((J * (l * 2.0)) * (5.0 + (Math.pow(K, 2.0) * -8.0)));
} else {
tmp = U + (2.0 * (J * (l * Math.cos((K * 0.5)))));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -54000000.0) or not (l <= 7600000000000.0): tmp = U + ((J * (l * 2.0)) * (5.0 + (math.pow(K, 2.0) * -8.0))) else: tmp = U + (2.0 * (J * (l * math.cos((K * 0.5))))) return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -54000000.0) || !(l <= 7600000000000.0)) tmp = Float64(U + Float64(Float64(J * Float64(l * 2.0)) * Float64(5.0 + Float64((K ^ 2.0) * -8.0)))); else tmp = Float64(U + Float64(2.0 * Float64(J * Float64(l * cos(Float64(K * 0.5)))))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -54000000.0) || ~((l <= 7600000000000.0))) tmp = U + ((J * (l * 2.0)) * (5.0 + ((K ^ 2.0) * -8.0))); else tmp = U + (2.0 * (J * (l * cos((K * 0.5))))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -54000000.0], N[Not[LessEqual[l, 7600000000000.0]], $MachinePrecision]], N[(U + N[(N[(J * N[(l * 2.0), $MachinePrecision]), $MachinePrecision] * N[(5.0 + N[(N[Power[K, 2.0], $MachinePrecision] * -8.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(2.0 * N[(J * N[(l * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -54000000 \lor \neg \left(\ell \leq 7600000000000\right):\\
\;\;\;\;U + \left(J \cdot \left(\ell \cdot 2\right)\right) \cdot \left(5 + {K}^{2} \cdot -8\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 < -5.4e7 or 7.6e12 < l Initial program 100.0%
Taylor expanded in l around 0 34.1%
*-commutative34.1%
associate-*l*34.1%
Simplified34.1%
Applied egg-rr24.8%
log1p-undefine24.8%
rem-exp-log24.8%
+-commutative24.8%
associate--l+24.8%
*-commutative24.8%
metadata-eval24.8%
Simplified24.8%
Taylor expanded in K around 0 42.0%
*-commutative42.0%
Simplified42.0%
if -5.4e7 < l < 7.6e12Initial program 74.8%
Taylor expanded in l around 0 96.8%
Final simplification68.8%
(FPCore (J l K U) :precision binary64 (if (or (<= l -650000000.0) (not (<= l 5.2e+16))) (+ U (* (* J (* l 2.0)) (+ 1.0 (* (pow K 2.0) -0.125)))) (+ U (* 2.0 (* J (* l (cos (* K 0.5))))))))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -650000000.0) || !(l <= 5.2e+16)) {
tmp = U + ((J * (l * 2.0)) * (1.0 + (pow(K, 2.0) * -0.125)));
} 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 <= (-650000000.0d0)) .or. (.not. (l <= 5.2d+16))) then
tmp = u + ((j * (l * 2.0d0)) * (1.0d0 + ((k ** 2.0d0) * (-0.125d0))))
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 <= -650000000.0) || !(l <= 5.2e+16)) {
tmp = U + ((J * (l * 2.0)) * (1.0 + (Math.pow(K, 2.0) * -0.125)));
} else {
tmp = U + (2.0 * (J * (l * Math.cos((K * 0.5)))));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -650000000.0) or not (l <= 5.2e+16): tmp = U + ((J * (l * 2.0)) * (1.0 + (math.pow(K, 2.0) * -0.125))) 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 <= -650000000.0) || !(l <= 5.2e+16)) tmp = Float64(U + Float64(Float64(J * Float64(l * 2.0)) * Float64(1.0 + Float64((K ^ 2.0) * -0.125)))); 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 <= -650000000.0) || ~((l <= 5.2e+16))) tmp = U + ((J * (l * 2.0)) * (1.0 + ((K ^ 2.0) * -0.125))); 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, -650000000.0], N[Not[LessEqual[l, 5.2e+16]], $MachinePrecision]], N[(U + N[(N[(J * N[(l * 2.0), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[Power[K, 2.0], $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(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 -650000000 \lor \neg \left(\ell \leq 5.2 \cdot 10^{+16}\right):\\
\;\;\;\;U + \left(J \cdot \left(\ell \cdot 2\right)\right) \cdot \left(1 + {K}^{2} \cdot -0.125\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 < -6.5e8 or 5.2e16 < l Initial program 100.0%
Taylor expanded in l around 0 34.9%
*-commutative34.9%
associate-*l*34.9%
Simplified34.9%
Taylor expanded in K around 0 43.0%
if -6.5e8 < l < 5.2e16Initial program 75.4%
Taylor expanded in l around 0 94.6%
Final simplification68.8%
(FPCore (J l K U) :precision binary64 (if (<= l -680.0) (/ (+ (pow U 3.0) 4096.0) (+ 256.0 (* U -16.0))) (+ U (* l (* J 2.0)))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -680.0) {
tmp = (pow(U, 3.0) + 4096.0) / (256.0 + (U * -16.0));
} else {
tmp = U + (l * (J * 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 <= (-680.0d0)) then
tmp = ((u ** 3.0d0) + 4096.0d0) / (256.0d0 + (u * (-16.0d0)))
else
tmp = u + (l * (j * 2.0d0))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (l <= -680.0) {
tmp = (Math.pow(U, 3.0) + 4096.0) / (256.0 + (U * -16.0));
} else {
tmp = U + (l * (J * 2.0));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -680.0: tmp = (math.pow(U, 3.0) + 4096.0) / (256.0 + (U * -16.0)) else: tmp = U + (l * (J * 2.0)) return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -680.0) tmp = Float64(Float64((U ^ 3.0) + 4096.0) / Float64(256.0 + Float64(U * -16.0))); else tmp = Float64(U + Float64(l * Float64(J * 2.0))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -680.0) tmp = ((U ^ 3.0) + 4096.0) / (256.0 + (U * -16.0)); else tmp = U + (l * (J * 2.0)); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -680.0], N[(N[(N[Power[U, 3.0], $MachinePrecision] + 4096.0), $MachinePrecision] / N[(256.0 + N[(U * -16.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(l * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -680:\\
\;\;\;\;\frac{{U}^{3} + 4096}{256 + U \cdot -16}\\
\mathbf{else}:\\
\;\;\;\;U + \ell \cdot \left(J \cdot 2\right)\\
\end{array}
\end{array}
if l < -680Initial program 100.0%
Applied egg-rr2.4%
fma-undefine2.4%
+-commutative2.4%
metadata-eval2.4%
Simplified2.4%
flip3-+11.0%
div-inv11.0%
metadata-eval11.0%
fma-define11.0%
metadata-eval11.0%
Applied egg-rr11.0%
associate-*r/11.0%
*-rgt-identity11.0%
fma-undefine11.0%
unpow211.0%
*-commutative11.0%
associate-+r-11.0%
+-commutative11.0%
associate-+r-11.0%
cancel-sign-sub-inv11.0%
unpow211.0%
metadata-eval11.0%
distribute-rgt-out11.0%
Simplified11.0%
Taylor expanded in U around 0 30.8%
*-commutative30.8%
Simplified30.8%
if -680 < l Initial program 83.9%
Taylor expanded in l around 0 75.7%
*-commutative75.7%
associate-*l*75.7%
Simplified75.7%
Taylor expanded in K around 0 65.2%
associate-*r*65.2%
*-commutative65.2%
Simplified65.2%
Final simplification57.0%
(FPCore (J l K U) :precision binary64 (* U (+ 1.0 (* 2.0 (* J (/ (* l (cos (* K 0.5))) U))))))
double code(double J, double l, double K, double U) {
return U * (1.0 + (2.0 * (J * ((l * cos((K * 0.5))) / 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 + (2.0d0 * (j * ((l * cos((k * 0.5d0))) / u))))
end function
public static double code(double J, double l, double K, double U) {
return U * (1.0 + (2.0 * (J * ((l * Math.cos((K * 0.5))) / U))));
}
def code(J, l, K, U): return U * (1.0 + (2.0 * (J * ((l * math.cos((K * 0.5))) / U))))
function code(J, l, K, U) return Float64(U * Float64(1.0 + Float64(2.0 * Float64(J * Float64(Float64(l * cos(Float64(K * 0.5))) / U))))) end
function tmp = code(J, l, K, U) tmp = U * (1.0 + (2.0 * (J * ((l * cos((K * 0.5))) / U)))); end
code[J_, l_, K_, U_] := N[(U * N[(1.0 + N[(2.0 * N[(J * N[(N[(l * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U \cdot \left(1 + 2 \cdot \left(J \cdot \frac{\ell \cdot \cos \left(K \cdot 0.5\right)}{U}\right)\right)
\end{array}
Initial program 87.7%
Taylor expanded in l around 0 64.7%
*-commutative64.7%
associate-*l*64.7%
Simplified64.7%
log1p-expm1-u99.6%
Applied egg-rr99.6%
Taylor expanded in U around inf 68.4%
associate-/l*70.6%
Simplified70.6%
Final simplification70.6%
(FPCore (J l K U) :precision binary64 (+ U (* 2.0 (* J (* l (cos (* K 0.5)))))))
double code(double J, double l, double K, double U) {
return U + (2.0 * (J * (l * cos((K * 0.5)))));
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = u + (2.0d0 * (j * (l * cos((k * 0.5d0)))))
end function
public static double code(double J, double l, double K, double U) {
return U + (2.0 * (J * (l * Math.cos((K * 0.5)))));
}
def code(J, l, K, U): return U + (2.0 * (J * (l * math.cos((K * 0.5)))))
function code(J, l, K, U) return Float64(U + Float64(2.0 * Float64(J * Float64(l * cos(Float64(K * 0.5)))))) end
function tmp = code(J, l, K, U) tmp = U + (2.0 * (J * (l * cos((K * 0.5))))); end
code[J_, l_, K_, U_] := N[(U + N[(2.0 * N[(J * N[(l * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + 2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(K \cdot 0.5\right)\right)\right)
\end{array}
Initial program 87.7%
Taylor expanded in l around 0 64.7%
Final simplification64.7%
(FPCore (J l K U) :precision binary64 (if (<= l 510000.0) U (* U U)))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= 510000.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 <= 510000.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 <= 510000.0) {
tmp = U;
} else {
tmp = U * U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= 510000.0: tmp = U else: tmp = U * U return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= 510000.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 <= 510000.0) tmp = U; else tmp = U * U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, 510000.0], U, N[(U * U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 510000:\\
\;\;\;\;U\\
\mathbf{else}:\\
\;\;\;\;U \cdot U\\
\end{array}
\end{array}
if l < 5.1e5Initial program 82.9%
Taylor expanded in J around 0 48.7%
if 5.1e5 < l Initial program 100.0%
Applied egg-rr12.9%
(FPCore (J l K U) :precision binary64 (+ U (* l (* J 2.0))))
double code(double J, double l, double K, double U) {
return U + (l * (J * 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 + (l * (j * 2.0d0))
end function
public static double code(double J, double l, double K, double U) {
return U + (l * (J * 2.0));
}
def code(J, l, K, U): return U + (l * (J * 2.0))
function code(J, l, K, U) return Float64(U + Float64(l * Float64(J * 2.0))) end
function tmp = code(J, l, K, U) tmp = U + (l * (J * 2.0)); end
code[J_, l_, K_, U_] := N[(U + N[(l * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + \ell \cdot \left(J \cdot 2\right)
\end{array}
Initial program 87.7%
Taylor expanded in l around 0 64.7%
*-commutative64.7%
associate-*l*64.7%
Simplified64.7%
Taylor expanded in K around 0 54.6%
associate-*r*54.6%
*-commutative54.6%
Simplified54.6%
Final simplification54.6%
(FPCore (J l K U) :precision binary64 (+ U (* 10.0 (* J l))))
double code(double J, double l, double K, double U) {
return U + (10.0 * (J * 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 + (10.0d0 * (j * l))
end function
public static double code(double J, double l, double K, double U) {
return U + (10.0 * (J * l));
}
def code(J, l, K, U): return U + (10.0 * (J * l))
function code(J, l, K, U) return Float64(U + Float64(10.0 * Float64(J * l))) end
function tmp = code(J, l, K, U) tmp = U + (10.0 * (J * l)); end
code[J_, l_, K_, U_] := N[(U + N[(10.0 * N[(J * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + 10 \cdot \left(J \cdot \ell\right)
\end{array}
Initial program 87.7%
Taylor expanded in l around 0 64.7%
*-commutative64.7%
associate-*l*64.7%
Simplified64.7%
Applied egg-rr48.4%
log1p-undefine48.4%
rem-exp-log48.4%
+-commutative48.4%
associate--l+48.4%
*-commutative48.4%
metadata-eval48.4%
Simplified48.4%
Taylor expanded in K around 0 48.4%
Final simplification48.4%
(FPCore (J l K U) :precision binary64 U)
double code(double J, double l, double K, double U) {
return U;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = u
end function
public static double code(double J, double l, double K, double U) {
return U;
}
def code(J, l, K, U): return U
function code(J, l, K, U) return U end
function tmp = code(J, l, K, U) tmp = U; end
code[J_, l_, K_, U_] := U
\begin{array}{l}
\\
U
\end{array}
Initial program 87.7%
Taylor expanded in J around 0 35.6%
(FPCore (J l K U) :precision binary64 16.0)
double code(double J, double l, double K, double U) {
return 16.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 = 16.0d0
end function
public static double code(double J, double l, double K, double U) {
return 16.0;
}
def code(J, l, K, U): return 16.0
function code(J, l, K, U) return 16.0 end
function tmp = code(J, l, K, U) tmp = 16.0; end
code[J_, l_, K_, U_] := 16.0
\begin{array}{l}
\\
16
\end{array}
Initial program 87.7%
Applied egg-rr22.8%
fma-undefine22.8%
+-commutative22.8%
metadata-eval22.8%
Simplified22.8%
Taylor expanded in U around 0 2.6%
herbie shell --seed 2024166
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))