
(FPCore (J l K U) :precision binary64 (+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))
double code(double J, double l, double K, double U) {
return ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = ((j * (exp(l) - exp(-l))) * cos((k / 2.0d0))) + u
end function
public static double code(double J, double l, double K, double U) {
return ((J * (Math.exp(l) - Math.exp(-l))) * Math.cos((K / 2.0))) + U;
}
def code(J, l, K, U): return ((J * (math.exp(l) - math.exp(-l))) * math.cos((K / 2.0))) + U
function code(J, l, K, U) return Float64(Float64(Float64(J * Float64(exp(l) - exp(Float64(-l)))) * cos(Float64(K / 2.0))) + U) end
function tmp = code(J, l, K, U) tmp = ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U; end
code[J_, l_, K_, U_] := N[(N[(N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]
\begin{array}{l}
\\
\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (J l K U) :precision binary64 (+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))
double code(double J, double l, double K, double U) {
return ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = ((j * (exp(l) - exp(-l))) * cos((k / 2.0d0))) + u
end function
public static double code(double J, double l, double K, double U) {
return ((J * (Math.exp(l) - Math.exp(-l))) * Math.cos((K / 2.0))) + U;
}
def code(J, l, K, U): return ((J * (math.exp(l) - math.exp(-l))) * math.cos((K / 2.0))) + U
function code(J, l, K, U) return Float64(Float64(Float64(J * Float64(exp(l) - exp(Float64(-l)))) * cos(Float64(K / 2.0))) + U) end
function tmp = code(J, l, K, U) tmp = ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U; end
code[J_, l_, K_, U_] := N[(N[(N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]
\begin{array}{l}
\\
\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U
\end{array}
(FPCore (J l K U) :precision binary64 (+ (* 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 88.3%
Taylor expanded in l around 0 65.9%
log1p-expm1-u98.8%
*-commutative98.8%
Applied egg-rr98.8%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (* l (cos (* K 0.5)))) (t_1 (cos (/ K 2.0))))
(if (<= t_1 -0.48)
(* U (+ 1.0 (* 2.0 (* t_0 (/ J U)))))
(if (<= t_1 0.78)
(* J (+ (* 2.0 t_0) (/ U J)))
(* U (+ 1.0 (* 2.0 (* J (/ l U)))))))))
double code(double J, double l, double K, double U) {
double t_0 = l * cos((K * 0.5));
double t_1 = cos((K / 2.0));
double tmp;
if (t_1 <= -0.48) {
tmp = U * (1.0 + (2.0 * (t_0 * (J / U))));
} else if (t_1 <= 0.78) {
tmp = J * ((2.0 * t_0) + (U / J));
} else {
tmp = U * (1.0 + (2.0 * (J * (l / U))));
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = l * cos((k * 0.5d0))
t_1 = cos((k / 2.0d0))
if (t_1 <= (-0.48d0)) then
tmp = u * (1.0d0 + (2.0d0 * (t_0 * (j / u))))
else if (t_1 <= 0.78d0) then
tmp = j * ((2.0d0 * t_0) + (u / j))
else
tmp = u * (1.0d0 + (2.0d0 * (j * (l / u))))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = l * Math.cos((K * 0.5));
double t_1 = Math.cos((K / 2.0));
double tmp;
if (t_1 <= -0.48) {
tmp = U * (1.0 + (2.0 * (t_0 * (J / U))));
} else if (t_1 <= 0.78) {
tmp = J * ((2.0 * t_0) + (U / J));
} else {
tmp = U * (1.0 + (2.0 * (J * (l / U))));
}
return tmp;
}
def code(J, l, K, U): t_0 = l * math.cos((K * 0.5)) t_1 = math.cos((K / 2.0)) tmp = 0 if t_1 <= -0.48: tmp = U * (1.0 + (2.0 * (t_0 * (J / U)))) elif t_1 <= 0.78: tmp = J * ((2.0 * t_0) + (U / J)) else: tmp = U * (1.0 + (2.0 * (J * (l / U)))) return tmp
function code(J, l, K, U) t_0 = Float64(l * cos(Float64(K * 0.5))) t_1 = cos(Float64(K / 2.0)) tmp = 0.0 if (t_1 <= -0.48) tmp = Float64(U * Float64(1.0 + Float64(2.0 * Float64(t_0 * Float64(J / U))))); elseif (t_1 <= 0.78) tmp = Float64(J * Float64(Float64(2.0 * t_0) + Float64(U / J))); else tmp = Float64(U * Float64(1.0 + Float64(2.0 * Float64(J * Float64(l / U))))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = l * cos((K * 0.5)); t_1 = cos((K / 2.0)); tmp = 0.0; if (t_1 <= -0.48) tmp = U * (1.0 + (2.0 * (t_0 * (J / U)))); elseif (t_1 <= 0.78) tmp = J * ((2.0 * t_0) + (U / J)); else tmp = U * (1.0 + (2.0 * (J * (l / U)))); end tmp_2 = 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[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$1, -0.48], N[(U * N[(1.0 + N[(2.0 * N[(t$95$0 * N[(J / U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.78], N[(J * N[(N[(2.0 * t$95$0), $MachinePrecision] + N[(U / J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U * N[(1.0 + N[(2.0 * N[(J * N[(l / U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \ell \cdot \cos \left(K \cdot 0.5\right)\\
t_1 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;t\_1 \leq -0.48:\\
\;\;\;\;U \cdot \left(1 + 2 \cdot \left(t\_0 \cdot \frac{J}{U}\right)\right)\\
\mathbf{elif}\;t\_1 \leq 0.78:\\
\;\;\;\;J \cdot \left(2 \cdot t\_0 + \frac{U}{J}\right)\\
\mathbf{else}:\\
\;\;\;\;U \cdot \left(1 + 2 \cdot \left(J \cdot \frac{\ell}{U}\right)\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < -0.47999999999999998Initial program 82.3%
Taylor expanded in l around 0 72.2%
log1p-expm1-u98.3%
*-commutative98.3%
Applied egg-rr98.3%
Taylor expanded in U around inf 83.1%
*-commutative83.1%
*-commutative83.1%
*-commutative83.1%
associate-*r*83.1%
associate-*r/83.1%
*-commutative83.1%
*-commutative83.1%
*-commutative83.1%
Simplified83.1%
Taylor expanded in J around 0 83.1%
*-commutative83.1%
associate-/l*77.4%
Simplified77.4%
if -0.47999999999999998 < (cos.f64 (/.f64 K #s(literal 2 binary64))) < 0.78000000000000003Initial program 83.6%
Taylor expanded in l around 0 70.0%
Taylor expanded in J around inf 72.8%
if 0.78000000000000003 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 92.8%
Taylor expanded in l around 0 61.5%
log1p-expm1-u98.9%
*-commutative98.9%
Applied egg-rr98.9%
Taylor expanded in U around inf 63.6%
*-commutative63.6%
*-commutative63.6%
*-commutative63.6%
associate-*r*63.6%
associate-*r/63.6%
*-commutative63.6%
*-commutative63.6%
*-commutative63.6%
Simplified63.6%
Taylor expanded in K around 0 63.1%
associate-/l*68.7%
Simplified68.7%
Final simplification71.5%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) 0.09) (* U (+ 1.0 (* 2.0 (/ (* J (* l (cos (* K 0.5)))) U)))) (+ U (* 2.0 (* J (log1p (expm1 l)))))))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= 0.09) {
tmp = U * (1.0 + (2.0 * ((J * (l * cos((K * 0.5)))) / U)));
} else {
tmp = U + (2.0 * (J * log1p(expm1(l))));
}
return tmp;
}
public static double code(double J, double l, double K, double U) {
double tmp;
if (Math.cos((K / 2.0)) <= 0.09) {
tmp = U * (1.0 + (2.0 * ((J * (l * Math.cos((K * 0.5)))) / U)));
} else {
tmp = U + (2.0 * (J * Math.log1p(Math.expm1(l))));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if math.cos((K / 2.0)) <= 0.09: tmp = U * (1.0 + (2.0 * ((J * (l * math.cos((K * 0.5)))) / U))) else: tmp = U + (2.0 * (J * math.log1p(math.expm1(l)))) return tmp
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= 0.09) tmp = Float64(U * Float64(1.0 + Float64(2.0 * Float64(Float64(J * Float64(l * cos(Float64(K * 0.5)))) / U)))); else tmp = Float64(U + Float64(2.0 * Float64(J * log1p(expm1(l))))); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], 0.09], N[(U * N[(1.0 + N[(2.0 * N[(N[(J * N[(l * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / U), $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}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq 0.09:\\
\;\;\;\;U \cdot \left(1 + 2 \cdot \frac{J \cdot \left(\ell \cdot \cos \left(K \cdot 0.5\right)\right)}{U}\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 #s(literal 2 binary64))) < 0.089999999999999997Initial program 82.1%
Taylor expanded in l around 0 70.0%
Taylor expanded in U around inf 77.4%
if 0.089999999999999997 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 90.9%
Taylor expanded in l around 0 64.1%
log1p-expm1-u99.2%
*-commutative99.2%
Applied egg-rr99.2%
Taylor expanded in K around 0 95.8%
Final simplification90.4%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))) (t_1 (exp (- l))))
(if (<= l -1.02)
(+ U (* (* J (- 0.3333333333333333 t_1)) t_0))
(if (<= l 0.032)
(+ U (* t_0 (* J (* l (+ 2.0 (* 0.3333333333333333 (pow l 2.0)))))))
(if (<= l 9.4e+42)
(+ U (* J (- (exp l) t_1)))
(+
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 t_1 = exp(-l);
double tmp;
if (l <= -1.02) {
tmp = U + ((J * (0.3333333333333333 - t_1)) * t_0);
} else if (l <= 0.032) {
tmp = U + (t_0 * (J * (l * (2.0 + (0.3333333333333333 * pow(l, 2.0))))));
} else if (l <= 9.4e+42) {
tmp = U + (J * (exp(l) - t_1));
} else {
tmp = U + (0.0003968253968253968 * ((J * pow(l, 7.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) :: t_1
real(8) :: tmp
t_0 = cos((k / 2.0d0))
t_1 = exp(-l)
if (l <= (-1.02d0)) then
tmp = u + ((j * (0.3333333333333333d0 - t_1)) * t_0)
else if (l <= 0.032d0) then
tmp = u + (t_0 * (j * (l * (2.0d0 + (0.3333333333333333d0 * (l ** 2.0d0))))))
else if (l <= 9.4d+42) then
tmp = u + (j * (exp(l) - t_1))
else
tmp = u + (0.0003968253968253968d0 * ((j * (l ** 7.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.cos((K / 2.0));
double t_1 = Math.exp(-l);
double tmp;
if (l <= -1.02) {
tmp = U + ((J * (0.3333333333333333 - t_1)) * t_0);
} else if (l <= 0.032) {
tmp = U + (t_0 * (J * (l * (2.0 + (0.3333333333333333 * Math.pow(l, 2.0))))));
} else if (l <= 9.4e+42) {
tmp = U + (J * (Math.exp(l) - t_1));
} 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)) t_1 = math.exp(-l) tmp = 0 if l <= -1.02: tmp = U + ((J * (0.3333333333333333 - t_1)) * t_0) elif l <= 0.032: tmp = U + (t_0 * (J * (l * (2.0 + (0.3333333333333333 * math.pow(l, 2.0)))))) elif l <= 9.4e+42: tmp = U + (J * (math.exp(l) - t_1)) 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)) t_1 = exp(Float64(-l)) tmp = 0.0 if (l <= -1.02) tmp = Float64(U + Float64(Float64(J * Float64(0.3333333333333333 - t_1)) * t_0)); elseif (l <= 0.032) tmp = Float64(U + Float64(t_0 * Float64(J * Float64(l * Float64(2.0 + Float64(0.3333333333333333 * (l ^ 2.0))))))); elseif (l <= 9.4e+42) tmp = Float64(U + Float64(J * Float64(exp(l) - t_1))); else tmp = Float64(U + Float64(0.0003968253968253968 * Float64(Float64(J * (l ^ 7.0)) * cos(Float64(K * 0.5))))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = cos((K / 2.0)); t_1 = exp(-l); tmp = 0.0; if (l <= -1.02) tmp = U + ((J * (0.3333333333333333 - t_1)) * t_0); elseif (l <= 0.032) tmp = U + (t_0 * (J * (l * (2.0 + (0.3333333333333333 * (l ^ 2.0)))))); elseif (l <= 9.4e+42) tmp = U + (J * (exp(l) - t_1)); else tmp = U + (0.0003968253968253968 * ((J * (l ^ 7.0)) * cos((K * 0.5)))); 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[Exp[(-l)], $MachinePrecision]}, If[LessEqual[l, -1.02], N[(U + N[(N[(J * N[(0.3333333333333333 - t$95$1), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 0.032], 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, 9.4e+42], N[(U + N[(J * N[(N[Exp[l], $MachinePrecision] - t$95$1), $MachinePrecision]), $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)\\
t_1 := e^{-\ell}\\
\mathbf{if}\;\ell \leq -1.02:\\
\;\;\;\;U + \left(J \cdot \left(0.3333333333333333 - t\_1\right)\right) \cdot t\_0\\
\mathbf{elif}\;\ell \leq 0.032:\\
\;\;\;\;U + t\_0 \cdot \left(J \cdot \left(\ell \cdot \left(2 + 0.3333333333333333 \cdot {\ell}^{2}\right)\right)\right)\\
\mathbf{elif}\;\ell \leq 9.4 \cdot 10^{+42}:\\
\;\;\;\;U + J \cdot \left(e^{\ell} - t\_1\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.02Initial program 100.0%
Applied egg-rr98.8%
if -1.02 < l < 0.032000000000000001Initial program 78.0%
Taylor expanded in l around 0 99.6%
if 0.032000000000000001 < l < 9.39999999999999971e42Initial program 100.0%
Taylor expanded in K around 0 60.0%
if 9.39999999999999971e42 < l Initial program 100.0%
Taylor expanded in l around 0 95.8%
distribute-rgt-in95.8%
associate-*r*95.8%
associate-+r+95.8%
+-commutative95.8%
*-commutative95.8%
associate-*l*95.8%
*-commutative95.8%
*-commutative95.8%
distribute-lft-out95.8%
fma-define95.8%
*-commutative95.8%
associate-*l*95.8%
Simplified95.8%
Taylor expanded in l around inf 100.0%
associate-*r*100.0%
Simplified100.0%
Final simplification97.2%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (* K 0.5))) (t_1 (exp (- l))))
(if (<= l -0.73)
(+ U (* (* J (- 0.3333333333333333 t_1)) (cos (/ K 2.0))))
(if (<= l 0.09)
(+ U (* 2.0 (* J (* l t_0))))
(if (<= l 1.05e+44)
(+ U (* J (- (exp l) t_1)))
(+ 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 t_1 = exp(-l);
double tmp;
if (l <= -0.73) {
tmp = U + ((J * (0.3333333333333333 - t_1)) * cos((K / 2.0)));
} else if (l <= 0.09) {
tmp = U + (2.0 * (J * (l * t_0)));
} else if (l <= 1.05e+44) {
tmp = U + (J * (exp(l) - t_1));
} else {
tmp = U + (0.0003968253968253968 * ((J * pow(l, 7.0)) * t_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 * 0.5d0))
t_1 = exp(-l)
if (l <= (-0.73d0)) then
tmp = u + ((j * (0.3333333333333333d0 - t_1)) * cos((k / 2.0d0)))
else if (l <= 0.09d0) then
tmp = u + (2.0d0 * (j * (l * t_0)))
else if (l <= 1.05d+44) then
tmp = u + (j * (exp(l) - t_1))
else
tmp = u + (0.0003968253968253968d0 * ((j * (l ** 7.0d0)) * t_0))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = Math.cos((K * 0.5));
double t_1 = Math.exp(-l);
double tmp;
if (l <= -0.73) {
tmp = U + ((J * (0.3333333333333333 - t_1)) * Math.cos((K / 2.0)));
} else if (l <= 0.09) {
tmp = U + (2.0 * (J * (l * t_0)));
} else if (l <= 1.05e+44) {
tmp = U + (J * (Math.exp(l) - t_1));
} 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)) t_1 = math.exp(-l) tmp = 0 if l <= -0.73: tmp = U + ((J * (0.3333333333333333 - t_1)) * math.cos((K / 2.0))) elif l <= 0.09: tmp = U + (2.0 * (J * (l * t_0))) elif l <= 1.05e+44: tmp = U + (J * (math.exp(l) - t_1)) 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)) t_1 = exp(Float64(-l)) tmp = 0.0 if (l <= -0.73) tmp = Float64(U + Float64(Float64(J * Float64(0.3333333333333333 - t_1)) * cos(Float64(K / 2.0)))); elseif (l <= 0.09) tmp = Float64(U + Float64(2.0 * Float64(J * Float64(l * t_0)))); elseif (l <= 1.05e+44) tmp = Float64(U + Float64(J * Float64(exp(l) - t_1))); else tmp = Float64(U + Float64(0.0003968253968253968 * Float64(Float64(J * (l ^ 7.0)) * t_0))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = cos((K * 0.5)); t_1 = exp(-l); tmp = 0.0; if (l <= -0.73) tmp = U + ((J * (0.3333333333333333 - t_1)) * cos((K / 2.0))); elseif (l <= 0.09) tmp = U + (2.0 * (J * (l * t_0))); elseif (l <= 1.05e+44) tmp = U + (J * (exp(l) - t_1)); else tmp = U + (0.0003968253968253968 * ((J * (l ^ 7.0)) * t_0)); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Exp[(-l)], $MachinePrecision]}, If[LessEqual[l, -0.73], N[(U + N[(N[(J * N[(0.3333333333333333 - t$95$1), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 0.09], N[(U + N[(2.0 * N[(J * N[(l * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.05e+44], N[(U + N[(J * N[(N[Exp[l], $MachinePrecision] - t$95$1), $MachinePrecision]), $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)\\
t_1 := e^{-\ell}\\
\mathbf{if}\;\ell \leq -0.73:\\
\;\;\;\;U + \left(J \cdot \left(0.3333333333333333 - t\_1\right)\right) \cdot \cos \left(\frac{K}{2}\right)\\
\mathbf{elif}\;\ell \leq 0.09:\\
\;\;\;\;U + 2 \cdot \left(J \cdot \left(\ell \cdot t\_0\right)\right)\\
\mathbf{elif}\;\ell \leq 1.05 \cdot 10^{+44}:\\
\;\;\;\;U + J \cdot \left(e^{\ell} - t\_1\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.72999999999999998Initial program 100.0%
Applied egg-rr98.8%
if -0.72999999999999998 < l < 0.089999999999999997Initial program 78.0%
Taylor expanded in l around 0 99.1%
if 0.089999999999999997 < l < 1.04999999999999993e44Initial program 100.0%
Taylor expanded in K around 0 60.0%
if 1.04999999999999993e44 < l Initial program 100.0%
Taylor expanded in l around 0 95.8%
distribute-rgt-in95.8%
associate-*r*95.8%
associate-+r+95.8%
+-commutative95.8%
*-commutative95.8%
associate-*l*95.8%
*-commutative95.8%
*-commutative95.8%
distribute-lft-out95.8%
fma-define95.8%
*-commutative95.8%
associate-*l*95.8%
Simplified95.8%
Taylor expanded in l around inf 100.0%
associate-*r*100.0%
Simplified100.0%
Final simplification96.9%
(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 -4.1)
t_1
(if (<= l 0.1)
(+ U (* 2.0 (* J (* l t_0))))
(if (<= l 9.5e+43) (+ U (* J (- (exp l) (exp (- l))))) 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 <= -4.1) {
tmp = t_1;
} else if (l <= 0.1) {
tmp = U + (2.0 * (J * (l * t_0)));
} else if (l <= 9.5e+43) {
tmp = U + (J * (exp(l) - exp(-l)));
} else {
tmp = 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 = cos((k * 0.5d0))
t_1 = u + (0.0003968253968253968d0 * ((j * (l ** 7.0d0)) * t_0))
if (l <= (-4.1d0)) then
tmp = t_1
else if (l <= 0.1d0) then
tmp = u + (2.0d0 * (j * (l * t_0)))
else if (l <= 9.5d+43) then
tmp = u + (j * (exp(l) - exp(-l)))
else
tmp = t_1
end if
code = tmp
end function
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 <= -4.1) {
tmp = t_1;
} else if (l <= 0.1) {
tmp = U + (2.0 * (J * (l * t_0)));
} else if (l <= 9.5e+43) {
tmp = U + (J * (Math.exp(l) - Math.exp(-l)));
} 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 <= -4.1: tmp = t_1 elif l <= 0.1: tmp = U + (2.0 * (J * (l * t_0))) elif l <= 9.5e+43: tmp = U + (J * (math.exp(l) - math.exp(-l))) 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 <= -4.1) tmp = t_1; elseif (l <= 0.1) tmp = Float64(U + Float64(2.0 * Float64(J * Float64(l * t_0)))); elseif (l <= 9.5e+43) tmp = Float64(U + Float64(J * Float64(exp(l) - exp(Float64(-l))))); else tmp = t_1; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = cos((K * 0.5)); t_1 = U + (0.0003968253968253968 * ((J * (l ^ 7.0)) * t_0)); tmp = 0.0; if (l <= -4.1) tmp = t_1; elseif (l <= 0.1) tmp = U + (2.0 * (J * (l * t_0))); elseif (l <= 9.5e+43) tmp = U + (J * (exp(l) - exp(-l))); else tmp = t_1; end tmp_2 = 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, -4.1], t$95$1, If[LessEqual[l, 0.1], N[(U + N[(2.0 * N[(J * N[(l * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 9.5e+43], N[(U + N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $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 -4.1:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\ell \leq 0.1:\\
\;\;\;\;U + 2 \cdot \left(J \cdot \left(\ell \cdot t\_0\right)\right)\\
\mathbf{elif}\;\ell \leq 9.5 \cdot 10^{+43}:\\
\;\;\;\;U + J \cdot \left(e^{\ell} - e^{-\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if l < -4.0999999999999996 or 9.5000000000000004e43 < l Initial program 100.0%
Taylor expanded in l around 0 91.9%
distribute-rgt-in91.9%
associate-*r*91.9%
associate-+r+91.9%
+-commutative91.9%
*-commutative91.9%
associate-*l*91.9%
*-commutative91.9%
*-commutative91.9%
distribute-lft-out91.9%
fma-define91.9%
*-commutative91.9%
associate-*l*91.9%
Simplified91.9%
Taylor expanded in l around inf 96.4%
associate-*r*96.4%
Simplified96.4%
if -4.0999999999999996 < l < 0.10000000000000001Initial program 78.0%
Taylor expanded in l around 0 99.1%
if 0.10000000000000001 < l < 9.5000000000000004e43Initial program 100.0%
Taylor expanded in K around 0 60.0%
Final simplification95.7%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) 0.78) (* U (+ 1.0 (* 2.0 (/ (* J (* l (cos (* K 0.5)))) U)))) (* U (+ 1.0 (* 2.0 (* J (/ l U)))))))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= 0.78) {
tmp = U * (1.0 + (2.0 * ((J * (l * cos((K * 0.5)))) / U)));
} else {
tmp = U * (1.0 + (2.0 * (J * (l / 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 (cos((k / 2.0d0)) <= 0.78d0) then
tmp = u * (1.0d0 + (2.0d0 * ((j * (l * cos((k * 0.5d0)))) / u)))
else
tmp = u * (1.0d0 + (2.0d0 * (j * (l / u))))
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.78) {
tmp = U * (1.0 + (2.0 * ((J * (l * Math.cos((K * 0.5)))) / U)));
} else {
tmp = U * (1.0 + (2.0 * (J * (l / U))));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if math.cos((K / 2.0)) <= 0.78: tmp = U * (1.0 + (2.0 * ((J * (l * math.cos((K * 0.5)))) / U))) else: tmp = U * (1.0 + (2.0 * (J * (l / U)))) return tmp
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= 0.78) tmp = Float64(U * Float64(1.0 + Float64(2.0 * Float64(Float64(J * Float64(l * cos(Float64(K * 0.5)))) / U)))); else tmp = Float64(U * Float64(1.0 + Float64(2.0 * Float64(J * Float64(l / U))))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (cos((K / 2.0)) <= 0.78) tmp = U * (1.0 + (2.0 * ((J * (l * cos((K * 0.5)))) / U))); else tmp = U * (1.0 + (2.0 * (J * (l / U)))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], 0.78], N[(U * N[(1.0 + N[(2.0 * N[(N[(J * N[(l * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U * N[(1.0 + N[(2.0 * N[(J * N[(l / U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq 0.78:\\
\;\;\;\;U \cdot \left(1 + 2 \cdot \frac{J \cdot \left(\ell \cdot \cos \left(K \cdot 0.5\right)\right)}{U}\right)\\
\mathbf{else}:\\
\;\;\;\;U \cdot \left(1 + 2 \cdot \left(J \cdot \frac{\ell}{U}\right)\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < 0.78000000000000003Initial program 83.0%
Taylor expanded in l around 0 71.0%
Taylor expanded in U around inf 74.9%
if 0.78000000000000003 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 92.8%
Taylor expanded in l around 0 61.5%
log1p-expm1-u98.9%
*-commutative98.9%
Applied egg-rr98.9%
Taylor expanded in U around inf 63.6%
*-commutative63.6%
*-commutative63.6%
*-commutative63.6%
associate-*r*63.6%
associate-*r/63.6%
*-commutative63.6%
*-commutative63.6%
*-commutative63.6%
Simplified63.6%
Taylor expanded in K around 0 63.1%
associate-/l*68.7%
Simplified68.7%
Final simplification71.5%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) 0.78) (+ U (* 2.0 (* J (* l (cos (* K 0.5)))))) (* U (+ 1.0 (* 2.0 (* J (/ l U)))))))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= 0.78) {
tmp = U + (2.0 * (J * (l * cos((K * 0.5)))));
} else {
tmp = U * (1.0 + (2.0 * (J * (l / 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 (cos((k / 2.0d0)) <= 0.78d0) then
tmp = u + (2.0d0 * (j * (l * cos((k * 0.5d0)))))
else
tmp = u * (1.0d0 + (2.0d0 * (j * (l / u))))
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.78) {
tmp = U + (2.0 * (J * (l * Math.cos((K * 0.5)))));
} else {
tmp = U * (1.0 + (2.0 * (J * (l / U))));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if math.cos((K / 2.0)) <= 0.78: tmp = U + (2.0 * (J * (l * math.cos((K * 0.5))))) else: tmp = U * (1.0 + (2.0 * (J * (l / U)))) return tmp
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= 0.78) tmp = Float64(U + Float64(2.0 * Float64(J * Float64(l * cos(Float64(K * 0.5)))))); else tmp = Float64(U * Float64(1.0 + Float64(2.0 * Float64(J * Float64(l / U))))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (cos((K / 2.0)) <= 0.78) tmp = U + (2.0 * (J * (l * cos((K * 0.5))))); else tmp = U * (1.0 + (2.0 * (J * (l / U)))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], 0.78], N[(U + N[(2.0 * N[(J * N[(l * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U * N[(1.0 + N[(2.0 * N[(J * N[(l / U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq 0.78:\\
\;\;\;\;U + 2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U \cdot \left(1 + 2 \cdot \left(J \cdot \frac{\ell}{U}\right)\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < 0.78000000000000003Initial program 83.0%
Taylor expanded in l around 0 71.0%
if 0.78000000000000003 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 92.8%
Taylor expanded in l around 0 61.5%
log1p-expm1-u98.9%
*-commutative98.9%
Applied egg-rr98.9%
Taylor expanded in U around inf 63.6%
*-commutative63.6%
*-commutative63.6%
*-commutative63.6%
associate-*r*63.6%
associate-*r/63.6%
*-commutative63.6%
*-commutative63.6%
*-commutative63.6%
Simplified63.6%
Taylor expanded in K around 0 63.1%
associate-/l*68.7%
Simplified68.7%
Final simplification69.7%
(FPCore (J l K U) :precision binary64 (if (or (<= J -1.95e+142) (not (<= J 1.05e+207))) (* 2.0 (* J (* l (cos (* K 0.5))))) (* U (+ 1.0 (* 2.0 (* J (/ l U)))))))
double code(double J, double l, double K, double U) {
double tmp;
if ((J <= -1.95e+142) || !(J <= 1.05e+207)) {
tmp = 2.0 * (J * (l * cos((K * 0.5))));
} else {
tmp = U * (1.0 + (2.0 * (J * (l / 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 ((j <= (-1.95d+142)) .or. (.not. (j <= 1.05d+207))) then
tmp = 2.0d0 * (j * (l * cos((k * 0.5d0))))
else
tmp = u * (1.0d0 + (2.0d0 * (j * (l / u))))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if ((J <= -1.95e+142) || !(J <= 1.05e+207)) {
tmp = 2.0 * (J * (l * Math.cos((K * 0.5))));
} else {
tmp = U * (1.0 + (2.0 * (J * (l / U))));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (J <= -1.95e+142) or not (J <= 1.05e+207): tmp = 2.0 * (J * (l * math.cos((K * 0.5)))) else: tmp = U * (1.0 + (2.0 * (J * (l / U)))) return tmp
function code(J, l, K, U) tmp = 0.0 if ((J <= -1.95e+142) || !(J <= 1.05e+207)) tmp = Float64(2.0 * Float64(J * Float64(l * cos(Float64(K * 0.5))))); else tmp = Float64(U * Float64(1.0 + Float64(2.0 * Float64(J * Float64(l / U))))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((J <= -1.95e+142) || ~((J <= 1.05e+207))) tmp = 2.0 * (J * (l * cos((K * 0.5)))); else tmp = U * (1.0 + (2.0 * (J * (l / U)))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[J, -1.95e+142], N[Not[LessEqual[J, 1.05e+207]], $MachinePrecision]], N[(2.0 * N[(J * N[(l * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U * N[(1.0 + N[(2.0 * N[(J * N[(l / U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;J \leq -1.95 \cdot 10^{+142} \lor \neg \left(J \leq 1.05 \cdot 10^{+207}\right):\\
\;\;\;\;2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U \cdot \left(1 + 2 \cdot \left(J \cdot \frac{\ell}{U}\right)\right)\\
\end{array}
\end{array}
if J < -1.95e142 or 1.05e207 < J Initial program 73.3%
Taylor expanded in l around 0 88.7%
log1p-expm1-u98.3%
*-commutative98.3%
Applied egg-rr98.3%
Taylor expanded in U around inf 84.6%
*-commutative84.6%
*-commutative84.6%
*-commutative84.6%
associate-*r*84.6%
associate-*r/84.6%
*-commutative84.6%
*-commutative84.6%
*-commutative84.6%
Simplified84.6%
Taylor expanded in U around 0 74.6%
if -1.95e142 < J < 1.05e207Initial program 91.8%
Taylor expanded in l around 0 60.6%
log1p-expm1-u98.9%
*-commutative98.9%
Applied egg-rr98.9%
Taylor expanded in U around inf 65.1%
*-commutative65.1%
*-commutative65.1%
*-commutative65.1%
associate-*r*65.1%
associate-*r/65.1%
*-commutative65.1%
*-commutative65.1%
*-commutative65.1%
Simplified65.1%
Taylor expanded in K around 0 56.1%
associate-/l*60.3%
Simplified60.3%
Final simplification63.0%
(FPCore (J l K U) :precision binary64 (if (or (<= l -6200000000.0) (not (<= l 6.8e+22))) (* U U) U))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -6200000000.0) || !(l <= 6.8e+22)) {
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 <= (-6200000000.0d0)) .or. (.not. (l <= 6.8d+22))) 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 <= -6200000000.0) || !(l <= 6.8e+22)) {
tmp = U * U;
} else {
tmp = U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -6200000000.0) or not (l <= 6.8e+22): tmp = U * U else: tmp = U return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -6200000000.0) || !(l <= 6.8e+22)) tmp = Float64(U * U); else tmp = U; end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -6200000000.0) || ~((l <= 6.8e+22))) tmp = U * U; else tmp = U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -6200000000.0], N[Not[LessEqual[l, 6.8e+22]], $MachinePrecision]], N[(U * U), $MachinePrecision], U]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -6200000000 \lor \neg \left(\ell \leq 6.8 \cdot 10^{+22}\right):\\
\;\;\;\;U \cdot U\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\end{array}
if l < -6.2e9 or 6.8e22 < l Initial program 100.0%
Applied egg-rr16.5%
if -6.2e9 < l < 6.8e22Initial program 79.5%
Taylor expanded in J around 0 70.6%
Final simplification47.3%
(FPCore (J l K U) :precision binary64 (* U (+ 1.0 (* 2.0 (* J (/ l U))))))
double code(double J, double l, double K, double U) {
return U * (1.0 + (2.0 * (J * (l / U))));
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = u * (1.0d0 + (2.0d0 * (j * (l / u))))
end function
public static double code(double J, double l, double K, double U) {
return U * (1.0 + (2.0 * (J * (l / U))));
}
def code(J, l, K, U): return U * (1.0 + (2.0 * (J * (l / U))))
function code(J, l, K, U) return Float64(U * Float64(1.0 + Float64(2.0 * Float64(J * Float64(l / U))))) end
function tmp = code(J, l, K, U) tmp = U * (1.0 + (2.0 * (J * (l / U)))); end
code[J_, l_, K_, U_] := N[(U * N[(1.0 + N[(2.0 * N[(J * N[(l / U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U \cdot \left(1 + 2 \cdot \left(J \cdot \frac{\ell}{U}\right)\right)
\end{array}
Initial program 88.3%
Taylor expanded in l around 0 65.9%
log1p-expm1-u98.8%
*-commutative98.8%
Applied egg-rr98.8%
Taylor expanded in U around inf 68.8%
*-commutative68.8%
*-commutative68.8%
*-commutative68.8%
associate-*r*68.7%
associate-*r/68.7%
*-commutative68.7%
*-commutative68.7%
*-commutative68.7%
Simplified68.7%
Taylor expanded in K around 0 54.9%
associate-/l*58.3%
Simplified58.3%
(FPCore (J l K U) :precision binary64 (+ U (* l (* 2.0 J))))
double code(double J, double l, double K, double U) {
return U + (l * (2.0 * J));
}
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))
end function
public static double code(double J, double l, double K, double U) {
return U + (l * (2.0 * J));
}
def code(J, l, K, U): return U + (l * (2.0 * J))
function code(J, l, K, U) return Float64(U + Float64(l * Float64(2.0 * J))) end
function tmp = code(J, l, K, U) tmp = U + (l * (2.0 * J)); end
code[J_, l_, K_, U_] := N[(U + N[(l * N[(2.0 * J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + \ell \cdot \left(2 \cdot J\right)
\end{array}
Initial program 88.3%
Taylor expanded in l around 0 65.9%
Taylor expanded in K around 0 53.5%
associate-*r*53.5%
*-commutative53.5%
Simplified53.5%
Final simplification53.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.3%
Taylor expanded in J around 0 41.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.3%
Applied egg-rr2.7%
Taylor expanded in U around 0 2.7%
herbie shell --seed 2024118
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))