
(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 12 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 -4e+86) (not (<= t_0 4e-7)))
(+ (* (cos (/ K 2.0)) (* t_0 J)) U)
(+ U (* 2.0 (* l (* J (cos (* K 0.5)))))))))
double code(double J, double l, double K, double U) {
double t_0 = exp(l) - exp(-l);
double tmp;
if ((t_0 <= -4e+86) || !(t_0 <= 4e-7)) {
tmp = (cos((K / 2.0)) * (t_0 * J)) + U;
} else {
tmp = U + (2.0 * (l * (J * cos((K * 0.5)))));
}
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 <= (-4d+86)) .or. (.not. (t_0 <= 4d-7))) then
tmp = (cos((k / 2.0d0)) * (t_0 * j)) + u
else
tmp = u + (2.0d0 * (l * (j * cos((k * 0.5d0)))))
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 <= -4e+86) || !(t_0 <= 4e-7)) {
tmp = (Math.cos((K / 2.0)) * (t_0 * J)) + U;
} else {
tmp = U + (2.0 * (l * (J * Math.cos((K * 0.5)))));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.exp(l) - math.exp(-l) tmp = 0 if (t_0 <= -4e+86) or not (t_0 <= 4e-7): tmp = (math.cos((K / 2.0)) * (t_0 * J)) + U else: tmp = U + (2.0 * (l * (J * math.cos((K * 0.5))))) return tmp
function code(J, l, K, U) t_0 = Float64(exp(l) - exp(Float64(-l))) tmp = 0.0 if ((t_0 <= -4e+86) || !(t_0 <= 4e-7)) tmp = Float64(Float64(cos(Float64(K / 2.0)) * Float64(t_0 * J)) + U); else tmp = Float64(U + Float64(2.0 * Float64(l * Float64(J * cos(Float64(K * 0.5)))))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = exp(l) - exp(-l); tmp = 0.0; if ((t_0 <= -4e+86) || ~((t_0 <= 4e-7))) tmp = (cos((K / 2.0)) * (t_0 * J)) + U; else tmp = U + (2.0 * (l * (J * cos((K * 0.5))))); 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, -4e+86], N[Not[LessEqual[t$95$0, 4e-7]], $MachinePrecision]], N[(N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(t$95$0 * J), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], N[(U + N[(2.0 * N[(l * N[(J * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{\ell} - e^{-\ell}\\
\mathbf{if}\;t_0 \leq -4 \cdot 10^{+86} \lor \neg \left(t_0 \leq 4 \cdot 10^{-7}\right):\\
\;\;\;\;\cos \left(\frac{K}{2}\right) \cdot \left(t_0 \cdot J\right) + U\\
\mathbf{else}:\\
\;\;\;\;U + 2 \cdot \left(\ell \cdot \left(J \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -4.0000000000000001e86 or 3.9999999999999998e-7 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 100.0%
if -4.0000000000000001e86 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 3.9999999999999998e-7Initial program 72.1%
Taylor expanded in l around 0 99.9%
*-commutative99.9%
associate-*l*99.9%
*-commutative99.9%
Simplified99.9%
Final simplification100.0%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (* K 0.5))) (t_1 (+ U (* (- (exp l) (exp (- l))) J))))
(if (<= l -1.35e+116)
(+ U (* (pow l 3.0) (* J (* t_0 0.3333333333333333))))
(if (<= l -200.0)
t_1
(if (<= l 0.0004)
(+ U (* 2.0 (* l (* J t_0))))
(if (<= l 2.35e+80)
t_1
(+
U
(*
(cos (/ K 2.0))
(* J (+ (* (pow l 3.0) 0.3333333333333333) (* l 2.0)))))))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K * 0.5));
double t_1 = U + ((exp(l) - exp(-l)) * J);
double tmp;
if (l <= -1.35e+116) {
tmp = U + (pow(l, 3.0) * (J * (t_0 * 0.3333333333333333)));
} else if (l <= -200.0) {
tmp = t_1;
} else if (l <= 0.0004) {
tmp = U + (2.0 * (l * (J * t_0)));
} else if (l <= 2.35e+80) {
tmp = t_1;
} else {
tmp = U + (cos((K / 2.0)) * (J * ((pow(l, 3.0) * 0.3333333333333333) + (l * 2.0))));
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = cos((k * 0.5d0))
t_1 = u + ((exp(l) - exp(-l)) * j)
if (l <= (-1.35d+116)) then
tmp = u + ((l ** 3.0d0) * (j * (t_0 * 0.3333333333333333d0)))
else if (l <= (-200.0d0)) then
tmp = t_1
else if (l <= 0.0004d0) then
tmp = u + (2.0d0 * (l * (j * t_0)))
else if (l <= 2.35d+80) then
tmp = t_1
else
tmp = u + (cos((k / 2.0d0)) * (j * (((l ** 3.0d0) * 0.3333333333333333d0) + (l * 2.0d0))))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = Math.cos((K * 0.5));
double t_1 = U + ((Math.exp(l) - Math.exp(-l)) * J);
double tmp;
if (l <= -1.35e+116) {
tmp = U + (Math.pow(l, 3.0) * (J * (t_0 * 0.3333333333333333)));
} else if (l <= -200.0) {
tmp = t_1;
} else if (l <= 0.0004) {
tmp = U + (2.0 * (l * (J * t_0)));
} else if (l <= 2.35e+80) {
tmp = t_1;
} else {
tmp = U + (Math.cos((K / 2.0)) * (J * ((Math.pow(l, 3.0) * 0.3333333333333333) + (l * 2.0))));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K * 0.5)) t_1 = U + ((math.exp(l) - math.exp(-l)) * J) tmp = 0 if l <= -1.35e+116: tmp = U + (math.pow(l, 3.0) * (J * (t_0 * 0.3333333333333333))) elif l <= -200.0: tmp = t_1 elif l <= 0.0004: tmp = U + (2.0 * (l * (J * t_0))) elif l <= 2.35e+80: tmp = t_1 else: tmp = U + (math.cos((K / 2.0)) * (J * ((math.pow(l, 3.0) * 0.3333333333333333) + (l * 2.0)))) return tmp
function code(J, l, K, U) t_0 = cos(Float64(K * 0.5)) t_1 = Float64(U + Float64(Float64(exp(l) - exp(Float64(-l))) * J)) tmp = 0.0 if (l <= -1.35e+116) tmp = Float64(U + Float64((l ^ 3.0) * Float64(J * Float64(t_0 * 0.3333333333333333)))); elseif (l <= -200.0) tmp = t_1; elseif (l <= 0.0004) tmp = Float64(U + Float64(2.0 * Float64(l * Float64(J * t_0)))); elseif (l <= 2.35e+80) tmp = t_1; else tmp = Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(J * Float64(Float64((l ^ 3.0) * 0.3333333333333333) + Float64(l * 2.0))))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = cos((K * 0.5)); t_1 = U + ((exp(l) - exp(-l)) * J); tmp = 0.0; if (l <= -1.35e+116) tmp = U + ((l ^ 3.0) * (J * (t_0 * 0.3333333333333333))); elseif (l <= -200.0) tmp = t_1; elseif (l <= 0.0004) tmp = U + (2.0 * (l * (J * t_0))); elseif (l <= 2.35e+80) tmp = t_1; else tmp = U + (cos((K / 2.0)) * (J * (((l ^ 3.0) * 0.3333333333333333) + (l * 2.0)))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(U + N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -1.35e+116], N[(U + N[(N[Power[l, 3.0], $MachinePrecision] * N[(J * N[(t$95$0 * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -200.0], t$95$1, If[LessEqual[l, 0.0004], N[(U + N[(2.0 * N[(l * N[(J * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.35e+80], t$95$1, N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(J * N[(N[(N[Power[l, 3.0], $MachinePrecision] * 0.3333333333333333), $MachinePrecision] + N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(K \cdot 0.5\right)\\
t_1 := U + \left(e^{\ell} - e^{-\ell}\right) \cdot J\\
\mathbf{if}\;\ell \leq -1.35 \cdot 10^{+116}:\\
\;\;\;\;U + {\ell}^{3} \cdot \left(J \cdot \left(t_0 \cdot 0.3333333333333333\right)\right)\\
\mathbf{elif}\;\ell \leq -200:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\ell \leq 0.0004:\\
\;\;\;\;U + 2 \cdot \left(\ell \cdot \left(J \cdot t_0\right)\right)\\
\mathbf{elif}\;\ell \leq 2.35 \cdot 10^{+80}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;U + \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left({\ell}^{3} \cdot 0.3333333333333333 + \ell \cdot 2\right)\right)\\
\end{array}
\end{array}
if l < -1.35e116Initial program 100.0%
Taylor expanded in l around 0 100.0%
Taylor expanded in l around inf 100.0%
*-commutative100.0%
*-commutative100.0%
associate-*r*100.0%
*-commutative100.0%
associate-*r*100.0%
associate-*l*100.0%
associate-*l*100.0%
*-commutative100.0%
Simplified100.0%
if -1.35e116 < l < -200 or 4.00000000000000019e-4 < l < 2.35000000000000005e80Initial program 100.0%
Taylor expanded in K around 0 76.4%
if -200 < l < 4.00000000000000019e-4Initial program 72.3%
Taylor expanded in l around 0 99.2%
*-commutative99.2%
associate-*l*99.3%
*-commutative99.3%
Simplified99.3%
if 2.35000000000000005e80 < l Initial program 100.0%
Taylor expanded in l around 0 95.0%
Final simplification95.5%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (* K 0.5)))
(t_1 (+ U (* (pow l 3.0) (* J (* t_0 0.3333333333333333)))))
(t_2 (+ U (* (- (exp l) (exp (- l))) J))))
(if (<= l -1.35e+116)
t_1
(if (<= l -200.0)
t_2
(if (<= l 0.00022)
(+ U (* 2.0 (* l (* J t_0))))
(if (<= l 2.35e+80) t_2 t_1))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K * 0.5));
double t_1 = U + (pow(l, 3.0) * (J * (t_0 * 0.3333333333333333)));
double t_2 = U + ((exp(l) - exp(-l)) * J);
double tmp;
if (l <= -1.35e+116) {
tmp = t_1;
} else if (l <= -200.0) {
tmp = t_2;
} else if (l <= 0.00022) {
tmp = U + (2.0 * (l * (J * t_0)));
} else if (l <= 2.35e+80) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = cos((k * 0.5d0))
t_1 = u + ((l ** 3.0d0) * (j * (t_0 * 0.3333333333333333d0)))
t_2 = u + ((exp(l) - exp(-l)) * j)
if (l <= (-1.35d+116)) then
tmp = t_1
else if (l <= (-200.0d0)) then
tmp = t_2
else if (l <= 0.00022d0) then
tmp = u + (2.0d0 * (l * (j * t_0)))
else if (l <= 2.35d+80) then
tmp = t_2
else
tmp = t_1
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = Math.cos((K * 0.5));
double t_1 = U + (Math.pow(l, 3.0) * (J * (t_0 * 0.3333333333333333)));
double t_2 = U + ((Math.exp(l) - Math.exp(-l)) * J);
double tmp;
if (l <= -1.35e+116) {
tmp = t_1;
} else if (l <= -200.0) {
tmp = t_2;
} else if (l <= 0.00022) {
tmp = U + (2.0 * (l * (J * t_0)));
} else if (l <= 2.35e+80) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K * 0.5)) t_1 = U + (math.pow(l, 3.0) * (J * (t_0 * 0.3333333333333333))) t_2 = U + ((math.exp(l) - math.exp(-l)) * J) tmp = 0 if l <= -1.35e+116: tmp = t_1 elif l <= -200.0: tmp = t_2 elif l <= 0.00022: tmp = U + (2.0 * (l * (J * t_0))) elif l <= 2.35e+80: tmp = t_2 else: tmp = t_1 return tmp
function code(J, l, K, U) t_0 = cos(Float64(K * 0.5)) t_1 = Float64(U + Float64((l ^ 3.0) * Float64(J * Float64(t_0 * 0.3333333333333333)))) t_2 = Float64(U + Float64(Float64(exp(l) - exp(Float64(-l))) * J)) tmp = 0.0 if (l <= -1.35e+116) tmp = t_1; elseif (l <= -200.0) tmp = t_2; elseif (l <= 0.00022) tmp = Float64(U + Float64(2.0 * Float64(l * Float64(J * t_0)))); elseif (l <= 2.35e+80) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = cos((K * 0.5)); t_1 = U + ((l ^ 3.0) * (J * (t_0 * 0.3333333333333333))); t_2 = U + ((exp(l) - exp(-l)) * J); tmp = 0.0; if (l <= -1.35e+116) tmp = t_1; elseif (l <= -200.0) tmp = t_2; elseif (l <= 0.00022) tmp = U + (2.0 * (l * (J * t_0))); elseif (l <= 2.35e+80) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(U + N[(N[Power[l, 3.0], $MachinePrecision] * N[(J * N[(t$95$0 * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(U + N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -1.35e+116], t$95$1, If[LessEqual[l, -200.0], t$95$2, If[LessEqual[l, 0.00022], N[(U + N[(2.0 * N[(l * N[(J * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.35e+80], t$95$2, t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(K \cdot 0.5\right)\\
t_1 := U + {\ell}^{3} \cdot \left(J \cdot \left(t_0 \cdot 0.3333333333333333\right)\right)\\
t_2 := U + \left(e^{\ell} - e^{-\ell}\right) \cdot J\\
\mathbf{if}\;\ell \leq -1.35 \cdot 10^{+116}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\ell \leq -200:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\ell \leq 0.00022:\\
\;\;\;\;U + 2 \cdot \left(\ell \cdot \left(J \cdot t_0\right)\right)\\
\mathbf{elif}\;\ell \leq 2.35 \cdot 10^{+80}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if l < -1.35e116 or 2.35000000000000005e80 < l Initial program 100.0%
Taylor expanded in l around 0 97.7%
Taylor expanded in l around inf 97.7%
*-commutative97.7%
*-commutative97.7%
associate-*r*97.7%
*-commutative97.7%
associate-*r*97.7%
associate-*l*97.7%
associate-*l*97.7%
*-commutative97.7%
Simplified97.7%
if -1.35e116 < l < -200 or 2.20000000000000008e-4 < l < 2.35000000000000005e80Initial program 100.0%
Taylor expanded in K around 0 76.4%
if -200 < l < 2.20000000000000008e-4Initial program 72.3%
Taylor expanded in l around 0 99.2%
*-commutative99.2%
associate-*l*99.3%
*-commutative99.3%
Simplified99.3%
Final simplification95.5%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) 0.94) (+ U (* 2.0 (* l (* J (cos (* K 0.5)))))) (+ U (* J (+ (* (pow l 3.0) 0.3333333333333333) (* l 2.0))))))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= 0.94) {
tmp = U + (2.0 * (l * (J * cos((K * 0.5)))));
} else {
tmp = U + (J * ((pow(l, 3.0) * 0.3333333333333333) + (l * 2.0)));
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if (cos((k / 2.0d0)) <= 0.94d0) then
tmp = u + (2.0d0 * (l * (j * cos((k * 0.5d0)))))
else
tmp = u + (j * (((l ** 3.0d0) * 0.3333333333333333d0) + (l * 2.0d0)))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (Math.cos((K / 2.0)) <= 0.94) {
tmp = U + (2.0 * (l * (J * Math.cos((K * 0.5)))));
} else {
tmp = U + (J * ((Math.pow(l, 3.0) * 0.3333333333333333) + (l * 2.0)));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if math.cos((K / 2.0)) <= 0.94: tmp = U + (2.0 * (l * (J * math.cos((K * 0.5))))) else: tmp = U + (J * ((math.pow(l, 3.0) * 0.3333333333333333) + (l * 2.0))) return tmp
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= 0.94) tmp = Float64(U + Float64(2.0 * Float64(l * Float64(J * cos(Float64(K * 0.5)))))); else tmp = Float64(U + Float64(J * Float64(Float64((l ^ 3.0) * 0.3333333333333333) + Float64(l * 2.0)))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (cos((K / 2.0)) <= 0.94) tmp = U + (2.0 * (l * (J * cos((K * 0.5))))); else tmp = U + (J * (((l ^ 3.0) * 0.3333333333333333) + (l * 2.0))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], 0.94], N[(U + N[(2.0 * N[(l * N[(J * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(J * N[(N[(N[Power[l, 3.0], $MachinePrecision] * 0.3333333333333333), $MachinePrecision] + N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq 0.94:\\
\;\;\;\;U + 2 \cdot \left(\ell \cdot \left(J \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + J \cdot \left({\ell}^{3} \cdot 0.3333333333333333 + \ell \cdot 2\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K 2)) < 0.93999999999999995Initial program 83.2%
Taylor expanded in l around 0 70.3%
*-commutative70.3%
associate-*l*70.3%
*-commutative70.3%
Simplified70.3%
if 0.93999999999999995 < (cos.f64 (/.f64 K 2)) Initial program 86.7%
Taylor expanded in l around 0 86.9%
Taylor expanded in K around 0 86.3%
Taylor expanded in J around 0 86.3%
Final simplification79.5%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (+ U (* (- (exp l) (exp (- l))) J))))
(if (<= l -200.0)
t_0
(if (<= l 0.00085)
(+ U (* 2.0 (* l (* J (cos (* K 0.5))))))
(if (<= l 2.35e+80)
t_0
(+
U
(*
(pow l 3.0)
(*
J
(+ 0.3333333333333333 (* -0.041666666666666664 (* K K)))))))))))
double code(double J, double l, double K, double U) {
double t_0 = U + ((exp(l) - exp(-l)) * J);
double tmp;
if (l <= -200.0) {
tmp = t_0;
} else if (l <= 0.00085) {
tmp = U + (2.0 * (l * (J * cos((K * 0.5)))));
} else if (l <= 2.35e+80) {
tmp = t_0;
} else {
tmp = U + (pow(l, 3.0) * (J * (0.3333333333333333 + (-0.041666666666666664 * (K * K)))));
}
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 + ((exp(l) - exp(-l)) * j)
if (l <= (-200.0d0)) then
tmp = t_0
else if (l <= 0.00085d0) then
tmp = u + (2.0d0 * (l * (j * cos((k * 0.5d0)))))
else if (l <= 2.35d+80) then
tmp = t_0
else
tmp = u + ((l ** 3.0d0) * (j * (0.3333333333333333d0 + ((-0.041666666666666664d0) * (k * k)))))
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 tmp;
if (l <= -200.0) {
tmp = t_0;
} else if (l <= 0.00085) {
tmp = U + (2.0 * (l * (J * Math.cos((K * 0.5)))));
} else if (l <= 2.35e+80) {
tmp = t_0;
} else {
tmp = U + (Math.pow(l, 3.0) * (J * (0.3333333333333333 + (-0.041666666666666664 * (K * K)))));
}
return tmp;
}
def code(J, l, K, U): t_0 = U + ((math.exp(l) - math.exp(-l)) * J) tmp = 0 if l <= -200.0: tmp = t_0 elif l <= 0.00085: tmp = U + (2.0 * (l * (J * math.cos((K * 0.5))))) elif l <= 2.35e+80: tmp = t_0 else: tmp = U + (math.pow(l, 3.0) * (J * (0.3333333333333333 + (-0.041666666666666664 * (K * K))))) return tmp
function code(J, l, K, U) t_0 = Float64(U + Float64(Float64(exp(l) - exp(Float64(-l))) * J)) tmp = 0.0 if (l <= -200.0) tmp = t_0; elseif (l <= 0.00085) tmp = Float64(U + Float64(2.0 * Float64(l * Float64(J * cos(Float64(K * 0.5)))))); elseif (l <= 2.35e+80) tmp = t_0; else tmp = Float64(U + Float64((l ^ 3.0) * Float64(J * Float64(0.3333333333333333 + Float64(-0.041666666666666664 * Float64(K * K)))))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = U + ((exp(l) - exp(-l)) * J); tmp = 0.0; if (l <= -200.0) tmp = t_0; elseif (l <= 0.00085) tmp = U + (2.0 * (l * (J * cos((K * 0.5))))); elseif (l <= 2.35e+80) tmp = t_0; else tmp = U + ((l ^ 3.0) * (J * (0.3333333333333333 + (-0.041666666666666664 * (K * K))))); 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]}, If[LessEqual[l, -200.0], t$95$0, If[LessEqual[l, 0.00085], 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.35e+80], t$95$0, N[(U + N[(N[Power[l, 3.0], $MachinePrecision] * N[(J * N[(0.3333333333333333 + N[(-0.041666666666666664 * N[(K * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + \left(e^{\ell} - e^{-\ell}\right) \cdot J\\
\mathbf{if}\;\ell \leq -200:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq 0.00085:\\
\;\;\;\;U + 2 \cdot \left(\ell \cdot \left(J \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\mathbf{elif}\;\ell \leq 2.35 \cdot 10^{+80}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;U + {\ell}^{3} \cdot \left(J \cdot \left(0.3333333333333333 + -0.041666666666666664 \cdot \left(K \cdot K\right)\right)\right)\\
\end{array}
\end{array}
if l < -200 or 8.49999999999999953e-4 < l < 2.35000000000000005e80Initial program 100.0%
Taylor expanded in K around 0 74.4%
if -200 < l < 8.49999999999999953e-4Initial program 72.3%
Taylor expanded in l around 0 99.2%
*-commutative99.2%
associate-*l*99.3%
*-commutative99.3%
Simplified99.3%
if 2.35000000000000005e80 < l Initial program 100.0%
Taylor expanded in l around 0 95.0%
Taylor expanded in l around inf 95.0%
*-commutative95.0%
*-commutative95.0%
associate-*r*95.0%
*-commutative95.0%
associate-*r*95.0%
associate-*l*95.0%
associate-*l*95.0%
*-commutative95.0%
Simplified95.0%
Taylor expanded in K around 0 81.8%
unpow281.8%
Simplified81.8%
Final simplification88.8%
(FPCore (J l K U)
:precision binary64
(if (or (<= l -195.0) (not (<= l 500.0)))
(+
U
(*
(pow l 3.0)
(* J (+ 0.3333333333333333 (* -0.041666666666666664 (* K K))))))
(+ U (* 2.0 (* l (* J (cos (* K 0.5))))))))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -195.0) || !(l <= 500.0)) {
tmp = U + (pow(l, 3.0) * (J * (0.3333333333333333 + (-0.041666666666666664 * (K * K)))));
} else {
tmp = U + (2.0 * (l * (J * cos((K * 0.5)))));
}
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 <= (-195.0d0)) .or. (.not. (l <= 500.0d0))) then
tmp = u + ((l ** 3.0d0) * (j * (0.3333333333333333d0 + ((-0.041666666666666664d0) * (k * k)))))
else
tmp = u + (2.0d0 * (l * (j * cos((k * 0.5d0)))))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -195.0) || !(l <= 500.0)) {
tmp = U + (Math.pow(l, 3.0) * (J * (0.3333333333333333 + (-0.041666666666666664 * (K * K)))));
} else {
tmp = U + (2.0 * (l * (J * Math.cos((K * 0.5)))));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -195.0) or not (l <= 500.0): tmp = U + (math.pow(l, 3.0) * (J * (0.3333333333333333 + (-0.041666666666666664 * (K * K))))) else: tmp = U + (2.0 * (l * (J * math.cos((K * 0.5))))) return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -195.0) || !(l <= 500.0)) tmp = Float64(U + Float64((l ^ 3.0) * Float64(J * Float64(0.3333333333333333 + Float64(-0.041666666666666664 * Float64(K * K)))))); else tmp = Float64(U + Float64(2.0 * Float64(l * Float64(J * cos(Float64(K * 0.5)))))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -195.0) || ~((l <= 500.0))) tmp = U + ((l ^ 3.0) * (J * (0.3333333333333333 + (-0.041666666666666664 * (K * K))))); else tmp = U + (2.0 * (l * (J * cos((K * 0.5))))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -195.0], N[Not[LessEqual[l, 500.0]], $MachinePrecision]], N[(U + N[(N[Power[l, 3.0], $MachinePrecision] * N[(J * N[(0.3333333333333333 + N[(-0.041666666666666664 * N[(K * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(2.0 * N[(l * N[(J * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -195 \lor \neg \left(\ell \leq 500\right):\\
\;\;\;\;U + {\ell}^{3} \cdot \left(J \cdot \left(0.3333333333333333 + -0.041666666666666664 \cdot \left(K \cdot K\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U + 2 \cdot \left(\ell \cdot \left(J \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\end{array}
\end{array}
if l < -195 or 500 < l Initial program 100.0%
Taylor expanded in l around 0 73.3%
Taylor expanded in l around inf 73.3%
*-commutative73.3%
*-commutative73.3%
associate-*r*73.3%
*-commutative73.3%
associate-*r*73.3%
associate-*l*73.3%
associate-*l*73.3%
*-commutative73.3%
Simplified73.3%
Taylor expanded in K around 0 63.8%
unpow263.8%
Simplified63.8%
if -195 < l < 500Initial program 72.3%
Taylor expanded in l around 0 99.2%
*-commutative99.2%
associate-*l*99.3%
*-commutative99.3%
Simplified99.3%
Final simplification82.8%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (+ U (* (pow l 3.0) (* J 0.3333333333333333)))))
(if (<= l -5e+39)
t_0
(if (<= l 3800.0)
(+ U (* 2.0 (* l (* J (cos (* K 0.5))))))
(if (<= l 3e+86) (+ U (* (* l J) (+ 2.0 (* (* K K) -0.25)))) t_0)))))
double code(double J, double l, double K, double U) {
double t_0 = U + (pow(l, 3.0) * (J * 0.3333333333333333));
double tmp;
if (l <= -5e+39) {
tmp = t_0;
} else if (l <= 3800.0) {
tmp = U + (2.0 * (l * (J * cos((K * 0.5)))));
} else if (l <= 3e+86) {
tmp = U + ((l * J) * (2.0 + ((K * K) * -0.25)));
} 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 + ((l ** 3.0d0) * (j * 0.3333333333333333d0))
if (l <= (-5d+39)) then
tmp = t_0
else if (l <= 3800.0d0) then
tmp = u + (2.0d0 * (l * (j * cos((k * 0.5d0)))))
else if (l <= 3d+86) then
tmp = u + ((l * j) * (2.0d0 + ((k * k) * (-0.25d0))))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = U + (Math.pow(l, 3.0) * (J * 0.3333333333333333));
double tmp;
if (l <= -5e+39) {
tmp = t_0;
} else if (l <= 3800.0) {
tmp = U + (2.0 * (l * (J * Math.cos((K * 0.5)))));
} else if (l <= 3e+86) {
tmp = U + ((l * J) * (2.0 + ((K * K) * -0.25)));
} else {
tmp = t_0;
}
return tmp;
}
def code(J, l, K, U): t_0 = U + (math.pow(l, 3.0) * (J * 0.3333333333333333)) tmp = 0 if l <= -5e+39: tmp = t_0 elif l <= 3800.0: tmp = U + (2.0 * (l * (J * math.cos((K * 0.5))))) elif l <= 3e+86: tmp = U + ((l * J) * (2.0 + ((K * K) * -0.25))) else: tmp = t_0 return tmp
function code(J, l, K, U) t_0 = Float64(U + Float64((l ^ 3.0) * Float64(J * 0.3333333333333333))) tmp = 0.0 if (l <= -5e+39) tmp = t_0; elseif (l <= 3800.0) tmp = Float64(U + Float64(2.0 * Float64(l * Float64(J * cos(Float64(K * 0.5)))))); elseif (l <= 3e+86) tmp = Float64(U + Float64(Float64(l * J) * Float64(2.0 + Float64(Float64(K * K) * -0.25)))); else tmp = t_0; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = U + ((l ^ 3.0) * (J * 0.3333333333333333)); tmp = 0.0; if (l <= -5e+39) tmp = t_0; elseif (l <= 3800.0) tmp = U + (2.0 * (l * (J * cos((K * 0.5))))); elseif (l <= 3e+86) tmp = U + ((l * J) * (2.0 + ((K * K) * -0.25))); else tmp = t_0; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(U + N[(N[Power[l, 3.0], $MachinePrecision] * N[(J * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -5e+39], t$95$0, If[LessEqual[l, 3800.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, 3e+86], N[(U + N[(N[(l * J), $MachinePrecision] * N[(2.0 + N[(N[(K * K), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + {\ell}^{3} \cdot \left(J \cdot 0.3333333333333333\right)\\
\mathbf{if}\;\ell \leq -5 \cdot 10^{+39}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq 3800:\\
\;\;\;\;U + 2 \cdot \left(\ell \cdot \left(J \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\mathbf{elif}\;\ell \leq 3 \cdot 10^{+86}:\\
\;\;\;\;U + \left(\ell \cdot J\right) \cdot \left(2 + \left(K \cdot K\right) \cdot -0.25\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if l < -5.00000000000000015e39 or 2.99999999999999977e86 < l Initial program 100.0%
Taylor expanded in l around 0 88.8%
Taylor expanded in l around inf 88.8%
*-commutative88.8%
*-commutative88.8%
associate-*r*88.8%
*-commutative88.8%
associate-*r*88.8%
associate-*l*88.8%
associate-*l*88.8%
*-commutative88.8%
Simplified88.8%
Taylor expanded in K around 0 63.2%
if -5.00000000000000015e39 < l < 3800Initial program 73.8%
Taylor expanded in l around 0 93.9%
*-commutative93.9%
associate-*l*94.0%
*-commutative94.0%
Simplified94.0%
if 3800 < l < 2.99999999999999977e86Initial program 100.0%
Taylor expanded in l around 0 3.5%
*-commutative3.5%
associate-*l*3.5%
*-commutative3.5%
Simplified3.5%
Taylor expanded in K around 0 31.2%
associate-+r+31.2%
+-commutative31.2%
associate-*r*31.2%
distribute-rgt-out31.2%
*-commutative31.2%
unpow231.2%
Simplified31.2%
Final simplification78.5%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (+ U (* (pow l 3.0) (* J 0.3333333333333333)))))
(if (<= l -3.4e-10)
t_0
(if (<= l 470.0)
(+ U (* 2.0 (* l J)))
(if (<= l 1.06e+85) (+ U (* (* l J) (+ 2.0 (* (* K K) -0.25)))) t_0)))))
double code(double J, double l, double K, double U) {
double t_0 = U + (pow(l, 3.0) * (J * 0.3333333333333333));
double tmp;
if (l <= -3.4e-10) {
tmp = t_0;
} else if (l <= 470.0) {
tmp = U + (2.0 * (l * J));
} else if (l <= 1.06e+85) {
tmp = U + ((l * J) * (2.0 + ((K * K) * -0.25)));
} 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 + ((l ** 3.0d0) * (j * 0.3333333333333333d0))
if (l <= (-3.4d-10)) then
tmp = t_0
else if (l <= 470.0d0) then
tmp = u + (2.0d0 * (l * j))
else if (l <= 1.06d+85) then
tmp = u + ((l * j) * (2.0d0 + ((k * k) * (-0.25d0))))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = U + (Math.pow(l, 3.0) * (J * 0.3333333333333333));
double tmp;
if (l <= -3.4e-10) {
tmp = t_0;
} else if (l <= 470.0) {
tmp = U + (2.0 * (l * J));
} else if (l <= 1.06e+85) {
tmp = U + ((l * J) * (2.0 + ((K * K) * -0.25)));
} else {
tmp = t_0;
}
return tmp;
}
def code(J, l, K, U): t_0 = U + (math.pow(l, 3.0) * (J * 0.3333333333333333)) tmp = 0 if l <= -3.4e-10: tmp = t_0 elif l <= 470.0: tmp = U + (2.0 * (l * J)) elif l <= 1.06e+85: tmp = U + ((l * J) * (2.0 + ((K * K) * -0.25))) else: tmp = t_0 return tmp
function code(J, l, K, U) t_0 = Float64(U + Float64((l ^ 3.0) * Float64(J * 0.3333333333333333))) tmp = 0.0 if (l <= -3.4e-10) tmp = t_0; elseif (l <= 470.0) tmp = Float64(U + Float64(2.0 * Float64(l * J))); elseif (l <= 1.06e+85) tmp = Float64(U + Float64(Float64(l * J) * Float64(2.0 + Float64(Float64(K * K) * -0.25)))); else tmp = t_0; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = U + ((l ^ 3.0) * (J * 0.3333333333333333)); tmp = 0.0; if (l <= -3.4e-10) tmp = t_0; elseif (l <= 470.0) tmp = U + (2.0 * (l * J)); elseif (l <= 1.06e+85) tmp = U + ((l * J) * (2.0 + ((K * K) * -0.25))); else tmp = t_0; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(U + N[(N[Power[l, 3.0], $MachinePrecision] * N[(J * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -3.4e-10], t$95$0, If[LessEqual[l, 470.0], N[(U + N[(2.0 * N[(l * J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.06e+85], N[(U + N[(N[(l * J), $MachinePrecision] * N[(2.0 + N[(N[(K * K), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + {\ell}^{3} \cdot \left(J \cdot 0.3333333333333333\right)\\
\mathbf{if}\;\ell \leq -3.4 \cdot 10^{-10}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq 470:\\
\;\;\;\;U + 2 \cdot \left(\ell \cdot J\right)\\
\mathbf{elif}\;\ell \leq 1.06 \cdot 10^{+85}:\\
\;\;\;\;U + \left(\ell \cdot J\right) \cdot \left(2 + \left(K \cdot K\right) \cdot -0.25\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if l < -3.40000000000000015e-10 or 1.0600000000000001e85 < l Initial program 99.6%
Taylor expanded in l around 0 83.4%
Taylor expanded in l around inf 82.5%
*-commutative82.5%
*-commutative82.5%
associate-*r*82.5%
*-commutative82.5%
associate-*r*82.5%
associate-*l*82.5%
associate-*l*82.5%
*-commutative82.5%
Simplified82.5%
Taylor expanded in K around 0 58.3%
if -3.40000000000000015e-10 < l < 470Initial program 72.2%
Taylor expanded in l around 0 99.2%
*-commutative99.2%
associate-*l*99.3%
*-commutative99.3%
Simplified99.3%
Taylor expanded in K around 0 86.0%
if 470 < l < 1.0600000000000001e85Initial program 100.0%
Taylor expanded in l around 0 3.5%
*-commutative3.5%
associate-*l*3.5%
*-commutative3.5%
Simplified3.5%
Taylor expanded in K around 0 31.2%
associate-+r+31.2%
+-commutative31.2%
associate-*r*31.2%
distribute-rgt-out31.2%
*-commutative31.2%
unpow231.2%
Simplified31.2%
Final simplification71.1%
(FPCore (J l K U) :precision binary64 (if (or (<= l -160.0) (not (<= l 3800.0))) (+ U (* (* l J) (+ 2.0 (* (* K K) -0.25)))) (+ U (* 2.0 (* l J)))))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -160.0) || !(l <= 3800.0)) {
tmp = U + ((l * J) * (2.0 + ((K * K) * -0.25)));
} else {
tmp = U + (2.0 * (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 <= (-160.0d0)) .or. (.not. (l <= 3800.0d0))) then
tmp = u + ((l * j) * (2.0d0 + ((k * k) * (-0.25d0))))
else
tmp = u + (2.0d0 * (l * j))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -160.0) || !(l <= 3800.0)) {
tmp = U + ((l * J) * (2.0 + ((K * K) * -0.25)));
} else {
tmp = U + (2.0 * (l * J));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -160.0) or not (l <= 3800.0): tmp = U + ((l * J) * (2.0 + ((K * K) * -0.25))) else: tmp = U + (2.0 * (l * J)) return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -160.0) || !(l <= 3800.0)) tmp = Float64(U + Float64(Float64(l * J) * Float64(2.0 + Float64(Float64(K * K) * -0.25)))); else tmp = Float64(U + Float64(2.0 * Float64(l * J))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -160.0) || ~((l <= 3800.0))) tmp = U + ((l * J) * (2.0 + ((K * K) * -0.25))); else tmp = U + (2.0 * (l * J)); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -160.0], N[Not[LessEqual[l, 3800.0]], $MachinePrecision]], N[(U + N[(N[(l * J), $MachinePrecision] * N[(2.0 + N[(N[(K * K), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(U + N[(2.0 * N[(l * J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -160 \lor \neg \left(\ell \leq 3800\right):\\
\;\;\;\;U + \left(\ell \cdot J\right) \cdot \left(2 + \left(K \cdot K\right) \cdot -0.25\right)\\
\mathbf{else}:\\
\;\;\;\;U + 2 \cdot \left(\ell \cdot J\right)\\
\end{array}
\end{array}
if l < -160 or 3800 < l Initial program 100.0%
Taylor expanded in l around 0 28.4%
*-commutative28.4%
associate-*l*28.4%
*-commutative28.4%
Simplified28.4%
Taylor expanded in K around 0 15.8%
associate-+r+15.8%
+-commutative15.8%
associate-*r*15.8%
distribute-rgt-out34.3%
*-commutative34.3%
unpow234.3%
Simplified34.3%
if -160 < l < 3800Initial program 72.3%
Taylor expanded in l around 0 99.2%
*-commutative99.2%
associate-*l*99.3%
*-commutative99.3%
Simplified99.3%
Taylor expanded in K around 0 85.5%
Final simplification61.7%
(FPCore (J l K U) :precision binary64 (+ U (* 2.0 (* l J))))
double code(double J, double l, double K, double U) {
return U + (2.0 * (l * J));
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = u + (2.0d0 * (l * j))
end function
public static double code(double J, double l, double K, double U) {
return U + (2.0 * (l * J));
}
def code(J, l, K, U): return U + (2.0 * (l * J))
function code(J, l, K, U) return Float64(U + Float64(2.0 * Float64(l * J))) end
function tmp = code(J, l, K, U) tmp = U + (2.0 * (l * J)); end
code[J_, l_, K_, U_] := N[(U + N[(2.0 * N[(l * J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + 2 \cdot \left(\ell \cdot J\right)
\end{array}
Initial program 85.2%
Taylor expanded in l around 0 66.3%
*-commutative66.3%
associate-*l*66.3%
*-commutative66.3%
Simplified66.3%
Taylor expanded in K around 0 54.8%
Final simplification54.8%
(FPCore (J l K U) :precision binary64 (if (<= l 92.0) U (* U U)))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= 92.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 <= 92.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 <= 92.0) {
tmp = U;
} else {
tmp = U * U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= 92.0: tmp = U else: tmp = U * U return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= 92.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 <= 92.0) tmp = U; else tmp = U * U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, 92.0], U, N[(U * U), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 92:\\
\;\;\;\;U\\
\mathbf{else}:\\
\;\;\;\;U \cdot U\\
\end{array}
\end{array}
if l < 92Initial program 81.3%
associate-*l*81.3%
fma-def81.3%
Simplified81.3%
Taylor expanded in J around 0 47.9%
if 92 < l Initial program 100.0%
associate-*l*100.0%
fma-def100.0%
Simplified100.0%
Applied egg-rr20.4%
Final simplification42.2%
(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 85.2%
associate-*l*85.2%
fma-def85.2%
Simplified85.2%
Taylor expanded in J around 0 38.4%
Final simplification38.4%
herbie shell --seed 2023243
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))