
(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 13 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 -20.0) (not (<= t_1 2e-9)))
(+ (* (* t_1 J) t_0) U)
(+
U
(*
t_0
(*
J
(+
(* 0.3333333333333333 (pow l 3.0))
(+
(* 0.0003968253968253968 (pow l 7.0))
(+ (* 0.016666666666666666 (pow l 5.0)) (* l 2.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 <= -20.0) || !(t_1 <= 2e-9)) {
tmp = ((t_1 * J) * t_0) + U;
} else {
tmp = U + (t_0 * (J * ((0.3333333333333333 * pow(l, 3.0)) + ((0.0003968253968253968 * pow(l, 7.0)) + ((0.016666666666666666 * pow(l, 5.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) :: t_1
real(8) :: tmp
t_0 = cos((k / 2.0d0))
t_1 = exp(l) - exp(-l)
if ((t_1 <= (-20.0d0)) .or. (.not. (t_1 <= 2d-9))) then
tmp = ((t_1 * j) * t_0) + u
else
tmp = u + (t_0 * (j * ((0.3333333333333333d0 * (l ** 3.0d0)) + ((0.0003968253968253968d0 * (l ** 7.0d0)) + ((0.016666666666666666d0 * (l ** 5.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 t_1 = Math.exp(l) - Math.exp(-l);
double tmp;
if ((t_1 <= -20.0) || !(t_1 <= 2e-9)) {
tmp = ((t_1 * J) * t_0) + U;
} else {
tmp = U + (t_0 * (J * ((0.3333333333333333 * Math.pow(l, 3.0)) + ((0.0003968253968253968 * Math.pow(l, 7.0)) + ((0.016666666666666666 * Math.pow(l, 5.0)) + (l * 2.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 <= -20.0) or not (t_1 <= 2e-9): tmp = ((t_1 * J) * t_0) + U else: tmp = U + (t_0 * (J * ((0.3333333333333333 * math.pow(l, 3.0)) + ((0.0003968253968253968 * math.pow(l, 7.0)) + ((0.016666666666666666 * math.pow(l, 5.0)) + (l * 2.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 <= -20.0) || !(t_1 <= 2e-9)) tmp = Float64(Float64(Float64(t_1 * J) * t_0) + U); else tmp = Float64(U + Float64(t_0 * Float64(J * Float64(Float64(0.3333333333333333 * (l ^ 3.0)) + Float64(Float64(0.0003968253968253968 * (l ^ 7.0)) + Float64(Float64(0.016666666666666666 * (l ^ 5.0)) + Float64(l * 2.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 <= -20.0) || ~((t_1 <= 2e-9))) tmp = ((t_1 * J) * t_0) + U; else tmp = U + (t_0 * (J * ((0.3333333333333333 * (l ^ 3.0)) + ((0.0003968253968253968 * (l ^ 7.0)) + ((0.016666666666666666 * (l ^ 5.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]}, Block[{t$95$1 = N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -20.0], N[Not[LessEqual[t$95$1, 2e-9]], $MachinePrecision]], N[(N[(N[(t$95$1 * J), $MachinePrecision] * t$95$0), $MachinePrecision] + U), $MachinePrecision], N[(U + N[(t$95$0 * N[(J * N[(N[(0.3333333333333333 * N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision] + N[(N[(0.0003968253968253968 * N[Power[l, 7.0], $MachinePrecision]), $MachinePrecision] + N[(N[(0.016666666666666666 * N[Power[l, 5.0], $MachinePrecision]), $MachinePrecision] + N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
t_1 := e^{\ell} - e^{-\ell}\\
\mathbf{if}\;t_1 \leq -20 \lor \neg \left(t_1 \leq 2 \cdot 10^{-9}\right):\\
\;\;\;\;\left(t_1 \cdot J\right) \cdot t_0 + U\\
\mathbf{else}:\\
\;\;\;\;U + t_0 \cdot \left(J \cdot \left(0.3333333333333333 \cdot {\ell}^{3} + \left(0.0003968253968253968 \cdot {\ell}^{7} + \left(0.016666666666666666 \cdot {\ell}^{5} + \ell \cdot 2\right)\right)\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -20 or 2.00000000000000012e-9 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 100.0%
if -20 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 2.00000000000000012e-9Initial program 68.8%
Taylor expanded in l around 0 99.9%
Final simplification99.9%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))) (t_1 (- (exp l) (exp (- l)))))
(if (or (<= t_1 -0.05) (not (<= t_1 2e-9)))
(+ (* (* t_1 J) t_0) U)
(+ U (* t_0 (* J (* l (+ 2.0 (* l (* l 0.3333333333333333))))))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double t_1 = exp(l) - exp(-l);
double tmp;
if ((t_1 <= -0.05) || !(t_1 <= 2e-9)) {
tmp = ((t_1 * J) * t_0) + U;
} else {
tmp = U + (t_0 * (J * (l * (2.0 + (l * (l * 0.3333333333333333))))));
}
return tmp;
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = cos((k / 2.0d0))
t_1 = exp(l) - exp(-l)
if ((t_1 <= (-0.05d0)) .or. (.not. (t_1 <= 2d-9))) then
tmp = ((t_1 * j) * t_0) + u
else
tmp = u + (t_0 * (j * (l * (2.0d0 + (l * (l * 0.3333333333333333d0))))))
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = Math.cos((K / 2.0));
double t_1 = Math.exp(l) - Math.exp(-l);
double tmp;
if ((t_1 <= -0.05) || !(t_1 <= 2e-9)) {
tmp = ((t_1 * J) * t_0) + U;
} else {
tmp = U + (t_0 * (J * (l * (2.0 + (l * (l * 0.3333333333333333))))));
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K / 2.0)) t_1 = math.exp(l) - math.exp(-l) tmp = 0 if (t_1 <= -0.05) or not (t_1 <= 2e-9): tmp = ((t_1 * J) * t_0) + U else: tmp = U + (t_0 * (J * (l * (2.0 + (l * (l * 0.3333333333333333)))))) return tmp
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) t_1 = Float64(exp(l) - exp(Float64(-l))) tmp = 0.0 if ((t_1 <= -0.05) || !(t_1 <= 2e-9)) tmp = Float64(Float64(Float64(t_1 * J) * t_0) + U); else tmp = Float64(U + Float64(t_0 * Float64(J * Float64(l * Float64(2.0 + Float64(l * Float64(l * 0.3333333333333333))))))); end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = cos((K / 2.0)); t_1 = exp(l) - exp(-l); tmp = 0.0; if ((t_1 <= -0.05) || ~((t_1 <= 2e-9))) tmp = ((t_1 * J) * t_0) + U; else tmp = U + (t_0 * (J * (l * (2.0 + (l * (l * 0.3333333333333333)))))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -0.05], N[Not[LessEqual[t$95$1, 2e-9]], $MachinePrecision]], N[(N[(N[(t$95$1 * J), $MachinePrecision] * t$95$0), $MachinePrecision] + U), $MachinePrecision], N[(U + N[(t$95$0 * N[(J * N[(l * N[(2.0 + N[(l * N[(l * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
t_1 := e^{\ell} - e^{-\ell}\\
\mathbf{if}\;t_1 \leq -0.05 \lor \neg \left(t_1 \leq 2 \cdot 10^{-9}\right):\\
\;\;\;\;\left(t_1 \cdot J\right) \cdot t_0 + U\\
\mathbf{else}:\\
\;\;\;\;U + t_0 \cdot \left(J \cdot \left(\ell \cdot \left(2 + \ell \cdot \left(\ell \cdot 0.3333333333333333\right)\right)\right)\right)\\
\end{array}
\end{array}
if (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < -0.050000000000000003 or 2.00000000000000012e-9 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) Initial program 100.0%
if -0.050000000000000003 < (-.f64 (exp.f64 l) (exp.f64 (neg.f64 l))) < 2.00000000000000012e-9Initial program 68.6%
Taylor expanded in l around 0 99.9%
Taylor expanded in l around 0 99.9%
+-commutative99.9%
associate-*r*99.9%
associate-*r*99.9%
distribute-rgt-out99.9%
*-commutative99.9%
cube-mult99.9%
associate-*l*99.9%
*-commutative99.9%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in l around 0 99.9%
unpow299.9%
*-commutative99.9%
associate-*r*99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (+ (* (- (exp l) (exp (- l))) J) U))
(t_1 (cos (/ K 2.0)))
(t_2 (+ U (* t_1 (* J (* l (+ 2.0 (* l (* l 0.3333333333333333))))))))
(t_3 (* 0.3333333333333333 (* l (* l l)))))
(if (<= l -8.2e+97)
t_2
(if (<= l -0.032)
t_0
(if (<= l 0.0065)
t_2
(if (<= l 3.5e+51)
t_0
(if (<= l 5.5e+102)
(+
U
(*
t_1
(*
J
(/
(- (* t_3 t_3) (* (* l 2.0) (* l 2.0)))
(- t_3 (* l 2.0))))))
t_2)))))))
double code(double J, double l, double K, double U) {
double t_0 = ((exp(l) - exp(-l)) * J) + U;
double t_1 = cos((K / 2.0));
double t_2 = U + (t_1 * (J * (l * (2.0 + (l * (l * 0.3333333333333333))))));
double t_3 = 0.3333333333333333 * (l * (l * l));
double tmp;
if (l <= -8.2e+97) {
tmp = t_2;
} else if (l <= -0.032) {
tmp = t_0;
} else if (l <= 0.0065) {
tmp = t_2;
} else if (l <= 3.5e+51) {
tmp = t_0;
} else if (l <= 5.5e+102) {
tmp = U + (t_1 * (J * (((t_3 * t_3) - ((l * 2.0) * (l * 2.0))) / (t_3 - (l * 2.0)))));
} else {
tmp = t_2;
}
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) :: t_3
real(8) :: tmp
t_0 = ((exp(l) - exp(-l)) * j) + u
t_1 = cos((k / 2.0d0))
t_2 = u + (t_1 * (j * (l * (2.0d0 + (l * (l * 0.3333333333333333d0))))))
t_3 = 0.3333333333333333d0 * (l * (l * l))
if (l <= (-8.2d+97)) then
tmp = t_2
else if (l <= (-0.032d0)) then
tmp = t_0
else if (l <= 0.0065d0) then
tmp = t_2
else if (l <= 3.5d+51) then
tmp = t_0
else if (l <= 5.5d+102) then
tmp = u + (t_1 * (j * (((t_3 * t_3) - ((l * 2.0d0) * (l * 2.0d0))) / (t_3 - (l * 2.0d0)))))
else
tmp = t_2
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double t_0 = ((Math.exp(l) - Math.exp(-l)) * J) + U;
double t_1 = Math.cos((K / 2.0));
double t_2 = U + (t_1 * (J * (l * (2.0 + (l * (l * 0.3333333333333333))))));
double t_3 = 0.3333333333333333 * (l * (l * l));
double tmp;
if (l <= -8.2e+97) {
tmp = t_2;
} else if (l <= -0.032) {
tmp = t_0;
} else if (l <= 0.0065) {
tmp = t_2;
} else if (l <= 3.5e+51) {
tmp = t_0;
} else if (l <= 5.5e+102) {
tmp = U + (t_1 * (J * (((t_3 * t_3) - ((l * 2.0) * (l * 2.0))) / (t_3 - (l * 2.0)))));
} else {
tmp = t_2;
}
return tmp;
}
def code(J, l, K, U): t_0 = ((math.exp(l) - math.exp(-l)) * J) + U t_1 = math.cos((K / 2.0)) t_2 = U + (t_1 * (J * (l * (2.0 + (l * (l * 0.3333333333333333)))))) t_3 = 0.3333333333333333 * (l * (l * l)) tmp = 0 if l <= -8.2e+97: tmp = t_2 elif l <= -0.032: tmp = t_0 elif l <= 0.0065: tmp = t_2 elif l <= 3.5e+51: tmp = t_0 elif l <= 5.5e+102: tmp = U + (t_1 * (J * (((t_3 * t_3) - ((l * 2.0) * (l * 2.0))) / (t_3 - (l * 2.0))))) else: tmp = t_2 return tmp
function code(J, l, K, U) t_0 = Float64(Float64(Float64(exp(l) - exp(Float64(-l))) * J) + U) t_1 = cos(Float64(K / 2.0)) t_2 = Float64(U + Float64(t_1 * Float64(J * Float64(l * Float64(2.0 + Float64(l * Float64(l * 0.3333333333333333))))))) t_3 = Float64(0.3333333333333333 * Float64(l * Float64(l * l))) tmp = 0.0 if (l <= -8.2e+97) tmp = t_2; elseif (l <= -0.032) tmp = t_0; elseif (l <= 0.0065) tmp = t_2; elseif (l <= 3.5e+51) tmp = t_0; elseif (l <= 5.5e+102) tmp = Float64(U + Float64(t_1 * Float64(J * Float64(Float64(Float64(t_3 * t_3) - Float64(Float64(l * 2.0) * Float64(l * 2.0))) / Float64(t_3 - Float64(l * 2.0)))))); else tmp = t_2; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = ((exp(l) - exp(-l)) * J) + U; t_1 = cos((K / 2.0)); t_2 = U + (t_1 * (J * (l * (2.0 + (l * (l * 0.3333333333333333)))))); t_3 = 0.3333333333333333 * (l * (l * l)); tmp = 0.0; if (l <= -8.2e+97) tmp = t_2; elseif (l <= -0.032) tmp = t_0; elseif (l <= 0.0065) tmp = t_2; elseif (l <= 3.5e+51) tmp = t_0; elseif (l <= 5.5e+102) tmp = U + (t_1 * (J * (((t_3 * t_3) - ((l * 2.0) * (l * 2.0))) / (t_3 - (l * 2.0))))); else tmp = t_2; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := Block[{t$95$0 = N[(N[(N[(N[Exp[l], $MachinePrecision] - N[Exp[(-l)], $MachinePrecision]), $MachinePrecision] * J), $MachinePrecision] + U), $MachinePrecision]}, Block[{t$95$1 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(U + N[(t$95$1 * N[(J * N[(l * N[(2.0 + N[(l * N[(l * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(0.3333333333333333 * N[(l * N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -8.2e+97], t$95$2, If[LessEqual[l, -0.032], t$95$0, If[LessEqual[l, 0.0065], t$95$2, If[LessEqual[l, 3.5e+51], t$95$0, If[LessEqual[l, 5.5e+102], N[(U + N[(t$95$1 * N[(J * N[(N[(N[(t$95$3 * t$95$3), $MachinePrecision] - N[(N[(l * 2.0), $MachinePrecision] * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$3 - N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$2]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(e^{\ell} - e^{-\ell}\right) \cdot J + U\\
t_1 := \cos \left(\frac{K}{2}\right)\\
t_2 := U + t_1 \cdot \left(J \cdot \left(\ell \cdot \left(2 + \ell \cdot \left(\ell \cdot 0.3333333333333333\right)\right)\right)\right)\\
t_3 := 0.3333333333333333 \cdot \left(\ell \cdot \left(\ell \cdot \ell\right)\right)\\
\mathbf{if}\;\ell \leq -8.2 \cdot 10^{+97}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\ell \leq -0.032:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq 0.0065:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\ell \leq 3.5 \cdot 10^{+51}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq 5.5 \cdot 10^{+102}:\\
\;\;\;\;U + t_1 \cdot \left(J \cdot \frac{t_3 \cdot t_3 - \left(\ell \cdot 2\right) \cdot \left(\ell \cdot 2\right)}{t_3 - \ell \cdot 2}\right)\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if l < -8.19999999999999977e97 or -0.032000000000000001 < l < 0.0064999999999999997 or 5.49999999999999981e102 < l Initial program 80.3%
Taylor expanded in l around 0 99.9%
Taylor expanded in l around 0 99.5%
+-commutative99.5%
associate-*r*99.5%
associate-*r*99.5%
distribute-rgt-out99.5%
*-commutative99.5%
cube-mult99.5%
associate-*l*99.5%
*-commutative99.5%
distribute-lft-out99.5%
Simplified99.5%
Taylor expanded in l around 0 99.5%
unpow299.5%
*-commutative99.5%
associate-*r*99.5%
Simplified99.5%
if -8.19999999999999977e97 < l < -0.032000000000000001 or 0.0064999999999999997 < l < 3.5e51Initial program 99.8%
Taylor expanded in K around 0 82.6%
if 3.5e51 < l < 5.49999999999999981e102Initial program 100.0%
Taylor expanded in l around 0 100.0%
Taylor expanded in l around 0 40.2%
+-commutative40.2%
associate-*r*40.2%
associate-*r*40.2%
distribute-rgt-out40.2%
*-commutative40.2%
cube-mult40.2%
associate-*l*40.2%
*-commutative40.2%
distribute-lft-out40.2%
Simplified40.2%
distribute-lft-in40.2%
flip-+100.0%
associate-*r*100.0%
associate-*r*100.0%
associate-*r*100.0%
Applied egg-rr100.0%
Final simplification97.6%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.9) (+ U (* (* l J) (+ 2.0 (* (* K K) -0.25)))) (+ U (* 2.0 (* l (* J (cos (* K 0.5))))))))
double code(double J, double l, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= -0.9) {
tmp = U + ((l * J) * (2.0 + ((K * K) * -0.25)));
} 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 (cos((k / 2.0d0)) <= (-0.9d0)) then
tmp = u + ((l * j) * (2.0d0 + ((k * k) * (-0.25d0))))
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 (Math.cos((K / 2.0)) <= -0.9) {
tmp = U + ((l * J) * (2.0 + ((K * K) * -0.25)));
} else {
tmp = U + (2.0 * (l * (J * Math.cos((K * 0.5)))));
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if math.cos((K / 2.0)) <= -0.9: tmp = U + ((l * J) * (2.0 + ((K * K) * -0.25))) else: tmp = U + (2.0 * (l * (J * math.cos((K * 0.5))))) return tmp
function code(J, l, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= -0.9) 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 * Float64(J * cos(Float64(K * 0.5)))))); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (cos((K / 2.0)) <= -0.9) tmp = U + ((l * J) * (2.0 + ((K * K) * -0.25))); else tmp = U + (2.0 * (l * (J * cos((K * 0.5))))); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.9], 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 * N[(J * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq -0.9:\\
\;\;\;\;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 \left(J \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K 2)) < -0.900000000000000022Initial program 93.3%
Taylor expanded in l around 0 43.5%
associate-*r*43.5%
*-commutative43.5%
associate-*l*43.5%
Simplified43.5%
Taylor expanded in K around 0 63.5%
associate-*r*63.5%
distribute-rgt-out68.7%
*-commutative68.7%
unpow268.7%
Simplified68.7%
if -0.900000000000000022 < (cos.f64 (/.f64 K 2)) Initial program 83.0%
Taylor expanded in l around 0 66.6%
associate-*r*66.6%
*-commutative66.6%
associate-*l*66.6%
Simplified66.6%
Final simplification66.8%
(FPCore (J l K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0)))
(t_1 (+ U (* t_0 (* J (* l (+ 2.0 (* l (* l 0.3333333333333333))))))))
(t_2 (* 0.3333333333333333 (* l (* l l))))
(t_3
(+
U
(*
t_0
(*
J
(/ (- (* t_2 t_2) (* (* l 2.0) (* l 2.0))) (- t_2 (* l 2.0))))))))
(if (<= l -5.6e+102)
t_1
(if (<= l -5e-109)
t_3
(if (<= l 1e-21)
(+ U (* 2.0 (* l (* J (cos (* K 0.5))))))
(if (<= l 5.5e+102) t_3 t_1))))))
double code(double J, double l, double K, double U) {
double t_0 = cos((K / 2.0));
double t_1 = U + (t_0 * (J * (l * (2.0 + (l * (l * 0.3333333333333333))))));
double t_2 = 0.3333333333333333 * (l * (l * l));
double t_3 = U + (t_0 * (J * (((t_2 * t_2) - ((l * 2.0) * (l * 2.0))) / (t_2 - (l * 2.0)))));
double tmp;
if (l <= -5.6e+102) {
tmp = t_1;
} else if (l <= -5e-109) {
tmp = t_3;
} else if (l <= 1e-21) {
tmp = U + (2.0 * (l * (J * cos((K * 0.5)))));
} else if (l <= 5.5e+102) {
tmp = t_3;
} 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) :: t_3
real(8) :: tmp
t_0 = cos((k / 2.0d0))
t_1 = u + (t_0 * (j * (l * (2.0d0 + (l * (l * 0.3333333333333333d0))))))
t_2 = 0.3333333333333333d0 * (l * (l * l))
t_3 = u + (t_0 * (j * (((t_2 * t_2) - ((l * 2.0d0) * (l * 2.0d0))) / (t_2 - (l * 2.0d0)))))
if (l <= (-5.6d+102)) then
tmp = t_1
else if (l <= (-5d-109)) then
tmp = t_3
else if (l <= 1d-21) then
tmp = u + (2.0d0 * (l * (j * cos((k * 0.5d0)))))
else if (l <= 5.5d+102) then
tmp = t_3
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 / 2.0));
double t_1 = U + (t_0 * (J * (l * (2.0 + (l * (l * 0.3333333333333333))))));
double t_2 = 0.3333333333333333 * (l * (l * l));
double t_3 = U + (t_0 * (J * (((t_2 * t_2) - ((l * 2.0) * (l * 2.0))) / (t_2 - (l * 2.0)))));
double tmp;
if (l <= -5.6e+102) {
tmp = t_1;
} else if (l <= -5e-109) {
tmp = t_3;
} else if (l <= 1e-21) {
tmp = U + (2.0 * (l * (J * Math.cos((K * 0.5)))));
} else if (l <= 5.5e+102) {
tmp = t_3;
} else {
tmp = t_1;
}
return tmp;
}
def code(J, l, K, U): t_0 = math.cos((K / 2.0)) t_1 = U + (t_0 * (J * (l * (2.0 + (l * (l * 0.3333333333333333)))))) t_2 = 0.3333333333333333 * (l * (l * l)) t_3 = U + (t_0 * (J * (((t_2 * t_2) - ((l * 2.0) * (l * 2.0))) / (t_2 - (l * 2.0))))) tmp = 0 if l <= -5.6e+102: tmp = t_1 elif l <= -5e-109: tmp = t_3 elif l <= 1e-21: tmp = U + (2.0 * (l * (J * math.cos((K * 0.5))))) elif l <= 5.5e+102: tmp = t_3 else: tmp = t_1 return tmp
function code(J, l, K, U) t_0 = cos(Float64(K / 2.0)) t_1 = Float64(U + Float64(t_0 * Float64(J * Float64(l * Float64(2.0 + Float64(l * Float64(l * 0.3333333333333333))))))) t_2 = Float64(0.3333333333333333 * Float64(l * Float64(l * l))) t_3 = Float64(U + Float64(t_0 * Float64(J * Float64(Float64(Float64(t_2 * t_2) - Float64(Float64(l * 2.0) * Float64(l * 2.0))) / Float64(t_2 - Float64(l * 2.0)))))) tmp = 0.0 if (l <= -5.6e+102) tmp = t_1; elseif (l <= -5e-109) tmp = t_3; elseif (l <= 1e-21) tmp = Float64(U + Float64(2.0 * Float64(l * Float64(J * cos(Float64(K * 0.5)))))); elseif (l <= 5.5e+102) tmp = t_3; else tmp = t_1; end return tmp end
function tmp_2 = code(J, l, K, U) t_0 = cos((K / 2.0)); t_1 = U + (t_0 * (J * (l * (2.0 + (l * (l * 0.3333333333333333)))))); t_2 = 0.3333333333333333 * (l * (l * l)); t_3 = U + (t_0 * (J * (((t_2 * t_2) - ((l * 2.0) * (l * 2.0))) / (t_2 - (l * 2.0))))); tmp = 0.0; if (l <= -5.6e+102) tmp = t_1; elseif (l <= -5e-109) tmp = t_3; elseif (l <= 1e-21) tmp = U + (2.0 * (l * (J * cos((K * 0.5))))); elseif (l <= 5.5e+102) tmp = t_3; else tmp = t_1; 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[(U + N[(t$95$0 * N[(J * N[(l * N[(2.0 + N[(l * N[(l * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(0.3333333333333333 * N[(l * N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(U + N[(t$95$0 * N[(J * N[(N[(N[(t$95$2 * t$95$2), $MachinePrecision] - N[(N[(l * 2.0), $MachinePrecision] * N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$2 - N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -5.6e+102], t$95$1, If[LessEqual[l, -5e-109], t$95$3, If[LessEqual[l, 1e-21], N[(U + N[(2.0 * N[(l * N[(J * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 5.5e+102], t$95$3, t$95$1]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
t_1 := U + t_0 \cdot \left(J \cdot \left(\ell \cdot \left(2 + \ell \cdot \left(\ell \cdot 0.3333333333333333\right)\right)\right)\right)\\
t_2 := 0.3333333333333333 \cdot \left(\ell \cdot \left(\ell \cdot \ell\right)\right)\\
t_3 := U + t_0 \cdot \left(J \cdot \frac{t_2 \cdot t_2 - \left(\ell \cdot 2\right) \cdot \left(\ell \cdot 2\right)}{t_2 - \ell \cdot 2}\right)\\
\mathbf{if}\;\ell \leq -5.6 \cdot 10^{+102}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\ell \leq -5 \cdot 10^{-109}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;\ell \leq 10^{-21}:\\
\;\;\;\;U + 2 \cdot \left(\ell \cdot \left(J \cdot \cos \left(K \cdot 0.5\right)\right)\right)\\
\mathbf{elif}\;\ell \leq 5.5 \cdot 10^{+102}:\\
\;\;\;\;t_3\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if l < -5.60000000000000037e102 or 5.49999999999999981e102 < l Initial program 100.0%
Taylor expanded in l around 0 100.0%
Taylor expanded in l around 0 100.0%
+-commutative100.0%
associate-*r*100.0%
associate-*r*100.0%
distribute-rgt-out100.0%
*-commutative100.0%
cube-mult100.0%
associate-*l*100.0%
*-commutative100.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in l around 0 100.0%
unpow2100.0%
*-commutative100.0%
associate-*r*100.0%
Simplified100.0%
if -5.60000000000000037e102 < l < -5.0000000000000002e-109 or 9.99999999999999908e-22 < l < 5.49999999999999981e102Initial program 86.1%
Taylor expanded in l around 0 87.2%
Taylor expanded in l around 0 60.8%
+-commutative60.8%
associate-*r*60.8%
associate-*r*60.8%
distribute-rgt-out60.8%
*-commutative60.8%
cube-mult60.8%
associate-*l*60.8%
*-commutative60.8%
distribute-lft-out60.8%
Simplified60.8%
distribute-lft-in60.8%
flip-+81.6%
associate-*r*81.6%
associate-*r*81.6%
associate-*r*81.6%
Applied egg-rr81.6%
if -5.0000000000000002e-109 < l < 9.99999999999999908e-22Initial program 69.3%
Taylor expanded in l around 0 99.9%
associate-*r*99.9%
*-commutative99.9%
associate-*l*99.9%
Simplified99.9%
Final simplification94.4%
(FPCore (J l K U) :precision binary64 (+ U (* (cos (/ K 2.0)) (* J (+ (* 0.3333333333333333 (* l (* l l))) (* l 2.0))))))
double code(double J, double l, double K, double U) {
return U + (cos((K / 2.0)) * (J * ((0.3333333333333333 * (l * (l * l))) + (l * 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)) * (j * ((0.3333333333333333d0 * (l * (l * l))) + (l * 2.0d0))))
end function
public static double code(double J, double l, double K, double U) {
return U + (Math.cos((K / 2.0)) * (J * ((0.3333333333333333 * (l * (l * l))) + (l * 2.0))));
}
def code(J, l, K, U): return U + (math.cos((K / 2.0)) * (J * ((0.3333333333333333 * (l * (l * l))) + (l * 2.0))))
function code(J, l, K, U) return Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(J * Float64(Float64(0.3333333333333333 * Float64(l * Float64(l * l))) + Float64(l * 2.0))))) end
function tmp = code(J, l, K, U) tmp = U + (cos((K / 2.0)) * (J * ((0.3333333333333333 * (l * (l * l))) + (l * 2.0)))); end
code[J_, l_, K_, U_] := N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(J * N[(N[(0.3333333333333333 * N[(l * N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(l * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(0.3333333333333333 \cdot \left(\ell \cdot \left(\ell \cdot \ell\right)\right) + \ell \cdot 2\right)\right)
\end{array}
Initial program 83.8%
Taylor expanded in l around 0 96.1%
Taylor expanded in l around 0 88.0%
+-commutative88.0%
associate-*r*88.0%
associate-*r*88.0%
distribute-rgt-out88.0%
*-commutative88.0%
cube-mult88.0%
associate-*l*88.0%
*-commutative88.0%
distribute-lft-out88.0%
Simplified88.0%
distribute-lft-in88.0%
associate-*r*88.0%
Applied egg-rr88.0%
Final simplification88.0%
(FPCore (J l K U) :precision binary64 (if (<= (cos (/ K 2.0)) -0.005) (+ 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 (cos((K / 2.0)) <= -0.005) {
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 (cos((k / 2.0d0)) <= (-0.005d0)) 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 (Math.cos((K / 2.0)) <= -0.005) {
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 math.cos((K / 2.0)) <= -0.005: 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 (cos(Float64(K / 2.0)) <= -0.005) 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 (cos((K / 2.0)) <= -0.005) 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[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], -0.005], 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}\;\cos \left(\frac{K}{2}\right) \leq -0.005:\\
\;\;\;\;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 (cos.f64 (/.f64 K 2)) < -0.0050000000000000001Initial program 85.3%
Taylor expanded in l around 0 67.9%
associate-*r*67.9%
*-commutative67.9%
associate-*l*67.9%
Simplified67.9%
Taylor expanded in K around 0 33.8%
associate-*r*33.8%
distribute-rgt-out50.4%
*-commutative50.4%
unpow250.4%
Simplified50.4%
if -0.0050000000000000001 < (cos.f64 (/.f64 K 2)) Initial program 83.2%
Taylor expanded in l around 0 63.9%
associate-*r*63.8%
*-commutative63.8%
associate-*l*63.9%
Simplified63.9%
Taylor expanded in K around 0 57.7%
Final simplification55.9%
(FPCore (J l K U) :precision binary64 (+ U (* (cos (/ K 2.0)) (* J (* l (+ 2.0 (* l (* l 0.3333333333333333))))))))
double code(double J, double l, double K, double U) {
return U + (cos((K / 2.0)) * (J * (l * (2.0 + (l * (l * 0.3333333333333333))))));
}
real(8) function code(j, l, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: l
real(8), intent (in) :: k
real(8), intent (in) :: u
code = u + (cos((k / 2.0d0)) * (j * (l * (2.0d0 + (l * (l * 0.3333333333333333d0))))))
end function
public static double code(double J, double l, double K, double U) {
return U + (Math.cos((K / 2.0)) * (J * (l * (2.0 + (l * (l * 0.3333333333333333))))));
}
def code(J, l, K, U): return U + (math.cos((K / 2.0)) * (J * (l * (2.0 + (l * (l * 0.3333333333333333))))))
function code(J, l, K, U) return Float64(U + Float64(cos(Float64(K / 2.0)) * Float64(J * Float64(l * Float64(2.0 + Float64(l * Float64(l * 0.3333333333333333))))))) end
function tmp = code(J, l, K, U) tmp = U + (cos((K / 2.0)) * (J * (l * (2.0 + (l * (l * 0.3333333333333333)))))); end
code[J_, l_, K_, U_] := N[(U + N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(J * N[(l * N[(2.0 + N[(l * N[(l * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
U + \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \left(\ell \cdot \left(2 + \ell \cdot \left(\ell \cdot 0.3333333333333333\right)\right)\right)\right)
\end{array}
Initial program 83.8%
Taylor expanded in l around 0 96.1%
Taylor expanded in l around 0 88.0%
+-commutative88.0%
associate-*r*88.0%
associate-*r*88.0%
distribute-rgt-out88.0%
*-commutative88.0%
cube-mult88.0%
associate-*l*88.0%
*-commutative88.0%
distribute-lft-out88.0%
Simplified88.0%
Taylor expanded in l around 0 88.0%
unpow288.0%
*-commutative88.0%
associate-*r*88.0%
Simplified88.0%
Final simplification88.0%
(FPCore (J l K U) :precision binary64 (if (or (<= l -920.0) (not (<= l 1.9e+64))) (- -8.0 (* U U)) U))
double code(double J, double l, double K, double U) {
double tmp;
if ((l <= -920.0) || !(l <= 1.9e+64)) {
tmp = -8.0 - (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 <= (-920.0d0)) .or. (.not. (l <= 1.9d+64))) then
tmp = (-8.0d0) - (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 <= -920.0) || !(l <= 1.9e+64)) {
tmp = -8.0 - (U * U);
} else {
tmp = U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if (l <= -920.0) or not (l <= 1.9e+64): tmp = -8.0 - (U * U) else: tmp = U return tmp
function code(J, l, K, U) tmp = 0.0 if ((l <= -920.0) || !(l <= 1.9e+64)) tmp = Float64(-8.0 - Float64(U * U)); else tmp = U; end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if ((l <= -920.0) || ~((l <= 1.9e+64))) tmp = -8.0 - (U * U); else tmp = U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[Or[LessEqual[l, -920.0], N[Not[LessEqual[l, 1.9e+64]], $MachinePrecision]], N[(-8.0 - N[(U * U), $MachinePrecision]), $MachinePrecision], U]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -920 \lor \neg \left(\ell \leq 1.9 \cdot 10^{+64}\right):\\
\;\;\;\;-8 - U \cdot U\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\end{array}
if l < -920 or 1.9000000000000001e64 < l Initial program 100.0%
associate-*l*100.0%
fma-def100.0%
Simplified100.0%
Applied egg-rr22.5%
cancel-sign-sub-inv22.5%
Simplified22.5%
if -920 < l < 1.9000000000000001e64Initial program 72.5%
Taylor expanded in J around 0 59.1%
Final simplification44.1%
(FPCore (J l K U) :precision binary64 (if (<= l 1.35e+64) (+ U (* 2.0 (* l J))) (- -8.0 (* U U))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= 1.35e+64) {
tmp = U + (2.0 * (l * J));
} else {
tmp = -8.0 - (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 <= 1.35d+64) then
tmp = u + (2.0d0 * (l * j))
else
tmp = (-8.0d0) - (u * u)
end if
code = tmp
end function
public static double code(double J, double l, double K, double U) {
double tmp;
if (l <= 1.35e+64) {
tmp = U + (2.0 * (l * J));
} else {
tmp = -8.0 - (U * U);
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= 1.35e+64: tmp = U + (2.0 * (l * J)) else: tmp = -8.0 - (U * U) return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= 1.35e+64) tmp = Float64(U + Float64(2.0 * Float64(l * J))); else tmp = Float64(-8.0 - Float64(U * U)); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= 1.35e+64) tmp = U + (2.0 * (l * J)); else tmp = -8.0 - (U * U); end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, 1.35e+64], N[(U + N[(2.0 * N[(l * J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-8.0 - N[(U * U), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 1.35 \cdot 10^{+64}:\\
\;\;\;\;U + 2 \cdot \left(\ell \cdot J\right)\\
\mathbf{else}:\\
\;\;\;\;-8 - U \cdot U\\
\end{array}
\end{array}
if l < 1.35e64Initial program 79.9%
Taylor expanded in l around 0 73.4%
associate-*r*73.4%
*-commutative73.4%
associate-*l*73.4%
Simplified73.4%
Taylor expanded in K around 0 61.0%
if 1.35e64 < l Initial program 100.0%
associate-*l*100.0%
fma-def100.0%
Simplified100.0%
Applied egg-rr24.0%
cancel-sign-sub-inv24.0%
Simplified24.0%
Final simplification53.9%
(FPCore (J l K U) :precision binary64 (if (<= l -1.12e+29) (* U U) (if (<= l 6.4e+22) U (* U U))))
double code(double J, double l, double K, double U) {
double tmp;
if (l <= -1.12e+29) {
tmp = U * U;
} else if (l <= 6.4e+22) {
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 <= (-1.12d+29)) then
tmp = u * u
else if (l <= 6.4d+22) 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 <= -1.12e+29) {
tmp = U * U;
} else if (l <= 6.4e+22) {
tmp = U;
} else {
tmp = U * U;
}
return tmp;
}
def code(J, l, K, U): tmp = 0 if l <= -1.12e+29: tmp = U * U elif l <= 6.4e+22: tmp = U else: tmp = U * U return tmp
function code(J, l, K, U) tmp = 0.0 if (l <= -1.12e+29) tmp = Float64(U * U); elseif (l <= 6.4e+22) tmp = U; else tmp = Float64(U * U); end return tmp end
function tmp_2 = code(J, l, K, U) tmp = 0.0; if (l <= -1.12e+29) tmp = U * U; elseif (l <= 6.4e+22) tmp = U; else tmp = U * U; end tmp_2 = tmp; end
code[J_, l_, K_, U_] := If[LessEqual[l, -1.12e+29], N[(U * U), $MachinePrecision], If[LessEqual[l, 6.4e+22], U, N[(U * U), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.12 \cdot 10^{+29}:\\
\;\;\;\;U \cdot U\\
\mathbf{elif}\;\ell \leq 6.4 \cdot 10^{+22}:\\
\;\;\;\;U\\
\mathbf{else}:\\
\;\;\;\;U \cdot U\\
\end{array}
\end{array}
if l < -1.1200000000000001e29 or 6.4e22 < l Initial program 100.0%
Applied egg-rr11.2%
if -1.1200000000000001e29 < l < 6.4e22Initial program 71.2%
Taylor expanded in J around 0 61.9%
Final simplification39.7%
(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.8%
Applied egg-rr2.9%
*-inverses2.9%
Simplified2.9%
Final simplification2.9%
(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.8%
Taylor expanded in J around 0 35.8%
Final simplification35.8%
herbie shell --seed 2023207
(FPCore (J l K U)
:name "Maksimov and Kolovsky, Equation (4)"
:precision binary64
(+ (* (* J (- (exp l) (exp (- l)))) (cos (/ K 2.0))) U))