
(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
(*
(* (* -2.0 J) t_0)
(sqrt (+ 1.0 (pow (/ U (* t_0 (* J 2.0))) 2.0)))))
(t_2 (* J t_0)))
(if (<= t_1 (- INFINITY))
(- U)
(if (<= t_1 1e+303) (* -2.0 (* t_2 (hypot 1.0 (/ U (* 2.0 t_2))))) U))))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) * sqrt((1.0 + pow((U / (t_0 * (J * 2.0))), 2.0)));
double t_2 = J * t_0;
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = -U;
} else if (t_1 <= 1e+303) {
tmp = -2.0 * (t_2 * hypot(1.0, (U / (2.0 * t_2))));
} else {
tmp = U;
}
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) * Math.sqrt((1.0 + Math.pow((U / (t_0 * (J * 2.0))), 2.0)));
double t_2 = J * t_0;
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = -U;
} else if (t_1 <= 1e+303) {
tmp = -2.0 * (t_2 * Math.hypot(1.0, (U / (2.0 * t_2))));
} else {
tmp = U;
}
return tmp;
}
U = abs(U) def code(J, K, U): t_0 = math.cos((K / 2.0)) t_1 = ((-2.0 * J) * t_0) * math.sqrt((1.0 + math.pow((U / (t_0 * (J * 2.0))), 2.0))) t_2 = J * t_0 tmp = 0 if t_1 <= -math.inf: tmp = -U elif t_1 <= 1e+303: tmp = -2.0 * (t_2 * math.hypot(1.0, (U / (2.0 * t_2)))) else: tmp = U return tmp
U = abs(U) function code(J, K, U) t_0 = cos(Float64(K / 2.0)) t_1 = Float64(Float64(Float64(-2.0 * J) * t_0) * sqrt(Float64(1.0 + (Float64(U / Float64(t_0 * Float64(J * 2.0))) ^ 2.0)))) t_2 = Float64(J * t_0) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(-U); elseif (t_1 <= 1e+303) tmp = Float64(-2.0 * Float64(t_2 * hypot(1.0, Float64(U / Float64(2.0 * t_2))))); else tmp = U; 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) * sqrt((1.0 + ((U / (t_0 * (J * 2.0))) ^ 2.0))); t_2 = J * t_0; tmp = 0.0; if (t_1 <= -Inf) tmp = -U; elseif (t_1 <= 1e+303) tmp = -2.0 * (t_2 * hypot(1.0, (U / (2.0 * t_2)))); else tmp = U; 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[(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]}, Block[{t$95$2 = N[(J * t$95$0), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], (-U), If[LessEqual[t$95$1, 1e+303], N[(-2.0 * N[(t$95$2 * N[Sqrt[1.0 ^ 2 + N[(U / N[(2.0 * t$95$2), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], U]]]]]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
t_1 := \left(\left(-2 \cdot J\right) \cdot t_0\right) \cdot \sqrt{1 + {\left(\frac{U}{t_0 \cdot \left(J \cdot 2\right)}\right)}^{2}}\\
t_2 := J \cdot t_0\\
\mathbf{if}\;t_1 \leq -\infty:\\
\;\;\;\;-U\\
\mathbf{elif}\;t_1 \leq 10^{+303}:\\
\;\;\;\;-2 \cdot \left(t_2 \cdot \mathsf{hypot}\left(1, \frac{U}{2 \cdot t_2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U\\
\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.3%
Taylor expanded in J around 0 41.5%
neg-mul-141.5%
Simplified41.5%
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)))) < 1e303Initial 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 1e303 < (*.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%
Taylor expanded in U around -inf 50.4%
Final simplification81.2%
NOTE: U should be positive before calling this function
(FPCore (J K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (or (<= J -2.85e-218) (not (<= J -6.8e-304)))
(* -2.0 (* t_0 (* J (hypot 1.0 (* (/ U (* J t_0)) 0.5)))))
U)))U = abs(U);
double code(double J, double K, double U) {
double t_0 = cos((K / 2.0));
double tmp;
if ((J <= -2.85e-218) || !(J <= -6.8e-304)) {
tmp = -2.0 * (t_0 * (J * hypot(1.0, ((U / (J * t_0)) * 0.5))));
} else {
tmp = U;
}
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 ((J <= -2.85e-218) || !(J <= -6.8e-304)) {
tmp = -2.0 * (t_0 * (J * Math.hypot(1.0, ((U / (J * t_0)) * 0.5))));
} else {
tmp = U;
}
return tmp;
}
U = abs(U) def code(J, K, U): t_0 = math.cos((K / 2.0)) tmp = 0 if (J <= -2.85e-218) or not (J <= -6.8e-304): tmp = -2.0 * (t_0 * (J * math.hypot(1.0, ((U / (J * t_0)) * 0.5)))) else: tmp = U return tmp
U = abs(U) function code(J, K, U) t_0 = cos(Float64(K / 2.0)) tmp = 0.0 if ((J <= -2.85e-218) || !(J <= -6.8e-304)) tmp = Float64(-2.0 * Float64(t_0 * Float64(J * hypot(1.0, Float64(Float64(U / Float64(J * t_0)) * 0.5))))); else tmp = U; end return tmp end
U = abs(U) function tmp_2 = code(J, K, U) t_0 = cos((K / 2.0)); tmp = 0.0; if ((J <= -2.85e-218) || ~((J <= -6.8e-304))) tmp = -2.0 * (t_0 * (J * hypot(1.0, ((U / (J * t_0)) * 0.5)))); else tmp = U; 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[Or[LessEqual[J, -2.85e-218], N[Not[LessEqual[J, -6.8e-304]], $MachinePrecision]], N[(-2.0 * N[(t$95$0 * N[(J * N[Sqrt[1.0 ^ 2 + N[(N[(U / N[(J * t$95$0), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], U]]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;J \leq -2.85 \cdot 10^{-218} \lor \neg \left(J \leq -6.8 \cdot 10^{-304}\right):\\
\;\;\;\;-2 \cdot \left(t_0 \cdot \left(J \cdot \mathsf{hypot}\left(1, \frac{U}{J \cdot t_0} \cdot 0.5\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\end{array}
if J < -2.8499999999999999e-218 or -6.7999999999999997e-304 < J Initial program 71.6%
associate-*l*71.6%
associate-*l*71.6%
*-commutative71.6%
unpow271.6%
sqr-neg71.6%
distribute-frac-neg71.6%
distribute-frac-neg71.6%
unpow271.6%
Simplified90.3%
if -2.8499999999999999e-218 < J < -6.7999999999999997e-304Initial program 24.0%
Taylor expanded in U around -inf 45.7%
Final simplification86.8%
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))) (hypot 1.0 (* U (/ 0.5 J)))))))
(if (<= J -9e-209)
t_0
(if (<= J -1e-310)
(* -2.0 (- (* U -0.5) (* J (/ J U))))
(if (or (<= J 4.2e-155) (and (not (<= J 3.8e-107)) (<= J 2.6e-71)))
(- U)
t_0)))))U = abs(U);
double code(double J, double K, double U) {
double t_0 = -2.0 * ((J * cos((K / 2.0))) * hypot(1.0, (U * (0.5 / J))));
double tmp;
if (J <= -9e-209) {
tmp = t_0;
} else if (J <= -1e-310) {
tmp = -2.0 * ((U * -0.5) - (J * (J / U)));
} else if ((J <= 4.2e-155) || (!(J <= 3.8e-107) && (J <= 2.6e-71))) {
tmp = -U;
} 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 * ((J * Math.cos((K / 2.0))) * Math.hypot(1.0, (U * (0.5 / J))));
double tmp;
if (J <= -9e-209) {
tmp = t_0;
} else if (J <= -1e-310) {
tmp = -2.0 * ((U * -0.5) - (J * (J / U)));
} else if ((J <= 4.2e-155) || (!(J <= 3.8e-107) && (J <= 2.6e-71))) {
tmp = -U;
} else {
tmp = t_0;
}
return tmp;
}
U = abs(U) def code(J, K, U): t_0 = -2.0 * ((J * math.cos((K / 2.0))) * math.hypot(1.0, (U * (0.5 / J)))) tmp = 0 if J <= -9e-209: tmp = t_0 elif J <= -1e-310: tmp = -2.0 * ((U * -0.5) - (J * (J / U))) elif (J <= 4.2e-155) or (not (J <= 3.8e-107) and (J <= 2.6e-71)): tmp = -U else: tmp = t_0 return tmp
U = abs(U) function code(J, K, U) t_0 = Float64(-2.0 * Float64(Float64(J * cos(Float64(K / 2.0))) * hypot(1.0, Float64(U * Float64(0.5 / J))))) tmp = 0.0 if (J <= -9e-209) tmp = t_0; elseif (J <= -1e-310) tmp = Float64(-2.0 * Float64(Float64(U * -0.5) - Float64(J * Float64(J / U)))); elseif ((J <= 4.2e-155) || (!(J <= 3.8e-107) && (J <= 2.6e-71))) tmp = Float64(-U); 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))) * hypot(1.0, (U * (0.5 / J)))); tmp = 0.0; if (J <= -9e-209) tmp = t_0; elseif (J <= -1e-310) tmp = -2.0 * ((U * -0.5) - (J * (J / U))); elseif ((J <= 4.2e-155) || (~((J <= 3.8e-107)) && (J <= 2.6e-71))) tmp = -U; 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[(J * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[1.0 ^ 2 + N[(U * N[(0.5 / J), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[J, -9e-209], t$95$0, If[LessEqual[J, -1e-310], N[(-2.0 * N[(N[(U * -0.5), $MachinePrecision] - N[(J * N[(J / U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[J, 4.2e-155], And[N[Not[LessEqual[J, 3.8e-107]], $MachinePrecision], LessEqual[J, 2.6e-71]]], (-U), t$95$0]]]]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
t_0 := -2 \cdot \left(\left(J \cdot \cos \left(\frac{K}{2}\right)\right) \cdot \mathsf{hypot}\left(1, U \cdot \frac{0.5}{J}\right)\right)\\
\mathbf{if}\;J \leq -9 \cdot 10^{-209}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;J \leq -1 \cdot 10^{-310}:\\
\;\;\;\;-2 \cdot \left(U \cdot -0.5 - J \cdot \frac{J}{U}\right)\\
\mathbf{elif}\;J \leq 4.2 \cdot 10^{-155} \lor \neg \left(J \leq 3.8 \cdot 10^{-107}\right) \land J \leq 2.6 \cdot 10^{-71}:\\
\;\;\;\;-U\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if J < -8.9999999999999996e-209 or 4.2000000000000003e-155 < J < 3.8000000000000002e-107 or 2.5999999999999999e-71 < J Initial program 83.3%
associate-*l*83.3%
associate-*l*83.3%
unpow283.3%
sqr-neg83.3%
distribute-frac-neg83.3%
distribute-frac-neg83.3%
unpow283.3%
Simplified96.2%
Taylor expanded in K around 0 84.3%
associate-*r/84.3%
*-commutative84.3%
associate-*r/84.2%
Simplified84.2%
if -8.9999999999999996e-209 < J < -9.999999999999969e-311Initial program 26.4%
Taylor expanded in K around 0 3.7%
*-commutative3.7%
unpow23.7%
unpow23.7%
Simplified3.7%
Taylor expanded in U around -inf 25.0%
Taylor expanded in J around 0 46.6%
+-commutative46.6%
mul-1-neg46.6%
unsub-neg46.6%
*-commutative46.6%
unpow246.6%
associate-*r/46.6%
Simplified46.6%
if -9.999999999999969e-311 < J < 4.2000000000000003e-155 or 3.8000000000000002e-107 < J < 2.5999999999999999e-71Initial program 33.2%
Taylor expanded in J around 0 32.7%
neg-mul-132.7%
Simplified32.7%
Final simplification70.1%
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) (hypot 1.0 (* 0.5 (/ U J))))))
(if (<= J -1.05e-208)
t_1
(if (<= J -1e-310)
(* -2.0 (- (* U -0.5) (* J (/ J U))))
(if (<= J 9e-155)
(- U)
(if (<= J 9.5e-108)
(* -2.0 (* (* J t_0) (hypot 1.0 (* U (/ 0.5 J)))))
(if (<= J 4.7e-73) (- U) t_1)))))))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) * hypot(1.0, (0.5 * (U / J)));
double tmp;
if (J <= -1.05e-208) {
tmp = t_1;
} else if (J <= -1e-310) {
tmp = -2.0 * ((U * -0.5) - (J * (J / U)));
} else if (J <= 9e-155) {
tmp = -U;
} else if (J <= 9.5e-108) {
tmp = -2.0 * ((J * t_0) * hypot(1.0, (U * (0.5 / J))));
} else if (J <= 4.7e-73) {
tmp = -U;
} else {
tmp = t_1;
}
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) * Math.hypot(1.0, (0.5 * (U / J)));
double tmp;
if (J <= -1.05e-208) {
tmp = t_1;
} else if (J <= -1e-310) {
tmp = -2.0 * ((U * -0.5) - (J * (J / U)));
} else if (J <= 9e-155) {
tmp = -U;
} else if (J <= 9.5e-108) {
tmp = -2.0 * ((J * t_0) * Math.hypot(1.0, (U * (0.5 / J))));
} else if (J <= 4.7e-73) {
tmp = -U;
} else {
tmp = t_1;
}
return tmp;
}
U = abs(U) def code(J, K, U): t_0 = math.cos((K / 2.0)) t_1 = ((-2.0 * J) * t_0) * math.hypot(1.0, (0.5 * (U / J))) tmp = 0 if J <= -1.05e-208: tmp = t_1 elif J <= -1e-310: tmp = -2.0 * ((U * -0.5) - (J * (J / U))) elif J <= 9e-155: tmp = -U elif J <= 9.5e-108: tmp = -2.0 * ((J * t_0) * math.hypot(1.0, (U * (0.5 / J)))) elif J <= 4.7e-73: tmp = -U else: tmp = t_1 return tmp
U = abs(U) function code(J, K, U) t_0 = cos(Float64(K / 2.0)) t_1 = Float64(Float64(Float64(-2.0 * J) * t_0) * hypot(1.0, Float64(0.5 * Float64(U / J)))) tmp = 0.0 if (J <= -1.05e-208) tmp = t_1; elseif (J <= -1e-310) tmp = Float64(-2.0 * Float64(Float64(U * -0.5) - Float64(J * Float64(J / U)))); elseif (J <= 9e-155) tmp = Float64(-U); elseif (J <= 9.5e-108) tmp = Float64(-2.0 * Float64(Float64(J * t_0) * hypot(1.0, Float64(U * Float64(0.5 / J))))); elseif (J <= 4.7e-73) tmp = Float64(-U); else tmp = t_1; 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) * hypot(1.0, (0.5 * (U / J))); tmp = 0.0; if (J <= -1.05e-208) tmp = t_1; elseif (J <= -1e-310) tmp = -2.0 * ((U * -0.5) - (J * (J / U))); elseif (J <= 9e-155) tmp = -U; elseif (J <= 9.5e-108) tmp = -2.0 * ((J * t_0) * hypot(1.0, (U * (0.5 / J)))); elseif (J <= 4.7e-73) tmp = -U; 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[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(-2.0 * J), $MachinePrecision] * t$95$0), $MachinePrecision] * N[Sqrt[1.0 ^ 2 + N[(0.5 * N[(U / J), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[J, -1.05e-208], t$95$1, If[LessEqual[J, -1e-310], N[(-2.0 * N[(N[(U * -0.5), $MachinePrecision] - N[(J * N[(J / U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[J, 9e-155], (-U), If[LessEqual[J, 9.5e-108], N[(-2.0 * N[(N[(J * t$95$0), $MachinePrecision] * N[Sqrt[1.0 ^ 2 + N[(U * N[(0.5 / J), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[J, 4.7e-73], (-U), t$95$1]]]]]]]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
t_1 := \left(\left(-2 \cdot J\right) \cdot t_0\right) \cdot \mathsf{hypot}\left(1, 0.5 \cdot \frac{U}{J}\right)\\
\mathbf{if}\;J \leq -1.05 \cdot 10^{-208}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;J \leq -1 \cdot 10^{-310}:\\
\;\;\;\;-2 \cdot \left(U \cdot -0.5 - J \cdot \frac{J}{U}\right)\\
\mathbf{elif}\;J \leq 9 \cdot 10^{-155}:\\
\;\;\;\;-U\\
\mathbf{elif}\;J \leq 9.5 \cdot 10^{-108}:\\
\;\;\;\;-2 \cdot \left(\left(J \cdot t_0\right) \cdot \mathsf{hypot}\left(1, U \cdot \frac{0.5}{J}\right)\right)\\
\mathbf{elif}\;J \leq 4.7 \cdot 10^{-73}:\\
\;\;\;\;-U\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if J < -1.05000000000000006e-208 or 4.69999999999999994e-73 < J Initial program 83.6%
metadata-eval83.6%
associate-*r*83.6%
pow283.6%
hypot-udef97.0%
*-un-lft-identity97.0%
times-frac97.0%
metadata-eval97.0%
*-commutative97.0%
associate-/r*97.0%
div-inv97.0%
metadata-eval97.0%
Applied egg-rr97.0%
Taylor expanded in K around 0 85.0%
if -1.05000000000000006e-208 < J < -9.999999999999969e-311Initial program 26.4%
Taylor expanded in K around 0 3.7%
*-commutative3.7%
unpow23.7%
unpow23.7%
Simplified3.7%
Taylor expanded in U around -inf 25.0%
Taylor expanded in J around 0 46.6%
+-commutative46.6%
mul-1-neg46.6%
unsub-neg46.6%
*-commutative46.6%
unpow246.6%
associate-*r/46.6%
Simplified46.6%
if -9.999999999999969e-311 < J < 9.0000000000000007e-155 or 9.5000000000000005e-108 < J < 4.69999999999999994e-73Initial program 33.2%
Taylor expanded in J around 0 32.7%
neg-mul-132.7%
Simplified32.7%
if 9.0000000000000007e-155 < J < 9.5000000000000005e-108Initial program 78.7%
associate-*l*78.7%
associate-*l*78.7%
unpow278.7%
sqr-neg78.7%
distribute-frac-neg78.7%
distribute-frac-neg78.7%
unpow278.7%
Simplified86.0%
Taylor expanded in K around 0 75.1%
associate-*r/75.1%
*-commutative75.1%
associate-*r/75.1%
Simplified75.1%
Final simplification70.2%
NOTE: U should be positive before calling this function (FPCore (J K U) :precision binary64 (if (<= (cos (/ K 2.0)) 0.7) (* J (* -2.0 (cos (* K 0.5)))) (* -2.0 (* J (hypot 1.0 (/ (* U 0.5) J))))))
U = abs(U);
double code(double J, double K, double U) {
double tmp;
if (cos((K / 2.0)) <= 0.7) {
tmp = J * (-2.0 * cos((K * 0.5)));
} 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 tmp;
if (Math.cos((K / 2.0)) <= 0.7) {
tmp = J * (-2.0 * Math.cos((K * 0.5)));
} else {
tmp = -2.0 * (J * Math.hypot(1.0, ((U * 0.5) / J)));
}
return tmp;
}
U = abs(U) def code(J, K, U): tmp = 0 if math.cos((K / 2.0)) <= 0.7: tmp = J * (-2.0 * math.cos((K * 0.5))) else: tmp = -2.0 * (J * math.hypot(1.0, ((U * 0.5) / J))) return tmp
U = abs(U) function code(J, K, U) tmp = 0.0 if (cos(Float64(K / 2.0)) <= 0.7) tmp = Float64(J * Float64(-2.0 * cos(Float64(K * 0.5)))); 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) tmp = 0.0; if (cos((K / 2.0)) <= 0.7) tmp = J * (-2.0 * cos((K * 0.5))); 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_] := If[LessEqual[N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision], 0.7], N[(J * N[(-2.0 * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $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}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq 0.7:\\
\;\;\;\;J \cdot \left(-2 \cdot \cos \left(K \cdot 0.5\right)\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.69999999999999996Initial program 70.3%
Taylor expanded in J around inf 53.0%
associate-*r*53.0%
metadata-eval53.0%
*-commutative53.0%
distribute-lft-neg-in53.0%
distribute-lft-neg-in53.0%
*-commutative53.0%
distribute-rgt-neg-in53.0%
distribute-lft-neg-in53.0%
metadata-eval53.0%
*-commutative53.0%
Simplified53.0%
if 0.69999999999999996 < (cos.f64 (/.f64 K 2)) Initial program 66.5%
Taylor expanded in K around 0 41.6%
*-commutative41.6%
unpow241.6%
unpow241.6%
Simplified41.6%
expm1-log1p-u41.2%
expm1-udef41.2%
add-sqr-sqrt41.2%
hypot-1-def41.2%
*-commutative41.2%
sqrt-prod41.2%
times-frac58.4%
sqrt-prod40.7%
add-sqr-sqrt74.8%
metadata-eval74.8%
Applied egg-rr74.8%
expm1-def74.8%
expm1-log1p78.2%
associate-*l/78.2%
Simplified78.2%
Final simplification69.0%
NOTE: U should be positive before calling this function
(FPCore (J K U)
:precision binary64
(let* ((t_0 (* J (* -2.0 (cos (* K 0.5))))))
(if (<= J -4.5e-58)
t_0
(if (<= J -1e-310)
(* -2.0 (- (* U -0.5) (* J (/ J U))))
(if (<= J 7e+93) (- U) t_0)))))U = abs(U);
double code(double J, double K, double U) {
double t_0 = J * (-2.0 * cos((K * 0.5)));
double tmp;
if (J <= -4.5e-58) {
tmp = t_0;
} else if (J <= -1e-310) {
tmp = -2.0 * ((U * -0.5) - (J * (J / U)));
} else if (J <= 7e+93) {
tmp = -U;
} 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 = j * ((-2.0d0) * cos((k * 0.5d0)))
if (j <= (-4.5d-58)) then
tmp = t_0
else if (j <= (-1d-310)) then
tmp = (-2.0d0) * ((u * (-0.5d0)) - (j * (j / u)))
else if (j <= 7d+93) then
tmp = -u
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 = J * (-2.0 * Math.cos((K * 0.5)));
double tmp;
if (J <= -4.5e-58) {
tmp = t_0;
} else if (J <= -1e-310) {
tmp = -2.0 * ((U * -0.5) - (J * (J / U)));
} else if (J <= 7e+93) {
tmp = -U;
} else {
tmp = t_0;
}
return tmp;
}
U = abs(U) def code(J, K, U): t_0 = J * (-2.0 * math.cos((K * 0.5))) tmp = 0 if J <= -4.5e-58: tmp = t_0 elif J <= -1e-310: tmp = -2.0 * ((U * -0.5) - (J * (J / U))) elif J <= 7e+93: tmp = -U else: tmp = t_0 return tmp
U = abs(U) function code(J, K, U) t_0 = Float64(J * Float64(-2.0 * cos(Float64(K * 0.5)))) tmp = 0.0 if (J <= -4.5e-58) tmp = t_0; elseif (J <= -1e-310) tmp = Float64(-2.0 * Float64(Float64(U * -0.5) - Float64(J * Float64(J / U)))); elseif (J <= 7e+93) tmp = Float64(-U); else tmp = t_0; end return tmp end
U = abs(U) function tmp_2 = code(J, K, U) t_0 = J * (-2.0 * cos((K * 0.5))); tmp = 0.0; if (J <= -4.5e-58) tmp = t_0; elseif (J <= -1e-310) tmp = -2.0 * ((U * -0.5) - (J * (J / U))); elseif (J <= 7e+93) tmp = -U; 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[(J * N[(-2.0 * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[J, -4.5e-58], t$95$0, If[LessEqual[J, -1e-310], N[(-2.0 * N[(N[(U * -0.5), $MachinePrecision] - N[(J * N[(J / U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[J, 7e+93], (-U), t$95$0]]]]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
t_0 := J \cdot \left(-2 \cdot \cos \left(K \cdot 0.5\right)\right)\\
\mathbf{if}\;J \leq -4.5 \cdot 10^{-58}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;J \leq -1 \cdot 10^{-310}:\\
\;\;\;\;-2 \cdot \left(U \cdot -0.5 - J \cdot \frac{J}{U}\right)\\
\mathbf{elif}\;J \leq 7 \cdot 10^{+93}:\\
\;\;\;\;-U\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if J < -4.5000000000000003e-58 or 6.99999999999999996e93 < J Initial program 95.0%
Taylor expanded in J around inf 78.6%
associate-*r*78.6%
metadata-eval78.6%
*-commutative78.6%
distribute-lft-neg-in78.6%
distribute-lft-neg-in78.6%
*-commutative78.6%
distribute-rgt-neg-in78.6%
distribute-lft-neg-in78.6%
metadata-eval78.6%
*-commutative78.6%
Simplified78.6%
if -4.5000000000000003e-58 < J < -9.999999999999969e-311Initial program 42.3%
Taylor expanded in K around 0 17.5%
*-commutative17.5%
unpow217.5%
unpow217.5%
Simplified17.5%
Taylor expanded in U around -inf 30.4%
Taylor expanded in J around 0 46.0%
+-commutative46.0%
mul-1-neg46.0%
unsub-neg46.0%
*-commutative46.0%
unpow246.0%
associate-*r/45.9%
Simplified45.9%
if -9.999999999999969e-311 < J < 6.99999999999999996e93Initial program 47.7%
Taylor expanded in J around 0 34.8%
neg-mul-134.8%
Simplified34.8%
Final simplification56.2%
NOTE: U should be positive before calling this function
(FPCore (J K U)
:precision binary64
(if (<= J -2.5e-54)
(* -2.0 J)
(if (<= J -1e-310)
(* -2.0 (- (* U -0.5) (* J (/ J U))))
(if (<= J 1.7e+108) (- U) (* -2.0 J)))))U = abs(U);
double code(double J, double K, double U) {
double tmp;
if (J <= -2.5e-54) {
tmp = -2.0 * J;
} else if (J <= -1e-310) {
tmp = -2.0 * ((U * -0.5) - (J * (J / U)));
} else if (J <= 1.7e+108) {
tmp = -U;
} 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 <= (-2.5d-54)) then
tmp = (-2.0d0) * j
else if (j <= (-1d-310)) then
tmp = (-2.0d0) * ((u * (-0.5d0)) - (j * (j / u)))
else if (j <= 1.7d+108) then
tmp = -u
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 <= -2.5e-54) {
tmp = -2.0 * J;
} else if (J <= -1e-310) {
tmp = -2.0 * ((U * -0.5) - (J * (J / U)));
} else if (J <= 1.7e+108) {
tmp = -U;
} else {
tmp = -2.0 * J;
}
return tmp;
}
U = abs(U) def code(J, K, U): tmp = 0 if J <= -2.5e-54: tmp = -2.0 * J elif J <= -1e-310: tmp = -2.0 * ((U * -0.5) - (J * (J / U))) elif J <= 1.7e+108: tmp = -U else: tmp = -2.0 * J return tmp
U = abs(U) function code(J, K, U) tmp = 0.0 if (J <= -2.5e-54) tmp = Float64(-2.0 * J); elseif (J <= -1e-310) tmp = Float64(-2.0 * Float64(Float64(U * -0.5) - Float64(J * Float64(J / U)))); elseif (J <= 1.7e+108) tmp = Float64(-U); 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 <= -2.5e-54) tmp = -2.0 * J; elseif (J <= -1e-310) tmp = -2.0 * ((U * -0.5) - (J * (J / U))); elseif (J <= 1.7e+108) tmp = -U; 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, -2.5e-54], N[(-2.0 * J), $MachinePrecision], If[LessEqual[J, -1e-310], N[(-2.0 * N[(N[(U * -0.5), $MachinePrecision] - N[(J * N[(J / U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[J, 1.7e+108], (-U), N[(-2.0 * J), $MachinePrecision]]]]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
\mathbf{if}\;J \leq -2.5 \cdot 10^{-54}:\\
\;\;\;\;-2 \cdot J\\
\mathbf{elif}\;J \leq -1 \cdot 10^{-310}:\\
\;\;\;\;-2 \cdot \left(U \cdot -0.5 - J \cdot \frac{J}{U}\right)\\
\mathbf{elif}\;J \leq 1.7 \cdot 10^{+108}:\\
\;\;\;\;-U\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot J\\
\end{array}
\end{array}
if J < -2.50000000000000008e-54 or 1.69999999999999998e108 < J Initial program 94.9%
Taylor expanded in K around 0 40.9%
*-commutative40.9%
unpow240.9%
unpow240.9%
Simplified40.9%
Taylor expanded in J around inf 42.1%
if -2.50000000000000008e-54 < J < -9.999999999999969e-311Initial program 42.3%
Taylor expanded in K around 0 17.5%
*-commutative17.5%
unpow217.5%
unpow217.5%
Simplified17.5%
Taylor expanded in U around -inf 30.4%
Taylor expanded in J around 0 46.0%
+-commutative46.0%
mul-1-neg46.0%
unsub-neg46.0%
*-commutative46.0%
unpow246.0%
associate-*r/45.9%
Simplified45.9%
if -9.999999999999969e-311 < J < 1.69999999999999998e108Initial program 48.7%
Taylor expanded in J around 0 34.2%
neg-mul-134.2%
Simplified34.2%
Final simplification39.6%
NOTE: U should be positive before calling this function (FPCore (J K U) :precision binary64 (if (<= J -2.4e-54) (* -2.0 J) (if (<= J -1e-310) U (if (<= J 6.8e+108) (- U) (* -2.0 J)))))
U = abs(U);
double code(double J, double K, double U) {
double tmp;
if (J <= -2.4e-54) {
tmp = -2.0 * J;
} else if (J <= -1e-310) {
tmp = U;
} else if (J <= 6.8e+108) {
tmp = -U;
} 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 <= (-2.4d-54)) then
tmp = (-2.0d0) * j
else if (j <= (-1d-310)) then
tmp = u
else if (j <= 6.8d+108) then
tmp = -u
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 <= -2.4e-54) {
tmp = -2.0 * J;
} else if (J <= -1e-310) {
tmp = U;
} else if (J <= 6.8e+108) {
tmp = -U;
} else {
tmp = -2.0 * J;
}
return tmp;
}
U = abs(U) def code(J, K, U): tmp = 0 if J <= -2.4e-54: tmp = -2.0 * J elif J <= -1e-310: tmp = U elif J <= 6.8e+108: tmp = -U else: tmp = -2.0 * J return tmp
U = abs(U) function code(J, K, U) tmp = 0.0 if (J <= -2.4e-54) tmp = Float64(-2.0 * J); elseif (J <= -1e-310) tmp = U; elseif (J <= 6.8e+108) tmp = Float64(-U); 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 <= -2.4e-54) tmp = -2.0 * J; elseif (J <= -1e-310) tmp = U; elseif (J <= 6.8e+108) tmp = -U; 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, -2.4e-54], N[(-2.0 * J), $MachinePrecision], If[LessEqual[J, -1e-310], U, If[LessEqual[J, 6.8e+108], (-U), N[(-2.0 * J), $MachinePrecision]]]]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
\mathbf{if}\;J \leq -2.4 \cdot 10^{-54}:\\
\;\;\;\;-2 \cdot J\\
\mathbf{elif}\;J \leq -1 \cdot 10^{-310}:\\
\;\;\;\;U\\
\mathbf{elif}\;J \leq 6.8 \cdot 10^{+108}:\\
\;\;\;\;-U\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot J\\
\end{array}
\end{array}
if J < -2.40000000000000013e-54 or 6.79999999999999992e108 < J Initial program 94.9%
Taylor expanded in K around 0 40.9%
*-commutative40.9%
unpow240.9%
unpow240.9%
Simplified40.9%
Taylor expanded in J around inf 42.1%
if -2.40000000000000013e-54 < J < -9.999999999999969e-311Initial program 42.3%
Taylor expanded in U around -inf 46.0%
if -9.999999999999969e-311 < J < 6.79999999999999992e108Initial program 48.7%
Taylor expanded in J around 0 34.2%
neg-mul-134.2%
Simplified34.2%
Final simplification39.6%
NOTE: U should be positive before calling this function (FPCore (J K U) :precision binary64 (if (<= J -1e-310) U (- U)))
U = abs(U);
double code(double J, double K, double U) {
double tmp;
if (J <= -1e-310) {
tmp = U;
} else {
tmp = -U;
}
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 <= (-1d-310)) then
tmp = u
else
tmp = -u
end if
code = tmp
end function
U = Math.abs(U);
public static double code(double J, double K, double U) {
double tmp;
if (J <= -1e-310) {
tmp = U;
} else {
tmp = -U;
}
return tmp;
}
U = abs(U) def code(J, K, U): tmp = 0 if J <= -1e-310: tmp = U else: tmp = -U return tmp
U = abs(U) function code(J, K, U) tmp = 0.0 if (J <= -1e-310) tmp = U; else tmp = Float64(-U); end return tmp end
U = abs(U) function tmp_2 = code(J, K, U) tmp = 0.0; if (J <= -1e-310) tmp = U; else tmp = -U; end tmp_2 = tmp; end
NOTE: U should be positive before calling this function code[J_, K_, U_] := If[LessEqual[J, -1e-310], U, (-U)]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
\mathbf{if}\;J \leq -1 \cdot 10^{-310}:\\
\;\;\;\;U\\
\mathbf{else}:\\
\;\;\;\;-U\\
\end{array}
\end{array}
if J < -9.999999999999969e-311Initial program 75.1%
Taylor expanded in U around -inf 25.6%
if -9.999999999999969e-311 < J Initial program 61.5%
Taylor expanded in J around 0 27.3%
neg-mul-127.3%
Simplified27.3%
Final simplification26.5%
NOTE: U should be positive before calling this function (FPCore (J K U) :precision binary64 U)
U = abs(U);
double code(double J, double K, double U) {
return U;
}
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 = u
end function
U = Math.abs(U);
public static double code(double J, double K, double U) {
return U;
}
U = abs(U) def code(J, K, U): return U
U = abs(U) function code(J, K, U) return U end
U = abs(U) function tmp = code(J, K, U) tmp = U; end
NOTE: U should be positive before calling this function code[J_, K_, U_] := U
\begin{array}{l}
U = |U|\\
\\
U
\end{array}
Initial program 67.8%
Taylor expanded in U around -inf 31.1%
Final simplification31.1%
herbie shell --seed 2023274
(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)))))