
(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 (- (exp l) (exp (- l)))) (t_1 (cos (* K 0.5))))
(if (or (<= t_0 (- INFINITY)) (not (<= t_0 0.0)))
(+ (* (* t_0 J) (cos (/ K 2.0))) U)
(+
U
(+
(* l (* (* J t_1) (fma 0.3333333333333333 (pow l 2.0) 2.0)))
(*
(*
t_1
(+
(* (pow l 2.0) (* J 0.0003968253968253968))
(* J 0.016666666666666666)))
(pow l 5.0)))))))
double code(double J, double l, double K, double U) {
double t_0 = exp(l) - exp(-l);
double t_1 = cos((K * 0.5));
double tmp;
if ((t_0 <= -((double) INFINITY)) || !(t_0 <= 0.0)) {
tmp = ((t_0 * J) * cos((K / 2.0))) + U;
} else {
tmp = U + ((l * ((J * t_1) * fma(0.3333333333333333, pow(l, 2.0), 2.0))) + ((t_1 * ((pow(l, 2.0) * (J * 0.0003968253968253968)) + (J * 0.016666666666666666))) * pow(l, 5.0)));
}
return tmp;
}
function code(J, l, K, U) t_0 = Float64(exp(l) - exp(Float64(-l))) t_1 = cos(Float64(K * 0.5)) tmp = 0.0 if ((t_0 <= Float64(-Inf)) || !(t_0 <= 0.0)) tmp = Float64(Float64(Float64(t_0 * J) * cos(Float64(K / 2.0))) + U); else tmp = Float64(U + Float64(Float64(l * Float64(Float64(J * t_1) * fma(0.3333333333333333, (l ^ 2.0), 2.0))) + Float64(Float64(t_1 * Float64(Float64((l ^ 2.0) * Float64(J * 0.0003968253968253968)) + Float64(J * 0.016666666666666666))) * (l ^ 5.0)))); end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]}, If[Or[LessEqual[t$95$0, (-Infinity)], N[Not[LessEqual[t$95$0, 0.0]], $MachinePrecision]], N[(N[(N[(t$95$0 * J), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], N[(U + N[(N[(l * N[(N[(J * t$95$1), $MachinePrecision] * N[(0.3333333333333333 * N[Power[l, 2.0], $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$1 * N[(N[(N[Power[l, 2.0], $MachinePrecision] * N[(J * 0.0003968253968253968), $MachinePrecision]), $MachinePrecision] + N[(J * 0.016666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Power[l, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{\ell} - e^{-\ell}\\
t_1 := \cos \left(K \cdot 0.5\right)\\
\mathbf{if}\;t\_0 \leq -\infty \lor \neg \left(t\_0 \leq 0\right):\\
\;\;\;\;\left(t\_0 \cdot J\right) \cdot \cos \left(\frac{K}{2}\right) + U\\
\mathbf{else}:\\
\;\;\;\;U + \left(\ell \cdot \left(\left(J \cdot t\_1\right) \cdot \mathsf{fma}\left(0.3333333333333333, {\ell}^{2}, 2\right)\right) + \left(t\_1 \cdot \left({\ell}^{2} \cdot \left(J \cdot 0.0003968253968253968\right) + J \cdot 0.016666666666666666\right)\right) \cdot {\ell}^{5}\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -inf.0 or 0.0 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 100.0%
if -inf.0 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 0.0Initial program 68.1%
Taylor expanded in l around 0 99.9%
Simplified99.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 (- INFINITY)) (not (<= t_1 0.0)))
(+ (* (* t_1 J) t_0) U)
(+
U
(*
t_0
(*
J
(*
l
(+
2.0
(*
(pow l 2.0)
(+ 0.3333333333333333 (* (pow l 2.0) 0.016666666666666666)))))))))))
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 <= -((double) INFINITY)) || !(t_1 <= 0.0)) {
tmp = ((t_1 * J) * t_0) + U;
} else {
tmp = U + (t_0 * (J * (l * (2.0 + (pow(l, 2.0) * (0.3333333333333333 + (pow(l, 2.0) * 0.016666666666666666)))))));
}
return tmp;
}
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 <= -Double.POSITIVE_INFINITY) || !(t_1 <= 0.0)) {
tmp = ((t_1 * J) * t_0) + U;
} else {
tmp = U + (t_0 * (J * (l * (2.0 + (Math.pow(l, 2.0) * (0.3333333333333333 + (Math.pow(l, 2.0) * 0.016666666666666666)))))));
}
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 <= -math.inf) or not (t_1 <= 0.0): tmp = ((t_1 * J) * t_0) + U else: tmp = U + (t_0 * (J * (l * (2.0 + (math.pow(l, 2.0) * (0.3333333333333333 + (math.pow(l, 2.0) * 0.016666666666666666))))))) 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 <= Float64(-Inf)) || !(t_1 <= 0.0)) tmp = Float64(Float64(Float64(t_1 * J) * t_0) + U); else tmp = Float64(U + Float64(t_0 * Float64(J * Float64(l * Float64(2.0 + Float64((l ^ 2.0) * Float64(0.3333333333333333 + Float64((l ^ 2.0) * 0.016666666666666666)))))))); 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 <= -Inf) || ~((t_1 <= 0.0))) tmp = ((t_1 * J) * t_0) + U; else tmp = U + (t_0 * (J * (l * (2.0 + ((l ^ 2.0) * (0.3333333333333333 + ((l ^ 2.0) * 0.016666666666666666))))))); 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, (-Infinity)], N[Not[LessEqual[t$95$1, 0.0]], $MachinePrecision]], N[(N[(N[(t$95$1 * J), $MachinePrecision] * t$95$0), $MachinePrecision] + U), $MachinePrecision], N[(U + N[(t$95$0 * N[(J * N[(l * N[(2.0 + N[(N[Power[l, 2.0], $MachinePrecision] * N[(0.3333333333333333 + N[(N[Power[l, 2.0], $MachinePrecision] * 0.016666666666666666), $MachinePrecision]), $MachinePrecision]), $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 -\infty \lor \neg \left(t\_1 \leq 0\right):\\
\;\;\;\;\left(t\_1 \cdot J\right) \cdot t\_0 + U\\
\mathbf{else}:\\
\;\;\;\;U + t\_0 \cdot \left(J \cdot \left(\ell \cdot \left(2 + {\ell}^{2} \cdot \left(0.3333333333333333 + {\ell}^{2} \cdot 0.016666666666666666\right)\right)\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -inf.0 or 0.0 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 100.0%
if -inf.0 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 0.0Initial program 68.1%
Taylor expanded in l around 0 99.9%
*-commutative99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (- (exp l) (exp (- l)))))
(if (or (<= t_0 -0.01) (not (<= t_0 0.0)))
(+ (* (* t_0 J) (cos (/ K 2.0))) U)
(+ U (* l (* (cos (* K 0.5)) (* J 2.0)))))))
double code(double J, double l, double K, double U) {
double t_0 = exp(l) - exp(-l);
double tmp;
if ((t_0 <= -0.01) || !(t_0 <= 0.0)) {
tmp = ((t_0 * J) * cos((K / 2.0))) + 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) :: t_0
real(8) :: tmp
t_0 = exp(l) - exp(-l)
if ((t_0 <= (-0.01d0)) .or. (.not. (t_0 <= 0.0d0))) then
tmp = ((t_0 * j) * cos((k / 2.0d0))) + 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 t_0 = Math.exp(l) - Math.exp(-l);
double tmp;
if ((t_0 <= -0.01) || !(t_0 <= 0.0)) {
tmp = ((t_0 * J) * Math.cos((K / 2.0))) + U;
} else {
tmp = U + (l * (Math.cos((K * 0.5)) * (J * 2.0)));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.exp(l) - math.exp(-l) tmp = 0 if (t_0 <= -0.01) or not (t_0 <= 0.0): tmp = ((t_0 * J) * math.cos((K / 2.0))) + U else: tmp = U + (l * (math.cos((K * 0.5)) * (J * 2.0))) return tmp
function code(J, l, K, U) t_0 = Float64(exp(l) - exp(Float64(-l))) tmp = 0.0 if ((t_0 <= -0.01) || !(t_0 <= 0.0)) tmp = Float64(Float64(Float64(t_0 * J) * cos(Float64(K / 2.0))) + 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) t_0 = exp(l) - exp(-l); tmp = 0.0; if ((t_0 <= -0.01) || ~((t_0 <= 0.0))) tmp = ((t_0 * J) * cos((K / 2.0))) + U; else tmp = U + (l * (cos((K * 0.5)) * (J * 2.0))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, -0.01], N[Not[LessEqual[t$95$0, 0.0]], $MachinePrecision]], N[(N[(N[(t$95$0 * J), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $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}
t_0 := e^{\ell} - e^{-\ell}\\
\mathbf{if}\;t\_0 \leq -0.01 \lor \neg \left(t\_0 \leq 0\right):\\
\;\;\;\;\left(t\_0 \cdot J\right) \cdot \cos \left(\frac{K}{2}\right) + 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 (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -0.0100000000000000002 or 0.0 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 99.9%
if -0.0100000000000000002 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 0.0Initial program 67.9%
Taylor expanded in l around 0 99.9%
Taylor expanded in l around 0 99.9%
*-commutative99.9%
associate-*r*99.9%
associate-*l*99.9%
*-commutative99.9%
associate-*r*99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (+ (* (- (exp l) (exp (- l))) J) U)) (t_1 (cos (/ K 2.0))))
(if (<= l -1.8e+91)
(+ U (* t_1 (* (pow l 3.0) (* J 0.3333333333333333))))
(if (<= l -0.004)
t_0
(if (<= l 0.0062)
(+ U (* l (* (cos (* K 0.5)) (* J 2.0))))
(if (<= l 5e+101)
t_0
(+
U
(*
t_1
(* J (* l (+ 2.0 (* 0.3333333333333333 (pow l 2.0)))))))))))))
double code(double J, double l, double K, double U) {
double t_0 = ((exp(l) - exp(-l)) * J) + U;
double t_1 = cos((K / 2.0));
double tmp;
if (l <= -1.8e+91) {
tmp = U + (t_1 * (pow(l, 3.0) * (J * 0.3333333333333333)));
} else if (l <= -0.004) {
tmp = t_0;
} else if (l <= 0.0062) {
tmp = U + (l * (cos((K * 0.5)) * (J * 2.0)));
} else if (l <= 5e+101) {
tmp = t_0;
} else {
tmp = U + (t_1 * (J * (l * (2.0 + (0.3333333333333333 * pow(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 = ((exp(l) - exp(-l)) * j) + u
t_1 = cos((k / 2.0d0))
if (l <= (-1.8d+91)) then
tmp = u + (t_1 * ((l ** 3.0d0) * (j * 0.3333333333333333d0)))
else if (l <= (-0.004d0)) then
tmp = t_0
else if (l <= 0.0062d0) then
tmp = u + (l * (cos((k * 0.5d0)) * (j * 2.0d0)))
else if (l <= 5d+101) then
tmp = t_0
else
tmp = u + (t_1 * (j * (l * (2.0d0 + (0.3333333333333333d0 * (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.exp(l) - Math.exp(-l)) * J) + U;
double t_1 = Math.cos((K / 2.0));
double tmp;
if (l <= -1.8e+91) {
tmp = U + (t_1 * (Math.pow(l, 3.0) * (J * 0.3333333333333333)));
} else if (l <= -0.004) {
tmp = t_0;
} else if (l <= 0.0062) {
tmp = U + (l * (Math.cos((K * 0.5)) * (J * 2.0)));
} else if (l <= 5e+101) {
tmp = t_0;
} else {
tmp = U + (t_1 * (J * (l * (2.0 + (0.3333333333333333 * Math.pow(l, 2.0))))));
}
return tmp;
}
def code(J, l, K, U): t_0 = ((math.exp(l) - math.exp(-l)) * J) + U t_1 = math.cos((K / 2.0)) tmp = 0 if l <= -1.8e+91: tmp = U + (t_1 * (math.pow(l, 3.0) * (J * 0.3333333333333333))) elif l <= -0.004: tmp = t_0 elif l <= 0.0062: tmp = U + (l * (math.cos((K * 0.5)) * (J * 2.0))) elif l <= 5e+101: tmp = t_0 else: tmp = U + (t_1 * (J * (l * (2.0 + (0.3333333333333333 * math.pow(l, 2.0)))))) return tmp
function code(J, l, K, U) t_0 = Float64(Float64(Float64(exp(l) - exp(Float64(-l))) * J) + U) t_1 = cos(Float64(K / 2.0)) tmp = 0.0 if (l <= -1.8e+91) tmp = Float64(U + Float64(t_1 * Float64((l ^ 3.0) * Float64(J * 0.3333333333333333)))); elseif (l <= -0.004) tmp = t_0; elseif (l <= 0.0062) tmp = Float64(U + Float64(l * Float64(cos(Float64(K * 0.5)) * Float64(J * 2.0)))); elseif (l <= 5e+101) tmp = t_0; else tmp = Float64(U + Float64(t_1 * Float64(J * Float64(l * Float64(2.0 + Float64(0.3333333333333333 * (l ^ 2.0))))))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = ((exp(l) - exp(-l)) * J) + U; t_1 = cos((K / 2.0)); tmp = 0.0; if (l <= -1.8e+91) tmp = U + (t_1 * ((l ^ 3.0) * (J * 0.3333333333333333))); elseif (l <= -0.004) tmp = t_0; elseif (l <= 0.0062) tmp = U + (l * (cos((K * 0.5)) * (J * 2.0))); elseif (l <= 5e+101) tmp = t_0; else tmp = U + (t_1 * (J * (l * (2.0 + (0.3333333333333333 * (l ^ 2.0)))))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision] + U), $MachinePrecision]}, Block[{t$95$1 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -1.8e+91], N[(U + N[(t$95$1 * N[(N[Power[l, 3.0], $MachinePrecision] * N[(J * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -0.004], t$95$0, If[LessEqual[l, 0.0062], N[(U + N[(l * N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 5e+101], t$95$0, N[(U + N[(t$95$1 * N[(J * N[(l * N[(2.0 + N[(0.3333333333333333 * N[Power[l, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(e^{\ell} - e^{-\ell}\right) \cdot J + U\\
t_1 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;\ell \leq -1.8 \cdot 10^{+91}:\\
\;\;\;\;U + t\_1 \cdot \left({\ell}^{3} \cdot \left(J \cdot 0.3333333333333333\right)\right)\\
\mathbf{elif}\;\ell \leq -0.004:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq 0.0062:\\
\;\;\;\;U + \ell \cdot \left(\cos \left(K \cdot 0.5\right) \cdot \left(J \cdot 2\right)\right)\\
\mathbf{elif}\;\ell \leq 5 \cdot 10^{+101}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;U + t\_1 \cdot \left(J \cdot \left(\ell \cdot \left(2 + 0.3333333333333333 \cdot {\ell}^{2}\right)\right)\right)\\
\end{array}
\end{array}
if l < -1.8e91Initial program 100.0%
Taylor expanded in l around 0 97.9%
Taylor expanded in l around inf 97.9%
*-commutative97.9%
*-commutative97.9%
associate-*r*97.9%
Simplified97.9%
if -1.8e91 < l < -0.0040000000000000001 or 0.00619999999999999978 < l < 4.99999999999999989e101Initial program 99.8%
Taylor expanded in K around 0 77.6%
if -0.0040000000000000001 < l < 0.00619999999999999978Initial program 67.9%
Taylor expanded in l around 0 99.9%
Taylor expanded in l around 0 99.9%
*-commutative99.9%
associate-*r*99.9%
associate-*l*99.9%
*-commutative99.9%
associate-*r*99.9%
Simplified99.9%
if 4.99999999999999989e101 < l Initial program 100.0%
Taylor expanded in l around 0 97.6%
Final simplification96.0%
(FPCore (J l K U)
:precision binary64
(let* ((t_0
(+ U (* (cos (/ K 2.0)) (* (pow l 3.0) (* J 0.3333333333333333)))))
(t_1 (+ (* (- (exp l) (exp (- l))) J) U)))
(if (<= l -1.8e+91)
t_0
(if (<= l -0.0037)
t_1
(if (<= l 0.00295)
(+ U (* l (* (cos (* K 0.5)) (* J 2.0))))
(if (<= l 5e+101) t_1 t_0))))))
double code(double J, double l, double K, double U) {
double t_0 = U + (cos((K / 2.0)) * (pow(l, 3.0) * (J * 0.3333333333333333)));
double t_1 = ((exp(l) - exp(-l)) * J) + U;
double tmp;
if (l <= -1.8e+91) {
tmp = t_0;
} else if (l <= -0.0037) {
tmp = t_1;
} else if (l <= 0.00295) {
tmp = U + (l * (cos((K * 0.5)) * (J * 2.0)));
} else if (l <= 5e+101) {
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)) * ((l ** 3.0d0) * (j * 0.3333333333333333d0)))
t_1 = ((exp(l) - exp(-l)) * j) + u
if (l <= (-1.8d+91)) then
tmp = t_0
else if (l <= (-0.0037d0)) then
tmp = t_1
else if (l <= 0.00295d0) then
tmp = u + (l * (cos((k * 0.5d0)) * (j * 2.0d0)))
else if (l <= 5d+101) 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)) * (Math.pow(l, 3.0) * (J * 0.3333333333333333)));
double t_1 = ((Math.exp(l) - Math.exp(-l)) * J) + U;
double tmp;
if (l <= -1.8e+91) {
tmp = t_0;
} else if (l <= -0.0037) {
tmp = t_1;
} else if (l <= 0.00295) {
tmp = U + (l * (Math.cos((K * 0.5)) * (J * 2.0)));
} else if (l <= 5e+101) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(J, l, K, U): t_0 = U + (math.cos((K / 2.0)) * (math.pow(l, 3.0) * (J * 0.3333333333333333))) t_1 = ((math.exp(l) - math.exp(-l)) * J) + U tmp = 0 if l <= -1.8e+91: tmp = t_0 elif l <= -0.0037: tmp = t_1 elif l <= 0.00295: tmp = U + (l * (math.cos((K * 0.5)) * (J * 2.0))) elif l <= 5e+101: 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((l ^ 3.0) * Float64(J * 0.3333333333333333)))) t_1 = Float64(Float64(Float64(exp(l) - exp(Float64(-l))) * J) + U) tmp = 0.0 if (l <= -1.8e+91) tmp = t_0; elseif (l <= -0.0037) tmp = t_1; elseif (l <= 0.00295) tmp = Float64(U + Float64(l * Float64(cos(Float64(K * 0.5)) * Float64(J * 2.0)))); elseif (l <= 5e+101) 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)) * ((l ^ 3.0) * (J * 0.3333333333333333))); t_1 = ((exp(l) - exp(-l)) * J) + U; tmp = 0.0; if (l <= -1.8e+91) tmp = t_0; elseif (l <= -0.0037) tmp = t_1; elseif (l <= 0.00295) tmp = U + (l * (cos((K * 0.5)) * (J * 2.0))); elseif (l <= 5e+101) 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[(N[Power[l, 3.0], $MachinePrecision] * N[(J * 0.3333333333333333), $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.8e+91], t$95$0, If[LessEqual[l, -0.0037], t$95$1, If[LessEqual[l, 0.00295], N[(U + N[(l * N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 5e+101], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + \cos \left(\frac{K}{2}\right) \cdot \left({\ell}^{3} \cdot \left(J \cdot 0.3333333333333333\right)\right)\\
t_1 := \left(e^{\ell} - e^{-\ell}\right) \cdot J + U\\
\mathbf{if}\;\ell \leq -1.8 \cdot 10^{+91}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq -0.0037:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\ell \leq 0.00295:\\
\;\;\;\;U + \ell \cdot \left(\cos \left(K \cdot 0.5\right) \cdot \left(J \cdot 2\right)\right)\\
\mathbf{elif}\;\ell \leq 5 \cdot 10^{+101}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if l < -1.8e91 or 4.99999999999999989e101 < l Initial program 100.0%
Taylor expanded in l around 0 97.7%
Taylor expanded in l around inf 97.7%
*-commutative97.7%
*-commutative97.7%
associate-*r*97.7%
Simplified97.7%
if -1.8e91 < l < -0.0037000000000000002 or 0.00294999999999999993 < l < 4.99999999999999989e101Initial program 99.8%
Taylor expanded in K around 0 77.6%
if -0.0037000000000000002 < l < 0.00294999999999999993Initial program 67.9%
Taylor expanded in l around 0 99.9%
Taylor expanded in l around 0 99.9%
*-commutative99.9%
associate-*r*99.9%
associate-*l*99.9%
*-commutative99.9%
associate-*r*99.9%
Simplified99.9%
Final simplification96.0%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) 0.4) (+ U (* l (* (cos (* K 0.5)) (* J 2.0)))) (+ U (* J (* l (+ 2.0 (* 0.3333333333333333 (pow l 2.0))))))))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= 0.4) {
tmp = U + (l * (cos((K * 0.5)) * (J * 2.0)));
} else {
tmp = U + (J * (l * (2.0 + (0.3333333333333333 * pow(l, 2.0)))));
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if (cos((k / 2.0d0)) <= 0.4d0) then
tmp = u + (l * (cos((k * 0.5d0)) * (j * 2.0d0)))
else
tmp = u + (j * (l * (2.0d0 + (0.3333333333333333d0 * (l ** 2.0d0)))))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (Math.cos((K / 2.0)) <= 0.4) {
tmp = U + (l * (Math.cos((K * 0.5)) * (J * 2.0)));
} else {
tmp = U + (J * (l * (2.0 + (0.3333333333333333 * Math.pow(l, 2.0)))));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if math.cos((K / 2.0)) <= 0.4: tmp = U + (l * (math.cos((K * 0.5)) * (J * 2.0))) else: tmp = U + (J * (l * (2.0 + (0.3333333333333333 * math.pow(l, 2.0))))) return tmp
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= 0.4) tmp = Float64(U + Float64(l * Float64(cos(Float64(K * 0.5)) * Float64(J * 2.0)))); else tmp = Float64(U + Float64(J * Float64(l * Float64(2.0 + Float64(0.3333333333333333 * (l ^ 2.0)))))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (cos((K / 2.0)) <= 0.4) tmp = U + (l * (cos((K * 0.5)) * (J * 2.0))); else tmp = U + (J * (l * (2.0 + (0.3333333333333333 * (l ^ 2.0))))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], 0.4], N[(U + N[(l * N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * N[(l * N[(2.0 + N[(0.3333333333333333 * N[Power[l, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq 0.4:\\
\;\;\;\;U + \ell \cdot \left(\cos \left(K \cdot 0.5\right) \cdot \left(J \cdot 2\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(\ell \cdot \left(2 + 0.3333333333333333 \cdot {\ell}^{2}\right)\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K #s(literal 2 binary64))) < 0.40000000000000002Initial program 79.1%
Taylor expanded in l around 0 86.0%
Taylor expanded in l around 0 72.0%
*-commutative72.0%
associate-*r*72.1%
associate-*l*72.1%
*-commutative72.1%
associate-*r*72.1%
Simplified72.1%
if 0.40000000000000002 < (cos.f64 (/.f64 K #s(literal 2 binary64))) Initial program 85.3%
Taylor expanded in l around 0 88.8%
Taylor expanded in K around 0 85.8%
Final simplification81.4%
(FPCore (J l K U) :precision binary64 (if (or (<= l -0.00105) (not (<= l 0.04))) (+ (* (- (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.00105) || !(l <= 0.04)) {
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.00105d0)) .or. (.not. (l <= 0.04d0))) 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.00105) || !(l <= 0.04)) {
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.00105) or not (l <= 0.04): 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.00105) || !(l <= 0.04)) 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.00105) || ~((l <= 0.04))) 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.00105], N[Not[LessEqual[l, 0.04]], $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.00105 \lor \neg \left(\ell \leq 0.04\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.00104999999999999994 or 0.0400000000000000008 < l Initial program 99.9%
Taylor expanded in K around 0 78.0%
if -0.00104999999999999994 < l < 0.0400000000000000008Initial program 67.9%
Taylor expanded in l around 0 99.9%
Taylor expanded in l around 0 99.9%
*-commutative99.9%
associate-*r*99.9%
associate-*l*99.9%
*-commutative99.9%
associate-*r*99.9%
Simplified99.9%
Final simplification89.4%
(FPCore (J l K U)
:precision binary64
(if (<= l -3.7e+74)
(pow U -3.0)
(if (<= l -520000000000.0)
(* U (- U -4.0))
(if (<= l 5.1e+101) U (pow U -4.0)))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -3.7e+74) {
tmp = pow(U, -3.0);
} else if (l <= -520000000000.0) {
tmp = U * (U - -4.0);
} else if (l <= 5.1e+101) {
tmp = U;
} 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 <= (-3.7d+74)) then
tmp = u ** (-3.0d0)
else if (l <= (-520000000000.0d0)) then
tmp = u * (u - (-4.0d0))
else if (l <= 5.1d+101) then
tmp = u
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 <= -3.7e+74) {
tmp = Math.pow(U, -3.0);
} else if (l <= -520000000000.0) {
tmp = U * (U - -4.0);
} else if (l <= 5.1e+101) {
tmp = U;
} else {
tmp = Math.pow(U, -4.0);
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -3.7e+74: tmp = math.pow(U, -3.0) elif l <= -520000000000.0: tmp = U * (U - -4.0) elif l <= 5.1e+101: tmp = U else: tmp = math.pow(U, -4.0) return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -3.7e+74) tmp = U ^ -3.0; elseif (l <= -520000000000.0) tmp = Float64(U * Float64(U - -4.0)); elseif (l <= 5.1e+101) tmp = U; else tmp = U ^ -4.0; end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -3.7e+74) tmp = U ^ -3.0; elseif (l <= -520000000000.0) tmp = U * (U - -4.0); elseif (l <= 5.1e+101) tmp = U; else tmp = U ^ -4.0; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -3.7e+74], N[Power[U, -3.0], $MachinePrecision], If[LessEqual[l, -520000000000.0], N[(U * N[(U - -4.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 5.1e+101], U, N[Power[U, -4.0], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -3.7 \cdot 10^{+74}:\\
\;\;\;\;{U}^{-3}\\
\mathbf{elif}\;\ell \leq -520000000000:\\
\;\;\;\;U \cdot \left(U - -4\right)\\
\mathbf{elif}\;\ell \leq 5.1 \cdot 10^{+101}:\\
\;\;\;\;U\\
\mathbf{else}:\\
\;\;\;\;{U}^{-4}\\
\end{array}
\end{array}
if l < -3.7000000000000001e74Initial program 100.0%
Applied egg-rr25.1%
if -3.7000000000000001e74 < l < -5.2e11Initial program 100.0%
Applied egg-rr41.9%
if -5.2e11 < l < 5.09999999999999995e101Initial program 71.9%
Taylor expanded in J around 0 59.5%
if 5.09999999999999995e101 < l Initial program 100.0%
Applied egg-rr26.8%
(FPCore (J l K U)
:precision binary64
(if (<= l -9e+132)
(pow U -4.0)
(if (<= l -170000000000.0)
(* U (- U -4.0))
(if (<= l 5.1e+101) U (pow U -4.0)))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -9e+132) {
tmp = pow(U, -4.0);
} else if (l <= -170000000000.0) {
tmp = U * (U - -4.0);
} else if (l <= 5.1e+101) {
tmp = U;
} 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 <= (-9d+132)) then
tmp = u ** (-4.0d0)
else if (l <= (-170000000000.0d0)) then
tmp = u * (u - (-4.0d0))
else if (l <= 5.1d+101) then
tmp = u
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 <= -9e+132) {
tmp = Math.pow(U, -4.0);
} else if (l <= -170000000000.0) {
tmp = U * (U - -4.0);
} else if (l <= 5.1e+101) {
tmp = U;
} else {
tmp = Math.pow(U, -4.0);
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -9e+132: tmp = math.pow(U, -4.0) elif l <= -170000000000.0: tmp = U * (U - -4.0) elif l <= 5.1e+101: tmp = U else: tmp = math.pow(U, -4.0) return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -9e+132) tmp = U ^ -4.0; elseif (l <= -170000000000.0) tmp = Float64(U * Float64(U - -4.0)); elseif (l <= 5.1e+101) tmp = U; else tmp = U ^ -4.0; end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -9e+132) tmp = U ^ -4.0; elseif (l <= -170000000000.0) tmp = U * (U - -4.0); elseif (l <= 5.1e+101) tmp = U; else tmp = U ^ -4.0; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -9e+132], N[Power[U, -4.0], $MachinePrecision], If[LessEqual[l, -170000000000.0], N[(U * N[(U - -4.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 5.1e+101], U, N[Power[U, -4.0], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -9 \cdot 10^{+132}:\\
\;\;\;\;{U}^{-4}\\
\mathbf{elif}\;\ell \leq -170000000000:\\
\;\;\;\;U \cdot \left(U - -4\right)\\
\mathbf{elif}\;\ell \leq 5.1 \cdot 10^{+101}:\\
\;\;\;\;U\\
\mathbf{else}:\\
\;\;\;\;{U}^{-4}\\
\end{array}
\end{array}
if l < -8.99999999999999944e132 or 5.09999999999999995e101 < l Initial program 100.0%
Applied egg-rr24.3%
if -8.99999999999999944e132 < l < -1.7e11Initial program 100.0%
Applied egg-rr32.4%
if -1.7e11 < l < 5.09999999999999995e101Initial program 71.9%
Taylor expanded in J around 0 59.5%
(FPCore (J l K U) :precision binary64 (+ U (* l (* (cos (* K 0.5)) (* J 2.0)))))
double code(double J, double l, double K, double U) {
return U + (l * (cos((K * 0.5)) * (J * 2.0)));
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = u + (l * (cos((k * 0.5d0)) * (j * 2.0d0)))
end function
public static double code(double J, double l, double K, double U) {
return U + (l * (Math.cos((K * 0.5)) * (J * 2.0)));
}
def code(J, l, K, U): return U + (l * (math.cos((K * 0.5)) * (J * 2.0)))
function code(J, l, K, U) return Float64(U + Float64(l * Float64(cos(Float64(K * 0.5)) * Float64(J * 2.0)))) end
function tmp = code(J, l, K, U) tmp = U + (l * (cos((K * 0.5)) * (J * 2.0))); end
code[J_, l_, K_, U_] := N[(U + N[(l * N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + \ell \cdot \left(\cos \left(K \cdot 0.5\right) \cdot \left(J \cdot 2\right)\right)
\end{array}
Initial program 83.3%
Taylor expanded in l around 0 87.9%
Taylor expanded in l around 0 69.4%
*-commutative69.4%
associate-*r*69.4%
associate-*l*69.4%
*-commutative69.4%
associate-*r*69.4%
Simplified69.4%
Final simplification69.4%
(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 83.3%
Taylor expanded in l around 0 69.4%
Final simplification69.4%
(FPCore (J l K U) :precision binary64 (if (or (<= l -760.0) (not (<= l 3.1e-56))) (* U U) U))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -760.0) || !(l <= 3.1e-56)) {
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 <= (-760.0d0)) .or. (.not. (l <= 3.1d-56))) 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 <= -760.0) || !(l <= 3.1e-56)) {
tmp = U * U;
} else {
tmp = U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -760.0) or not (l <= 3.1e-56): tmp = U * U else: tmp = U return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -760.0) || !(l <= 3.1e-56)) tmp = Float64(U * U); else tmp = U; end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -760.0) || ~((l <= 3.1e-56))) tmp = U * U; else tmp = U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -760.0], N[Not[LessEqual[l, 3.1e-56]], $MachinePrecision]], N[(U * U), $MachinePrecision], U]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -760 \lor \neg \left(\ell \leq 3.1 \cdot 10^{-56}\right):\\
\;\;\;\;U \cdot U\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\end{array}
if l < -760 or 3.09999999999999987e-56 < l Initial program 97.7%
Applied egg-rr18.4%
if -760 < l < 3.09999999999999987e-56Initial program 69.6%
Taylor expanded in J around 0 68.6%
Final simplification44.1%
(FPCore (J l K U) :precision binary64 (if (<= l -150000000000.0) (* U (- U -4.0)) (if (<= l 3.1e-56) U (* U U))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -150000000000.0) {
tmp = U * (U - -4.0);
} else if (l <= 3.1e-56) {
tmp = U;
} else {
tmp = U * U;
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if (l <= (-150000000000.0d0)) then
tmp = u * (u - (-4.0d0))
else if (l <= 3.1d-56) then
tmp = u
else
tmp = u * u
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (l <= -150000000000.0) {
tmp = U * (U - -4.0);
} else if (l <= 3.1e-56) {
tmp = U;
} else {
tmp = U * U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -150000000000.0: tmp = U * (U - -4.0) elif l <= 3.1e-56: tmp = U else: tmp = U * U return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -150000000000.0) tmp = Float64(U * Float64(U - -4.0)); elseif (l <= 3.1e-56) tmp = U; else tmp = Float64(U * U); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -150000000000.0) tmp = U * (U - -4.0); elseif (l <= 3.1e-56) tmp = U; else tmp = U * U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -150000000000.0], N[(U * N[(U - -4.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 3.1e-56], U, N[(U * U), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -150000000000:\\
\;\;\;\;U \cdot \left(U - -4\right)\\
\mathbf{elif}\;\ell \leq 3.1 \cdot 10^{-56}:\\
\;\;\;\;U\\
\mathbf{else}:\\
\;\;\;\;U \cdot U\\
\end{array}
\end{array}
if l < -1.5e11Initial program 100.0%
Applied egg-rr18.7%
if -1.5e11 < l < 3.09999999999999987e-56Initial program 70.1%
Taylor expanded in J around 0 67.6%
if 3.09999999999999987e-56 < l Initial program 95.0%
Applied egg-rr18.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 36.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 83.3%
Applied egg-rr2.9%
*-inverses2.9%
Simplified2.9%
herbie shell --seed 2024087
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))