
(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 (- INFINITY)) (not (<= t_0 0.0)))
(+ (* (cos (/ K 2.0)) (* t_0 J)) U)
(+
U
(*
J
(* (cos (* K 0.5)) (fma 0.3333333333333333 (pow l 3.0) (* 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 <= -((double) INFINITY)) || !(t_0 <= 0.0)) {
tmp = (cos((K / 2.0)) * (t_0 * J)) + U;
} else {
tmp = U + (J * (cos((K * 0.5)) * fma(0.3333333333333333, pow(l, 3.0), (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 <= Float64(-Inf)) || !(t_0 <= 0.0)) tmp = Float64(Float64(cos(Float64(K / 2.0)) * Float64(t_0 * J)) + U); else tmp = Float64(U + Float64(J * Float64(cos(Float64(K * 0.5)) * fma(0.3333333333333333, (l ^ 3.0), Float64(l * 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, (-Infinity)], N[Not[LessEqual[t$95$0, 0.0]], $MachinePrecision]], N[(N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(t$95$0 * J), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], N[(U + N[(J * N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision] + N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{\ell} - e^{-\ell}\\
\mathbf{if}\;t_0 \leq -\infty \lor \neg \left(t_0 \leq 0\right):\\
\;\;\;\;\cos \left(\frac{K}{2}\right) \cdot \left(t_0 \cdot J\right) + U\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(\cos \left(K \cdot 0.5\right) \cdot \mathsf{fma}\left(0.3333333333333333, {\ell}^{3}, \ell \cdot 2\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 69.7%
Taylor expanded in l around 0 99.8%
associate-*r*99.9%
associate-*r*99.9%
associate-*r*99.9%
associate-*r*99.9%
distribute-rgt-out99.9%
*-commutative99.9%
associate-*r*99.9%
*-commutative99.9%
associate-*r*99.9%
distribute-rgt-out99.9%
+-commutative99.9%
fma-def99.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_0 (* t_1 J)) U)
(+ U (* t_0 (* J (+ (* l 2.0) (* 0.3333333333333333 (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 <= 0.0)) {
tmp = (t_0 * (t_1 * J)) + U;
} else {
tmp = U + (t_0 * (J * ((l * 2.0) + (0.3333333333333333 * 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 <= 0.0)) {
tmp = (t_0 * (t_1 * J)) + U;
} else {
tmp = U + (t_0 * (J * ((l * 2.0) + (0.3333333333333333 * 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 <= 0.0): tmp = (t_0 * (t_1 * J)) + U else: tmp = U + (t_0 * (J * ((l * 2.0) + (0.3333333333333333 * 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 <= 0.0)) tmp = Float64(Float64(t_0 * Float64(t_1 * J)) + U); else tmp = Float64(U + Float64(t_0 * Float64(J * Float64(Float64(l * 2.0) + Float64(0.3333333333333333 * (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 <= 0.0))) tmp = (t_0 * (t_1 * J)) + U; else tmp = U + (t_0 * (J * ((l * 2.0) + (0.3333333333333333 * (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, 0.0]], $MachinePrecision]], N[(N[(t$95$0 * N[(t$95$1 * J), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], N[(U + N[(t$95$0 * N[(J * N[(N[(l * 2.0), $MachinePrecision] + N[(0.3333333333333333 * 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 0\right):\\
\;\;\;\;t_0 \cdot \left(t_1 \cdot J\right) + U\\
\mathbf{else}:\\
\;\;\;\;U + t_0 \cdot \left(J \cdot \left(\ell \cdot 2 + 0.3333333333333333 \cdot {\ell}^{3}\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 69.7%
Taylor expanded in l around 0 99.8%
Final simplification99.9%
(FPCore (J l K U)
:precision binary64
(if (or (<= l -5.8e+102)
(and (not (<= l -960000000000.0))
(or (<= l 6.2e-22) (not (<= l 1.18e+91)))))
(+
U
(* (cos (/ K 2.0)) (* J (+ (* l 2.0) (* 0.3333333333333333 (pow l 3.0))))))
(+ U (* (- (exp l) (exp (- l))) J))))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -5.8e+102) || (!(l <= -960000000000.0) && ((l <= 6.2e-22) || !(l <= 1.18e+91)))) {
tmp = U + (cos((K / 2.0)) * (J * ((l * 2.0) + (0.3333333333333333 * pow(l, 3.0)))));
} else {
tmp = U + ((exp(l) - exp(-l)) * 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 <= (-5.8d+102)) .or. (.not. (l <= (-960000000000.0d0))) .and. (l <= 6.2d-22) .or. (.not. (l <= 1.18d+91))) then
tmp = u + (cos((k / 2.0d0)) * (j * ((l * 2.0d0) + (0.3333333333333333d0 * (l ** 3.0d0)))))
else
tmp = u + ((exp(l) - exp(-l)) * j)
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -5.8e+102) || (!(l <= -960000000000.0) && ((l <= 6.2e-22) || !(l <= 1.18e+91)))) {
tmp = U + (Math.cos((K / 2.0)) * (J * ((l * 2.0) + (0.3333333333333333 * Math.pow(l, 3.0)))));
} else {
tmp = U + ((Math.exp(l) - Math.exp(-l)) * J);
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -5.8e+102) or (not (l <= -960000000000.0) and ((l <= 6.2e-22) or not (l <= 1.18e+91))): tmp = U + (math.cos((K / 2.0)) * (J * ((l * 2.0) + (0.3333333333333333 * math.pow(l, 3.0))))) else: tmp = U + ((math.exp(l) - math.exp(-l)) * J) return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -5.8e+102) || (!(l <= -960000000000.0) && ((l <= 6.2e-22) || !(l <= 1.18e+91)))) tmp = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(J * Float64(Float64(l * 2.0) + Float64(0.3333333333333333 * (l ^ 3.0)))))); else tmp = Float64(U + Float64(Float64(exp(l) - exp(Float64(-l))) * J)); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -5.8e+102) || (~((l <= -960000000000.0)) && ((l <= 6.2e-22) || ~((l <= 1.18e+91))))) tmp = U + (cos((K / 2.0)) * (J * ((l * 2.0) + (0.3333333333333333 * (l ^ 3.0))))); else tmp = U + ((exp(l) - exp(-l)) * J); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -5.8e+102], And[N[Not[LessEqual[l, -960000000000.0]], $MachinePrecision], Or[LessEqual[l, 6.2e-22], N[Not[LessEqual[l, 1.18e+91]], $MachinePrecision]]]], N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(J * N[(N[(l * 2.0), $MachinePrecision] + N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -5.8 \cdot 10^{+102} \lor \neg \left(\ell \leq -960000000000\right) \land \left(\ell \leq 6.2 \cdot 10^{-22} \lor \neg \left(\ell \leq 1.18 \cdot 10^{+91}\right)\right):\\
\;\;\;\;U + \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(\ell \cdot 2 + 0.3333333333333333 \cdot {\ell}^{3}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + \left(e^{\ell} - e^{-\ell}\right) \cdot J\\
\end{array}
\end{array}
if l < -5.8000000000000005e102 or -9.6e11 < l < 6.20000000000000025e-22 or 1.18000000000000008e91 < l Initial program 80.7%
Taylor expanded in l around 0 99.0%
if -5.8000000000000005e102 < l < -9.6e11 or 6.20000000000000025e-22 < l < 1.18000000000000008e91Initial program 100.0%
Taylor expanded in K around 0 79.5%
Final simplification95.7%
(FPCore (J l K U)
:precision binary64
(let* ((t_0
(+
U
(*
(cos (/ K 2.0))
(* J (+ (* l 2.0) (* 0.3333333333333333 (pow l 3.0)))))))
(t_1 (* (- (exp l) (exp (- l))) J)))
(if (<= l -5.2e+102)
t_0
(if (<= l -960000000000.0)
(+ U t_1)
(if (or (<= l 6.2e-22) (not (<= l 1.7e+100)))
t_0
(+ U (* t_1 (+ (* -0.125 (* K K)) 1.0))))))))
double code(double J, double l, double K, double U) {
double t_0 = U + (cos((K / 2.0)) * (J * ((l * 2.0) + (0.3333333333333333 * pow(l, 3.0)))));
double t_1 = (exp(l) - exp(-l)) * J;
double tmp;
if (l <= -5.2e+102) {
tmp = t_0;
} else if (l <= -960000000000.0) {
tmp = U + t_1;
} else if ((l <= 6.2e-22) || !(l <= 1.7e+100)) {
tmp = t_0;
} else {
tmp = U + (t_1 * ((-0.125 * (K * K)) + 1.0));
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = u + (cos((k / 2.0d0)) * (j * ((l * 2.0d0) + (0.3333333333333333d0 * (l ** 3.0d0)))))
t_1 = (exp(l) - exp(-l)) * j
if (l <= (-5.2d+102)) then
tmp = t_0
else if (l <= (-960000000000.0d0)) then
tmp = u + t_1
else if ((l <= 6.2d-22) .or. (.not. (l <= 1.7d+100))) then
tmp = t_0
else
tmp = u + (t_1 * (((-0.125d0) * (k * k)) + 1.0d0))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = U + (Math.cos((K / 2.0)) * (J * ((l * 2.0) + (0.3333333333333333 * Math.pow(l, 3.0)))));
double t_1 = (Math.exp(l) - Math.exp(-l)) * J;
double tmp;
if (l <= -5.2e+102) {
tmp = t_0;
} else if (l <= -960000000000.0) {
tmp = U + t_1;
} else if ((l <= 6.2e-22) || !(l <= 1.7e+100)) {
tmp = t_0;
} else {
tmp = U + (t_1 * ((-0.125 * (K * K)) + 1.0));
}
return tmp;
}
def code(J, l, K, U): t_0 = U + (math.cos((K / 2.0)) * (J * ((l * 2.0) + (0.3333333333333333 * math.pow(l, 3.0))))) t_1 = (math.exp(l) - math.exp(-l)) * J tmp = 0 if l <= -5.2e+102: tmp = t_0 elif l <= -960000000000.0: tmp = U + t_1 elif (l <= 6.2e-22) or not (l <= 1.7e+100): tmp = t_0 else: tmp = U + (t_1 * ((-0.125 * (K * K)) + 1.0)) return tmp
function code(J, l, K, U) t_0 = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(J * Float64(Float64(l * 2.0) + Float64(0.3333333333333333 * (l ^ 3.0)))))) t_1 = Float64(Float64(exp(l) - exp(Float64(-l))) * J) tmp = 0.0 if (l <= -5.2e+102) tmp = t_0; elseif (l <= -960000000000.0) tmp = Float64(U + t_1); elseif ((l <= 6.2e-22) || !(l <= 1.7e+100)) tmp = t_0; else tmp = Float64(U + Float64(t_1 * Float64(Float64(-0.125 * Float64(K * K)) + 1.0))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = U + (cos((K / 2.0)) * (J * ((l * 2.0) + (0.3333333333333333 * (l ^ 3.0))))); t_1 = (exp(l) - exp(-l)) * J; tmp = 0.0; if (l <= -5.2e+102) tmp = t_0; elseif (l <= -960000000000.0) tmp = U + t_1; elseif ((l <= 6.2e-22) || ~((l <= 1.7e+100))) tmp = t_0; else tmp = U + (t_1 * ((-0.125 * (K * K)) + 1.0)); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(J * N[(N[(l * 2.0), $MachinePrecision] + N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision]}, If[LessEqual[l, -5.2e+102], t$95$0, If[LessEqual[l, -960000000000.0], N[(U + t$95$1), $MachinePrecision], If[Or[LessEqual[l, 6.2e-22], N[Not[LessEqual[l, 1.7e+100]], $MachinePrecision]], t$95$0, N[(U + N[(t$95$1 * N[(N[(-0.125 * N[(K * K), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(\ell \cdot 2 + 0.3333333333333333 \cdot {\ell}^{3}\right)\right)\\
t_1 := \left(e^{\ell} - e^{-\ell}\right) \cdot J\\
\mathbf{if}\;\ell \leq -5.2 \cdot 10^{+102}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq -960000000000:\\
\;\;\;\;U + t_1\\
\mathbf{elif}\;\ell \leq 6.2 \cdot 10^{-22} \lor \neg \left(\ell \leq 1.7 \cdot 10^{+100}\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;U + t_1 \cdot \left(-0.125 \cdot \left(K \cdot K\right) + 1\right)\\
\end{array}
\end{array}
if l < -5.20000000000000013e102 or -9.6e11 < l < 6.20000000000000025e-22 or 1.69999999999999997e100 < l Initial program 80.6%
Taylor expanded in l around 0 99.5%
if -5.20000000000000013e102 < l < -9.6e11Initial program 100.0%
Taylor expanded in K around 0 80.0%
if 6.20000000000000025e-22 < l < 1.69999999999999997e100Initial program 100.0%
Taylor expanded in K around 0 12.0%
associate-*r*12.0%
distribute-rgt1-in84.0%
unpow284.0%
Simplified84.0%
Final simplification96.4%
(FPCore (J l K U) :precision binary64 (if (or (<= l -105000000000.0) (not (<= l 6.2e-22))) (+ U (* (- (exp l) (exp (- l))) J)) (fma (* (cos (* K 0.5)) (* J 2.0)) l U)))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -105000000000.0) || !(l <= 6.2e-22)) {
tmp = U + ((exp(l) - exp(-l)) * J);
} else {
tmp = fma((cos((K * 0.5)) * (J * 2.0)), l, U);
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if ((l <= -105000000000.0) || !(l <= 6.2e-22)) tmp = Float64(U + Float64(Float64(exp(l) - exp(Float64(-l))) * J)); else tmp = fma(Float64(cos(Float64(K * 0.5)) * Float64(J * 2.0)), l, U); end return tmp end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -105000000000.0], N[Not[LessEqual[l, 6.2e-22]], $MachinePrecision]], N[(U + N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision]), $MachinePrecision], N[(N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * N[(J * 2.0), $MachinePrecision]), $MachinePrecision] * l + U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -105000000000 \lor \neg \left(\ell \leq 6.2 \cdot 10^{-22}\right):\\
\;\;\;\;U + \left(e^{\ell} - e^{-\ell}\right) \cdot J\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\cos \left(K \cdot 0.5\right) \cdot \left(J \cdot 2\right), \ell, U\right)\\
\end{array}
\end{array}
if l < -1.05e11 or 6.20000000000000025e-22 < l Initial program 100.0%
Taylor expanded in K around 0 76.9%
if -1.05e11 < l < 6.20000000000000025e-22Initial program 69.7%
Taylor expanded in l around 0 99.0%
*-commutative99.0%
associate-*r*99.0%
associate-*r*99.1%
fma-def99.1%
div-inv99.1%
metadata-eval99.1%
*-commutative99.1%
Applied egg-rr99.1%
Final simplification88.6%
(FPCore (J l K U) :precision binary64 (if (or (<= l -105000000000.0) (not (<= l 6.2e-22))) (+ U (* (- (exp l) (exp (- l))) J)) (+ U (* J (* (cos (* K 0.5)) (* l 2.0))))))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -105000000000.0) || !(l <= 6.2e-22)) {
tmp = U + ((exp(l) - exp(-l)) * J);
} else {
tmp = U + (J * (cos((K * 0.5)) * (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 ((l <= (-105000000000.0d0)) .or. (.not. (l <= 6.2d-22))) then
tmp = u + ((exp(l) - exp(-l)) * j)
else
tmp = u + (j * (cos((k * 0.5d0)) * (l * 2.0d0)))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -105000000000.0) || !(l <= 6.2e-22)) {
tmp = U + ((Math.exp(l) - Math.exp(-l)) * J);
} else {
tmp = U + (J * (Math.cos((K * 0.5)) * (l * 2.0)));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -105000000000.0) or not (l <= 6.2e-22): tmp = U + ((math.exp(l) - math.exp(-l)) * J) else: tmp = U + (J * (math.cos((K * 0.5)) * (l * 2.0))) return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -105000000000.0) || !(l <= 6.2e-22)) tmp = Float64(U + Float64(Float64(exp(l) - exp(Float64(-l))) * J)); else tmp = Float64(U + Float64(J * Float64(cos(Float64(K * 0.5)) * Float64(l * 2.0)))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -105000000000.0) || ~((l <= 6.2e-22))) tmp = U + ((exp(l) - exp(-l)) * J); else tmp = U + (J * (cos((K * 0.5)) * (l * 2.0))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -105000000000.0], N[Not[LessEqual[l, 6.2e-22]], $MachinePrecision]], N[(U + N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -105000000000 \lor \neg \left(\ell \leq 6.2 \cdot 10^{-22}\right):\\
\;\;\;\;U + \left(e^{\ell} - e^{-\ell}\right) \cdot J\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left(\cos \left(K \cdot 0.5\right) \cdot \left(\ell \cdot 2\right)\right)\\
\end{array}
\end{array}
if l < -1.05e11 or 6.20000000000000025e-22 < l Initial program 100.0%
Taylor expanded in K around 0 76.9%
if -1.05e11 < l < 6.20000000000000025e-22Initial program 69.7%
Taylor expanded in l around 0 99.1%
associate-*r*99.2%
associate-*r*99.2%
associate-*r*99.2%
associate-*r*99.2%
distribute-rgt-out99.2%
*-commutative99.2%
associate-*r*99.2%
*-commutative99.2%
associate-*r*99.2%
distribute-rgt-out99.2%
+-commutative99.2%
fma-def99.2%
Simplified99.2%
Taylor expanded in l around 0 99.1%
*-commutative99.1%
associate-*r*99.1%
Simplified99.1%
Final simplification88.6%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (+ U (* 0.3333333333333333 (* J (pow l 3.0))))))
(if (<= l -320000000000.0)
t_0
(if (<= l 6500.0)
(+ U (* J (* (cos (* K 0.5)) (* l 2.0))))
(if (<= l 2.15e+88) (pow U -8.0) t_0)))))
double code(double J, double l, double K, double U) {
double t_0 = U + (0.3333333333333333 * (J * pow(l, 3.0)));
double tmp;
if (l <= -320000000000.0) {
tmp = t_0;
} else if (l <= 6500.0) {
tmp = U + (J * (cos((K * 0.5)) * (l * 2.0)));
} else if (l <= 2.15e+88) {
tmp = pow(U, -8.0);
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: t_0
real(8) :: tmp
t_0 = u + (0.3333333333333333d0 * (j * (l ** 3.0d0)))
if (l <= (-320000000000.0d0)) then
tmp = t_0
else if (l <= 6500.0d0) then
tmp = u + (j * (cos((k * 0.5d0)) * (l * 2.0d0)))
else if (l <= 2.15d+88) then
tmp = u ** (-8.0d0)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = U + (0.3333333333333333 * (J * Math.pow(l, 3.0)));
double tmp;
if (l <= -320000000000.0) {
tmp = t_0;
} else if (l <= 6500.0) {
tmp = U + (J * (Math.cos((K * 0.5)) * (l * 2.0)));
} else if (l <= 2.15e+88) {
tmp = Math.pow(U, -8.0);
} else {
tmp = t_0;
}
return tmp;
}
def code(J, l, K, U): t_0 = U + (0.3333333333333333 * (J * math.pow(l, 3.0))) tmp = 0 if l <= -320000000000.0: tmp = t_0 elif l <= 6500.0: tmp = U + (J * (math.cos((K * 0.5)) * (l * 2.0))) elif l <= 2.15e+88: tmp = math.pow(U, -8.0) else: tmp = t_0 return tmp
function code(J, l, K, U) t_0 = Float64(U + Float64(0.3333333333333333 * Float64(J * (l ^ 3.0)))) tmp = 0.0 if (l <= -320000000000.0) tmp = t_0; elseif (l <= 6500.0) tmp = Float64(U + Float64(J * Float64(cos(Float64(K * 0.5)) * Float64(l * 2.0)))); elseif (l <= 2.15e+88) tmp = U ^ -8.0; else tmp = t_0; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = U + (0.3333333333333333 * (J * (l ^ 3.0))); tmp = 0.0; if (l <= -320000000000.0) tmp = t_0; elseif (l <= 6500.0) tmp = U + (J * (cos((K * 0.5)) * (l * 2.0))); elseif (l <= 2.15e+88) tmp = U ^ -8.0; else tmp = t_0; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(U + N[(0.3333333333333333 * N[(J * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -320000000000.0], t$95$0, If[LessEqual[l, 6500.0], N[(U + N[(J * N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.15e+88], N[Power[U, -8.0], $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + 0.3333333333333333 \cdot \left(J \cdot {\ell}^{3}\right)\\
\mathbf{if}\;\ell \leq -320000000000:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq 6500:\\
\;\;\;\;U + J \cdot \left(\cos \left(K \cdot 0.5\right) \cdot \left(\ell \cdot 2\right)\right)\\
\mathbf{elif}\;\ell \leq 2.15 \cdot 10^{+88}:\\
\;\;\;\;{U}^{-8}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if l < -3.2e11 or 2.14999999999999987e88 < l Initial program 100.0%
Taylor expanded in l around 0 86.2%
associate-*r*86.2%
associate-*r*86.2%
associate-*r*86.2%
associate-*r*86.2%
distribute-rgt-out86.2%
*-commutative86.2%
associate-*r*86.2%
*-commutative86.2%
associate-*r*86.2%
distribute-rgt-out86.2%
+-commutative86.2%
fma-def86.2%
Simplified86.2%
Taylor expanded in K around 0 67.5%
Taylor expanded in l around inf 67.5%
if -3.2e11 < l < 6500Initial program 70.5%
Taylor expanded in l around 0 97.8%
associate-*r*97.9%
associate-*r*97.9%
associate-*r*97.9%
associate-*r*97.9%
distribute-rgt-out97.9%
*-commutative97.9%
associate-*r*97.9%
*-commutative97.9%
associate-*r*97.9%
distribute-rgt-out97.9%
+-commutative97.9%
fma-def97.9%
Simplified97.9%
Taylor expanded in l around 0 97.8%
*-commutative97.8%
associate-*r*97.8%
Simplified97.8%
if 6500 < l < 2.14999999999999987e88Initial program 100.0%
Applied egg-rr35.6%
Final simplification81.5%
(FPCore (J l K U)
:precision binary64
(if (<= l -1.9e-6)
(+ U (* J (+ (* l 2.0) (* 0.3333333333333333 (pow l 3.0)))))
(if (<= l 6500.0)
(+ U (* J (* (cos (* K 0.5)) (* l 2.0))))
(if (<= l 1.38e+88)
(pow U -8.0)
(+ U (* 0.3333333333333333 (* J (pow l 3.0))))))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -1.9e-6) {
tmp = U + (J * ((l * 2.0) + (0.3333333333333333 * pow(l, 3.0))));
} else if (l <= 6500.0) {
tmp = U + (J * (cos((K * 0.5)) * (l * 2.0)));
} else if (l <= 1.38e+88) {
tmp = pow(U, -8.0);
} else {
tmp = U + (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) :: tmp
if (l <= (-1.9d-6)) then
tmp = u + (j * ((l * 2.0d0) + (0.3333333333333333d0 * (l ** 3.0d0))))
else if (l <= 6500.0d0) then
tmp = u + (j * (cos((k * 0.5d0)) * (l * 2.0d0)))
else if (l <= 1.38d+88) then
tmp = u ** (-8.0d0)
else
tmp = u + (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 tmp;
if (l <= -1.9e-6) {
tmp = U + (J * ((l * 2.0) + (0.3333333333333333 * Math.pow(l, 3.0))));
} else if (l <= 6500.0) {
tmp = U + (J * (Math.cos((K * 0.5)) * (l * 2.0)));
} else if (l <= 1.38e+88) {
tmp = Math.pow(U, -8.0);
} else {
tmp = U + (0.3333333333333333 * (J * Math.pow(l, 3.0)));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -1.9e-6: tmp = U + (J * ((l * 2.0) + (0.3333333333333333 * math.pow(l, 3.0)))) elif l <= 6500.0: tmp = U + (J * (math.cos((K * 0.5)) * (l * 2.0))) elif l <= 1.38e+88: tmp = math.pow(U, -8.0) else: tmp = U + (0.3333333333333333 * (J * math.pow(l, 3.0))) return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -1.9e-6) tmp = Float64(U + Float64(J * Float64(Float64(l * 2.0) + Float64(0.3333333333333333 * (l ^ 3.0))))); elseif (l <= 6500.0) tmp = Float64(U + Float64(J * Float64(cos(Float64(K * 0.5)) * Float64(l * 2.0)))); elseif (l <= 1.38e+88) tmp = U ^ -8.0; else tmp = Float64(U + Float64(0.3333333333333333 * Float64(J * (l ^ 3.0)))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -1.9e-6) tmp = U + (J * ((l * 2.0) + (0.3333333333333333 * (l ^ 3.0)))); elseif (l <= 6500.0) tmp = U + (J * (cos((K * 0.5)) * (l * 2.0))); elseif (l <= 1.38e+88) tmp = U ^ -8.0; else tmp = U + (0.3333333333333333 * (J * (l ^ 3.0))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -1.9e-6], N[(U + N[(J * N[(N[(l * 2.0), $MachinePrecision] + N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 6500.0], N[(U + N[(J * N[(N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision] * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.38e+88], N[Power[U, -8.0], $MachinePrecision], N[(U + N[(0.3333333333333333 * N[(J * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.9 \cdot 10^{-6}:\\
\;\;\;\;U + J \cdot \left(\ell \cdot 2 + 0.3333333333333333 \cdot {\ell}^{3}\right)\\
\mathbf{elif}\;\ell \leq 6500:\\
\;\;\;\;U + J \cdot \left(\cos \left(K \cdot 0.5\right) \cdot \left(\ell \cdot 2\right)\right)\\
\mathbf{elif}\;\ell \leq 1.38 \cdot 10^{+88}:\\
\;\;\;\;{U}^{-8}\\
\mathbf{else}:\\
\;\;\;\;U + 0.3333333333333333 \cdot \left(J \cdot {\ell}^{3}\right)\\
\end{array}
\end{array}
if l < -1.9e-6Initial program 99.5%
Taylor expanded in l around 0 77.0%
associate-*r*77.0%
associate-*r*77.0%
associate-*r*77.0%
associate-*r*77.0%
distribute-rgt-out77.0%
*-commutative77.0%
associate-*r*77.0%
*-commutative77.0%
associate-*r*77.0%
distribute-rgt-out77.0%
+-commutative77.0%
fma-def77.0%
Simplified77.0%
Taylor expanded in K around 0 57.7%
if -1.9e-6 < l < 6500Initial program 70.1%
Taylor expanded in l around 0 98.5%
associate-*r*98.5%
associate-*r*98.5%
associate-*r*98.5%
associate-*r*98.5%
distribute-rgt-out98.5%
*-commutative98.5%
associate-*r*98.5%
*-commutative98.5%
associate-*r*98.5%
distribute-rgt-out98.5%
+-commutative98.5%
fma-def98.5%
Simplified98.5%
Taylor expanded in l around 0 98.5%
*-commutative98.5%
associate-*r*98.5%
Simplified98.5%
if 6500 < l < 1.37999999999999993e88Initial program 100.0%
Applied egg-rr35.6%
if 1.37999999999999993e88 < l Initial program 100.0%
Taylor expanded in l around 0 97.7%
associate-*r*97.7%
associate-*r*97.7%
associate-*r*97.7%
associate-*r*97.7%
distribute-rgt-out97.7%
*-commutative97.7%
associate-*r*97.7%
*-commutative97.7%
associate-*r*97.7%
distribute-rgt-out97.7%
+-commutative97.7%
fma-def97.7%
Simplified97.7%
Taylor expanded in K around 0 81.0%
Taylor expanded in l around inf 81.0%
Final simplification81.5%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (+ U (* 0.3333333333333333 (* J (pow l 3.0))))))
(if (<= l -105000000000.0)
t_0
(if (<= l 6500.0)
(fma l (* J 2.0) U)
(if (<= l 1.4e+89) (pow U -8.0) t_0)))))
double code(double J, double l, double K, double U) {
double t_0 = U + (0.3333333333333333 * (J * pow(l, 3.0)));
double tmp;
if (l <= -105000000000.0) {
tmp = t_0;
} else if (l <= 6500.0) {
tmp = fma(l, (J * 2.0), U);
} else if (l <= 1.4e+89) {
tmp = pow(U, -8.0);
} else {
tmp = t_0;
}
return tmp;
}
function code(J, l, K, U) t_0 = Float64(U + Float64(0.3333333333333333 * Float64(J * (l ^ 3.0)))) tmp = 0.0 if (l <= -105000000000.0) tmp = t_0; elseif (l <= 6500.0) tmp = fma(l, Float64(J * 2.0), U); elseif (l <= 1.4e+89) tmp = U ^ -8.0; else tmp = t_0; end return tmp end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(U + N[(0.3333333333333333 * N[(J * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -105000000000.0], t$95$0, If[LessEqual[l, 6500.0], N[(l * N[(J * 2.0), $MachinePrecision] + U), $MachinePrecision], If[LessEqual[l, 1.4e+89], N[Power[U, -8.0], $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + 0.3333333333333333 \cdot \left(J \cdot {\ell}^{3}\right)\\
\mathbf{if}\;\ell \leq -105000000000:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq 6500:\\
\;\;\;\;\mathsf{fma}\left(\ell, J \cdot 2, U\right)\\
\mathbf{elif}\;\ell \leq 1.4 \cdot 10^{+89}:\\
\;\;\;\;{U}^{-8}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if l < -1.05e11 or 1.3999999999999999e89 < l Initial program 100.0%
Taylor expanded in l around 0 86.2%
associate-*r*86.2%
associate-*r*86.2%
associate-*r*86.2%
associate-*r*86.2%
distribute-rgt-out86.2%
*-commutative86.2%
associate-*r*86.2%
*-commutative86.2%
associate-*r*86.2%
distribute-rgt-out86.2%
+-commutative86.2%
fma-def86.2%
Simplified86.2%
Taylor expanded in K around 0 67.5%
Taylor expanded in l around inf 67.5%
if -1.05e11 < l < 6500Initial program 70.5%
Taylor expanded in l around 0 97.7%
Taylor expanded in K around 0 86.4%
*-commutative86.4%
associate-*r*86.4%
fma-def86.4%
*-commutative86.4%
Simplified86.4%
if 6500 < l < 1.3999999999999999e89Initial program 100.0%
Applied egg-rr35.6%
Final simplification75.3%
(FPCore (J l K U)
:precision binary64
(if (<= l -760.0)
(+ U (* (* l J) (+ 2.0 (* (* K K) -0.25))))
(if (<= l 11200.0)
(fma l (* J 2.0) U)
(if (<= l 5.2e+188) (pow U -8.0) (+ U (* l (* J 2.0)))))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -760.0) {
tmp = U + ((l * J) * (2.0 + ((K * K) * -0.25)));
} else if (l <= 11200.0) {
tmp = fma(l, (J * 2.0), U);
} else if (l <= 5.2e+188) {
tmp = pow(U, -8.0);
} else {
tmp = U + (l * (J * 2.0));
}
return tmp;
}
function code(J, l, K, U) tmp = 0.0 if (l <= -760.0) tmp = Float64(U + Float64(Float64(l * J) * Float64(2.0 + Float64(Float64(K * K) * -0.25)))); elseif (l <= 11200.0) tmp = fma(l, Float64(J * 2.0), U); elseif (l <= 5.2e+188) tmp = U ^ -8.0; else tmp = Float64(U + Float64(l * Float64(J * 2.0))); end return tmp end
code[J_, l_, K_, U_] := If[LessEqual[l, -760.0], N[(U + N[(N[(l * J), $MachinePrecision] * N[(2.0 + N[(N[(K * K), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 11200.0], N[(l * N[(J * 2.0), $MachinePrecision] + U), $MachinePrecision], If[LessEqual[l, 5.2e+188], N[Power[U, -8.0], $MachinePrecision], N[(U + N[(l * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -760:\\
\;\;\;\;U + \left(\ell \cdot J\right) \cdot \left(2 + \left(K \cdot K\right) \cdot -0.25\right)\\
\mathbf{elif}\;\ell \leq 11200:\\
\;\;\;\;\mathsf{fma}\left(\ell, J \cdot 2, U\right)\\
\mathbf{elif}\;\ell \leq 5.2 \cdot 10^{+188}:\\
\;\;\;\;{U}^{-8}\\
\mathbf{else}:\\
\;\;\;\;U + \ell \cdot \left(J \cdot 2\right)\\
\end{array}
\end{array}
if l < -760Initial program 100.0%
Taylor expanded in l around 0 21.6%
Taylor expanded in K around 0 18.1%
+-commutative18.1%
associate-*r*18.1%
distribute-rgt-out34.1%
*-commutative34.1%
unpow234.1%
Simplified34.1%
if -760 < l < 11200Initial program 70.3%
Taylor expanded in l around 0 98.4%
Taylor expanded in K around 0 87.0%
*-commutative87.0%
associate-*r*87.0%
fma-def87.0%
*-commutative87.0%
Simplified87.0%
if 11200 < l < 5.19999999999999975e188Initial program 100.0%
Applied egg-rr42.7%
if 5.19999999999999975e188 < l Initial program 100.0%
Taylor expanded in l around 0 76.4%
Taylor expanded in K around 0 67.8%
*-commutative67.8%
associate-*r*67.8%
*-commutative67.8%
Simplified67.8%
Final simplification67.1%
(FPCore (J l K U)
:precision binary64
(if (<= l -450.0)
(+ U (* (* l J) (+ 2.0 (* (* K K) -0.25))))
(if (or (<= l 6500.0) (not (<= l 2.55e+184)))
(+ U (* l (* J 2.0)))
(pow U -8.0))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -450.0) {
tmp = U + ((l * J) * (2.0 + ((K * K) * -0.25)));
} else if ((l <= 6500.0) || !(l <= 2.55e+184)) {
tmp = U + (l * (J * 2.0));
} 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 <= (-450.0d0)) then
tmp = u + ((l * j) * (2.0d0 + ((k * k) * (-0.25d0))))
else if ((l <= 6500.0d0) .or. (.not. (l <= 2.55d+184))) then
tmp = u + (l * (j * 2.0d0))
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 <= -450.0) {
tmp = U + ((l * J) * (2.0 + ((K * K) * -0.25)));
} else if ((l <= 6500.0) || !(l <= 2.55e+184)) {
tmp = U + (l * (J * 2.0));
} else {
tmp = Math.pow(U, -8.0);
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -450.0: tmp = U + ((l * J) * (2.0 + ((K * K) * -0.25))) elif (l <= 6500.0) or not (l <= 2.55e+184): tmp = U + (l * (J * 2.0)) else: tmp = math.pow(U, -8.0) return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -450.0) tmp = Float64(U + Float64(Float64(l * J) * Float64(2.0 + Float64(Float64(K * K) * -0.25)))); elseif ((l <= 6500.0) || !(l <= 2.55e+184)) tmp = Float64(U + Float64(l * Float64(J * 2.0))); else tmp = U ^ -8.0; end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -450.0) tmp = U + ((l * J) * (2.0 + ((K * K) * -0.25))); elseif ((l <= 6500.0) || ~((l <= 2.55e+184))) tmp = U + (l * (J * 2.0)); else tmp = U ^ -8.0; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -450.0], N[(U + N[(N[(l * J), $MachinePrecision] * N[(2.0 + N[(N[(K * K), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[l, 6500.0], N[Not[LessEqual[l, 2.55e+184]], $MachinePrecision]], N[(U + N[(l * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Power[U, -8.0], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -450:\\
\;\;\;\;U + \left(\ell \cdot J\right) \cdot \left(2 + \left(K \cdot K\right) \cdot -0.25\right)\\
\mathbf{elif}\;\ell \leq 6500 \lor \neg \left(\ell \leq 2.55 \cdot 10^{+184}\right):\\
\;\;\;\;U + \ell \cdot \left(J \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;{U}^{-8}\\
\end{array}
\end{array}
if l < -450Initial program 100.0%
Taylor expanded in l around 0 21.6%
Taylor expanded in K around 0 18.1%
+-commutative18.1%
associate-*r*18.1%
distribute-rgt-out34.1%
*-commutative34.1%
unpow234.1%
Simplified34.1%
if -450 < l < 6500 or 2.5500000000000001e184 < l Initial program 74.7%
Taylor expanded in l around 0 95.1%
Taylor expanded in K around 0 84.2%
*-commutative84.2%
associate-*r*84.2%
*-commutative84.2%
Simplified84.2%
if 6500 < l < 2.5500000000000001e184Initial program 100.0%
Applied egg-rr42.7%
Final simplification67.1%
(FPCore (J l K U) :precision binary64 (if (or (<= l -300.0) (and (not (<= l 540000.0)) (<= l 5.5e+207))) (+ U (* (* l J) (+ 2.0 (* (* K K) -0.25)))) (+ U (* l (* J 2.0)))))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -300.0) || (!(l <= 540000.0) && (l <= 5.5e+207))) {
tmp = U + ((l * J) * (2.0 + ((K * K) * -0.25)));
} else {
tmp = U + (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 <= (-300.0d0)) .or. (.not. (l <= 540000.0d0)) .and. (l <= 5.5d+207)) then
tmp = u + ((l * j) * (2.0d0 + ((k * k) * (-0.25d0))))
else
tmp = u + (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 <= -300.0) || (!(l <= 540000.0) && (l <= 5.5e+207))) {
tmp = U + ((l * J) * (2.0 + ((K * K) * -0.25)));
} else {
tmp = U + (l * (J * 2.0));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -300.0) or (not (l <= 540000.0) and (l <= 5.5e+207)): tmp = U + ((l * J) * (2.0 + ((K * K) * -0.25))) else: tmp = U + (l * (J * 2.0)) return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -300.0) || (!(l <= 540000.0) && (l <= 5.5e+207))) tmp = Float64(U + Float64(Float64(l * J) * Float64(2.0 + Float64(Float64(K * K) * -0.25)))); else tmp = Float64(U + Float64(l * Float64(J * 2.0))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -300.0) || (~((l <= 540000.0)) && (l <= 5.5e+207))) tmp = U + ((l * J) * (2.0 + ((K * K) * -0.25))); else tmp = U + (l * (J * 2.0)); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -300.0], And[N[Not[LessEqual[l, 540000.0]], $MachinePrecision], LessEqual[l, 5.5e+207]]], N[(U + N[(N[(l * J), $MachinePrecision] * N[(2.0 + N[(N[(K * K), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(l * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -300 \lor \neg \left(\ell \leq 540000\right) \land \ell \leq 5.5 \cdot 10^{+207}:\\
\;\;\;\;U + \left(\ell \cdot J\right) \cdot \left(2 + \left(K \cdot K\right) \cdot -0.25\right)\\
\mathbf{else}:\\
\;\;\;\;U + \ell \cdot \left(J \cdot 2\right)\\
\end{array}
\end{array}
if l < -300 or 5.4e5 < l < 5.50000000000000036e207Initial program 100.0%
Taylor expanded in l around 0 19.6%
Taylor expanded in K around 0 16.3%
+-commutative16.3%
associate-*r*16.3%
distribute-rgt-out31.5%
*-commutative31.5%
unpow231.5%
Simplified31.5%
if -300 < l < 5.4e5 or 5.50000000000000036e207 < l Initial program 73.9%
Taylor expanded in l around 0 96.1%
Taylor expanded in K around 0 86.1%
*-commutative86.1%
associate-*r*86.1%
*-commutative86.1%
Simplified86.1%
Final simplification65.0%
(FPCore (J l K U) :precision binary64 (if (<= l -8.2e+18) (* U U) (if (<= l 23.0) U (* U U))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -8.2e+18) {
tmp = U * U;
} else if (l <= 23.0) {
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 <= (-8.2d+18)) then
tmp = u * u
else if (l <= 23.0d0) 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 <= -8.2e+18) {
tmp = U * U;
} else if (l <= 23.0) {
tmp = U;
} else {
tmp = U * U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -8.2e+18: tmp = U * U elif l <= 23.0: tmp = U else: tmp = U * U return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -8.2e+18) tmp = Float64(U * U); elseif (l <= 23.0) tmp = U; else tmp = Float64(U * U); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -8.2e+18) tmp = U * U; elseif (l <= 23.0) tmp = U; else tmp = U * U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -8.2e+18], N[(U * U), $MachinePrecision], If[LessEqual[l, 23.0], U, N[(U * U), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -8.2 \cdot 10^{+18}:\\
\;\;\;\;U \cdot U\\
\mathbf{elif}\;\ell \leq 23:\\
\;\;\;\;U\\
\mathbf{else}:\\
\;\;\;\;U \cdot U\\
\end{array}
\end{array}
if l < -8.2e18 or 23 < l Initial program 100.0%
Applied egg-rr13.0%
if -8.2e18 < l < 23Initial program 70.9%
Taylor expanded in J around 0 66.8%
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.0%
Taylor expanded in l around 0 66.6%
Taylor expanded in K around 0 57.9%
*-commutative57.9%
associate-*r*57.9%
*-commutative57.9%
Simplified57.9%
Final simplification57.9%
(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 84.0%
Applied egg-rr2.8%
*-inverses2.8%
Simplified2.8%
Final simplification2.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.0%
Taylor expanded in J around 0 37.7%
Final simplification37.7%
herbie shell --seed 2023216
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))