
(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 15 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
(*
(sqrt (+ (pow (/ U_m (* (* 2.0 J) t_0)) 2.0) 1.0))
(* t_0 (* J -2.0)))))
(if (<= t_1 (- INFINITY))
(- U_m)
(if (<= t_1 1e+305) t_1 (* -1.0 (- 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 = sqrt((pow((U_m / ((2.0 * J) * t_0)), 2.0) + 1.0)) * (t_0 * (J * -2.0));
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = -U_m;
} else if (t_1 <= 1e+305) {
tmp = t_1;
} else {
tmp = -1.0 * -U_m;
}
return tmp;
}
U_m = Math.abs(U);
public static double code(double J, double K, double U_m) {
double t_0 = Math.cos((K / 2.0));
double t_1 = Math.sqrt((Math.pow((U_m / ((2.0 * J) * t_0)), 2.0) + 1.0)) * (t_0 * (J * -2.0));
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = -U_m;
} else if (t_1 <= 1e+305) {
tmp = t_1;
} else {
tmp = -1.0 * -U_m;
}
return tmp;
}
U_m = math.fabs(U) def code(J, K, U_m): t_0 = math.cos((K / 2.0)) t_1 = math.sqrt((math.pow((U_m / ((2.0 * J) * t_0)), 2.0) + 1.0)) * (t_0 * (J * -2.0)) tmp = 0 if t_1 <= -math.inf: tmp = -U_m elif t_1 <= 1e+305: tmp = t_1 else: tmp = -1.0 * -U_m return tmp
U_m = abs(U) function code(J, K, U_m) t_0 = cos(Float64(K / 2.0)) t_1 = Float64(sqrt(Float64((Float64(U_m / Float64(Float64(2.0 * J) * t_0)) ^ 2.0) + 1.0)) * Float64(t_0 * Float64(J * -2.0))) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(-U_m); elseif (t_1 <= 1e+305) tmp = t_1; else tmp = Float64(-1.0 * Float64(-U_m)); end return tmp end
U_m = abs(U); function tmp_2 = code(J, K, U_m) t_0 = cos((K / 2.0)); t_1 = sqrt((((U_m / ((2.0 * J) * t_0)) ^ 2.0) + 1.0)) * (t_0 * (J * -2.0)); tmp = 0.0; if (t_1 <= -Inf) tmp = -U_m; elseif (t_1 <= 1e+305) tmp = t_1; else tmp = -1.0 * -U_m; end tmp_2 = 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[Sqrt[N[(N[Power[N[(U$95$m / N[(N[(2.0 * J), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision] * N[(t$95$0 * N[(J * -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], (-U$95$m), If[LessEqual[t$95$1, 1e+305], t$95$1, N[(-1.0 * (-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 := \sqrt{{\left(\frac{U\_m}{\left(2 \cdot J\right) \cdot t\_0}\right)}^{2} + 1} \cdot \left(t\_0 \cdot \left(J \cdot -2\right)\right)\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;-U\_m\\
\mathbf{elif}\;t\_1 \leq 10^{+305}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;-1 \cdot \left(-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 5.0%
Taylor expanded in U around inf
mul-1-negN/A
lower-neg.f6455.9
Applied rewrites55.9%
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))))) < 9.9999999999999994e304Initial program 99.8%
if 9.9999999999999994e304 < (*.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 6.0%
Taylor expanded in U around -inf
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites53.6%
Taylor expanded in U around inf
Applied rewrites53.6%
Final simplification88.2%
U_m = (fabs.f64 U)
(FPCore (J K U_m)
:precision binary64
(let* ((t_0
(*
(sqrt
(fma (* (/ 0.25 (* (* (fma (cos K) 0.5 0.5) J) J)) U_m) U_m 1.0))
(* (cos (* 0.5 K)) (* J -2.0))))
(t_1 (cos (/ K 2.0)))
(t_2
(*
(sqrt (+ (pow (/ U_m (* (* 2.0 J) t_1)) 2.0) 1.0))
(* t_1 (* J -2.0)))))
(if (<= t_2 -2e+300)
(fma (/ J U_m) (* J -2.0) (- U_m))
(if (<= t_2 -5e-64)
t_0
(if (<= t_2 1e-167)
(* (sqrt (fma (/ (* (/ U_m J) U_m) J) 0.25 1.0)) (* J -2.0))
(if (<= t_2 1e+305) t_0 (* -1.0 (- U_m))))))))U_m = fabs(U);
double code(double J, double K, double U_m) {
double t_0 = sqrt(fma(((0.25 / ((fma(cos(K), 0.5, 0.5) * J) * J)) * U_m), U_m, 1.0)) * (cos((0.5 * K)) * (J * -2.0));
double t_1 = cos((K / 2.0));
double t_2 = sqrt((pow((U_m / ((2.0 * J) * t_1)), 2.0) + 1.0)) * (t_1 * (J * -2.0));
double tmp;
if (t_2 <= -2e+300) {
tmp = fma((J / U_m), (J * -2.0), -U_m);
} else if (t_2 <= -5e-64) {
tmp = t_0;
} else if (t_2 <= 1e-167) {
tmp = sqrt(fma((((U_m / J) * U_m) / J), 0.25, 1.0)) * (J * -2.0);
} else if (t_2 <= 1e+305) {
tmp = t_0;
} else {
tmp = -1.0 * -U_m;
}
return tmp;
}
U_m = abs(U) function code(J, K, U_m) t_0 = Float64(sqrt(fma(Float64(Float64(0.25 / Float64(Float64(fma(cos(K), 0.5, 0.5) * J) * J)) * U_m), U_m, 1.0)) * Float64(cos(Float64(0.5 * K)) * Float64(J * -2.0))) t_1 = cos(Float64(K / 2.0)) t_2 = Float64(sqrt(Float64((Float64(U_m / Float64(Float64(2.0 * J) * t_1)) ^ 2.0) + 1.0)) * Float64(t_1 * Float64(J * -2.0))) tmp = 0.0 if (t_2 <= -2e+300) tmp = fma(Float64(J / U_m), Float64(J * -2.0), Float64(-U_m)); elseif (t_2 <= -5e-64) tmp = t_0; elseif (t_2 <= 1e-167) tmp = Float64(sqrt(fma(Float64(Float64(Float64(U_m / J) * U_m) / J), 0.25, 1.0)) * Float64(J * -2.0)); elseif (t_2 <= 1e+305) tmp = t_0; else tmp = Float64(-1.0 * Float64(-U_m)); end return tmp end
U_m = N[Abs[U], $MachinePrecision]
code[J_, K_, U$95$m_] := Block[{t$95$0 = N[(N[Sqrt[N[(N[(N[(0.25 / N[(N[(N[(N[Cos[K], $MachinePrecision] * 0.5 + 0.5), $MachinePrecision] * J), $MachinePrecision] * J), $MachinePrecision]), $MachinePrecision] * U$95$m), $MachinePrecision] * U$95$m + 1.0), $MachinePrecision]], $MachinePrecision] * N[(N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision] * N[(J * -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[N[(N[Power[N[(U$95$m / N[(N[(2.0 * J), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision] * N[(t$95$1 * N[(J * -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -2e+300], N[(N[(J / U$95$m), $MachinePrecision] * N[(J * -2.0), $MachinePrecision] + (-U$95$m)), $MachinePrecision], If[LessEqual[t$95$2, -5e-64], t$95$0, If[LessEqual[t$95$2, 1e-167], N[(N[Sqrt[N[(N[(N[(N[(U$95$m / J), $MachinePrecision] * U$95$m), $MachinePrecision] / J), $MachinePrecision] * 0.25 + 1.0), $MachinePrecision]], $MachinePrecision] * N[(J * -2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 1e+305], t$95$0, N[(-1.0 * (-U$95$m)), $MachinePrecision]]]]]]]]
\begin{array}{l}
U_m = \left|U\right|
\\
\begin{array}{l}
t_0 := \sqrt{\mathsf{fma}\left(\frac{0.25}{\left(\mathsf{fma}\left(\cos K, 0.5, 0.5\right) \cdot J\right) \cdot J} \cdot U\_m, U\_m, 1\right)} \cdot \left(\cos \left(0.5 \cdot K\right) \cdot \left(J \cdot -2\right)\right)\\
t_1 := \cos \left(\frac{K}{2}\right)\\
t_2 := \sqrt{{\left(\frac{U\_m}{\left(2 \cdot J\right) \cdot t\_1}\right)}^{2} + 1} \cdot \left(t\_1 \cdot \left(J \cdot -2\right)\right)\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{+300}:\\
\;\;\;\;\mathsf{fma}\left(\frac{J}{U\_m}, J \cdot -2, -U\_m\right)\\
\mathbf{elif}\;t\_2 \leq -5 \cdot 10^{-64}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_2 \leq 10^{-167}:\\
\;\;\;\;\sqrt{\mathsf{fma}\left(\frac{\frac{U\_m}{J} \cdot U\_m}{J}, 0.25, 1\right)} \cdot \left(J \cdot -2\right)\\
\mathbf{elif}\;t\_2 \leq 10^{+305}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;-1 \cdot \left(-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))))) < -2.0000000000000001e300Initial program 12.3%
Taylor expanded in J around 0
*-commutativeN/A
associate-/l*N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6452.7
Applied rewrites52.7%
Applied rewrites57.1%
Taylor expanded in K around 0
Applied rewrites57.1%
if -2.0000000000000001e300 < (*.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.00000000000000033e-64 or 1e-167 < (*.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))))) < 9.9999999999999994e304Initial program 99.8%
lift-pow.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
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lift-*.f64N/A
Applied rewrites95.1%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
div-invN/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites95.1%
Taylor expanded in K around inf
*-commutativeN/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites93.3%
if -5.00000000000000033e-64 < (*.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))))) < 1e-167Initial program 99.8%
lift-pow.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
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lift-*.f64N/A
Applied rewrites99.3%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
div-invN/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites99.3%
Taylor expanded in K around 0
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6422.5
Applied rewrites22.5%
Applied rewrites74.6%
if 9.9999999999999994e304 < (*.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 6.0%
Taylor expanded in U around -inf
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites53.6%
Taylor expanded in U around inf
Applied rewrites53.6%
Final simplification81.5%
U_m = (fabs.f64 U)
(FPCore (J K U_m)
:precision binary64
(let* ((t_0 (cos (/ K 2.0)))
(t_1 (* t_0 (* J -2.0)))
(t_2 (* (sqrt (+ (pow (/ U_m (* (* 2.0 J) t_0)) 2.0) 1.0)) t_1))
(t_3 (* (sqrt (fma (* (/ U_m (* J J)) U_m) 0.25 1.0)) t_1)))
(if (<= t_2 -2e+300)
(fma (/ J U_m) (* J -2.0) (- U_m))
(if (<= t_2 -1e-6)
t_3
(if (<= t_2 1e-167)
(* (sqrt (fma (/ (* (/ U_m J) U_m) J) 0.25 1.0)) (* J -2.0))
(if (<= t_2 1e+305) t_3 (* -1.0 (- 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 = t_0 * (J * -2.0);
double t_2 = sqrt((pow((U_m / ((2.0 * J) * t_0)), 2.0) + 1.0)) * t_1;
double t_3 = sqrt(fma(((U_m / (J * J)) * U_m), 0.25, 1.0)) * t_1;
double tmp;
if (t_2 <= -2e+300) {
tmp = fma((J / U_m), (J * -2.0), -U_m);
} else if (t_2 <= -1e-6) {
tmp = t_3;
} else if (t_2 <= 1e-167) {
tmp = sqrt(fma((((U_m / J) * U_m) / J), 0.25, 1.0)) * (J * -2.0);
} else if (t_2 <= 1e+305) {
tmp = t_3;
} else {
tmp = -1.0 * -U_m;
}
return tmp;
}
U_m = abs(U) function code(J, K, U_m) t_0 = cos(Float64(K / 2.0)) t_1 = Float64(t_0 * Float64(J * -2.0)) t_2 = Float64(sqrt(Float64((Float64(U_m / Float64(Float64(2.0 * J) * t_0)) ^ 2.0) + 1.0)) * t_1) t_3 = Float64(sqrt(fma(Float64(Float64(U_m / Float64(J * J)) * U_m), 0.25, 1.0)) * t_1) tmp = 0.0 if (t_2 <= -2e+300) tmp = fma(Float64(J / U_m), Float64(J * -2.0), Float64(-U_m)); elseif (t_2 <= -1e-6) tmp = t_3; elseif (t_2 <= 1e-167) tmp = Float64(sqrt(fma(Float64(Float64(Float64(U_m / J) * U_m) / J), 0.25, 1.0)) * Float64(J * -2.0)); elseif (t_2 <= 1e+305) tmp = t_3; else tmp = Float64(-1.0 * 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[(t$95$0 * N[(J * -2.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[N[(N[Power[N[(U$95$m / N[(N[(2.0 * J), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision] * t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(N[Sqrt[N[(N[(N[(U$95$m / N[(J * J), $MachinePrecision]), $MachinePrecision] * U$95$m), $MachinePrecision] * 0.25 + 1.0), $MachinePrecision]], $MachinePrecision] * t$95$1), $MachinePrecision]}, If[LessEqual[t$95$2, -2e+300], N[(N[(J / U$95$m), $MachinePrecision] * N[(J * -2.0), $MachinePrecision] + (-U$95$m)), $MachinePrecision], If[LessEqual[t$95$2, -1e-6], t$95$3, If[LessEqual[t$95$2, 1e-167], N[(N[Sqrt[N[(N[(N[(N[(U$95$m / J), $MachinePrecision] * U$95$m), $MachinePrecision] / J), $MachinePrecision] * 0.25 + 1.0), $MachinePrecision]], $MachinePrecision] * N[(J * -2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 1e+305], t$95$3, N[(-1.0 * (-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 := t\_0 \cdot \left(J \cdot -2\right)\\
t_2 := \sqrt{{\left(\frac{U\_m}{\left(2 \cdot J\right) \cdot t\_0}\right)}^{2} + 1} \cdot t\_1\\
t_3 := \sqrt{\mathsf{fma}\left(\frac{U\_m}{J \cdot J} \cdot U\_m, 0.25, 1\right)} \cdot t\_1\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{+300}:\\
\;\;\;\;\mathsf{fma}\left(\frac{J}{U\_m}, J \cdot -2, -U\_m\right)\\
\mathbf{elif}\;t\_2 \leq -1 \cdot 10^{-6}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_2 \leq 10^{-167}:\\
\;\;\;\;\sqrt{\mathsf{fma}\left(\frac{\frac{U\_m}{J} \cdot U\_m}{J}, 0.25, 1\right)} \cdot \left(J \cdot -2\right)\\
\mathbf{elif}\;t\_2 \leq 10^{+305}:\\
\;\;\;\;t\_3\\
\mathbf{else}:\\
\;\;\;\;-1 \cdot \left(-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))))) < -2.0000000000000001e300Initial program 12.3%
Taylor expanded in J around 0
*-commutativeN/A
associate-/l*N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6452.7
Applied rewrites52.7%
Applied rewrites57.1%
Taylor expanded in K around 0
Applied rewrites57.1%
if -2.0000000000000001e300 < (*.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))))) < -9.99999999999999955e-7 or 1e-167 < (*.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))))) < 9.9999999999999994e304Initial program 99.8%
Taylor expanded in K around 0
lower-sqrt.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6483.8
Applied rewrites83.8%
if -9.99999999999999955e-7 < (*.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))))) < 1e-167Initial program 99.7%
lift-pow.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
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lift-*.f64N/A
Applied rewrites99.4%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
div-invN/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites99.3%
Taylor expanded in K around 0
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6434.4
Applied rewrites34.4%
Applied rewrites74.4%
if 9.9999999999999994e304 < (*.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 6.0%
Taylor expanded in U around -inf
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites53.6%
Taylor expanded in U around inf
Applied rewrites53.6%
Final simplification75.1%
U_m = (fabs.f64 U)
(FPCore (J K U_m)
:precision binary64
(let* ((t_0 (* (cos (* 0.5 K)) (* J -2.0)))
(t_1 (cos (/ K 2.0)))
(t_2
(*
(sqrt (+ (pow (/ U_m (* (* 2.0 J) t_1)) 2.0) 1.0))
(* t_1 (* J -2.0)))))
(if (<= t_2 -2e+300)
(fma (/ J U_m) (* J -2.0) (- U_m))
(if (<= t_2 -1e-6)
t_0
(if (<= t_2 -1e-185)
(* (sqrt (fma (/ (* (/ U_m J) U_m) J) 0.25 1.0)) (* J -2.0))
(if (<= t_2 1e+305) t_0 (* -1.0 (- U_m))))))))U_m = fabs(U);
double code(double J, double K, double U_m) {
double t_0 = cos((0.5 * K)) * (J * -2.0);
double t_1 = cos((K / 2.0));
double t_2 = sqrt((pow((U_m / ((2.0 * J) * t_1)), 2.0) + 1.0)) * (t_1 * (J * -2.0));
double tmp;
if (t_2 <= -2e+300) {
tmp = fma((J / U_m), (J * -2.0), -U_m);
} else if (t_2 <= -1e-6) {
tmp = t_0;
} else if (t_2 <= -1e-185) {
tmp = sqrt(fma((((U_m / J) * U_m) / J), 0.25, 1.0)) * (J * -2.0);
} else if (t_2 <= 1e+305) {
tmp = t_0;
} else {
tmp = -1.0 * -U_m;
}
return tmp;
}
U_m = abs(U) function code(J, K, U_m) t_0 = Float64(cos(Float64(0.5 * K)) * Float64(J * -2.0)) t_1 = cos(Float64(K / 2.0)) t_2 = Float64(sqrt(Float64((Float64(U_m / Float64(Float64(2.0 * J) * t_1)) ^ 2.0) + 1.0)) * Float64(t_1 * Float64(J * -2.0))) tmp = 0.0 if (t_2 <= -2e+300) tmp = fma(Float64(J / U_m), Float64(J * -2.0), Float64(-U_m)); elseif (t_2 <= -1e-6) tmp = t_0; elseif (t_2 <= -1e-185) tmp = Float64(sqrt(fma(Float64(Float64(Float64(U_m / J) * U_m) / J), 0.25, 1.0)) * Float64(J * -2.0)); elseif (t_2 <= 1e+305) tmp = t_0; else tmp = Float64(-1.0 * Float64(-U_m)); end return tmp end
U_m = N[Abs[U], $MachinePrecision]
code[J_, K_, U$95$m_] := Block[{t$95$0 = N[(N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision] * N[(J * -2.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[N[(N[Power[N[(U$95$m / N[(N[(2.0 * J), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision] * N[(t$95$1 * N[(J * -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -2e+300], N[(N[(J / U$95$m), $MachinePrecision] * N[(J * -2.0), $MachinePrecision] + (-U$95$m)), $MachinePrecision], If[LessEqual[t$95$2, -1e-6], t$95$0, If[LessEqual[t$95$2, -1e-185], N[(N[Sqrt[N[(N[(N[(N[(U$95$m / J), $MachinePrecision] * U$95$m), $MachinePrecision] / J), $MachinePrecision] * 0.25 + 1.0), $MachinePrecision]], $MachinePrecision] * N[(J * -2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 1e+305], t$95$0, N[(-1.0 * (-U$95$m)), $MachinePrecision]]]]]]]]
\begin{array}{l}
U_m = \left|U\right|
\\
\begin{array}{l}
t_0 := \cos \left(0.5 \cdot K\right) \cdot \left(J \cdot -2\right)\\
t_1 := \cos \left(\frac{K}{2}\right)\\
t_2 := \sqrt{{\left(\frac{U\_m}{\left(2 \cdot J\right) \cdot t\_1}\right)}^{2} + 1} \cdot \left(t\_1 \cdot \left(J \cdot -2\right)\right)\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{+300}:\\
\;\;\;\;\mathsf{fma}\left(\frac{J}{U\_m}, J \cdot -2, -U\_m\right)\\
\mathbf{elif}\;t\_2 \leq -1 \cdot 10^{-6}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_2 \leq -1 \cdot 10^{-185}:\\
\;\;\;\;\sqrt{\mathsf{fma}\left(\frac{\frac{U\_m}{J} \cdot U\_m}{J}, 0.25, 1\right)} \cdot \left(J \cdot -2\right)\\
\mathbf{elif}\;t\_2 \leq 10^{+305}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;-1 \cdot \left(-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))))) < -2.0000000000000001e300Initial program 12.3%
Taylor expanded in J around 0
*-commutativeN/A
associate-/l*N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6452.7
Applied rewrites52.7%
Applied rewrites57.1%
Taylor expanded in K around 0
Applied rewrites57.1%
if -2.0000000000000001e300 < (*.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))))) < -9.99999999999999955e-7 or -9.9999999999999999e-186 < (*.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))))) < 9.9999999999999994e304Initial program 99.8%
Taylor expanded in U around 0
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6476.4
Applied rewrites76.4%
if -9.99999999999999955e-7 < (*.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))))) < -9.9999999999999999e-186Initial program 99.7%
lift-pow.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
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lift-*.f64N/A
Applied rewrites99.3%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
div-invN/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites99.4%
Taylor expanded in K around 0
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6449.2
Applied rewrites49.2%
Applied rewrites81.8%
if 9.9999999999999994e304 < (*.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 6.0%
Taylor expanded in U around -inf
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites53.6%
Taylor expanded in U around inf
Applied rewrites53.6%
Final simplification71.3%
U_m = (fabs.f64 U)
(FPCore (J K U_m)
:precision binary64
(let* ((t_0 (* (cos (* 0.5 K)) (* J -2.0)))
(t_1 (cos (/ K 2.0)))
(t_2
(*
(sqrt (+ (pow (/ U_m (* (* 2.0 J) t_1)) 2.0) 1.0))
(* t_1 (* J -2.0)))))
(if (<= t_2 (- INFINITY))
(- U_m)
(if (<= t_2 -2e+221)
(* t_0 (sqrt (fma (/ (* (/ U_m (* (+ (cos K) 1.0) J)) 0.5) J) U_m 1.0)))
(if (<= t_2 1e+305)
(*
(sqrt
(fma
(* (/ (* 0.5 U_m) (* (fma (cos K) 0.5 0.5) J)) U_m)
(/ 0.5 J)
1.0))
t_0)
(* -1.0 (- U_m)))))))U_m = fabs(U);
double code(double J, double K, double U_m) {
double t_0 = cos((0.5 * K)) * (J * -2.0);
double t_1 = cos((K / 2.0));
double t_2 = sqrt((pow((U_m / ((2.0 * J) * t_1)), 2.0) + 1.0)) * (t_1 * (J * -2.0));
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = -U_m;
} else if (t_2 <= -2e+221) {
tmp = t_0 * sqrt(fma((((U_m / ((cos(K) + 1.0) * J)) * 0.5) / J), U_m, 1.0));
} else if (t_2 <= 1e+305) {
tmp = sqrt(fma((((0.5 * U_m) / (fma(cos(K), 0.5, 0.5) * J)) * U_m), (0.5 / J), 1.0)) * t_0;
} else {
tmp = -1.0 * -U_m;
}
return tmp;
}
U_m = abs(U) function code(J, K, U_m) t_0 = Float64(cos(Float64(0.5 * K)) * Float64(J * -2.0)) t_1 = cos(Float64(K / 2.0)) t_2 = Float64(sqrt(Float64((Float64(U_m / Float64(Float64(2.0 * J) * t_1)) ^ 2.0) + 1.0)) * Float64(t_1 * Float64(J * -2.0))) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = Float64(-U_m); elseif (t_2 <= -2e+221) tmp = Float64(t_0 * sqrt(fma(Float64(Float64(Float64(U_m / Float64(Float64(cos(K) + 1.0) * J)) * 0.5) / J), U_m, 1.0))); elseif (t_2 <= 1e+305) tmp = Float64(sqrt(fma(Float64(Float64(Float64(0.5 * U_m) / Float64(fma(cos(K), 0.5, 0.5) * J)) * U_m), Float64(0.5 / J), 1.0)) * t_0); else tmp = Float64(-1.0 * Float64(-U_m)); end return tmp end
U_m = N[Abs[U], $MachinePrecision]
code[J_, K_, U$95$m_] := Block[{t$95$0 = N[(N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision] * N[(J * -2.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[N[(N[Power[N[(U$95$m / N[(N[(2.0 * J), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision] * N[(t$95$1 * N[(J * -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], (-U$95$m), If[LessEqual[t$95$2, -2e+221], N[(t$95$0 * N[Sqrt[N[(N[(N[(N[(U$95$m / N[(N[(N[Cos[K], $MachinePrecision] + 1.0), $MachinePrecision] * J), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision] / J), $MachinePrecision] * U$95$m + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 1e+305], N[(N[Sqrt[N[(N[(N[(N[(0.5 * U$95$m), $MachinePrecision] / N[(N[(N[Cos[K], $MachinePrecision] * 0.5 + 0.5), $MachinePrecision] * J), $MachinePrecision]), $MachinePrecision] * U$95$m), $MachinePrecision] * N[(0.5 / J), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision], N[(-1.0 * (-U$95$m)), $MachinePrecision]]]]]]]
\begin{array}{l}
U_m = \left|U\right|
\\
\begin{array}{l}
t_0 := \cos \left(0.5 \cdot K\right) \cdot \left(J \cdot -2\right)\\
t_1 := \cos \left(\frac{K}{2}\right)\\
t_2 := \sqrt{{\left(\frac{U\_m}{\left(2 \cdot J\right) \cdot t\_1}\right)}^{2} + 1} \cdot \left(t\_1 \cdot \left(J \cdot -2\right)\right)\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;-U\_m\\
\mathbf{elif}\;t\_2 \leq -2 \cdot 10^{+221}:\\
\;\;\;\;t\_0 \cdot \sqrt{\mathsf{fma}\left(\frac{\frac{U\_m}{\left(\cos K + 1\right) \cdot J} \cdot 0.5}{J}, U\_m, 1\right)}\\
\mathbf{elif}\;t\_2 \leq 10^{+305}:\\
\;\;\;\;\sqrt{\mathsf{fma}\left(\frac{0.5 \cdot U\_m}{\mathsf{fma}\left(\cos K, 0.5, 0.5\right) \cdot J} \cdot U\_m, \frac{0.5}{J}, 1\right)} \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;-1 \cdot \left(-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 5.0%
Taylor expanded in U around inf
mul-1-negN/A
lower-neg.f6455.9
Applied rewrites55.9%
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))))) < -2.0000000000000001e221Initial program 99.8%
lift-pow.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
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lift-*.f64N/A
Applied rewrites80.5%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
div-invN/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites80.4%
Taylor expanded in K around inf
*-commutativeN/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites88.6%
Applied rewrites99.7%
if -2.0000000000000001e221 < (*.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))))) < 9.9999999999999994e304Initial program 99.8%
lift-pow.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
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lift-*.f64N/A
Applied rewrites97.8%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
div-invN/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites97.8%
lift-/.f64N/A
div-invN/A
metadata-evalN/A
lift-*.f6497.8
Applied rewrites97.8%
if 9.9999999999999994e304 < (*.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 6.0%
Taylor expanded in U around -inf
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites53.6%
Taylor expanded in U around inf
Applied rewrites53.6%
Final simplification87.0%
U_m = (fabs.f64 U)
(FPCore (J K U_m)
:precision binary64
(let* ((t_0 (cos (/ K 2.0)))
(t_1 (* t_0 (* J -2.0)))
(t_2 (* (sqrt (+ (pow (/ U_m (* (* 2.0 J) t_0)) 2.0) 1.0)) t_1)))
(if (<= t_2 -2e+300)
(fma (/ J U_m) (* J -2.0) (- U_m))
(if (<= t_2 1e-167)
(* (sqrt (+ (/ (* (/ U_m (* 2.0 J)) U_m) (* 2.0 J)) 1.0)) t_1)
(if (<= t_2 1e+305)
(*
(*
(* (cos (* 0.5 K)) J)
(sqrt
(fma (/ (* U_m U_m) (* (* (fma (cos K) 0.5 0.5) J) J)) 0.25 1.0)))
-2.0)
(* -1.0 (- 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 = t_0 * (J * -2.0);
double t_2 = sqrt((pow((U_m / ((2.0 * J) * t_0)), 2.0) + 1.0)) * t_1;
double tmp;
if (t_2 <= -2e+300) {
tmp = fma((J / U_m), (J * -2.0), -U_m);
} else if (t_2 <= 1e-167) {
tmp = sqrt(((((U_m / (2.0 * J)) * U_m) / (2.0 * J)) + 1.0)) * t_1;
} else if (t_2 <= 1e+305) {
tmp = ((cos((0.5 * K)) * J) * sqrt(fma(((U_m * U_m) / ((fma(cos(K), 0.5, 0.5) * J) * J)), 0.25, 1.0))) * -2.0;
} else {
tmp = -1.0 * -U_m;
}
return tmp;
}
U_m = abs(U) function code(J, K, U_m) t_0 = cos(Float64(K / 2.0)) t_1 = Float64(t_0 * Float64(J * -2.0)) t_2 = Float64(sqrt(Float64((Float64(U_m / Float64(Float64(2.0 * J) * t_0)) ^ 2.0) + 1.0)) * t_1) tmp = 0.0 if (t_2 <= -2e+300) tmp = fma(Float64(J / U_m), Float64(J * -2.0), Float64(-U_m)); elseif (t_2 <= 1e-167) tmp = Float64(sqrt(Float64(Float64(Float64(Float64(U_m / Float64(2.0 * J)) * U_m) / Float64(2.0 * J)) + 1.0)) * t_1); elseif (t_2 <= 1e+305) tmp = Float64(Float64(Float64(cos(Float64(0.5 * K)) * J) * sqrt(fma(Float64(Float64(U_m * U_m) / Float64(Float64(fma(cos(K), 0.5, 0.5) * J) * J)), 0.25, 1.0))) * -2.0); else tmp = Float64(-1.0 * 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[(t$95$0 * N[(J * -2.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[N[(N[Power[N[(U$95$m / N[(N[(2.0 * J), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision] * t$95$1), $MachinePrecision]}, If[LessEqual[t$95$2, -2e+300], N[(N[(J / U$95$m), $MachinePrecision] * N[(J * -2.0), $MachinePrecision] + (-U$95$m)), $MachinePrecision], If[LessEqual[t$95$2, 1e-167], N[(N[Sqrt[N[(N[(N[(N[(U$95$m / N[(2.0 * J), $MachinePrecision]), $MachinePrecision] * U$95$m), $MachinePrecision] / N[(2.0 * J), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[t$95$2, 1e+305], N[(N[(N[(N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision] * J), $MachinePrecision] * N[Sqrt[N[(N[(N[(U$95$m * U$95$m), $MachinePrecision] / N[(N[(N[(N[Cos[K], $MachinePrecision] * 0.5 + 0.5), $MachinePrecision] * J), $MachinePrecision] * J), $MachinePrecision]), $MachinePrecision] * 0.25 + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * -2.0), $MachinePrecision], N[(-1.0 * (-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 := t\_0 \cdot \left(J \cdot -2\right)\\
t_2 := \sqrt{{\left(\frac{U\_m}{\left(2 \cdot J\right) \cdot t\_0}\right)}^{2} + 1} \cdot t\_1\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{+300}:\\
\;\;\;\;\mathsf{fma}\left(\frac{J}{U\_m}, J \cdot -2, -U\_m\right)\\
\mathbf{elif}\;t\_2 \leq 10^{-167}:\\
\;\;\;\;\sqrt{\frac{\frac{U\_m}{2 \cdot J} \cdot U\_m}{2 \cdot J} + 1} \cdot t\_1\\
\mathbf{elif}\;t\_2 \leq 10^{+305}:\\
\;\;\;\;\left(\left(\cos \left(0.5 \cdot K\right) \cdot J\right) \cdot \sqrt{\mathsf{fma}\left(\frac{U\_m \cdot U\_m}{\left(\mathsf{fma}\left(\cos K, 0.5, 0.5\right) \cdot J\right) \cdot J}, 0.25, 1\right)}\right) \cdot -2\\
\mathbf{else}:\\
\;\;\;\;-1 \cdot \left(-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))))) < -2.0000000000000001e300Initial program 12.3%
Taylor expanded in J around 0
*-commutativeN/A
associate-/l*N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6452.7
Applied rewrites52.7%
Applied rewrites57.1%
Taylor expanded in K around 0
Applied rewrites57.1%
if -2.0000000000000001e300 < (*.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))))) < 1e-167Initial program 99.8%
lift-pow.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
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lift-*.f64N/A
Applied rewrites95.0%
Taylor expanded in K around 0
*-commutativeN/A
lower-*.f6486.3
Applied rewrites86.3%
if 1e-167 < (*.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))))) < 9.9999999999999994e304Initial program 99.8%
lift-pow.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
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lift-*.f64N/A
Applied rewrites96.4%
Taylor expanded in K around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites84.1%
if 9.9999999999999994e304 < (*.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 6.0%
Taylor expanded in U around -inf
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites53.6%
Taylor expanded in U around inf
Applied rewrites53.6%
Final simplification77.3%
U_m = (fabs.f64 U)
(FPCore (J K U_m)
:precision binary64
(let* ((t_0 (fma (/ J U_m) (* J -2.0) (- U_m)))
(t_1 (cos (/ K 2.0)))
(t_2
(*
(sqrt (+ (pow (/ U_m (* (* 2.0 J) t_1)) 2.0) 1.0))
(* t_1 (* J -2.0)))))
(if (<= t_2 -2e+300)
t_0
(if (<= t_2 -5e-64)
(* (sqrt (fma (* (/ U_m (* J J)) U_m) 0.25 1.0)) (* J -2.0))
(if (<= t_2 -4e-222) t_0 (* -1.0 (- U_m)))))))U_m = fabs(U);
double code(double J, double K, double U_m) {
double t_0 = fma((J / U_m), (J * -2.0), -U_m);
double t_1 = cos((K / 2.0));
double t_2 = sqrt((pow((U_m / ((2.0 * J) * t_1)), 2.0) + 1.0)) * (t_1 * (J * -2.0));
double tmp;
if (t_2 <= -2e+300) {
tmp = t_0;
} else if (t_2 <= -5e-64) {
tmp = sqrt(fma(((U_m / (J * J)) * U_m), 0.25, 1.0)) * (J * -2.0);
} else if (t_2 <= -4e-222) {
tmp = t_0;
} else {
tmp = -1.0 * -U_m;
}
return tmp;
}
U_m = abs(U) function code(J, K, U_m) t_0 = fma(Float64(J / U_m), Float64(J * -2.0), Float64(-U_m)) t_1 = cos(Float64(K / 2.0)) t_2 = Float64(sqrt(Float64((Float64(U_m / Float64(Float64(2.0 * J) * t_1)) ^ 2.0) + 1.0)) * Float64(t_1 * Float64(J * -2.0))) tmp = 0.0 if (t_2 <= -2e+300) tmp = t_0; elseif (t_2 <= -5e-64) tmp = Float64(sqrt(fma(Float64(Float64(U_m / Float64(J * J)) * U_m), 0.25, 1.0)) * Float64(J * -2.0)); elseif (t_2 <= -4e-222) tmp = t_0; else tmp = Float64(-1.0 * Float64(-U_m)); end return tmp end
U_m = N[Abs[U], $MachinePrecision]
code[J_, K_, U$95$m_] := Block[{t$95$0 = N[(N[(J / U$95$m), $MachinePrecision] * N[(J * -2.0), $MachinePrecision] + (-U$95$m)), $MachinePrecision]}, Block[{t$95$1 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[N[(N[Power[N[(U$95$m / N[(N[(2.0 * J), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision] * N[(t$95$1 * N[(J * -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -2e+300], t$95$0, If[LessEqual[t$95$2, -5e-64], N[(N[Sqrt[N[(N[(N[(U$95$m / N[(J * J), $MachinePrecision]), $MachinePrecision] * U$95$m), $MachinePrecision] * 0.25 + 1.0), $MachinePrecision]], $MachinePrecision] * N[(J * -2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, -4e-222], t$95$0, N[(-1.0 * (-U$95$m)), $MachinePrecision]]]]]]]
\begin{array}{l}
U_m = \left|U\right|
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(\frac{J}{U\_m}, J \cdot -2, -U\_m\right)\\
t_1 := \cos \left(\frac{K}{2}\right)\\
t_2 := \sqrt{{\left(\frac{U\_m}{\left(2 \cdot J\right) \cdot t\_1}\right)}^{2} + 1} \cdot \left(t\_1 \cdot \left(J \cdot -2\right)\right)\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{+300}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_2 \leq -5 \cdot 10^{-64}:\\
\;\;\;\;\sqrt{\mathsf{fma}\left(\frac{U\_m}{J \cdot J} \cdot U\_m, 0.25, 1\right)} \cdot \left(J \cdot -2\right)\\
\mathbf{elif}\;t\_2 \leq -4 \cdot 10^{-222}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;-1 \cdot \left(-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))))) < -2.0000000000000001e300 or -5.00000000000000033e-64 < (*.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))))) < -4.00000000000000019e-222Initial program 35.4%
Taylor expanded in J around 0
*-commutativeN/A
associate-/l*N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6448.9
Applied rewrites48.9%
Applied rewrites52.2%
Taylor expanded in K around 0
Applied rewrites52.2%
if -2.0000000000000001e300 < (*.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.00000000000000033e-64Initial program 99.8%
Taylor expanded in K around 0
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6455.2
Applied rewrites55.2%
if -4.00000000000000019e-222 < (*.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 77.6%
Taylor expanded in U around -inf
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites22.6%
Taylor expanded in U around inf
Applied rewrites27.1%
Final simplification40.6%
U_m = (fabs.f64 U)
(FPCore (J K U_m)
:precision binary64
(let* ((t_0 (fma (/ J U_m) (* J -2.0) (- U_m)))
(t_1 (cos (/ K 2.0)))
(t_2
(*
(sqrt (+ (pow (/ U_m (* (* 2.0 J) t_1)) 2.0) 1.0))
(* t_1 (* J -2.0)))))
(if (<= t_2 -2e+300)
t_0
(if (<= t_2 -2e-58)
(* J -2.0)
(if (<= t_2 -4e-222) t_0 (* -1.0 (- U_m)))))))U_m = fabs(U);
double code(double J, double K, double U_m) {
double t_0 = fma((J / U_m), (J * -2.0), -U_m);
double t_1 = cos((K / 2.0));
double t_2 = sqrt((pow((U_m / ((2.0 * J) * t_1)), 2.0) + 1.0)) * (t_1 * (J * -2.0));
double tmp;
if (t_2 <= -2e+300) {
tmp = t_0;
} else if (t_2 <= -2e-58) {
tmp = J * -2.0;
} else if (t_2 <= -4e-222) {
tmp = t_0;
} else {
tmp = -1.0 * -U_m;
}
return tmp;
}
U_m = abs(U) function code(J, K, U_m) t_0 = fma(Float64(J / U_m), Float64(J * -2.0), Float64(-U_m)) t_1 = cos(Float64(K / 2.0)) t_2 = Float64(sqrt(Float64((Float64(U_m / Float64(Float64(2.0 * J) * t_1)) ^ 2.0) + 1.0)) * Float64(t_1 * Float64(J * -2.0))) tmp = 0.0 if (t_2 <= -2e+300) tmp = t_0; elseif (t_2 <= -2e-58) tmp = Float64(J * -2.0); elseif (t_2 <= -4e-222) tmp = t_0; else tmp = Float64(-1.0 * Float64(-U_m)); end return tmp end
U_m = N[Abs[U], $MachinePrecision]
code[J_, K_, U$95$m_] := Block[{t$95$0 = N[(N[(J / U$95$m), $MachinePrecision] * N[(J * -2.0), $MachinePrecision] + (-U$95$m)), $MachinePrecision]}, Block[{t$95$1 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[N[(N[Power[N[(U$95$m / N[(N[(2.0 * J), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision] * N[(t$95$1 * N[(J * -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -2e+300], t$95$0, If[LessEqual[t$95$2, -2e-58], N[(J * -2.0), $MachinePrecision], If[LessEqual[t$95$2, -4e-222], t$95$0, N[(-1.0 * (-U$95$m)), $MachinePrecision]]]]]]]
\begin{array}{l}
U_m = \left|U\right|
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(\frac{J}{U\_m}, J \cdot -2, -U\_m\right)\\
t_1 := \cos \left(\frac{K}{2}\right)\\
t_2 := \sqrt{{\left(\frac{U\_m}{\left(2 \cdot J\right) \cdot t\_1}\right)}^{2} + 1} \cdot \left(t\_1 \cdot \left(J \cdot -2\right)\right)\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{+300}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_2 \leq -2 \cdot 10^{-58}:\\
\;\;\;\;J \cdot -2\\
\mathbf{elif}\;t\_2 \leq -4 \cdot 10^{-222}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;-1 \cdot \left(-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))))) < -2.0000000000000001e300 or -2.0000000000000001e-58 < (*.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))))) < -4.00000000000000019e-222Initial program 36.6%
Taylor expanded in J around 0
*-commutativeN/A
associate-/l*N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6448.1
Applied rewrites48.1%
Applied rewrites51.3%
Taylor expanded in K around 0
Applied rewrites51.3%
if -2.0000000000000001e300 < (*.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))))) < -2.0000000000000001e-58Initial program 99.8%
Taylor expanded in U around 0
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6481.6
Applied rewrites81.6%
Taylor expanded in K around 0
Applied rewrites44.0%
if -4.00000000000000019e-222 < (*.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 77.6%
Taylor expanded in U around -inf
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites22.6%
Taylor expanded in U around inf
Applied rewrites27.1%
Final simplification37.1%
U_m = (fabs.f64 U)
(FPCore (J K U_m)
:precision binary64
(let* ((t_0 (cos (/ K 2.0)))
(t_1
(*
(sqrt (+ (pow (/ U_m (* (* 2.0 J) t_0)) 2.0) 1.0))
(* t_0 (* J -2.0)))))
(if (<= t_1 -5e+306)
(- U_m)
(if (<= t_1 -2e-58)
(* J -2.0)
(if (<= t_1 -4e-222)
(- (* (/ (* J J) U_m) -2.0) U_m)
(* -1.0 (- 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 = sqrt((pow((U_m / ((2.0 * J) * t_0)), 2.0) + 1.0)) * (t_0 * (J * -2.0));
double tmp;
if (t_1 <= -5e+306) {
tmp = -U_m;
} else if (t_1 <= -2e-58) {
tmp = J * -2.0;
} else if (t_1 <= -4e-222) {
tmp = (((J * J) / U_m) * -2.0) - U_m;
} else {
tmp = -1.0 * -U_m;
}
return tmp;
}
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
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = cos((k / 2.0d0))
t_1 = sqrt((((u_m / ((2.0d0 * j) * t_0)) ** 2.0d0) + 1.0d0)) * (t_0 * (j * (-2.0d0)))
if (t_1 <= (-5d+306)) then
tmp = -u_m
else if (t_1 <= (-2d-58)) then
tmp = j * (-2.0d0)
else if (t_1 <= (-4d-222)) then
tmp = (((j * j) / u_m) * (-2.0d0)) - u_m
else
tmp = (-1.0d0) * -u_m
end if
code = tmp
end function
U_m = Math.abs(U);
public static double code(double J, double K, double U_m) {
double t_0 = Math.cos((K / 2.0));
double t_1 = Math.sqrt((Math.pow((U_m / ((2.0 * J) * t_0)), 2.0) + 1.0)) * (t_0 * (J * -2.0));
double tmp;
if (t_1 <= -5e+306) {
tmp = -U_m;
} else if (t_1 <= -2e-58) {
tmp = J * -2.0;
} else if (t_1 <= -4e-222) {
tmp = (((J * J) / U_m) * -2.0) - U_m;
} else {
tmp = -1.0 * -U_m;
}
return tmp;
}
U_m = math.fabs(U) def code(J, K, U_m): t_0 = math.cos((K / 2.0)) t_1 = math.sqrt((math.pow((U_m / ((2.0 * J) * t_0)), 2.0) + 1.0)) * (t_0 * (J * -2.0)) tmp = 0 if t_1 <= -5e+306: tmp = -U_m elif t_1 <= -2e-58: tmp = J * -2.0 elif t_1 <= -4e-222: tmp = (((J * J) / U_m) * -2.0) - U_m else: tmp = -1.0 * -U_m return tmp
U_m = abs(U) function code(J, K, U_m) t_0 = cos(Float64(K / 2.0)) t_1 = Float64(sqrt(Float64((Float64(U_m / Float64(Float64(2.0 * J) * t_0)) ^ 2.0) + 1.0)) * Float64(t_0 * Float64(J * -2.0))) tmp = 0.0 if (t_1 <= -5e+306) tmp = Float64(-U_m); elseif (t_1 <= -2e-58) tmp = Float64(J * -2.0); elseif (t_1 <= -4e-222) tmp = Float64(Float64(Float64(Float64(J * J) / U_m) * -2.0) - U_m); else tmp = Float64(-1.0 * Float64(-U_m)); end return tmp end
U_m = abs(U); function tmp_2 = code(J, K, U_m) t_0 = cos((K / 2.0)); t_1 = sqrt((((U_m / ((2.0 * J) * t_0)) ^ 2.0) + 1.0)) * (t_0 * (J * -2.0)); tmp = 0.0; if (t_1 <= -5e+306) tmp = -U_m; elseif (t_1 <= -2e-58) tmp = J * -2.0; elseif (t_1 <= -4e-222) tmp = (((J * J) / U_m) * -2.0) - U_m; else tmp = -1.0 * -U_m; end tmp_2 = 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[Sqrt[N[(N[Power[N[(U$95$m / N[(N[(2.0 * J), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision] * N[(t$95$0 * N[(J * -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+306], (-U$95$m), If[LessEqual[t$95$1, -2e-58], N[(J * -2.0), $MachinePrecision], If[LessEqual[t$95$1, -4e-222], N[(N[(N[(N[(J * J), $MachinePrecision] / U$95$m), $MachinePrecision] * -2.0), $MachinePrecision] - U$95$m), $MachinePrecision], N[(-1.0 * (-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 := \sqrt{{\left(\frac{U\_m}{\left(2 \cdot J\right) \cdot t\_0}\right)}^{2} + 1} \cdot \left(t\_0 \cdot \left(J \cdot -2\right)\right)\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+306}:\\
\;\;\;\;-U\_m\\
\mathbf{elif}\;t\_1 \leq -2 \cdot 10^{-58}:\\
\;\;\;\;J \cdot -2\\
\mathbf{elif}\;t\_1 \leq -4 \cdot 10^{-222}:\\
\;\;\;\;\frac{J \cdot J}{U\_m} \cdot -2 - U\_m\\
\mathbf{else}:\\
\;\;\;\;-1 \cdot \left(-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))))) < -4.99999999999999993e306Initial program 7.6%
Taylor expanded in U around inf
mul-1-negN/A
lower-neg.f6457.1
Applied rewrites57.1%
if -4.99999999999999993e306 < (*.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))))) < -2.0000000000000001e-58Initial program 99.8%
Taylor expanded in U around 0
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6480.8
Applied rewrites80.8%
Taylor expanded in K around 0
Applied rewrites44.2%
if -2.0000000000000001e-58 < (*.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))))) < -4.00000000000000019e-222Initial program 99.8%
Taylor expanded in J around 0
*-commutativeN/A
associate-/l*N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6436.2
Applied rewrites36.2%
Taylor expanded in K around 0
Applied rewrites36.2%
if -4.00000000000000019e-222 < (*.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 77.6%
Taylor expanded in U around -inf
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites22.6%
Taylor expanded in U around inf
Applied rewrites27.1%
Final simplification37.1%
U_m = (fabs.f64 U)
(FPCore (J K U_m)
:precision binary64
(let* ((t_0 (cos (/ K 2.0)))
(t_1
(*
(sqrt (+ (pow (/ U_m (* (* 2.0 J) t_0)) 2.0) 1.0))
(* t_0 (* J -2.0)))))
(if (<= t_1 -5e+306)
(- U_m)
(if (<= t_1 -2e-58)
(* J -2.0)
(if (<= t_1 -4e-222) (- U_m) (* -1.0 (- 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 = sqrt((pow((U_m / ((2.0 * J) * t_0)), 2.0) + 1.0)) * (t_0 * (J * -2.0));
double tmp;
if (t_1 <= -5e+306) {
tmp = -U_m;
} else if (t_1 <= -2e-58) {
tmp = J * -2.0;
} else if (t_1 <= -4e-222) {
tmp = -U_m;
} else {
tmp = -1.0 * -U_m;
}
return tmp;
}
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
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = cos((k / 2.0d0))
t_1 = sqrt((((u_m / ((2.0d0 * j) * t_0)) ** 2.0d0) + 1.0d0)) * (t_0 * (j * (-2.0d0)))
if (t_1 <= (-5d+306)) then
tmp = -u_m
else if (t_1 <= (-2d-58)) then
tmp = j * (-2.0d0)
else if (t_1 <= (-4d-222)) then
tmp = -u_m
else
tmp = (-1.0d0) * -u_m
end if
code = tmp
end function
U_m = Math.abs(U);
public static double code(double J, double K, double U_m) {
double t_0 = Math.cos((K / 2.0));
double t_1 = Math.sqrt((Math.pow((U_m / ((2.0 * J) * t_0)), 2.0) + 1.0)) * (t_0 * (J * -2.0));
double tmp;
if (t_1 <= -5e+306) {
tmp = -U_m;
} else if (t_1 <= -2e-58) {
tmp = J * -2.0;
} else if (t_1 <= -4e-222) {
tmp = -U_m;
} else {
tmp = -1.0 * -U_m;
}
return tmp;
}
U_m = math.fabs(U) def code(J, K, U_m): t_0 = math.cos((K / 2.0)) t_1 = math.sqrt((math.pow((U_m / ((2.0 * J) * t_0)), 2.0) + 1.0)) * (t_0 * (J * -2.0)) tmp = 0 if t_1 <= -5e+306: tmp = -U_m elif t_1 <= -2e-58: tmp = J * -2.0 elif t_1 <= -4e-222: tmp = -U_m else: tmp = -1.0 * -U_m return tmp
U_m = abs(U) function code(J, K, U_m) t_0 = cos(Float64(K / 2.0)) t_1 = Float64(sqrt(Float64((Float64(U_m / Float64(Float64(2.0 * J) * t_0)) ^ 2.0) + 1.0)) * Float64(t_0 * Float64(J * -2.0))) tmp = 0.0 if (t_1 <= -5e+306) tmp = Float64(-U_m); elseif (t_1 <= -2e-58) tmp = Float64(J * -2.0); elseif (t_1 <= -4e-222) tmp = Float64(-U_m); else tmp = Float64(-1.0 * Float64(-U_m)); end return tmp end
U_m = abs(U); function tmp_2 = code(J, K, U_m) t_0 = cos((K / 2.0)); t_1 = sqrt((((U_m / ((2.0 * J) * t_0)) ^ 2.0) + 1.0)) * (t_0 * (J * -2.0)); tmp = 0.0; if (t_1 <= -5e+306) tmp = -U_m; elseif (t_1 <= -2e-58) tmp = J * -2.0; elseif (t_1 <= -4e-222) tmp = -U_m; else tmp = -1.0 * -U_m; end tmp_2 = 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[Sqrt[N[(N[Power[N[(U$95$m / N[(N[(2.0 * J), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision] * N[(t$95$0 * N[(J * -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+306], (-U$95$m), If[LessEqual[t$95$1, -2e-58], N[(J * -2.0), $MachinePrecision], If[LessEqual[t$95$1, -4e-222], (-U$95$m), N[(-1.0 * (-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 := \sqrt{{\left(\frac{U\_m}{\left(2 \cdot J\right) \cdot t\_0}\right)}^{2} + 1} \cdot \left(t\_0 \cdot \left(J \cdot -2\right)\right)\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+306}:\\
\;\;\;\;-U\_m\\
\mathbf{elif}\;t\_1 \leq -2 \cdot 10^{-58}:\\
\;\;\;\;J \cdot -2\\
\mathbf{elif}\;t\_1 \leq -4 \cdot 10^{-222}:\\
\;\;\;\;-U\_m\\
\mathbf{else}:\\
\;\;\;\;-1 \cdot \left(-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))))) < -4.99999999999999993e306 or -2.0000000000000001e-58 < (*.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))))) < -4.00000000000000019e-222Initial program 34.2%
Taylor expanded in U around inf
mul-1-negN/A
lower-neg.f6451.1
Applied rewrites51.1%
if -4.99999999999999993e306 < (*.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))))) < -2.0000000000000001e-58Initial program 99.8%
Taylor expanded in U around 0
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6480.8
Applied rewrites80.8%
Taylor expanded in K around 0
Applied rewrites44.2%
if -4.00000000000000019e-222 < (*.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 77.6%
Taylor expanded in U around -inf
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites22.6%
Taylor expanded in U around inf
Applied rewrites27.1%
Final simplification37.1%
U_m = (fabs.f64 U)
(FPCore (J K U_m)
:precision binary64
(let* ((t_0 (cos (/ K 2.0)))
(t_1
(*
(sqrt (+ (pow (/ U_m (* (* 2.0 J) t_0)) 2.0) 1.0))
(* t_0 (* J -2.0)))))
(if (<= t_1 (- INFINITY))
(- U_m)
(if (<= t_1 1e+305)
(*
(* (cos (* 0.5 K)) (* J -2.0))
(sqrt (fma (/ (* (/ U_m (* (+ (cos K) 1.0) J)) 0.5) J) U_m 1.0)))
(* -1.0 (- 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 = sqrt((pow((U_m / ((2.0 * J) * t_0)), 2.0) + 1.0)) * (t_0 * (J * -2.0));
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = -U_m;
} else if (t_1 <= 1e+305) {
tmp = (cos((0.5 * K)) * (J * -2.0)) * sqrt(fma((((U_m / ((cos(K) + 1.0) * J)) * 0.5) / J), U_m, 1.0));
} else {
tmp = -1.0 * -U_m;
}
return tmp;
}
U_m = abs(U) function code(J, K, U_m) t_0 = cos(Float64(K / 2.0)) t_1 = Float64(sqrt(Float64((Float64(U_m / Float64(Float64(2.0 * J) * t_0)) ^ 2.0) + 1.0)) * Float64(t_0 * Float64(J * -2.0))) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(-U_m); elseif (t_1 <= 1e+305) tmp = Float64(Float64(cos(Float64(0.5 * K)) * Float64(J * -2.0)) * sqrt(fma(Float64(Float64(Float64(U_m / Float64(Float64(cos(K) + 1.0) * J)) * 0.5) / J), U_m, 1.0))); else tmp = Float64(-1.0 * 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[Sqrt[N[(N[Power[N[(U$95$m / N[(N[(2.0 * J), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision] * N[(t$95$0 * N[(J * -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], (-U$95$m), If[LessEqual[t$95$1, 1e+305], N[(N[(N[Cos[N[(0.5 * K), $MachinePrecision]], $MachinePrecision] * N[(J * -2.0), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(N[(N[(N[(U$95$m / N[(N[(N[Cos[K], $MachinePrecision] + 1.0), $MachinePrecision] * J), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision] / J), $MachinePrecision] * U$95$m + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(-1.0 * (-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 := \sqrt{{\left(\frac{U\_m}{\left(2 \cdot J\right) \cdot t\_0}\right)}^{2} + 1} \cdot \left(t\_0 \cdot \left(J \cdot -2\right)\right)\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;-U\_m\\
\mathbf{elif}\;t\_1 \leq 10^{+305}:\\
\;\;\;\;\left(\cos \left(0.5 \cdot K\right) \cdot \left(J \cdot -2\right)\right) \cdot \sqrt{\mathsf{fma}\left(\frac{\frac{U\_m}{\left(\cos K + 1\right) \cdot J} \cdot 0.5}{J}, U\_m, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;-1 \cdot \left(-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 5.0%
Taylor expanded in U around inf
mul-1-negN/A
lower-neg.f6455.9
Applied rewrites55.9%
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))))) < 9.9999999999999994e304Initial program 99.8%
lift-pow.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
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lift-*.f64N/A
Applied rewrites94.8%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
div-invN/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites94.8%
Taylor expanded in K around inf
*-commutativeN/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites84.5%
Applied rewrites94.0%
if 9.9999999999999994e304 < (*.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 6.0%
Taylor expanded in U around -inf
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites53.6%
Taylor expanded in U around inf
Applied rewrites53.6%
Final simplification83.9%
U_m = (fabs.f64 U)
(FPCore (J K U_m)
:precision binary64
(let* ((t_0 (cos (/ K 2.0)))
(t_1 (* t_0 (* J -2.0)))
(t_2 (* (sqrt (+ (pow (/ U_m (* (* 2.0 J) t_0)) 2.0) 1.0)) t_1)))
(if (<= t_2 -2e+300)
(fma (/ J U_m) (* J -2.0) (- U_m))
(if (<= t_2 1e+305)
(* (sqrt (+ (/ (* (/ U_m (* 2.0 J)) U_m) (* 2.0 J)) 1.0)) t_1)
(* -1.0 (- 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 = t_0 * (J * -2.0);
double t_2 = sqrt((pow((U_m / ((2.0 * J) * t_0)), 2.0) + 1.0)) * t_1;
double tmp;
if (t_2 <= -2e+300) {
tmp = fma((J / U_m), (J * -2.0), -U_m);
} else if (t_2 <= 1e+305) {
tmp = sqrt(((((U_m / (2.0 * J)) * U_m) / (2.0 * J)) + 1.0)) * t_1;
} else {
tmp = -1.0 * -U_m;
}
return tmp;
}
U_m = abs(U) function code(J, K, U_m) t_0 = cos(Float64(K / 2.0)) t_1 = Float64(t_0 * Float64(J * -2.0)) t_2 = Float64(sqrt(Float64((Float64(U_m / Float64(Float64(2.0 * J) * t_0)) ^ 2.0) + 1.0)) * t_1) tmp = 0.0 if (t_2 <= -2e+300) tmp = fma(Float64(J / U_m), Float64(J * -2.0), Float64(-U_m)); elseif (t_2 <= 1e+305) tmp = Float64(sqrt(Float64(Float64(Float64(Float64(U_m / Float64(2.0 * J)) * U_m) / Float64(2.0 * J)) + 1.0)) * t_1); else tmp = Float64(-1.0 * 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[(t$95$0 * N[(J * -2.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[N[(N[Power[N[(U$95$m / N[(N[(2.0 * J), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision] * t$95$1), $MachinePrecision]}, If[LessEqual[t$95$2, -2e+300], N[(N[(J / U$95$m), $MachinePrecision] * N[(J * -2.0), $MachinePrecision] + (-U$95$m)), $MachinePrecision], If[LessEqual[t$95$2, 1e+305], N[(N[Sqrt[N[(N[(N[(N[(U$95$m / N[(2.0 * J), $MachinePrecision]), $MachinePrecision] * U$95$m), $MachinePrecision] / N[(2.0 * J), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision] * t$95$1), $MachinePrecision], N[(-1.0 * (-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 := t\_0 \cdot \left(J \cdot -2\right)\\
t_2 := \sqrt{{\left(\frac{U\_m}{\left(2 \cdot J\right) \cdot t\_0}\right)}^{2} + 1} \cdot t\_1\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{+300}:\\
\;\;\;\;\mathsf{fma}\left(\frac{J}{U\_m}, J \cdot -2, -U\_m\right)\\
\mathbf{elif}\;t\_2 \leq 10^{+305}:\\
\;\;\;\;\sqrt{\frac{\frac{U\_m}{2 \cdot J} \cdot U\_m}{2 \cdot J} + 1} \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;-1 \cdot \left(-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))))) < -2.0000000000000001e300Initial program 12.3%
Taylor expanded in J around 0
*-commutativeN/A
associate-/l*N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6452.7
Applied rewrites52.7%
Applied rewrites57.1%
Taylor expanded in K around 0
Applied rewrites57.1%
if -2.0000000000000001e300 < (*.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))))) < 9.9999999999999994e304Initial program 99.8%
lift-pow.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
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lift-*.f64N/A
Applied rewrites95.6%
Taylor expanded in K around 0
*-commutativeN/A
lower-*.f6485.7
Applied rewrites85.7%
if 9.9999999999999994e304 < (*.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 6.0%
Taylor expanded in U around -inf
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites53.6%
Taylor expanded in U around inf
Applied rewrites53.6%
Final simplification77.6%
U_m = (fabs.f64 U)
(FPCore (J K U_m)
:precision binary64
(let* ((t_0 (cos (/ K 2.0)))
(t_1
(*
(sqrt (+ (pow (/ U_m (* (* 2.0 J) t_0)) 2.0) 1.0))
(* t_0 (* J -2.0)))))
(if (<= t_1 -2e+300)
(fma (/ J U_m) (* J -2.0) (- U_m))
(if (<= t_1 -4e-222)
(* (sqrt (fma (/ (* (/ U_m J) U_m) J) 0.25 1.0)) (* J -2.0))
(* -1.0 (- 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 = sqrt((pow((U_m / ((2.0 * J) * t_0)), 2.0) + 1.0)) * (t_0 * (J * -2.0));
double tmp;
if (t_1 <= -2e+300) {
tmp = fma((J / U_m), (J * -2.0), -U_m);
} else if (t_1 <= -4e-222) {
tmp = sqrt(fma((((U_m / J) * U_m) / J), 0.25, 1.0)) * (J * -2.0);
} else {
tmp = -1.0 * -U_m;
}
return tmp;
}
U_m = abs(U) function code(J, K, U_m) t_0 = cos(Float64(K / 2.0)) t_1 = Float64(sqrt(Float64((Float64(U_m / Float64(Float64(2.0 * J) * t_0)) ^ 2.0) + 1.0)) * Float64(t_0 * Float64(J * -2.0))) tmp = 0.0 if (t_1 <= -2e+300) tmp = fma(Float64(J / U_m), Float64(J * -2.0), Float64(-U_m)); elseif (t_1 <= -4e-222) tmp = Float64(sqrt(fma(Float64(Float64(Float64(U_m / J) * U_m) / J), 0.25, 1.0)) * Float64(J * -2.0)); else tmp = Float64(-1.0 * 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[Sqrt[N[(N[Power[N[(U$95$m / N[(N[(2.0 * J), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision] * N[(t$95$0 * N[(J * -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+300], N[(N[(J / U$95$m), $MachinePrecision] * N[(J * -2.0), $MachinePrecision] + (-U$95$m)), $MachinePrecision], If[LessEqual[t$95$1, -4e-222], N[(N[Sqrt[N[(N[(N[(N[(U$95$m / J), $MachinePrecision] * U$95$m), $MachinePrecision] / J), $MachinePrecision] * 0.25 + 1.0), $MachinePrecision]], $MachinePrecision] * N[(J * -2.0), $MachinePrecision]), $MachinePrecision], N[(-1.0 * (-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 := \sqrt{{\left(\frac{U\_m}{\left(2 \cdot J\right) \cdot t\_0}\right)}^{2} + 1} \cdot \left(t\_0 \cdot \left(J \cdot -2\right)\right)\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+300}:\\
\;\;\;\;\mathsf{fma}\left(\frac{J}{U\_m}, J \cdot -2, -U\_m\right)\\
\mathbf{elif}\;t\_1 \leq -4 \cdot 10^{-222}:\\
\;\;\;\;\sqrt{\mathsf{fma}\left(\frac{\frac{U\_m}{J} \cdot U\_m}{J}, 0.25, 1\right)} \cdot \left(J \cdot -2\right)\\
\mathbf{else}:\\
\;\;\;\;-1 \cdot \left(-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))))) < -2.0000000000000001e300Initial program 12.3%
Taylor expanded in J around 0
*-commutativeN/A
associate-/l*N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6452.7
Applied rewrites52.7%
Applied rewrites57.1%
Taylor expanded in K around 0
Applied rewrites57.1%
if -2.0000000000000001e300 < (*.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))))) < -4.00000000000000019e-222Initial program 99.8%
lift-pow.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
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lift-*.f64N/A
Applied rewrites94.5%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
div-invN/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites94.5%
Taylor expanded in K around 0
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6444.2
Applied rewrites44.2%
Applied rewrites57.9%
if -4.00000000000000019e-222 < (*.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 77.6%
Taylor expanded in U around -inf
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites22.6%
Taylor expanded in U around inf
Applied rewrites27.1%
Final simplification42.5%
U_m = (fabs.f64 U) (FPCore (J K U_m) :precision binary64 (if (<= J 1.8e+38) (- U_m) (* J -2.0)))
U_m = fabs(U);
double code(double J, double K, double U_m) {
double tmp;
if (J <= 1.8e+38) {
tmp = -U_m;
} else {
tmp = J * -2.0;
}
return tmp;
}
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
real(8) :: tmp
if (j <= 1.8d+38) then
tmp = -u_m
else
tmp = j * (-2.0d0)
end if
code = tmp
end function
U_m = Math.abs(U);
public static double code(double J, double K, double U_m) {
double tmp;
if (J <= 1.8e+38) {
tmp = -U_m;
} else {
tmp = J * -2.0;
}
return tmp;
}
U_m = math.fabs(U) def code(J, K, U_m): tmp = 0 if J <= 1.8e+38: tmp = -U_m else: tmp = J * -2.0 return tmp
U_m = abs(U) function code(J, K, U_m) tmp = 0.0 if (J <= 1.8e+38) tmp = Float64(-U_m); else tmp = Float64(J * -2.0); end return tmp end
U_m = abs(U); function tmp_2 = code(J, K, U_m) tmp = 0.0; if (J <= 1.8e+38) tmp = -U_m; else tmp = J * -2.0; end tmp_2 = tmp; end
U_m = N[Abs[U], $MachinePrecision] code[J_, K_, U$95$m_] := If[LessEqual[J, 1.8e+38], (-U$95$m), N[(J * -2.0), $MachinePrecision]]
\begin{array}{l}
U_m = \left|U\right|
\\
\begin{array}{l}
\mathbf{if}\;J \leq 1.8 \cdot 10^{+38}:\\
\;\;\;\;-U\_m\\
\mathbf{else}:\\
\;\;\;\;J \cdot -2\\
\end{array}
\end{array}
if J < 1.79999999999999985e38Initial program 68.1%
Taylor expanded in U around inf
mul-1-negN/A
lower-neg.f6428.8
Applied rewrites28.8%
if 1.79999999999999985e38 < J Initial program 98.5%
Taylor expanded in U around 0
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f6481.6
Applied rewrites81.6%
Taylor expanded in K around 0
Applied rewrites47.9%
Final simplification33.4%
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 75.5%
Taylor expanded in U around inf
mul-1-negN/A
lower-neg.f6425.4
Applied rewrites25.4%
herbie shell --seed 2024235
(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)))))