
(FPCore (J l K U) :precision binary64 (+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))
double code(double J, double l, double K, double U) {
return ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = ((j * (exp(l) - exp(-l))) * cos((k / 2.0d0))) + u
end function
public static double code(double J, double l, double K, double U) {
return ((J * (Math.exp(l) - Math.exp(-l))) * Math.cos((K / 2.0))) + U;
}
def code(J, l, K, U): return ((J * (math.exp(l) - math.exp(-l))) * math.cos((K / 2.0))) + U
function code(J, l, K, U) return Float64(Float64(Float64(J * Float64(exp(l) - exp(Float64(-l)))) * cos(Float64(K / 2.0))) + U) end
function tmp = code(J, l, K, U) tmp = ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U; end
code[J_, l_, K_, U_] := N[(N[(N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]
\begin{array}{l}
\\
\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 16 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (J l K U) :precision binary64 (+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))
double code(double J, double l, double K, double U) {
return ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = ((j * (exp(l) - exp(-l))) * cos((k / 2.0d0))) + u
end function
public static double code(double J, double l, double K, double U) {
return ((J * (Math.exp(l) - Math.exp(-l))) * Math.cos((K / 2.0))) + U;
}
def code(J, l, K, U): return ((J * (math.exp(l) - math.exp(-l))) * math.cos((K / 2.0))) + U
function code(J, l, K, U) return Float64(Float64(Float64(J * Float64(exp(l) - exp(Float64(-l)))) * cos(Float64(K / 2.0))) + U) end
function tmp = code(J, l, K, U) tmp = ((J * (exp(l) - exp(-l))) * cos((K / 2.0))) + U; end
code[J_, l_, K_, U_] := N[(N[(N[(J * N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision]
\begin{array}{l}
\\
\left(J \cdot \left(e^{\ell} - e^{-\ell}\right)\right) \cdot \cos \left(\frac{K}{2}\right) + U
\end{array}
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (- (exp l) (exp (- l)))))
(if (or (<= t_0 -0.2) (not (<= t_0 0.02)))
(+ (* (* t_0 J) (cos (/ K 2.0))) U)
(+
U
(*
J
(*
(cos (* K 0.5))
(+
(* l 2.0)
(*
(pow l 3.0)
(+ 0.3333333333333333 (* 0.016666666666666666 (pow l 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.2) || !(t_0 <= 0.02)) {
tmp = ((t_0 * J) * cos((K / 2.0))) + U;
} else {
tmp = U + (J * (cos((K * 0.5)) * ((l * 2.0) + (pow(l, 3.0) * (0.3333333333333333 + (0.016666666666666666 * 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) :: tmp
t_0 = exp(l) - exp(-l)
if ((t_0 <= (-0.2d0)) .or. (.not. (t_0 <= 0.02d0))) then
tmp = ((t_0 * j) * cos((k / 2.0d0))) + u
else
tmp = u + (j * (cos((k * 0.5d0)) * ((l * 2.0d0) + ((l ** 3.0d0) * (0.3333333333333333d0 + (0.016666666666666666d0 * (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);
double tmp;
if ((t_0 <= -0.2) || !(t_0 <= 0.02)) {
tmp = ((t_0 * J) * Math.cos((K / 2.0))) + U;
} else {
tmp = U + (J * (Math.cos((K * 0.5)) * ((l * 2.0) + (Math.pow(l, 3.0) * (0.3333333333333333 + (0.016666666666666666 * Math.pow(l, 2.0)))))));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.exp(l) - math.exp(-l) tmp = 0 if (t_0 <= -0.2) or not (t_0 <= 0.02): tmp = ((t_0 * J) * math.cos((K / 2.0))) + U else: tmp = U + (J * (math.cos((K * 0.5)) * ((l * 2.0) + (math.pow(l, 3.0) * (0.3333333333333333 + (0.016666666666666666 * math.pow(l, 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.2) || !(t_0 <= 0.02)) tmp = Float64(Float64(Float64(t_0 * J) * cos(Float64(K / 2.0))) + U); else tmp = Float64(U + Float64(J * Float64(cos(Float64(K * 0.5)) * Float64(Float64(l * 2.0) + Float64((l ^ 3.0) * Float64(0.3333333333333333 + Float64(0.016666666666666666 * (l ^ 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.2) || ~((t_0 <= 0.02))) tmp = ((t_0 * J) * cos((K / 2.0))) + U; else tmp = U + (J * (cos((K * 0.5)) * ((l * 2.0) + ((l ^ 3.0) * (0.3333333333333333 + (0.016666666666666666 * (l ^ 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.2], N[Not[LessEqual[t$95$0, 0.02]], $MachinePrecision]], N[(N[(N[(t$95$0 * J), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], N[(U + N[(J * N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * N[(N[(l * 2.0), $MachinePrecision] + N[(N[Power[l, 3.0], $MachinePrecision] * N[(0.3333333333333333 + N[(0.016666666666666666 * N[Power[l, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{\ell} - e^{-\ell}\\
\mathbf{if}\;t\_0 \leq -0.2 \lor \neg \left(t\_0 \leq 0.02\right):\\
\;\;\;\;\left(t\_0 \cdot J\right) \cdot \cos \left(\frac{K}{2}\right) + U\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(\cos \left(K \cdot 0.5\right) \cdot \left(\ell \cdot 2 + {\ell}^{3} \cdot \left(0.3333333333333333 + 0.016666666666666666 \cdot {\ell}^{2}\right)\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -0.20000000000000001 or 0.0200000000000000004 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 100.0%
if -0.20000000000000001 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 0.0200000000000000004Initial program 70.2%
Taylor expanded in l around 0 99.9%
*-commutative99.9%
Simplified99.9%
unpow299.9%
Applied egg-rr99.9%
Taylor expanded in J around 0 99.9%
distribute-lft-in99.9%
distribute-lft-in99.9%
+-commutative99.9%
*-commutative99.9%
fma-undefine99.9%
associate-*r*99.9%
unpow299.9%
cube-mult99.9%
*-commutative99.9%
distribute-lft-out99.9%
fma-define99.9%
*-commutative99.9%
fma-undefine99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in J around 0 99.9%
Final simplification99.9%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (- (exp l) (exp (- l)))))
(if (or (<= t_0 -0.2) (not (<= t_0 0.0)))
(+ (* (* t_0 J) (cos (/ K 2.0))) U)
(+
U
(*
l
(* (cos (* K 0.5)) (* J (fma 0.3333333333333333 (pow l 2.0) 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.2) || !(t_0 <= 0.0)) {
tmp = ((t_0 * J) * cos((K / 2.0))) + U;
} else {
tmp = U + (l * (cos((K * 0.5)) * (J * fma(0.3333333333333333, pow(l, 2.0), 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.2) || !(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 * fma(0.3333333333333333, (l ^ 2.0), 2.0))))); end return 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.2], 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 * N[(0.3333333333333333 * N[Power[l, 2.0], $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{\ell} - e^{-\ell}\\
\mathbf{if}\;t\_0 \leq -0.2 \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 \mathsf{fma}\left(0.3333333333333333, {\ell}^{2}, 2\right)\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -0.20000000000000001 or 0.0 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 99.9%
if -0.20000000000000001 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 0.0Initial program 69.8%
Taylor expanded in l around 0 99.9%
associate-*r*99.9%
associate-*r*99.9%
associate-*r*99.9%
distribute-rgt-out99.9%
*-commutative99.9%
associate-*r*99.9%
distribute-rgt-out99.9%
fma-define99.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 -0.2) (not (<= t_1 0.02)))
(+ (* (* t_1 J) t_0) U)
(+
U
(*
t_0
(*
J
(*
l
(+
2.0
(*
(* l l)
(+ 0.3333333333333333 (* 0.016666666666666666 (* l l))))))))))))
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 <= -0.2) || !(t_1 <= 0.02)) {
tmp = ((t_1 * J) * t_0) + U;
} else {
tmp = U + (t_0 * (J * (l * (2.0 + ((l * l) * (0.3333333333333333 + (0.016666666666666666 * (l * l))))))));
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = cos((k / 2.0d0))
t_1 = exp(l) - exp(-l)
if ((t_1 <= (-0.2d0)) .or. (.not. (t_1 <= 0.02d0))) then
tmp = ((t_1 * j) * t_0) + u
else
tmp = u + (t_0 * (j * (l * (2.0d0 + ((l * l) * (0.3333333333333333d0 + (0.016666666666666666d0 * (l * l))))))))
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 <= -0.2) || !(t_1 <= 0.02)) {
tmp = ((t_1 * J) * t_0) + U;
} else {
tmp = U + (t_0 * (J * (l * (2.0 + ((l * l) * (0.3333333333333333 + (0.016666666666666666 * (l * l))))))));
}
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 <= -0.2) or not (t_1 <= 0.02): tmp = ((t_1 * J) * t_0) + U else: tmp = U + (t_0 * (J * (l * (2.0 + ((l * l) * (0.3333333333333333 + (0.016666666666666666 * (l * l)))))))) 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 <= -0.2) || !(t_1 <= 0.02)) 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(Float64(l * l) * Float64(0.3333333333333333 + Float64(0.016666666666666666 * Float64(l * l))))))))); 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 <= -0.2) || ~((t_1 <= 0.02))) tmp = ((t_1 * J) * t_0) + U; else tmp = U + (t_0 * (J * (l * (2.0 + ((l * l) * (0.3333333333333333 + (0.016666666666666666 * (l * l)))))))); 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, -0.2], N[Not[LessEqual[t$95$1, 0.02]], $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[(l * l), $MachinePrecision] * N[(0.3333333333333333 + N[(0.016666666666666666 * N[(l * l), $MachinePrecision]), $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 -0.2 \lor \neg \left(t\_1 \leq 0.02\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 + \left(\ell \cdot \ell\right) \cdot \left(0.3333333333333333 + 0.016666666666666666 \cdot \left(\ell \cdot \ell\right)\right)\right)\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -0.20000000000000001 or 0.0200000000000000004 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 100.0%
if -0.20000000000000001 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 0.0200000000000000004Initial program 70.2%
Taylor expanded in l around 0 99.9%
*-commutative99.9%
Simplified99.9%
unpow299.9%
Applied egg-rr99.9%
unpow299.9%
Applied egg-rr99.9%
Final simplification99.9%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (exp (- l))) (t_1 (cos (/ K 2.0))))
(if (<= l -4.6)
(+ U (* t_1 (* J (- 27.0 t_0))))
(if (or (<= l 5200.0) (not (<= l 7.2e+61)))
(+
U
(*
t_1
(*
J
(*
l
(+
2.0
(*
(* l l)
(+ 0.3333333333333333 (* 0.016666666666666666 (* l l)))))))))
(+ (* (- (exp l) t_0) J) U)))))
double code(double J, double l, double K, double U) {
double t_0 = exp(-l);
double t_1 = cos((K / 2.0));
double tmp;
if (l <= -4.6) {
tmp = U + (t_1 * (J * (27.0 - t_0)));
} else if ((l <= 5200.0) || !(l <= 7.2e+61)) {
tmp = U + (t_1 * (J * (l * (2.0 + ((l * l) * (0.3333333333333333 + (0.016666666666666666 * (l * l))))))));
} else {
tmp = ((exp(l) - t_0) * J) + 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 = exp(-l)
t_1 = cos((k / 2.0d0))
if (l <= (-4.6d0)) then
tmp = u + (t_1 * (j * (27.0d0 - t_0)))
else if ((l <= 5200.0d0) .or. (.not. (l <= 7.2d+61))) then
tmp = u + (t_1 * (j * (l * (2.0d0 + ((l * l) * (0.3333333333333333d0 + (0.016666666666666666d0 * (l * l))))))))
else
tmp = ((exp(l) - t_0) * j) + u
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = Math.exp(-l);
double t_1 = Math.cos((K / 2.0));
double tmp;
if (l <= -4.6) {
tmp = U + (t_1 * (J * (27.0 - t_0)));
} else if ((l <= 5200.0) || !(l <= 7.2e+61)) {
tmp = U + (t_1 * (J * (l * (2.0 + ((l * l) * (0.3333333333333333 + (0.016666666666666666 * (l * l))))))));
} else {
tmp = ((Math.exp(l) - t_0) * J) + U;
}
return tmp;
}
def code(J, l, K, U): t_0 = math.exp(-l) t_1 = math.cos((K / 2.0)) tmp = 0 if l <= -4.6: tmp = U + (t_1 * (J * (27.0 - t_0))) elif (l <= 5200.0) or not (l <= 7.2e+61): tmp = U + (t_1 * (J * (l * (2.0 + ((l * l) * (0.3333333333333333 + (0.016666666666666666 * (l * l)))))))) else: tmp = ((math.exp(l) - t_0) * J) + U return tmp
function code(J, l, K, U) t_0 = exp(Float64(-l)) t_1 = cos(Float64(K / 2.0)) tmp = 0.0 if (l <= -4.6) tmp = Float64(U + Float64(t_1 * Float64(J * Float64(27.0 - t_0)))); elseif ((l <= 5200.0) || !(l <= 7.2e+61)) tmp = Float64(U + Float64(t_1 * Float64(J * Float64(l * Float64(2.0 + Float64(Float64(l * l) * Float64(0.3333333333333333 + Float64(0.016666666666666666 * Float64(l * l))))))))); else tmp = Float64(Float64(Float64(exp(l) - t_0) * J) + U); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = exp(-l); t_1 = cos((K / 2.0)); tmp = 0.0; if (l <= -4.6) tmp = U + (t_1 * (J * (27.0 - t_0))); elseif ((l <= 5200.0) || ~((l <= 7.2e+61))) tmp = U + (t_1 * (J * (l * (2.0 + ((l * l) * (0.3333333333333333 + (0.016666666666666666 * (l * l)))))))); else tmp = ((exp(l) - t_0) * J) + U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Exp[(-l)], $MachinePrecision]}, Block[{t$95$1 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -4.6], N[(U + N[(t$95$1 * N[(J * N[(27.0 - t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[l, 5200.0], N[Not[LessEqual[l, 7.2e+61]], $MachinePrecision]], N[(U + N[(t$95$1 * N[(J * N[(l * N[(2.0 + N[(N[(l * l), $MachinePrecision] * N[(0.3333333333333333 + N[(0.016666666666666666 * N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Exp[l], $MachinePrecision] - t$95$0), $MachinePrecision] * J), $MachinePrecision] + U), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-\ell}\\
t_1 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;\ell \leq -4.6:\\
\;\;\;\;U + t\_1 \cdot \left(J \cdot \left(27 - t\_0\right)\right)\\
\mathbf{elif}\;\ell \leq 5200 \lor \neg \left(\ell \leq 7.2 \cdot 10^{+61}\right):\\
\;\;\;\;U + t\_1 \cdot \left(J \cdot \left(\ell \cdot \left(2 + \left(\ell \cdot \ell\right) \cdot \left(0.3333333333333333 + 0.016666666666666666 \cdot \left(\ell \cdot \ell\right)\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(e^{\ell} - t\_0\right) \cdot J + U\\
\end{array}
\end{array}
if l < -4.5999999999999996Initial program 100.0%
Applied egg-rr100.0%
if -4.5999999999999996 < l < 5200 or 7.20000000000000021e61 < l Initial program 78.9%
Taylor expanded in l around 0 99.0%
*-commutative99.0%
Simplified99.0%
unpow299.0%
Applied egg-rr99.0%
unpow299.0%
Applied egg-rr99.0%
if 5200 < l < 7.20000000000000021e61Initial program 100.0%
Taylor expanded in K around 0 100.0%
Final simplification99.3%
(FPCore (J l K U)
:precision binary64
(if (or (<= l 5200.0) (not (<= l 1.02e+62)))
(+
U
(*
(cos (/ K 2.0))
(*
J
(*
l
(+
2.0
(*
(* l l)
(+ 0.3333333333333333 (* 0.016666666666666666 (* l l)))))))))
(+ (* (- (exp l) (exp (- l))) J) U)))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= 5200.0) || !(l <= 1.02e+62)) {
tmp = U + (cos((K / 2.0)) * (J * (l * (2.0 + ((l * l) * (0.3333333333333333 + (0.016666666666666666 * (l * l))))))));
} else {
tmp = ((exp(l) - exp(-l)) * J) + 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 <= 5200.0d0) .or. (.not. (l <= 1.02d+62))) then
tmp = u + (cos((k / 2.0d0)) * (j * (l * (2.0d0 + ((l * l) * (0.3333333333333333d0 + (0.016666666666666666d0 * (l * l))))))))
else
tmp = ((exp(l) - exp(-l)) * j) + u
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if ((l <= 5200.0) || !(l <= 1.02e+62)) {
tmp = U + (Math.cos((K / 2.0)) * (J * (l * (2.0 + ((l * l) * (0.3333333333333333 + (0.016666666666666666 * (l * l))))))));
} else {
tmp = ((Math.exp(l) - Math.exp(-l)) * J) + U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= 5200.0) or not (l <= 1.02e+62): tmp = U + (math.cos((K / 2.0)) * (J * (l * (2.0 + ((l * l) * (0.3333333333333333 + (0.016666666666666666 * (l * l)))))))) else: tmp = ((math.exp(l) - math.exp(-l)) * J) + U return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= 5200.0) || !(l <= 1.02e+62)) tmp = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(J * Float64(l * Float64(2.0 + Float64(Float64(l * l) * Float64(0.3333333333333333 + Float64(0.016666666666666666 * Float64(l * l))))))))); else tmp = Float64(Float64(Float64(exp(l) - exp(Float64(-l))) * J) + U); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= 5200.0) || ~((l <= 1.02e+62))) tmp = U + (cos((K / 2.0)) * (J * (l * (2.0 + ((l * l) * (0.3333333333333333 + (0.016666666666666666 * (l * l)))))))); else tmp = ((exp(l) - exp(-l)) * J) + U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, 5200.0], N[Not[LessEqual[l, 1.02e+62]], $MachinePrecision]], N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(J * N[(l * N[(2.0 + N[(N[(l * l), $MachinePrecision] * N[(0.3333333333333333 + N[(0.016666666666666666 * N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision] + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 5200 \lor \neg \left(\ell \leq 1.02 \cdot 10^{+62}\right):\\
\;\;\;\;U + \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(\ell \cdot \left(2 + \left(\ell \cdot \ell\right) \cdot \left(0.3333333333333333 + 0.016666666666666666 \cdot \left(\ell \cdot \ell\right)\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(e^{\ell} - e^{-\ell}\right) \cdot J + U\\
\end{array}
\end{array}
if l < 5200 or 1.02000000000000002e62 < l Initial program 83.6%
Taylor expanded in l around 0 95.4%
*-commutative95.4%
Simplified95.4%
unpow295.4%
Applied egg-rr95.4%
unpow295.4%
Applied egg-rr95.4%
if 5200 < l < 1.02000000000000002e62Initial program 100.0%
Taylor expanded in K around 0 100.0%
Final simplification95.6%
(FPCore (J l K U)
:precision binary64
(if (<= l 350000000000.0)
(+ U (* 2.0 (* l (* J (cos (* K -0.5))))))
(if (<= l 2.4e+144)
(pow U -3.0)
(* J (+ (* 2.0 (* l (cos (* K 0.5)))) (/ U J))))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= 350000000000.0) {
tmp = U + (2.0 * (l * (J * cos((K * -0.5)))));
} else if (l <= 2.4e+144) {
tmp = pow(U, -3.0);
} else {
tmp = J * ((2.0 * (l * cos((K * 0.5)))) + (U / J));
}
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 <= 350000000000.0d0) then
tmp = u + (2.0d0 * (l * (j * cos((k * (-0.5d0))))))
else if (l <= 2.4d+144) then
tmp = u ** (-3.0d0)
else
tmp = j * ((2.0d0 * (l * cos((k * 0.5d0)))) + (u / j))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (l <= 350000000000.0) {
tmp = U + (2.0 * (l * (J * Math.cos((K * -0.5)))));
} else if (l <= 2.4e+144) {
tmp = Math.pow(U, -3.0);
} else {
tmp = J * ((2.0 * (l * Math.cos((K * 0.5)))) + (U / J));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= 350000000000.0: tmp = U + (2.0 * (l * (J * math.cos((K * -0.5))))) elif l <= 2.4e+144: tmp = math.pow(U, -3.0) else: tmp = J * ((2.0 * (l * math.cos((K * 0.5)))) + (U / J)) return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= 350000000000.0) tmp = Float64(U + Float64(2.0 * Float64(l * Float64(J * cos(Float64(K * -0.5)))))); elseif (l <= 2.4e+144) tmp = U ^ -3.0; else tmp = Float64(J * Float64(Float64(2.0 * Float64(l * cos(Float64(K * 0.5)))) + Float64(U / J))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= 350000000000.0) tmp = U + (2.0 * (l * (J * cos((K * -0.5))))); elseif (l <= 2.4e+144) tmp = U ^ -3.0; else tmp = J * ((2.0 * (l * cos((K * 0.5)))) + (U / J)); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, 350000000000.0], N[(U + N[(2.0 * N[(l * N[(J * N[Cos[N[(K * -0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.4e+144], N[Power[U, -3.0], $MachinePrecision], N[(J * N[(N[(2.0 * N[(l * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(U / J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 350000000000:\\
\;\;\;\;U + 2 \cdot \left(\ell \cdot \left(J \cdot \cos \left(K \cdot -0.5\right)\right)\right)\\
\mathbf{elif}\;\ell \leq 2.4 \cdot 10^{+144}:\\
\;\;\;\;{U}^{-3}\\
\mathbf{else}:\\
\;\;\;\;J \cdot \left(2 \cdot \left(\ell \cdot \cos \left(K \cdot 0.5\right)\right) + \frac{U}{J}\right)\\
\end{array}
\end{array}
if l < 3.5e11Initial program 79.4%
Taylor expanded in l around 0 74.2%
associate-*r*74.2%
*-commutative74.2%
Simplified74.2%
Taylor expanded in J around 0 74.2%
*-commutative74.2%
associate-*l*74.3%
*-commutative74.3%
*-commutative74.3%
metadata-eval74.3%
distribute-rgt-neg-in74.3%
cos-neg74.3%
Simplified74.3%
if 3.5e11 < l < 2.4000000000000001e144Initial program 100.0%
associate-*l*100.0%
fma-define100.0%
Simplified100.0%
Applied egg-rr34.6%
if 2.4000000000000001e144 < l Initial program 100.0%
Taylor expanded in l around 0 46.1%
associate-*r*46.1%
*-commutative46.1%
Simplified46.1%
Taylor expanded in J around inf 53.3%
Final simplification67.4%
(FPCore (J l K U)
:precision binary64
(+
U
(*
(cos (/ K 2.0))
(*
J
(*
l
(+
2.0
(* (* l l) (+ 0.3333333333333333 (* 0.016666666666666666 (* l l))))))))))
double code(double J, double l, double K, double U) {
return U + (cos((K / 2.0)) * (J * (l * (2.0 + ((l * l) * (0.3333333333333333 + (0.016666666666666666 * (l * l))))))));
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = u + (cos((k / 2.0d0)) * (j * (l * (2.0d0 + ((l * l) * (0.3333333333333333d0 + (0.016666666666666666d0 * (l * l))))))))
end function
public static double code(double J, double l, double K, double U) {
return U + (Math.cos((K / 2.0)) * (J * (l * (2.0 + ((l * l) * (0.3333333333333333 + (0.016666666666666666 * (l * l))))))));
}
def code(J, l, K, U): return U + (math.cos((K / 2.0)) * (J * (l * (2.0 + ((l * l) * (0.3333333333333333 + (0.016666666666666666 * (l * l))))))))
function code(J, l, K, U) return Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(J * Float64(l * Float64(2.0 + Float64(Float64(l * l) * Float64(0.3333333333333333 + Float64(0.016666666666666666 * Float64(l * l))))))))) end
function tmp = code(J, l, K, U) tmp = U + (cos((K / 2.0)) * (J * (l * (2.0 + ((l * l) * (0.3333333333333333 + (0.016666666666666666 * (l * l)))))))); end
code[J_, l_, K_, U_] := N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(J * N[(l * N[(2.0 + N[(N[(l * l), $MachinePrecision] * N[(0.3333333333333333 + N[(0.016666666666666666 * N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(\ell \cdot \left(2 + \left(\ell \cdot \ell\right) \cdot \left(0.3333333333333333 + 0.016666666666666666 \cdot \left(\ell \cdot \ell\right)\right)\right)\right)\right)
\end{array}
Initial program 84.5%
Taylor expanded in l around 0 91.5%
*-commutative91.5%
Simplified91.5%
unpow291.5%
Applied egg-rr91.5%
unpow291.5%
Applied egg-rr91.5%
Final simplification91.5%
(FPCore (J l K U) :precision binary64 (* U (+ 1.0 (* 2.0 (* J (/ (* l (cos (* K 0.5))) U))))))
double code(double J, double l, double K, double U) {
return U * (1.0 + (2.0 * (J * ((l * cos((K * 0.5))) / U))));
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = u * (1.0d0 + (2.0d0 * (j * ((l * cos((k * 0.5d0))) / u))))
end function
public static double code(double J, double l, double K, double U) {
return U * (1.0 + (2.0 * (J * ((l * Math.cos((K * 0.5))) / U))));
}
def code(J, l, K, U): return U * (1.0 + (2.0 * (J * ((l * math.cos((K * 0.5))) / U))))
function code(J, l, K, U) return Float64(U * Float64(1.0 + Float64(2.0 * Float64(J * Float64(Float64(l * cos(Float64(K * 0.5))) / U))))) end
function tmp = code(J, l, K, U) tmp = U * (1.0 + (2.0 * (J * ((l * cos((K * 0.5))) / U)))); end
code[J_, l_, K_, U_] := N[(U * N[(1.0 + N[(2.0 * N[(J * N[(N[(l * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U \cdot \left(1 + 2 \cdot \left(J \cdot \frac{\ell \cdot \cos \left(K \cdot 0.5\right)}{U}\right)\right)
\end{array}
Initial program 84.5%
Taylor expanded in l around 0 63.3%
associate-*r*63.3%
*-commutative63.3%
Simplified63.3%
Taylor expanded in U around inf 65.8%
associate-/l*68.9%
Simplified68.9%
Final simplification68.9%
(FPCore (J l K U) :precision binary64 (+ U (* 2.0 (* l (* J (cos (* K -0.5)))))))
double code(double J, double l, double K, double U) {
return U + (2.0 * (l * (J * cos((K * -0.5)))));
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = u + (2.0d0 * (l * (j * cos((k * (-0.5d0))))))
end function
public static double code(double J, double l, double K, double U) {
return U + (2.0 * (l * (J * Math.cos((K * -0.5)))));
}
def code(J, l, K, U): return U + (2.0 * (l * (J * math.cos((K * -0.5)))))
function code(J, l, K, U) return Float64(U + Float64(2.0 * Float64(l * Float64(J * cos(Float64(K * -0.5)))))) end
function tmp = code(J, l, K, U) tmp = U + (2.0 * (l * (J * cos((K * -0.5))))); end
code[J_, l_, K_, U_] := N[(U + N[(2.0 * N[(l * N[(J * N[Cos[N[(K * -0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + 2 \cdot \left(\ell \cdot \left(J \cdot \cos \left(K \cdot -0.5\right)\right)\right)
\end{array}
Initial program 84.5%
Taylor expanded in l around 0 63.3%
associate-*r*63.3%
*-commutative63.3%
Simplified63.3%
Taylor expanded in J around 0 63.3%
*-commutative63.3%
associate-*l*63.3%
*-commutative63.3%
*-commutative63.3%
metadata-eval63.3%
distribute-rgt-neg-in63.3%
cos-neg63.3%
Simplified63.3%
Final simplification63.3%
(FPCore (J l K U) :precision binary64 (fma l (* J 2.0) U))
double code(double J, double l, double K, double U) {
return fma(l, (J * 2.0), U);
}
function code(J, l, K, U) return fma(l, Float64(J * 2.0), U) end
code[J_, l_, K_, U_] := N[(l * N[(J * 2.0), $MachinePrecision] + U), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\ell, J \cdot 2, U\right)
\end{array}
Initial program 84.5%
Taylor expanded in l around 0 63.3%
associate-*r*63.3%
*-commutative63.3%
Simplified63.3%
Taylor expanded in J around 0 63.3%
*-commutative63.3%
associate-*l*63.3%
*-commutative63.3%
*-commutative63.3%
metadata-eval63.3%
distribute-rgt-neg-in63.3%
cos-neg63.3%
Simplified63.3%
Taylor expanded in K around 0 51.8%
+-commutative51.8%
associate-*r*51.8%
*-commutative51.8%
fma-define51.8%
Simplified51.8%
Final simplification51.8%
(FPCore (J l K U) :precision binary64 (if (or (<= l -830.0) (not (<= l 650000.0))) (* U (- U -4.0)) U))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -830.0) || !(l <= 650000.0)) {
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 <= (-830.0d0)) .or. (.not. (l <= 650000.0d0))) 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 <= -830.0) || !(l <= 650000.0)) {
tmp = U * (U - -4.0);
} else {
tmp = U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -830.0) or not (l <= 650000.0): tmp = U * (U - -4.0) else: tmp = U return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -830.0) || !(l <= 650000.0)) 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 <= -830.0) || ~((l <= 650000.0))) tmp = U * (U - -4.0); else tmp = U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -830.0], N[Not[LessEqual[l, 650000.0]], $MachinePrecision]], N[(U * N[(U - -4.0), $MachinePrecision]), $MachinePrecision], U]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -830 \lor \neg \left(\ell \leq 650000\right):\\
\;\;\;\;U \cdot \left(U - -4\right)\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\end{array}
if l < -830 or 6.5e5 < l Initial program 100.0%
associate-*l*100.0%
fma-define100.0%
Simplified100.0%
Applied egg-rr14.1%
if -830 < l < 6.5e5Initial program 71.0%
associate-*l*71.0%
fma-define71.0%
Simplified71.0%
Taylor expanded in J around 0 67.4%
Final simplification42.6%
(FPCore (J l K U) :precision binary64 (if (<= l -13500000000000.0) (- -4.0 (* U U)) (if (<= l 13000.0) U (* U (- U -4.0)))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -13500000000000.0) {
tmp = -4.0 - (U * U);
} else if (l <= 13000.0) {
tmp = U;
} else {
tmp = U * (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 <= (-13500000000000.0d0)) then
tmp = (-4.0d0) - (u * u)
else if (l <= 13000.0d0) then
tmp = u
else
tmp = u * (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 <= -13500000000000.0) {
tmp = -4.0 - (U * U);
} else if (l <= 13000.0) {
tmp = U;
} else {
tmp = U * (U - -4.0);
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -13500000000000.0: tmp = -4.0 - (U * U) elif l <= 13000.0: tmp = U else: tmp = U * (U - -4.0) return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -13500000000000.0) tmp = Float64(-4.0 - Float64(U * U)); elseif (l <= 13000.0) tmp = U; else tmp = Float64(U * Float64(U - -4.0)); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -13500000000000.0) tmp = -4.0 - (U * U); elseif (l <= 13000.0) tmp = U; else tmp = U * (U - -4.0); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -13500000000000.0], N[(-4.0 - N[(U * U), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 13000.0], U, N[(U * N[(U - -4.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -13500000000000:\\
\;\;\;\;-4 - U \cdot U\\
\mathbf{elif}\;\ell \leq 13000:\\
\;\;\;\;U\\
\mathbf{else}:\\
\;\;\;\;U \cdot \left(U - -4\right)\\
\end{array}
\end{array}
if l < -1.35e13Initial program 100.0%
associate-*l*100.0%
fma-define100.0%
Simplified100.0%
Applied egg-rr17.6%
cancel-sign-sub-inv17.6%
Simplified17.6%
if -1.35e13 < l < 13000Initial program 71.7%
associate-*l*71.7%
fma-define71.7%
Simplified71.7%
Taylor expanded in J around 0 66.0%
if 13000 < l Initial program 100.0%
associate-*l*100.0%
fma-define100.0%
Simplified100.0%
Applied egg-rr12.6%
(FPCore (J l K U) :precision binary64 (if (or (<= l -860.0) (not (<= l 11500.0))) (* U U) U))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -860.0) || !(l <= 11500.0)) {
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 <= (-860.0d0)) .or. (.not. (l <= 11500.0d0))) 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 <= -860.0) || !(l <= 11500.0)) {
tmp = U * U;
} else {
tmp = U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -860.0) or not (l <= 11500.0): tmp = U * U else: tmp = U return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -860.0) || !(l <= 11500.0)) tmp = Float64(U * U); else tmp = U; end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -860.0) || ~((l <= 11500.0))) tmp = U * U; else tmp = U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -860.0], N[Not[LessEqual[l, 11500.0]], $MachinePrecision]], N[(U * U), $MachinePrecision], U]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -860 \lor \neg \left(\ell \leq 11500\right):\\
\;\;\;\;U \cdot U\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\end{array}
if l < -860 or 11500 < l Initial program 100.0%
associate-*l*100.0%
fma-define100.0%
Simplified100.0%
Applied egg-rr14.0%
if -860 < l < 11500Initial program 71.0%
associate-*l*71.0%
fma-define71.0%
Simplified71.0%
Taylor expanded in J around 0 67.4%
Final simplification42.6%
(FPCore (J l K U) :precision binary64 (+ U (* l (* J 2.0))))
double code(double J, double l, double K, double U) {
return U + (l * (J * 2.0));
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = u + (l * (j * 2.0d0))
end function
public static double code(double J, double l, double K, double U) {
return U + (l * (J * 2.0));
}
def code(J, l, K, U): return U + (l * (J * 2.0))
function code(J, l, K, U) return Float64(U + Float64(l * Float64(J * 2.0))) end
function tmp = code(J, l, K, U) tmp = U + (l * (J * 2.0)); end
code[J_, l_, K_, U_] := N[(U + N[(l * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + \ell \cdot \left(J \cdot 2\right)
\end{array}
Initial program 84.5%
Taylor expanded in l around 0 63.3%
associate-*r*63.3%
*-commutative63.3%
Simplified63.3%
Taylor expanded in K around 0 51.8%
associate-*r*51.8%
*-commutative51.8%
Simplified51.8%
Final simplification51.8%
(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 84.5%
associate-*l*84.5%
fma-define84.5%
Simplified84.5%
Taylor expanded in J around 0 37.1%
(FPCore (J l K U) :precision binary64 -4.0)
double code(double J, double l, double K, double U) {
return -4.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 = -4.0d0
end function
public static double code(double J, double l, double K, double U) {
return -4.0;
}
def code(J, l, K, U): return -4.0
function code(J, l, K, U) return -4.0 end
function tmp = code(J, l, K, U) tmp = -4.0; end
code[J_, l_, K_, U_] := -4.0
\begin{array}{l}
\\
-4
\end{array}
Initial program 84.5%
associate-*l*84.5%
fma-define84.5%
Simplified84.5%
Applied egg-rr2.4%
sub-neg2.4%
Simplified2.4%
Taylor expanded in U around 0 2.7%
herbie shell --seed 2024149
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))