
(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 11 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}
NOTE: U should be positive before calling this function
(FPCore (J K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0)))
(t_1 (* J t_0))
(t_2
(*
(* (* -2.0 J) t_0)
(sqrt (+ 1.0 (pow (/ U (* t_0 (* J 2.0))) 2.0))))))
(if (<= t_2 (- INFINITY))
(* -2.0 (* U 0.5))
(if (<= t_2 5e+306)
(* -2.0 (* t_1 (hypot 1.0 (/ U (* 2.0 t_1)))))
(* -2.0 (* U -0.5))))))U = abs(U);
double code(double J, double K, double U) {
double t_0 = cos((K / 2.0));
double t_1 = J * t_0;
double t_2 = ((-2.0 * J) * t_0) * sqrt((1.0 + pow((U / (t_0 * (J * 2.0))), 2.0)));
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = -2.0 * (U * 0.5);
} else if (t_2 <= 5e+306) {
tmp = -2.0 * (t_1 * hypot(1.0, (U / (2.0 * t_1))));
} else {
tmp = -2.0 * (U * -0.5);
}
return tmp;
}
U = Math.abs(U);
public static double code(double J, double K, double U) {
double t_0 = Math.cos((K / 2.0));
double t_1 = J * t_0;
double t_2 = ((-2.0 * J) * t_0) * Math.sqrt((1.0 + Math.pow((U / (t_0 * (J * 2.0))), 2.0)));
double tmp;
if (t_2 <= -Double.POSITIVE_INFINITY) {
tmp = -2.0 * (U * 0.5);
} else if (t_2 <= 5e+306) {
tmp = -2.0 * (t_1 * Math.hypot(1.0, (U / (2.0 * t_1))));
} else {
tmp = -2.0 * (U * -0.5);
}
return tmp;
}
U = abs(U) def code(J, K, U): t_0 = math.cos((K / 2.0)) t_1 = J * t_0 t_2 = ((-2.0 * J) * t_0) * math.sqrt((1.0 + math.pow((U / (t_0 * (J * 2.0))), 2.0))) tmp = 0 if t_2 <= -math.inf: tmp = -2.0 * (U * 0.5) elif t_2 <= 5e+306: tmp = -2.0 * (t_1 * math.hypot(1.0, (U / (2.0 * t_1)))) else: tmp = -2.0 * (U * -0.5) return tmp
U = abs(U) function code(J, K, U) t_0 = cos(Float64(K / 2.0)) t_1 = Float64(J * t_0) t_2 = Float64(Float64(Float64(-2.0 * J) * t_0) * sqrt(Float64(1.0 + (Float64(U / Float64(t_0 * Float64(J * 2.0))) ^ 2.0)))) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = Float64(-2.0 * Float64(U * 0.5)); elseif (t_2 <= 5e+306) tmp = Float64(-2.0 * Float64(t_1 * hypot(1.0, Float64(U / Float64(2.0 * t_1))))); else tmp = Float64(-2.0 * Float64(U * -0.5)); end return tmp end
U = abs(U) function tmp_2 = code(J, K, U) t_0 = cos((K / 2.0)); t_1 = J * t_0; t_2 = ((-2.0 * J) * t_0) * sqrt((1.0 + ((U / (t_0 * (J * 2.0))) ^ 2.0))); tmp = 0.0; if (t_2 <= -Inf) tmp = -2.0 * (U * 0.5); elseif (t_2 <= 5e+306) tmp = -2.0 * (t_1 * hypot(1.0, (U / (2.0 * t_1)))); else tmp = -2.0 * (U * -0.5); end tmp_2 = tmp; end
NOTE: U should be positive before calling this function
code[J_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(J * t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(-2.0 * J), $MachinePrecision] * t$95$0), $MachinePrecision] * N[Sqrt[N[(1.0 + N[Power[N[(U / N[(t$95$0 * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], N[(-2.0 * N[(U * 0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 5e+306], N[(-2.0 * N[(t$95$1 * N[Sqrt[1.0 ^ 2 + N[(U / N[(2.0 * t$95$1), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-2.0 * N[(U * -0.5), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
t_1 := J \cdot t_0\\
t_2 := \left(\left(-2 \cdot J\right) \cdot t_0\right) \cdot \sqrt{1 + {\left(\frac{U}{t_0 \cdot \left(J \cdot 2\right)}\right)}^{2}}\\
\mathbf{if}\;t_2 \leq -\infty:\\
\;\;\;\;-2 \cdot \left(U \cdot 0.5\right)\\
\mathbf{elif}\;t_2 \leq 5 \cdot 10^{+306}:\\
\;\;\;\;-2 \cdot \left(t_1 \cdot \mathsf{hypot}\left(1, \frac{U}{2 \cdot t_1}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \left(U \cdot -0.5\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 (*.f64 -2 J) (cos.f64 (/.f64 K 2))) (sqrt.f64 (+.f64 1 (pow.f64 (/.f64 U (*.f64 (*.f64 2 J) (cos.f64 (/.f64 K 2)))) 2)))) < -inf.0Initial program 6.0%
Simplified64.7%
Taylor expanded in J around 0 55.9%
if -inf.0 < (*.f64 (*.f64 (*.f64 -2 J) (cos.f64 (/.f64 K 2))) (sqrt.f64 (+.f64 1 (pow.f64 (/.f64 U (*.f64 (*.f64 2 J) (cos.f64 (/.f64 K 2)))) 2)))) < 4.99999999999999993e306Initial program 99.8%
associate-*l*99.8%
associate-*l*99.8%
unpow299.8%
sqr-neg99.8%
distribute-frac-neg99.8%
distribute-frac-neg99.8%
unpow299.8%
Simplified99.8%
if 4.99999999999999993e306 < (*.f64 (*.f64 (*.f64 -2 J) (cos.f64 (/.f64 K 2))) (sqrt.f64 (+.f64 1 (pow.f64 (/.f64 U (*.f64 (*.f64 2 J) (cos.f64 (/.f64 K 2)))) 2)))) Initial program 5.1%
Simplified59.7%
Taylor expanded in U around -inf 54.9%
*-commutative54.9%
Simplified54.9%
Final simplification86.3%
NOTE: U should be positive before calling this function
(FPCore (J K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))) (t_1 (* -2.0 (* J t_0))))
(if (<= t_0 0.34)
t_1
(if (<= t_0 0.5)
(* -2.0 (* U -0.5))
(if (<= t_0 0.66) t_1 (* -2.0 (* J (hypot 1.0 (/ (* U 0.5) J)))))))))U = abs(U);
double code(double J, double K, double U) {
double t_0 = cos((K / 2.0));
double t_1 = -2.0 * (J * t_0);
double tmp;
if (t_0 <= 0.34) {
tmp = t_1;
} else if (t_0 <= 0.5) {
tmp = -2.0 * (U * -0.5);
} else if (t_0 <= 0.66) {
tmp = t_1;
} else {
tmp = -2.0 * (J * hypot(1.0, ((U * 0.5) / J)));
}
return tmp;
}
U = Math.abs(U);
public static double code(double J, double K, double U) {
double t_0 = Math.cos((K / 2.0));
double t_1 = -2.0 * (J * t_0);
double tmp;
if (t_0 <= 0.34) {
tmp = t_1;
} else if (t_0 <= 0.5) {
tmp = -2.0 * (U * -0.5);
} else if (t_0 <= 0.66) {
tmp = t_1;
} else {
tmp = -2.0 * (J * Math.hypot(1.0, ((U * 0.5) / J)));
}
return tmp;
}
U = abs(U) def code(J, K, U): t_0 = math.cos((K / 2.0)) t_1 = -2.0 * (J * t_0) tmp = 0 if t_0 <= 0.34: tmp = t_1 elif t_0 <= 0.5: tmp = -2.0 * (U * -0.5) elif t_0 <= 0.66: tmp = t_1 else: tmp = -2.0 * (J * math.hypot(1.0, ((U * 0.5) / J))) return tmp
U = abs(U) function code(J, K, U) t_0 = cos(Float64(K / 2.0)) t_1 = Float64(-2.0 * Float64(J * t_0)) tmp = 0.0 if (t_0 <= 0.34) tmp = t_1; elseif (t_0 <= 0.5) tmp = Float64(-2.0 * Float64(U * -0.5)); elseif (t_0 <= 0.66) tmp = t_1; else tmp = Float64(-2.0 * Float64(J * hypot(1.0, Float64(Float64(U * 0.5) / J)))); end return tmp end
U = abs(U) function tmp_2 = code(J, K, U) t_0 = cos((K / 2.0)); t_1 = -2.0 * (J * t_0); tmp = 0.0; if (t_0 <= 0.34) tmp = t_1; elseif (t_0 <= 0.5) tmp = -2.0 * (U * -0.5); elseif (t_0 <= 0.66) tmp = t_1; else tmp = -2.0 * (J * hypot(1.0, ((U * 0.5) / J))); end tmp_2 = tmp; end
NOTE: U should be positive before calling this function
code[J_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(-2.0 * N[(J * t$95$0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 0.34], t$95$1, If[LessEqual[t$95$0, 0.5], N[(-2.0 * N[(U * -0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 0.66], t$95$1, N[(-2.0 * N[(J * N[Sqrt[1.0 ^ 2 + N[(N[(U * 0.5), $MachinePrecision] / J), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
t_1 := -2 \cdot \left(J \cdot t_0\right)\\
\mathbf{if}\;t_0 \leq 0.34:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t_0 \leq 0.5:\\
\;\;\;\;-2 \cdot \left(U \cdot -0.5\right)\\
\mathbf{elif}\;t_0 \leq 0.66:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \left(J \cdot \mathsf{hypot}\left(1, \frac{U \cdot 0.5}{J}\right)\right)\\
\end{array}
\end{array}
if (cos.f64 (/.f64 K 2)) < 0.340000000000000024 or 0.5 < (cos.f64 (/.f64 K 2)) < 0.660000000000000031Initial program 75.1%
associate-*l*75.1%
associate-*l*75.1%
*-commutative75.1%
unpow275.1%
sqr-neg75.1%
distribute-frac-neg75.1%
distribute-frac-neg75.1%
unpow275.1%
Simplified92.5%
Taylor expanded in J around inf 56.1%
if 0.340000000000000024 < (cos.f64 (/.f64 K 2)) < 0.5Initial program 46.1%
Simplified59.4%
Taylor expanded in U around -inf 44.1%
*-commutative44.1%
Simplified44.1%
if 0.660000000000000031 < (cos.f64 (/.f64 K 2)) Initial program 69.9%
Simplified87.4%
Taylor expanded in K around 0 46.2%
unpow246.2%
unpow246.2%
Simplified46.2%
add-sqr-sqrt46.2%
hypot-1-def46.2%
sqrt-prod46.2%
metadata-eval46.2%
times-frac64.2%
sqrt-prod38.2%
add-sqr-sqrt82.3%
associate-*r/82.3%
Applied egg-rr82.3%
Final simplification71.9%
NOTE: U should be positive before calling this function
(FPCore (J K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= U 1.55e+270)
(* -2.0 (* J (* t_0 (hypot 1.0 (/ U (* J (* 2.0 t_0)))))))
(* -2.0 (* U 0.5)))))U = abs(U);
double code(double J, double K, double U) {
double t_0 = cos((K / 2.0));
double tmp;
if (U <= 1.55e+270) {
tmp = -2.0 * (J * (t_0 * hypot(1.0, (U / (J * (2.0 * t_0))))));
} else {
tmp = -2.0 * (U * 0.5);
}
return tmp;
}
U = Math.abs(U);
public static double code(double J, double K, double U) {
double t_0 = Math.cos((K / 2.0));
double tmp;
if (U <= 1.55e+270) {
tmp = -2.0 * (J * (t_0 * Math.hypot(1.0, (U / (J * (2.0 * t_0))))));
} else {
tmp = -2.0 * (U * 0.5);
}
return tmp;
}
U = abs(U) def code(J, K, U): t_0 = math.cos((K / 2.0)) tmp = 0 if U <= 1.55e+270: tmp = -2.0 * (J * (t_0 * math.hypot(1.0, (U / (J * (2.0 * t_0)))))) else: tmp = -2.0 * (U * 0.5) return tmp
U = abs(U) function code(J, K, U) t_0 = cos(Float64(K / 2.0)) tmp = 0.0 if (U <= 1.55e+270) tmp = Float64(-2.0 * Float64(J * Float64(t_0 * hypot(1.0, Float64(U / Float64(J * Float64(2.0 * t_0))))))); else tmp = Float64(-2.0 * Float64(U * 0.5)); end return tmp end
U = abs(U) function tmp_2 = code(J, K, U) t_0 = cos((K / 2.0)); tmp = 0.0; if (U <= 1.55e+270) tmp = -2.0 * (J * (t_0 * hypot(1.0, (U / (J * (2.0 * t_0)))))); else tmp = -2.0 * (U * 0.5); end tmp_2 = tmp; end
NOTE: U should be positive before calling this function
code[J_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[U, 1.55e+270], N[(-2.0 * N[(J * N[(t$95$0 * N[Sqrt[1.0 ^ 2 + N[(U / N[(J * N[(2.0 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-2.0 * N[(U * 0.5), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;U \leq 1.55 \cdot 10^{+270}:\\
\;\;\;\;-2 \cdot \left(J \cdot \left(t_0 \cdot \mathsf{hypot}\left(1, \frac{U}{J \cdot \left(2 \cdot t_0\right)}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \left(U \cdot 0.5\right)\\
\end{array}
\end{array}
if U < 1.55e270Initial program 72.4%
Simplified89.9%
if 1.55e270 < U Initial program 31.8%
Simplified43.3%
Taylor expanded in J around 0 87.5%
Final simplification89.8%
NOTE: U should be positive before calling this function
(FPCore (J K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= U 1.65e+270)
(* -2.0 (* t_0 (* J (hypot 1.0 (* 0.5 (/ U (* J t_0)))))))
(* -2.0 (* U 0.5)))))U = abs(U);
double code(double J, double K, double U) {
double t_0 = cos((K / 2.0));
double tmp;
if (U <= 1.65e+270) {
tmp = -2.0 * (t_0 * (J * hypot(1.0, (0.5 * (U / (J * t_0))))));
} else {
tmp = -2.0 * (U * 0.5);
}
return tmp;
}
U = Math.abs(U);
public static double code(double J, double K, double U) {
double t_0 = Math.cos((K / 2.0));
double tmp;
if (U <= 1.65e+270) {
tmp = -2.0 * (t_0 * (J * Math.hypot(1.0, (0.5 * (U / (J * t_0))))));
} else {
tmp = -2.0 * (U * 0.5);
}
return tmp;
}
U = abs(U) def code(J, K, U): t_0 = math.cos((K / 2.0)) tmp = 0 if U <= 1.65e+270: tmp = -2.0 * (t_0 * (J * math.hypot(1.0, (0.5 * (U / (J * t_0)))))) else: tmp = -2.0 * (U * 0.5) return tmp
U = abs(U) function code(J, K, U) t_0 = cos(Float64(K / 2.0)) tmp = 0.0 if (U <= 1.65e+270) tmp = Float64(-2.0 * Float64(t_0 * Float64(J * hypot(1.0, Float64(0.5 * Float64(U / Float64(J * t_0))))))); else tmp = Float64(-2.0 * Float64(U * 0.5)); end return tmp end
U = abs(U) function tmp_2 = code(J, K, U) t_0 = cos((K / 2.0)); tmp = 0.0; if (U <= 1.65e+270) tmp = -2.0 * (t_0 * (J * hypot(1.0, (0.5 * (U / (J * t_0)))))); else tmp = -2.0 * (U * 0.5); end tmp_2 = tmp; end
NOTE: U should be positive before calling this function
code[J_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[U, 1.65e+270], N[(-2.0 * N[(t$95$0 * N[(J * N[Sqrt[1.0 ^ 2 + N[(0.5 * N[(U / N[(J * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-2.0 * N[(U * 0.5), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;U \leq 1.65 \cdot 10^{+270}:\\
\;\;\;\;-2 \cdot \left(t_0 \cdot \left(J \cdot \mathsf{hypot}\left(1, 0.5 \cdot \frac{U}{J \cdot t_0}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \left(U \cdot 0.5\right)\\
\end{array}
\end{array}
if U < 1.64999999999999996e270Initial program 72.4%
associate-*l*72.4%
associate-*l*72.4%
*-commutative72.4%
unpow272.4%
sqr-neg72.4%
distribute-frac-neg72.4%
distribute-frac-neg72.4%
unpow272.4%
Simplified89.9%
if 1.64999999999999996e270 < U Initial program 31.8%
Simplified43.3%
Taylor expanded in J around 0 87.5%
Final simplification89.8%
NOTE: U should be positive before calling this function
(FPCore (J K U)
:precision binary64
(let* ((t_0 (* -2.0 (* (cos (/ K 2.0)) (* J (hypot 1.0 (* 0.5 (/ U J))))))))
(if (<= J -2.65e-146)
t_0
(if (<= J -4e-310)
(* -2.0 (* U -0.5))
(if (<= J 3.6e-107) (* -2.0 (* U 0.5)) t_0)))))U = abs(U);
double code(double J, double K, double U) {
double t_0 = -2.0 * (cos((K / 2.0)) * (J * hypot(1.0, (0.5 * (U / J)))));
double tmp;
if (J <= -2.65e-146) {
tmp = t_0;
} else if (J <= -4e-310) {
tmp = -2.0 * (U * -0.5);
} else if (J <= 3.6e-107) {
tmp = -2.0 * (U * 0.5);
} else {
tmp = t_0;
}
return tmp;
}
U = Math.abs(U);
public static double code(double J, double K, double U) {
double t_0 = -2.0 * (Math.cos((K / 2.0)) * (J * Math.hypot(1.0, (0.5 * (U / J)))));
double tmp;
if (J <= -2.65e-146) {
tmp = t_0;
} else if (J <= -4e-310) {
tmp = -2.0 * (U * -0.5);
} else if (J <= 3.6e-107) {
tmp = -2.0 * (U * 0.5);
} else {
tmp = t_0;
}
return tmp;
}
U = abs(U) def code(J, K, U): t_0 = -2.0 * (math.cos((K / 2.0)) * (J * math.hypot(1.0, (0.5 * (U / J))))) tmp = 0 if J <= -2.65e-146: tmp = t_0 elif J <= -4e-310: tmp = -2.0 * (U * -0.5) elif J <= 3.6e-107: tmp = -2.0 * (U * 0.5) else: tmp = t_0 return tmp
U = abs(U) function code(J, K, U) t_0 = Float64(-2.0 * Float64(cos(Float64(K / 2.0)) * Float64(J * hypot(1.0, Float64(0.5 * Float64(U / J)))))) tmp = 0.0 if (J <= -2.65e-146) tmp = t_0; elseif (J <= -4e-310) tmp = Float64(-2.0 * Float64(U * -0.5)); elseif (J <= 3.6e-107) tmp = Float64(-2.0 * Float64(U * 0.5)); else tmp = t_0; end return tmp end
U = abs(U) function tmp_2 = code(J, K, U) t_0 = -2.0 * (cos((K / 2.0)) * (J * hypot(1.0, (0.5 * (U / J))))); tmp = 0.0; if (J <= -2.65e-146) tmp = t_0; elseif (J <= -4e-310) tmp = -2.0 * (U * -0.5); elseif (J <= 3.6e-107) tmp = -2.0 * (U * 0.5); else tmp = t_0; end tmp_2 = tmp; end
NOTE: U should be positive before calling this function
code[J_, K_, U_] := Block[{t$95$0 = N[(-2.0 * N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(J * N[Sqrt[1.0 ^ 2 + N[(0.5 * N[(U / J), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[J, -2.65e-146], t$95$0, If[LessEqual[J, -4e-310], N[(-2.0 * N[(U * -0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[J, 3.6e-107], N[(-2.0 * N[(U * 0.5), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
t_0 := -2 \cdot \left(\cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \mathsf{hypot}\left(1, 0.5 \cdot \frac{U}{J}\right)\right)\right)\\
\mathbf{if}\;J \leq -2.65 \cdot 10^{-146}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;J \leq -4 \cdot 10^{-310}:\\
\;\;\;\;-2 \cdot \left(U \cdot -0.5\right)\\
\mathbf{elif}\;J \leq 3.6 \cdot 10^{-107}:\\
\;\;\;\;-2 \cdot \left(U \cdot 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if J < -2.64999999999999991e-146 or 3.59999999999999976e-107 < J Initial program 85.0%
associate-*l*85.0%
associate-*l*85.0%
*-commutative85.0%
unpow285.0%
sqr-neg85.0%
distribute-frac-neg85.0%
distribute-frac-neg85.0%
unpow285.0%
Simplified97.7%
Taylor expanded in K around 0 82.1%
if -2.64999999999999991e-146 < J < -3.999999999999988e-310Initial program 40.8%
Simplified64.1%
Taylor expanded in U around -inf 42.1%
*-commutative42.1%
Simplified42.1%
if -3.999999999999988e-310 < J < 3.59999999999999976e-107Initial program 33.3%
Simplified67.1%
Taylor expanded in J around 0 44.5%
Final simplification70.9%
NOTE: U should be positive before calling this function
(FPCore (J K U)
:precision binary64
(let* ((t_0 (* -2.0 (* J (cos (/ K 2.0))))))
(if (<= J -2.35e+30)
t_0
(if (<= J -5.7e-12)
(* -2.0 (- (* U -0.5) (/ J (/ U J))))
(if (<= J -2.3e-91)
t_0
(if (<= J -4e-310)
(* -2.0 (* U -0.5))
(if (or (<= J 1.5e-98) (and (not (<= J 5.2e+26)) (<= J 5.8e+63)))
(* -2.0 (* U 0.5))
t_0)))))))U = abs(U);
double code(double J, double K, double U) {
double t_0 = -2.0 * (J * cos((K / 2.0)));
double tmp;
if (J <= -2.35e+30) {
tmp = t_0;
} else if (J <= -5.7e-12) {
tmp = -2.0 * ((U * -0.5) - (J / (U / J)));
} else if (J <= -2.3e-91) {
tmp = t_0;
} else if (J <= -4e-310) {
tmp = -2.0 * (U * -0.5);
} else if ((J <= 1.5e-98) || (!(J <= 5.2e+26) && (J <= 5.8e+63))) {
tmp = -2.0 * (U * 0.5);
} else {
tmp = t_0;
}
return tmp;
}
NOTE: U should be positive before calling this function
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
real(8) :: tmp
t_0 = (-2.0d0) * (j * cos((k / 2.0d0)))
if (j <= (-2.35d+30)) then
tmp = t_0
else if (j <= (-5.7d-12)) then
tmp = (-2.0d0) * ((u * (-0.5d0)) - (j / (u / j)))
else if (j <= (-2.3d-91)) then
tmp = t_0
else if (j <= (-4d-310)) then
tmp = (-2.0d0) * (u * (-0.5d0))
else if ((j <= 1.5d-98) .or. (.not. (j <= 5.2d+26)) .and. (j <= 5.8d+63)) then
tmp = (-2.0d0) * (u * 0.5d0)
else
tmp = t_0
end if
code = tmp
end function
U = Math.abs(U);
public static double code(double J, double K, double U) {
double t_0 = -2.0 * (J * Math.cos((K / 2.0)));
double tmp;
if (J <= -2.35e+30) {
tmp = t_0;
} else if (J <= -5.7e-12) {
tmp = -2.0 * ((U * -0.5) - (J / (U / J)));
} else if (J <= -2.3e-91) {
tmp = t_0;
} else if (J <= -4e-310) {
tmp = -2.0 * (U * -0.5);
} else if ((J <= 1.5e-98) || (!(J <= 5.2e+26) && (J <= 5.8e+63))) {
tmp = -2.0 * (U * 0.5);
} else {
tmp = t_0;
}
return tmp;
}
U = abs(U) def code(J, K, U): t_0 = -2.0 * (J * math.cos((K / 2.0))) tmp = 0 if J <= -2.35e+30: tmp = t_0 elif J <= -5.7e-12: tmp = -2.0 * ((U * -0.5) - (J / (U / J))) elif J <= -2.3e-91: tmp = t_0 elif J <= -4e-310: tmp = -2.0 * (U * -0.5) elif (J <= 1.5e-98) or (not (J <= 5.2e+26) and (J <= 5.8e+63)): tmp = -2.0 * (U * 0.5) else: tmp = t_0 return tmp
U = abs(U) function code(J, K, U) t_0 = Float64(-2.0 * Float64(J * cos(Float64(K / 2.0)))) tmp = 0.0 if (J <= -2.35e+30) tmp = t_0; elseif (J <= -5.7e-12) tmp = Float64(-2.0 * Float64(Float64(U * -0.5) - Float64(J / Float64(U / J)))); elseif (J <= -2.3e-91) tmp = t_0; elseif (J <= -4e-310) tmp = Float64(-2.0 * Float64(U * -0.5)); elseif ((J <= 1.5e-98) || (!(J <= 5.2e+26) && (J <= 5.8e+63))) tmp = Float64(-2.0 * Float64(U * 0.5)); else tmp = t_0; end return tmp end
U = abs(U) function tmp_2 = code(J, K, U) t_0 = -2.0 * (J * cos((K / 2.0))); tmp = 0.0; if (J <= -2.35e+30) tmp = t_0; elseif (J <= -5.7e-12) tmp = -2.0 * ((U * -0.5) - (J / (U / J))); elseif (J <= -2.3e-91) tmp = t_0; elseif (J <= -4e-310) tmp = -2.0 * (U * -0.5); elseif ((J <= 1.5e-98) || (~((J <= 5.2e+26)) && (J <= 5.8e+63))) tmp = -2.0 * (U * 0.5); else tmp = t_0; end tmp_2 = tmp; end
NOTE: U should be positive before calling this function
code[J_, K_, U_] := Block[{t$95$0 = N[(-2.0 * N[(J * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[J, -2.35e+30], t$95$0, If[LessEqual[J, -5.7e-12], N[(-2.0 * N[(N[(U * -0.5), $MachinePrecision] - N[(J / N[(U / J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[J, -2.3e-91], t$95$0, If[LessEqual[J, -4e-310], N[(-2.0 * N[(U * -0.5), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[J, 1.5e-98], And[N[Not[LessEqual[J, 5.2e+26]], $MachinePrecision], LessEqual[J, 5.8e+63]]], N[(-2.0 * N[(U * 0.5), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
t_0 := -2 \cdot \left(J \cdot \cos \left(\frac{K}{2}\right)\right)\\
\mathbf{if}\;J \leq -2.35 \cdot 10^{+30}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;J \leq -5.7 \cdot 10^{-12}:\\
\;\;\;\;-2 \cdot \left(U \cdot -0.5 - \frac{J}{\frac{U}{J}}\right)\\
\mathbf{elif}\;J \leq -2.3 \cdot 10^{-91}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;J \leq -4 \cdot 10^{-310}:\\
\;\;\;\;-2 \cdot \left(U \cdot -0.5\right)\\
\mathbf{elif}\;J \leq 1.5 \cdot 10^{-98} \lor \neg \left(J \leq 5.2 \cdot 10^{+26}\right) \land J \leq 5.8 \cdot 10^{+63}:\\
\;\;\;\;-2 \cdot \left(U \cdot 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if J < -2.34999999999999995e30 or -5.7000000000000003e-12 < J < -2.29999999999999996e-91 or 1.5e-98 < J < 5.20000000000000004e26 or 5.7999999999999999e63 < J Initial program 89.4%
associate-*l*89.4%
associate-*l*89.4%
*-commutative89.4%
unpow289.4%
sqr-neg89.4%
distribute-frac-neg89.4%
distribute-frac-neg89.4%
unpow289.4%
Simplified97.9%
Taylor expanded in J around inf 71.6%
if -2.34999999999999995e30 < J < -5.7000000000000003e-12Initial program 62.6%
Simplified99.8%
Taylor expanded in K around 0 54.1%
unpow254.1%
unpow254.1%
Simplified54.1%
Taylor expanded in U around -inf 51.3%
+-commutative51.3%
mul-1-neg51.3%
unsub-neg51.3%
*-commutative51.3%
unpow251.3%
associate-/l*51.3%
Simplified51.3%
if -2.29999999999999996e-91 < J < -3.999999999999988e-310Initial program 47.3%
Simplified69.7%
Taylor expanded in U around -inf 46.3%
*-commutative46.3%
Simplified46.3%
if -3.999999999999988e-310 < J < 1.5e-98 or 5.20000000000000004e26 < J < 5.7999999999999999e63Initial program 38.7%
Simplified74.5%
Taylor expanded in J around 0 42.9%
Final simplification60.8%
NOTE: U should be positive before calling this function
(FPCore (J K U)
:precision binary64
(let* ((t_0 (* -2.0 (+ J (* -0.125 (* J (* K K))))))
(t_1 (* -2.0 (* U -0.5))))
(if (<= J -2.9e+151)
(* -2.0 J)
(if (<= J -4.5e-45)
t_1
(if (<= J -2.1e-91)
t_0
(if (<= J -4e-310)
t_1
(if (<= J 1.1e+64) (* -2.0 (* U 0.5)) t_0)))))))U = abs(U);
double code(double J, double K, double U) {
double t_0 = -2.0 * (J + (-0.125 * (J * (K * K))));
double t_1 = -2.0 * (U * -0.5);
double tmp;
if (J <= -2.9e+151) {
tmp = -2.0 * J;
} else if (J <= -4.5e-45) {
tmp = t_1;
} else if (J <= -2.1e-91) {
tmp = t_0;
} else if (J <= -4e-310) {
tmp = t_1;
} else if (J <= 1.1e+64) {
tmp = -2.0 * (U * 0.5);
} else {
tmp = t_0;
}
return tmp;
}
NOTE: U should be positive before calling this function
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
real(8) :: t_1
real(8) :: tmp
t_0 = (-2.0d0) * (j + ((-0.125d0) * (j * (k * k))))
t_1 = (-2.0d0) * (u * (-0.5d0))
if (j <= (-2.9d+151)) then
tmp = (-2.0d0) * j
else if (j <= (-4.5d-45)) then
tmp = t_1
else if (j <= (-2.1d-91)) then
tmp = t_0
else if (j <= (-4d-310)) then
tmp = t_1
else if (j <= 1.1d+64) then
tmp = (-2.0d0) * (u * 0.5d0)
else
tmp = t_0
end if
code = tmp
end function
U = Math.abs(U);
public static double code(double J, double K, double U) {
double t_0 = -2.0 * (J + (-0.125 * (J * (K * K))));
double t_1 = -2.0 * (U * -0.5);
double tmp;
if (J <= -2.9e+151) {
tmp = -2.0 * J;
} else if (J <= -4.5e-45) {
tmp = t_1;
} else if (J <= -2.1e-91) {
tmp = t_0;
} else if (J <= -4e-310) {
tmp = t_1;
} else if (J <= 1.1e+64) {
tmp = -2.0 * (U * 0.5);
} else {
tmp = t_0;
}
return tmp;
}
U = abs(U) def code(J, K, U): t_0 = -2.0 * (J + (-0.125 * (J * (K * K)))) t_1 = -2.0 * (U * -0.5) tmp = 0 if J <= -2.9e+151: tmp = -2.0 * J elif J <= -4.5e-45: tmp = t_1 elif J <= -2.1e-91: tmp = t_0 elif J <= -4e-310: tmp = t_1 elif J <= 1.1e+64: tmp = -2.0 * (U * 0.5) else: tmp = t_0 return tmp
U = abs(U) function code(J, K, U) t_0 = Float64(-2.0 * Float64(J + Float64(-0.125 * Float64(J * Float64(K * K))))) t_1 = Float64(-2.0 * Float64(U * -0.5)) tmp = 0.0 if (J <= -2.9e+151) tmp = Float64(-2.0 * J); elseif (J <= -4.5e-45) tmp = t_1; elseif (J <= -2.1e-91) tmp = t_0; elseif (J <= -4e-310) tmp = t_1; elseif (J <= 1.1e+64) tmp = Float64(-2.0 * Float64(U * 0.5)); else tmp = t_0; end return tmp end
U = abs(U) function tmp_2 = code(J, K, U) t_0 = -2.0 * (J + (-0.125 * (J * (K * K)))); t_1 = -2.0 * (U * -0.5); tmp = 0.0; if (J <= -2.9e+151) tmp = -2.0 * J; elseif (J <= -4.5e-45) tmp = t_1; elseif (J <= -2.1e-91) tmp = t_0; elseif (J <= -4e-310) tmp = t_1; elseif (J <= 1.1e+64) tmp = -2.0 * (U * 0.5); else tmp = t_0; end tmp_2 = tmp; end
NOTE: U should be positive before calling this function
code[J_, K_, U_] := Block[{t$95$0 = N[(-2.0 * N[(J + N[(-0.125 * N[(J * N[(K * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(-2.0 * N[(U * -0.5), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[J, -2.9e+151], N[(-2.0 * J), $MachinePrecision], If[LessEqual[J, -4.5e-45], t$95$1, If[LessEqual[J, -2.1e-91], t$95$0, If[LessEqual[J, -4e-310], t$95$1, If[LessEqual[J, 1.1e+64], N[(-2.0 * N[(U * 0.5), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]]]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
t_0 := -2 \cdot \left(J + -0.125 \cdot \left(J \cdot \left(K \cdot K\right)\right)\right)\\
t_1 := -2 \cdot \left(U \cdot -0.5\right)\\
\mathbf{if}\;J \leq -2.9 \cdot 10^{+151}:\\
\;\;\;\;-2 \cdot J\\
\mathbf{elif}\;J \leq -4.5 \cdot 10^{-45}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;J \leq -2.1 \cdot 10^{-91}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;J \leq -4 \cdot 10^{-310}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;J \leq 1.1 \cdot 10^{+64}:\\
\;\;\;\;-2 \cdot \left(U \cdot 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if J < -2.90000000000000018e151Initial program 99.8%
Simplified99.8%
Taylor expanded in K around 0 35.8%
unpow235.8%
unpow235.8%
Simplified35.8%
Taylor expanded in J around inf 50.4%
if -2.90000000000000018e151 < J < -4.4999999999999999e-45 or -2.0999999999999999e-91 < J < -3.999999999999988e-310Initial program 61.1%
Simplified81.6%
Taylor expanded in U around -inf 39.9%
*-commutative39.9%
Simplified39.9%
if -4.4999999999999999e-45 < J < -2.0999999999999999e-91 or 1.10000000000000001e64 < J Initial program 92.3%
Simplified99.7%
expm1-log1p-u85.9%
expm1-udef85.8%
Applied egg-rr85.8%
Taylor expanded in U around 0 75.0%
*-commutative75.0%
Simplified75.0%
Taylor expanded in K around 0 45.0%
unpow245.0%
Simplified45.0%
if -3.999999999999988e-310 < J < 1.10000000000000001e64Initial program 54.4%
Simplified82.3%
Taylor expanded in J around 0 39.3%
Final simplification42.2%
NOTE: U should be positive before calling this function
(FPCore (J K U)
:precision binary64
(let* ((t_0 (* -2.0 (+ J (* -0.125 (* J (* K K)))))))
(if (<= J -4e+151)
(* -2.0 J)
(if (<= J -4.5e-45)
(* -2.0 (- (* U -0.5) (/ J (/ U J))))
(if (<= J -2.3e-91)
t_0
(if (<= J -4e-310)
(* -2.0 (* U -0.5))
(if (<= J 1.4e+64) (* -2.0 (* U 0.5)) t_0)))))))U = abs(U);
double code(double J, double K, double U) {
double t_0 = -2.0 * (J + (-0.125 * (J * (K * K))));
double tmp;
if (J <= -4e+151) {
tmp = -2.0 * J;
} else if (J <= -4.5e-45) {
tmp = -2.0 * ((U * -0.5) - (J / (U / J)));
} else if (J <= -2.3e-91) {
tmp = t_0;
} else if (J <= -4e-310) {
tmp = -2.0 * (U * -0.5);
} else if (J <= 1.4e+64) {
tmp = -2.0 * (U * 0.5);
} else {
tmp = t_0;
}
return tmp;
}
NOTE: U should be positive before calling this function
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
real(8) :: tmp
t_0 = (-2.0d0) * (j + ((-0.125d0) * (j * (k * k))))
if (j <= (-4d+151)) then
tmp = (-2.0d0) * j
else if (j <= (-4.5d-45)) then
tmp = (-2.0d0) * ((u * (-0.5d0)) - (j / (u / j)))
else if (j <= (-2.3d-91)) then
tmp = t_0
else if (j <= (-4d-310)) then
tmp = (-2.0d0) * (u * (-0.5d0))
else if (j <= 1.4d+64) then
tmp = (-2.0d0) * (u * 0.5d0)
else
tmp = t_0
end if
code = tmp
end function
U = Math.abs(U);
public static double code(double J, double K, double U) {
double t_0 = -2.0 * (J + (-0.125 * (J * (K * K))));
double tmp;
if (J <= -4e+151) {
tmp = -2.0 * J;
} else if (J <= -4.5e-45) {
tmp = -2.0 * ((U * -0.5) - (J / (U / J)));
} else if (J <= -2.3e-91) {
tmp = t_0;
} else if (J <= -4e-310) {
tmp = -2.0 * (U * -0.5);
} else if (J <= 1.4e+64) {
tmp = -2.0 * (U * 0.5);
} else {
tmp = t_0;
}
return tmp;
}
U = abs(U) def code(J, K, U): t_0 = -2.0 * (J + (-0.125 * (J * (K * K)))) tmp = 0 if J <= -4e+151: tmp = -2.0 * J elif J <= -4.5e-45: tmp = -2.0 * ((U * -0.5) - (J / (U / J))) elif J <= -2.3e-91: tmp = t_0 elif J <= -4e-310: tmp = -2.0 * (U * -0.5) elif J <= 1.4e+64: tmp = -2.0 * (U * 0.5) else: tmp = t_0 return tmp
U = abs(U) function code(J, K, U) t_0 = Float64(-2.0 * Float64(J + Float64(-0.125 * Float64(J * Float64(K * K))))) tmp = 0.0 if (J <= -4e+151) tmp = Float64(-2.0 * J); elseif (J <= -4.5e-45) tmp = Float64(-2.0 * Float64(Float64(U * -0.5) - Float64(J / Float64(U / J)))); elseif (J <= -2.3e-91) tmp = t_0; elseif (J <= -4e-310) tmp = Float64(-2.0 * Float64(U * -0.5)); elseif (J <= 1.4e+64) tmp = Float64(-2.0 * Float64(U * 0.5)); else tmp = t_0; end return tmp end
U = abs(U) function tmp_2 = code(J, K, U) t_0 = -2.0 * (J + (-0.125 * (J * (K * K)))); tmp = 0.0; if (J <= -4e+151) tmp = -2.0 * J; elseif (J <= -4.5e-45) tmp = -2.0 * ((U * -0.5) - (J / (U / J))); elseif (J <= -2.3e-91) tmp = t_0; elseif (J <= -4e-310) tmp = -2.0 * (U * -0.5); elseif (J <= 1.4e+64) tmp = -2.0 * (U * 0.5); else tmp = t_0; end tmp_2 = tmp; end
NOTE: U should be positive before calling this function
code[J_, K_, U_] := Block[{t$95$0 = N[(-2.0 * N[(J + N[(-0.125 * N[(J * N[(K * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[J, -4e+151], N[(-2.0 * J), $MachinePrecision], If[LessEqual[J, -4.5e-45], N[(-2.0 * N[(N[(U * -0.5), $MachinePrecision] - N[(J / N[(U / J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[J, -2.3e-91], t$95$0, If[LessEqual[J, -4e-310], N[(-2.0 * N[(U * -0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[J, 1.4e+64], N[(-2.0 * N[(U * 0.5), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
t_0 := -2 \cdot \left(J + -0.125 \cdot \left(J \cdot \left(K \cdot K\right)\right)\right)\\
\mathbf{if}\;J \leq -4 \cdot 10^{+151}:\\
\;\;\;\;-2 \cdot J\\
\mathbf{elif}\;J \leq -4.5 \cdot 10^{-45}:\\
\;\;\;\;-2 \cdot \left(U \cdot -0.5 - \frac{J}{\frac{U}{J}}\right)\\
\mathbf{elif}\;J \leq -2.3 \cdot 10^{-91}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;J \leq -4 \cdot 10^{-310}:\\
\;\;\;\;-2 \cdot \left(U \cdot -0.5\right)\\
\mathbf{elif}\;J \leq 1.4 \cdot 10^{+64}:\\
\;\;\;\;-2 \cdot \left(U \cdot 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if J < -4.00000000000000007e151Initial program 99.8%
Simplified99.8%
Taylor expanded in K around 0 35.8%
unpow235.8%
unpow235.8%
Simplified35.8%
Taylor expanded in J around inf 50.4%
if -4.00000000000000007e151 < J < -4.4999999999999999e-45Initial program 82.0%
Simplified99.7%
Taylor expanded in K around 0 36.0%
unpow236.0%
unpow236.0%
Simplified36.0%
Taylor expanded in U around -inf 30.4%
+-commutative30.4%
mul-1-neg30.4%
unsub-neg30.4%
*-commutative30.4%
unpow230.4%
associate-/l*30.4%
Simplified30.4%
if -4.4999999999999999e-45 < J < -2.29999999999999996e-91 or 1.40000000000000012e64 < J Initial program 92.3%
Simplified99.7%
expm1-log1p-u85.9%
expm1-udef85.8%
Applied egg-rr85.8%
Taylor expanded in U around 0 75.0%
*-commutative75.0%
Simplified75.0%
Taylor expanded in K around 0 45.0%
unpow245.0%
Simplified45.0%
if -2.29999999999999996e-91 < J < -3.999999999999988e-310Initial program 47.3%
Simplified69.7%
Taylor expanded in U around -inf 46.3%
*-commutative46.3%
Simplified46.3%
if -3.999999999999988e-310 < J < 1.40000000000000012e64Initial program 54.4%
Simplified82.3%
Taylor expanded in J around 0 39.3%
Final simplification42.3%
NOTE: U should be positive before calling this function
(FPCore (J K U)
:precision binary64
(let* ((t_0 (* -2.0 (* U -0.5))))
(if (<= J -4.2e+151)
(* -2.0 J)
(if (<= J -4.6e-45)
t_0
(if (<= J -2.3e-91)
(* -2.0 J)
(if (<= J -4e-310)
t_0
(if (<= J 7.6e+63) (* -2.0 (* U 0.5)) (* -2.0 J))))))))U = abs(U);
double code(double J, double K, double U) {
double t_0 = -2.0 * (U * -0.5);
double tmp;
if (J <= -4.2e+151) {
tmp = -2.0 * J;
} else if (J <= -4.6e-45) {
tmp = t_0;
} else if (J <= -2.3e-91) {
tmp = -2.0 * J;
} else if (J <= -4e-310) {
tmp = t_0;
} else if (J <= 7.6e+63) {
tmp = -2.0 * (U * 0.5);
} else {
tmp = -2.0 * J;
}
return tmp;
}
NOTE: U should be positive before calling this function
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
real(8) :: tmp
t_0 = (-2.0d0) * (u * (-0.5d0))
if (j <= (-4.2d+151)) then
tmp = (-2.0d0) * j
else if (j <= (-4.6d-45)) then
tmp = t_0
else if (j <= (-2.3d-91)) then
tmp = (-2.0d0) * j
else if (j <= (-4d-310)) then
tmp = t_0
else if (j <= 7.6d+63) then
tmp = (-2.0d0) * (u * 0.5d0)
else
tmp = (-2.0d0) * j
end if
code = tmp
end function
U = Math.abs(U);
public static double code(double J, double K, double U) {
double t_0 = -2.0 * (U * -0.5);
double tmp;
if (J <= -4.2e+151) {
tmp = -2.0 * J;
} else if (J <= -4.6e-45) {
tmp = t_0;
} else if (J <= -2.3e-91) {
tmp = -2.0 * J;
} else if (J <= -4e-310) {
tmp = t_0;
} else if (J <= 7.6e+63) {
tmp = -2.0 * (U * 0.5);
} else {
tmp = -2.0 * J;
}
return tmp;
}
U = abs(U) def code(J, K, U): t_0 = -2.0 * (U * -0.5) tmp = 0 if J <= -4.2e+151: tmp = -2.0 * J elif J <= -4.6e-45: tmp = t_0 elif J <= -2.3e-91: tmp = -2.0 * J elif J <= -4e-310: tmp = t_0 elif J <= 7.6e+63: tmp = -2.0 * (U * 0.5) else: tmp = -2.0 * J return tmp
U = abs(U) function code(J, K, U) t_0 = Float64(-2.0 * Float64(U * -0.5)) tmp = 0.0 if (J <= -4.2e+151) tmp = Float64(-2.0 * J); elseif (J <= -4.6e-45) tmp = t_0; elseif (J <= -2.3e-91) tmp = Float64(-2.0 * J); elseif (J <= -4e-310) tmp = t_0; elseif (J <= 7.6e+63) tmp = Float64(-2.0 * Float64(U * 0.5)); else tmp = Float64(-2.0 * J); end return tmp end
U = abs(U) function tmp_2 = code(J, K, U) t_0 = -2.0 * (U * -0.5); tmp = 0.0; if (J <= -4.2e+151) tmp = -2.0 * J; elseif (J <= -4.6e-45) tmp = t_0; elseif (J <= -2.3e-91) tmp = -2.0 * J; elseif (J <= -4e-310) tmp = t_0; elseif (J <= 7.6e+63) tmp = -2.0 * (U * 0.5); else tmp = -2.0 * J; end tmp_2 = tmp; end
NOTE: U should be positive before calling this function
code[J_, K_, U_] := Block[{t$95$0 = N[(-2.0 * N[(U * -0.5), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[J, -4.2e+151], N[(-2.0 * J), $MachinePrecision], If[LessEqual[J, -4.6e-45], t$95$0, If[LessEqual[J, -2.3e-91], N[(-2.0 * J), $MachinePrecision], If[LessEqual[J, -4e-310], t$95$0, If[LessEqual[J, 7.6e+63], N[(-2.0 * N[(U * 0.5), $MachinePrecision]), $MachinePrecision], N[(-2.0 * J), $MachinePrecision]]]]]]]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
t_0 := -2 \cdot \left(U \cdot -0.5\right)\\
\mathbf{if}\;J \leq -4.2 \cdot 10^{+151}:\\
\;\;\;\;-2 \cdot J\\
\mathbf{elif}\;J \leq -4.6 \cdot 10^{-45}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;J \leq -2.3 \cdot 10^{-91}:\\
\;\;\;\;-2 \cdot J\\
\mathbf{elif}\;J \leq -4 \cdot 10^{-310}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;J \leq 7.6 \cdot 10^{+63}:\\
\;\;\;\;-2 \cdot \left(U \cdot 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot J\\
\end{array}
\end{array}
if J < -4.2000000000000001e151 or -4.59999999999999983e-45 < J < -2.29999999999999996e-91 or 7.6000000000000002e63 < J Initial program 94.8%
Simplified99.7%
Taylor expanded in K around 0 40.5%
unpow240.5%
unpow240.5%
Simplified40.5%
Taylor expanded in J around inf 46.6%
if -4.2000000000000001e151 < J < -4.59999999999999983e-45 or -2.29999999999999996e-91 < J < -3.999999999999988e-310Initial program 61.1%
Simplified81.6%
Taylor expanded in U around -inf 39.9%
*-commutative39.9%
Simplified39.9%
if -3.999999999999988e-310 < J < 7.6000000000000002e63Initial program 54.4%
Simplified82.3%
Taylor expanded in J around 0 39.3%
Final simplification42.2%
NOTE: U should be positive before calling this function (FPCore (J K U) :precision binary64 (if (<= U 1.2e-36) (* -2.0 J) (* -2.0 (* U 0.5))))
U = abs(U);
double code(double J, double K, double U) {
double tmp;
if (U <= 1.2e-36) {
tmp = -2.0 * J;
} else {
tmp = -2.0 * (U * 0.5);
}
return tmp;
}
NOTE: U should be positive before calling this function
real(8) function code(j, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if (u <= 1.2d-36) then
tmp = (-2.0d0) * j
else
tmp = (-2.0d0) * (u * 0.5d0)
end if
code = tmp
end function
U = Math.abs(U);
public static double code(double J, double K, double U) {
double tmp;
if (U <= 1.2e-36) {
tmp = -2.0 * J;
} else {
tmp = -2.0 * (U * 0.5);
}
return tmp;
}
U = abs(U) def code(J, K, U): tmp = 0 if U <= 1.2e-36: tmp = -2.0 * J else: tmp = -2.0 * (U * 0.5) return tmp
U = abs(U) function code(J, K, U) tmp = 0.0 if (U <= 1.2e-36) tmp = Float64(-2.0 * J); else tmp = Float64(-2.0 * Float64(U * 0.5)); end return tmp end
U = abs(U) function tmp_2 = code(J, K, U) tmp = 0.0; if (U <= 1.2e-36) tmp = -2.0 * J; else tmp = -2.0 * (U * 0.5); end tmp_2 = tmp; end
NOTE: U should be positive before calling this function code[J_, K_, U_] := If[LessEqual[U, 1.2e-36], N[(-2.0 * J), $MachinePrecision], N[(-2.0 * N[(U * 0.5), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
\mathbf{if}\;U \leq 1.2 \cdot 10^{-36}:\\
\;\;\;\;-2 \cdot J\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \left(U \cdot 0.5\right)\\
\end{array}
\end{array}
if U < 1.2e-36Initial program 79.0%
Simplified93.9%
Taylor expanded in K around 0 35.2%
unpow235.2%
unpow235.2%
Simplified35.2%
Taylor expanded in J around inf 33.0%
if 1.2e-36 < U Initial program 53.4%
Simplified76.1%
Taylor expanded in J around 0 42.6%
Final simplification35.9%
NOTE: U should be positive before calling this function (FPCore (J K U) :precision binary64 (* -2.0 J))
U = abs(U);
double code(double J, double K, double U) {
return -2.0 * J;
}
NOTE: U should be positive before calling this function
real(8) function code(j, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: k
real(8), intent (in) :: u
code = (-2.0d0) * j
end function
U = Math.abs(U);
public static double code(double J, double K, double U) {
return -2.0 * J;
}
U = abs(U) def code(J, K, U): return -2.0 * J
U = abs(U) function code(J, K, U) return Float64(-2.0 * J) end
U = abs(U) function tmp = code(J, K, U) tmp = -2.0 * J; end
NOTE: U should be positive before calling this function code[J_, K_, U_] := N[(-2.0 * J), $MachinePrecision]
\begin{array}{l}
U = |U|\\
\\
-2 \cdot J
\end{array}
Initial program 71.1%
Simplified88.4%
Taylor expanded in K around 0 30.5%
unpow230.5%
unpow230.5%
Simplified30.5%
Taylor expanded in J around inf 28.2%
Final simplification28.2%
herbie shell --seed 2023271
(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)))))