
(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 17 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 (- INFINITY)) (not (<= t_1 5e-5)))
(+ (* t_0 (* t_1 J)) U)
(+
U
(* t_0 (+ (* 2.0 (* l J)) (* 0.3333333333333333 (* J (pow l 3.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 <= -((double) INFINITY)) || !(t_1 <= 5e-5)) {
tmp = (t_0 * (t_1 * J)) + U;
} else {
tmp = U + (t_0 * ((2.0 * (l * J)) + (0.3333333333333333 * (J * pow(l, 3.0)))));
}
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 <= 5e-5)) {
tmp = (t_0 * (t_1 * J)) + U;
} else {
tmp = U + (t_0 * ((2.0 * (l * J)) + (0.3333333333333333 * (J * Math.pow(l, 3.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 <= -math.inf) or not (t_1 <= 5e-5): tmp = (t_0 * (t_1 * J)) + U else: tmp = U + (t_0 * ((2.0 * (l * J)) + (0.3333333333333333 * (J * math.pow(l, 3.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 <= Float64(-Inf)) || !(t_1 <= 5e-5)) tmp = Float64(Float64(t_0 * Float64(t_1 * J)) + U); else tmp = Float64(U + Float64(t_0 * Float64(Float64(2.0 * Float64(l * J)) + Float64(0.3333333333333333 * Float64(J * (l ^ 3.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 <= -Inf) || ~((t_1 <= 5e-5))) tmp = (t_0 * (t_1 * J)) + U; else tmp = U + (t_0 * ((2.0 * (l * J)) + (0.3333333333333333 * (J * (l ^ 3.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, (-Infinity)], N[Not[LessEqual[t$95$1, 5e-5]], $MachinePrecision]], N[(N[(t$95$0 * N[(t$95$1 * J), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], N[(U + N[(t$95$0 * N[(N[(2.0 * N[(l * J), $MachinePrecision]), $MachinePrecision] + N[(0.3333333333333333 * N[(J * N[Power[l, 3.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 -\infty \lor \neg \left(t_1 \leq 5 \cdot 10^{-5}\right):\\
\;\;\;\;t_0 \cdot \left(t_1 \cdot J\right) + U\\
\mathbf{else}:\\
\;\;\;\;U + t_0 \cdot \left(2 \cdot \left(\ell \cdot J\right) + 0.3333333333333333 \cdot \left(J \cdot {\ell}^{3}\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -inf.0 or 5.00000000000000024e-5 < (-.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))) < 5.00000000000000024e-5Initial program 68.5%
Taylor expanded in l around 0 99.9%
Final simplification100.0%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (+ U (* (- (exp l) (exp (- l))) J)))
(t_1 (* (* (pow l 3.0) (* J 0.3333333333333333)) (cos (* K 0.5)))))
(if (<= l -1.35e+96)
t_1
(if (<= l -0.48)
t_0
(if (<= l 13000000000000.0)
(+
U
(*
(cos (/ K 2.0))
(+ (* 2.0 (* l J)) (* 0.3333333333333333 (* J (pow l 3.0))))))
(if (<= l 1.9e+97) t_0 t_1))))))
double code(double J, double l, double K, double U) {
double t_0 = U + ((exp(l) - exp(-l)) * J);
double t_1 = (pow(l, 3.0) * (J * 0.3333333333333333)) * cos((K * 0.5));
double tmp;
if (l <= -1.35e+96) {
tmp = t_1;
} else if (l <= -0.48) {
tmp = t_0;
} else if (l <= 13000000000000.0) {
tmp = U + (cos((K / 2.0)) * ((2.0 * (l * J)) + (0.3333333333333333 * (J * pow(l, 3.0)))));
} else if (l <= 1.9e+97) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = u + ((exp(l) - exp(-l)) * j)
t_1 = ((l ** 3.0d0) * (j * 0.3333333333333333d0)) * cos((k * 0.5d0))
if (l <= (-1.35d+96)) then
tmp = t_1
else if (l <= (-0.48d0)) then
tmp = t_0
else if (l <= 13000000000000.0d0) then
tmp = u + (cos((k / 2.0d0)) * ((2.0d0 * (l * j)) + (0.3333333333333333d0 * (j * (l ** 3.0d0)))))
else if (l <= 1.9d+97) then
tmp = t_0
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 = U + ((Math.exp(l) - Math.exp(-l)) * J);
double t_1 = (Math.pow(l, 3.0) * (J * 0.3333333333333333)) * Math.cos((K * 0.5));
double tmp;
if (l <= -1.35e+96) {
tmp = t_1;
} else if (l <= -0.48) {
tmp = t_0;
} else if (l <= 13000000000000.0) {
tmp = U + (Math.cos((K / 2.0)) * ((2.0 * (l * J)) + (0.3333333333333333 * (J * Math.pow(l, 3.0)))));
} else if (l <= 1.9e+97) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(J, l, K, U): t_0 = U + ((math.exp(l) - math.exp(-l)) * J) t_1 = (math.pow(l, 3.0) * (J * 0.3333333333333333)) * math.cos((K * 0.5)) tmp = 0 if l <= -1.35e+96: tmp = t_1 elif l <= -0.48: tmp = t_0 elif l <= 13000000000000.0: tmp = U + (math.cos((K / 2.0)) * ((2.0 * (l * J)) + (0.3333333333333333 * (J * math.pow(l, 3.0))))) elif l <= 1.9e+97: tmp = t_0 else: tmp = t_1 return tmp
function code(J, l, K, U) t_0 = Float64(U + Float64(Float64(exp(l) - exp(Float64(-l))) * J)) t_1 = Float64(Float64((l ^ 3.0) * Float64(J * 0.3333333333333333)) * cos(Float64(K * 0.5))) tmp = 0.0 if (l <= -1.35e+96) tmp = t_1; elseif (l <= -0.48) tmp = t_0; elseif (l <= 13000000000000.0) tmp = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(Float64(2.0 * Float64(l * J)) + Float64(0.3333333333333333 * Float64(J * (l ^ 3.0)))))); elseif (l <= 1.9e+97) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = U + ((exp(l) - exp(-l)) * J); t_1 = ((l ^ 3.0) * (J * 0.3333333333333333)) * cos((K * 0.5)); tmp = 0.0; if (l <= -1.35e+96) tmp = t_1; elseif (l <= -0.48) tmp = t_0; elseif (l <= 13000000000000.0) tmp = U + (cos((K / 2.0)) * ((2.0 * (l * J)) + (0.3333333333333333 * (J * (l ^ 3.0))))); elseif (l <= 1.9e+97) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(U + N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Power[l, 3.0], $MachinePrecision] * N[(J * 0.3333333333333333), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -1.35e+96], t$95$1, If[LessEqual[l, -0.48], t$95$0, If[LessEqual[l, 13000000000000.0], N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(N[(2.0 * N[(l * J), $MachinePrecision]), $MachinePrecision] + N[(0.3333333333333333 * N[(J * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.9e+97], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + \left(e^{\ell} - e^{-\ell}\right) \cdot J\\
t_1 := \left({\ell}^{3} \cdot \left(J \cdot 0.3333333333333333\right)\right) \cdot \cos \left(K \cdot 0.5\right)\\
\mathbf{if}\;\ell \leq -1.35 \cdot 10^{+96}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\ell \leq -0.48:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq 13000000000000:\\
\;\;\;\;U + \cos \left(\frac{K}{2}\right) \cdot \left(2 \cdot \left(\ell \cdot J\right) + 0.3333333333333333 \cdot \left(J \cdot {\ell}^{3}\right)\right)\\
\mathbf{elif}\;\ell \leq 1.9 \cdot 10^{+97}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if l < -1.35000000000000011e96 or 1.90000000000000018e97 < l Initial program 100.0%
Taylor expanded in l around 0 98.9%
fma-def98.9%
+-commutative98.9%
associate-*r*98.9%
associate-*r*98.9%
distribute-rgt-out98.9%
div-inv98.9%
metadata-eval98.9%
Applied egg-rr98.9%
Taylor expanded in l around inf 98.9%
*-commutative98.9%
*-commutative98.9%
associate-*r*98.9%
associate-*r*98.9%
*-commutative98.9%
associate-*r*98.9%
*-commutative98.9%
Simplified98.9%
if -1.35000000000000011e96 < l < -0.47999999999999998 or 1.3e13 < l < 1.90000000000000018e97Initial program 100.0%
Taylor expanded in K around 0 80.0%
if -0.47999999999999998 < l < 1.3e13Initial program 68.9%
Taylor expanded in l around 0 98.5%
Final simplification96.1%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (+ U (* (- (exp l) (exp (- l))) J)))
(t_1 (* (* (pow l 3.0) (* J 0.3333333333333333)) (cos (* K 0.5)))))
(if (<= l -1.35e+96)
t_1
(if (<= l -0.056)
t_0
(if (<= l 13000000000000.0)
(+
U
(*
(cos (/ K 2.0))
(* J (+ (* 0.3333333333333333 (pow l 3.0)) (* l 2.0)))))
(if (<= l 1.9e+97) t_0 t_1))))))
double code(double J, double l, double K, double U) {
double t_0 = U + ((exp(l) - exp(-l)) * J);
double t_1 = (pow(l, 3.0) * (J * 0.3333333333333333)) * cos((K * 0.5));
double tmp;
if (l <= -1.35e+96) {
tmp = t_1;
} else if (l <= -0.056) {
tmp = t_0;
} else if (l <= 13000000000000.0) {
tmp = U + (cos((K / 2.0)) * (J * ((0.3333333333333333 * pow(l, 3.0)) + (l * 2.0))));
} else if (l <= 1.9e+97) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = u + ((exp(l) - exp(-l)) * j)
t_1 = ((l ** 3.0d0) * (j * 0.3333333333333333d0)) * cos((k * 0.5d0))
if (l <= (-1.35d+96)) then
tmp = t_1
else if (l <= (-0.056d0)) then
tmp = t_0
else if (l <= 13000000000000.0d0) then
tmp = u + (cos((k / 2.0d0)) * (j * ((0.3333333333333333d0 * (l ** 3.0d0)) + (l * 2.0d0))))
else if (l <= 1.9d+97) then
tmp = t_0
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 = U + ((Math.exp(l) - Math.exp(-l)) * J);
double t_1 = (Math.pow(l, 3.0) * (J * 0.3333333333333333)) * Math.cos((K * 0.5));
double tmp;
if (l <= -1.35e+96) {
tmp = t_1;
} else if (l <= -0.056) {
tmp = t_0;
} else if (l <= 13000000000000.0) {
tmp = U + (Math.cos((K / 2.0)) * (J * ((0.3333333333333333 * Math.pow(l, 3.0)) + (l * 2.0))));
} else if (l <= 1.9e+97) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(J, l, K, U): t_0 = U + ((math.exp(l) - math.exp(-l)) * J) t_1 = (math.pow(l, 3.0) * (J * 0.3333333333333333)) * math.cos((K * 0.5)) tmp = 0 if l <= -1.35e+96: tmp = t_1 elif l <= -0.056: tmp = t_0 elif l <= 13000000000000.0: tmp = U + (math.cos((K / 2.0)) * (J * ((0.3333333333333333 * math.pow(l, 3.0)) + (l * 2.0)))) elif l <= 1.9e+97: tmp = t_0 else: tmp = t_1 return tmp
function code(J, l, K, U) t_0 = Float64(U + Float64(Float64(exp(l) - exp(Float64(-l))) * J)) t_1 = Float64(Float64((l ^ 3.0) * Float64(J * 0.3333333333333333)) * cos(Float64(K * 0.5))) tmp = 0.0 if (l <= -1.35e+96) tmp = t_1; elseif (l <= -0.056) tmp = t_0; elseif (l <= 13000000000000.0) tmp = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(J * Float64(Float64(0.3333333333333333 * (l ^ 3.0)) + Float64(l * 2.0))))); elseif (l <= 1.9e+97) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = U + ((exp(l) - exp(-l)) * J); t_1 = ((l ^ 3.0) * (J * 0.3333333333333333)) * cos((K * 0.5)); tmp = 0.0; if (l <= -1.35e+96) tmp = t_1; elseif (l <= -0.056) tmp = t_0; elseif (l <= 13000000000000.0) tmp = U + (cos((K / 2.0)) * (J * ((0.3333333333333333 * (l ^ 3.0)) + (l * 2.0)))); elseif (l <= 1.9e+97) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(U + N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Power[l, 3.0], $MachinePrecision] * N[(J * 0.3333333333333333), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -1.35e+96], t$95$1, If[LessEqual[l, -0.056], t$95$0, If[LessEqual[l, 13000000000000.0], N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * 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.9e+97], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + \left(e^{\ell} - e^{-\ell}\right) \cdot J\\
t_1 := \left({\ell}^{3} \cdot \left(J \cdot 0.3333333333333333\right)\right) \cdot \cos \left(K \cdot 0.5\right)\\
\mathbf{if}\;\ell \leq -1.35 \cdot 10^{+96}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\ell \leq -0.056:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq 13000000000000:\\
\;\;\;\;U + \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right)\right)\\
\mathbf{elif}\;\ell \leq 1.9 \cdot 10^{+97}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if l < -1.35000000000000011e96 or 1.90000000000000018e97 < l Initial program 100.0%
Taylor expanded in l around 0 98.9%
fma-def98.9%
+-commutative98.9%
associate-*r*98.9%
associate-*r*98.9%
distribute-rgt-out98.9%
div-inv98.9%
metadata-eval98.9%
Applied egg-rr98.9%
Taylor expanded in l around inf 98.9%
*-commutative98.9%
*-commutative98.9%
associate-*r*98.9%
associate-*r*98.9%
*-commutative98.9%
associate-*r*98.9%
*-commutative98.9%
Simplified98.9%
if -1.35000000000000011e96 < l < -0.0560000000000000012 or 1.3e13 < l < 1.90000000000000018e97Initial program 100.0%
Taylor expanded in K around 0 80.0%
if -0.0560000000000000012 < l < 1.3e13Initial program 68.9%
Taylor expanded in l around 0 98.5%
Final simplification96.1%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (+ U (* (- (exp l) (exp (- l))) J)))
(t_1 (cos (* K 0.5)))
(t_2 (* (* (pow l 3.0) (* J 0.3333333333333333)) t_1)))
(if (<= l -2.6e+94)
t_2
(if (<= l -0.03)
t_0
(if (<= l 13000000000000.0)
(fma (* l (* J 2.0)) t_1 U)
(if (<= l 2.02e+96) t_0 t_2))))))
double code(double J, double l, double K, double U) {
double t_0 = U + ((exp(l) - exp(-l)) * J);
double t_1 = cos((K * 0.5));
double t_2 = (pow(l, 3.0) * (J * 0.3333333333333333)) * t_1;
double tmp;
if (l <= -2.6e+94) {
tmp = t_2;
} else if (l <= -0.03) {
tmp = t_0;
} else if (l <= 13000000000000.0) {
tmp = fma((l * (J * 2.0)), t_1, U);
} else if (l <= 2.02e+96) {
tmp = t_0;
} else {
tmp = t_2;
}
return tmp;
}
function code(J, l, K, U) t_0 = Float64(U + Float64(Float64(exp(l) - exp(Float64(-l))) * J)) t_1 = cos(Float64(K * 0.5)) t_2 = Float64(Float64((l ^ 3.0) * Float64(J * 0.3333333333333333)) * t_1) tmp = 0.0 if (l <= -2.6e+94) tmp = t_2; elseif (l <= -0.03) tmp = t_0; elseif (l <= 13000000000000.0) tmp = fma(Float64(l * Float64(J * 2.0)), t_1, U); elseif (l <= 2.02e+96) tmp = t_0; else tmp = t_2; end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(U + N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[Power[l, 3.0], $MachinePrecision] * N[(J * 0.3333333333333333), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]}, If[LessEqual[l, -2.6e+94], t$95$2, If[LessEqual[l, -0.03], t$95$0, If[LessEqual[l, 13000000000000.0], N[(N[(l * N[(J * 2.0), $MachinePrecision]), $MachinePrecision] * t$95$1 + U), $MachinePrecision], If[LessEqual[l, 2.02e+96], t$95$0, t$95$2]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + \left(e^{\ell} - e^{-\ell}\right) \cdot J\\
t_1 := \cos \left(K \cdot 0.5\right)\\
t_2 := \left({\ell}^{3} \cdot \left(J \cdot 0.3333333333333333\right)\right) \cdot t_1\\
\mathbf{if}\;\ell \leq -2.6 \cdot 10^{+94}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\ell \leq -0.03:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq 13000000000000:\\
\;\;\;\;\mathsf{fma}\left(\ell \cdot \left(J \cdot 2\right), t_1, U\right)\\
\mathbf{elif}\;\ell \leq 2.02 \cdot 10^{+96}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if l < -2.5999999999999999e94 or 2.02000000000000006e96 < l Initial program 100.0%
Taylor expanded in l around 0 98.9%
fma-def98.9%
+-commutative98.9%
associate-*r*98.9%
associate-*r*98.9%
distribute-rgt-out98.9%
div-inv98.9%
metadata-eval98.9%
Applied egg-rr98.9%
Taylor expanded in l around inf 98.9%
*-commutative98.9%
*-commutative98.9%
associate-*r*98.9%
associate-*r*98.9%
*-commutative98.9%
associate-*r*98.9%
*-commutative98.9%
Simplified98.9%
if -2.5999999999999999e94 < l < -0.029999999999999999 or 1.3e13 < l < 2.02000000000000006e96Initial program 100.0%
Taylor expanded in K around 0 80.0%
if -0.029999999999999999 < l < 1.3e13Initial program 68.9%
Taylor expanded in l around 0 98.5%
fma-def98.5%
+-commutative98.5%
associate-*r*98.5%
associate-*r*98.5%
distribute-rgt-out98.5%
div-inv98.5%
metadata-eval98.5%
Applied egg-rr98.5%
Taylor expanded in l around 0 98.3%
*-commutative98.3%
associate-*r*98.3%
*-commutative98.3%
Simplified98.3%
Final simplification96.0%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= t_0 0.86)
(+ U (* t_0 (* l (* J 2.0))))
(+ U (+ (* 2.0 (* l J)) (* 0.3333333333333333 (* J (pow l 3.0))))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double tmp;
if (t_0 <= 0.86) {
tmp = U + (t_0 * (l * (J * 2.0)));
} else {
tmp = U + ((2.0 * (l * J)) + (0.3333333333333333 * (J * pow(l, 3.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 / 2.0d0))
if (t_0 <= 0.86d0) then
tmp = u + (t_0 * (l * (j * 2.0d0)))
else
tmp = u + ((2.0d0 * (l * j)) + (0.3333333333333333d0 * (j * (l ** 3.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 tmp;
if (t_0 <= 0.86) {
tmp = U + (t_0 * (l * (J * 2.0)));
} else {
tmp = U + ((2.0 * (l * J)) + (0.3333333333333333 * (J * Math.pow(l, 3.0))));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K / 2.0)) tmp = 0 if t_0 <= 0.86: tmp = U + (t_0 * (l * (J * 2.0))) else: tmp = U + ((2.0 * (l * J)) + (0.3333333333333333 * (J * math.pow(l, 3.0)))) return tmp
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) tmp = 0.0 if (t_0 <= 0.86) tmp = Float64(U + Float64(t_0 * Float64(l * Float64(J * 2.0)))); else tmp = Float64(U + Float64(Float64(2.0 * Float64(l * J)) + Float64(0.3333333333333333 * Float64(J * (l ^ 3.0))))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = cos((K / 2.0)); tmp = 0.0; if (t_0 <= 0.86) tmp = U + (t_0 * (l * (J * 2.0))); else tmp = U + ((2.0 * (l * J)) + (0.3333333333333333 * (J * (l ^ 3.0)))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, 0.86], N[(U + N[(t$95$0 * N[(l * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(N[(2.0 * N[(l * J), $MachinePrecision]), $MachinePrecision] + N[(0.3333333333333333 * N[(J * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;t_0 \leq 0.86:\\
\;\;\;\;U + t_0 \cdot \left(\ell \cdot \left(J \cdot 2\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + \left(2 \cdot \left(\ell \cdot J\right) + 0.3333333333333333 \cdot \left(J \cdot {\ell}^{3}\right)\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K 2)) < 0.859999999999999987Initial program 82.6%
Taylor expanded in l around 0 68.2%
*-commutative68.2%
associate-*l*68.2%
Simplified68.2%
if 0.859999999999999987 < (cos.f64 (/.f64 K 2)) Initial program 84.7%
Taylor expanded in l around 0 91.0%
Taylor expanded in K around 0 89.9%
Final simplification80.0%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= t_0 0.86)
(+ U (* t_0 (* l (* J 2.0))))
(+ U (* 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 tmp;
if (t_0 <= 0.86) {
tmp = U + (t_0 * (l * (J * 2.0)));
} else {
tmp = U + (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) :: tmp
t_0 = cos((k / 2.0d0))
if (t_0 <= 0.86d0) then
tmp = u + (t_0 * (l * (j * 2.0d0)))
else
tmp = u + (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 tmp;
if (t_0 <= 0.86) {
tmp = U + (t_0 * (l * (J * 2.0)));
} else {
tmp = U + (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)) tmp = 0 if t_0 <= 0.86: tmp = U + (t_0 * (l * (J * 2.0))) else: tmp = U + (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)) tmp = 0.0 if (t_0 <= 0.86) tmp = Float64(U + Float64(t_0 * Float64(l * Float64(J * 2.0)))); else tmp = Float64(U + 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)); tmp = 0.0; if (t_0 <= 0.86) tmp = U + (t_0 * (l * (J * 2.0))); else tmp = U + (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]}, If[LessEqual[t$95$0, 0.86], N[(U + N[(t$95$0 * N[(l * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * N[(N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision] + N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;t_0 \leq 0.86:\\
\;\;\;\;U + t_0 \cdot \left(\ell \cdot \left(J \cdot 2\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + \ell \cdot 2\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K 2)) < 0.859999999999999987Initial program 82.6%
Taylor expanded in l around 0 68.2%
*-commutative68.2%
associate-*l*68.2%
Simplified68.2%
if 0.859999999999999987 < (cos.f64 (/.f64 K 2)) Initial program 84.7%
Taylor expanded in l around 0 91.0%
fma-def91.0%
+-commutative91.0%
associate-*r*91.0%
associate-*r*91.0%
distribute-rgt-out91.0%
div-inv91.0%
metadata-eval91.0%
Applied egg-rr91.0%
Taylor expanded in K around 0 89.9%
Final simplification80.0%
(FPCore (J l K U) :precision binary64 (if (or (<= l -0.03) (not (<= l 13000000000000.0))) (+ U (* (- (exp l) (exp (- l))) J)) (fma (* l (* J 2.0)) (cos (* K 0.5)) U)))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -0.03) || !(l <= 13000000000000.0)) {
tmp = U + ((exp(l) - exp(-l)) * J);
} else {
tmp = fma((l * (J * 2.0)), cos((K * 0.5)), U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if ((l <= -0.03) || !(l <= 13000000000000.0)) tmp = Float64(U + Float64(Float64(exp(l) - exp(Float64(-l))) * J)); else tmp = fma(Float64(l * Float64(J * 2.0)), cos(Float64(K * 0.5)), U); end return tmp end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -0.03], N[Not[LessEqual[l, 13000000000000.0]], $MachinePrecision]], N[(U + N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision]), $MachinePrecision], N[(N[(l * N[(J * 2.0), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -0.03 \lor \neg \left(\ell \leq 13000000000000\right):\\
\;\;\;\;U + \left(e^{\ell} - e^{-\ell}\right) \cdot J\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\ell \cdot \left(J \cdot 2\right), \cos \left(K \cdot 0.5\right), U\right)\\
\end{array}
\end{array}
if l < -0.029999999999999999 or 1.3e13 < l Initial program 100.0%
Taylor expanded in K around 0 74.6%
if -0.029999999999999999 < l < 1.3e13Initial program 68.9%
Taylor expanded in l around 0 98.5%
fma-def98.5%
+-commutative98.5%
associate-*r*98.5%
associate-*r*98.5%
distribute-rgt-out98.5%
div-inv98.5%
metadata-eval98.5%
Applied egg-rr98.5%
Taylor expanded in l around 0 98.3%
*-commutative98.3%
associate-*r*98.3%
*-commutative98.3%
Simplified98.3%
Final simplification87.0%
(FPCore (J l K U) :precision binary64 (if (or (<= l -0.03) (not (<= l 13000000000000.0))) (+ U (* (- (exp l) (exp (- l))) J)) (+ U (* (cos (/ K 2.0)) (* l (* J 2.0))))))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -0.03) || !(l <= 13000000000000.0)) {
tmp = U + ((exp(l) - exp(-l)) * J);
} else {
tmp = U + (cos((K / 2.0)) * (l * (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.03d0)) .or. (.not. (l <= 13000000000000.0d0))) then
tmp = u + ((exp(l) - exp(-l)) * j)
else
tmp = u + (cos((k / 2.0d0)) * (l * (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.03) || !(l <= 13000000000000.0)) {
tmp = U + ((Math.exp(l) - Math.exp(-l)) * J);
} else {
tmp = U + (Math.cos((K / 2.0)) * (l * (J * 2.0)));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -0.03) or not (l <= 13000000000000.0): tmp = U + ((math.exp(l) - math.exp(-l)) * J) else: tmp = U + (math.cos((K / 2.0)) * (l * (J * 2.0))) return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -0.03) || !(l <= 13000000000000.0)) tmp = Float64(U + Float64(Float64(exp(l) - exp(Float64(-l))) * J)); else tmp = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(l * Float64(J * 2.0)))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -0.03) || ~((l <= 13000000000000.0))) tmp = U + ((exp(l) - exp(-l)) * J); else tmp = U + (cos((K / 2.0)) * (l * (J * 2.0))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -0.03], N[Not[LessEqual[l, 13000000000000.0]], $MachinePrecision]], N[(U + N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision]), $MachinePrecision], N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(l * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -0.03 \lor \neg \left(\ell \leq 13000000000000\right):\\
\;\;\;\;U + \left(e^{\ell} - e^{-\ell}\right) \cdot J\\
\mathbf{else}:\\
\;\;\;\;U + \cos \left(\frac{K}{2}\right) \cdot \left(\ell \cdot \left(J \cdot 2\right)\right)\\
\end{array}
\end{array}
if l < -0.029999999999999999 or 1.3e13 < l Initial program 100.0%
Taylor expanded in K around 0 74.6%
if -0.029999999999999999 < l < 1.3e13Initial program 68.9%
Taylor expanded in l around 0 98.3%
*-commutative98.3%
associate-*l*98.3%
Simplified98.3%
Final simplification87.0%
(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 83.7%
Taylor expanded in l around 0 66.3%
*-commutative66.3%
associate-*l*66.3%
*-commutative66.3%
Simplified66.3%
Final simplification66.3%
(FPCore (J l K U) :precision binary64 (+ U (* (cos (/ K 2.0)) (* l (* J 2.0)))))
double code(double J, double l, double K, double U) {
return U + (cos((K / 2.0)) * (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 + (cos((k / 2.0d0)) * (l * (j * 2.0d0)))
end function
public static double code(double J, double l, double K, double U) {
return U + (Math.cos((K / 2.0)) * (l * (J * 2.0)));
}
def code(J, l, K, U): return U + (math.cos((K / 2.0)) * (l * (J * 2.0)))
function code(J, l, K, U) return Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(l * Float64(J * 2.0)))) end
function tmp = code(J, l, K, U) tmp = U + (cos((K / 2.0)) * (l * (J * 2.0))); end
code[J_, l_, K_, U_] := N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(l * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + \cos \left(\frac{K}{2}\right) \cdot \left(\ell \cdot \left(J \cdot 2\right)\right)
\end{array}
Initial program 83.7%
Taylor expanded in l around 0 66.3%
*-commutative66.3%
associate-*l*66.3%
Simplified66.3%
Final simplification66.3%
(FPCore (J l K U) :precision binary64 (if (<= l -700.0) (pow U -8.0) (if (<= l 1.3e-5) U (pow U -8.0))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -700.0) {
tmp = pow(U, -8.0);
} else if (l <= 1.3e-5) {
tmp = U;
} else {
tmp = pow(U, -8.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 <= (-700.0d0)) then
tmp = u ** (-8.0d0)
else if (l <= 1.3d-5) then
tmp = u
else
tmp = u ** (-8.0d0)
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (l <= -700.0) {
tmp = Math.pow(U, -8.0);
} else if (l <= 1.3e-5) {
tmp = U;
} else {
tmp = Math.pow(U, -8.0);
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -700.0: tmp = math.pow(U, -8.0) elif l <= 1.3e-5: tmp = U else: tmp = math.pow(U, -8.0) return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -700.0) tmp = U ^ -8.0; elseif (l <= 1.3e-5) tmp = U; else tmp = U ^ -8.0; end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -700.0) tmp = U ^ -8.0; elseif (l <= 1.3e-5) tmp = U; else tmp = U ^ -8.0; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -700.0], N[Power[U, -8.0], $MachinePrecision], If[LessEqual[l, 1.3e-5], U, N[Power[U, -8.0], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -700:\\
\;\;\;\;{U}^{-8}\\
\mathbf{elif}\;\ell \leq 1.3 \cdot 10^{-5}:\\
\;\;\;\;U\\
\mathbf{else}:\\
\;\;\;\;{U}^{-8}\\
\end{array}
\end{array}
if l < -700 or 1.29999999999999992e-5 < l Initial program 99.9%
Applied egg-rr25.1%
if -700 < l < 1.29999999999999992e-5Initial program 68.3%
Taylor expanded in J around 0 67.5%
Final simplification46.8%
(FPCore (J l K U) :precision binary64 (if (<= l -4.2e+18) (* U U) (if (<= l 1.3e-5) U (- (/ 0.109375 (* U U)) (/ 0.125 U)))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -4.2e+18) {
tmp = U * U;
} else if (l <= 1.3e-5) {
tmp = U;
} else {
tmp = (0.109375 / (U * U)) - (0.125 / 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.2d+18)) then
tmp = u * u
else if (l <= 1.3d-5) then
tmp = u
else
tmp = (0.109375d0 / (u * u)) - (0.125d0 / u)
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (l <= -4.2e+18) {
tmp = U * U;
} else if (l <= 1.3e-5) {
tmp = U;
} else {
tmp = (0.109375 / (U * U)) - (0.125 / U);
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -4.2e+18: tmp = U * U elif l <= 1.3e-5: tmp = U else: tmp = (0.109375 / (U * U)) - (0.125 / U) return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -4.2e+18) tmp = Float64(U * U); elseif (l <= 1.3e-5) tmp = U; else tmp = Float64(Float64(0.109375 / Float64(U * U)) - Float64(0.125 / U)); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -4.2e+18) tmp = U * U; elseif (l <= 1.3e-5) tmp = U; else tmp = (0.109375 / (U * U)) - (0.125 / U); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -4.2e+18], N[(U * U), $MachinePrecision], If[LessEqual[l, 1.3e-5], U, N[(N[(0.109375 / N[(U * U), $MachinePrecision]), $MachinePrecision] - N[(0.125 / U), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -4.2 \cdot 10^{+18}:\\
\;\;\;\;U \cdot U\\
\mathbf{elif}\;\ell \leq 1.3 \cdot 10^{-5}:\\
\;\;\;\;U\\
\mathbf{else}:\\
\;\;\;\;\frac{0.109375}{U \cdot U} - \frac{0.125}{U}\\
\end{array}
\end{array}
if l < -4.2e18Initial program 100.0%
Applied egg-rr14.8%
if -4.2e18 < l < 1.29999999999999992e-5Initial program 69.3%
Taylor expanded in J around 0 65.6%
if 1.29999999999999992e-5 < l Initial program 99.7%
Applied egg-rr1.4%
associate-+r+1.4%
distribute-rgt1-in1.4%
*-commutative1.4%
distribute-rgt-out1.4%
associate-/r*1.4%
*-inverses1.4%
+-commutative1.4%
*-commutative1.4%
metadata-eval1.4%
Simplified1.4%
Taylor expanded in U around inf 23.1%
unpow223.1%
associate-*r/23.1%
metadata-eval23.1%
associate-*r/23.1%
metadata-eval23.1%
Simplified23.1%
Final simplification43.5%
(FPCore (J l K U) :precision binary64 (if (<= l -5.4e+18) (* U U) (if (<= l 2.45e+51) U (* U (- 2.0 U)))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -5.4e+18) {
tmp = U * U;
} else if (l <= 2.45e+51) {
tmp = U;
} else {
tmp = U * (2.0 - 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.4d+18)) then
tmp = u * u
else if (l <= 2.45d+51) then
tmp = u
else
tmp = u * (2.0d0 - u)
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (l <= -5.4e+18) {
tmp = U * U;
} else if (l <= 2.45e+51) {
tmp = U;
} else {
tmp = U * (2.0 - U);
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -5.4e+18: tmp = U * U elif l <= 2.45e+51: tmp = U else: tmp = U * (2.0 - U) return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -5.4e+18) tmp = Float64(U * U); elseif (l <= 2.45e+51) tmp = U; else tmp = Float64(U * Float64(2.0 - U)); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -5.4e+18) tmp = U * U; elseif (l <= 2.45e+51) tmp = U; else tmp = U * (2.0 - U); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -5.4e+18], N[(U * U), $MachinePrecision], If[LessEqual[l, 2.45e+51], U, N[(U * N[(2.0 - U), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -5.4 \cdot 10^{+18}:\\
\;\;\;\;U \cdot U\\
\mathbf{elif}\;\ell \leq 2.45 \cdot 10^{+51}:\\
\;\;\;\;U\\
\mathbf{else}:\\
\;\;\;\;U \cdot \left(2 - U\right)\\
\end{array}
\end{array}
if l < -5.4e18Initial program 100.0%
Applied egg-rr14.8%
if -5.4e18 < l < 2.44999999999999992e51Initial program 71.3%
Taylor expanded in J around 0 61.2%
if 2.44999999999999992e51 < l Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
fma-def100.0%
Simplified100.0%
Applied egg-rr19.5%
fma-udef19.5%
+-commutative19.5%
associate-+r+19.5%
count-219.5%
distribute-rgt-out19.5%
unsub-neg19.5%
Simplified19.5%
Final simplification42.0%
(FPCore (J l K U) :precision binary64 (if (<= l -7.5e+16) (* U U) U))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -7.5e+16) {
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 <= (-7.5d+16)) 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 <= -7.5e+16) {
tmp = U * U;
} else {
tmp = U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -7.5e+16: tmp = U * U else: tmp = U return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -7.5e+16) tmp = Float64(U * U); else tmp = U; end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -7.5e+16) tmp = U * U; else tmp = U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -7.5e+16], N[(U * U), $MachinePrecision], U]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -7.5 \cdot 10^{+16}:\\
\;\;\;\;U \cdot U\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\end{array}
if l < -7.5e16Initial program 100.0%
Applied egg-rr14.8%
if -7.5e16 < l Initial program 78.7%
Taylor expanded in J around 0 46.3%
Final simplification38.8%
(FPCore (J l K U) :precision binary64 -0.14285714285714285)
double code(double J, double l, double K, double U) {
return -0.14285714285714285;
}
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 = -0.14285714285714285d0
end function
public static double code(double J, double l, double K, double U) {
return -0.14285714285714285;
}
def code(J, l, K, U): return -0.14285714285714285
function code(J, l, K, U) return -0.14285714285714285 end
function tmp = code(J, l, K, U) tmp = -0.14285714285714285; end
code[J_, l_, K_, U_] := -0.14285714285714285
\begin{array}{l}
\\
-0.14285714285714285
\end{array}
Initial program 83.7%
Applied egg-rr2.2%
associate-+r+2.2%
distribute-rgt1-in2.2%
*-commutative2.2%
distribute-rgt-out2.2%
associate-/r*2.2%
*-inverses2.2%
+-commutative2.2%
*-commutative2.2%
metadata-eval2.2%
Simplified2.2%
Taylor expanded in U around 0 2.5%
Final simplification2.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.7%
Applied egg-rr3.1%
*-inverses3.1%
Simplified3.1%
Final simplification3.1%
(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.7%
Taylor expanded in J around 0 35.7%
Final simplification35.7%
herbie shell --seed 2023195
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))