
(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 18 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 (* K 0.5))))))) U))
double code(double J, double l, double K, double U) {
return (2.0 * (J * log1p(expm1((l * cos((K * 0.5))))))) + U;
}
public static double code(double J, double l, double K, double U) {
return (2.0 * (J * Math.log1p(Math.expm1((l * Math.cos((K * 0.5))))))) + U;
}
def code(J, l, K, U): return (2.0 * (J * math.log1p(math.expm1((l * math.cos((K * 0.5))))))) + U
function code(J, l, K, U) return Float64(Float64(2.0 * Float64(J * log1p(expm1(Float64(l * cos(Float64(K * 0.5))))))) + U) end
code[J_, l_, K_, U_] := N[(N[(2.0 * N[(J * N[Log[1 + N[(Exp[N[(l * N[Cos[N[(K * 0.5), $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(K \cdot 0.5\right)\right)\right)\right) + U
\end{array}
Initial program 85.0%
Taylor expanded in l around 0 67.5%
log1p-expm1-u99.3%
*-commutative99.3%
Applied egg-rr99.3%
Final simplification99.3%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= t_0 -0.98)
(+ U (* 2.0 (* J (+ l (* -0.125 (* l (pow K 2.0)))))))
(if (<= t_0 0.26)
(+ U (* 2.0 (* l (* J (cos (* K 0.5))))))
(+ U (* 2.0 (* J (log1p (expm1 l)))))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double tmp;
if (t_0 <= -0.98) {
tmp = U + (2.0 * (J * (l + (-0.125 * (l * pow(K, 2.0))))));
} else if (t_0 <= 0.26) {
tmp = U + (2.0 * (l * (J * cos((K * 0.5)))));
} else {
tmp = U + (2.0 * (J * log1p(expm1(l))));
}
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 (t_0 <= -0.98) {
tmp = U + (2.0 * (J * (l + (-0.125 * (l * Math.pow(K, 2.0))))));
} else if (t_0 <= 0.26) {
tmp = U + (2.0 * (l * (J * Math.cos((K * 0.5)))));
} else {
tmp = U + (2.0 * (J * Math.log1p(Math.expm1(l))));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K / 2.0)) tmp = 0 if t_0 <= -0.98: tmp = U + (2.0 * (J * (l + (-0.125 * (l * math.pow(K, 2.0)))))) elif t_0 <= 0.26: tmp = U + (2.0 * (l * (J * math.cos((K * 0.5))))) else: tmp = U + (2.0 * (J * math.log1p(math.expm1(l)))) return tmp
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) tmp = 0.0 if (t_0 <= -0.98) tmp = Float64(U + Float64(2.0 * Float64(J * Float64(l + Float64(-0.125 * Float64(l * (K ^ 2.0))))))); elseif (t_0 <= 0.26) tmp = Float64(U + Float64(2.0 * Float64(l * Float64(J * cos(Float64(K * 0.5)))))); else tmp = Float64(U + Float64(2.0 * Float64(J * log1p(expm1(l))))); end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, -0.98], N[(U + N[(2.0 * N[(J * N[(l + N[(-0.125 * N[(l * N[Power[K, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 0.26], N[(U + N[(2.0 * N[(l * N[(J * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(2.0 * N[(J * N[Log[1 + N[(Exp[l] - 1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;t\_0 \leq -0.98:\\
\;\;\;\;U + 2 \cdot \left(J \cdot \left(\ell + -0.125 \cdot \left(\ell \cdot {K}^{2}\right)\right)\right)\\
\mathbf{elif}\;t\_0 \leq 0.26:\\
\;\;\;\;U + 2 \cdot \left(\ell \cdot \left(J \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + 2 \cdot \left(J \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(\ell\right)\right)\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K 2)) < -0.97999999999999998Initial program 91.2%
Taylor expanded in l around 0 32.0%
Taylor expanded in K around 0 76.2%
if -0.97999999999999998 < (cos.f64 (/.f64 K 2)) < 0.26000000000000001Initial program 82.8%
Taylor expanded in l around 0 77.4%
associate-*r*77.3%
*-commutative77.3%
associate-*l*77.4%
Simplified77.4%
if 0.26000000000000001 < (cos.f64 (/.f64 K 2)) Initial program 85.6%
Taylor expanded in l around 0 65.7%
log1p-expm1-u99.3%
*-commutative99.3%
Applied egg-rr99.3%
Taylor expanded in K around 0 84.9%
expm1-define96.6%
Simplified96.6%
Final simplification90.2%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= t_0 0.26)
(+ U (* t_0 (+ (* 0.3333333333333333 (* J (pow l 3.0))) (* 2.0 (* J l)))))
(+ U (* 2.0 (* J (log1p (expm1 l))))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double tmp;
if (t_0 <= 0.26) {
tmp = U + (t_0 * ((0.3333333333333333 * (J * pow(l, 3.0))) + (2.0 * (J * l))));
} else {
tmp = U + (2.0 * (J * log1p(expm1(l))));
}
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 (t_0 <= 0.26) {
tmp = U + (t_0 * ((0.3333333333333333 * (J * Math.pow(l, 3.0))) + (2.0 * (J * l))));
} else {
tmp = U + (2.0 * (J * Math.log1p(Math.expm1(l))));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K / 2.0)) tmp = 0 if t_0 <= 0.26: tmp = U + (t_0 * ((0.3333333333333333 * (J * math.pow(l, 3.0))) + (2.0 * (J * l)))) else: tmp = U + (2.0 * (J * math.log1p(math.expm1(l)))) return tmp
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) tmp = 0.0 if (t_0 <= 0.26) tmp = Float64(U + Float64(t_0 * Float64(Float64(0.3333333333333333 * Float64(J * (l ^ 3.0))) + Float64(2.0 * Float64(J * l))))); else tmp = Float64(U + Float64(2.0 * Float64(J * log1p(expm1(l))))); end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, 0.26], N[(U + N[(t$95$0 * N[(N[(0.3333333333333333 * N[(J * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(2.0 * N[(J * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(2.0 * N[(J * N[Log[1 + N[(Exp[l] - 1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;t\_0 \leq 0.26:\\
\;\;\;\;U + t\_0 \cdot \left(0.3333333333333333 \cdot \left(J \cdot {\ell}^{3}\right) + 2 \cdot \left(J \cdot \ell\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + 2 \cdot \left(J \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(\ell\right)\right)\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K 2)) < 0.26000000000000001Initial program 84.0%
Taylor expanded in l around 0 89.5%
if 0.26000000000000001 < (cos.f64 (/.f64 K 2)) Initial program 85.6%
Taylor expanded in l around 0 65.7%
log1p-expm1-u99.3%
*-commutative99.3%
Applied egg-rr99.3%
Taylor expanded in K around 0 84.9%
expm1-define96.6%
Simplified96.6%
Final simplification94.2%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= t_0 0.26)
(+ U (* t_0 (* J (+ (* 0.3333333333333333 (pow l 3.0)) (* 2.0 l)))))
(+ U (* 2.0 (* J (log1p (expm1 l))))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double tmp;
if (t_0 <= 0.26) {
tmp = U + (t_0 * (J * ((0.3333333333333333 * pow(l, 3.0)) + (2.0 * l))));
} else {
tmp = U + (2.0 * (J * log1p(expm1(l))));
}
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 (t_0 <= 0.26) {
tmp = U + (t_0 * (J * ((0.3333333333333333 * Math.pow(l, 3.0)) + (2.0 * l))));
} else {
tmp = U + (2.0 * (J * Math.log1p(Math.expm1(l))));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K / 2.0)) tmp = 0 if t_0 <= 0.26: tmp = U + (t_0 * (J * ((0.3333333333333333 * math.pow(l, 3.0)) + (2.0 * l)))) else: tmp = U + (2.0 * (J * math.log1p(math.expm1(l)))) return tmp
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) tmp = 0.0 if (t_0 <= 0.26) tmp = Float64(U + Float64(t_0 * Float64(J * Float64(Float64(0.3333333333333333 * (l ^ 3.0)) + Float64(2.0 * l))))); else tmp = Float64(U + Float64(2.0 * Float64(J * log1p(expm1(l))))); end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, 0.26], N[(U + N[(t$95$0 * N[(J * N[(N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision] + N[(2.0 * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(2.0 * N[(J * N[Log[1 + N[(Exp[l] - 1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;t\_0 \leq 0.26:\\
\;\;\;\;U + t\_0 \cdot \left(J \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + 2 \cdot \ell\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + 2 \cdot \left(J \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(\ell\right)\right)\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K 2)) < 0.26000000000000001Initial program 84.0%
Taylor expanded in l around 0 89.5%
if 0.26000000000000001 < (cos.f64 (/.f64 K 2)) Initial program 85.6%
Taylor expanded in l around 0 65.7%
log1p-expm1-u99.3%
*-commutative99.3%
Applied egg-rr99.3%
Taylor expanded in K around 0 84.9%
expm1-define96.6%
Simplified96.6%
Final simplification94.2%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (+ U (* 2.0 (* J (+ l (* -0.125 (* l (pow K 2.0)))))))))
(if (<= l -4.1e+92)
t_0
(if (<= l -2.45e+67)
(log1p (expm1 (* U (+ U 4.0))))
(if (<= l -1.55e+23)
t_0
(if (<= l 820.0)
(+ U (* 2.0 (* l (* J (cos (* K 0.5))))))
(if (<= l 1.65e+131) (log1p (expm1 U)) t_0)))))))
double code(double J, double l, double K, double U) {
double t_0 = U + (2.0 * (J * (l + (-0.125 * (l * pow(K, 2.0))))));
double tmp;
if (l <= -4.1e+92) {
tmp = t_0;
} else if (l <= -2.45e+67) {
tmp = log1p(expm1((U * (U + 4.0))));
} else if (l <= -1.55e+23) {
tmp = t_0;
} else if (l <= 820.0) {
tmp = U + (2.0 * (l * (J * cos((K * 0.5)))));
} else if (l <= 1.65e+131) {
tmp = log1p(expm1(U));
} else {
tmp = t_0;
}
return tmp;
}
public static double code(double J, double l, double K, double U) {
double t_0 = U + (2.0 * (J * (l + (-0.125 * (l * Math.pow(K, 2.0))))));
double tmp;
if (l <= -4.1e+92) {
tmp = t_0;
} else if (l <= -2.45e+67) {
tmp = Math.log1p(Math.expm1((U * (U + 4.0))));
} else if (l <= -1.55e+23) {
tmp = t_0;
} else if (l <= 820.0) {
tmp = U + (2.0 * (l * (J * Math.cos((K * 0.5)))));
} else if (l <= 1.65e+131) {
tmp = Math.log1p(Math.expm1(U));
} else {
tmp = t_0;
}
return tmp;
}
def code(J, l, K, U): t_0 = U + (2.0 * (J * (l + (-0.125 * (l * math.pow(K, 2.0)))))) tmp = 0 if l <= -4.1e+92: tmp = t_0 elif l <= -2.45e+67: tmp = math.log1p(math.expm1((U * (U + 4.0)))) elif l <= -1.55e+23: tmp = t_0 elif l <= 820.0: tmp = U + (2.0 * (l * (J * math.cos((K * 0.5))))) elif l <= 1.65e+131: tmp = math.log1p(math.expm1(U)) else: tmp = t_0 return tmp
function code(J, l, K, U) t_0 = Float64(U + Float64(2.0 * Float64(J * Float64(l + Float64(-0.125 * Float64(l * (K ^ 2.0))))))) tmp = 0.0 if (l <= -4.1e+92) tmp = t_0; elseif (l <= -2.45e+67) tmp = log1p(expm1(Float64(U * Float64(U + 4.0)))); elseif (l <= -1.55e+23) tmp = t_0; elseif (l <= 820.0) tmp = Float64(U + Float64(2.0 * Float64(l * Float64(J * cos(Float64(K * 0.5)))))); elseif (l <= 1.65e+131) tmp = log1p(expm1(U)); else tmp = t_0; end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(U + N[(2.0 * N[(J * N[(l + N[(-0.125 * N[(l * N[Power[K, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -4.1e+92], t$95$0, If[LessEqual[l, -2.45e+67], N[Log[1 + N[(Exp[N[(U * N[(U + 4.0), $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision], If[LessEqual[l, -1.55e+23], t$95$0, If[LessEqual[l, 820.0], N[(U + N[(2.0 * N[(l * N[(J * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.65e+131], N[Log[1 + N[(Exp[U] - 1), $MachinePrecision]], $MachinePrecision], t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + 2 \cdot \left(J \cdot \left(\ell + -0.125 \cdot \left(\ell \cdot {K}^{2}\right)\right)\right)\\
\mathbf{if}\;\ell \leq -4.1 \cdot 10^{+92}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq -2.45 \cdot 10^{+67}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(U \cdot \left(U + 4\right)\right)\right)\\
\mathbf{elif}\;\ell \leq -1.55 \cdot 10^{+23}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq 820:\\
\;\;\;\;U + 2 \cdot \left(\ell \cdot \left(J \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\mathbf{elif}\;\ell \leq 1.65 \cdot 10^{+131}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(U\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if l < -4.10000000000000024e92 or -2.44999999999999995e67 < l < -1.54999999999999985e23 or 1.6499999999999999e131 < l Initial program 100.0%
Taylor expanded in l around 0 34.6%
Taylor expanded in K around 0 52.3%
if -4.10000000000000024e92 < l < -2.44999999999999995e67Initial program 100.0%
Applied egg-rr28.2%
log1p-expm1-u87.5%
sub-neg87.5%
metadata-eval87.5%
Applied egg-rr87.5%
if -1.54999999999999985e23 < l < 820Initial program 73.8%
Taylor expanded in l around 0 96.9%
associate-*r*96.8%
*-commutative96.8%
associate-*l*96.9%
Simplified96.9%
if 820 < l < 1.6499999999999999e131Initial program 100.0%
Applied egg-rr31.1%
Final simplification76.9%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (+ U (* 2.0 (* J (+ l (* -0.125 (* l (pow K 2.0)))))))))
(if (<= l -1.55e+23)
t_0
(if (<= l 940.0)
(+ U (* 2.0 (* l (* J (cos (* K 0.5))))))
(if (<= l 1.35e+131) (log1p (expm1 U)) t_0)))))
double code(double J, double l, double K, double U) {
double t_0 = U + (2.0 * (J * (l + (-0.125 * (l * pow(K, 2.0))))));
double tmp;
if (l <= -1.55e+23) {
tmp = t_0;
} else if (l <= 940.0) {
tmp = U + (2.0 * (l * (J * cos((K * 0.5)))));
} else if (l <= 1.35e+131) {
tmp = log1p(expm1(U));
} else {
tmp = t_0;
}
return tmp;
}
public static double code(double J, double l, double K, double U) {
double t_0 = U + (2.0 * (J * (l + (-0.125 * (l * Math.pow(K, 2.0))))));
double tmp;
if (l <= -1.55e+23) {
tmp = t_0;
} else if (l <= 940.0) {
tmp = U + (2.0 * (l * (J * Math.cos((K * 0.5)))));
} else if (l <= 1.35e+131) {
tmp = Math.log1p(Math.expm1(U));
} else {
tmp = t_0;
}
return tmp;
}
def code(J, l, K, U): t_0 = U + (2.0 * (J * (l + (-0.125 * (l * math.pow(K, 2.0)))))) tmp = 0 if l <= -1.55e+23: tmp = t_0 elif l <= 940.0: tmp = U + (2.0 * (l * (J * math.cos((K * 0.5))))) elif l <= 1.35e+131: tmp = math.log1p(math.expm1(U)) else: tmp = t_0 return tmp
function code(J, l, K, U) t_0 = Float64(U + Float64(2.0 * Float64(J * Float64(l + Float64(-0.125 * Float64(l * (K ^ 2.0))))))) tmp = 0.0 if (l <= -1.55e+23) tmp = t_0; elseif (l <= 940.0) tmp = Float64(U + Float64(2.0 * Float64(l * Float64(J * cos(Float64(K * 0.5)))))); elseif (l <= 1.35e+131) tmp = log1p(expm1(U)); else tmp = t_0; end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(U + N[(2.0 * N[(J * N[(l + N[(-0.125 * N[(l * N[Power[K, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -1.55e+23], t$95$0, If[LessEqual[l, 940.0], N[(U + N[(2.0 * N[(l * N[(J * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.35e+131], N[Log[1 + N[(Exp[U] - 1), $MachinePrecision]], $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + 2 \cdot \left(J \cdot \left(\ell + -0.125 \cdot \left(\ell \cdot {K}^{2}\right)\right)\right)\\
\mathbf{if}\;\ell \leq -1.55 \cdot 10^{+23}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq 940:\\
\;\;\;\;U + 2 \cdot \left(\ell \cdot \left(J \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\mathbf{elif}\;\ell \leq 1.35 \cdot 10^{+131}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(U\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if l < -1.54999999999999985e23 or 1.35000000000000002e131 < l Initial program 100.0%
Taylor expanded in l around 0 32.9%
Taylor expanded in K around 0 50.1%
if -1.54999999999999985e23 < l < 940Initial program 73.8%
Taylor expanded in l around 0 96.9%
associate-*r*96.8%
*-commutative96.8%
associate-*l*96.9%
Simplified96.9%
if 940 < l < 1.35000000000000002e131Initial program 100.0%
Applied egg-rr31.1%
Final simplification75.0%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (+ U (* 2.0 (* J (+ l (* -0.125 (* l (pow K 2.0))))))))
(t_1 (cos (* K 0.5))))
(if (<= l -1.55e+23)
t_0
(if (<= l 8.2e+130)
(+ U (* 2.0 (* l (* J t_1))))
(if (<= l 1.75e+247) t_0 (+ U (* 2.0 (* J (* l t_1)))))))))
double code(double J, double l, double K, double U) {
double t_0 = U + (2.0 * (J * (l + (-0.125 * (l * pow(K, 2.0))))));
double t_1 = cos((K * 0.5));
double tmp;
if (l <= -1.55e+23) {
tmp = t_0;
} else if (l <= 8.2e+130) {
tmp = U + (2.0 * (l * (J * t_1)));
} else if (l <= 1.75e+247) {
tmp = t_0;
} else {
tmp = U + (2.0 * (J * (l * t_1)));
}
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 = u + (2.0d0 * (j * (l + ((-0.125d0) * (l * (k ** 2.0d0))))))
t_1 = cos((k * 0.5d0))
if (l <= (-1.55d+23)) then
tmp = t_0
else if (l <= 8.2d+130) then
tmp = u + (2.0d0 * (l * (j * t_1)))
else if (l <= 1.75d+247) then
tmp = t_0
else
tmp = u + (2.0d0 * (j * (l * t_1)))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = U + (2.0 * (J * (l + (-0.125 * (l * Math.pow(K, 2.0))))));
double t_1 = Math.cos((K * 0.5));
double tmp;
if (l <= -1.55e+23) {
tmp = t_0;
} else if (l <= 8.2e+130) {
tmp = U + (2.0 * (l * (J * t_1)));
} else if (l <= 1.75e+247) {
tmp = t_0;
} else {
tmp = U + (2.0 * (J * (l * t_1)));
}
return tmp;
}
def code(J, l, K, U): t_0 = U + (2.0 * (J * (l + (-0.125 * (l * math.pow(K, 2.0)))))) t_1 = math.cos((K * 0.5)) tmp = 0 if l <= -1.55e+23: tmp = t_0 elif l <= 8.2e+130: tmp = U + (2.0 * (l * (J * t_1))) elif l <= 1.75e+247: tmp = t_0 else: tmp = U + (2.0 * (J * (l * t_1))) return tmp
function code(J, l, K, U) t_0 = Float64(U + Float64(2.0 * Float64(J * Float64(l + Float64(-0.125 * Float64(l * (K ^ 2.0))))))) t_1 = cos(Float64(K * 0.5)) tmp = 0.0 if (l <= -1.55e+23) tmp = t_0; elseif (l <= 8.2e+130) tmp = Float64(U + Float64(2.0 * Float64(l * Float64(J * t_1)))); elseif (l <= 1.75e+247) tmp = t_0; else tmp = Float64(U + Float64(2.0 * Float64(J * Float64(l * t_1)))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = U + (2.0 * (J * (l + (-0.125 * (l * (K ^ 2.0)))))); t_1 = cos((K * 0.5)); tmp = 0.0; if (l <= -1.55e+23) tmp = t_0; elseif (l <= 8.2e+130) tmp = U + (2.0 * (l * (J * t_1))); elseif (l <= 1.75e+247) tmp = t_0; else tmp = U + (2.0 * (J * (l * t_1))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(U + N[(2.0 * N[(J * N[(l + N[(-0.125 * N[(l * N[Power[K, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -1.55e+23], t$95$0, If[LessEqual[l, 8.2e+130], N[(U + N[(2.0 * N[(l * N[(J * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.75e+247], t$95$0, N[(U + N[(2.0 * N[(J * N[(l * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + 2 \cdot \left(J \cdot \left(\ell + -0.125 \cdot \left(\ell \cdot {K}^{2}\right)\right)\right)\\
t_1 := \cos \left(K \cdot 0.5\right)\\
\mathbf{if}\;\ell \leq -1.55 \cdot 10^{+23}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq 8.2 \cdot 10^{+130}:\\
\;\;\;\;U + 2 \cdot \left(\ell \cdot \left(J \cdot t\_1\right)\right)\\
\mathbf{elif}\;\ell \leq 1.75 \cdot 10^{+247}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;U + 2 \cdot \left(J \cdot \left(\ell \cdot t\_1\right)\right)\\
\end{array}
\end{array}
if l < -1.54999999999999985e23 or 8.19999999999999955e130 < l < 1.7500000000000001e247Initial program 100.0%
Taylor expanded in l around 0 26.9%
Taylor expanded in K around 0 49.0%
if -1.54999999999999985e23 < l < 8.19999999999999955e130Initial program 77.3%
Taylor expanded in l around 0 85.3%
associate-*r*85.3%
*-commutative85.3%
associate-*l*85.3%
Simplified85.3%
if 1.7500000000000001e247 < l Initial program 100.0%
Taylor expanded in l around 0 61.7%
Final simplification73.7%
(FPCore (J l K U)
:precision binary64
(if (<= l -6.3e+244)
(/ (* U (fma U U -16.0)) (+ U -4.0))
(if (<= l -2.4e+143)
(pow U -3.0)
(if (<= l -9e+19)
(+ U (* J (+ -0.5 (* (pow K 2.0) 0.0625))))
(+ U (* 2.0 (* J l)))))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -6.3e+244) {
tmp = (U * fma(U, U, -16.0)) / (U + -4.0);
} else if (l <= -2.4e+143) {
tmp = pow(U, -3.0);
} else if (l <= -9e+19) {
tmp = U + (J * (-0.5 + (pow(K, 2.0) * 0.0625)));
} else {
tmp = U + (2.0 * (J * l));
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (l <= -6.3e+244) tmp = Float64(Float64(U * fma(U, U, -16.0)) / Float64(U + -4.0)); elseif (l <= -2.4e+143) tmp = U ^ -3.0; elseif (l <= -9e+19) tmp = Float64(U + Float64(J * Float64(-0.5 + Float64((K ^ 2.0) * 0.0625)))); else tmp = Float64(U + Float64(2.0 * Float64(J * l))); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[l, -6.3e+244], N[(N[(U * N[(U * U + -16.0), $MachinePrecision]), $MachinePrecision] / N[(U + -4.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -2.4e+143], N[Power[U, -3.0], $MachinePrecision], If[LessEqual[l, -9e+19], N[(U + N[(J * N[(-0.5 + N[(N[Power[K, 2.0], $MachinePrecision] * 0.0625), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(2.0 * N[(J * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -6.3 \cdot 10^{+244}:\\
\;\;\;\;\frac{U \cdot \mathsf{fma}\left(U, U, -16\right)}{U + -4}\\
\mathbf{elif}\;\ell \leq -2.4 \cdot 10^{+143}:\\
\;\;\;\;{U}^{-3}\\
\mathbf{elif}\;\ell \leq -9 \cdot 10^{+19}:\\
\;\;\;\;U + J \cdot \left(-0.5 + {K}^{2} \cdot 0.0625\right)\\
\mathbf{else}:\\
\;\;\;\;U + 2 \cdot \left(J \cdot \ell\right)\\
\end{array}
\end{array}
if l < -6.2999999999999996e244Initial program 100.0%
Applied egg-rr33.1%
*-commutative33.1%
flip--33.1%
associate-*l/54.6%
fma-neg54.6%
metadata-eval54.6%
metadata-eval54.6%
Applied egg-rr54.6%
if -6.2999999999999996e244 < l < -2.3999999999999998e143Initial program 100.0%
Applied egg-rr43.9%
if -2.3999999999999998e143 < l < -9e19Initial program 100.0%
Applied egg-rr3.7%
Taylor expanded in K around 0 32.4%
*-commutative32.4%
associate-*r*32.4%
distribute-rgt-out32.4%
Simplified32.4%
if -9e19 < l Initial program 81.0%
Taylor expanded in l around 0 78.7%
Taylor expanded in K around 0 66.4%
Final simplification61.3%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (/ (* U (fma U U -16.0)) (+ U -4.0))))
(if (<= l -7.2e+247)
t_0
(if (<= l -2.05e+95)
(pow U -3.0)
(if (<= l -950.0) t_0 (+ U (* 2.0 (* J l))))))))
double code(double J, double l, double K, double U) {
double t_0 = (U * fma(U, U, -16.0)) / (U + -4.0);
double tmp;
if (l <= -7.2e+247) {
tmp = t_0;
} else if (l <= -2.05e+95) {
tmp = pow(U, -3.0);
} else if (l <= -950.0) {
tmp = t_0;
} else {
tmp = U + (2.0 * (J * l));
}
return tmp;
}
function code(J, l, K, U) t_0 = Float64(Float64(U * fma(U, U, -16.0)) / Float64(U + -4.0)) tmp = 0.0 if (l <= -7.2e+247) tmp = t_0; elseif (l <= -2.05e+95) tmp = U ^ -3.0; elseif (l <= -950.0) tmp = t_0; else tmp = Float64(U + Float64(2.0 * Float64(J * l))); end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[(U * N[(U * U + -16.0), $MachinePrecision]), $MachinePrecision] / N[(U + -4.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -7.2e+247], t$95$0, If[LessEqual[l, -2.05e+95], N[Power[U, -3.0], $MachinePrecision], If[LessEqual[l, -950.0], t$95$0, N[(U + N[(2.0 * N[(J * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{U \cdot \mathsf{fma}\left(U, U, -16\right)}{U + -4}\\
\mathbf{if}\;\ell \leq -7.2 \cdot 10^{+247}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq -2.05 \cdot 10^{+95}:\\
\;\;\;\;{U}^{-3}\\
\mathbf{elif}\;\ell \leq -950:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;U + 2 \cdot \left(J \cdot \ell\right)\\
\end{array}
\end{array}
if l < -7.2e247 or -2.04999999999999993e95 < l < -950Initial program 100.0%
Applied egg-rr27.9%
*-commutative27.9%
flip--27.9%
associate-*l/39.8%
fma-neg39.8%
metadata-eval39.8%
metadata-eval39.8%
Applied egg-rr39.8%
if -7.2e247 < l < -2.04999999999999993e95Initial program 100.0%
Applied egg-rr41.4%
if -950 < l Initial program 80.9%
Taylor expanded in l around 0 79.4%
Taylor expanded in K around 0 67.0%
Final simplification61.2%
(FPCore (J l K U) :precision binary64 (if (<= l -5.7e+240) (* U U) (if (<= l -6.2e+103) (pow U -3.0) (+ U (* 2.0 (* J l))))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -5.7e+240) {
tmp = U * U;
} else if (l <= -6.2e+103) {
tmp = pow(U, -3.0);
} else {
tmp = U + (2.0 * (J * l));
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if (l <= (-5.7d+240)) then
tmp = u * u
else if (l <= (-6.2d+103)) then
tmp = u ** (-3.0d0)
else
tmp = u + (2.0d0 * (j * l))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (l <= -5.7e+240) {
tmp = U * U;
} else if (l <= -6.2e+103) {
tmp = Math.pow(U, -3.0);
} else {
tmp = U + (2.0 * (J * l));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -5.7e+240: tmp = U * U elif l <= -6.2e+103: tmp = math.pow(U, -3.0) else: tmp = U + (2.0 * (J * l)) return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -5.7e+240) tmp = Float64(U * U); elseif (l <= -6.2e+103) tmp = U ^ -3.0; else tmp = Float64(U + Float64(2.0 * Float64(J * l))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -5.7e+240) tmp = U * U; elseif (l <= -6.2e+103) tmp = U ^ -3.0; else tmp = U + (2.0 * (J * l)); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -5.7e+240], N[(U * U), $MachinePrecision], If[LessEqual[l, -6.2e+103], N[Power[U, -3.0], $MachinePrecision], N[(U + N[(2.0 * N[(J * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -5.7 \cdot 10^{+240}:\\
\;\;\;\;U \cdot U\\
\mathbf{elif}\;\ell \leq -6.2 \cdot 10^{+103}:\\
\;\;\;\;{U}^{-3}\\
\mathbf{else}:\\
\;\;\;\;U + 2 \cdot \left(J \cdot \ell\right)\\
\end{array}
\end{array}
if l < -5.69999999999999973e240Initial program 100.0%
Applied egg-rr33.1%
if -5.69999999999999973e240 < l < -6.2000000000000003e103Initial program 100.0%
Applied egg-rr43.0%
if -6.2000000000000003e103 < l Initial program 82.5%
Taylor expanded in l around 0 73.8%
Taylor expanded in K around 0 62.4%
Final simplification59.1%
(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 85.0%
Taylor expanded in l around 0 67.5%
Final simplification67.5%
(FPCore (J l K U) :precision binary64 (+ U (* 2.0 (* l (* J (cos (* K 0.5)))))))
double code(double J, double l, double K, double U) {
return U + (2.0 * (l * (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 + (2.0d0 * (l * (j * cos((k * 0.5d0)))))
end function
public static double code(double J, double l, double K, double U) {
return U + (2.0 * (l * (J * Math.cos((K * 0.5)))));
}
def code(J, l, K, U): return U + (2.0 * (l * (J * math.cos((K * 0.5)))))
function code(J, l, K, U) return Float64(U + Float64(2.0 * Float64(l * Float64(J * cos(Float64(K * 0.5)))))) end
function tmp = code(J, l, K, U) tmp = U + (2.0 * (l * (J * cos((K * 0.5))))); end
code[J_, l_, K_, U_] := N[(U + N[(2.0 * N[(l * N[(J * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + 2 \cdot \left(\ell \cdot \left(J \cdot \cos \left(K \cdot 0.5\right)\right)\right)
\end{array}
Initial program 85.0%
Taylor expanded in l around 0 67.5%
associate-*r*67.5%
*-commutative67.5%
associate-*l*67.5%
Simplified67.5%
Final simplification67.5%
(FPCore (J l K U) :precision binary64 (if (<= l -3.3e+104) (pow U -4.0) (+ U (* 2.0 (* J l)))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -3.3e+104) {
tmp = pow(U, -4.0);
} else {
tmp = U + (2.0 * (J * l));
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if (l <= (-3.3d+104)) then
tmp = u ** (-4.0d0)
else
tmp = u + (2.0d0 * (j * l))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (l <= -3.3e+104) {
tmp = Math.pow(U, -4.0);
} else {
tmp = U + (2.0 * (J * l));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -3.3e+104: tmp = math.pow(U, -4.0) else: tmp = U + (2.0 * (J * l)) return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -3.3e+104) tmp = U ^ -4.0; else tmp = Float64(U + Float64(2.0 * Float64(J * l))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -3.3e+104) tmp = U ^ -4.0; else tmp = U + (2.0 * (J * l)); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -3.3e+104], N[Power[U, -4.0], $MachinePrecision], N[(U + N[(2.0 * N[(J * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -3.3 \cdot 10^{+104}:\\
\;\;\;\;{U}^{-4}\\
\mathbf{else}:\\
\;\;\;\;U + 2 \cdot \left(J \cdot \ell\right)\\
\end{array}
\end{array}
if l < -3.29999999999999985e104Initial program 100.0%
Applied egg-rr28.3%
if -3.29999999999999985e104 < l Initial program 82.5%
Taylor expanded in l around 0 73.8%
Taylor expanded in K around 0 62.4%
Final simplification57.5%
(FPCore (J l K U) :precision binary64 (if (or (<= l -1000.0) (not (<= l 7.5e-5))) (* U (- U -4.0)) U))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -1000.0) || !(l <= 7.5e-5)) {
tmp = U * (U - -4.0);
} 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 <= (-1000.0d0)) .or. (.not. (l <= 7.5d-5))) then
tmp = u * (u - (-4.0d0))
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 <= -1000.0) || !(l <= 7.5e-5)) {
tmp = U * (U - -4.0);
} else {
tmp = U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -1000.0) or not (l <= 7.5e-5): tmp = U * (U - -4.0) else: tmp = U return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -1000.0) || !(l <= 7.5e-5)) tmp = Float64(U * Float64(U - -4.0)); else tmp = U; end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -1000.0) || ~((l <= 7.5e-5))) tmp = U * (U - -4.0); else tmp = U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -1000.0], N[Not[LessEqual[l, 7.5e-5]], $MachinePrecision]], N[(U * N[(U - -4.0), $MachinePrecision]), $MachinePrecision], U]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1000 \lor \neg \left(\ell \leq 7.5 \cdot 10^{-5}\right):\\
\;\;\;\;U \cdot \left(U - -4\right)\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\end{array}
if l < -1e3 or 7.49999999999999934e-5 < l Initial program 99.7%
Applied egg-rr17.6%
if -1e3 < l < 7.49999999999999934e-5Initial program 72.9%
Taylor expanded in J around 0 72.6%
Final simplification47.7%
(FPCore (J l K U) :precision binary64 (if (or (<= l -1250.0) (not (<= l 7.5e-5))) (* U U) U))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -1250.0) || !(l <= 7.5e-5)) {
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 <= (-1250.0d0)) .or. (.not. (l <= 7.5d-5))) 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 <= -1250.0) || !(l <= 7.5e-5)) {
tmp = U * U;
} else {
tmp = U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -1250.0) or not (l <= 7.5e-5): tmp = U * U else: tmp = U return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -1250.0) || !(l <= 7.5e-5)) tmp = Float64(U * U); else tmp = U; end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -1250.0) || ~((l <= 7.5e-5))) tmp = U * U; else tmp = U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -1250.0], N[Not[LessEqual[l, 7.5e-5]], $MachinePrecision]], N[(U * U), $MachinePrecision], U]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1250 \lor \neg \left(\ell \leq 7.5 \cdot 10^{-5}\right):\\
\;\;\;\;U \cdot U\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\end{array}
if l < -1250 or 7.49999999999999934e-5 < l Initial program 99.7%
Applied egg-rr17.4%
if -1250 < l < 7.49999999999999934e-5Initial program 72.9%
Taylor expanded in J around 0 72.6%
Final simplification47.6%
(FPCore (J l K U) :precision binary64 (+ U (* 2.0 (* J l))))
double code(double J, double l, double K, double U) {
return U + (2.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 + (2.0d0 * (j * l))
end function
public static double code(double J, double l, double K, double U) {
return U + (2.0 * (J * l));
}
def code(J, l, K, U): return U + (2.0 * (J * l))
function code(J, l, K, U) return Float64(U + Float64(2.0 * Float64(J * l))) end
function tmp = code(J, l, K, U) tmp = U + (2.0 * (J * l)); end
code[J_, l_, K_, U_] := N[(U + N[(2.0 * N[(J * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + 2 \cdot \left(J \cdot \ell\right)
\end{array}
Initial program 85.0%
Taylor expanded in l around 0 67.5%
Taylor expanded in K around 0 55.7%
Final simplification55.7%
(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 85.0%
Applied egg-rr2.9%
*-inverses2.9%
Simplified2.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 85.0%
Taylor expanded in J around 0 40.8%
Final simplification40.8%
herbie shell --seed 2024041
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))