
(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 15 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (J l K U) :precision binary64 (+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))
double code(double J, double l, double K, double U) {
return ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = ((j * (exp(l) - exp(-l))) * cos((k / 2.0d0))) + u
end function
public static double code(double J, double l, double K, double U) {
return ((J * (Math.exp(l) - Math.exp(-l))) * Math.cos((K / 2.0))) + U;
}
def code(J, l, K, U): return ((J * (math.exp(l) - math.exp(-l))) * math.cos((K / 2.0))) + U
function code(J, l, K, U) return Float64(Float64(Float64(J * Float64(exp(l) - exp(Float64(-l)))) * cos(Float64(K / 2.0))) + U) end
function tmp = code(J, l, K, U) tmp = ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U; end
code[J_, l_, K_, U_] := N[(N[(N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]
\begin{array}{l}
\\
\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U
\end{array}
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))) (t_1 (- (exp l) (exp (- l)))))
(if (or (<= t_1 -200.0) (not (<= t_1 0.005)))
(+ (* (* t_1 J) t_0) U)
(+
U
(*
t_0
(*
J
(+
(* 0.016666666666666666 (pow l 5.0))
(+ (* 0.3333333333333333 (pow l 3.0)) (* l 2.0)))))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double t_1 = exp(l) - exp(-l);
double tmp;
if ((t_1 <= -200.0) || !(t_1 <= 0.005)) {
tmp = ((t_1 * J) * t_0) + U;
} else {
tmp = U + (t_0 * (J * ((0.016666666666666666 * pow(l, 5.0)) + ((0.3333333333333333 * pow(l, 3.0)) + (l * 2.0)))));
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = cos((k / 2.0d0))
t_1 = exp(l) - exp(-l)
if ((t_1 <= (-200.0d0)) .or. (.not. (t_1 <= 0.005d0))) then
tmp = ((t_1 * j) * t_0) + u
else
tmp = u + (t_0 * (j * ((0.016666666666666666d0 * (l ** 5.0d0)) + ((0.3333333333333333d0 * (l ** 3.0d0)) + (l * 2.0d0)))))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = Math.cos((K / 2.0));
double t_1 = Math.exp(l) - Math.exp(-l);
double tmp;
if ((t_1 <= -200.0) || !(t_1 <= 0.005)) {
tmp = ((t_1 * J) * t_0) + U;
} else {
tmp = U + (t_0 * (J * ((0.016666666666666666 * Math.pow(l, 5.0)) + ((0.3333333333333333 * Math.pow(l, 3.0)) + (l * 2.0)))));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K / 2.0)) t_1 = math.exp(l) - math.exp(-l) tmp = 0 if (t_1 <= -200.0) or not (t_1 <= 0.005): tmp = ((t_1 * J) * t_0) + U else: tmp = U + (t_0 * (J * ((0.016666666666666666 * math.pow(l, 5.0)) + ((0.3333333333333333 * math.pow(l, 3.0)) + (l * 2.0))))) return tmp
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) t_1 = Float64(exp(l) - exp(Float64(-l))) tmp = 0.0 if ((t_1 <= -200.0) || !(t_1 <= 0.005)) tmp = Float64(Float64(Float64(t_1 * J) * t_0) + U); else tmp = Float64(U + Float64(t_0 * Float64(J * Float64(Float64(0.016666666666666666 * (l ^ 5.0)) + Float64(Float64(0.3333333333333333 * (l ^ 3.0)) + Float64(l * 2.0)))))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = cos((K / 2.0)); t_1 = exp(l) - exp(-l); tmp = 0.0; if ((t_1 <= -200.0) || ~((t_1 <= 0.005))) tmp = ((t_1 * J) * t_0) + U; else tmp = U + (t_0 * (J * ((0.016666666666666666 * (l ^ 5.0)) + ((0.3333333333333333 * (l ^ 3.0)) + (l * 2.0))))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -200.0], N[Not[LessEqual[t$95$1, 0.005]], $MachinePrecision]], N[(N[(N[(t$95$1 * J), $MachinePrecision] * t$95$0), $MachinePrecision] + U), $MachinePrecision], N[(U + N[(t$95$0 * N[(J * N[(N[(0.016666666666666666 * N[Power[l, 5.0], $MachinePrecision]), $MachinePrecision] + N[(N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision] + N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
t_1 := e^{\ell} - e^{-\ell}\\
\mathbf{if}\;t\_1 \leq -200 \lor \neg \left(t\_1 \leq 0.005\right):\\
\;\;\;\;\left(t\_1 \cdot J\right) \cdot t\_0 + U\\
\mathbf{else}:\\
\;\;\;\;U + t\_0 \cdot \left(J \cdot \left(0.016666666666666666 \cdot {\ell}^{5} + \left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right)\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -200 or 0.0050000000000000001 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 100.0%
if -200 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 0.0050000000000000001Initial program 67.1%
Taylor expanded in l around 0 99.9%
Final simplification99.9%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))) (t_1 (- (exp l) (exp (- l)))))
(if (or (<= t_1 -200.0) (not (<= t_1 0.0005)))
(+ (* (* t_1 J) t_0) U)
(+ U (* t_0 (* J (+ (* 0.3333333333333333 (pow l 3.0)) (* l 2.0))))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double t_1 = exp(l) - exp(-l);
double tmp;
if ((t_1 <= -200.0) || !(t_1 <= 0.0005)) {
tmp = ((t_1 * J) * t_0) + U;
} else {
tmp = U + (t_0 * (J * ((0.3333333333333333 * pow(l, 3.0)) + (l * 2.0))));
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = cos((k / 2.0d0))
t_1 = exp(l) - exp(-l)
if ((t_1 <= (-200.0d0)) .or. (.not. (t_1 <= 0.0005d0))) then
tmp = ((t_1 * j) * t_0) + u
else
tmp = u + (t_0 * (j * ((0.3333333333333333d0 * (l ** 3.0d0)) + (l * 2.0d0))))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = Math.cos((K / 2.0));
double t_1 = Math.exp(l) - Math.exp(-l);
double tmp;
if ((t_1 <= -200.0) || !(t_1 <= 0.0005)) {
tmp = ((t_1 * J) * t_0) + U;
} else {
tmp = U + (t_0 * (J * ((0.3333333333333333 * Math.pow(l, 3.0)) + (l * 2.0))));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K / 2.0)) t_1 = math.exp(l) - math.exp(-l) tmp = 0 if (t_1 <= -200.0) or not (t_1 <= 0.0005): tmp = ((t_1 * J) * t_0) + U else: tmp = U + (t_0 * (J * ((0.3333333333333333 * math.pow(l, 3.0)) + (l * 2.0)))) return tmp
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) t_1 = Float64(exp(l) - exp(Float64(-l))) tmp = 0.0 if ((t_1 <= -200.0) || !(t_1 <= 0.0005)) tmp = Float64(Float64(Float64(t_1 * J) * t_0) + U); else tmp = Float64(U + Float64(t_0 * Float64(J * Float64(Float64(0.3333333333333333 * (l ^ 3.0)) + Float64(l * 2.0))))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = cos((K / 2.0)); t_1 = exp(l) - exp(-l); tmp = 0.0; if ((t_1 <= -200.0) || ~((t_1 <= 0.0005))) tmp = ((t_1 * J) * t_0) + U; else tmp = U + (t_0 * (J * ((0.3333333333333333 * (l ^ 3.0)) + (l * 2.0)))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -200.0], N[Not[LessEqual[t$95$1, 0.0005]], $MachinePrecision]], N[(N[(N[(t$95$1 * J), $MachinePrecision] * t$95$0), $MachinePrecision] + U), $MachinePrecision], N[(U + N[(t$95$0 * N[(J * N[(N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision] + N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
t_1 := e^{\ell} - e^{-\ell}\\
\mathbf{if}\;t\_1 \leq -200 \lor \neg \left(t\_1 \leq 0.0005\right):\\
\;\;\;\;\left(t\_1 \cdot J\right) \cdot t\_0 + U\\
\mathbf{else}:\\
\;\;\;\;U + t\_0 \cdot \left(J \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -200 or 5.0000000000000001e-4 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 99.9%
if -200 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 5.0000000000000001e-4Initial program 66.9%
Taylor expanded in l around 0 99.9%
Final simplification99.9%
(FPCore (J l K U)
:precision binary64
(let* ((t_0
(+ U (* (cos (/ K 2.0)) (* J (* 0.016666666666666666 (pow l 5.0))))))
(t_1 (+ (* (- (exp l) (exp (- l))) J) U)))
(if (<= l -1.1e+68)
t_0
(if (<= l -0.85)
t_1
(if (<= l 0.0006)
(+ U (* l (* (cos (* K 0.5)) (* J 2.0))))
(if (<= l 1.35e+56) t_1 t_0))))))
double code(double J, double l, double K, double U) {
double t_0 = U + (cos((K / 2.0)) * (J * (0.016666666666666666 * pow(l, 5.0))));
double t_1 = ((exp(l) - exp(-l)) * J) + U;
double tmp;
if (l <= -1.1e+68) {
tmp = t_0;
} else if (l <= -0.85) {
tmp = t_1;
} else if (l <= 0.0006) {
tmp = U + (l * (cos((K * 0.5)) * (J * 2.0)));
} else if (l <= 1.35e+56) {
tmp = t_1;
} else {
tmp = 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 = u + (cos((k / 2.0d0)) * (j * (0.016666666666666666d0 * (l ** 5.0d0))))
t_1 = ((exp(l) - exp(-l)) * j) + u
if (l <= (-1.1d+68)) then
tmp = t_0
else if (l <= (-0.85d0)) then
tmp = t_1
else if (l <= 0.0006d0) then
tmp = u + (l * (cos((k * 0.5d0)) * (j * 2.0d0)))
else if (l <= 1.35d+56) then
tmp = t_1
else
tmp = t_0
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = U + (Math.cos((K / 2.0)) * (J * (0.016666666666666666 * Math.pow(l, 5.0))));
double t_1 = ((Math.exp(l) - Math.exp(-l)) * J) + U;
double tmp;
if (l <= -1.1e+68) {
tmp = t_0;
} else if (l <= -0.85) {
tmp = t_1;
} else if (l <= 0.0006) {
tmp = U + (l * (Math.cos((K * 0.5)) * (J * 2.0)));
} else if (l <= 1.35e+56) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(J, l, K, U): t_0 = U + (math.cos((K / 2.0)) * (J * (0.016666666666666666 * math.pow(l, 5.0)))) t_1 = ((math.exp(l) - math.exp(-l)) * J) + U tmp = 0 if l <= -1.1e+68: tmp = t_0 elif l <= -0.85: tmp = t_1 elif l <= 0.0006: tmp = U + (l * (math.cos((K * 0.5)) * (J * 2.0))) elif l <= 1.35e+56: tmp = t_1 else: tmp = t_0 return tmp
function code(J, l, K, U) t_0 = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(J * Float64(0.016666666666666666 * (l ^ 5.0))))) t_1 = Float64(Float64(Float64(exp(l) - exp(Float64(-l))) * J) + U) tmp = 0.0 if (l <= -1.1e+68) tmp = t_0; elseif (l <= -0.85) tmp = t_1; elseif (l <= 0.0006) tmp = Float64(U + Float64(l * Float64(cos(Float64(K * 0.5)) * Float64(J * 2.0)))); elseif (l <= 1.35e+56) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = U + (cos((K / 2.0)) * (J * (0.016666666666666666 * (l ^ 5.0)))); t_1 = ((exp(l) - exp(-l)) * J) + U; tmp = 0.0; if (l <= -1.1e+68) tmp = t_0; elseif (l <= -0.85) tmp = t_1; elseif (l <= 0.0006) tmp = U + (l * (cos((K * 0.5)) * (J * 2.0))); elseif (l <= 1.35e+56) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(J * N[(0.016666666666666666 * N[Power[l, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision] + U), $MachinePrecision]}, If[LessEqual[l, -1.1e+68], t$95$0, If[LessEqual[l, -0.85], t$95$1, If[LessEqual[l, 0.0006], N[(U + N[(l * N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.35e+56], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(0.016666666666666666 \cdot {\ell}^{5}\right)\right)\\
t_1 := \left(e^{\ell} - e^{-\ell}\right) \cdot J + U\\
\mathbf{if}\;\ell \leq -1.1 \cdot 10^{+68}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq -0.85:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\ell \leq 0.0006:\\
\;\;\;\;U + \ell \cdot \left(\cos \left(K \cdot 0.5\right) \cdot \left(J \cdot 2\right)\right)\\
\mathbf{elif}\;\ell \leq 1.35 \cdot 10^{+56}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if l < -1.09999999999999994e68 or 1.35000000000000005e56 < l Initial program 100.0%
Taylor expanded in l around 0 100.0%
Taylor expanded in l around inf 100.0%
*-commutative100.0%
associate-*r*100.0%
*-commutative100.0%
Simplified100.0%
if -1.09999999999999994e68 < l < -0.849999999999999978 or 5.99999999999999947e-4 < l < 1.35000000000000005e56Initial program 99.7%
Taylor expanded in K around 0 90.0%
if -0.849999999999999978 < l < 5.99999999999999947e-4Initial program 66.9%
Taylor expanded in l around 0 99.6%
associate-*r*99.6%
*-commutative99.6%
associate-*l*99.6%
Simplified99.6%
Final simplification98.6%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0)))
(t_1 (+ U (* t_0 (* J (* 0.016666666666666666 (pow l 5.0))))))
(t_2 (+ (* (- (exp l) (exp (- l))) J) U)))
(if (<= l -1.1e+68)
t_1
(if (<= l -0.85)
t_2
(if (<= l 0.002)
(+ U (* t_0 (* J (+ (* 0.3333333333333333 (pow l 3.0)) (* l 2.0)))))
(if (<= l 1.35e+56) t_2 t_1))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double t_1 = U + (t_0 * (J * (0.016666666666666666 * pow(l, 5.0))));
double t_2 = ((exp(l) - exp(-l)) * J) + U;
double tmp;
if (l <= -1.1e+68) {
tmp = t_1;
} else if (l <= -0.85) {
tmp = t_2;
} else if (l <= 0.002) {
tmp = U + (t_0 * (J * ((0.3333333333333333 * pow(l, 3.0)) + (l * 2.0))));
} else if (l <= 1.35e+56) {
tmp = t_2;
} 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) :: t_2
real(8) :: tmp
t_0 = cos((k / 2.0d0))
t_1 = u + (t_0 * (j * (0.016666666666666666d0 * (l ** 5.0d0))))
t_2 = ((exp(l) - exp(-l)) * j) + u
if (l <= (-1.1d+68)) then
tmp = t_1
else if (l <= (-0.85d0)) then
tmp = t_2
else if (l <= 0.002d0) then
tmp = u + (t_0 * (j * ((0.3333333333333333d0 * (l ** 3.0d0)) + (l * 2.0d0))))
else if (l <= 1.35d+56) then
tmp = t_2
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 / 2.0));
double t_1 = U + (t_0 * (J * (0.016666666666666666 * Math.pow(l, 5.0))));
double t_2 = ((Math.exp(l) - Math.exp(-l)) * J) + U;
double tmp;
if (l <= -1.1e+68) {
tmp = t_1;
} else if (l <= -0.85) {
tmp = t_2;
} else if (l <= 0.002) {
tmp = U + (t_0 * (J * ((0.3333333333333333 * Math.pow(l, 3.0)) + (l * 2.0))));
} else if (l <= 1.35e+56) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K / 2.0)) t_1 = U + (t_0 * (J * (0.016666666666666666 * math.pow(l, 5.0)))) t_2 = ((math.exp(l) - math.exp(-l)) * J) + U tmp = 0 if l <= -1.1e+68: tmp = t_1 elif l <= -0.85: tmp = t_2 elif l <= 0.002: tmp = U + (t_0 * (J * ((0.3333333333333333 * math.pow(l, 3.0)) + (l * 2.0)))) elif l <= 1.35e+56: tmp = t_2 else: tmp = t_1 return tmp
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) t_1 = Float64(U + Float64(t_0 * Float64(J * Float64(0.016666666666666666 * (l ^ 5.0))))) t_2 = Float64(Float64(Float64(exp(l) - exp(Float64(-l))) * J) + U) tmp = 0.0 if (l <= -1.1e+68) tmp = t_1; elseif (l <= -0.85) tmp = t_2; elseif (l <= 0.002) tmp = Float64(U + Float64(t_0 * Float64(J * Float64(Float64(0.3333333333333333 * (l ^ 3.0)) + Float64(l * 2.0))))); elseif (l <= 1.35e+56) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = cos((K / 2.0)); t_1 = U + (t_0 * (J * (0.016666666666666666 * (l ^ 5.0)))); t_2 = ((exp(l) - exp(-l)) * J) + U; tmp = 0.0; if (l <= -1.1e+68) tmp = t_1; elseif (l <= -0.85) tmp = t_2; elseif (l <= 0.002) tmp = U + (t_0 * (J * ((0.3333333333333333 * (l ^ 3.0)) + (l * 2.0)))); elseif (l <= 1.35e+56) tmp = t_2; else tmp = t_1; 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[(U + N[(t$95$0 * N[(J * N[(0.016666666666666666 * N[Power[l, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision] + U), $MachinePrecision]}, If[LessEqual[l, -1.1e+68], t$95$1, If[LessEqual[l, -0.85], t$95$2, If[LessEqual[l, 0.002], N[(U + N[(t$95$0 * N[(J * N[(N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision] + N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.35e+56], t$95$2, t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
t_1 := U + t\_0 \cdot \left(J \cdot \left(0.016666666666666666 \cdot {\ell}^{5}\right)\right)\\
t_2 := \left(e^{\ell} - e^{-\ell}\right) \cdot J + U\\
\mathbf{if}\;\ell \leq -1.1 \cdot 10^{+68}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\ell \leq -0.85:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;\ell \leq 0.002:\\
\;\;\;\;U + t\_0 \cdot \left(J \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right)\right)\\
\mathbf{elif}\;\ell \leq 1.35 \cdot 10^{+56}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if l < -1.09999999999999994e68 or 1.35000000000000005e56 < l Initial program 100.0%
Taylor expanded in l around 0 100.0%
Taylor expanded in l around inf 100.0%
*-commutative100.0%
associate-*r*100.0%
*-commutative100.0%
Simplified100.0%
if -1.09999999999999994e68 < l < -0.849999999999999978 or 2e-3 < l < 1.35000000000000005e56Initial program 99.7%
Taylor expanded in K around 0 90.0%
if -0.849999999999999978 < l < 2e-3Initial program 66.9%
Taylor expanded in l around 0 99.9%
Final simplification98.7%
(FPCore (J l K U) :precision binary64 (if (or (<= l -0.85) (not (<= l 0.0005))) (+ (* (- (exp l) (exp (- l))) J) U) (+ U (* l (* (cos (* K 0.5)) (* J 2.0))))))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -0.85) || !(l <= 0.0005)) {
tmp = ((exp(l) - exp(-l)) * J) + U;
} else {
tmp = U + (l * (cos((K * 0.5)) * (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 <= (-0.85d0)) .or. (.not. (l <= 0.0005d0))) then
tmp = ((exp(l) - exp(-l)) * j) + u
else
tmp = u + (l * (cos((k * 0.5d0)) * (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 <= -0.85) || !(l <= 0.0005)) {
tmp = ((Math.exp(l) - Math.exp(-l)) * J) + U;
} else {
tmp = U + (l * (Math.cos((K * 0.5)) * (J * 2.0)));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -0.85) or not (l <= 0.0005): tmp = ((math.exp(l) - math.exp(-l)) * J) + U else: tmp = U + (l * (math.cos((K * 0.5)) * (J * 2.0))) return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -0.85) || !(l <= 0.0005)) tmp = Float64(Float64(Float64(exp(l) - exp(Float64(-l))) * J) + U); else tmp = Float64(U + Float64(l * Float64(cos(Float64(K * 0.5)) * Float64(J * 2.0)))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -0.85) || ~((l <= 0.0005))) tmp = ((exp(l) - exp(-l)) * J) + U; else tmp = U + (l * (cos((K * 0.5)) * (J * 2.0))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -0.85], N[Not[LessEqual[l, 0.0005]], $MachinePrecision]], N[(N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision] + U), $MachinePrecision], N[(U + N[(l * N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -0.85 \lor \neg \left(\ell \leq 0.0005\right):\\
\;\;\;\;\left(e^{\ell} - e^{-\ell}\right) \cdot J + U\\
\mathbf{else}:\\
\;\;\;\;U + \ell \cdot \left(\cos \left(K \cdot 0.5\right) \cdot \left(J \cdot 2\right)\right)\\
\end{array}
\end{array}
if l < -0.849999999999999978 or 5.0000000000000001e-4 < l Initial program 99.9%
Taylor expanded in K around 0 82.6%
if -0.849999999999999978 < l < 5.0000000000000001e-4Initial program 66.9%
Taylor expanded in l around 0 99.6%
associate-*r*99.6%
*-commutative99.6%
associate-*l*99.6%
Simplified99.6%
Final simplification91.2%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (+ U (* J (+ (* 0.3333333333333333 (pow l 3.0)) (* l 2.0))))))
(if (<= l -1.25e+86)
t_0
(if (<= l -3.2e+18)
(pow U -4.0)
(if (<= l 0.00088) (+ U (* l (* (cos (* K 0.5)) (* J 2.0)))) t_0)))))
double code(double J, double l, double K, double U) {
double t_0 = U + (J * ((0.3333333333333333 * pow(l, 3.0)) + (l * 2.0)));
double tmp;
if (l <= -1.25e+86) {
tmp = t_0;
} else if (l <= -3.2e+18) {
tmp = pow(U, -4.0);
} else if (l <= 0.00088) {
tmp = U + (l * (cos((K * 0.5)) * (J * 2.0)));
} else {
tmp = 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) :: tmp
t_0 = u + (j * ((0.3333333333333333d0 * (l ** 3.0d0)) + (l * 2.0d0)))
if (l <= (-1.25d+86)) then
tmp = t_0
else if (l <= (-3.2d+18)) then
tmp = u ** (-4.0d0)
else if (l <= 0.00088d0) then
tmp = u + (l * (cos((k * 0.5d0)) * (j * 2.0d0)))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = U + (J * ((0.3333333333333333 * Math.pow(l, 3.0)) + (l * 2.0)));
double tmp;
if (l <= -1.25e+86) {
tmp = t_0;
} else if (l <= -3.2e+18) {
tmp = Math.pow(U, -4.0);
} else if (l <= 0.00088) {
tmp = U + (l * (Math.cos((K * 0.5)) * (J * 2.0)));
} else {
tmp = t_0;
}
return tmp;
}
def code(J, l, K, U): t_0 = U + (J * ((0.3333333333333333 * math.pow(l, 3.0)) + (l * 2.0))) tmp = 0 if l <= -1.25e+86: tmp = t_0 elif l <= -3.2e+18: tmp = math.pow(U, -4.0) elif l <= 0.00088: tmp = U + (l * (math.cos((K * 0.5)) * (J * 2.0))) else: tmp = t_0 return tmp
function code(J, l, K, U) t_0 = Float64(U + Float64(J * Float64(Float64(0.3333333333333333 * (l ^ 3.0)) + Float64(l * 2.0)))) tmp = 0.0 if (l <= -1.25e+86) tmp = t_0; elseif (l <= -3.2e+18) tmp = U ^ -4.0; elseif (l <= 0.00088) tmp = Float64(U + Float64(l * Float64(cos(Float64(K * 0.5)) * Float64(J * 2.0)))); else tmp = t_0; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = U + (J * ((0.3333333333333333 * (l ^ 3.0)) + (l * 2.0))); tmp = 0.0; if (l <= -1.25e+86) tmp = t_0; elseif (l <= -3.2e+18) tmp = U ^ -4.0; elseif (l <= 0.00088) tmp = U + (l * (cos((K * 0.5)) * (J * 2.0))); else tmp = t_0; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(U + N[(J * N[(N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision] + N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -1.25e+86], t$95$0, If[LessEqual[l, -3.2e+18], N[Power[U, -4.0], $MachinePrecision], If[LessEqual[l, 0.00088], N[(U + N[(l * N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + J \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right)\\
\mathbf{if}\;\ell \leq -1.25 \cdot 10^{+86}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq -3.2 \cdot 10^{+18}:\\
\;\;\;\;{U}^{-4}\\
\mathbf{elif}\;\ell \leq 0.00088:\\
\;\;\;\;U + \ell \cdot \left(\cos \left(K \cdot 0.5\right) \cdot \left(J \cdot 2\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if l < -1.2499999999999999e86 or 8.80000000000000031e-4 < l Initial program 99.9%
Taylor expanded in l around 0 81.5%
Taylor expanded in K around 0 66.7%
if -1.2499999999999999e86 < l < -3.2e18Initial program 100.0%
Applied egg-rr57.8%
if -3.2e18 < l < 8.80000000000000031e-4Initial program 67.9%
Taylor expanded in l around 0 96.7%
associate-*r*96.7%
*-commutative96.7%
associate-*l*96.8%
Simplified96.8%
Final simplification81.8%
(FPCore (J l K U) :precision binary64 (if (or (<= l -1.35e+178) (and (not (<= l -3e+18)) (<= l 1.6e+112))) (+ U (* 2.0 (* J (* l (cos (* K 0.5)))))) (pow U -4.0)))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -1.35e+178) || (!(l <= -3e+18) && (l <= 1.6e+112))) {
tmp = U + (2.0 * (J * (l * cos((K * 0.5)))));
} else {
tmp = pow(U, -4.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 <= (-1.35d+178)) .or. (.not. (l <= (-3d+18))) .and. (l <= 1.6d+112)) then
tmp = u + (2.0d0 * (j * (l * cos((k * 0.5d0)))))
else
tmp = u ** (-4.0d0)
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -1.35e+178) || (!(l <= -3e+18) && (l <= 1.6e+112))) {
tmp = U + (2.0 * (J * (l * Math.cos((K * 0.5)))));
} else {
tmp = Math.pow(U, -4.0);
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -1.35e+178) or (not (l <= -3e+18) and (l <= 1.6e+112)): tmp = U + (2.0 * (J * (l * math.cos((K * 0.5))))) else: tmp = math.pow(U, -4.0) return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -1.35e+178) || (!(l <= -3e+18) && (l <= 1.6e+112))) tmp = Float64(U + Float64(2.0 * Float64(J * Float64(l * cos(Float64(K * 0.5)))))); else tmp = U ^ -4.0; end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -1.35e+178) || (~((l <= -3e+18)) && (l <= 1.6e+112))) tmp = U + (2.0 * (J * (l * cos((K * 0.5))))); else tmp = U ^ -4.0; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -1.35e+178], And[N[Not[LessEqual[l, -3e+18]], $MachinePrecision], LessEqual[l, 1.6e+112]]], N[(U + N[(2.0 * N[(J * N[(l * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Power[U, -4.0], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.35 \cdot 10^{+178} \lor \neg \left(\ell \leq -3 \cdot 10^{+18}\right) \land \ell \leq 1.6 \cdot 10^{+112}:\\
\;\;\;\;U + 2 \cdot \left(J \cdot \left(\ell \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;{U}^{-4}\\
\end{array}
\end{array}
if l < -1.35000000000000009e178 or -3e18 < l < 1.59999999999999993e112Initial program 77.1%
Taylor expanded in l around 0 77.4%
if -1.35000000000000009e178 < l < -3e18 or 1.59999999999999993e112 < l Initial program 100.0%
Applied egg-rr35.6%
Final simplification66.1%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (* K 0.5))))
(if (<= l -3.1e+176)
(+ U (* 2.0 (* J (* l t_0))))
(if (or (<= l -2.8e+18) (not (<= l 5.2e+118)))
(pow U -4.0)
(+ U (* l (* t_0 (* J 2.0))))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K * 0.5));
double tmp;
if (l <= -3.1e+176) {
tmp = U + (2.0 * (J * (l * t_0)));
} else if ((l <= -2.8e+18) || !(l <= 5.2e+118)) {
tmp = pow(U, -4.0);
} else {
tmp = U + (l * (t_0 * (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) :: t_0
real(8) :: tmp
t_0 = cos((k * 0.5d0))
if (l <= (-3.1d+176)) then
tmp = u + (2.0d0 * (j * (l * t_0)))
else if ((l <= (-2.8d+18)) .or. (.not. (l <= 5.2d+118))) then
tmp = u ** (-4.0d0)
else
tmp = u + (l * (t_0 * (j * 2.0d0)))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = Math.cos((K * 0.5));
double tmp;
if (l <= -3.1e+176) {
tmp = U + (2.0 * (J * (l * t_0)));
} else if ((l <= -2.8e+18) || !(l <= 5.2e+118)) {
tmp = Math.pow(U, -4.0);
} else {
tmp = U + (l * (t_0 * (J * 2.0)));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K * 0.5)) tmp = 0 if l <= -3.1e+176: tmp = U + (2.0 * (J * (l * t_0))) elif (l <= -2.8e+18) or not (l <= 5.2e+118): tmp = math.pow(U, -4.0) else: tmp = U + (l * (t_0 * (J * 2.0))) return tmp
function code(J, l, K, U) t_0 = cos(Float64(K * 0.5)) tmp = 0.0 if (l <= -3.1e+176) tmp = Float64(U + Float64(2.0 * Float64(J * Float64(l * t_0)))); elseif ((l <= -2.8e+18) || !(l <= 5.2e+118)) tmp = U ^ -4.0; else tmp = Float64(U + Float64(l * Float64(t_0 * Float64(J * 2.0)))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = cos((K * 0.5)); tmp = 0.0; if (l <= -3.1e+176) tmp = U + (2.0 * (J * (l * t_0))); elseif ((l <= -2.8e+18) || ~((l <= 5.2e+118))) tmp = U ^ -4.0; else tmp = U + (l * (t_0 * (J * 2.0))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -3.1e+176], N[(U + N[(2.0 * N[(J * N[(l * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[l, -2.8e+18], N[Not[LessEqual[l, 5.2e+118]], $MachinePrecision]], N[Power[U, -4.0], $MachinePrecision], N[(U + N[(l * N[(t$95$0 * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(K \cdot 0.5\right)\\
\mathbf{if}\;\ell \leq -3.1 \cdot 10^{+176}:\\
\;\;\;\;U + 2 \cdot \left(J \cdot \left(\ell \cdot t\_0\right)\right)\\
\mathbf{elif}\;\ell \leq -2.8 \cdot 10^{+18} \lor \neg \left(\ell \leq 5.2 \cdot 10^{+118}\right):\\
\;\;\;\;{U}^{-4}\\
\mathbf{else}:\\
\;\;\;\;U + \ell \cdot \left(t\_0 \cdot \left(J \cdot 2\right)\right)\\
\end{array}
\end{array}
if l < -3.0999999999999999e176Initial program 100.0%
Taylor expanded in l around 0 40.5%
if -3.0999999999999999e176 < l < -2.8e18 or 5.20000000000000032e118 < l Initial program 100.0%
Applied egg-rr35.6%
if -2.8e18 < l < 5.20000000000000032e118Initial program 73.8%
Taylor expanded in l around 0 82.9%
associate-*r*82.9%
*-commutative82.9%
associate-*l*82.9%
Simplified82.9%
Final simplification66.2%
(FPCore (J l K U)
:precision binary64
(if (<= l -3.6e+178)
(+ U (* 2.0 (* l J)))
(if (or (<= l -5.8e+19) (not (<= l 3.9e+114)))
(pow U -4.0)
(fma (* J 2.0) l U))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -3.6e+178) {
tmp = U + (2.0 * (l * J));
} else if ((l <= -5.8e+19) || !(l <= 3.9e+114)) {
tmp = pow(U, -4.0);
} else {
tmp = fma((J * 2.0), l, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (l <= -3.6e+178) tmp = Float64(U + Float64(2.0 * Float64(l * J))); elseif ((l <= -5.8e+19) || !(l <= 3.9e+114)) tmp = U ^ -4.0; else tmp = fma(Float64(J * 2.0), l, U); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[l, -3.6e+178], N[(U + N[(2.0 * N[(l * J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[l, -5.8e+19], N[Not[LessEqual[l, 3.9e+114]], $MachinePrecision]], N[Power[U, -4.0], $MachinePrecision], N[(N[(J * 2.0), $MachinePrecision] * l + U), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -3.6 \cdot 10^{+178}:\\
\;\;\;\;U + 2 \cdot \left(\ell \cdot J\right)\\
\mathbf{elif}\;\ell \leq -5.8 \cdot 10^{+19} \lor \neg \left(\ell \leq 3.9 \cdot 10^{+114}\right):\\
\;\;\;\;{U}^{-4}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(J \cdot 2, \ell, U\right)\\
\end{array}
\end{array}
if l < -3.5999999999999998e178Initial program 100.0%
Taylor expanded in l around 0 40.5%
Taylor expanded in K around 0 35.8%
if -3.5999999999999998e178 < l < -5.8e19 or 3.9000000000000001e114 < l Initial program 100.0%
Applied egg-rr35.6%
if -5.8e19 < l < 3.9000000000000001e114Initial program 73.8%
Taylor expanded in l around 0 82.9%
associate-*r*82.9%
fma-define82.9%
*-commutative82.9%
*-commutative82.9%
Applied egg-rr82.9%
Taylor expanded in K around 0 71.0%
Final simplification58.1%
(FPCore (J l K U) :precision binary64 (if (or (<= l -1e+179) (and (not (<= l -2.8e+18)) (<= l 4.4e+113))) (+ U (* 2.0 (* l J))) (pow U -4.0)))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -1e+179) || (!(l <= -2.8e+18) && (l <= 4.4e+113))) {
tmp = U + (2.0 * (l * J));
} else {
tmp = pow(U, -4.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 <= (-1d+179)) .or. (.not. (l <= (-2.8d+18))) .and. (l <= 4.4d+113)) then
tmp = u + (2.0d0 * (l * j))
else
tmp = u ** (-4.0d0)
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -1e+179) || (!(l <= -2.8e+18) && (l <= 4.4e+113))) {
tmp = U + (2.0 * (l * J));
} else {
tmp = Math.pow(U, -4.0);
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -1e+179) or (not (l <= -2.8e+18) and (l <= 4.4e+113)): tmp = U + (2.0 * (l * J)) else: tmp = math.pow(U, -4.0) return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -1e+179) || (!(l <= -2.8e+18) && (l <= 4.4e+113))) tmp = Float64(U + Float64(2.0 * Float64(l * J))); else tmp = U ^ -4.0; end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -1e+179) || (~((l <= -2.8e+18)) && (l <= 4.4e+113))) tmp = U + (2.0 * (l * J)); else tmp = U ^ -4.0; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -1e+179], And[N[Not[LessEqual[l, -2.8e+18]], $MachinePrecision], LessEqual[l, 4.4e+113]]], N[(U + N[(2.0 * N[(l * J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Power[U, -4.0], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1 \cdot 10^{+179} \lor \neg \left(\ell \leq -2.8 \cdot 10^{+18}\right) \land \ell \leq 4.4 \cdot 10^{+113}:\\
\;\;\;\;U + 2 \cdot \left(\ell \cdot J\right)\\
\mathbf{else}:\\
\;\;\;\;{U}^{-4}\\
\end{array}
\end{array}
if l < -9.9999999999999998e178 or -2.8e18 < l < 4.40000000000000021e113Initial program 77.1%
Taylor expanded in l around 0 77.4%
Taylor expanded in K around 0 66.5%
if -9.9999999999999998e178 < l < -2.8e18 or 4.40000000000000021e113 < l Initial program 100.0%
Applied egg-rr35.6%
Final simplification58.1%
(FPCore (J l K U) :precision binary64 (if (or (<= l -4.8e+42) (not (<= l 0.00023))) (* U (- U -4.0)) U))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -4.8e+42) || !(l <= 0.00023)) {
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 <= (-4.8d+42)) .or. (.not. (l <= 0.00023d0))) 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 <= -4.8e+42) || !(l <= 0.00023)) {
tmp = U * (U - -4.0);
} else {
tmp = U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -4.8e+42) or not (l <= 0.00023): tmp = U * (U - -4.0) else: tmp = U return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -4.8e+42) || !(l <= 0.00023)) 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 <= -4.8e+42) || ~((l <= 0.00023))) tmp = U * (U - -4.0); else tmp = U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -4.8e+42], N[Not[LessEqual[l, 0.00023]], $MachinePrecision]], N[(U * N[(U - -4.0), $MachinePrecision]), $MachinePrecision], U]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -4.8 \cdot 10^{+42} \lor \neg \left(\ell \leq 0.00023\right):\\
\;\;\;\;U \cdot \left(U - -4\right)\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\end{array}
if l < -4.7999999999999997e42 or 2.3000000000000001e-4 < l Initial program 99.9%
Applied egg-rr13.5%
if -4.7999999999999997e42 < l < 2.3000000000000001e-4Initial program 68.9%
Taylor expanded in J around 0 61.6%
Final simplification39.3%
(FPCore (J l K U) :precision binary64 (if (or (<= l -5.3) (not (<= l 2.6e-8))) (* U U) U))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -5.3) || !(l <= 2.6e-8)) {
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 <= (-5.3d0)) .or. (.not. (l <= 2.6d-8))) 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 <= -5.3) || !(l <= 2.6e-8)) {
tmp = U * U;
} else {
tmp = U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -5.3) or not (l <= 2.6e-8): tmp = U * U else: tmp = U return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -5.3) || !(l <= 2.6e-8)) tmp = Float64(U * U); else tmp = U; end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -5.3) || ~((l <= 2.6e-8))) tmp = U * U; else tmp = U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -5.3], N[Not[LessEqual[l, 2.6e-8]], $MachinePrecision]], N[(U * U), $MachinePrecision], U]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -5.3 \lor \neg \left(\ell \leq 2.6 \cdot 10^{-8}\right):\\
\;\;\;\;U \cdot U\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\end{array}
if l < -5.29999999999999982 or 2.6000000000000001e-8 < l Initial program 99.6%
Applied egg-rr12.5%
if -5.29999999999999982 < l < 2.6000000000000001e-8Initial program 66.7%
Taylor expanded in J around 0 66.4%
Final simplification39.2%
(FPCore (J l K U) :precision binary64 (+ U (* 2.0 (* l J))))
double code(double J, double l, double K, double U) {
return U + (2.0 * (l * 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 + (2.0d0 * (l * j))
end function
public static double code(double J, double l, double K, double U) {
return U + (2.0 * (l * J));
}
def code(J, l, K, U): return U + (2.0 * (l * J))
function code(J, l, K, U) return Float64(U + Float64(2.0 * Float64(l * J))) end
function tmp = code(J, l, K, U) tmp = U + (2.0 * (l * J)); end
code[J_, l_, K_, U_] := N[(U + N[(2.0 * N[(l * J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + 2 \cdot \left(\ell \cdot J\right)
\end{array}
Initial program 83.3%
Taylor expanded in l around 0 61.0%
Taylor expanded in K around 0 52.5%
Final simplification52.5%
(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 83.3%
Applied egg-rr2.6%
*-inverses2.6%
Simplified2.6%
Final simplification2.6%
(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 83.3%
Taylor expanded in J around 0 34.1%
Final simplification34.1%
herbie shell --seed 2024040
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))