
(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 12 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))))))
(if (<= t_1 (- INFINITY))
(* -2.0 (* U 0.5))
(if (<= t_1 1e+300) 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 = ((-2.0 * J) * t_0) * sqrt((1.0 + pow((U / (t_0 * (J * 2.0))), 2.0)));
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = -2.0 * (U * 0.5);
} else if (t_1 <= 1e+300) {
tmp = 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 = ((-2.0 * J) * t_0) * Math.sqrt((1.0 + Math.pow((U / (t_0 * (J * 2.0))), 2.0)));
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = -2.0 * (U * 0.5);
} else if (t_1 <= 1e+300) {
tmp = 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 = ((-2.0 * J) * t_0) * math.sqrt((1.0 + math.pow((U / (t_0 * (J * 2.0))), 2.0))) tmp = 0 if t_1 <= -math.inf: tmp = -2.0 * (U * 0.5) elif t_1 <= 1e+300: tmp = 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(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_1 <= Float64(-Inf)) tmp = Float64(-2.0 * Float64(U * 0.5)); elseif (t_1 <= 1e+300) tmp = 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 = ((-2.0 * J) * t_0) * sqrt((1.0 + ((U / (t_0 * (J * 2.0))) ^ 2.0))); tmp = 0.0; if (t_1 <= -Inf) tmp = -2.0 * (U * 0.5); elseif (t_1 <= 1e+300) tmp = 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[(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$1, (-Infinity)], N[(-2.0 * N[(U * 0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+300], t$95$1, 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 := \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_1 \leq -\infty:\\
\;\;\;\;-2 \cdot \left(U \cdot 0.5\right)\\
\mathbf{elif}\;t_1 \leq 10^{+300}:\\
\;\;\;\;t_1\\
\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.2%
Simplified44.5%
Taylor expanded in J around 0 36.1%
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)))) < 1.0000000000000001e300Initial program 99.8%
if 1.0000000000000001e300 < (*.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.0%
Simplified68.5%
Taylor expanded in U around -inf 53.2%
*-commutative53.2%
Simplified53.2%
Final simplification82.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-106)
t_0
(if (<= J -2e-310)
(* -2.0 (- (* U -0.5) (/ (* J J) U)))
(if (<= J 1.2e-94)
(* -2.0 (fma 0.5 U (/ (pow (* J (cos (* K 0.5))) 2.0) 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-106) {
tmp = t_0;
} else if (J <= -2e-310) {
tmp = -2.0 * ((U * -0.5) - ((J * J) / U));
} else if (J <= 1.2e-94) {
tmp = -2.0 * fma(0.5, U, (pow((J * cos((K * 0.5))), 2.0) / U));
} else {
tmp = t_0;
}
return tmp;
}
U = abs(U) function code(J, K, U) t_0 = Float64(-2.0 * Float64(J * Float64(cos(Float64(K / 2.0)) * hypot(1.0, Float64(U * Float64(0.5 / J)))))) tmp = 0.0 if (J <= -9e-106) tmp = t_0; elseif (J <= -2e-310) tmp = Float64(-2.0 * Float64(Float64(U * -0.5) - Float64(Float64(J * J) / U))); elseif (J <= 1.2e-94) tmp = Float64(-2.0 * fma(0.5, U, Float64((Float64(J * cos(Float64(K * 0.5))) ^ 2.0) / U))); else tmp = t_0; end return 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[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[Sqrt[1.0 ^ 2 + N[(U * N[(0.5 / J), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[J, -9e-106], t$95$0, If[LessEqual[J, -2e-310], N[(-2.0 * N[(N[(U * -0.5), $MachinePrecision] - N[(N[(J * J), $MachinePrecision] / U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[J, 1.2e-94], N[(-2.0 * N[(0.5 * U + N[(N[Power[N[(J * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
t_0 := -2 \cdot \left(J \cdot \left(\cos \left(\frac{K}{2}\right) \cdot \mathsf{hypot}\left(1, U \cdot \frac{0.5}{J}\right)\right)\right)\\
\mathbf{if}\;J \leq -9 \cdot 10^{-106}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;J \leq -2 \cdot 10^{-310}:\\
\;\;\;\;-2 \cdot \left(U \cdot -0.5 - \frac{J \cdot J}{U}\right)\\
\mathbf{elif}\;J \leq 1.2 \cdot 10^{-94}:\\
\;\;\;\;-2 \cdot \mathsf{fma}\left(0.5, U, \frac{{\left(J \cdot \cos \left(K \cdot 0.5\right)\right)}^{2}}{U}\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if J < -8.99999999999999911e-106 or 1.2e-94 < J Initial program 87.6%
Simplified98.1%
Taylor expanded in K around 0 85.1%
associate-*r/85.1%
*-commutative85.1%
associate-*r/85.1%
Simplified85.1%
if -8.99999999999999911e-106 < J < -1.999999999999994e-310Initial program 42.4%
Simplified68.3%
Taylor expanded in K around 0 12.3%
unpow212.3%
unpow212.3%
Simplified12.3%
Taylor expanded in U around -inf 51.6%
+-commutative51.6%
mul-1-neg51.6%
unsub-neg51.6%
*-commutative51.6%
unpow251.6%
Simplified51.6%
if -1.999999999999994e-310 < J < 1.2e-94Initial program 41.5%
Simplified59.9%
Taylor expanded in J around 0 46.2%
fma-def46.2%
unpow246.2%
*-commutative46.2%
unpow246.2%
swap-sqr46.2%
unpow246.2%
*-commutative46.2%
Simplified46.2%
Final simplification72.4%
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 71.5%
Simplified86.3%
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)))) (* -2.0 (* t_0 (* J (hypot 1.0 (* 0.5 (/ U (* J t_0)))))))))
U = abs(U);
double code(double J, double K, double U) {
double t_0 = cos((K / 2.0));
return -2.0 * (t_0 * (J * hypot(1.0, (0.5 * (U / (J * 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 * (t_0 * (J * Math.hypot(1.0, (0.5 * (U / (J * t_0))))));
}
U = abs(U) def code(J, K, U): t_0 = math.cos((K / 2.0)) return -2.0 * (t_0 * (J * math.hypot(1.0, (0.5 * (U / (J * t_0))))))
U = abs(U) function code(J, K, U) t_0 = cos(Float64(K / 2.0)) return Float64(-2.0 * Float64(t_0 * Float64(J * hypot(1.0, Float64(0.5 * Float64(U / Float64(J * t_0))))))) end
U = abs(U) function tmp = code(J, K, U) t_0 = cos((K / 2.0)); tmp = -2.0 * (t_0 * (J * hypot(1.0, (0.5 * (U / (J * 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[(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]]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
-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)
\end{array}
\end{array}
Initial program 71.5%
associate-*l*71.5%
associate-*l*71.5%
*-commutative71.5%
unpow271.5%
sqr-neg71.5%
distribute-frac-neg71.5%
distribute-frac-neg71.5%
unpow271.5%
Simplified86.3%
Final simplification86.3%
NOTE: U should be positive before calling this function (FPCore (J K U) :precision binary64 (let* ((t_0 (* J (cos (/ K 2.0))))) (* -2.0 (* t_0 (hypot 1.0 (/ U (* 2.0 t_0)))))))
U = abs(U);
double code(double J, double K, double U) {
double t_0 = J * cos((K / 2.0));
return -2.0 * (t_0 * hypot(1.0, (U / (2.0 * t_0))));
}
U = Math.abs(U);
public static double code(double J, double K, double U) {
double t_0 = J * Math.cos((K / 2.0));
return -2.0 * (t_0 * Math.hypot(1.0, (U / (2.0 * t_0))));
}
U = abs(U) def code(J, K, U): t_0 = J * math.cos((K / 2.0)) return -2.0 * (t_0 * math.hypot(1.0, (U / (2.0 * t_0))))
U = abs(U) function code(J, K, U) t_0 = Float64(J * cos(Float64(K / 2.0))) return Float64(-2.0 * Float64(t_0 * hypot(1.0, Float64(U / Float64(2.0 * t_0))))) end
U = abs(U) function tmp = code(J, K, U) t_0 = J * cos((K / 2.0)); tmp = -2.0 * (t_0 * hypot(1.0, (U / (2.0 * t_0)))); end
NOTE: U should be positive before calling this function
code[J_, K_, U_] := Block[{t$95$0 = N[(J * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, N[(-2.0 * N[(t$95$0 * N[Sqrt[1.0 ^ 2 + N[(U / N[(2.0 * t$95$0), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
t_0 := J \cdot \cos \left(\frac{K}{2}\right)\\
-2 \cdot \left(t_0 \cdot \mathsf{hypot}\left(1, \frac{U}{2 \cdot t_0}\right)\right)
\end{array}
\end{array}
Initial program 71.5%
associate-*l*71.5%
associate-*l*71.5%
unpow271.5%
sqr-neg71.5%
distribute-frac-neg71.5%
distribute-frac-neg71.5%
unpow271.5%
Simplified86.4%
Final simplification86.4%
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 -6.5e-104)
t_0
(if (<= J -2e-310)
(* -2.0 (- (* U -0.5) (/ (* J J) U)))
(if (<= J 2.6e-97) (* -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)) * hypot(1.0, (U * (0.5 / J)))));
double tmp;
if (J <= -6.5e-104) {
tmp = t_0;
} else if (J <= -2e-310) {
tmp = -2.0 * ((U * -0.5) - ((J * J) / U));
} else if (J <= 2.6e-97) {
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 * (J * (Math.cos((K / 2.0)) * Math.hypot(1.0, (U * (0.5 / J)))));
double tmp;
if (J <= -6.5e-104) {
tmp = t_0;
} else if (J <= -2e-310) {
tmp = -2.0 * ((U * -0.5) - ((J * J) / U));
} else if (J <= 2.6e-97) {
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)) * math.hypot(1.0, (U * (0.5 / J))))) tmp = 0 if J <= -6.5e-104: tmp = t_0 elif J <= -2e-310: tmp = -2.0 * ((U * -0.5) - ((J * J) / U)) elif J <= 2.6e-97: 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(cos(Float64(K / 2.0)) * hypot(1.0, Float64(U * Float64(0.5 / J)))))) tmp = 0.0 if (J <= -6.5e-104) tmp = t_0; elseif (J <= -2e-310) tmp = Float64(-2.0 * Float64(Float64(U * -0.5) - Float64(Float64(J * J) / U))); elseif (J <= 2.6e-97) 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)) * hypot(1.0, (U * (0.5 / J))))); tmp = 0.0; if (J <= -6.5e-104) tmp = t_0; elseif (J <= -2e-310) tmp = -2.0 * ((U * -0.5) - ((J * J) / U)); elseif (J <= 2.6e-97) 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[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[Sqrt[1.0 ^ 2 + N[(U * N[(0.5 / J), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[J, -6.5e-104], t$95$0, If[LessEqual[J, -2e-310], N[(-2.0 * N[(N[(U * -0.5), $MachinePrecision] - N[(N[(J * J), $MachinePrecision] / U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[J, 2.6e-97], 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 \left(\cos \left(\frac{K}{2}\right) \cdot \mathsf{hypot}\left(1, U \cdot \frac{0.5}{J}\right)\right)\right)\\
\mathbf{if}\;J \leq -6.5 \cdot 10^{-104}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;J \leq -2 \cdot 10^{-310}:\\
\;\;\;\;-2 \cdot \left(U \cdot -0.5 - \frac{J \cdot J}{U}\right)\\
\mathbf{elif}\;J \leq 2.6 \cdot 10^{-97}:\\
\;\;\;\;-2 \cdot \left(U \cdot 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if J < -6.49999999999999991e-104 or 2.60000000000000007e-97 < J Initial program 87.6%
Simplified98.1%
Taylor expanded in K around 0 85.1%
associate-*r/85.1%
*-commutative85.1%
associate-*r/85.1%
Simplified85.1%
if -6.49999999999999991e-104 < J < -1.999999999999994e-310Initial program 42.4%
Simplified68.3%
Taylor expanded in K around 0 12.3%
unpow212.3%
unpow212.3%
Simplified12.3%
Taylor expanded in U around -inf 51.6%
+-commutative51.6%
mul-1-neg51.6%
unsub-neg51.6%
*-commutative51.6%
unpow251.6%
Simplified51.6%
if -1.999999999999994e-310 < J < 2.60000000000000007e-97Initial program 41.5%
Simplified59.9%
Taylor expanded in J around 0 46.3%
Final simplification72.5%
NOTE: U should be positive before calling this function
(FPCore (J K U)
:precision binary64
(if (<= (/ K 2.0) 5e+27)
(* -2.0 (* J (hypot 1.0 (/ (* U 0.5) J))))
(if (or (<= (/ K 2.0) 5e+222) (not (<= (/ K 2.0) 5e+241)))
(* -2.0 (* J (cos (/ K 2.0))))
(* -2.0 (- (* U -0.5) (/ (* J J) U))))))U = abs(U);
double code(double J, double K, double U) {
double tmp;
if ((K / 2.0) <= 5e+27) {
tmp = -2.0 * (J * hypot(1.0, ((U * 0.5) / J)));
} else if (((K / 2.0) <= 5e+222) || !((K / 2.0) <= 5e+241)) {
tmp = -2.0 * (J * cos((K / 2.0)));
} else {
tmp = -2.0 * ((U * -0.5) - ((J * J) / U));
}
return tmp;
}
U = Math.abs(U);
public static double code(double J, double K, double U) {
double tmp;
if ((K / 2.0) <= 5e+27) {
tmp = -2.0 * (J * Math.hypot(1.0, ((U * 0.5) / J)));
} else if (((K / 2.0) <= 5e+222) || !((K / 2.0) <= 5e+241)) {
tmp = -2.0 * (J * Math.cos((K / 2.0)));
} else {
tmp = -2.0 * ((U * -0.5) - ((J * J) / U));
}
return tmp;
}
U = abs(U) def code(J, K, U): tmp = 0 if (K / 2.0) <= 5e+27: tmp = -2.0 * (J * math.hypot(1.0, ((U * 0.5) / J))) elif ((K / 2.0) <= 5e+222) or not ((K / 2.0) <= 5e+241): tmp = -2.0 * (J * math.cos((K / 2.0))) else: tmp = -2.0 * ((U * -0.5) - ((J * J) / U)) return tmp
U = abs(U) function code(J, K, U) tmp = 0.0 if (Float64(K / 2.0) <= 5e+27) tmp = Float64(-2.0 * Float64(J * hypot(1.0, Float64(Float64(U * 0.5) / J)))); elseif ((Float64(K / 2.0) <= 5e+222) || !(Float64(K / 2.0) <= 5e+241)) tmp = Float64(-2.0 * Float64(J * cos(Float64(K / 2.0)))); else tmp = Float64(-2.0 * Float64(Float64(U * -0.5) - Float64(Float64(J * J) / U))); end return tmp end
U = abs(U) function tmp_2 = code(J, K, U) tmp = 0.0; if ((K / 2.0) <= 5e+27) tmp = -2.0 * (J * hypot(1.0, ((U * 0.5) / J))); elseif (((K / 2.0) <= 5e+222) || ~(((K / 2.0) <= 5e+241))) tmp = -2.0 * (J * cos((K / 2.0))); else tmp = -2.0 * ((U * -0.5) - ((J * J) / U)); end tmp_2 = tmp; end
NOTE: U should be positive before calling this function code[J_, K_, U_] := If[LessEqual[N[(K / 2.0), $MachinePrecision], 5e+27], N[(-2.0 * N[(J * N[Sqrt[1.0 ^ 2 + N[(N[(U * 0.5), $MachinePrecision] / J), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[N[(K / 2.0), $MachinePrecision], 5e+222], N[Not[LessEqual[N[(K / 2.0), $MachinePrecision], 5e+241]], $MachinePrecision]], N[(-2.0 * N[(J * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-2.0 * N[(N[(U * -0.5), $MachinePrecision] - N[(N[(J * J), $MachinePrecision] / U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
\mathbf{if}\;\frac{K}{2} \leq 5 \cdot 10^{+27}:\\
\;\;\;\;-2 \cdot \left(J \cdot \mathsf{hypot}\left(1, \frac{U \cdot 0.5}{J}\right)\right)\\
\mathbf{elif}\;\frac{K}{2} \leq 5 \cdot 10^{+222} \lor \neg \left(\frac{K}{2} \leq 5 \cdot 10^{+241}\right):\\
\;\;\;\;-2 \cdot \left(J \cdot \cos \left(\frac{K}{2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \left(U \cdot -0.5 - \frac{J \cdot J}{U}\right)\\
\end{array}
\end{array}
if (/.f64 K 2) < 4.99999999999999979e27Initial program 73.1%
Simplified86.8%
add-cube-cbrt85.8%
pow385.8%
Applied egg-rr85.9%
Taylor expanded in K around 0 40.5%
metadata-eval40.5%
unpow240.5%
unpow240.5%
times-frac51.9%
swap-sqr52.4%
unpow252.4%
associate-*r/52.4%
*-commutative52.4%
*-commutative52.4%
associate-*r/52.4%
unpow252.4%
hypot-1-def64.7%
associate-*r/64.7%
*-commutative64.7%
Simplified64.7%
if 4.99999999999999979e27 < (/.f64 K 2) < 5.00000000000000023e222 or 5.00000000000000025e241 < (/.f64 K 2) Initial program 67.2%
associate-*l*67.2%
associate-*l*67.2%
*-commutative67.2%
unpow267.2%
sqr-neg67.2%
distribute-frac-neg67.2%
distribute-frac-neg67.2%
unpow267.2%
Simplified85.5%
Taylor expanded in J around inf 42.9%
if 5.00000000000000023e222 < (/.f64 K 2) < 5.00000000000000025e241Initial program 6.3%
Simplified54.6%
Taylor expanded in K around 0 0.3%
unpow20.3%
unpow20.3%
Simplified0.3%
Taylor expanded in U around -inf 50.0%
+-commutative50.0%
mul-1-neg50.0%
unsub-neg50.0%
*-commutative50.0%
unpow250.0%
Simplified50.0%
Final simplification60.7%
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 -4.4e+42)
t_0
(if (<= J -2e-310)
(* -2.0 (- (* U -0.5) (/ (* J J) U)))
(if (<= J 2.25e-38) (* -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 <= -4.4e+42) {
tmp = t_0;
} else if (J <= -2e-310) {
tmp = -2.0 * ((U * -0.5) - ((J * J) / U));
} else if (J <= 2.25e-38) {
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 <= (-4.4d+42)) then
tmp = t_0
else if (j <= (-2d-310)) then
tmp = (-2.0d0) * ((u * (-0.5d0)) - ((j * j) / u))
else if (j <= 2.25d-38) 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 <= -4.4e+42) {
tmp = t_0;
} else if (J <= -2e-310) {
tmp = -2.0 * ((U * -0.5) - ((J * J) / U));
} else if (J <= 2.25e-38) {
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 <= -4.4e+42: tmp = t_0 elif J <= -2e-310: tmp = -2.0 * ((U * -0.5) - ((J * J) / U)) elif J <= 2.25e-38: 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 <= -4.4e+42) tmp = t_0; elseif (J <= -2e-310) tmp = Float64(-2.0 * Float64(Float64(U * -0.5) - Float64(Float64(J * J) / U))); elseif (J <= 2.25e-38) 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 <= -4.4e+42) tmp = t_0; elseif (J <= -2e-310) tmp = -2.0 * ((U * -0.5) - ((J * J) / U)); elseif (J <= 2.25e-38) 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, -4.4e+42], t$95$0, If[LessEqual[J, -2e-310], N[(-2.0 * N[(N[(U * -0.5), $MachinePrecision] - N[(N[(J * J), $MachinePrecision] / U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[J, 2.25e-38], 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 -4.4 \cdot 10^{+42}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;J \leq -2 \cdot 10^{-310}:\\
\;\;\;\;-2 \cdot \left(U \cdot -0.5 - \frac{J \cdot J}{U}\right)\\
\mathbf{elif}\;J \leq 2.25 \cdot 10^{-38}:\\
\;\;\;\;-2 \cdot \left(U \cdot 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if J < -4.4000000000000003e42 or 2.25000000000000004e-38 < J Initial program 94.5%
associate-*l*94.5%
associate-*l*94.5%
*-commutative94.5%
unpow294.5%
sqr-neg94.5%
distribute-frac-neg94.5%
distribute-frac-neg94.5%
unpow294.5%
Simplified99.8%
Taylor expanded in J around inf 76.5%
if -4.4000000000000003e42 < J < -1.999999999999994e-310Initial program 54.2%
Simplified81.1%
Taylor expanded in K around 0 26.0%
unpow226.0%
unpow226.0%
Simplified26.0%
Taylor expanded in U around -inf 44.0%
+-commutative44.0%
mul-1-neg44.0%
unsub-neg44.0%
*-commutative44.0%
unpow244.0%
Simplified44.0%
if -1.999999999999994e-310 < J < 2.25000000000000004e-38Initial program 47.0%
Simplified64.4%
Taylor expanded in J around 0 43.1%
Final simplification59.0%
NOTE: U should be positive before calling this function
(FPCore (J K U)
:precision binary64
(if (<= J -7e+41)
(* -2.0 J)
(if (<= J -2e-310)
(* -2.0 (- (* U -0.5) (/ (* J J) U)))
(if (<= J 1.4e-37) (* -2.0 (* U 0.5)) (* -2.0 J)))))U = abs(U);
double code(double J, double K, double U) {
double tmp;
if (J <= -7e+41) {
tmp = -2.0 * J;
} else if (J <= -2e-310) {
tmp = -2.0 * ((U * -0.5) - ((J * J) / U));
} else if (J <= 1.4e-37) {
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 <= (-7d+41)) then
tmp = (-2.0d0) * j
else if (j <= (-2d-310)) then
tmp = (-2.0d0) * ((u * (-0.5d0)) - ((j * j) / u))
else if (j <= 1.4d-37) 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 <= -7e+41) {
tmp = -2.0 * J;
} else if (J <= -2e-310) {
tmp = -2.0 * ((U * -0.5) - ((J * J) / U));
} else if (J <= 1.4e-37) {
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 <= -7e+41: tmp = -2.0 * J elif J <= -2e-310: tmp = -2.0 * ((U * -0.5) - ((J * J) / U)) elif J <= 1.4e-37: 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 <= -7e+41) tmp = Float64(-2.0 * J); elseif (J <= -2e-310) tmp = Float64(-2.0 * Float64(Float64(U * -0.5) - Float64(Float64(J * J) / U))); elseif (J <= 1.4e-37) 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 <= -7e+41) tmp = -2.0 * J; elseif (J <= -2e-310) tmp = -2.0 * ((U * -0.5) - ((J * J) / U)); elseif (J <= 1.4e-37) 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, -7e+41], N[(-2.0 * J), $MachinePrecision], If[LessEqual[J, -2e-310], N[(-2.0 * N[(N[(U * -0.5), $MachinePrecision] - N[(N[(J * J), $MachinePrecision] / U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[J, 1.4e-37], 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 -7 \cdot 10^{+41}:\\
\;\;\;\;-2 \cdot J\\
\mathbf{elif}\;J \leq -2 \cdot 10^{-310}:\\
\;\;\;\;-2 \cdot \left(U \cdot -0.5 - \frac{J \cdot J}{U}\right)\\
\mathbf{elif}\;J \leq 1.4 \cdot 10^{-37}:\\
\;\;\;\;-2 \cdot \left(U \cdot 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot J\\
\end{array}
\end{array}
if J < -6.9999999999999998e41 or 1.4000000000000001e-37 < J Initial program 94.5%
Simplified99.8%
Taylor expanded in K around 0 47.6%
unpow247.6%
unpow247.6%
Simplified47.6%
Taylor expanded in J around inf 47.0%
if -6.9999999999999998e41 < J < -1.999999999999994e-310Initial program 54.2%
Simplified81.1%
Taylor expanded in K around 0 26.0%
unpow226.0%
unpow226.0%
Simplified26.0%
Taylor expanded in U around -inf 44.0%
+-commutative44.0%
mul-1-neg44.0%
unsub-neg44.0%
*-commutative44.0%
unpow244.0%
Simplified44.0%
if -1.999999999999994e-310 < J < 1.4000000000000001e-37Initial program 47.0%
Simplified64.4%
Taylor expanded in J around 0 43.1%
Final simplification45.2%
NOTE: U should be positive before calling this function
(FPCore (J K U)
:precision binary64
(if (<= J -9.2e+184)
(* -2.0 J)
(if (<= J -2e-310)
(* -2.0 (* U -0.5))
(if (<= J 1.45e-37) (* -2.0 (* U 0.5)) (* -2.0 J)))))U = abs(U);
double code(double J, double K, double U) {
double tmp;
if (J <= -9.2e+184) {
tmp = -2.0 * J;
} else if (J <= -2e-310) {
tmp = -2.0 * (U * -0.5);
} else if (J <= 1.45e-37) {
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 <= (-9.2d+184)) then
tmp = (-2.0d0) * j
else if (j <= (-2d-310)) then
tmp = (-2.0d0) * (u * (-0.5d0))
else if (j <= 1.45d-37) 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 <= -9.2e+184) {
tmp = -2.0 * J;
} else if (J <= -2e-310) {
tmp = -2.0 * (U * -0.5);
} else if (J <= 1.45e-37) {
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 <= -9.2e+184: tmp = -2.0 * J elif J <= -2e-310: tmp = -2.0 * (U * -0.5) elif J <= 1.45e-37: 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 <= -9.2e+184) tmp = Float64(-2.0 * J); elseif (J <= -2e-310) tmp = Float64(-2.0 * Float64(U * -0.5)); elseif (J <= 1.45e-37) 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 <= -9.2e+184) tmp = -2.0 * J; elseif (J <= -2e-310) tmp = -2.0 * (U * -0.5); elseif (J <= 1.45e-37) 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, -9.2e+184], N[(-2.0 * J), $MachinePrecision], If[LessEqual[J, -2e-310], N[(-2.0 * N[(U * -0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[J, 1.45e-37], 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 -9.2 \cdot 10^{+184}:\\
\;\;\;\;-2 \cdot J\\
\mathbf{elif}\;J \leq -2 \cdot 10^{-310}:\\
\;\;\;\;-2 \cdot \left(U \cdot -0.5\right)\\
\mathbf{elif}\;J \leq 1.45 \cdot 10^{-37}:\\
\;\;\;\;-2 \cdot \left(U \cdot 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot J\\
\end{array}
\end{array}
if J < -9.1999999999999999e184 or 1.45000000000000002e-37 < J Initial program 96.1%
Simplified99.8%
Taylor expanded in K around 0 50.2%
unpow250.2%
unpow250.2%
Simplified50.2%
Taylor expanded in J around inf 50.5%
if -9.1999999999999999e184 < J < -1.999999999999994e-310Initial program 61.7%
Simplified85.2%
Taylor expanded in U around -inf 39.4%
*-commutative39.4%
Simplified39.4%
if -1.999999999999994e-310 < J < 1.45000000000000002e-37Initial program 47.0%
Simplified64.4%
Taylor expanded in J around 0 43.1%
Final simplification44.4%
NOTE: U should be positive before calling this function (FPCore (J K U) :precision binary64 (if (<= U 1.6e+25) (* -2.0 J) (* -2.0 (* U 0.5))))
U = abs(U);
double code(double J, double K, double U) {
double tmp;
if (U <= 1.6e+25) {
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.6d+25) 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.6e+25) {
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.6e+25: 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.6e+25) 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.6e+25) 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.6e+25], 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.6 \cdot 10^{+25}:\\
\;\;\;\;-2 \cdot J\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \left(U \cdot 0.5\right)\\
\end{array}
\end{array}
if U < 1.6e25Initial program 76.9%
Simplified90.2%
Taylor expanded in K around 0 40.1%
unpow240.1%
unpow240.1%
Simplified40.1%
Taylor expanded in J around inf 33.6%
if 1.6e25 < U Initial program 49.4%
Simplified69.9%
Taylor expanded in J around 0 41.1%
Final simplification35.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 71.5%
Simplified86.3%
Taylor expanded in K around 0 35.0%
unpow235.0%
unpow235.0%
Simplified35.0%
Taylor expanded in J around inf 28.8%
Final simplification28.8%
herbie shell --seed 2023272
(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)))))