
(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 10 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 1e+307)
(* -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 <= 1e+307) {
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 <= 1e+307) {
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 <= 1e+307: 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 <= 1e+307) 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 <= 1e+307) 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, 1e+307], 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 10^{+307}:\\
\;\;\;\;-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 5.9%
Simplified55.5%
Taylor expanded in J around 0 47.8%
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)))) < 9.99999999999999986e306Initial 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 9.99999999999999986e306 < (*.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 8.5%
Simplified76.4%
Taylor expanded in U around -inf 50.4%
*-commutative50.4%
Simplified50.4%
Final simplification85.9%
NOTE: U should be positive before calling this function (FPCore (J K U) :precision binary64 (let* ((t_0 (cos (/ K 2.0)))) (* -2.0 (* J (* t_0 (hypot 1.0 (/ U (* J (* 2.0 t_0)))))))))
U = abs(U);
double code(double J, double K, double U) {
double t_0 = cos((K / 2.0));
return -2.0 * (J * (t_0 * hypot(1.0, (U / (J * (2.0 * t_0))))));
}
U = Math.abs(U);
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.hypot(1.0, (U / (J * (2.0 * t_0))))));
}
U = abs(U) def code(J, K, U): t_0 = math.cos((K / 2.0)) return -2.0 * (J * (t_0 * math.hypot(1.0, (U / (J * (2.0 * t_0))))))
U = abs(U) function code(J, K, U) t_0 = cos(Float64(K / 2.0)) return Float64(-2.0 * Float64(J * Float64(t_0 * hypot(1.0, Float64(U / Float64(J * Float64(2.0 * t_0))))))) end
U = abs(U) function tmp = code(J, K, U) t_0 = cos((K / 2.0)); tmp = -2.0 * (J * (t_0 * hypot(1.0, (U / (J * (2.0 * t_0)))))); 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]}, 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]]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
-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)
\end{array}
\end{array}
Initial program 74.5%
Simplified90.2%
Final simplification90.2%
NOTE: U should be positive before calling this function (FPCore (J K U) :precision binary64 (if (<= U 3e+234) (* -2.0 (* J (* (cos (/ K 2.0)) (hypot 1.0 (/ U (* J 2.0)))))) (* -2.0 (* U 0.5))))
U = abs(U);
double code(double J, double K, double U) {
double tmp;
if (U <= 3e+234) {
tmp = -2.0 * (J * (cos((K / 2.0)) * hypot(1.0, (U / (J * 2.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 tmp;
if (U <= 3e+234) {
tmp = -2.0 * (J * (Math.cos((K / 2.0)) * Math.hypot(1.0, (U / (J * 2.0)))));
} else {
tmp = -2.0 * (U * 0.5);
}
return tmp;
}
U = abs(U) def code(J, K, U): tmp = 0 if U <= 3e+234: tmp = -2.0 * (J * (math.cos((K / 2.0)) * math.hypot(1.0, (U / (J * 2.0))))) else: tmp = -2.0 * (U * 0.5) return tmp
U = abs(U) function code(J, K, U) tmp = 0.0 if (U <= 3e+234) tmp = Float64(-2.0 * Float64(J * Float64(cos(Float64(K / 2.0)) * hypot(1.0, Float64(U / Float64(J * 2.0)))))); 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 <= 3e+234) tmp = -2.0 * (J * (cos((K / 2.0)) * hypot(1.0, (U / (J * 2.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_] := If[LessEqual[U, 3e+234], N[(-2.0 * N[(J * N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[Sqrt[1.0 ^ 2 + N[(U / N[(J * 2.0), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-2.0 * N[(U * 0.5), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
\mathbf{if}\;U \leq 3 \cdot 10^{+234}:\\
\;\;\;\;-2 \cdot \left(J \cdot \left(\cos \left(\frac{K}{2}\right) \cdot \mathsf{hypot}\left(1, \frac{U}{J \cdot 2}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \left(U \cdot 0.5\right)\\
\end{array}
\end{array}
if U < 2.9999999999999999e234Initial program 77.4%
Simplified92.1%
Taylor expanded in K around 0 74.5%
*-commutative74.5%
Simplified74.5%
if 2.9999999999999999e234 < U Initial program 37.6%
Simplified66.4%
Taylor expanded in J around 0 52.7%
Final simplification72.9%
NOTE: U should be positive before calling this function
(FPCore (J K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= t_0 0.232)
(* -2.0 (* J t_0))
(* -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 tmp;
if (t_0 <= 0.232) {
tmp = -2.0 * (J * t_0);
} 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 tmp;
if (t_0 <= 0.232) {
tmp = -2.0 * (J * t_0);
} 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)) tmp = 0 if t_0 <= 0.232: tmp = -2.0 * (J * t_0) 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)) tmp = 0.0 if (t_0 <= 0.232) tmp = Float64(-2.0 * Float64(J * t_0)); 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)); tmp = 0.0; if (t_0 <= 0.232) tmp = -2.0 * (J * t_0); 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]}, If[LessEqual[t$95$0, 0.232], N[(-2.0 * N[(J * t$95$0), $MachinePrecision]), $MachinePrecision], 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)\\
\mathbf{if}\;t_0 \leq 0.232:\\
\;\;\;\;-2 \cdot \left(J \cdot t_0\right)\\
\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.232000000000000012Initial 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%
Simplified91.1%
Taylor expanded in J around inf 53.7%
if 0.232000000000000012 < (cos.f64 (/.f64 K 2)) Initial program 74.1%
Simplified89.8%
Taylor expanded in K around 0 46.6%
unpow246.6%
unpow246.6%
Simplified46.6%
expm1-log1p-u46.0%
expm1-udef46.0%
add-sqr-sqrt46.0%
hypot-1-def46.0%
sqrt-prod46.0%
metadata-eval46.0%
times-frac63.9%
sqrt-prod38.4%
add-sqr-sqrt77.9%
Applied egg-rr77.9%
expm1-def77.9%
expm1-log1p81.5%
associate-*r/81.5%
Simplified81.5%
Final simplification72.0%
NOTE: U should be positive before calling this function
(FPCore (J K U)
:precision binary64
(let* ((t_0 (* -2.0 (* U -0.5)))
(t_1 (* -2.0 (* J (cos (/ K 2.0)))))
(t_2 (* -2.0 (* U 0.5))))
(if (<= J -3.9e+57)
t_1
(if (<= J -9e-82)
t_0
(if (<= J -1.05e-168)
t_2
(if (<= J -3.4e-301) t_0 (if (<= J 1.1e-49) t_2 t_1)))))))U = abs(U);
double code(double J, double K, double U) {
double t_0 = -2.0 * (U * -0.5);
double t_1 = -2.0 * (J * cos((K / 2.0)));
double t_2 = -2.0 * (U * 0.5);
double tmp;
if (J <= -3.9e+57) {
tmp = t_1;
} else if (J <= -9e-82) {
tmp = t_0;
} else if (J <= -1.05e-168) {
tmp = t_2;
} else if (J <= -3.4e-301) {
tmp = t_0;
} else if (J <= 1.1e-49) {
tmp = t_2;
} else {
tmp = t_1;
}
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) :: t_2
real(8) :: tmp
t_0 = (-2.0d0) * (u * (-0.5d0))
t_1 = (-2.0d0) * (j * cos((k / 2.0d0)))
t_2 = (-2.0d0) * (u * 0.5d0)
if (j <= (-3.9d+57)) then
tmp = t_1
else if (j <= (-9d-82)) then
tmp = t_0
else if (j <= (-1.05d-168)) then
tmp = t_2
else if (j <= (-3.4d-301)) then
tmp = t_0
else if (j <= 1.1d-49) then
tmp = t_2
else
tmp = t_1
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 t_1 = -2.0 * (J * Math.cos((K / 2.0)));
double t_2 = -2.0 * (U * 0.5);
double tmp;
if (J <= -3.9e+57) {
tmp = t_1;
} else if (J <= -9e-82) {
tmp = t_0;
} else if (J <= -1.05e-168) {
tmp = t_2;
} else if (J <= -3.4e-301) {
tmp = t_0;
} else if (J <= 1.1e-49) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
U = abs(U) def code(J, K, U): t_0 = -2.0 * (U * -0.5) t_1 = -2.0 * (J * math.cos((K / 2.0))) t_2 = -2.0 * (U * 0.5) tmp = 0 if J <= -3.9e+57: tmp = t_1 elif J <= -9e-82: tmp = t_0 elif J <= -1.05e-168: tmp = t_2 elif J <= -3.4e-301: tmp = t_0 elif J <= 1.1e-49: tmp = t_2 else: tmp = t_1 return tmp
U = abs(U) function code(J, K, U) t_0 = Float64(-2.0 * Float64(U * -0.5)) t_1 = Float64(-2.0 * Float64(J * cos(Float64(K / 2.0)))) t_2 = Float64(-2.0 * Float64(U * 0.5)) tmp = 0.0 if (J <= -3.9e+57) tmp = t_1; elseif (J <= -9e-82) tmp = t_0; elseif (J <= -1.05e-168) tmp = t_2; elseif (J <= -3.4e-301) tmp = t_0; elseif (J <= 1.1e-49) tmp = t_2; else tmp = t_1; end return tmp end
U = abs(U) function tmp_2 = code(J, K, U) t_0 = -2.0 * (U * -0.5); t_1 = -2.0 * (J * cos((K / 2.0))); t_2 = -2.0 * (U * 0.5); tmp = 0.0; if (J <= -3.9e+57) tmp = t_1; elseif (J <= -9e-82) tmp = t_0; elseif (J <= -1.05e-168) tmp = t_2; elseif (J <= -3.4e-301) tmp = t_0; elseif (J <= 1.1e-49) tmp = t_2; else tmp = t_1; 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]}, Block[{t$95$1 = N[(-2.0 * N[(J * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(-2.0 * N[(U * 0.5), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[J, -3.9e+57], t$95$1, If[LessEqual[J, -9e-82], t$95$0, If[LessEqual[J, -1.05e-168], t$95$2, If[LessEqual[J, -3.4e-301], t$95$0, If[LessEqual[J, 1.1e-49], t$95$2, t$95$1]]]]]]]]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
t_0 := -2 \cdot \left(U \cdot -0.5\right)\\
t_1 := -2 \cdot \left(J \cdot \cos \left(\frac{K}{2}\right)\right)\\
t_2 := -2 \cdot \left(U \cdot 0.5\right)\\
\mathbf{if}\;J \leq -3.9 \cdot 10^{+57}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;J \leq -9 \cdot 10^{-82}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;J \leq -1.05 \cdot 10^{-168}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;J \leq -3.4 \cdot 10^{-301}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;J \leq 1.1 \cdot 10^{-49}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if J < -3.89999999999999968e57 or 1.09999999999999995e-49 < J Initial program 92.8%
associate-*l*92.8%
associate-*l*92.8%
*-commutative92.8%
unpow292.8%
sqr-neg92.8%
distribute-frac-neg92.8%
distribute-frac-neg92.8%
unpow292.8%
Simplified99.1%
Taylor expanded in J around inf 78.6%
if -3.89999999999999968e57 < J < -8.9999999999999997e-82 or -1.04999999999999997e-168 < J < -3.4000000000000002e-301Initial program 54.9%
Simplified84.8%
Taylor expanded in U around -inf 44.0%
*-commutative44.0%
Simplified44.0%
if -8.9999999999999997e-82 < J < -1.04999999999999997e-168 or -3.4000000000000002e-301 < J < 1.09999999999999995e-49Initial program 55.5%
Simplified77.1%
Taylor expanded in J around 0 46.4%
Final simplification62.3%
NOTE: U should be positive before calling this function
(FPCore (J K U)
:precision binary64
(let* ((t_0 (* -2.0 (* U -0.5)))
(t_1 (* -2.0 (+ J (* 0.125 (/ U (/ J U))))))
(t_2 (* -2.0 (* U 0.5))))
(if (<= J -9.5e+63)
t_1
(if (<= J -5.2e-85)
t_0
(if (<= J -1.45e-168)
t_2
(if (<= J -3.3e-301) t_0 (if (<= J 2.4e+29) t_2 t_1)))))))U = abs(U);
double code(double J, double K, double U) {
double t_0 = -2.0 * (U * -0.5);
double t_1 = -2.0 * (J + (0.125 * (U / (J / U))));
double t_2 = -2.0 * (U * 0.5);
double tmp;
if (J <= -9.5e+63) {
tmp = t_1;
} else if (J <= -5.2e-85) {
tmp = t_0;
} else if (J <= -1.45e-168) {
tmp = t_2;
} else if (J <= -3.3e-301) {
tmp = t_0;
} else if (J <= 2.4e+29) {
tmp = t_2;
} else {
tmp = t_1;
}
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) :: t_2
real(8) :: tmp
t_0 = (-2.0d0) * (u * (-0.5d0))
t_1 = (-2.0d0) * (j + (0.125d0 * (u / (j / u))))
t_2 = (-2.0d0) * (u * 0.5d0)
if (j <= (-9.5d+63)) then
tmp = t_1
else if (j <= (-5.2d-85)) then
tmp = t_0
else if (j <= (-1.45d-168)) then
tmp = t_2
else if (j <= (-3.3d-301)) then
tmp = t_0
else if (j <= 2.4d+29) then
tmp = t_2
else
tmp = t_1
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 t_1 = -2.0 * (J + (0.125 * (U / (J / U))));
double t_2 = -2.0 * (U * 0.5);
double tmp;
if (J <= -9.5e+63) {
tmp = t_1;
} else if (J <= -5.2e-85) {
tmp = t_0;
} else if (J <= -1.45e-168) {
tmp = t_2;
} else if (J <= -3.3e-301) {
tmp = t_0;
} else if (J <= 2.4e+29) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
U = abs(U) def code(J, K, U): t_0 = -2.0 * (U * -0.5) t_1 = -2.0 * (J + (0.125 * (U / (J / U)))) t_2 = -2.0 * (U * 0.5) tmp = 0 if J <= -9.5e+63: tmp = t_1 elif J <= -5.2e-85: tmp = t_0 elif J <= -1.45e-168: tmp = t_2 elif J <= -3.3e-301: tmp = t_0 elif J <= 2.4e+29: tmp = t_2 else: tmp = t_1 return tmp
U = abs(U) function code(J, K, U) t_0 = Float64(-2.0 * Float64(U * -0.5)) t_1 = Float64(-2.0 * Float64(J + Float64(0.125 * Float64(U / Float64(J / U))))) t_2 = Float64(-2.0 * Float64(U * 0.5)) tmp = 0.0 if (J <= -9.5e+63) tmp = t_1; elseif (J <= -5.2e-85) tmp = t_0; elseif (J <= -1.45e-168) tmp = t_2; elseif (J <= -3.3e-301) tmp = t_0; elseif (J <= 2.4e+29) tmp = t_2; else tmp = t_1; end return tmp end
U = abs(U) function tmp_2 = code(J, K, U) t_0 = -2.0 * (U * -0.5); t_1 = -2.0 * (J + (0.125 * (U / (J / U)))); t_2 = -2.0 * (U * 0.5); tmp = 0.0; if (J <= -9.5e+63) tmp = t_1; elseif (J <= -5.2e-85) tmp = t_0; elseif (J <= -1.45e-168) tmp = t_2; elseif (J <= -3.3e-301) tmp = t_0; elseif (J <= 2.4e+29) tmp = t_2; else tmp = t_1; 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]}, Block[{t$95$1 = N[(-2.0 * N[(J + N[(0.125 * N[(U / N[(J / U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(-2.0 * N[(U * 0.5), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[J, -9.5e+63], t$95$1, If[LessEqual[J, -5.2e-85], t$95$0, If[LessEqual[J, -1.45e-168], t$95$2, If[LessEqual[J, -3.3e-301], t$95$0, If[LessEqual[J, 2.4e+29], t$95$2, t$95$1]]]]]]]]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
t_0 := -2 \cdot \left(U \cdot -0.5\right)\\
t_1 := -2 \cdot \left(J + 0.125 \cdot \frac{U}{\frac{J}{U}}\right)\\
t_2 := -2 \cdot \left(U \cdot 0.5\right)\\
\mathbf{if}\;J \leq -9.5 \cdot 10^{+63}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;J \leq -5.2 \cdot 10^{-85}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;J \leq -1.45 \cdot 10^{-168}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;J \leq -3.3 \cdot 10^{-301}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;J \leq 2.4 \cdot 10^{+29}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if J < -9.5000000000000003e63 or 2.4000000000000001e29 < J Initial program 96.5%
Simplified99.8%
Taylor expanded in K around 0 45.4%
unpow245.4%
unpow245.4%
Simplified45.4%
Taylor expanded in J around inf 45.9%
unpow245.9%
associate-/l*49.5%
Simplified49.5%
if -9.5000000000000003e63 < J < -5.20000000000000023e-85 or -1.4499999999999999e-168 < J < -3.3e-301Initial program 57.0%
Simplified85.5%
Taylor expanded in U around -inf 42.0%
*-commutative42.0%
Simplified42.0%
if -5.20000000000000023e-85 < J < -1.4499999999999999e-168 or -3.3e-301 < J < 2.4000000000000001e29Initial program 57.6%
Simplified80.6%
Taylor expanded in J around 0 44.9%
Final simplification46.2%
NOTE: U should be positive before calling this function
(FPCore (J K U)
:precision binary64
(let* ((t_0 (* -2.0 (+ J (* 0.125 (/ U (/ J U)))))) (t_1 (* -2.0 (* U 0.5))))
(if (<= J -3e+62)
t_0
(if (<= J -1.8e-80)
(* -2.0 (- (* U -0.5) (* J (/ J U))))
(if (<= J -8.8e-169)
t_1
(if (<= J -3.3e-301)
(* -2.0 (* U -0.5))
(if (<= J 1.1e+30) t_1 t_0)))))))U = abs(U);
double code(double J, double K, double U) {
double t_0 = -2.0 * (J + (0.125 * (U / (J / U))));
double t_1 = -2.0 * (U * 0.5);
double tmp;
if (J <= -3e+62) {
tmp = t_0;
} else if (J <= -1.8e-80) {
tmp = -2.0 * ((U * -0.5) - (J * (J / U)));
} else if (J <= -8.8e-169) {
tmp = t_1;
} else if (J <= -3.3e-301) {
tmp = -2.0 * (U * -0.5);
} else if (J <= 1.1e+30) {
tmp = t_1;
} 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 * (u / (j / u))))
t_1 = (-2.0d0) * (u * 0.5d0)
if (j <= (-3d+62)) then
tmp = t_0
else if (j <= (-1.8d-80)) then
tmp = (-2.0d0) * ((u * (-0.5d0)) - (j * (j / u)))
else if (j <= (-8.8d-169)) then
tmp = t_1
else if (j <= (-3.3d-301)) then
tmp = (-2.0d0) * (u * (-0.5d0))
else if (j <= 1.1d+30) then
tmp = t_1
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 * (U / (J / U))));
double t_1 = -2.0 * (U * 0.5);
double tmp;
if (J <= -3e+62) {
tmp = t_0;
} else if (J <= -1.8e-80) {
tmp = -2.0 * ((U * -0.5) - (J * (J / U)));
} else if (J <= -8.8e-169) {
tmp = t_1;
} else if (J <= -3.3e-301) {
tmp = -2.0 * (U * -0.5);
} else if (J <= 1.1e+30) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
U = abs(U) def code(J, K, U): t_0 = -2.0 * (J + (0.125 * (U / (J / U)))) t_1 = -2.0 * (U * 0.5) tmp = 0 if J <= -3e+62: tmp = t_0 elif J <= -1.8e-80: tmp = -2.0 * ((U * -0.5) - (J * (J / U))) elif J <= -8.8e-169: tmp = t_1 elif J <= -3.3e-301: tmp = -2.0 * (U * -0.5) elif J <= 1.1e+30: tmp = t_1 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(U / Float64(J / U))))) t_1 = Float64(-2.0 * Float64(U * 0.5)) tmp = 0.0 if (J <= -3e+62) tmp = t_0; elseif (J <= -1.8e-80) tmp = Float64(-2.0 * Float64(Float64(U * -0.5) - Float64(J * Float64(J / U)))); elseif (J <= -8.8e-169) tmp = t_1; elseif (J <= -3.3e-301) tmp = Float64(-2.0 * Float64(U * -0.5)); elseif (J <= 1.1e+30) tmp = t_1; 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 * (U / (J / U)))); t_1 = -2.0 * (U * 0.5); tmp = 0.0; if (J <= -3e+62) tmp = t_0; elseif (J <= -1.8e-80) tmp = -2.0 * ((U * -0.5) - (J * (J / U))); elseif (J <= -8.8e-169) tmp = t_1; elseif (J <= -3.3e-301) tmp = -2.0 * (U * -0.5); elseif (J <= 1.1e+30) tmp = t_1; 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[(U / N[(J / U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(-2.0 * N[(U * 0.5), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[J, -3e+62], t$95$0, If[LessEqual[J, -1.8e-80], N[(-2.0 * N[(N[(U * -0.5), $MachinePrecision] - N[(J * N[(J / U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[J, -8.8e-169], t$95$1, If[LessEqual[J, -3.3e-301], N[(-2.0 * N[(U * -0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[J, 1.1e+30], t$95$1, t$95$0]]]]]]]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
t_0 := -2 \cdot \left(J + 0.125 \cdot \frac{U}{\frac{J}{U}}\right)\\
t_1 := -2 \cdot \left(U \cdot 0.5\right)\\
\mathbf{if}\;J \leq -3 \cdot 10^{+62}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;J \leq -1.8 \cdot 10^{-80}:\\
\;\;\;\;-2 \cdot \left(U \cdot -0.5 - J \cdot \frac{J}{U}\right)\\
\mathbf{elif}\;J \leq -8.8 \cdot 10^{-169}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;J \leq -3.3 \cdot 10^{-301}:\\
\;\;\;\;-2 \cdot \left(U \cdot -0.5\right)\\
\mathbf{elif}\;J \leq 1.1 \cdot 10^{+30}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if J < -3e62 or 1.1e30 < J Initial program 96.5%
Simplified99.8%
Taylor expanded in K around 0 45.4%
unpow245.4%
unpow245.4%
Simplified45.4%
Taylor expanded in J around inf 45.9%
unpow245.9%
associate-/l*49.5%
Simplified49.5%
if -3e62 < J < -1.8e-80Initial program 68.0%
Simplified97.6%
Taylor expanded in K around 0 42.9%
unpow242.9%
unpow242.9%
Simplified42.9%
Taylor expanded in U around -inf 35.4%
+-commutative35.4%
mul-1-neg35.4%
unsub-neg35.4%
Simplified35.4%
Taylor expanded in J around 0 37.6%
+-commutative37.6%
mul-1-neg37.6%
unsub-neg37.6%
*-commutative37.6%
unpow237.6%
associate-*r/37.6%
Simplified37.6%
if -1.8e-80 < J < -8.80000000000000029e-169 or -3.3e-301 < J < 1.1e30Initial program 57.6%
Simplified80.6%
Taylor expanded in J around 0 44.9%
if -8.80000000000000029e-169 < J < -3.3e-301Initial program 38.9%
Simplified65.7%
Taylor expanded in U around -inf 48.9%
*-commutative48.9%
Simplified48.9%
Final simplification46.1%
NOTE: U should be positive before calling this function
(FPCore (J K U)
:precision binary64
(let* ((t_0 (* -2.0 (* U 0.5))) (t_1 (* -2.0 (* U -0.5))))
(if (<= J -5.6e+62)
(* -2.0 J)
(if (<= J -2.8e-85)
t_1
(if (<= J -1.45e-168)
t_0
(if (<= J -4.7e-299)
t_1
(if (<= J 1200000000000.0) t_0 (* -2.0 J))))))))U = abs(U);
double code(double J, double K, double U) {
double t_0 = -2.0 * (U * 0.5);
double t_1 = -2.0 * (U * -0.5);
double tmp;
if (J <= -5.6e+62) {
tmp = -2.0 * J;
} else if (J <= -2.8e-85) {
tmp = t_1;
} else if (J <= -1.45e-168) {
tmp = t_0;
} else if (J <= -4.7e-299) {
tmp = t_1;
} else if (J <= 1200000000000.0) {
tmp = t_0;
} 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) :: t_1
real(8) :: tmp
t_0 = (-2.0d0) * (u * 0.5d0)
t_1 = (-2.0d0) * (u * (-0.5d0))
if (j <= (-5.6d+62)) then
tmp = (-2.0d0) * j
else if (j <= (-2.8d-85)) then
tmp = t_1
else if (j <= (-1.45d-168)) then
tmp = t_0
else if (j <= (-4.7d-299)) then
tmp = t_1
else if (j <= 1200000000000.0d0) then
tmp = t_0
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 t_1 = -2.0 * (U * -0.5);
double tmp;
if (J <= -5.6e+62) {
tmp = -2.0 * J;
} else if (J <= -2.8e-85) {
tmp = t_1;
} else if (J <= -1.45e-168) {
tmp = t_0;
} else if (J <= -4.7e-299) {
tmp = t_1;
} else if (J <= 1200000000000.0) {
tmp = t_0;
} else {
tmp = -2.0 * J;
}
return tmp;
}
U = abs(U) def code(J, K, U): t_0 = -2.0 * (U * 0.5) t_1 = -2.0 * (U * -0.5) tmp = 0 if J <= -5.6e+62: tmp = -2.0 * J elif J <= -2.8e-85: tmp = t_1 elif J <= -1.45e-168: tmp = t_0 elif J <= -4.7e-299: tmp = t_1 elif J <= 1200000000000.0: tmp = t_0 else: tmp = -2.0 * J return tmp
U = abs(U) function code(J, K, U) t_0 = Float64(-2.0 * Float64(U * 0.5)) t_1 = Float64(-2.0 * Float64(U * -0.5)) tmp = 0.0 if (J <= -5.6e+62) tmp = Float64(-2.0 * J); elseif (J <= -2.8e-85) tmp = t_1; elseif (J <= -1.45e-168) tmp = t_0; elseif (J <= -4.7e-299) tmp = t_1; elseif (J <= 1200000000000.0) tmp = t_0; 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); t_1 = -2.0 * (U * -0.5); tmp = 0.0; if (J <= -5.6e+62) tmp = -2.0 * J; elseif (J <= -2.8e-85) tmp = t_1; elseif (J <= -1.45e-168) tmp = t_0; elseif (J <= -4.7e-299) tmp = t_1; elseif (J <= 1200000000000.0) tmp = t_0; 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]}, Block[{t$95$1 = N[(-2.0 * N[(U * -0.5), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[J, -5.6e+62], N[(-2.0 * J), $MachinePrecision], If[LessEqual[J, -2.8e-85], t$95$1, If[LessEqual[J, -1.45e-168], t$95$0, If[LessEqual[J, -4.7e-299], t$95$1, If[LessEqual[J, 1200000000000.0], t$95$0, N[(-2.0 * J), $MachinePrecision]]]]]]]]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
t_0 := -2 \cdot \left(U \cdot 0.5\right)\\
t_1 := -2 \cdot \left(U \cdot -0.5\right)\\
\mathbf{if}\;J \leq -5.6 \cdot 10^{+62}:\\
\;\;\;\;-2 \cdot J\\
\mathbf{elif}\;J \leq -2.8 \cdot 10^{-85}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;J \leq -1.45 \cdot 10^{-168}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;J \leq -4.7 \cdot 10^{-299}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;J \leq 1200000000000:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot J\\
\end{array}
\end{array}
if J < -5.60000000000000029e62 or 1.2e12 < J Initial program 95.8%
Simplified99.8%
Taylor expanded in K around 0 44.6%
unpow244.6%
unpow244.6%
Simplified44.6%
Taylor expanded in J around inf 48.2%
if -5.60000000000000029e62 < J < -2.80000000000000017e-85 or -1.4499999999999999e-168 < J < -4.6999999999999997e-299Initial program 57.0%
Simplified85.5%
Taylor expanded in U around -inf 42.0%
*-commutative42.0%
Simplified42.0%
if -2.80000000000000017e-85 < J < -1.4499999999999999e-168 or -4.6999999999999997e-299 < J < 1.2e12Initial program 57.6%
Simplified80.1%
Taylor expanded in J around 0 43.5%
Final simplification45.2%
NOTE: U should be positive before calling this function (FPCore (J K U) :precision binary64 (if (<= J -7500000000000.0) (* -2.0 J) (if (<= J 63000000000000.0) (* -2.0 (* U 0.5)) (* -2.0 J))))
U = abs(U);
double code(double J, double K, double U) {
double tmp;
if (J <= -7500000000000.0) {
tmp = -2.0 * J;
} else if (J <= 63000000000000.0) {
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) :: tmp
if (j <= (-7500000000000.0d0)) then
tmp = (-2.0d0) * j
else if (j <= 63000000000000.0d0) 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 tmp;
if (J <= -7500000000000.0) {
tmp = -2.0 * J;
} else if (J <= 63000000000000.0) {
tmp = -2.0 * (U * 0.5);
} else {
tmp = -2.0 * J;
}
return tmp;
}
U = abs(U) def code(J, K, U): tmp = 0 if J <= -7500000000000.0: tmp = -2.0 * J elif J <= 63000000000000.0: tmp = -2.0 * (U * 0.5) else: tmp = -2.0 * J return tmp
U = abs(U) function code(J, K, U) tmp = 0.0 if (J <= -7500000000000.0) tmp = Float64(-2.0 * J); elseif (J <= 63000000000000.0) 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) tmp = 0.0; if (J <= -7500000000000.0) tmp = -2.0 * J; elseif (J <= 63000000000000.0) 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_] := If[LessEqual[J, -7500000000000.0], N[(-2.0 * J), $MachinePrecision], If[LessEqual[J, 63000000000000.0], N[(-2.0 * N[(U * 0.5), $MachinePrecision]), $MachinePrecision], N[(-2.0 * J), $MachinePrecision]]]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
\mathbf{if}\;J \leq -7500000000000:\\
\;\;\;\;-2 \cdot J\\
\mathbf{elif}\;J \leq 63000000000000:\\
\;\;\;\;-2 \cdot \left(U \cdot 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot J\\
\end{array}
\end{array}
if J < -7.5e12 or 6.3e13 < J Initial program 94.7%
Simplified99.8%
Taylor expanded in K around 0 47.1%
unpow247.1%
unpow247.1%
Simplified47.1%
Taylor expanded in J around inf 46.7%
if -7.5e12 < J < 6.3e13Initial program 54.8%
Simplified81.0%
Taylor expanded in J around 0 41.4%
Final simplification44.0%
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 74.5%
Simplified90.2%
Taylor expanded in K around 0 31.2%
unpow231.2%
unpow231.2%
Simplified31.2%
Taylor expanded in J around inf 29.1%
Final simplification29.1%
herbie shell --seed 2023285
(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)))))