
(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)))))
(t_2 (* J t_0)))
(if (<= t_1 (- INFINITY))
(- U)
(if (<= t_1 5e+294)
(* -2.0 (* t_2 (hypot 1.0 (/ U (* 2.0 t_2)))))
(* -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 t_2 = J * t_0;
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = -U;
} else if (t_1 <= 5e+294) {
tmp = -2.0 * (t_2 * hypot(1.0, (U / (2.0 * t_2))));
} 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 t_2 = J * t_0;
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = -U;
} else if (t_1 <= 5e+294) {
tmp = -2.0 * (t_2 * Math.hypot(1.0, (U / (2.0 * t_2))));
} 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))) t_2 = J * t_0 tmp = 0 if t_1 <= -math.inf: tmp = -U elif t_1 <= 5e+294: tmp = -2.0 * (t_2 * math.hypot(1.0, (U / (2.0 * t_2)))) 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)))) t_2 = Float64(J * t_0) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(-U); elseif (t_1 <= 5e+294) tmp = Float64(-2.0 * Float64(t_2 * hypot(1.0, Float64(U / Float64(2.0 * t_2))))); 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))); t_2 = J * t_0; tmp = 0.0; if (t_1 <= -Inf) tmp = -U; elseif (t_1 <= 5e+294) tmp = -2.0 * (t_2 * hypot(1.0, (U / (2.0 * t_2)))); 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]}, Block[{t$95$2 = N[(J * t$95$0), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], (-U), If[LessEqual[t$95$1, 5e+294], 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], 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}}\\
t_2 := J \cdot t_0\\
\mathbf{if}\;t_1 \leq -\infty:\\
\;\;\;\;-U\\
\mathbf{elif}\;t_1 \leq 5 \cdot 10^{+294}:\\
\;\;\;\;-2 \cdot \left(t_2 \cdot \mathsf{hypot}\left(1, \frac{U}{2 \cdot t_2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \left(U \cdot -0.5\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 (*.f64 -2 J) (cos.f64 (/.f64 K 2))) (sqrt.f64 (+.f64 1 (pow.f64 (/.f64 U (*.f64 (*.f64 2 J) (cos.f64 (/.f64 K 2)))) 2)))) < -inf.0Initial program 6.4%
Simplified52.3%
Taylor expanded in J around 0 56.7%
Taylor expanded in U around 0 56.7%
mul-1-neg56.7%
Simplified56.7%
if -inf.0 < (*.f64 (*.f64 (*.f64 -2 J) (cos.f64 (/.f64 K 2))) (sqrt.f64 (+.f64 1 (pow.f64 (/.f64 U (*.f64 (*.f64 2 J) (cos.f64 (/.f64 K 2)))) 2)))) < 4.9999999999999999e294Initial program 99.8%
associate-*l*99.8%
associate-*l*99.8%
unpow299.8%
sqr-neg99.8%
distribute-frac-neg99.8%
distribute-frac-neg99.8%
unpow299.8%
Simplified99.8%
if 4.9999999999999999e294 < (*.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.6%
Simplified51.3%
Taylor expanded in U around -inf 55.9%
*-commutative55.9%
Simplified55.9%
Final simplification88.6%
NOTE: U should be positive before calling this function
(FPCore (J K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= U 1.4e+293)
(* -2.0 (* J (* t_0 (hypot 1.0 (/ U (* J (* 2.0 t_0)))))))
(- U))))U = abs(U);
double code(double J, double K, double U) {
double t_0 = cos((K / 2.0));
double tmp;
if (U <= 1.4e+293) {
tmp = -2.0 * (J * (t_0 * hypot(1.0, (U / (J * (2.0 * t_0))))));
} 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 (U <= 1.4e+293) {
tmp = -2.0 * (J * (t_0 * Math.hypot(1.0, (U / (J * (2.0 * t_0))))));
} else {
tmp = -U;
}
return tmp;
}
U = abs(U) def code(J, K, U): t_0 = math.cos((K / 2.0)) tmp = 0 if U <= 1.4e+293: tmp = -2.0 * (J * (t_0 * math.hypot(1.0, (U / (J * (2.0 * t_0)))))) else: tmp = -U return tmp
U = abs(U) function code(J, K, U) t_0 = cos(Float64(K / 2.0)) tmp = 0.0 if (U <= 1.4e+293) tmp = Float64(-2.0 * Float64(J * Float64(t_0 * hypot(1.0, Float64(U / Float64(J * Float64(2.0 * t_0))))))); else tmp = Float64(-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 (U <= 1.4e+293) tmp = -2.0 * (J * (t_0 * hypot(1.0, (U / (J * (2.0 * t_0)))))); 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[LessEqual[U, 1.4e+293], 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], (-U)]]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;U \leq 1.4 \cdot 10^{+293}:\\
\;\;\;\;-2 \cdot \left(J \cdot \left(t_0 \cdot \mathsf{hypot}\left(1, \frac{U}{J \cdot \left(2 \cdot t_0\right)}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;-U\\
\end{array}
\end{array}
if U < 1.39999999999999993e293Initial program 77.2%
Simplified88.8%
if 1.39999999999999993e293 < U Initial program 11.4%
Simplified26.1%
Taylor expanded in J around 0 83.3%
Taylor expanded in U around 0 83.3%
mul-1-neg83.3%
Simplified83.3%
Final simplification88.7%
NOTE: U should be positive before calling this function
(FPCore (J K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= U 3.1e+293)
(* -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 (U <= 3.1e+293) {
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 (U <= 3.1e+293) {
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 U <= 3.1e+293: 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 (U <= 3.1e+293) tmp = Float64(-2.0 * Float64(t_0 * Float64(J * hypot(1.0, Float64(Float64(U / Float64(J * t_0)) * 0.5))))); else tmp = Float64(-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 (U <= 3.1e+293) 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[LessEqual[U, 3.1e+293], 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}\;U \leq 3.1 \cdot 10^{+293}:\\
\;\;\;\;-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 U < 3.0999999999999999e293Initial program 77.2%
associate-*l*77.2%
associate-*l*77.2%
*-commutative77.2%
unpow277.2%
sqr-neg77.2%
distribute-frac-neg77.2%
distribute-frac-neg77.2%
unpow277.2%
Simplified88.8%
if 3.0999999999999999e293 < U Initial program 11.4%
Simplified26.1%
Taylor expanded in J around 0 83.3%
Taylor expanded in U around 0 83.3%
mul-1-neg83.3%
Simplified83.3%
Final simplification88.7%
NOTE: U should be positive before calling this function
(FPCore (J K U)
:precision binary64
(let* ((t_0 (* -2.0 (* (cos (/ K 2.0)) (* J (hypot 1.0 (* 0.5 (/ U J))))))))
(if (<= J -3.2e-186)
t_0
(if (<= J 7.6e-297) (* -2.0 (* U -0.5)) (if (<= J 3.5e-57) (- U) t_0)))))U = abs(U);
double code(double J, double K, double U) {
double t_0 = -2.0 * (cos((K / 2.0)) * (J * hypot(1.0, (0.5 * (U / J)))));
double tmp;
if (J <= -3.2e-186) {
tmp = t_0;
} else if (J <= 7.6e-297) {
tmp = -2.0 * (U * -0.5);
} else if (J <= 3.5e-57) {
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 * (Math.cos((K / 2.0)) * (J * Math.hypot(1.0, (0.5 * (U / J)))));
double tmp;
if (J <= -3.2e-186) {
tmp = t_0;
} else if (J <= 7.6e-297) {
tmp = -2.0 * (U * -0.5);
} else if (J <= 3.5e-57) {
tmp = -U;
} else {
tmp = t_0;
}
return tmp;
}
U = abs(U) def code(J, K, U): t_0 = -2.0 * (math.cos((K / 2.0)) * (J * math.hypot(1.0, (0.5 * (U / J))))) tmp = 0 if J <= -3.2e-186: tmp = t_0 elif J <= 7.6e-297: tmp = -2.0 * (U * -0.5) elif J <= 3.5e-57: tmp = -U else: tmp = t_0 return tmp
U = abs(U) function code(J, K, U) t_0 = Float64(-2.0 * Float64(cos(Float64(K / 2.0)) * Float64(J * hypot(1.0, Float64(0.5 * Float64(U / J)))))) tmp = 0.0 if (J <= -3.2e-186) tmp = t_0; elseif (J <= 7.6e-297) tmp = Float64(-2.0 * Float64(U * -0.5)); elseif (J <= 3.5e-57) 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 * (cos((K / 2.0)) * (J * hypot(1.0, (0.5 * (U / J))))); tmp = 0.0; if (J <= -3.2e-186) tmp = t_0; elseif (J <= 7.6e-297) tmp = -2.0 * (U * -0.5); elseif (J <= 3.5e-57) 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[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(J * N[Sqrt[1.0 ^ 2 + N[(0.5 * N[(U / J), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[J, -3.2e-186], t$95$0, If[LessEqual[J, 7.6e-297], N[(-2.0 * N[(U * -0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[J, 3.5e-57], (-U), t$95$0]]]]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
t_0 := -2 \cdot \left(\cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \mathsf{hypot}\left(1, 0.5 \cdot \frac{U}{J}\right)\right)\right)\\
\mathbf{if}\;J \leq -3.2 \cdot 10^{-186}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;J \leq 7.6 \cdot 10^{-297}:\\
\;\;\;\;-2 \cdot \left(U \cdot -0.5\right)\\
\mathbf{elif}\;J \leq 3.5 \cdot 10^{-57}:\\
\;\;\;\;-U\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if J < -3.2e-186 or 3.49999999999999991e-57 < J Initial program 88.4%
associate-*l*88.4%
associate-*l*88.4%
*-commutative88.4%
unpow288.4%
sqr-neg88.4%
distribute-frac-neg88.4%
distribute-frac-neg88.4%
unpow288.4%
Simplified97.2%
Taylor expanded in K around 0 85.1%
if -3.2e-186 < J < 7.6000000000000001e-297Initial program 40.2%
Simplified54.4%
Taylor expanded in U around -inf 60.5%
*-commutative60.5%
Simplified60.5%
if 7.6000000000000001e-297 < J < 3.49999999999999991e-57Initial program 49.0%
Simplified69.9%
Taylor expanded in J around 0 47.2%
Taylor expanded in U around 0 47.2%
mul-1-neg47.2%
Simplified47.2%
Final simplification75.1%
NOTE: U should be positive before calling this function
(FPCore (J K U)
:precision binary64
(if (<= U 1.2e-29)
(* -2.0 (* J (cos (/ K 2.0))))
(if (<= U 8e+205)
(* -2.0 (* J (sqrt (+ 1.0 (* 0.25 (* (/ U J) (/ U J)))))))
(if (<= U 3e+293) (* -2.0 (* U -0.5)) (- U)))))U = abs(U);
double code(double J, double K, double U) {
double tmp;
if (U <= 1.2e-29) {
tmp = -2.0 * (J * cos((K / 2.0)));
} else if (U <= 8e+205) {
tmp = -2.0 * (J * sqrt((1.0 + (0.25 * ((U / J) * (U / J))))));
} else if (U <= 3e+293) {
tmp = -2.0 * (U * -0.5);
} 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 (u <= 1.2d-29) then
tmp = (-2.0d0) * (j * cos((k / 2.0d0)))
else if (u <= 8d+205) then
tmp = (-2.0d0) * (j * sqrt((1.0d0 + (0.25d0 * ((u / j) * (u / j))))))
else if (u <= 3d+293) then
tmp = (-2.0d0) * (u * (-0.5d0))
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 (U <= 1.2e-29) {
tmp = -2.0 * (J * Math.cos((K / 2.0)));
} else if (U <= 8e+205) {
tmp = -2.0 * (J * Math.sqrt((1.0 + (0.25 * ((U / J) * (U / J))))));
} else if (U <= 3e+293) {
tmp = -2.0 * (U * -0.5);
} else {
tmp = -U;
}
return tmp;
}
U = abs(U) def code(J, K, U): tmp = 0 if U <= 1.2e-29: tmp = -2.0 * (J * math.cos((K / 2.0))) elif U <= 8e+205: tmp = -2.0 * (J * math.sqrt((1.0 + (0.25 * ((U / J) * (U / J)))))) elif U <= 3e+293: tmp = -2.0 * (U * -0.5) else: tmp = -U return tmp
U = abs(U) function code(J, K, U) tmp = 0.0 if (U <= 1.2e-29) tmp = Float64(-2.0 * Float64(J * cos(Float64(K / 2.0)))); elseif (U <= 8e+205) tmp = Float64(-2.0 * Float64(J * sqrt(Float64(1.0 + Float64(0.25 * Float64(Float64(U / J) * Float64(U / J))))))); elseif (U <= 3e+293) tmp = Float64(-2.0 * Float64(U * -0.5)); else tmp = Float64(-U); end return tmp end
U = abs(U) function tmp_2 = code(J, K, U) tmp = 0.0; if (U <= 1.2e-29) tmp = -2.0 * (J * cos((K / 2.0))); elseif (U <= 8e+205) tmp = -2.0 * (J * sqrt((1.0 + (0.25 * ((U / J) * (U / J)))))); elseif (U <= 3e+293) tmp = -2.0 * (U * -0.5); else tmp = -U; end tmp_2 = tmp; end
NOTE: U should be positive before calling this function code[J_, K_, U_] := If[LessEqual[U, 1.2e-29], N[(-2.0 * N[(J * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[U, 8e+205], N[(-2.0 * N[(J * N[Sqrt[N[(1.0 + N[(0.25 * N[(N[(U / J), $MachinePrecision] * N[(U / J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[U, 3e+293], N[(-2.0 * N[(U * -0.5), $MachinePrecision]), $MachinePrecision], (-U)]]]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
\mathbf{if}\;U \leq 1.2 \cdot 10^{-29}:\\
\;\;\;\;-2 \cdot \left(J \cdot \cos \left(\frac{K}{2}\right)\right)\\
\mathbf{elif}\;U \leq 8 \cdot 10^{+205}:\\
\;\;\;\;-2 \cdot \left(J \cdot \sqrt{1 + 0.25 \cdot \left(\frac{U}{J} \cdot \frac{U}{J}\right)}\right)\\
\mathbf{elif}\;U \leq 3 \cdot 10^{+293}:\\
\;\;\;\;-2 \cdot \left(U \cdot -0.5\right)\\
\mathbf{else}:\\
\;\;\;\;-U\\
\end{array}
\end{array}
if U < 1.19999999999999996e-29Initial program 83.7%
associate-*l*83.7%
associate-*l*83.7%
*-commutative83.7%
unpow283.7%
sqr-neg83.7%
distribute-frac-neg83.7%
distribute-frac-neg83.7%
unpow283.7%
Simplified91.3%
Taylor expanded in J around inf 64.1%
if 1.19999999999999996e-29 < U < 8.00000000000000013e205Initial program 72.1%
Simplified90.4%
Taylor expanded in K around 0 46.1%
*-commutative46.1%
unpow246.1%
unpow246.1%
Simplified46.1%
times-frac56.9%
Applied egg-rr56.9%
if 8.00000000000000013e205 < U < 3.00000000000000013e293Initial program 36.7%
Simplified65.9%
Taylor expanded in U around -inf 63.7%
*-commutative63.7%
Simplified63.7%
if 3.00000000000000013e293 < U Initial program 11.4%
Simplified26.1%
Taylor expanded in J around 0 83.3%
Taylor expanded in U around 0 83.3%
mul-1-neg83.3%
Simplified83.3%
Final simplification63.0%
NOTE: U should be positive before calling this function
(FPCore (J K U)
:precision binary64
(if (<= U 1.65e-29)
(* -2.0 (* (cos (/ K 2.0)) (+ J (* 0.125 (/ U (/ J U))))))
(if (<= U 1.05e+206)
(* -2.0 (* J (sqrt (+ 1.0 (* 0.25 (* (/ U J) (/ U J)))))))
(if (<= U 2.8e+293) (* -2.0 (* U -0.5)) (- U)))))U = abs(U);
double code(double J, double K, double U) {
double tmp;
if (U <= 1.65e-29) {
tmp = -2.0 * (cos((K / 2.0)) * (J + (0.125 * (U / (J / U)))));
} else if (U <= 1.05e+206) {
tmp = -2.0 * (J * sqrt((1.0 + (0.25 * ((U / J) * (U / J))))));
} else if (U <= 2.8e+293) {
tmp = -2.0 * (U * -0.5);
} 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 (u <= 1.65d-29) then
tmp = (-2.0d0) * (cos((k / 2.0d0)) * (j + (0.125d0 * (u / (j / u)))))
else if (u <= 1.05d+206) then
tmp = (-2.0d0) * (j * sqrt((1.0d0 + (0.25d0 * ((u / j) * (u / j))))))
else if (u <= 2.8d+293) then
tmp = (-2.0d0) * (u * (-0.5d0))
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 (U <= 1.65e-29) {
tmp = -2.0 * (Math.cos((K / 2.0)) * (J + (0.125 * (U / (J / U)))));
} else if (U <= 1.05e+206) {
tmp = -2.0 * (J * Math.sqrt((1.0 + (0.25 * ((U / J) * (U / J))))));
} else if (U <= 2.8e+293) {
tmp = -2.0 * (U * -0.5);
} else {
tmp = -U;
}
return tmp;
}
U = abs(U) def code(J, K, U): tmp = 0 if U <= 1.65e-29: tmp = -2.0 * (math.cos((K / 2.0)) * (J + (0.125 * (U / (J / U))))) elif U <= 1.05e+206: tmp = -2.0 * (J * math.sqrt((1.0 + (0.25 * ((U / J) * (U / J)))))) elif U <= 2.8e+293: tmp = -2.0 * (U * -0.5) else: tmp = -U return tmp
U = abs(U) function code(J, K, U) tmp = 0.0 if (U <= 1.65e-29) tmp = Float64(-2.0 * Float64(cos(Float64(K / 2.0)) * Float64(J + Float64(0.125 * Float64(U / Float64(J / U)))))); elseif (U <= 1.05e+206) tmp = Float64(-2.0 * Float64(J * sqrt(Float64(1.0 + Float64(0.25 * Float64(Float64(U / J) * Float64(U / J))))))); elseif (U <= 2.8e+293) tmp = Float64(-2.0 * Float64(U * -0.5)); else tmp = Float64(-U); end return tmp end
U = abs(U) function tmp_2 = code(J, K, U) tmp = 0.0; if (U <= 1.65e-29) tmp = -2.0 * (cos((K / 2.0)) * (J + (0.125 * (U / (J / U))))); elseif (U <= 1.05e+206) tmp = -2.0 * (J * sqrt((1.0 + (0.25 * ((U / J) * (U / J)))))); elseif (U <= 2.8e+293) tmp = -2.0 * (U * -0.5); else tmp = -U; end tmp_2 = tmp; end
NOTE: U should be positive before calling this function code[J_, K_, U_] := If[LessEqual[U, 1.65e-29], N[(-2.0 * N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[(J + N[(0.125 * N[(U / N[(J / U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[U, 1.05e+206], N[(-2.0 * N[(J * N[Sqrt[N[(1.0 + N[(0.25 * N[(N[(U / J), $MachinePrecision] * N[(U / J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[U, 2.8e+293], N[(-2.0 * N[(U * -0.5), $MachinePrecision]), $MachinePrecision], (-U)]]]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
\mathbf{if}\;U \leq 1.65 \cdot 10^{-29}:\\
\;\;\;\;-2 \cdot \left(\cos \left(\frac{K}{2}\right) \cdot \left(J + 0.125 \cdot \frac{U}{\frac{J}{U}}\right)\right)\\
\mathbf{elif}\;U \leq 1.05 \cdot 10^{+206}:\\
\;\;\;\;-2 \cdot \left(J \cdot \sqrt{1 + 0.25 \cdot \left(\frac{U}{J} \cdot \frac{U}{J}\right)}\right)\\
\mathbf{elif}\;U \leq 2.8 \cdot 10^{+293}:\\
\;\;\;\;-2 \cdot \left(U \cdot -0.5\right)\\
\mathbf{else}:\\
\;\;\;\;-U\\
\end{array}
\end{array}
if U < 1.65000000000000014e-29Initial program 83.7%
associate-*l*83.7%
associate-*l*83.7%
*-commutative83.7%
unpow283.7%
sqr-neg83.7%
distribute-frac-neg83.7%
distribute-frac-neg83.7%
unpow283.7%
Simplified91.3%
Taylor expanded in K around 0 80.4%
Taylor expanded in J around inf 64.0%
fma-def64.0%
unpow264.0%
Simplified64.0%
fma-udef64.0%
associate-/l*64.6%
Applied egg-rr64.6%
if 1.65000000000000014e-29 < U < 1.04999999999999993e206Initial program 72.1%
Simplified90.4%
Taylor expanded in K around 0 46.1%
*-commutative46.1%
unpow246.1%
unpow246.1%
Simplified46.1%
times-frac56.9%
Applied egg-rr56.9%
if 1.04999999999999993e206 < U < 2.79999999999999986e293Initial program 36.7%
Simplified65.9%
Taylor expanded in U around -inf 63.7%
*-commutative63.7%
Simplified63.7%
if 2.79999999999999986e293 < U Initial program 11.4%
Simplified26.1%
Taylor expanded in J around 0 83.3%
Taylor expanded in U around 0 83.3%
mul-1-neg83.3%
Simplified83.3%
Final simplification63.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))))))
(if (<= J -9.5e-51)
t_0
(if (<= J 7.6e-297)
(* -2.0 (- (* U -0.5) (/ (* J J) U)))
(if (<= J 9.2e-25) (- U) 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 <= -9.5e-51) {
tmp = t_0;
} else if (J <= 7.6e-297) {
tmp = -2.0 * ((U * -0.5) - ((J * J) / U));
} else if (J <= 9.2e-25) {
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 = (-2.0d0) * (j * cos((k / 2.0d0)))
if (j <= (-9.5d-51)) then
tmp = t_0
else if (j <= 7.6d-297) then
tmp = (-2.0d0) * ((u * (-0.5d0)) - ((j * j) / u))
else if (j <= 9.2d-25) 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 = -2.0 * (J * Math.cos((K / 2.0)));
double tmp;
if (J <= -9.5e-51) {
tmp = t_0;
} else if (J <= 7.6e-297) {
tmp = -2.0 * ((U * -0.5) - ((J * J) / U));
} else if (J <= 9.2e-25) {
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))) tmp = 0 if J <= -9.5e-51: tmp = t_0 elif J <= 7.6e-297: tmp = -2.0 * ((U * -0.5) - ((J * J) / U)) elif J <= 9.2e-25: tmp = -U 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 <= -9.5e-51) tmp = t_0; elseif (J <= 7.6e-297) tmp = Float64(-2.0 * Float64(Float64(U * -0.5) - Float64(Float64(J * J) / U))); elseif (J <= 9.2e-25) 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))); tmp = 0.0; if (J <= -9.5e-51) tmp = t_0; elseif (J <= 7.6e-297) tmp = -2.0 * ((U * -0.5) - ((J * J) / U)); elseif (J <= 9.2e-25) 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[(J * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[J, -9.5e-51], t$95$0, If[LessEqual[J, 7.6e-297], N[(-2.0 * N[(N[(U * -0.5), $MachinePrecision] - N[(N[(J * J), $MachinePrecision] / U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[J, 9.2e-25], (-U), 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 -9.5 \cdot 10^{-51}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;J \leq 7.6 \cdot 10^{-297}:\\
\;\;\;\;-2 \cdot \left(U \cdot -0.5 - \frac{J \cdot J}{U}\right)\\
\mathbf{elif}\;J \leq 9.2 \cdot 10^{-25}:\\
\;\;\;\;-U\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if J < -9.4999999999999998e-51 or 9.1999999999999997e-25 < J Initial program 93.7%
associate-*l*93.7%
associate-*l*93.7%
*-commutative93.7%
unpow293.7%
sqr-neg93.7%
distribute-frac-neg93.7%
distribute-frac-neg93.7%
unpow293.7%
Simplified99.7%
Taylor expanded in J around inf 74.5%
if -9.4999999999999998e-51 < J < 7.6000000000000001e-297Initial program 58.0%
Simplified73.2%
Taylor expanded in K around 0 24.9%
*-commutative24.9%
unpow224.9%
unpow224.9%
Simplified24.9%
Taylor expanded in U around -inf 41.3%
+-commutative41.3%
mul-1-neg41.3%
unsub-neg41.3%
*-commutative41.3%
unpow241.3%
Simplified41.3%
if 7.6000000000000001e-297 < J < 9.1999999999999997e-25Initial program 51.1%
Simplified73.1%
Taylor expanded in J around 0 45.9%
Taylor expanded in U around 0 45.9%
mul-1-neg45.9%
Simplified45.9%
Final simplification60.1%
NOTE: U should be positive before calling this function
(FPCore (J K U)
:precision binary64
(let* ((t_0 (* -2.0 (* J (+ 1.0 (* U (/ 0.5 J)))))))
(if (<= J -4.2e-5)
t_0
(if (<= J 7.6e-297) (* -2.0 (* U -0.5)) (if (<= J 4.5e-98) (- U) t_0)))))U = abs(U);
double code(double J, double K, double U) {
double t_0 = -2.0 * (J * (1.0 + (U * (0.5 / J))));
double tmp;
if (J <= -4.2e-5) {
tmp = t_0;
} else if (J <= 7.6e-297) {
tmp = -2.0 * (U * -0.5);
} else if (J <= 4.5e-98) {
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 = (-2.0d0) * (j * (1.0d0 + (u * (0.5d0 / j))))
if (j <= (-4.2d-5)) then
tmp = t_0
else if (j <= 7.6d-297) then
tmp = (-2.0d0) * (u * (-0.5d0))
else if (j <= 4.5d-98) 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 = -2.0 * (J * (1.0 + (U * (0.5 / J))));
double tmp;
if (J <= -4.2e-5) {
tmp = t_0;
} else if (J <= 7.6e-297) {
tmp = -2.0 * (U * -0.5);
} else if (J <= 4.5e-98) {
tmp = -U;
} else {
tmp = t_0;
}
return tmp;
}
U = abs(U) def code(J, K, U): t_0 = -2.0 * (J * (1.0 + (U * (0.5 / J)))) tmp = 0 if J <= -4.2e-5: tmp = t_0 elif J <= 7.6e-297: tmp = -2.0 * (U * -0.5) elif J <= 4.5e-98: tmp = -U else: tmp = t_0 return tmp
U = abs(U) function code(J, K, U) t_0 = Float64(-2.0 * Float64(J * Float64(1.0 + Float64(U * Float64(0.5 / J))))) tmp = 0.0 if (J <= -4.2e-5) tmp = t_0; elseif (J <= 7.6e-297) tmp = Float64(-2.0 * Float64(U * -0.5)); elseif (J <= 4.5e-98) 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 * (1.0 + (U * (0.5 / J)))); tmp = 0.0; if (J <= -4.2e-5) tmp = t_0; elseif (J <= 7.6e-297) tmp = -2.0 * (U * -0.5); elseif (J <= 4.5e-98) 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[(J * N[(1.0 + N[(U * N[(0.5 / J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[J, -4.2e-5], t$95$0, If[LessEqual[J, 7.6e-297], N[(-2.0 * N[(U * -0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[J, 4.5e-98], (-U), t$95$0]]]]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
t_0 := -2 \cdot \left(J \cdot \left(1 + U \cdot \frac{0.5}{J}\right)\right)\\
\mathbf{if}\;J \leq -4.2 \cdot 10^{-5}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;J \leq 7.6 \cdot 10^{-297}:\\
\;\;\;\;-2 \cdot \left(U \cdot -0.5\right)\\
\mathbf{elif}\;J \leq 4.5 \cdot 10^{-98}:\\
\;\;\;\;-U\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if J < -4.19999999999999977e-5 or 4.49999999999999997e-98 < J Initial program 92.6%
Simplified99.0%
add-cube-cbrt98.1%
pow398.1%
Applied egg-rr98.1%
expm1-log1p-u89.8%
rem-cube-cbrt90.3%
*-commutative90.3%
associate-/l*90.3%
Applied egg-rr90.3%
expm1-udef90.1%
sub-neg90.1%
Applied egg-rr98.9%
metadata-eval98.9%
sub-neg98.9%
associate--l+99.0%
*-commutative99.0%
*-commutative99.0%
Simplified99.0%
Taylor expanded in U around inf 51.8%
metadata-eval51.8%
times-frac51.8%
*-commutative51.8%
times-frac51.7%
/-rgt-identity51.7%
Simplified51.7%
if -4.19999999999999977e-5 < J < 7.6000000000000001e-297Initial program 61.0%
Simplified77.5%
Taylor expanded in U around -inf 42.5%
*-commutative42.5%
Simplified42.5%
if 7.6000000000000001e-297 < J < 4.49999999999999997e-98Initial program 42.0%
Simplified63.9%
Taylor expanded in J around 0 47.4%
Taylor expanded in U around 0 47.4%
mul-1-neg47.4%
Simplified47.4%
Final simplification48.4%
NOTE: U should be positive before calling this function
(FPCore (J K U)
:precision binary64
(let* ((t_0 (* -2.0 (* J (+ 1.0 (* U (/ 0.5 J)))))))
(if (<= J -0.15)
t_0
(if (<= J 7.6e-297)
(* -2.0 (- (* U -0.5) (/ (* J J) U)))
(if (<= J 2.8e-105) (- U) t_0)))))U = abs(U);
double code(double J, double K, double U) {
double t_0 = -2.0 * (J * (1.0 + (U * (0.5 / J))));
double tmp;
if (J <= -0.15) {
tmp = t_0;
} else if (J <= 7.6e-297) {
tmp = -2.0 * ((U * -0.5) - ((J * J) / U));
} else if (J <= 2.8e-105) {
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 = (-2.0d0) * (j * (1.0d0 + (u * (0.5d0 / j))))
if (j <= (-0.15d0)) then
tmp = t_0
else if (j <= 7.6d-297) then
tmp = (-2.0d0) * ((u * (-0.5d0)) - ((j * j) / u))
else if (j <= 2.8d-105) 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 = -2.0 * (J * (1.0 + (U * (0.5 / J))));
double tmp;
if (J <= -0.15) {
tmp = t_0;
} else if (J <= 7.6e-297) {
tmp = -2.0 * ((U * -0.5) - ((J * J) / U));
} else if (J <= 2.8e-105) {
tmp = -U;
} else {
tmp = t_0;
}
return tmp;
}
U = abs(U) def code(J, K, U): t_0 = -2.0 * (J * (1.0 + (U * (0.5 / J)))) tmp = 0 if J <= -0.15: tmp = t_0 elif J <= 7.6e-297: tmp = -2.0 * ((U * -0.5) - ((J * J) / U)) elif J <= 2.8e-105: tmp = -U else: tmp = t_0 return tmp
U = abs(U) function code(J, K, U) t_0 = Float64(-2.0 * Float64(J * Float64(1.0 + Float64(U * Float64(0.5 / J))))) tmp = 0.0 if (J <= -0.15) tmp = t_0; elseif (J <= 7.6e-297) tmp = Float64(-2.0 * Float64(Float64(U * -0.5) - Float64(Float64(J * J) / U))); elseif (J <= 2.8e-105) 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 * (1.0 + (U * (0.5 / J)))); tmp = 0.0; if (J <= -0.15) tmp = t_0; elseif (J <= 7.6e-297) tmp = -2.0 * ((U * -0.5) - ((J * J) / U)); elseif (J <= 2.8e-105) 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[(J * N[(1.0 + N[(U * N[(0.5 / J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[J, -0.15], t$95$0, If[LessEqual[J, 7.6e-297], N[(-2.0 * N[(N[(U * -0.5), $MachinePrecision] - N[(N[(J * J), $MachinePrecision] / U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[J, 2.8e-105], (-U), t$95$0]]]]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
t_0 := -2 \cdot \left(J \cdot \left(1 + U \cdot \frac{0.5}{J}\right)\right)\\
\mathbf{if}\;J \leq -0.15:\\
\;\;\;\;t_0\\
\mathbf{elif}\;J \leq 7.6 \cdot 10^{-297}:\\
\;\;\;\;-2 \cdot \left(U \cdot -0.5 - \frac{J \cdot J}{U}\right)\\
\mathbf{elif}\;J \leq 2.8 \cdot 10^{-105}:\\
\;\;\;\;-U\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if J < -0.149999999999999994 or 2.8e-105 < J Initial program 92.6%
Simplified99.0%
add-cube-cbrt98.1%
pow398.1%
Applied egg-rr98.1%
expm1-log1p-u89.8%
rem-cube-cbrt90.3%
*-commutative90.3%
associate-/l*90.3%
Applied egg-rr90.3%
expm1-udef90.1%
sub-neg90.1%
Applied egg-rr98.9%
metadata-eval98.9%
sub-neg98.9%
associate--l+99.0%
*-commutative99.0%
*-commutative99.0%
Simplified99.0%
Taylor expanded in U around inf 51.8%
metadata-eval51.8%
times-frac51.8%
*-commutative51.8%
times-frac51.7%
/-rgt-identity51.7%
Simplified51.7%
if -0.149999999999999994 < J < 7.6000000000000001e-297Initial program 61.0%
Simplified77.5%
Taylor expanded in K around 0 29.3%
*-commutative29.3%
unpow229.3%
unpow229.3%
Simplified29.3%
Taylor expanded in U around -inf 42.9%
+-commutative42.9%
mul-1-neg42.9%
unsub-neg42.9%
*-commutative42.9%
unpow242.9%
Simplified42.9%
if 7.6000000000000001e-297 < J < 2.8e-105Initial program 42.0%
Simplified63.9%
Taylor expanded in J around 0 47.4%
Taylor expanded in U around 0 47.4%
mul-1-neg47.4%
Simplified47.4%
Final simplification48.5%
NOTE: U should be positive before calling this function
(FPCore (J K U)
:precision binary64
(if (<= J -1.9e+177)
(* -2.0 J)
(if (<= J 1.05e-296)
(* -2.0 (* U -0.5))
(if (<= J 5.6e-19) (- U) (* -2.0 J)))))U = abs(U);
double code(double J, double K, double U) {
double tmp;
if (J <= -1.9e+177) {
tmp = -2.0 * J;
} else if (J <= 1.05e-296) {
tmp = -2.0 * (U * -0.5);
} else if (J <= 5.6e-19) {
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 <= (-1.9d+177)) then
tmp = (-2.0d0) * j
else if (j <= 1.05d-296) then
tmp = (-2.0d0) * (u * (-0.5d0))
else if (j <= 5.6d-19) 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 <= -1.9e+177) {
tmp = -2.0 * J;
} else if (J <= 1.05e-296) {
tmp = -2.0 * (U * -0.5);
} else if (J <= 5.6e-19) {
tmp = -U;
} else {
tmp = -2.0 * J;
}
return tmp;
}
U = abs(U) def code(J, K, U): tmp = 0 if J <= -1.9e+177: tmp = -2.0 * J elif J <= 1.05e-296: tmp = -2.0 * (U * -0.5) elif J <= 5.6e-19: tmp = -U else: tmp = -2.0 * J return tmp
U = abs(U) function code(J, K, U) tmp = 0.0 if (J <= -1.9e+177) tmp = Float64(-2.0 * J); elseif (J <= 1.05e-296) tmp = Float64(-2.0 * Float64(U * -0.5)); elseif (J <= 5.6e-19) 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 <= -1.9e+177) tmp = -2.0 * J; elseif (J <= 1.05e-296) tmp = -2.0 * (U * -0.5); elseif (J <= 5.6e-19) 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, -1.9e+177], N[(-2.0 * J), $MachinePrecision], If[LessEqual[J, 1.05e-296], N[(-2.0 * N[(U * -0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[J, 5.6e-19], (-U), N[(-2.0 * J), $MachinePrecision]]]]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
\mathbf{if}\;J \leq -1.9 \cdot 10^{+177}:\\
\;\;\;\;-2 \cdot J\\
\mathbf{elif}\;J \leq 1.05 \cdot 10^{-296}:\\
\;\;\;\;-2 \cdot \left(U \cdot -0.5\right)\\
\mathbf{elif}\;J \leq 5.6 \cdot 10^{-19}:\\
\;\;\;\;-U\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot J\\
\end{array}
\end{array}
if J < -1.8999999999999999e177 or 5.60000000000000005e-19 < J Initial program 97.6%
Simplified99.7%
Taylor expanded in K around 0 49.3%
*-commutative49.3%
unpow249.3%
unpow249.3%
Simplified49.3%
Taylor expanded in J around inf 51.4%
if -1.8999999999999999e177 < J < 1.05e-296Initial program 71.0%
Simplified85.0%
Taylor expanded in U around -inf 34.7%
*-commutative34.7%
Simplified34.7%
if 1.05e-296 < J < 5.60000000000000005e-19Initial program 51.1%
Simplified73.1%
Taylor expanded in J around 0 45.9%
Taylor expanded in U around 0 45.9%
mul-1-neg45.9%
Simplified45.9%
Final simplification42.8%
NOTE: U should be positive before calling this function (FPCore (J K U) :precision binary64 (if (<= U 18.0) (* -2.0 J) (- U)))
U = abs(U);
double code(double J, double K, double U) {
double tmp;
if (U <= 18.0) {
tmp = -2.0 * J;
} 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 (u <= 18.0d0) then
tmp = (-2.0d0) * j
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 (U <= 18.0) {
tmp = -2.0 * J;
} else {
tmp = -U;
}
return tmp;
}
U = abs(U) def code(J, K, U): tmp = 0 if U <= 18.0: tmp = -2.0 * J else: tmp = -U return tmp
U = abs(U) function code(J, K, U) tmp = 0.0 if (U <= 18.0) tmp = Float64(-2.0 * J); else tmp = Float64(-U); end return tmp end
U = abs(U) function tmp_2 = code(J, K, U) tmp = 0.0; if (U <= 18.0) tmp = -2.0 * J; else tmp = -U; end tmp_2 = tmp; end
NOTE: U should be positive before calling this function code[J_, K_, U_] := If[LessEqual[U, 18.0], N[(-2.0 * J), $MachinePrecision], (-U)]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
\mathbf{if}\;U \leq 18:\\
\;\;\;\;-2 \cdot J\\
\mathbf{else}:\\
\;\;\;\;-U\\
\end{array}
\end{array}
if U < 18Initial program 83.4%
Simplified91.6%
Taylor expanded in K around 0 39.6%
*-commutative39.6%
unpow239.6%
unpow239.6%
Simplified39.6%
Taylor expanded in J around inf 34.2%
if 18 < U Initial program 55.2%
Simplified76.3%
Taylor expanded in J around 0 42.2%
Taylor expanded in U around 0 42.2%
mul-1-neg42.2%
Simplified42.2%
Final simplification36.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 Float64(-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 75.6%
Simplified87.4%
Taylor expanded in J around 0 25.6%
Taylor expanded in U around 0 25.6%
mul-1-neg25.6%
Simplified25.6%
Final simplification25.6%
herbie shell --seed 2023264
(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)))))