
(FPCore (J K U) :precision binary64 (let* ((t_0 (cos (/ K 2.0)))) (* (* (* -2.0 J) t_0) (sqrt (+ 1.0 (pow (/ U (* (* 2.0 J) t_0)) 2.0))))))
double code(double J, double K, double U) {
double t_0 = cos((K / 2.0));
return ((-2.0 * J) * t_0) * sqrt((1.0 + pow((U / ((2.0 * J) * t_0)), 2.0)));
}
real(8) function code(j, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: t_0
t_0 = cos((k / 2.0d0))
code = (((-2.0d0) * j) * t_0) * sqrt((1.0d0 + ((u / ((2.0d0 * j) * t_0)) ** 2.0d0)))
end function
public static double code(double J, double K, double U) {
double t_0 = Math.cos((K / 2.0));
return ((-2.0 * J) * t_0) * Math.sqrt((1.0 + Math.pow((U / ((2.0 * J) * t_0)), 2.0)));
}
def code(J, K, U): t_0 = math.cos((K / 2.0)) return ((-2.0 * J) * t_0) * math.sqrt((1.0 + math.pow((U / ((2.0 * J) * t_0)), 2.0)))
function code(J, K, U) t_0 = cos(Float64(K / 2.0)) return Float64(Float64(Float64(-2.0 * J) * t_0) * sqrt(Float64(1.0 + (Float64(U / Float64(Float64(2.0 * J) * t_0)) ^ 2.0)))) end
function tmp = code(J, K, U) t_0 = cos((K / 2.0)); tmp = ((-2.0 * J) * t_0) * sqrt((1.0 + ((U / ((2.0 * J) * t_0)) ^ 2.0))); end
code[J_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, N[(N[(N[(-2.0 * J), $MachinePrecision] * t$95$0), $MachinePrecision] * N[Sqrt[N[(1.0 + N[Power[N[(U / N[(N[(2.0 * J), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\left(\left(-2 \cdot J\right) \cdot t\_0\right) \cdot \sqrt{1 + {\left(\frac{U}{\left(2 \cdot J\right) \cdot t\_0}\right)}^{2}}
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 17 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (J K U) :precision binary64 (let* ((t_0 (cos (/ K 2.0)))) (* (* (* -2.0 J) t_0) (sqrt (+ 1.0 (pow (/ U (* (* 2.0 J) t_0)) 2.0))))))
double code(double J, double K, double U) {
double t_0 = cos((K / 2.0));
return ((-2.0 * J) * t_0) * sqrt((1.0 + pow((U / ((2.0 * J) * t_0)), 2.0)));
}
real(8) function code(j, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: t_0
t_0 = cos((k / 2.0d0))
code = (((-2.0d0) * j) * t_0) * sqrt((1.0d0 + ((u / ((2.0d0 * j) * t_0)) ** 2.0d0)))
end function
public static double code(double J, double K, double U) {
double t_0 = Math.cos((K / 2.0));
return ((-2.0 * J) * t_0) * Math.sqrt((1.0 + Math.pow((U / ((2.0 * J) * t_0)), 2.0)));
}
def code(J, K, U): t_0 = math.cos((K / 2.0)) return ((-2.0 * J) * t_0) * math.sqrt((1.0 + math.pow((U / ((2.0 * J) * t_0)), 2.0)))
function code(J, K, U) t_0 = cos(Float64(K / 2.0)) return Float64(Float64(Float64(-2.0 * J) * t_0) * sqrt(Float64(1.0 + (Float64(U / Float64(Float64(2.0 * J) * t_0)) ^ 2.0)))) end
function tmp = code(J, K, U) t_0 = cos((K / 2.0)); tmp = ((-2.0 * J) * t_0) * sqrt((1.0 + ((U / ((2.0 * J) * t_0)) ^ 2.0))); end
code[J_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, N[(N[(N[(-2.0 * J), $MachinePrecision] * t$95$0), $MachinePrecision] * N[Sqrt[N[(1.0 + N[Power[N[(U / N[(N[(2.0 * J), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\left(\left(-2 \cdot J\right) \cdot t\_0\right) \cdot \sqrt{1 + {\left(\frac{U}{\left(2 \cdot J\right) \cdot t\_0}\right)}^{2}}
\end{array}
\end{array}
U_m = (fabs.f64 U)
(FPCore (J K U_m)
:precision binary64
(let* ((t_0 (cos (/ K 2.0)))
(t_1
(*
(* (* -2.0 J) t_0)
(sqrt (+ 1.0 (pow (/ U_m (* t_0 (* J 2.0))) 2.0))))))
(if (<= t_1 (- INFINITY))
(- U_m)
(if (<= t_1 5e+300)
t_1
(*
(- U_m)
(fma
-2.0
(* (pow (cos (* K 0.5)) 2.0) (/ (* J J) (* U_m U_m)))
-1.0))))))U_m = fabs(U);
double code(double J, double K, double U_m) {
double t_0 = cos((K / 2.0));
double t_1 = ((-2.0 * J) * t_0) * sqrt((1.0 + pow((U_m / (t_0 * (J * 2.0))), 2.0)));
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = -U_m;
} else if (t_1 <= 5e+300) {
tmp = t_1;
} else {
tmp = -U_m * fma(-2.0, (pow(cos((K * 0.5)), 2.0) * ((J * J) / (U_m * U_m))), -1.0);
}
return tmp;
}
U_m = abs(U) function code(J, K, U_m) t_0 = cos(Float64(K / 2.0)) t_1 = Float64(Float64(Float64(-2.0 * J) * t_0) * sqrt(Float64(1.0 + (Float64(U_m / Float64(t_0 * Float64(J * 2.0))) ^ 2.0)))) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(-U_m); elseif (t_1 <= 5e+300) tmp = t_1; else tmp = Float64(Float64(-U_m) * fma(-2.0, Float64((cos(Float64(K * 0.5)) ^ 2.0) * Float64(Float64(J * J) / Float64(U_m * U_m))), -1.0)); end return tmp end
U_m = N[Abs[U], $MachinePrecision]
code[J_, K_, U$95$m_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(-2.0 * J), $MachinePrecision] * t$95$0), $MachinePrecision] * N[Sqrt[N[(1.0 + N[Power[N[(U$95$m / N[(t$95$0 * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], (-U$95$m), If[LessEqual[t$95$1, 5e+300], t$95$1, N[((-U$95$m) * N[(-2.0 * N[(N[Power[N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(J * J), $MachinePrecision] / N[(U$95$m * U$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
U_m = \left|U\right|
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
t_1 := \left(\left(-2 \cdot J\right) \cdot t\_0\right) \cdot \sqrt{1 + {\left(\frac{U\_m}{t\_0 \cdot \left(J \cdot 2\right)}\right)}^{2}}\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;-U\_m\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+300}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\left(-U\_m\right) \cdot \mathsf{fma}\left(-2, {\cos \left(K \cdot 0.5\right)}^{2} \cdot \frac{J \cdot J}{U\_m \cdot U\_m}, -1\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 (*.f64 #s(literal -2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64)))) (sqrt.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 U (*.f64 (*.f64 #s(literal 2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64))))) #s(literal 2 binary64))))) < -inf.0Initial program 6.3%
Taylor expanded in J around 0
mul-1-negN/A
lower-neg.f6458.3
Applied rewrites58.3%
if -inf.0 < (*.f64 (*.f64 (*.f64 #s(literal -2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64)))) (sqrt.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 U (*.f64 (*.f64 #s(literal 2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64))))) #s(literal 2 binary64))))) < 5.00000000000000026e300Initial program 99.8%
if 5.00000000000000026e300 < (*.f64 (*.f64 (*.f64 #s(literal -2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64)))) (sqrt.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 U (*.f64 (*.f64 #s(literal 2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64))))) #s(literal 2 binary64))))) Initial program 5.5%
Taylor expanded in U around -inf
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6439.5
Applied rewrites39.5%
Final simplification89.4%
U_m = (fabs.f64 U)
(FPCore (J K U_m)
:precision binary64
(let* ((t_0 (cos (/ K 2.0)))
(t_1
(*
(* (* -2.0 J) t_0)
(sqrt (+ 1.0 (pow (/ U_m (* t_0 (* J 2.0))) 2.0)))))
(t_2 (* (* -2.0 J) (cos (* K 0.5)))))
(if (<= t_1 (- INFINITY))
(- U_m)
(if (<= t_1 -1e+160)
t_2
(if (<= t_1 -2e-88)
(* (* -2.0 J) (sqrt (fma 0.25 (/ (* U_m U_m) (* J J)) 1.0)))
(if (<= t_1 -4e-178)
(*
(sqrt (fma 0.25 (/ (* U_m (/ U_m J)) J) 1.0))
(*
(* -2.0 J)
(fma (* K K) (fma (* K K) 0.0026041666666666665 -0.125) 1.0)))
t_2))))))U_m = fabs(U);
double code(double J, double K, double U_m) {
double t_0 = cos((K / 2.0));
double t_1 = ((-2.0 * J) * t_0) * sqrt((1.0 + pow((U_m / (t_0 * (J * 2.0))), 2.0)));
double t_2 = (-2.0 * J) * cos((K * 0.5));
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = -U_m;
} else if (t_1 <= -1e+160) {
tmp = t_2;
} else if (t_1 <= -2e-88) {
tmp = (-2.0 * J) * sqrt(fma(0.25, ((U_m * U_m) / (J * J)), 1.0));
} else if (t_1 <= -4e-178) {
tmp = sqrt(fma(0.25, ((U_m * (U_m / J)) / J), 1.0)) * ((-2.0 * J) * fma((K * K), fma((K * K), 0.0026041666666666665, -0.125), 1.0));
} else {
tmp = t_2;
}
return tmp;
}
U_m = abs(U) function code(J, K, U_m) t_0 = cos(Float64(K / 2.0)) t_1 = Float64(Float64(Float64(-2.0 * J) * t_0) * sqrt(Float64(1.0 + (Float64(U_m / Float64(t_0 * Float64(J * 2.0))) ^ 2.0)))) t_2 = Float64(Float64(-2.0 * J) * cos(Float64(K * 0.5))) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(-U_m); elseif (t_1 <= -1e+160) tmp = t_2; elseif (t_1 <= -2e-88) tmp = Float64(Float64(-2.0 * J) * sqrt(fma(0.25, Float64(Float64(U_m * U_m) / Float64(J * J)), 1.0))); elseif (t_1 <= -4e-178) tmp = Float64(sqrt(fma(0.25, Float64(Float64(U_m * Float64(U_m / J)) / J), 1.0)) * Float64(Float64(-2.0 * J) * fma(Float64(K * K), fma(Float64(K * K), 0.0026041666666666665, -0.125), 1.0))); else tmp = t_2; end return tmp end
U_m = N[Abs[U], $MachinePrecision]
code[J_, K_, U$95$m_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(-2.0 * J), $MachinePrecision] * t$95$0), $MachinePrecision] * N[Sqrt[N[(1.0 + N[Power[N[(U$95$m / N[(t$95$0 * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(-2.0 * J), $MachinePrecision] * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], (-U$95$m), If[LessEqual[t$95$1, -1e+160], t$95$2, If[LessEqual[t$95$1, -2e-88], N[(N[(-2.0 * J), $MachinePrecision] * N[Sqrt[N[(0.25 * N[(N[(U$95$m * U$95$m), $MachinePrecision] / N[(J * J), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, -4e-178], N[(N[Sqrt[N[(0.25 * N[(N[(U$95$m * N[(U$95$m / J), $MachinePrecision]), $MachinePrecision] / J), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision] * N[(N[(-2.0 * J), $MachinePrecision] * N[(N[(K * K), $MachinePrecision] * N[(N[(K * K), $MachinePrecision] * 0.0026041666666666665 + -0.125), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$2]]]]]]]
\begin{array}{l}
U_m = \left|U\right|
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
t_1 := \left(\left(-2 \cdot J\right) \cdot t\_0\right) \cdot \sqrt{1 + {\left(\frac{U\_m}{t\_0 \cdot \left(J \cdot 2\right)}\right)}^{2}}\\
t_2 := \left(-2 \cdot J\right) \cdot \cos \left(K \cdot 0.5\right)\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;-U\_m\\
\mathbf{elif}\;t\_1 \leq -1 \cdot 10^{+160}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq -2 \cdot 10^{-88}:\\
\;\;\;\;\left(-2 \cdot J\right) \cdot \sqrt{\mathsf{fma}\left(0.25, \frac{U\_m \cdot U\_m}{J \cdot J}, 1\right)}\\
\mathbf{elif}\;t\_1 \leq -4 \cdot 10^{-178}:\\
\;\;\;\;\sqrt{\mathsf{fma}\left(0.25, \frac{U\_m \cdot \frac{U\_m}{J}}{J}, 1\right)} \cdot \left(\left(-2 \cdot J\right) \cdot \mathsf{fma}\left(K \cdot K, \mathsf{fma}\left(K \cdot K, 0.0026041666666666665, -0.125\right), 1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (*.f64 (*.f64 (*.f64 #s(literal -2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64)))) (sqrt.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 U (*.f64 (*.f64 #s(literal 2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64))))) #s(literal 2 binary64))))) < -inf.0Initial program 6.3%
Taylor expanded in J around 0
mul-1-negN/A
lower-neg.f6458.3
Applied rewrites58.3%
if -inf.0 < (*.f64 (*.f64 (*.f64 #s(literal -2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64)))) (sqrt.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 U (*.f64 (*.f64 #s(literal 2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64))))) #s(literal 2 binary64))))) < -1.00000000000000001e160 or -3.9999999999999998e-178 < (*.f64 (*.f64 (*.f64 #s(literal -2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64)))) (sqrt.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 U (*.f64 (*.f64 #s(literal 2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64))))) #s(literal 2 binary64))))) Initial program 87.1%
Taylor expanded in J around inf
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-*.f6463.3
Applied rewrites63.3%
if -1.00000000000000001e160 < (*.f64 (*.f64 (*.f64 #s(literal -2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64)))) (sqrt.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 U (*.f64 (*.f64 #s(literal 2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64))))) #s(literal 2 binary64))))) < -1.99999999999999987e-88Initial program 99.8%
Taylor expanded in K around 0
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f6458.4
Applied rewrites58.4%
if -1.99999999999999987e-88 < (*.f64 (*.f64 (*.f64 #s(literal -2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64)))) (sqrt.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 U (*.f64 (*.f64 #s(literal 2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64))))) #s(literal 2 binary64))))) < -3.9999999999999998e-178Initial program 100.0%
Taylor expanded in K around 0
lower-sqrt.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6438.9
Applied rewrites38.9%
Taylor expanded in K around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6428.0
Applied rewrites28.0%
times-fracN/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f6446.6
Applied rewrites46.6%
Final simplification61.2%
U_m = (fabs.f64 U)
(FPCore (J K U_m)
:precision binary64
(let* ((t_0 (cos (/ K 2.0)))
(t_1 (* (* -2.0 J) t_0))
(t_2 (* t_1 (sqrt (+ 1.0 (pow (/ U_m (* t_0 (* J 2.0))) 2.0))))))
(if (<= t_2 (- INFINITY))
(- U_m)
(if (<= t_2 -2e+233)
(* t_1 (sqrt (+ 1.0 (pow (* 0.5 (/ U_m J)) 2.0))))
(if (<= t_2 5e+300)
(*
t_1
(sqrt
(+
1.0
(/
(* U_m (/ U_m (* J 2.0)))
(* (* J 2.0) (fma 0.5 (cos K) 0.5))))))
(*
(- U_m)
(fma
-2.0
(* (pow (cos (* K 0.5)) 2.0) (/ (* J J) (* U_m U_m)))
-1.0)))))))U_m = fabs(U);
double code(double J, double K, double U_m) {
double t_0 = cos((K / 2.0));
double t_1 = (-2.0 * J) * t_0;
double t_2 = t_1 * sqrt((1.0 + pow((U_m / (t_0 * (J * 2.0))), 2.0)));
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = -U_m;
} else if (t_2 <= -2e+233) {
tmp = t_1 * sqrt((1.0 + pow((0.5 * (U_m / J)), 2.0)));
} else if (t_2 <= 5e+300) {
tmp = t_1 * sqrt((1.0 + ((U_m * (U_m / (J * 2.0))) / ((J * 2.0) * fma(0.5, cos(K), 0.5)))));
} else {
tmp = -U_m * fma(-2.0, (pow(cos((K * 0.5)), 2.0) * ((J * J) / (U_m * U_m))), -1.0);
}
return tmp;
}
U_m = abs(U) function code(J, K, U_m) t_0 = cos(Float64(K / 2.0)) t_1 = Float64(Float64(-2.0 * J) * t_0) t_2 = Float64(t_1 * sqrt(Float64(1.0 + (Float64(U_m / Float64(t_0 * Float64(J * 2.0))) ^ 2.0)))) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = Float64(-U_m); elseif (t_2 <= -2e+233) tmp = Float64(t_1 * sqrt(Float64(1.0 + (Float64(0.5 * Float64(U_m / J)) ^ 2.0)))); elseif (t_2 <= 5e+300) tmp = Float64(t_1 * sqrt(Float64(1.0 + Float64(Float64(U_m * Float64(U_m / Float64(J * 2.0))) / Float64(Float64(J * 2.0) * fma(0.5, cos(K), 0.5)))))); else tmp = Float64(Float64(-U_m) * fma(-2.0, Float64((cos(Float64(K * 0.5)) ^ 2.0) * Float64(Float64(J * J) / Float64(U_m * U_m))), -1.0)); end return tmp end
U_m = N[Abs[U], $MachinePrecision]
code[J_, K_, U$95$m_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(-2.0 * J), $MachinePrecision] * t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 * N[Sqrt[N[(1.0 + N[Power[N[(U$95$m / N[(t$95$0 * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], (-U$95$m), If[LessEqual[t$95$2, -2e+233], N[(t$95$1 * N[Sqrt[N[(1.0 + N[Power[N[(0.5 * N[(U$95$m / J), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 5e+300], N[(t$95$1 * N[Sqrt[N[(1.0 + N[(N[(U$95$m * N[(U$95$m / N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(J * 2.0), $MachinePrecision] * N[(0.5 * N[Cos[K], $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[((-U$95$m) * N[(-2.0 * N[(N[Power[N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(J * J), $MachinePrecision] / N[(U$95$m * U$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
U_m = \left|U\right|
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
t_1 := \left(-2 \cdot J\right) \cdot t\_0\\
t_2 := t\_1 \cdot \sqrt{1 + {\left(\frac{U\_m}{t\_0 \cdot \left(J \cdot 2\right)}\right)}^{2}}\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;-U\_m\\
\mathbf{elif}\;t\_2 \leq -2 \cdot 10^{+233}:\\
\;\;\;\;t\_1 \cdot \sqrt{1 + {\left(0.5 \cdot \frac{U\_m}{J}\right)}^{2}}\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+300}:\\
\;\;\;\;t\_1 \cdot \sqrt{1 + \frac{U\_m \cdot \frac{U\_m}{J \cdot 2}}{\left(J \cdot 2\right) \cdot \mathsf{fma}\left(0.5, \cos K, 0.5\right)}}\\
\mathbf{else}:\\
\;\;\;\;\left(-U\_m\right) \cdot \mathsf{fma}\left(-2, {\cos \left(K \cdot 0.5\right)}^{2} \cdot \frac{J \cdot J}{U\_m \cdot U\_m}, -1\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 (*.f64 #s(literal -2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64)))) (sqrt.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 U (*.f64 (*.f64 #s(literal 2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64))))) #s(literal 2 binary64))))) < -inf.0Initial program 6.3%
Taylor expanded in J around 0
mul-1-negN/A
lower-neg.f6458.3
Applied rewrites58.3%
if -inf.0 < (*.f64 (*.f64 (*.f64 #s(literal -2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64)))) (sqrt.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 U (*.f64 (*.f64 #s(literal 2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64))))) #s(literal 2 binary64))))) < -1.99999999999999995e233Initial program 99.8%
Taylor expanded in K around 0
lower-*.f64N/A
lower-/.f6494.5
Applied rewrites94.5%
if -1.99999999999999995e233 < (*.f64 (*.f64 (*.f64 #s(literal -2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64)))) (sqrt.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 U (*.f64 (*.f64 #s(literal 2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64))))) #s(literal 2 binary64))))) < 5.00000000000000026e300Initial program 99.8%
lift-*.f64N/A
lift-/.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
lift-/.f64N/A
unpow2N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
associate-*l/N/A
lift-/.f64N/A
associate-*r/N/A
associate-/r*N/A
Applied rewrites98.1%
Taylor expanded in K around inf
+-commutativeN/A
lower-fma.f64N/A
lower-cos.f6498.1
Applied rewrites98.1%
if 5.00000000000000026e300 < (*.f64 (*.f64 (*.f64 #s(literal -2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64)))) (sqrt.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 U (*.f64 (*.f64 #s(literal 2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64))))) #s(literal 2 binary64))))) Initial program 5.5%
Taylor expanded in U around -inf
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6439.5
Applied rewrites39.5%
Final simplification87.6%
U_m = (fabs.f64 U)
(FPCore (J K U_m)
:precision binary64
(let* ((t_0 (cos (* K 0.5)))
(t_1 (cos (/ K 2.0)))
(t_2 (* (* -2.0 J) t_1))
(t_3 (* t_2 (sqrt (+ 1.0 (pow (/ U_m (* t_1 (* J 2.0))) 2.0))))))
(if (<= t_3 (- INFINITY))
(- U_m)
(if (<= t_3 4e-154)
(* t_2 (sqrt (+ 1.0 (pow (* 0.5 (/ U_m J)) 2.0))))
(if (<= t_3 5e+300)
(*
-2.0
(*
(* J t_0)
(sqrt
(fma 0.25 (/ (* U_m U_m) (* (* J J) (fma 0.5 (cos K) 0.5))) 1.0))))
(*
(- U_m)
(fma -2.0 (* (pow t_0 2.0) (/ (* J J) (* U_m U_m))) -1.0)))))))U_m = fabs(U);
double code(double J, double K, double U_m) {
double t_0 = cos((K * 0.5));
double t_1 = cos((K / 2.0));
double t_2 = (-2.0 * J) * t_1;
double t_3 = t_2 * sqrt((1.0 + pow((U_m / (t_1 * (J * 2.0))), 2.0)));
double tmp;
if (t_3 <= -((double) INFINITY)) {
tmp = -U_m;
} else if (t_3 <= 4e-154) {
tmp = t_2 * sqrt((1.0 + pow((0.5 * (U_m / J)), 2.0)));
} else if (t_3 <= 5e+300) {
tmp = -2.0 * ((J * t_0) * sqrt(fma(0.25, ((U_m * U_m) / ((J * J) * fma(0.5, cos(K), 0.5))), 1.0)));
} else {
tmp = -U_m * fma(-2.0, (pow(t_0, 2.0) * ((J * J) / (U_m * U_m))), -1.0);
}
return tmp;
}
U_m = abs(U) function code(J, K, U_m) t_0 = cos(Float64(K * 0.5)) t_1 = cos(Float64(K / 2.0)) t_2 = Float64(Float64(-2.0 * J) * t_1) t_3 = Float64(t_2 * sqrt(Float64(1.0 + (Float64(U_m / Float64(t_1 * Float64(J * 2.0))) ^ 2.0)))) tmp = 0.0 if (t_3 <= Float64(-Inf)) tmp = Float64(-U_m); elseif (t_3 <= 4e-154) tmp = Float64(t_2 * sqrt(Float64(1.0 + (Float64(0.5 * Float64(U_m / J)) ^ 2.0)))); elseif (t_3 <= 5e+300) tmp = Float64(-2.0 * Float64(Float64(J * t_0) * sqrt(fma(0.25, Float64(Float64(U_m * U_m) / Float64(Float64(J * J) * fma(0.5, cos(K), 0.5))), 1.0)))); else tmp = Float64(Float64(-U_m) * fma(-2.0, Float64((t_0 ^ 2.0) * Float64(Float64(J * J) / Float64(U_m * U_m))), -1.0)); end return tmp end
U_m = N[Abs[U], $MachinePrecision]
code[J_, K_, U$95$m_] := Block[{t$95$0 = N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(-2.0 * J), $MachinePrecision] * t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 * N[Sqrt[N[(1.0 + N[Power[N[(U$95$m / N[(t$95$1 * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, (-Infinity)], (-U$95$m), If[LessEqual[t$95$3, 4e-154], N[(t$95$2 * N[Sqrt[N[(1.0 + N[Power[N[(0.5 * N[(U$95$m / J), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 5e+300], N[(-2.0 * N[(N[(J * t$95$0), $MachinePrecision] * N[Sqrt[N[(0.25 * N[(N[(U$95$m * U$95$m), $MachinePrecision] / N[(N[(J * J), $MachinePrecision] * N[(0.5 * N[Cos[K], $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-U$95$m) * N[(-2.0 * N[(N[Power[t$95$0, 2.0], $MachinePrecision] * N[(N[(J * J), $MachinePrecision] / N[(U$95$m * U$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
U_m = \left|U\right|
\\
\begin{array}{l}
t_0 := \cos \left(K \cdot 0.5\right)\\
t_1 := \cos \left(\frac{K}{2}\right)\\
t_2 := \left(-2 \cdot J\right) \cdot t\_1\\
t_3 := t\_2 \cdot \sqrt{1 + {\left(\frac{U\_m}{t\_1 \cdot \left(J \cdot 2\right)}\right)}^{2}}\\
\mathbf{if}\;t\_3 \leq -\infty:\\
\;\;\;\;-U\_m\\
\mathbf{elif}\;t\_3 \leq 4 \cdot 10^{-154}:\\
\;\;\;\;t\_2 \cdot \sqrt{1 + {\left(0.5 \cdot \frac{U\_m}{J}\right)}^{2}}\\
\mathbf{elif}\;t\_3 \leq 5 \cdot 10^{+300}:\\
\;\;\;\;-2 \cdot \left(\left(J \cdot t\_0\right) \cdot \sqrt{\mathsf{fma}\left(0.25, \frac{U\_m \cdot U\_m}{\left(J \cdot J\right) \cdot \mathsf{fma}\left(0.5, \cos K, 0.5\right)}, 1\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(-U\_m\right) \cdot \mathsf{fma}\left(-2, {t\_0}^{2} \cdot \frac{J \cdot J}{U\_m \cdot U\_m}, -1\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 (*.f64 #s(literal -2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64)))) (sqrt.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 U (*.f64 (*.f64 #s(literal 2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64))))) #s(literal 2 binary64))))) < -inf.0Initial program 6.3%
Taylor expanded in J around 0
mul-1-negN/A
lower-neg.f6458.3
Applied rewrites58.3%
if -inf.0 < (*.f64 (*.f64 (*.f64 #s(literal -2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64)))) (sqrt.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 U (*.f64 (*.f64 #s(literal 2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64))))) #s(literal 2 binary64))))) < 3.9999999999999999e-154Initial program 99.8%
Taylor expanded in K around 0
lower-*.f64N/A
lower-/.f6486.8
Applied rewrites86.8%
if 3.9999999999999999e-154 < (*.f64 (*.f64 (*.f64 #s(literal -2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64)))) (sqrt.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 U (*.f64 (*.f64 #s(literal 2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64))))) #s(literal 2 binary64))))) < 5.00000000000000026e300Initial program 99.8%
lift-*.f64N/A
lift-/.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
lift-/.f64N/A
unpow2N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
associate-*l/N/A
lift-/.f64N/A
associate-*r/N/A
associate-/r*N/A
Applied rewrites97.6%
Taylor expanded in K around inf
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
+-commutativeN/A
lower-fma.f64N/A
Applied rewrites83.8%
if 5.00000000000000026e300 < (*.f64 (*.f64 (*.f64 #s(literal -2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64)))) (sqrt.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 U (*.f64 (*.f64 #s(literal 2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64))))) #s(literal 2 binary64))))) Initial program 5.5%
Taylor expanded in U around -inf
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6439.5
Applied rewrites39.5%
Final simplification78.1%
U_m = (fabs.f64 U)
(FPCore (J K U_m)
:precision binary64
(let* ((t_0 (cos (* K 0.5)))
(t_1 (cos (/ K 2.0)))
(t_2 (* (* -2.0 J) t_1))
(t_3 (* t_2 (sqrt (+ 1.0 (pow (/ U_m (* t_1 (* J 2.0))) 2.0))))))
(if (<= t_3 (- INFINITY))
(- U_m)
(if (<= t_3 4e-154)
(* t_2 (sqrt (+ 1.0 (pow (* 0.5 (/ U_m J)) 2.0))))
(if (<= t_3 5e+300)
(*
(* -2.0 J)
(* t_0 (sqrt (fma U_m (/ U_m (* (* J 2.0) (fma (cos K) J J))) 1.0))))
(*
(- U_m)
(fma -2.0 (* (pow t_0 2.0) (/ (* J J) (* U_m U_m))) -1.0)))))))U_m = fabs(U);
double code(double J, double K, double U_m) {
double t_0 = cos((K * 0.5));
double t_1 = cos((K / 2.0));
double t_2 = (-2.0 * J) * t_1;
double t_3 = t_2 * sqrt((1.0 + pow((U_m / (t_1 * (J * 2.0))), 2.0)));
double tmp;
if (t_3 <= -((double) INFINITY)) {
tmp = -U_m;
} else if (t_3 <= 4e-154) {
tmp = t_2 * sqrt((1.0 + pow((0.5 * (U_m / J)), 2.0)));
} else if (t_3 <= 5e+300) {
tmp = (-2.0 * J) * (t_0 * sqrt(fma(U_m, (U_m / ((J * 2.0) * fma(cos(K), J, J))), 1.0)));
} else {
tmp = -U_m * fma(-2.0, (pow(t_0, 2.0) * ((J * J) / (U_m * U_m))), -1.0);
}
return tmp;
}
U_m = abs(U) function code(J, K, U_m) t_0 = cos(Float64(K * 0.5)) t_1 = cos(Float64(K / 2.0)) t_2 = Float64(Float64(-2.0 * J) * t_1) t_3 = Float64(t_2 * sqrt(Float64(1.0 + (Float64(U_m / Float64(t_1 * Float64(J * 2.0))) ^ 2.0)))) tmp = 0.0 if (t_3 <= Float64(-Inf)) tmp = Float64(-U_m); elseif (t_3 <= 4e-154) tmp = Float64(t_2 * sqrt(Float64(1.0 + (Float64(0.5 * Float64(U_m / J)) ^ 2.0)))); elseif (t_3 <= 5e+300) tmp = Float64(Float64(-2.0 * J) * Float64(t_0 * sqrt(fma(U_m, Float64(U_m / Float64(Float64(J * 2.0) * fma(cos(K), J, J))), 1.0)))); else tmp = Float64(Float64(-U_m) * fma(-2.0, Float64((t_0 ^ 2.0) * Float64(Float64(J * J) / Float64(U_m * U_m))), -1.0)); end return tmp end
U_m = N[Abs[U], $MachinePrecision]
code[J_, K_, U$95$m_] := Block[{t$95$0 = N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(-2.0 * J), $MachinePrecision] * t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 * N[Sqrt[N[(1.0 + N[Power[N[(U$95$m / N[(t$95$1 * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, (-Infinity)], (-U$95$m), If[LessEqual[t$95$3, 4e-154], N[(t$95$2 * N[Sqrt[N[(1.0 + N[Power[N[(0.5 * N[(U$95$m / J), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 5e+300], N[(N[(-2.0 * J), $MachinePrecision] * N[(t$95$0 * N[Sqrt[N[(U$95$m * N[(U$95$m / N[(N[(J * 2.0), $MachinePrecision] * N[(N[Cos[K], $MachinePrecision] * J + J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-U$95$m) * N[(-2.0 * N[(N[Power[t$95$0, 2.0], $MachinePrecision] * N[(N[(J * J), $MachinePrecision] / N[(U$95$m * U$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
U_m = \left|U\right|
\\
\begin{array}{l}
t_0 := \cos \left(K \cdot 0.5\right)\\
t_1 := \cos \left(\frac{K}{2}\right)\\
t_2 := \left(-2 \cdot J\right) \cdot t\_1\\
t_3 := t\_2 \cdot \sqrt{1 + {\left(\frac{U\_m}{t\_1 \cdot \left(J \cdot 2\right)}\right)}^{2}}\\
\mathbf{if}\;t\_3 \leq -\infty:\\
\;\;\;\;-U\_m\\
\mathbf{elif}\;t\_3 \leq 4 \cdot 10^{-154}:\\
\;\;\;\;t\_2 \cdot \sqrt{1 + {\left(0.5 \cdot \frac{U\_m}{J}\right)}^{2}}\\
\mathbf{elif}\;t\_3 \leq 5 \cdot 10^{+300}:\\
\;\;\;\;\left(-2 \cdot J\right) \cdot \left(t\_0 \cdot \sqrt{\mathsf{fma}\left(U\_m, \frac{U\_m}{\left(J \cdot 2\right) \cdot \mathsf{fma}\left(\cos K, J, J\right)}, 1\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(-U\_m\right) \cdot \mathsf{fma}\left(-2, {t\_0}^{2} \cdot \frac{J \cdot J}{U\_m \cdot U\_m}, -1\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 (*.f64 #s(literal -2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64)))) (sqrt.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 U (*.f64 (*.f64 #s(literal 2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64))))) #s(literal 2 binary64))))) < -inf.0Initial program 6.3%
Taylor expanded in J around 0
mul-1-negN/A
lower-neg.f6458.3
Applied rewrites58.3%
if -inf.0 < (*.f64 (*.f64 (*.f64 #s(literal -2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64)))) (sqrt.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 U (*.f64 (*.f64 #s(literal 2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64))))) #s(literal 2 binary64))))) < 3.9999999999999999e-154Initial program 99.8%
Taylor expanded in K around 0
lower-*.f64N/A
lower-/.f6486.8
Applied rewrites86.8%
if 3.9999999999999999e-154 < (*.f64 (*.f64 (*.f64 #s(literal -2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64)))) (sqrt.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 U (*.f64 (*.f64 #s(literal 2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64))))) #s(literal 2 binary64))))) < 5.00000000000000026e300Initial program 99.8%
lift-*.f64N/A
lift-/.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
lift-/.f64N/A
unpow2N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
associate-*l/N/A
lift-/.f64N/A
associate-*r/N/A
associate-/r*N/A
Applied rewrites97.6%
Applied rewrites89.2%
if 5.00000000000000026e300 < (*.f64 (*.f64 (*.f64 #s(literal -2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64)))) (sqrt.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 U (*.f64 (*.f64 #s(literal 2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64))))) #s(literal 2 binary64))))) Initial program 5.5%
Taylor expanded in U around -inf
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6439.5
Applied rewrites39.5%
Final simplification79.9%
U_m = (fabs.f64 U)
(FPCore (J K U_m)
:precision binary64
(let* ((t_0 (cos (/ K 2.0)))
(t_1
(*
(* (* -2.0 J) t_0)
(sqrt (+ 1.0 (pow (/ U_m (* t_0 (* J 2.0))) 2.0)))))
(t_2 (cos (* K 0.5))))
(if (<= t_1 (- INFINITY))
(- U_m)
(if (<= t_1 -2e-88)
(* t_2 (* (* -2.0 J) (sqrt (fma (* U_m 0.25) (/ U_m (* J J)) 1.0))))
(if (<= t_1 -4e-178)
(*
(sqrt (fma 0.25 (/ (* U_m (/ U_m J)) J) 1.0))
(*
(* -2.0 J)
(fma (* K K) (fma (* K K) 0.0026041666666666665 -0.125) 1.0)))
(* (* -2.0 J) t_2))))))U_m = fabs(U);
double code(double J, double K, double U_m) {
double t_0 = cos((K / 2.0));
double t_1 = ((-2.0 * J) * t_0) * sqrt((1.0 + pow((U_m / (t_0 * (J * 2.0))), 2.0)));
double t_2 = cos((K * 0.5));
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = -U_m;
} else if (t_1 <= -2e-88) {
tmp = t_2 * ((-2.0 * J) * sqrt(fma((U_m * 0.25), (U_m / (J * J)), 1.0)));
} else if (t_1 <= -4e-178) {
tmp = sqrt(fma(0.25, ((U_m * (U_m / J)) / J), 1.0)) * ((-2.0 * J) * fma((K * K), fma((K * K), 0.0026041666666666665, -0.125), 1.0));
} else {
tmp = (-2.0 * J) * t_2;
}
return tmp;
}
U_m = abs(U) function code(J, K, U_m) t_0 = cos(Float64(K / 2.0)) t_1 = Float64(Float64(Float64(-2.0 * J) * t_0) * sqrt(Float64(1.0 + (Float64(U_m / Float64(t_0 * Float64(J * 2.0))) ^ 2.0)))) t_2 = cos(Float64(K * 0.5)) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(-U_m); elseif (t_1 <= -2e-88) tmp = Float64(t_2 * Float64(Float64(-2.0 * J) * sqrt(fma(Float64(U_m * 0.25), Float64(U_m / Float64(J * J)), 1.0)))); elseif (t_1 <= -4e-178) tmp = Float64(sqrt(fma(0.25, Float64(Float64(U_m * Float64(U_m / J)) / J), 1.0)) * Float64(Float64(-2.0 * J) * fma(Float64(K * K), fma(Float64(K * K), 0.0026041666666666665, -0.125), 1.0))); else tmp = Float64(Float64(-2.0 * J) * t_2); end return tmp end
U_m = N[Abs[U], $MachinePrecision]
code[J_, K_, U$95$m_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(-2.0 * J), $MachinePrecision] * t$95$0), $MachinePrecision] * N[Sqrt[N[(1.0 + N[Power[N[(U$95$m / N[(t$95$0 * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], (-U$95$m), If[LessEqual[t$95$1, -2e-88], N[(t$95$2 * N[(N[(-2.0 * J), $MachinePrecision] * N[Sqrt[N[(N[(U$95$m * 0.25), $MachinePrecision] * N[(U$95$m / N[(J * J), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, -4e-178], N[(N[Sqrt[N[(0.25 * N[(N[(U$95$m * N[(U$95$m / J), $MachinePrecision]), $MachinePrecision] / J), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision] * N[(N[(-2.0 * J), $MachinePrecision] * N[(N[(K * K), $MachinePrecision] * N[(N[(K * K), $MachinePrecision] * 0.0026041666666666665 + -0.125), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(-2.0 * J), $MachinePrecision] * t$95$2), $MachinePrecision]]]]]]]
\begin{array}{l}
U_m = \left|U\right|
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
t_1 := \left(\left(-2 \cdot J\right) \cdot t\_0\right) \cdot \sqrt{1 + {\left(\frac{U\_m}{t\_0 \cdot \left(J \cdot 2\right)}\right)}^{2}}\\
t_2 := \cos \left(K \cdot 0.5\right)\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;-U\_m\\
\mathbf{elif}\;t\_1 \leq -2 \cdot 10^{-88}:\\
\;\;\;\;t\_2 \cdot \left(\left(-2 \cdot J\right) \cdot \sqrt{\mathsf{fma}\left(U\_m \cdot 0.25, \frac{U\_m}{J \cdot J}, 1\right)}\right)\\
\mathbf{elif}\;t\_1 \leq -4 \cdot 10^{-178}:\\
\;\;\;\;\sqrt{\mathsf{fma}\left(0.25, \frac{U\_m \cdot \frac{U\_m}{J}}{J}, 1\right)} \cdot \left(\left(-2 \cdot J\right) \cdot \mathsf{fma}\left(K \cdot K, \mathsf{fma}\left(K \cdot K, 0.0026041666666666665, -0.125\right), 1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(-2 \cdot J\right) \cdot t\_2\\
\end{array}
\end{array}
if (*.f64 (*.f64 (*.f64 #s(literal -2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64)))) (sqrt.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 U (*.f64 (*.f64 #s(literal 2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64))))) #s(literal 2 binary64))))) < -inf.0Initial program 6.3%
Taylor expanded in J around 0
mul-1-negN/A
lower-neg.f6458.3
Applied rewrites58.3%
if -inf.0 < (*.f64 (*.f64 (*.f64 #s(literal -2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64)))) (sqrt.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 U (*.f64 (*.f64 #s(literal 2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64))))) #s(literal 2 binary64))))) < -1.99999999999999987e-88Initial program 99.8%
Taylor expanded in K around 0
lower-sqrt.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6474.1
Applied rewrites74.1%
Applied rewrites85.9%
if -1.99999999999999987e-88 < (*.f64 (*.f64 (*.f64 #s(literal -2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64)))) (sqrt.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 U (*.f64 (*.f64 #s(literal 2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64))))) #s(literal 2 binary64))))) < -3.9999999999999998e-178Initial program 100.0%
Taylor expanded in K around 0
lower-sqrt.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6438.9
Applied rewrites38.9%
Taylor expanded in K around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6428.0
Applied rewrites28.0%
times-fracN/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f6446.6
Applied rewrites46.6%
if -3.9999999999999998e-178 < (*.f64 (*.f64 (*.f64 #s(literal -2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64)))) (sqrt.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 U (*.f64 (*.f64 #s(literal 2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64))))) #s(literal 2 binary64))))) Initial program 82.6%
Taylor expanded in J around inf
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-*.f6456.9
Applied rewrites56.9%
Final simplification66.6%
U_m = (fabs.f64 U)
(FPCore (J K U_m)
:precision binary64
(let* ((t_0 (cos (/ K 2.0)))
(t_1
(*
(* (* -2.0 J) t_0)
(sqrt (+ 1.0 (pow (/ U_m (* t_0 (* J 2.0))) 2.0))))))
(if (<= t_1 (- INFINITY))
(- U_m)
(if (<= t_1 -2e+180)
(*
(fma K (* K (fma (* K K) 0.0026041666666666665 -0.125)) 1.0)
(* (* -2.0 J) (sqrt (fma U_m (* 0.25 (/ U_m (* J J))) 1.0))))
(if (<= t_1 -5e-156)
(* (* -2.0 J) (sqrt (fma 0.25 (/ (* U_m U_m) (* J J)) 1.0)))
(fma (* U_m (* K 0.125)) K (- U_m)))))))U_m = fabs(U);
double code(double J, double K, double U_m) {
double t_0 = cos((K / 2.0));
double t_1 = ((-2.0 * J) * t_0) * sqrt((1.0 + pow((U_m / (t_0 * (J * 2.0))), 2.0)));
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = -U_m;
} else if (t_1 <= -2e+180) {
tmp = fma(K, (K * fma((K * K), 0.0026041666666666665, -0.125)), 1.0) * ((-2.0 * J) * sqrt(fma(U_m, (0.25 * (U_m / (J * J))), 1.0)));
} else if (t_1 <= -5e-156) {
tmp = (-2.0 * J) * sqrt(fma(0.25, ((U_m * U_m) / (J * J)), 1.0));
} else {
tmp = fma((U_m * (K * 0.125)), K, -U_m);
}
return tmp;
}
U_m = abs(U) function code(J, K, U_m) t_0 = cos(Float64(K / 2.0)) t_1 = Float64(Float64(Float64(-2.0 * J) * t_0) * sqrt(Float64(1.0 + (Float64(U_m / Float64(t_0 * Float64(J * 2.0))) ^ 2.0)))) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(-U_m); elseif (t_1 <= -2e+180) tmp = Float64(fma(K, Float64(K * fma(Float64(K * K), 0.0026041666666666665, -0.125)), 1.0) * Float64(Float64(-2.0 * J) * sqrt(fma(U_m, Float64(0.25 * Float64(U_m / Float64(J * J))), 1.0)))); elseif (t_1 <= -5e-156) tmp = Float64(Float64(-2.0 * J) * sqrt(fma(0.25, Float64(Float64(U_m * U_m) / Float64(J * J)), 1.0))); else tmp = fma(Float64(U_m * Float64(K * 0.125)), K, Float64(-U_m)); end return tmp end
U_m = N[Abs[U], $MachinePrecision]
code[J_, K_, U$95$m_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(-2.0 * J), $MachinePrecision] * t$95$0), $MachinePrecision] * N[Sqrt[N[(1.0 + N[Power[N[(U$95$m / N[(t$95$0 * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], (-U$95$m), If[LessEqual[t$95$1, -2e+180], N[(N[(K * N[(K * N[(N[(K * K), $MachinePrecision] * 0.0026041666666666665 + -0.125), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(N[(-2.0 * J), $MachinePrecision] * N[Sqrt[N[(U$95$m * N[(0.25 * N[(U$95$m / N[(J * J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, -5e-156], N[(N[(-2.0 * J), $MachinePrecision] * N[Sqrt[N[(0.25 * N[(N[(U$95$m * U$95$m), $MachinePrecision] / N[(J * J), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(U$95$m * N[(K * 0.125), $MachinePrecision]), $MachinePrecision] * K + (-U$95$m)), $MachinePrecision]]]]]]
\begin{array}{l}
U_m = \left|U\right|
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
t_1 := \left(\left(-2 \cdot J\right) \cdot t\_0\right) \cdot \sqrt{1 + {\left(\frac{U\_m}{t\_0 \cdot \left(J \cdot 2\right)}\right)}^{2}}\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;-U\_m\\
\mathbf{elif}\;t\_1 \leq -2 \cdot 10^{+180}:\\
\;\;\;\;\mathsf{fma}\left(K, K \cdot \mathsf{fma}\left(K \cdot K, 0.0026041666666666665, -0.125\right), 1\right) \cdot \left(\left(-2 \cdot J\right) \cdot \sqrt{\mathsf{fma}\left(U\_m, 0.25 \cdot \frac{U\_m}{J \cdot J}, 1\right)}\right)\\
\mathbf{elif}\;t\_1 \leq -5 \cdot 10^{-156}:\\
\;\;\;\;\left(-2 \cdot J\right) \cdot \sqrt{\mathsf{fma}\left(0.25, \frac{U\_m \cdot U\_m}{J \cdot J}, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(U\_m \cdot \left(K \cdot 0.125\right), K, -U\_m\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 (*.f64 #s(literal -2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64)))) (sqrt.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 U (*.f64 (*.f64 #s(literal 2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64))))) #s(literal 2 binary64))))) < -inf.0Initial program 6.3%
Taylor expanded in J around 0
mul-1-negN/A
lower-neg.f6458.3
Applied rewrites58.3%
if -inf.0 < (*.f64 (*.f64 (*.f64 #s(literal -2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64)))) (sqrt.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 U (*.f64 (*.f64 #s(literal 2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64))))) #s(literal 2 binary64))))) < -2e180Initial program 99.8%
Taylor expanded in K around 0
lower-sqrt.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6465.5
Applied rewrites65.5%
Taylor expanded in K around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6431.7
Applied rewrites31.7%
Applied rewrites48.1%
if -2e180 < (*.f64 (*.f64 (*.f64 #s(literal -2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64)))) (sqrt.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 U (*.f64 (*.f64 #s(literal 2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64))))) #s(literal 2 binary64))))) < -5.00000000000000007e-156Initial program 99.8%
Taylor expanded in K around 0
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f6454.7
Applied rewrites54.7%
if -5.00000000000000007e-156 < (*.f64 (*.f64 (*.f64 #s(literal -2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64)))) (sqrt.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 U (*.f64 (*.f64 #s(literal 2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64))))) #s(literal 2 binary64))))) Initial program 83.1%
Taylor expanded in K around 0
lower-sqrt.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6451.9
Applied rewrites51.9%
Taylor expanded in U around inf
associate-*r/N/A
*-commutativeN/A
associate-*r/N/A
metadata-evalN/A
associate-*r/N/A
lower-*.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f6415.2
Applied rewrites15.2%
Taylor expanded in K around 0
+-commutativeN/A
associate-*r*N/A
distribute-rgt-outN/A
lower-*.f64N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6417.3
Applied rewrites17.3%
lift-*.f64N/A
distribute-lft-inN/A
*-commutativeN/A
neg-mul-1N/A
lift-*.f64N/A
associate-*r*N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-neg.f6417.4
Applied rewrites17.4%
Final simplification35.1%
U_m = (fabs.f64 U)
(FPCore (J K U_m)
:precision binary64
(let* ((t_0 (cos (/ K 2.0)))
(t_1
(*
(* (* -2.0 J) t_0)
(sqrt (+ 1.0 (pow (/ U_m (* t_0 (* J 2.0))) 2.0))))))
(if (<= t_1 (- INFINITY))
(- U_m)
(if (<= t_1 -2e+180)
(*
-2.0
(fma (* J (* K K)) (fma (* K K) 0.0026041666666666665 -0.125) J))
(if (<= t_1 -5e-156)
(* (* -2.0 J) (sqrt (fma 0.25 (/ (* U_m U_m) (* J J)) 1.0)))
(fma (* U_m (* K 0.125)) K (- U_m)))))))U_m = fabs(U);
double code(double J, double K, double U_m) {
double t_0 = cos((K / 2.0));
double t_1 = ((-2.0 * J) * t_0) * sqrt((1.0 + pow((U_m / (t_0 * (J * 2.0))), 2.0)));
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = -U_m;
} else if (t_1 <= -2e+180) {
tmp = -2.0 * fma((J * (K * K)), fma((K * K), 0.0026041666666666665, -0.125), J);
} else if (t_1 <= -5e-156) {
tmp = (-2.0 * J) * sqrt(fma(0.25, ((U_m * U_m) / (J * J)), 1.0));
} else {
tmp = fma((U_m * (K * 0.125)), K, -U_m);
}
return tmp;
}
U_m = abs(U) function code(J, K, U_m) t_0 = cos(Float64(K / 2.0)) t_1 = Float64(Float64(Float64(-2.0 * J) * t_0) * sqrt(Float64(1.0 + (Float64(U_m / Float64(t_0 * Float64(J * 2.0))) ^ 2.0)))) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(-U_m); elseif (t_1 <= -2e+180) tmp = Float64(-2.0 * fma(Float64(J * Float64(K * K)), fma(Float64(K * K), 0.0026041666666666665, -0.125), J)); elseif (t_1 <= -5e-156) tmp = Float64(Float64(-2.0 * J) * sqrt(fma(0.25, Float64(Float64(U_m * U_m) / Float64(J * J)), 1.0))); else tmp = fma(Float64(U_m * Float64(K * 0.125)), K, Float64(-U_m)); end return tmp end
U_m = N[Abs[U], $MachinePrecision]
code[J_, K_, U$95$m_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(-2.0 * J), $MachinePrecision] * t$95$0), $MachinePrecision] * N[Sqrt[N[(1.0 + N[Power[N[(U$95$m / N[(t$95$0 * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], (-U$95$m), If[LessEqual[t$95$1, -2e+180], N[(-2.0 * N[(N[(J * N[(K * K), $MachinePrecision]), $MachinePrecision] * N[(N[(K * K), $MachinePrecision] * 0.0026041666666666665 + -0.125), $MachinePrecision] + J), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, -5e-156], N[(N[(-2.0 * J), $MachinePrecision] * N[Sqrt[N[(0.25 * N[(N[(U$95$m * U$95$m), $MachinePrecision] / N[(J * J), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(U$95$m * N[(K * 0.125), $MachinePrecision]), $MachinePrecision] * K + (-U$95$m)), $MachinePrecision]]]]]]
\begin{array}{l}
U_m = \left|U\right|
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
t_1 := \left(\left(-2 \cdot J\right) \cdot t\_0\right) \cdot \sqrt{1 + {\left(\frac{U\_m}{t\_0 \cdot \left(J \cdot 2\right)}\right)}^{2}}\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;-U\_m\\
\mathbf{elif}\;t\_1 \leq -2 \cdot 10^{+180}:\\
\;\;\;\;-2 \cdot \mathsf{fma}\left(J \cdot \left(K \cdot K\right), \mathsf{fma}\left(K \cdot K, 0.0026041666666666665, -0.125\right), J\right)\\
\mathbf{elif}\;t\_1 \leq -5 \cdot 10^{-156}:\\
\;\;\;\;\left(-2 \cdot J\right) \cdot \sqrt{\mathsf{fma}\left(0.25, \frac{U\_m \cdot U\_m}{J \cdot J}, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(U\_m \cdot \left(K \cdot 0.125\right), K, -U\_m\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 (*.f64 #s(literal -2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64)))) (sqrt.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 U (*.f64 (*.f64 #s(literal 2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64))))) #s(literal 2 binary64))))) < -inf.0Initial program 6.3%
Taylor expanded in J around 0
mul-1-negN/A
lower-neg.f6458.3
Applied rewrites58.3%
if -inf.0 < (*.f64 (*.f64 (*.f64 #s(literal -2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64)))) (sqrt.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 U (*.f64 (*.f64 #s(literal 2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64))))) #s(literal 2 binary64))))) < -2e180Initial program 99.8%
Taylor expanded in K around 0
lower-sqrt.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6465.5
Applied rewrites65.5%
Taylor expanded in K around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6431.7
Applied rewrites31.7%
Taylor expanded in J around inf
lower-*.f64N/A
+-commutativeN/A
distribute-lft-inN/A
associate-*r*N/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6441.5
Applied rewrites41.5%
if -2e180 < (*.f64 (*.f64 (*.f64 #s(literal -2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64)))) (sqrt.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 U (*.f64 (*.f64 #s(literal 2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64))))) #s(literal 2 binary64))))) < -5.00000000000000007e-156Initial program 99.8%
Taylor expanded in K around 0
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f6454.7
Applied rewrites54.7%
if -5.00000000000000007e-156 < (*.f64 (*.f64 (*.f64 #s(literal -2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64)))) (sqrt.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 U (*.f64 (*.f64 #s(literal 2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64))))) #s(literal 2 binary64))))) Initial program 83.1%
Taylor expanded in K around 0
lower-sqrt.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6451.9
Applied rewrites51.9%
Taylor expanded in U around inf
associate-*r/N/A
*-commutativeN/A
associate-*r/N/A
metadata-evalN/A
associate-*r/N/A
lower-*.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f6415.2
Applied rewrites15.2%
Taylor expanded in K around 0
+-commutativeN/A
associate-*r*N/A
distribute-rgt-outN/A
lower-*.f64N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6417.3
Applied rewrites17.3%
lift-*.f64N/A
distribute-lft-inN/A
*-commutativeN/A
neg-mul-1N/A
lift-*.f64N/A
associate-*r*N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-neg.f6417.4
Applied rewrites17.4%
Final simplification34.0%
U_m = (fabs.f64 U)
(FPCore (J K U_m)
:precision binary64
(let* ((t_0 (cos (/ K 2.0)))
(t_1
(*
(* (* -2.0 J) t_0)
(sqrt (+ 1.0 (pow (/ U_m (* t_0 (* J 2.0))) 2.0)))))
(t_2 (cos (* K 0.5))))
(if (<= t_1 (- INFINITY))
(- U_m)
(if (<= t_1 5e+300)
(*
(* J (* -2.0 t_2))
(sqrt (+ 1.0 (pow (/ (* t_2 (* J 2.0)) U_m) -2.0))))
(*
(- U_m)
(fma -2.0 (* (pow t_2 2.0) (/ (* J J) (* U_m U_m))) -1.0))))))U_m = fabs(U);
double code(double J, double K, double U_m) {
double t_0 = cos((K / 2.0));
double t_1 = ((-2.0 * J) * t_0) * sqrt((1.0 + pow((U_m / (t_0 * (J * 2.0))), 2.0)));
double t_2 = cos((K * 0.5));
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = -U_m;
} else if (t_1 <= 5e+300) {
tmp = (J * (-2.0 * t_2)) * sqrt((1.0 + pow(((t_2 * (J * 2.0)) / U_m), -2.0)));
} else {
tmp = -U_m * fma(-2.0, (pow(t_2, 2.0) * ((J * J) / (U_m * U_m))), -1.0);
}
return tmp;
}
U_m = abs(U) function code(J, K, U_m) t_0 = cos(Float64(K / 2.0)) t_1 = Float64(Float64(Float64(-2.0 * J) * t_0) * sqrt(Float64(1.0 + (Float64(U_m / Float64(t_0 * Float64(J * 2.0))) ^ 2.0)))) t_2 = cos(Float64(K * 0.5)) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(-U_m); elseif (t_1 <= 5e+300) tmp = Float64(Float64(J * Float64(-2.0 * t_2)) * sqrt(Float64(1.0 + (Float64(Float64(t_2 * Float64(J * 2.0)) / U_m) ^ -2.0)))); else tmp = Float64(Float64(-U_m) * fma(-2.0, Float64((t_2 ^ 2.0) * Float64(Float64(J * J) / Float64(U_m * U_m))), -1.0)); end return tmp end
U_m = N[Abs[U], $MachinePrecision]
code[J_, K_, U$95$m_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(-2.0 * J), $MachinePrecision] * t$95$0), $MachinePrecision] * N[Sqrt[N[(1.0 + N[Power[N[(U$95$m / N[(t$95$0 * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], (-U$95$m), If[LessEqual[t$95$1, 5e+300], N[(N[(J * N[(-2.0 * t$95$2), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(1.0 + N[Power[N[(N[(t$95$2 * N[(J * 2.0), $MachinePrecision]), $MachinePrecision] / U$95$m), $MachinePrecision], -2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[((-U$95$m) * N[(-2.0 * N[(N[Power[t$95$2, 2.0], $MachinePrecision] * N[(N[(J * J), $MachinePrecision] / N[(U$95$m * U$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
U_m = \left|U\right|
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
t_1 := \left(\left(-2 \cdot J\right) \cdot t\_0\right) \cdot \sqrt{1 + {\left(\frac{U\_m}{t\_0 \cdot \left(J \cdot 2\right)}\right)}^{2}}\\
t_2 := \cos \left(K \cdot 0.5\right)\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;-U\_m\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+300}:\\
\;\;\;\;\left(J \cdot \left(-2 \cdot t\_2\right)\right) \cdot \sqrt{1 + {\left(\frac{t\_2 \cdot \left(J \cdot 2\right)}{U\_m}\right)}^{-2}}\\
\mathbf{else}:\\
\;\;\;\;\left(-U\_m\right) \cdot \mathsf{fma}\left(-2, {t\_2}^{2} \cdot \frac{J \cdot J}{U\_m \cdot U\_m}, -1\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 (*.f64 #s(literal -2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64)))) (sqrt.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 U (*.f64 (*.f64 #s(literal 2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64))))) #s(literal 2 binary64))))) < -inf.0Initial program 6.3%
Taylor expanded in J around 0
mul-1-negN/A
lower-neg.f6458.3
Applied rewrites58.3%
if -inf.0 < (*.f64 (*.f64 (*.f64 #s(literal -2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64)))) (sqrt.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 U (*.f64 (*.f64 #s(literal 2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64))))) #s(literal 2 binary64))))) < 5.00000000000000026e300Initial program 99.8%
lift-*.f64N/A
lift-/.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
lift-/.f64N/A
unpow2N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
associate-/r*N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites95.7%
Applied rewrites99.7%
lift-*.f64N/A
div-invN/A
metadata-evalN/A
lift-*.f64N/A
lift-cos.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6499.7
Applied rewrites99.7%
if 5.00000000000000026e300 < (*.f64 (*.f64 (*.f64 #s(literal -2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64)))) (sqrt.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 U (*.f64 (*.f64 #s(literal 2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64))))) #s(literal 2 binary64))))) Initial program 5.5%
Taylor expanded in U around -inf
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6439.5
Applied rewrites39.5%
Final simplification89.3%
U_m = (fabs.f64 U)
(FPCore (J K U_m)
:precision binary64
(let* ((t_0 (cos (/ K 2.0)))
(t_1 (* (* -2.0 J) t_0))
(t_2 (* t_1 (sqrt (+ 1.0 (pow (/ U_m (* t_0 (* J 2.0))) 2.0))))))
(if (<= t_2 (- INFINITY))
(- U_m)
(if (<= t_2 5e+300)
(* t_1 (sqrt (+ 1.0 (pow (* 0.5 (/ U_m J)) 2.0))))
(*
(- U_m)
(fma
-2.0
(* (pow (cos (* K 0.5)) 2.0) (/ (* J J) (* U_m U_m)))
-1.0))))))U_m = fabs(U);
double code(double J, double K, double U_m) {
double t_0 = cos((K / 2.0));
double t_1 = (-2.0 * J) * t_0;
double t_2 = t_1 * sqrt((1.0 + pow((U_m / (t_0 * (J * 2.0))), 2.0)));
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = -U_m;
} else if (t_2 <= 5e+300) {
tmp = t_1 * sqrt((1.0 + pow((0.5 * (U_m / J)), 2.0)));
} else {
tmp = -U_m * fma(-2.0, (pow(cos((K * 0.5)), 2.0) * ((J * J) / (U_m * U_m))), -1.0);
}
return tmp;
}
U_m = abs(U) function code(J, K, U_m) t_0 = cos(Float64(K / 2.0)) t_1 = Float64(Float64(-2.0 * J) * t_0) t_2 = Float64(t_1 * sqrt(Float64(1.0 + (Float64(U_m / Float64(t_0 * Float64(J * 2.0))) ^ 2.0)))) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = Float64(-U_m); elseif (t_2 <= 5e+300) tmp = Float64(t_1 * sqrt(Float64(1.0 + (Float64(0.5 * Float64(U_m / J)) ^ 2.0)))); else tmp = Float64(Float64(-U_m) * fma(-2.0, Float64((cos(Float64(K * 0.5)) ^ 2.0) * Float64(Float64(J * J) / Float64(U_m * U_m))), -1.0)); end return tmp end
U_m = N[Abs[U], $MachinePrecision]
code[J_, K_, U$95$m_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(-2.0 * J), $MachinePrecision] * t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 * N[Sqrt[N[(1.0 + N[Power[N[(U$95$m / N[(t$95$0 * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], (-U$95$m), If[LessEqual[t$95$2, 5e+300], N[(t$95$1 * N[Sqrt[N[(1.0 + N[Power[N[(0.5 * N[(U$95$m / J), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[((-U$95$m) * N[(-2.0 * N[(N[Power[N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(J * J), $MachinePrecision] / N[(U$95$m * U$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
U_m = \left|U\right|
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
t_1 := \left(-2 \cdot J\right) \cdot t\_0\\
t_2 := t\_1 \cdot \sqrt{1 + {\left(\frac{U\_m}{t\_0 \cdot \left(J \cdot 2\right)}\right)}^{2}}\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;-U\_m\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+300}:\\
\;\;\;\;t\_1 \cdot \sqrt{1 + {\left(0.5 \cdot \frac{U\_m}{J}\right)}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\left(-U\_m\right) \cdot \mathsf{fma}\left(-2, {\cos \left(K \cdot 0.5\right)}^{2} \cdot \frac{J \cdot J}{U\_m \cdot U\_m}, -1\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 (*.f64 #s(literal -2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64)))) (sqrt.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 U (*.f64 (*.f64 #s(literal 2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64))))) #s(literal 2 binary64))))) < -inf.0Initial program 6.3%
Taylor expanded in J around 0
mul-1-negN/A
lower-neg.f6458.3
Applied rewrites58.3%
if -inf.0 < (*.f64 (*.f64 (*.f64 #s(literal -2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64)))) (sqrt.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 U (*.f64 (*.f64 #s(literal 2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64))))) #s(literal 2 binary64))))) < 5.00000000000000026e300Initial program 99.8%
Taylor expanded in K around 0
lower-*.f64N/A
lower-/.f6487.4
Applied rewrites87.4%
if 5.00000000000000026e300 < (*.f64 (*.f64 (*.f64 #s(literal -2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64)))) (sqrt.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 U (*.f64 (*.f64 #s(literal 2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64))))) #s(literal 2 binary64))))) Initial program 5.5%
Taylor expanded in U around -inf
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6439.5
Applied rewrites39.5%
Final simplification79.6%
U_m = (fabs.f64 U)
(FPCore (J K U_m)
:precision binary64
(let* ((t_0 (cos (/ K 2.0)))
(t_1 (* (* -2.0 J) t_0))
(t_2 (* t_1 (sqrt (+ 1.0 (pow (/ U_m (* t_0 (* J 2.0))) 2.0))))))
(if (<= t_2 (- INFINITY))
(- U_m)
(if (<= t_2 5e+300)
(* t_1 (sqrt (fma 0.25 (/ (* U_m (/ U_m J)) J) 1.0)))
(*
(- U_m)
(fma
-2.0
(* (pow (cos (* K 0.5)) 2.0) (/ (* J J) (* U_m U_m)))
-1.0))))))U_m = fabs(U);
double code(double J, double K, double U_m) {
double t_0 = cos((K / 2.0));
double t_1 = (-2.0 * J) * t_0;
double t_2 = t_1 * sqrt((1.0 + pow((U_m / (t_0 * (J * 2.0))), 2.0)));
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = -U_m;
} else if (t_2 <= 5e+300) {
tmp = t_1 * sqrt(fma(0.25, ((U_m * (U_m / J)) / J), 1.0));
} else {
tmp = -U_m * fma(-2.0, (pow(cos((K * 0.5)), 2.0) * ((J * J) / (U_m * U_m))), -1.0);
}
return tmp;
}
U_m = abs(U) function code(J, K, U_m) t_0 = cos(Float64(K / 2.0)) t_1 = Float64(Float64(-2.0 * J) * t_0) t_2 = Float64(t_1 * sqrt(Float64(1.0 + (Float64(U_m / Float64(t_0 * Float64(J * 2.0))) ^ 2.0)))) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = Float64(-U_m); elseif (t_2 <= 5e+300) tmp = Float64(t_1 * sqrt(fma(0.25, Float64(Float64(U_m * Float64(U_m / J)) / J), 1.0))); else tmp = Float64(Float64(-U_m) * fma(-2.0, Float64((cos(Float64(K * 0.5)) ^ 2.0) * Float64(Float64(J * J) / Float64(U_m * U_m))), -1.0)); end return tmp end
U_m = N[Abs[U], $MachinePrecision]
code[J_, K_, U$95$m_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(-2.0 * J), $MachinePrecision] * t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 * N[Sqrt[N[(1.0 + N[Power[N[(U$95$m / N[(t$95$0 * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], (-U$95$m), If[LessEqual[t$95$2, 5e+300], N[(t$95$1 * N[Sqrt[N[(0.25 * N[(N[(U$95$m * N[(U$95$m / J), $MachinePrecision]), $MachinePrecision] / J), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[((-U$95$m) * N[(-2.0 * N[(N[Power[N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(J * J), $MachinePrecision] / N[(U$95$m * U$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
U_m = \left|U\right|
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
t_1 := \left(-2 \cdot J\right) \cdot t\_0\\
t_2 := t\_1 \cdot \sqrt{1 + {\left(\frac{U\_m}{t\_0 \cdot \left(J \cdot 2\right)}\right)}^{2}}\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;-U\_m\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+300}:\\
\;\;\;\;t\_1 \cdot \sqrt{\mathsf{fma}\left(0.25, \frac{U\_m \cdot \frac{U\_m}{J}}{J}, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\left(-U\_m\right) \cdot \mathsf{fma}\left(-2, {\cos \left(K \cdot 0.5\right)}^{2} \cdot \frac{J \cdot J}{U\_m \cdot U\_m}, -1\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 (*.f64 #s(literal -2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64)))) (sqrt.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 U (*.f64 (*.f64 #s(literal 2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64))))) #s(literal 2 binary64))))) < -inf.0Initial program 6.3%
Taylor expanded in J around 0
mul-1-negN/A
lower-neg.f6458.3
Applied rewrites58.3%
if -inf.0 < (*.f64 (*.f64 (*.f64 #s(literal -2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64)))) (sqrt.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 U (*.f64 (*.f64 #s(literal 2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64))))) #s(literal 2 binary64))))) < 5.00000000000000026e300Initial program 99.8%
Taylor expanded in K around 0
lower-sqrt.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6467.2
Applied rewrites67.2%
times-fracN/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f6485.2
Applied rewrites85.2%
if 5.00000000000000026e300 < (*.f64 (*.f64 (*.f64 #s(literal -2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64)))) (sqrt.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 U (*.f64 (*.f64 #s(literal 2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64))))) #s(literal 2 binary64))))) Initial program 5.5%
Taylor expanded in U around -inf
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6439.5
Applied rewrites39.5%
Final simplification77.8%
U_m = (fabs.f64 U)
(FPCore (J K U_m)
:precision binary64
(let* ((t_0 (cos (/ K 2.0)))
(t_1 (* (* -2.0 J) t_0))
(t_2 (* t_1 (sqrt (+ 1.0 (pow (/ U_m (* t_0 (* J 2.0))) 2.0))))))
(if (<= t_2 (- INFINITY))
(- U_m)
(if (<= t_2 5e+300)
(* t_1 (sqrt (fma 0.25 (/ (* U_m (/ U_m J)) J) 1.0)))
(* U_m (/ (- (cos (* K 0.5))) (sqrt (fma 0.5 (cos K) 0.5))))))))U_m = fabs(U);
double code(double J, double K, double U_m) {
double t_0 = cos((K / 2.0));
double t_1 = (-2.0 * J) * t_0;
double t_2 = t_1 * sqrt((1.0 + pow((U_m / (t_0 * (J * 2.0))), 2.0)));
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = -U_m;
} else if (t_2 <= 5e+300) {
tmp = t_1 * sqrt(fma(0.25, ((U_m * (U_m / J)) / J), 1.0));
} else {
tmp = U_m * (-cos((K * 0.5)) / sqrt(fma(0.5, cos(K), 0.5)));
}
return tmp;
}
U_m = abs(U) function code(J, K, U_m) t_0 = cos(Float64(K / 2.0)) t_1 = Float64(Float64(-2.0 * J) * t_0) t_2 = Float64(t_1 * sqrt(Float64(1.0 + (Float64(U_m / Float64(t_0 * Float64(J * 2.0))) ^ 2.0)))) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = Float64(-U_m); elseif (t_2 <= 5e+300) tmp = Float64(t_1 * sqrt(fma(0.25, Float64(Float64(U_m * Float64(U_m / J)) / J), 1.0))); else tmp = Float64(U_m * Float64(Float64(-cos(Float64(K * 0.5))) / sqrt(fma(0.5, cos(K), 0.5)))); end return tmp end
U_m = N[Abs[U], $MachinePrecision]
code[J_, K_, U$95$m_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(-2.0 * J), $MachinePrecision] * t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 * N[Sqrt[N[(1.0 + N[Power[N[(U$95$m / N[(t$95$0 * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], (-U$95$m), If[LessEqual[t$95$2, 5e+300], N[(t$95$1 * N[Sqrt[N[(0.25 * N[(N[(U$95$m * N[(U$95$m / J), $MachinePrecision]), $MachinePrecision] / J), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(U$95$m * N[((-N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]) / N[Sqrt[N[(0.5 * N[Cos[K], $MachinePrecision] + 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
U_m = \left|U\right|
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
t_1 := \left(-2 \cdot J\right) \cdot t\_0\\
t_2 := t\_1 \cdot \sqrt{1 + {\left(\frac{U\_m}{t\_0 \cdot \left(J \cdot 2\right)}\right)}^{2}}\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;-U\_m\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+300}:\\
\;\;\;\;t\_1 \cdot \sqrt{\mathsf{fma}\left(0.25, \frac{U\_m \cdot \frac{U\_m}{J}}{J}, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;U\_m \cdot \frac{-\cos \left(K \cdot 0.5\right)}{\sqrt{\mathsf{fma}\left(0.5, \cos K, 0.5\right)}}\\
\end{array}
\end{array}
if (*.f64 (*.f64 (*.f64 #s(literal -2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64)))) (sqrt.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 U (*.f64 (*.f64 #s(literal 2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64))))) #s(literal 2 binary64))))) < -inf.0Initial program 6.3%
Taylor expanded in J around 0
mul-1-negN/A
lower-neg.f6458.3
Applied rewrites58.3%
if -inf.0 < (*.f64 (*.f64 (*.f64 #s(literal -2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64)))) (sqrt.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 U (*.f64 (*.f64 #s(literal 2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64))))) #s(literal 2 binary64))))) < 5.00000000000000026e300Initial program 99.8%
Taylor expanded in K around 0
lower-sqrt.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6467.2
Applied rewrites67.2%
times-fracN/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f6485.2
Applied rewrites85.2%
if 5.00000000000000026e300 < (*.f64 (*.f64 (*.f64 #s(literal -2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64)))) (sqrt.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 U (*.f64 (*.f64 #s(literal 2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64))))) #s(literal 2 binary64))))) Initial program 5.5%
lift-*.f64N/A
lift-/.f64N/A
lift-cos.f64N/A
lift-*.f64N/A
lift-/.f64N/A
unpow2N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
associate-*l/N/A
lift-/.f64N/A
associate-*r/N/A
associate-/r*N/A
Applied rewrites5.5%
Taylor expanded in J around 0
mul-1-negN/A
lower-neg.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-cos.f6461.0
Applied rewrites61.0%
lift-*.f64N/A
lift-cos.f64N/A
lift-cos.f64N/A
lift-fma.f64N/A
lift-/.f64N/A
lift-sqrt.f64N/A
associate-*l*N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
lower-neg.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-sqrt.f64N/A
lift-/.f64N/A
Applied rewrites61.0%
Final simplification79.7%
U_m = (fabs.f64 U)
(FPCore (J K U_m)
:precision binary64
(let* ((t_0 (cos (/ K 2.0)))
(t_1
(*
(* (* -2.0 J) t_0)
(sqrt (+ 1.0 (pow (/ U_m (* t_0 (* J 2.0))) 2.0))))))
(if (<= t_1 (- INFINITY))
(- U_m)
(if (<= t_1 -4e-213)
(*
(sqrt (fma 0.25 (/ (* U_m (/ U_m J)) J) 1.0))
(*
(* -2.0 J)
(fma (* K K) (fma (* K K) 0.0026041666666666665 -0.125) 1.0)))
(* (- U_m) (cos (* K 0.5)))))))U_m = fabs(U);
double code(double J, double K, double U_m) {
double t_0 = cos((K / 2.0));
double t_1 = ((-2.0 * J) * t_0) * sqrt((1.0 + pow((U_m / (t_0 * (J * 2.0))), 2.0)));
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = -U_m;
} else if (t_1 <= -4e-213) {
tmp = sqrt(fma(0.25, ((U_m * (U_m / J)) / J), 1.0)) * ((-2.0 * J) * fma((K * K), fma((K * K), 0.0026041666666666665, -0.125), 1.0));
} else {
tmp = -U_m * cos((K * 0.5));
}
return tmp;
}
U_m = abs(U) function code(J, K, U_m) t_0 = cos(Float64(K / 2.0)) t_1 = Float64(Float64(Float64(-2.0 * J) * t_0) * sqrt(Float64(1.0 + (Float64(U_m / Float64(t_0 * Float64(J * 2.0))) ^ 2.0)))) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(-U_m); elseif (t_1 <= -4e-213) tmp = Float64(sqrt(fma(0.25, Float64(Float64(U_m * Float64(U_m / J)) / J), 1.0)) * Float64(Float64(-2.0 * J) * fma(Float64(K * K), fma(Float64(K * K), 0.0026041666666666665, -0.125), 1.0))); else tmp = Float64(Float64(-U_m) * cos(Float64(K * 0.5))); end return tmp end
U_m = N[Abs[U], $MachinePrecision]
code[J_, K_, U$95$m_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(-2.0 * J), $MachinePrecision] * t$95$0), $MachinePrecision] * N[Sqrt[N[(1.0 + N[Power[N[(U$95$m / N[(t$95$0 * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], (-U$95$m), If[LessEqual[t$95$1, -4e-213], N[(N[Sqrt[N[(0.25 * N[(N[(U$95$m * N[(U$95$m / J), $MachinePrecision]), $MachinePrecision] / J), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision] * N[(N[(-2.0 * J), $MachinePrecision] * N[(N[(K * K), $MachinePrecision] * N[(N[(K * K), $MachinePrecision] * 0.0026041666666666665 + -0.125), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-U$95$m) * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
U_m = \left|U\right|
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
t_1 := \left(\left(-2 \cdot J\right) \cdot t\_0\right) \cdot \sqrt{1 + {\left(\frac{U\_m}{t\_0 \cdot \left(J \cdot 2\right)}\right)}^{2}}\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;-U\_m\\
\mathbf{elif}\;t\_1 \leq -4 \cdot 10^{-213}:\\
\;\;\;\;\sqrt{\mathsf{fma}\left(0.25, \frac{U\_m \cdot \frac{U\_m}{J}}{J}, 1\right)} \cdot \left(\left(-2 \cdot J\right) \cdot \mathsf{fma}\left(K \cdot K, \mathsf{fma}\left(K \cdot K, 0.0026041666666666665, -0.125\right), 1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(-U\_m\right) \cdot \cos \left(K \cdot 0.5\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 (*.f64 #s(literal -2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64)))) (sqrt.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 U (*.f64 (*.f64 #s(literal 2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64))))) #s(literal 2 binary64))))) < -inf.0Initial program 6.3%
Taylor expanded in J around 0
mul-1-negN/A
lower-neg.f6458.3
Applied rewrites58.3%
if -inf.0 < (*.f64 (*.f64 (*.f64 #s(literal -2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64)))) (sqrt.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 U (*.f64 (*.f64 #s(literal 2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64))))) #s(literal 2 binary64))))) < -3.9999999999999998e-213Initial program 99.8%
Taylor expanded in K around 0
lower-sqrt.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6467.4
Applied rewrites67.4%
Taylor expanded in K around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6436.1
Applied rewrites36.1%
times-fracN/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f6444.2
Applied rewrites44.2%
if -3.9999999999999998e-213 < (*.f64 (*.f64 (*.f64 #s(literal -2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64)))) (sqrt.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 U (*.f64 (*.f64 #s(literal 2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64))))) #s(literal 2 binary64))))) Initial program 82.0%
Taylor expanded in K around 0
lower-sqrt.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6455.3
Applied rewrites55.3%
Taylor expanded in J around 0
mul-1-negN/A
*-commutativeN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6420.0
Applied rewrites20.0%
Final simplification34.4%
U_m = (fabs.f64 U)
(FPCore (J K U_m)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))) (t_1 (* (* -2.0 J) t_0)))
(if (<=
(* t_1 (sqrt (+ 1.0 (pow (/ U_m (* t_0 (* J 2.0))) 2.0))))
(- INFINITY))
(- U_m)
(* t_1 (sqrt (fma 0.25 (/ (* U_m (/ U_m J)) J) 1.0))))))U_m = fabs(U);
double code(double J, double K, double U_m) {
double t_0 = cos((K / 2.0));
double t_1 = (-2.0 * J) * t_0;
double tmp;
if ((t_1 * sqrt((1.0 + pow((U_m / (t_0 * (J * 2.0))), 2.0)))) <= -((double) INFINITY)) {
tmp = -U_m;
} else {
tmp = t_1 * sqrt(fma(0.25, ((U_m * (U_m / J)) / J), 1.0));
}
return tmp;
}
U_m = abs(U) function code(J, K, U_m) t_0 = cos(Float64(K / 2.0)) t_1 = Float64(Float64(-2.0 * J) * t_0) tmp = 0.0 if (Float64(t_1 * sqrt(Float64(1.0 + (Float64(U_m / Float64(t_0 * Float64(J * 2.0))) ^ 2.0)))) <= Float64(-Inf)) tmp = Float64(-U_m); else tmp = Float64(t_1 * sqrt(fma(0.25, Float64(Float64(U_m * Float64(U_m / J)) / J), 1.0))); end return tmp end
U_m = N[Abs[U], $MachinePrecision]
code[J_, K_, U$95$m_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(-2.0 * J), $MachinePrecision] * t$95$0), $MachinePrecision]}, If[LessEqual[N[(t$95$1 * N[Sqrt[N[(1.0 + N[Power[N[(U$95$m / N[(t$95$0 * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], (-Infinity)], (-U$95$m), N[(t$95$1 * N[Sqrt[N[(0.25 * N[(N[(U$95$m * N[(U$95$m / J), $MachinePrecision]), $MachinePrecision] / J), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
U_m = \left|U\right|
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
t_1 := \left(-2 \cdot J\right) \cdot t\_0\\
\mathbf{if}\;t\_1 \cdot \sqrt{1 + {\left(\frac{U\_m}{t\_0 \cdot \left(J \cdot 2\right)}\right)}^{2}} \leq -\infty:\\
\;\;\;\;-U\_m\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \sqrt{\mathsf{fma}\left(0.25, \frac{U\_m \cdot \frac{U\_m}{J}}{J}, 1\right)}\\
\end{array}
\end{array}
if (*.f64 (*.f64 (*.f64 #s(literal -2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64)))) (sqrt.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 U (*.f64 (*.f64 #s(literal 2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64))))) #s(literal 2 binary64))))) < -inf.0Initial program 6.3%
Taylor expanded in J around 0
mul-1-negN/A
lower-neg.f6458.3
Applied rewrites58.3%
if -inf.0 < (*.f64 (*.f64 (*.f64 #s(literal -2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64)))) (sqrt.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 U (*.f64 (*.f64 #s(literal 2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64))))) #s(literal 2 binary64))))) Initial program 90.2%
Taylor expanded in K around 0
lower-sqrt.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6460.9
Applied rewrites60.9%
times-fracN/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f6477.0
Applied rewrites77.0%
Final simplification74.8%
U_m = (fabs.f64 U)
(FPCore (J K U_m)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<=
(*
(* (* -2.0 J) t_0)
(sqrt (+ 1.0 (pow (/ U_m (* t_0 (* J 2.0))) 2.0))))
(- INFINITY))
(- U_m)
(*
(sqrt (fma 0.25 (/ (* U_m (/ U_m J)) J) 1.0))
(*
(* -2.0 J)
(fma (* K K) (fma (* K K) 0.0026041666666666665 -0.125) 1.0))))))U_m = fabs(U);
double code(double J, double K, double U_m) {
double t_0 = cos((K / 2.0));
double tmp;
if ((((-2.0 * J) * t_0) * sqrt((1.0 + pow((U_m / (t_0 * (J * 2.0))), 2.0)))) <= -((double) INFINITY)) {
tmp = -U_m;
} else {
tmp = sqrt(fma(0.25, ((U_m * (U_m / J)) / J), 1.0)) * ((-2.0 * J) * fma((K * K), fma((K * K), 0.0026041666666666665, -0.125), 1.0));
}
return tmp;
}
U_m = abs(U) function code(J, K, U_m) t_0 = cos(Float64(K / 2.0)) tmp = 0.0 if (Float64(Float64(Float64(-2.0 * J) * t_0) * sqrt(Float64(1.0 + (Float64(U_m / Float64(t_0 * Float64(J * 2.0))) ^ 2.0)))) <= Float64(-Inf)) tmp = Float64(-U_m); else tmp = Float64(sqrt(fma(0.25, Float64(Float64(U_m * Float64(U_m / J)) / J), 1.0)) * Float64(Float64(-2.0 * J) * fma(Float64(K * K), fma(Float64(K * K), 0.0026041666666666665, -0.125), 1.0))); end return tmp end
U_m = N[Abs[U], $MachinePrecision]
code[J_, K_, U$95$m_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(N[(N[(-2.0 * J), $MachinePrecision] * t$95$0), $MachinePrecision] * N[Sqrt[N[(1.0 + N[Power[N[(U$95$m / N[(t$95$0 * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], (-Infinity)], (-U$95$m), N[(N[Sqrt[N[(0.25 * N[(N[(U$95$m * N[(U$95$m / J), $MachinePrecision]), $MachinePrecision] / J), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision] * N[(N[(-2.0 * J), $MachinePrecision] * N[(N[(K * K), $MachinePrecision] * N[(N[(K * K), $MachinePrecision] * 0.0026041666666666665 + -0.125), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
U_m = \left|U\right|
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;\left(\left(-2 \cdot J\right) \cdot t\_0\right) \cdot \sqrt{1 + {\left(\frac{U\_m}{t\_0 \cdot \left(J \cdot 2\right)}\right)}^{2}} \leq -\infty:\\
\;\;\;\;-U\_m\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\mathsf{fma}\left(0.25, \frac{U\_m \cdot \frac{U\_m}{J}}{J}, 1\right)} \cdot \left(\left(-2 \cdot J\right) \cdot \mathsf{fma}\left(K \cdot K, \mathsf{fma}\left(K \cdot K, 0.0026041666666666665, -0.125\right), 1\right)\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 (*.f64 #s(literal -2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64)))) (sqrt.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 U (*.f64 (*.f64 #s(literal 2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64))))) #s(literal 2 binary64))))) < -inf.0Initial program 6.3%
Taylor expanded in J around 0
mul-1-negN/A
lower-neg.f6458.3
Applied rewrites58.3%
if -inf.0 < (*.f64 (*.f64 (*.f64 #s(literal -2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64)))) (sqrt.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 U (*.f64 (*.f64 #s(literal 2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64))))) #s(literal 2 binary64))))) Initial program 90.2%
Taylor expanded in K around 0
lower-sqrt.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6460.9
Applied rewrites60.9%
Taylor expanded in K around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6432.4
Applied rewrites32.4%
times-fracN/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f6443.6
Applied rewrites43.6%
Final simplification45.4%
U_m = (fabs.f64 U) (FPCore (J K U_m) :precision binary64 (if (<= U_m 5.2e+17) (* -2.0 (fma (* J (* K K)) (fma (* K K) 0.0026041666666666665 -0.125) J)) (- U_m)))
U_m = fabs(U);
double code(double J, double K, double U_m) {
double tmp;
if (U_m <= 5.2e+17) {
tmp = -2.0 * fma((J * (K * K)), fma((K * K), 0.0026041666666666665, -0.125), J);
} else {
tmp = -U_m;
}
return tmp;
}
U_m = abs(U) function code(J, K, U_m) tmp = 0.0 if (U_m <= 5.2e+17) tmp = Float64(-2.0 * fma(Float64(J * Float64(K * K)), fma(Float64(K * K), 0.0026041666666666665, -0.125), J)); else tmp = Float64(-U_m); end return tmp end
U_m = N[Abs[U], $MachinePrecision] code[J_, K_, U$95$m_] := If[LessEqual[U$95$m, 5.2e+17], N[(-2.0 * N[(N[(J * N[(K * K), $MachinePrecision]), $MachinePrecision] * N[(N[(K * K), $MachinePrecision] * 0.0026041666666666665 + -0.125), $MachinePrecision] + J), $MachinePrecision]), $MachinePrecision], (-U$95$m)]
\begin{array}{l}
U_m = \left|U\right|
\\
\begin{array}{l}
\mathbf{if}\;U\_m \leq 5.2 \cdot 10^{+17}:\\
\;\;\;\;-2 \cdot \mathsf{fma}\left(J \cdot \left(K \cdot K\right), \mathsf{fma}\left(K \cdot K, 0.0026041666666666665, -0.125\right), J\right)\\
\mathbf{else}:\\
\;\;\;\;-U\_m\\
\end{array}
\end{array}
if U < 5.2e17Initial program 87.0%
Taylor expanded in K around 0
lower-sqrt.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6461.1
Applied rewrites61.1%
Taylor expanded in K around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6432.7
Applied rewrites32.7%
Taylor expanded in J around inf
lower-*.f64N/A
+-commutativeN/A
distribute-lft-inN/A
associate-*r*N/A
*-rgt-identityN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6431.9
Applied rewrites31.9%
if 5.2e17 < U Initial program 51.7%
Taylor expanded in J around 0
mul-1-negN/A
lower-neg.f6449.8
Applied rewrites49.8%
U_m = (fabs.f64 U) (FPCore (J K U_m) :precision binary64 (- U_m))
U_m = fabs(U);
double code(double J, double K, double U_m) {
return -U_m;
}
U_m = abs(u)
real(8) function code(j, k, u_m)
real(8), intent (in) :: j
real(8), intent (in) :: k
real(8), intent (in) :: u_m
code = -u_m
end function
U_m = Math.abs(U);
public static double code(double J, double K, double U_m) {
return -U_m;
}
U_m = math.fabs(U) def code(J, K, U_m): return -U_m
U_m = abs(U) function code(J, K, U_m) return Float64(-U_m) end
U_m = abs(U); function tmp = code(J, K, U_m) tmp = -U_m; end
U_m = N[Abs[U], $MachinePrecision] code[J_, K_, U$95$m_] := (-U$95$m)
\begin{array}{l}
U_m = \left|U\right|
\\
-U\_m
\end{array}
Initial program 80.0%
Taylor expanded in J around 0
mul-1-negN/A
lower-neg.f6426.8
Applied rewrites26.8%
herbie shell --seed 2024214
(FPCore (J K U)
:name "Maksimov and Kolovsky, Equation (3)"
:precision binary64
(* (* (* -2.0 J) (cos (/ K 2.0))) (sqrt (+ 1.0 (pow (/ U (* (* 2.0 J) (cos (/ K 2.0)))) 2.0)))))