
(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 13 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)) (- U) (if (<= t_1 1e+307) t_1 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 tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = -U;
} else if (t_1 <= 1e+307) {
tmp = t_1;
} 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 tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = -U;
} else if (t_1 <= 1e+307) {
tmp = t_1;
} 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))) tmp = 0 if t_1 <= -math.inf: tmp = -U elif t_1 <= 1e+307: tmp = t_1 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)))) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(-U); elseif (t_1 <= 1e+307) tmp = t_1; 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))); tmp = 0.0; if (t_1 <= -Inf) tmp = -U; elseif (t_1 <= 1e+307) tmp = t_1; 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]}, If[LessEqual[t$95$1, (-Infinity)], (-U), If[LessEqual[t$95$1, 1e+307], t$95$1, 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}}\\
\mathbf{if}\;t_1 \leq -\infty:\\
\;\;\;\;-U\\
\mathbf{elif}\;t_1 \leq 10^{+307}:\\
\;\;\;\;t_1\\
\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 5.7%
*-commutative5.7%
associate-*l*5.7%
unpow25.7%
hypot-1-def55.6%
*-commutative55.6%
associate-*l*55.6%
Simplified55.6%
Taylor expanded in J around 0 48.0%
neg-mul-148.0%
Simplified48.0%
if -inf.0 < (*.f64 (*.f64 (*.f64 -2 J) (cos.f64 (/.f64 K 2))) (sqrt.f64 (+.f64 1 (pow.f64 (/.f64 U (*.f64 (*.f64 2 J) (cos.f64 (/.f64 K 2)))) 2)))) < 9.99999999999999986e306Initial program 99.8%
if 9.99999999999999986e306 < (*.f64 (*.f64 (*.f64 -2 J) (cos.f64 (/.f64 K 2))) (sqrt.f64 (+.f64 1 (pow.f64 (/.f64 U (*.f64 (*.f64 2 J) (cos.f64 (/.f64 K 2)))) 2)))) Initial program 4.8%
*-commutative4.8%
associate-*l*4.8%
unpow24.8%
hypot-1-def57.6%
*-commutative57.6%
associate-*l*57.6%
Simplified57.6%
Taylor expanded in U around -inf 47.8%
Final simplification83.6%
NOTE: U should be positive before calling this function
(FPCore (J K U)
:precision binary64
(let* ((t_0 (cos (* K 0.5))) (t_1 (* (* -2.0 J) t_0)))
(if (<= K 62000000.0)
(*
(hypot 1.0 (/ U (* J (* 2.0 (cos (/ K 2.0))))))
(* J (+ -2.0 (* 0.25 (* K K)))))
(if (<= K 5.3e+213)
t_1
(if (<= K 1.22e+240)
(* -2.0 (+ (* J (/ J U)) (* U 0.5)))
(fma -0.25 (/ (* U U) (* J t_0)) t_1))))))U = abs(U);
double code(double J, double K, double U) {
double t_0 = cos((K * 0.5));
double t_1 = (-2.0 * J) * t_0;
double tmp;
if (K <= 62000000.0) {
tmp = hypot(1.0, (U / (J * (2.0 * cos((K / 2.0)))))) * (J * (-2.0 + (0.25 * (K * K))));
} else if (K <= 5.3e+213) {
tmp = t_1;
} else if (K <= 1.22e+240) {
tmp = -2.0 * ((J * (J / U)) + (U * 0.5));
} else {
tmp = fma(-0.25, ((U * U) / (J * t_0)), t_1);
}
return tmp;
}
U = abs(U) function code(J, K, U) t_0 = cos(Float64(K * 0.5)) t_1 = Float64(Float64(-2.0 * J) * t_0) tmp = 0.0 if (K <= 62000000.0) tmp = Float64(hypot(1.0, Float64(U / Float64(J * Float64(2.0 * cos(Float64(K / 2.0)))))) * Float64(J * Float64(-2.0 + Float64(0.25 * Float64(K * K))))); elseif (K <= 5.3e+213) tmp = t_1; elseif (K <= 1.22e+240) tmp = Float64(-2.0 * Float64(Float64(J * Float64(J / U)) + Float64(U * 0.5))); else tmp = fma(-0.25, Float64(Float64(U * U) / Float64(J * t_0)), t_1); end return tmp end
NOTE: U should be positive before calling this function
code[J_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(-2.0 * J), $MachinePrecision] * t$95$0), $MachinePrecision]}, If[LessEqual[K, 62000000.0], N[(N[Sqrt[1.0 ^ 2 + N[(U / N[(J * N[(2.0 * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision] * N[(J * N[(-2.0 + N[(0.25 * N[(K * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[K, 5.3e+213], t$95$1, If[LessEqual[K, 1.22e+240], N[(-2.0 * N[(N[(J * N[(J / U), $MachinePrecision]), $MachinePrecision] + N[(U * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-0.25 * N[(N[(U * U), $MachinePrecision] / N[(J * t$95$0), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]]]]]]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
t_0 := \cos \left(K \cdot 0.5\right)\\
t_1 := \left(-2 \cdot J\right) \cdot t_0\\
\mathbf{if}\;K \leq 62000000:\\
\;\;\;\;\mathsf{hypot}\left(1, \frac{U}{J \cdot \left(2 \cdot \cos \left(\frac{K}{2}\right)\right)}\right) \cdot \left(J \cdot \left(-2 + 0.25 \cdot \left(K \cdot K\right)\right)\right)\\
\mathbf{elif}\;K \leq 5.3 \cdot 10^{+213}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;K \leq 1.22 \cdot 10^{+240}:\\
\;\;\;\;-2 \cdot \left(J \cdot \frac{J}{U} + U \cdot 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.25, \frac{U \cdot U}{J \cdot t_0}, t_1\right)\\
\end{array}
\end{array}
if K < 6.2e7Initial program 71.6%
*-commutative71.6%
associate-*l*71.6%
unpow271.6%
hypot-1-def86.8%
*-commutative86.8%
associate-*l*86.8%
Simplified86.8%
Taylor expanded in K around 0 58.4%
associate-*r*58.4%
distribute-rgt-out58.4%
unpow258.4%
Simplified58.4%
if 6.2e7 < K < 5.2999999999999998e213Initial program 67.0%
*-commutative67.0%
associate-*l*67.0%
unpow267.0%
hypot-1-def80.7%
*-commutative80.7%
associate-*l*80.7%
Simplified80.7%
Taylor expanded in J around inf 45.0%
associate-*r*45.0%
*-commutative45.0%
*-commutative45.0%
associate-*r*45.0%
*-commutative45.0%
Simplified45.0%
if 5.2999999999999998e213 < K < 1.2200000000000001e240Initial program 35.6%
*-commutative35.6%
associate-*l*35.6%
unpow235.6%
hypot-1-def99.5%
*-commutative99.5%
associate-*l*99.5%
Simplified99.5%
Taylor expanded in K around 0 7.7%
*-commutative7.7%
unpow27.7%
unpow27.7%
Simplified7.7%
Taylor expanded in J around 0 68.4%
*-commutative68.4%
fma-def68.4%
unpow268.4%
Simplified68.4%
fma-udef68.4%
+-commutative68.4%
associate-*r/69.3%
*-commutative69.3%
Applied egg-rr69.3%
if 1.2200000000000001e240 < K Initial program 67.2%
*-commutative67.2%
associate-*l*67.2%
unpow267.2%
hypot-1-def89.6%
*-commutative89.6%
associate-*l*89.6%
Simplified89.6%
Taylor expanded in J around inf 34.6%
fma-def34.6%
unpow234.6%
*-commutative34.6%
associate-*r*34.6%
*-commutative34.6%
*-commutative34.6%
associate-*r*34.6%
*-commutative34.6%
Simplified34.6%
Final simplification55.1%
NOTE: U should be positive before calling this function (FPCore (J K U) :precision binary64 (let* ((t_0 (cos (/ K 2.0)))) (* (* J (* -2.0 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 (J * (-2.0 * 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 (J * (-2.0 * 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 (J * (-2.0 * 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(Float64(J * Float64(-2.0 * 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 = (J * (-2.0 * 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[(N[(J * N[(-2.0 * t$95$0), $MachinePrecision]), $MachinePrecision] * N[Sqrt[1.0 ^ 2 + N[(U / N[(J * N[(2.0 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\left(J \cdot \left(-2 \cdot t_0\right)\right) \cdot \mathsf{hypot}\left(1, \frac{U}{J \cdot \left(2 \cdot t_0\right)}\right)
\end{array}
\end{array}
Initial program 70.3%
*-commutative70.3%
associate-*l*70.3%
unpow270.3%
hypot-1-def86.3%
*-commutative86.3%
associate-*l*86.3%
Simplified86.3%
Final simplification86.3%
NOTE: U should be positive before calling this function
(FPCore (J K U)
:precision binary64
(if (<= K 62000000.0)
(*
(hypot 1.0 (/ U (* J (* 2.0 (cos (/ K 2.0))))))
(* J (+ -2.0 (* 0.25 (* K K)))))
(if (or (<= K 6.5e+213) (not (<= K 9.5e+239)))
(* (* -2.0 J) (cos (* K 0.5)))
(* -2.0 (+ (* J (/ J U)) (* U 0.5))))))U = abs(U);
double code(double J, double K, double U) {
double tmp;
if (K <= 62000000.0) {
tmp = hypot(1.0, (U / (J * (2.0 * cos((K / 2.0)))))) * (J * (-2.0 + (0.25 * (K * K))));
} else if ((K <= 6.5e+213) || !(K <= 9.5e+239)) {
tmp = (-2.0 * J) * cos((K * 0.5));
} else {
tmp = -2.0 * ((J * (J / U)) + (U * 0.5));
}
return tmp;
}
U = Math.abs(U);
public static double code(double J, double K, double U) {
double tmp;
if (K <= 62000000.0) {
tmp = Math.hypot(1.0, (U / (J * (2.0 * Math.cos((K / 2.0)))))) * (J * (-2.0 + (0.25 * (K * K))));
} else if ((K <= 6.5e+213) || !(K <= 9.5e+239)) {
tmp = (-2.0 * J) * Math.cos((K * 0.5));
} else {
tmp = -2.0 * ((J * (J / U)) + (U * 0.5));
}
return tmp;
}
U = abs(U) def code(J, K, U): tmp = 0 if K <= 62000000.0: tmp = math.hypot(1.0, (U / (J * (2.0 * math.cos((K / 2.0)))))) * (J * (-2.0 + (0.25 * (K * K)))) elif (K <= 6.5e+213) or not (K <= 9.5e+239): tmp = (-2.0 * J) * math.cos((K * 0.5)) else: tmp = -2.0 * ((J * (J / U)) + (U * 0.5)) return tmp
U = abs(U) function code(J, K, U) tmp = 0.0 if (K <= 62000000.0) tmp = Float64(hypot(1.0, Float64(U / Float64(J * Float64(2.0 * cos(Float64(K / 2.0)))))) * Float64(J * Float64(-2.0 + Float64(0.25 * Float64(K * K))))); elseif ((K <= 6.5e+213) || !(K <= 9.5e+239)) tmp = Float64(Float64(-2.0 * J) * cos(Float64(K * 0.5))); else tmp = Float64(-2.0 * Float64(Float64(J * Float64(J / U)) + Float64(U * 0.5))); end return tmp end
U = abs(U) function tmp_2 = code(J, K, U) tmp = 0.0; if (K <= 62000000.0) tmp = hypot(1.0, (U / (J * (2.0 * cos((K / 2.0)))))) * (J * (-2.0 + (0.25 * (K * K)))); elseif ((K <= 6.5e+213) || ~((K <= 9.5e+239))) tmp = (-2.0 * J) * cos((K * 0.5)); else tmp = -2.0 * ((J * (J / U)) + (U * 0.5)); end tmp_2 = tmp; end
NOTE: U should be positive before calling this function code[J_, K_, U_] := If[LessEqual[K, 62000000.0], N[(N[Sqrt[1.0 ^ 2 + N[(U / N[(J * N[(2.0 * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision] * N[(J * N[(-2.0 + N[(0.25 * N[(K * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[K, 6.5e+213], N[Not[LessEqual[K, 9.5e+239]], $MachinePrecision]], N[(N[(-2.0 * J), $MachinePrecision] * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(-2.0 * N[(N[(J * N[(J / U), $MachinePrecision]), $MachinePrecision] + N[(U * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
\mathbf{if}\;K \leq 62000000:\\
\;\;\;\;\mathsf{hypot}\left(1, \frac{U}{J \cdot \left(2 \cdot \cos \left(\frac{K}{2}\right)\right)}\right) \cdot \left(J \cdot \left(-2 + 0.25 \cdot \left(K \cdot K\right)\right)\right)\\
\mathbf{elif}\;K \leq 6.5 \cdot 10^{+213} \lor \neg \left(K \leq 9.5 \cdot 10^{+239}\right):\\
\;\;\;\;\left(-2 \cdot J\right) \cdot \cos \left(K \cdot 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \left(J \cdot \frac{J}{U} + U \cdot 0.5\right)\\
\end{array}
\end{array}
if K < 6.2e7Initial program 71.6%
*-commutative71.6%
associate-*l*71.6%
unpow271.6%
hypot-1-def86.8%
*-commutative86.8%
associate-*l*86.8%
Simplified86.8%
Taylor expanded in K around 0 58.4%
associate-*r*58.4%
distribute-rgt-out58.4%
unpow258.4%
Simplified58.4%
if 6.2e7 < K < 6.49999999999999982e213 or 9.5000000000000008e239 < K Initial program 67.0%
*-commutative67.0%
associate-*l*67.0%
unpow267.0%
hypot-1-def83.6%
*-commutative83.6%
associate-*l*83.6%
Simplified83.6%
Taylor expanded in J around inf 41.4%
associate-*r*41.4%
*-commutative41.4%
*-commutative41.4%
associate-*r*41.4%
*-commutative41.4%
Simplified41.4%
if 6.49999999999999982e213 < K < 9.5000000000000008e239Initial program 35.6%
*-commutative35.6%
associate-*l*35.6%
unpow235.6%
hypot-1-def99.5%
*-commutative99.5%
associate-*l*99.5%
Simplified99.5%
Taylor expanded in K around 0 7.7%
*-commutative7.7%
unpow27.7%
unpow27.7%
Simplified7.7%
Taylor expanded in J around 0 68.4%
*-commutative68.4%
fma-def68.4%
unpow268.4%
Simplified68.4%
fma-udef68.4%
+-commutative68.4%
associate-*r/69.3%
*-commutative69.3%
Applied egg-rr69.3%
Final simplification55.1%
NOTE: U should be positive before calling this function
(FPCore (J K U)
:precision binary64
(let* ((t_0 (* (* -2.0 J) (cos (* K 0.5)))))
(if (<= J -8e+16)
t_0
(if (<= J -8.5e-53)
U
(if (<= J -3.3e-92)
t_0
(if (<= J -7.8e-110)
(- U)
(if (<= J -1e-310)
U
(if (<= J 4.05e-243)
(- U)
(if (<= J 2.1e-229)
U
(if (<= J 5e-120)
(- U)
(if (or (<= J 6.6e-89) (not (<= J 12500000000000.0)))
t_0
(* -2.0 (+ (* J (/ J U)) (* U 0.5))))))))))))))U = abs(U);
double code(double J, double K, double U) {
double t_0 = (-2.0 * J) * cos((K * 0.5));
double tmp;
if (J <= -8e+16) {
tmp = t_0;
} else if (J <= -8.5e-53) {
tmp = U;
} else if (J <= -3.3e-92) {
tmp = t_0;
} else if (J <= -7.8e-110) {
tmp = -U;
} else if (J <= -1e-310) {
tmp = U;
} else if (J <= 4.05e-243) {
tmp = -U;
} else if (J <= 2.1e-229) {
tmp = U;
} else if (J <= 5e-120) {
tmp = -U;
} else if ((J <= 6.6e-89) || !(J <= 12500000000000.0)) {
tmp = t_0;
} else {
tmp = -2.0 * ((J * (J / U)) + (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) :: t_0
real(8) :: tmp
t_0 = ((-2.0d0) * j) * cos((k * 0.5d0))
if (j <= (-8d+16)) then
tmp = t_0
else if (j <= (-8.5d-53)) then
tmp = u
else if (j <= (-3.3d-92)) then
tmp = t_0
else if (j <= (-7.8d-110)) then
tmp = -u
else if (j <= (-1d-310)) then
tmp = u
else if (j <= 4.05d-243) then
tmp = -u
else if (j <= 2.1d-229) then
tmp = u
else if (j <= 5d-120) then
tmp = -u
else if ((j <= 6.6d-89) .or. (.not. (j <= 12500000000000.0d0))) then
tmp = t_0
else
tmp = (-2.0d0) * ((j * (j / u)) + (u * 0.5d0))
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 * 0.5));
double tmp;
if (J <= -8e+16) {
tmp = t_0;
} else if (J <= -8.5e-53) {
tmp = U;
} else if (J <= -3.3e-92) {
tmp = t_0;
} else if (J <= -7.8e-110) {
tmp = -U;
} else if (J <= -1e-310) {
tmp = U;
} else if (J <= 4.05e-243) {
tmp = -U;
} else if (J <= 2.1e-229) {
tmp = U;
} else if (J <= 5e-120) {
tmp = -U;
} else if ((J <= 6.6e-89) || !(J <= 12500000000000.0)) {
tmp = t_0;
} else {
tmp = -2.0 * ((J * (J / U)) + (U * 0.5));
}
return tmp;
}
U = abs(U) def code(J, K, U): t_0 = (-2.0 * J) * math.cos((K * 0.5)) tmp = 0 if J <= -8e+16: tmp = t_0 elif J <= -8.5e-53: tmp = U elif J <= -3.3e-92: tmp = t_0 elif J <= -7.8e-110: tmp = -U elif J <= -1e-310: tmp = U elif J <= 4.05e-243: tmp = -U elif J <= 2.1e-229: tmp = U elif J <= 5e-120: tmp = -U elif (J <= 6.6e-89) or not (J <= 12500000000000.0): tmp = t_0 else: tmp = -2.0 * ((J * (J / U)) + (U * 0.5)) return tmp
U = abs(U) function code(J, K, U) t_0 = Float64(Float64(-2.0 * J) * cos(Float64(K * 0.5))) tmp = 0.0 if (J <= -8e+16) tmp = t_0; elseif (J <= -8.5e-53) tmp = U; elseif (J <= -3.3e-92) tmp = t_0; elseif (J <= -7.8e-110) tmp = Float64(-U); elseif (J <= -1e-310) tmp = U; elseif (J <= 4.05e-243) tmp = Float64(-U); elseif (J <= 2.1e-229) tmp = U; elseif (J <= 5e-120) tmp = Float64(-U); elseif ((J <= 6.6e-89) || !(J <= 12500000000000.0)) tmp = t_0; else tmp = Float64(-2.0 * Float64(Float64(J * Float64(J / U)) + Float64(U * 0.5))); end return tmp end
U = abs(U) function tmp_2 = code(J, K, U) t_0 = (-2.0 * J) * cos((K * 0.5)); tmp = 0.0; if (J <= -8e+16) tmp = t_0; elseif (J <= -8.5e-53) tmp = U; elseif (J <= -3.3e-92) tmp = t_0; elseif (J <= -7.8e-110) tmp = -U; elseif (J <= -1e-310) tmp = U; elseif (J <= 4.05e-243) tmp = -U; elseif (J <= 2.1e-229) tmp = U; elseif (J <= 5e-120) tmp = -U; elseif ((J <= 6.6e-89) || ~((J <= 12500000000000.0))) tmp = t_0; else tmp = -2.0 * ((J * (J / U)) + (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[(N[(-2.0 * J), $MachinePrecision] * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[J, -8e+16], t$95$0, If[LessEqual[J, -8.5e-53], U, If[LessEqual[J, -3.3e-92], t$95$0, If[LessEqual[J, -7.8e-110], (-U), If[LessEqual[J, -1e-310], U, If[LessEqual[J, 4.05e-243], (-U), If[LessEqual[J, 2.1e-229], U, If[LessEqual[J, 5e-120], (-U), If[Or[LessEqual[J, 6.6e-89], N[Not[LessEqual[J, 12500000000000.0]], $MachinePrecision]], t$95$0, N[(-2.0 * N[(N[(J * N[(J / U), $MachinePrecision]), $MachinePrecision] + N[(U * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
t_0 := \left(-2 \cdot J\right) \cdot \cos \left(K \cdot 0.5\right)\\
\mathbf{if}\;J \leq -8 \cdot 10^{+16}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;J \leq -8.5 \cdot 10^{-53}:\\
\;\;\;\;U\\
\mathbf{elif}\;J \leq -3.3 \cdot 10^{-92}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;J \leq -7.8 \cdot 10^{-110}:\\
\;\;\;\;-U\\
\mathbf{elif}\;J \leq -1 \cdot 10^{-310}:\\
\;\;\;\;U\\
\mathbf{elif}\;J \leq 4.05 \cdot 10^{-243}:\\
\;\;\;\;-U\\
\mathbf{elif}\;J \leq 2.1 \cdot 10^{-229}:\\
\;\;\;\;U\\
\mathbf{elif}\;J \leq 5 \cdot 10^{-120}:\\
\;\;\;\;-U\\
\mathbf{elif}\;J \leq 6.6 \cdot 10^{-89} \lor \neg \left(J \leq 12500000000000\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \left(J \cdot \frac{J}{U} + U \cdot 0.5\right)\\
\end{array}
\end{array}
if J < -8e16 or -8.50000000000000044e-53 < J < -3.29999999999999998e-92 or 5.00000000000000007e-120 < J < 6.5999999999999993e-89 or 1.25e13 < J Initial program 93.6%
*-commutative93.6%
associate-*l*93.6%
unpow293.6%
hypot-1-def98.4%
*-commutative98.4%
associate-*l*98.4%
Simplified98.4%
Taylor expanded in J around inf 73.4%
associate-*r*73.4%
*-commutative73.4%
*-commutative73.4%
associate-*r*73.4%
*-commutative73.4%
Simplified73.4%
if -8e16 < J < -8.50000000000000044e-53 or -7.8e-110 < J < -9.999999999999969e-311 or 4.0499999999999999e-243 < J < 2.09999999999999983e-229Initial program 37.0%
*-commutative37.0%
associate-*l*37.0%
unpow237.0%
hypot-1-def71.3%
*-commutative71.3%
associate-*l*71.3%
Simplified71.3%
Taylor expanded in U around -inf 40.8%
if -3.29999999999999998e-92 < J < -7.8e-110 or -9.999999999999969e-311 < J < 4.0499999999999999e-243 or 2.09999999999999983e-229 < J < 5.00000000000000007e-120Initial program 47.3%
*-commutative47.3%
associate-*l*47.3%
unpow247.3%
hypot-1-def66.6%
*-commutative66.6%
associate-*l*66.6%
Simplified66.6%
Taylor expanded in J around 0 41.5%
neg-mul-141.5%
Simplified41.5%
if 6.5999999999999993e-89 < J < 1.25e13Initial program 57.6%
*-commutative57.6%
associate-*l*57.6%
unpow257.6%
hypot-1-def90.7%
*-commutative90.7%
associate-*l*90.7%
Simplified90.7%
Taylor expanded in K around 0 48.9%
*-commutative48.9%
unpow248.9%
unpow248.9%
Simplified48.9%
Taylor expanded in J around 0 32.1%
*-commutative32.1%
fma-def32.1%
unpow232.1%
Simplified32.1%
fma-udef32.1%
+-commutative32.1%
associate-*r/32.1%
*-commutative32.1%
Applied egg-rr32.1%
Final simplification57.4%
NOTE: U should be positive before calling this function
(FPCore (J K U)
:precision binary64
(let* ((t_0 (* (* -2.0 J) (cos (* K 0.5)))))
(if (<= J -5.2e+16)
t_0
(if (<= J -3.9e-53)
U
(if (<= J -6.5e-90)
t_0
(if (<= J -8.8e-110)
(- U)
(if (<= J -1e-310)
U
(if (<= J 5.8e-243)
(- U)
(if (<= J 2.35e-229)
U
(if (<= J 5.6e-120)
(* -2.0 (fma U 0.5 (/ (* J J) U)))
(if (or (<= J 1.6e-91) (not (<= J 1.95e+25)))
t_0
(* -2.0 (+ (* J (/ J U)) (* U 0.5))))))))))))))U = abs(U);
double code(double J, double K, double U) {
double t_0 = (-2.0 * J) * cos((K * 0.5));
double tmp;
if (J <= -5.2e+16) {
tmp = t_0;
} else if (J <= -3.9e-53) {
tmp = U;
} else if (J <= -6.5e-90) {
tmp = t_0;
} else if (J <= -8.8e-110) {
tmp = -U;
} else if (J <= -1e-310) {
tmp = U;
} else if (J <= 5.8e-243) {
tmp = -U;
} else if (J <= 2.35e-229) {
tmp = U;
} else if (J <= 5.6e-120) {
tmp = -2.0 * fma(U, 0.5, ((J * J) / U));
} else if ((J <= 1.6e-91) || !(J <= 1.95e+25)) {
tmp = t_0;
} else {
tmp = -2.0 * ((J * (J / U)) + (U * 0.5));
}
return tmp;
}
U = abs(U) function code(J, K, U) t_0 = Float64(Float64(-2.0 * J) * cos(Float64(K * 0.5))) tmp = 0.0 if (J <= -5.2e+16) tmp = t_0; elseif (J <= -3.9e-53) tmp = U; elseif (J <= -6.5e-90) tmp = t_0; elseif (J <= -8.8e-110) tmp = Float64(-U); elseif (J <= -1e-310) tmp = U; elseif (J <= 5.8e-243) tmp = Float64(-U); elseif (J <= 2.35e-229) tmp = U; elseif (J <= 5.6e-120) tmp = Float64(-2.0 * fma(U, 0.5, Float64(Float64(J * J) / U))); elseif ((J <= 1.6e-91) || !(J <= 1.95e+25)) tmp = t_0; else tmp = Float64(-2.0 * Float64(Float64(J * Float64(J / U)) + Float64(U * 0.5))); end return tmp end
NOTE: U should be positive before calling this function
code[J_, K_, U_] := Block[{t$95$0 = N[(N[(-2.0 * J), $MachinePrecision] * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[J, -5.2e+16], t$95$0, If[LessEqual[J, -3.9e-53], U, If[LessEqual[J, -6.5e-90], t$95$0, If[LessEqual[J, -8.8e-110], (-U), If[LessEqual[J, -1e-310], U, If[LessEqual[J, 5.8e-243], (-U), If[LessEqual[J, 2.35e-229], U, If[LessEqual[J, 5.6e-120], N[(-2.0 * N[(U * 0.5 + N[(N[(J * J), $MachinePrecision] / U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[J, 1.6e-91], N[Not[LessEqual[J, 1.95e+25]], $MachinePrecision]], t$95$0, N[(-2.0 * N[(N[(J * N[(J / U), $MachinePrecision]), $MachinePrecision] + N[(U * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
t_0 := \left(-2 \cdot J\right) \cdot \cos \left(K \cdot 0.5\right)\\
\mathbf{if}\;J \leq -5.2 \cdot 10^{+16}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;J \leq -3.9 \cdot 10^{-53}:\\
\;\;\;\;U\\
\mathbf{elif}\;J \leq -6.5 \cdot 10^{-90}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;J \leq -8.8 \cdot 10^{-110}:\\
\;\;\;\;-U\\
\mathbf{elif}\;J \leq -1 \cdot 10^{-310}:\\
\;\;\;\;U\\
\mathbf{elif}\;J \leq 5.8 \cdot 10^{-243}:\\
\;\;\;\;-U\\
\mathbf{elif}\;J \leq 2.35 \cdot 10^{-229}:\\
\;\;\;\;U\\
\mathbf{elif}\;J \leq 5.6 \cdot 10^{-120}:\\
\;\;\;\;-2 \cdot \mathsf{fma}\left(U, 0.5, \frac{J \cdot J}{U}\right)\\
\mathbf{elif}\;J \leq 1.6 \cdot 10^{-91} \lor \neg \left(J \leq 1.95 \cdot 10^{+25}\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \left(J \cdot \frac{J}{U} + U \cdot 0.5\right)\\
\end{array}
\end{array}
if J < -5.2e16 or -3.9000000000000002e-53 < J < -6.4999999999999996e-90 or 5.59999999999999988e-120 < J < 1.59999999999999998e-91 or 1.9500000000000001e25 < J Initial program 93.6%
*-commutative93.6%
associate-*l*93.6%
unpow293.6%
hypot-1-def98.4%
*-commutative98.4%
associate-*l*98.4%
Simplified98.4%
Taylor expanded in J around inf 73.4%
associate-*r*73.4%
*-commutative73.4%
*-commutative73.4%
associate-*r*73.4%
*-commutative73.4%
Simplified73.4%
if -5.2e16 < J < -3.9000000000000002e-53 or -8.7999999999999997e-110 < J < -9.999999999999969e-311 or 5.79999999999999953e-243 < J < 2.35000000000000017e-229Initial program 37.0%
*-commutative37.0%
associate-*l*37.0%
unpow237.0%
hypot-1-def71.3%
*-commutative71.3%
associate-*l*71.3%
Simplified71.3%
Taylor expanded in U around -inf 40.8%
if -6.4999999999999996e-90 < J < -8.7999999999999997e-110 or -9.999999999999969e-311 < J < 5.79999999999999953e-243Initial program 43.6%
*-commutative43.6%
associate-*l*43.6%
unpow243.6%
hypot-1-def65.7%
*-commutative65.7%
associate-*l*65.7%
Simplified65.7%
Taylor expanded in J around 0 37.8%
neg-mul-137.8%
Simplified37.8%
if 2.35000000000000017e-229 < J < 5.59999999999999988e-120Initial program 50.7%
*-commutative50.7%
associate-*l*50.7%
unpow250.7%
hypot-1-def67.4%
*-commutative67.4%
associate-*l*67.4%
Simplified67.4%
Taylor expanded in K around 0 6.9%
*-commutative6.9%
unpow26.9%
unpow26.9%
Simplified6.9%
Taylor expanded in J around 0 45.1%
*-commutative45.1%
fma-def45.1%
unpow245.1%
Simplified45.1%
if 1.59999999999999998e-91 < J < 1.9500000000000001e25Initial program 57.6%
*-commutative57.6%
associate-*l*57.6%
unpow257.6%
hypot-1-def90.7%
*-commutative90.7%
associate-*l*90.7%
Simplified90.7%
Taylor expanded in K around 0 48.9%
*-commutative48.9%
unpow248.9%
unpow248.9%
Simplified48.9%
Taylor expanded in J around 0 32.1%
*-commutative32.1%
fma-def32.1%
unpow232.1%
Simplified32.1%
fma-udef32.1%
+-commutative32.1%
associate-*r/32.1%
*-commutative32.1%
Applied egg-rr32.1%
Final simplification57.4%
NOTE: U should be positive before calling this function
(FPCore (J K U)
:precision binary64
(if (<= K 8.5e-5)
(* -2.0 (* J (hypot 1.0 (/ (* U 0.5) J))))
(if (or (<= K 6.2e+213) (not (<= K 1.22e+240)))
(* (* -2.0 J) (cos (* K 0.5)))
(* -2.0 (+ (* J (/ J U)) (* U 0.5))))))U = abs(U);
double code(double J, double K, double U) {
double tmp;
if (K <= 8.5e-5) {
tmp = -2.0 * (J * hypot(1.0, ((U * 0.5) / J)));
} else if ((K <= 6.2e+213) || !(K <= 1.22e+240)) {
tmp = (-2.0 * J) * cos((K * 0.5));
} else {
tmp = -2.0 * ((J * (J / U)) + (U * 0.5));
}
return tmp;
}
U = Math.abs(U);
public static double code(double J, double K, double U) {
double tmp;
if (K <= 8.5e-5) {
tmp = -2.0 * (J * Math.hypot(1.0, ((U * 0.5) / J)));
} else if ((K <= 6.2e+213) || !(K <= 1.22e+240)) {
tmp = (-2.0 * J) * Math.cos((K * 0.5));
} else {
tmp = -2.0 * ((J * (J / U)) + (U * 0.5));
}
return tmp;
}
U = abs(U) def code(J, K, U): tmp = 0 if K <= 8.5e-5: tmp = -2.0 * (J * math.hypot(1.0, ((U * 0.5) / J))) elif (K <= 6.2e+213) or not (K <= 1.22e+240): tmp = (-2.0 * J) * math.cos((K * 0.5)) else: tmp = -2.0 * ((J * (J / U)) + (U * 0.5)) return tmp
U = abs(U) function code(J, K, U) tmp = 0.0 if (K <= 8.5e-5) tmp = Float64(-2.0 * Float64(J * hypot(1.0, Float64(Float64(U * 0.5) / J)))); elseif ((K <= 6.2e+213) || !(K <= 1.22e+240)) tmp = Float64(Float64(-2.0 * J) * cos(Float64(K * 0.5))); else tmp = Float64(-2.0 * Float64(Float64(J * Float64(J / U)) + Float64(U * 0.5))); end return tmp end
U = abs(U) function tmp_2 = code(J, K, U) tmp = 0.0; if (K <= 8.5e-5) tmp = -2.0 * (J * hypot(1.0, ((U * 0.5) / J))); elseif ((K <= 6.2e+213) || ~((K <= 1.22e+240))) tmp = (-2.0 * J) * cos((K * 0.5)); else tmp = -2.0 * ((J * (J / U)) + (U * 0.5)); end tmp_2 = tmp; end
NOTE: U should be positive before calling this function code[J_, K_, U_] := If[LessEqual[K, 8.5e-5], 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[K, 6.2e+213], N[Not[LessEqual[K, 1.22e+240]], $MachinePrecision]], N[(N[(-2.0 * J), $MachinePrecision] * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(-2.0 * N[(N[(J * N[(J / U), $MachinePrecision]), $MachinePrecision] + N[(U * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
\mathbf{if}\;K \leq 8.5 \cdot 10^{-5}:\\
\;\;\;\;-2 \cdot \left(J \cdot \mathsf{hypot}\left(1, \frac{U \cdot 0.5}{J}\right)\right)\\
\mathbf{elif}\;K \leq 6.2 \cdot 10^{+213} \lor \neg \left(K \leq 1.22 \cdot 10^{+240}\right):\\
\;\;\;\;\left(-2 \cdot J\right) \cdot \cos \left(K \cdot 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \left(J \cdot \frac{J}{U} + U \cdot 0.5\right)\\
\end{array}
\end{array}
if K < 8.500000000000001e-5Initial program 71.7%
*-commutative71.7%
associate-*l*71.7%
unpow271.7%
hypot-1-def87.1%
*-commutative87.1%
associate-*l*87.1%
Simplified87.1%
Taylor expanded in K around 0 37.3%
*-commutative37.3%
unpow237.3%
unpow237.3%
Simplified37.3%
add-sqr-sqrt37.3%
hypot-1-def37.3%
*-commutative37.3%
times-frac52.4%
Applied egg-rr52.4%
*-commutative52.4%
times-frac37.3%
unpow237.3%
unpow237.3%
associate-*r/37.3%
associate-/l*37.3%
unpow237.3%
unpow237.3%
times-frac52.4%
Simplified52.4%
expm1-log1p-u33.8%
expm1-udef17.7%
sqrt-div18.4%
metadata-eval18.4%
sqrt-prod11.4%
add-sqr-sqrt23.6%
Applied egg-rr23.6%
expm1-def41.6%
expm1-log1p64.9%
associate-/l*65.0%
Simplified65.0%
if 8.500000000000001e-5 < K < 6.19999999999999981e213 or 1.2200000000000001e240 < K Initial program 67.1%
*-commutative67.1%
associate-*l*67.1%
unpow267.1%
hypot-1-def82.7%
*-commutative82.7%
associate-*l*82.7%
Simplified82.7%
Taylor expanded in J around inf 42.8%
associate-*r*42.8%
*-commutative42.8%
*-commutative42.8%
associate-*r*42.8%
*-commutative42.8%
Simplified42.8%
if 6.19999999999999981e213 < K < 1.2200000000000001e240Initial program 35.6%
*-commutative35.6%
associate-*l*35.6%
unpow235.6%
hypot-1-def99.5%
*-commutative99.5%
associate-*l*99.5%
Simplified99.5%
Taylor expanded in K around 0 7.7%
*-commutative7.7%
unpow27.7%
unpow27.7%
Simplified7.7%
Taylor expanded in J around 0 68.4%
*-commutative68.4%
fma-def68.4%
unpow268.4%
Simplified68.4%
fma-udef68.4%
+-commutative68.4%
associate-*r/69.3%
*-commutative69.3%
Applied egg-rr69.3%
Final simplification60.3%
NOTE: U should be positive before calling this function
(FPCore (J K U)
:precision binary64
(if (<= J -3.4e+42)
(* J (+ -2.0 (* 0.25 (* K K))))
(if (<= J -1e-310)
U
(if (<= J 1.4e-243)
(- U)
(if (<= J 2.1e-229)
U
(if (<= J 3.6e+99)
(* -2.0 (+ (* J (/ J U)) (* U 0.5)))
(* -2.0 J)))))))U = abs(U);
double code(double J, double K, double U) {
double tmp;
if (J <= -3.4e+42) {
tmp = J * (-2.0 + (0.25 * (K * K)));
} else if (J <= -1e-310) {
tmp = U;
} else if (J <= 1.4e-243) {
tmp = -U;
} else if (J <= 2.1e-229) {
tmp = U;
} else if (J <= 3.6e+99) {
tmp = -2.0 * ((J * (J / U)) + (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 <= (-3.4d+42)) then
tmp = j * ((-2.0d0) + (0.25d0 * (k * k)))
else if (j <= (-1d-310)) then
tmp = u
else if (j <= 1.4d-243) then
tmp = -u
else if (j <= 2.1d-229) then
tmp = u
else if (j <= 3.6d+99) then
tmp = (-2.0d0) * ((j * (j / u)) + (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 <= -3.4e+42) {
tmp = J * (-2.0 + (0.25 * (K * K)));
} else if (J <= -1e-310) {
tmp = U;
} else if (J <= 1.4e-243) {
tmp = -U;
} else if (J <= 2.1e-229) {
tmp = U;
} else if (J <= 3.6e+99) {
tmp = -2.0 * ((J * (J / U)) + (U * 0.5));
} else {
tmp = -2.0 * J;
}
return tmp;
}
U = abs(U) def code(J, K, U): tmp = 0 if J <= -3.4e+42: tmp = J * (-2.0 + (0.25 * (K * K))) elif J <= -1e-310: tmp = U elif J <= 1.4e-243: tmp = -U elif J <= 2.1e-229: tmp = U elif J <= 3.6e+99: tmp = -2.0 * ((J * (J / U)) + (U * 0.5)) else: tmp = -2.0 * J return tmp
U = abs(U) function code(J, K, U) tmp = 0.0 if (J <= -3.4e+42) tmp = Float64(J * Float64(-2.0 + Float64(0.25 * Float64(K * K)))); elseif (J <= -1e-310) tmp = U; elseif (J <= 1.4e-243) tmp = Float64(-U); elseif (J <= 2.1e-229) tmp = U; elseif (J <= 3.6e+99) tmp = Float64(-2.0 * Float64(Float64(J * Float64(J / U)) + 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 <= -3.4e+42) tmp = J * (-2.0 + (0.25 * (K * K))); elseif (J <= -1e-310) tmp = U; elseif (J <= 1.4e-243) tmp = -U; elseif (J <= 2.1e-229) tmp = U; elseif (J <= 3.6e+99) tmp = -2.0 * ((J * (J / U)) + (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, -3.4e+42], N[(J * N[(-2.0 + N[(0.25 * N[(K * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[J, -1e-310], U, If[LessEqual[J, 1.4e-243], (-U), If[LessEqual[J, 2.1e-229], U, If[LessEqual[J, 3.6e+99], N[(-2.0 * N[(N[(J * N[(J / U), $MachinePrecision]), $MachinePrecision] + N[(U * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-2.0 * J), $MachinePrecision]]]]]]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
\mathbf{if}\;J \leq -3.4 \cdot 10^{+42}:\\
\;\;\;\;J \cdot \left(-2 + 0.25 \cdot \left(K \cdot K\right)\right)\\
\mathbf{elif}\;J \leq -1 \cdot 10^{-310}:\\
\;\;\;\;U\\
\mathbf{elif}\;J \leq 1.4 \cdot 10^{-243}:\\
\;\;\;\;-U\\
\mathbf{elif}\;J \leq 2.1 \cdot 10^{-229}:\\
\;\;\;\;U\\
\mathbf{elif}\;J \leq 3.6 \cdot 10^{+99}:\\
\;\;\;\;-2 \cdot \left(J \cdot \frac{J}{U} + U \cdot 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot J\\
\end{array}
\end{array}
if J < -3.39999999999999975e42Initial program 95.2%
*-commutative95.2%
associate-*l*95.2%
unpow295.2%
hypot-1-def99.9%
*-commutative99.9%
associate-*l*99.9%
Simplified99.9%
Taylor expanded in J around inf 75.0%
associate-*r*75.0%
*-commutative75.0%
*-commutative75.0%
associate-*r*75.0%
*-commutative75.0%
Simplified75.0%
Taylor expanded in K around 0 45.7%
+-commutative45.7%
associate-*r*45.7%
distribute-rgt-out45.7%
unpow245.7%
Simplified45.7%
if -3.39999999999999975e42 < J < -9.999999999999969e-311 or 1.39999999999999997e-243 < J < 2.09999999999999983e-229Initial program 44.4%
*-commutative44.4%
associate-*l*44.4%
unpow244.4%
hypot-1-def75.1%
*-commutative75.1%
associate-*l*75.1%
Simplified75.1%
Taylor expanded in U around -inf 40.5%
if -9.999999999999969e-311 < J < 1.39999999999999997e-243Initial program 32.6%
*-commutative32.6%
associate-*l*32.6%
unpow232.6%
hypot-1-def61.1%
*-commutative61.1%
associate-*l*61.1%
Simplified61.1%
Taylor expanded in J around 0 42.6%
neg-mul-142.6%
Simplified42.6%
if 2.09999999999999983e-229 < J < 3.6000000000000002e99Initial program 68.1%
*-commutative68.1%
associate-*l*68.1%
unpow268.1%
hypot-1-def84.8%
*-commutative84.8%
associate-*l*84.8%
Simplified84.8%
Taylor expanded in K around 0 35.8%
*-commutative35.8%
unpow235.8%
unpow235.8%
Simplified35.8%
Taylor expanded in J around 0 28.3%
*-commutative28.3%
fma-def28.3%
unpow228.3%
Simplified28.3%
fma-udef28.3%
+-commutative28.3%
associate-*r/28.3%
*-commutative28.3%
Applied egg-rr28.3%
if 3.6000000000000002e99 < J Initial program 99.6%
*-commutative99.6%
associate-*l*99.6%
unpow299.6%
hypot-1-def99.7%
*-commutative99.7%
associate-*l*99.7%
Simplified99.7%
Taylor expanded in K around 0 39.9%
*-commutative39.9%
unpow239.9%
unpow239.9%
Simplified39.9%
Taylor expanded in J around inf 41.4%
Final simplification38.7%
NOTE: U should be positive before calling this function
(FPCore (J K U)
:precision binary64
(if (<= J -2.2e+35)
(* J (+ -2.0 (* 0.25 (* K K))))
(if (<= J -1e-310)
U
(if (<= J 5.8e-243)
(- U)
(if (<= J 2.1e-229)
U
(if (<= J 1.7e+101)
(* -2.0 (+ (* J (/ J U)) (* U 0.5)))
(* -2.0 (+ J (* (/ U (/ J U)) 0.125)))))))))U = abs(U);
double code(double J, double K, double U) {
double tmp;
if (J <= -2.2e+35) {
tmp = J * (-2.0 + (0.25 * (K * K)));
} else if (J <= -1e-310) {
tmp = U;
} else if (J <= 5.8e-243) {
tmp = -U;
} else if (J <= 2.1e-229) {
tmp = U;
} else if (J <= 1.7e+101) {
tmp = -2.0 * ((J * (J / U)) + (U * 0.5));
} else {
tmp = -2.0 * (J + ((U / (J / U)) * 0.125));
}
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.2d+35)) then
tmp = j * ((-2.0d0) + (0.25d0 * (k * k)))
else if (j <= (-1d-310)) then
tmp = u
else if (j <= 5.8d-243) then
tmp = -u
else if (j <= 2.1d-229) then
tmp = u
else if (j <= 1.7d+101) then
tmp = (-2.0d0) * ((j * (j / u)) + (u * 0.5d0))
else
tmp = (-2.0d0) * (j + ((u / (j / u)) * 0.125d0))
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.2e+35) {
tmp = J * (-2.0 + (0.25 * (K * K)));
} else if (J <= -1e-310) {
tmp = U;
} else if (J <= 5.8e-243) {
tmp = -U;
} else if (J <= 2.1e-229) {
tmp = U;
} else if (J <= 1.7e+101) {
tmp = -2.0 * ((J * (J / U)) + (U * 0.5));
} else {
tmp = -2.0 * (J + ((U / (J / U)) * 0.125));
}
return tmp;
}
U = abs(U) def code(J, K, U): tmp = 0 if J <= -2.2e+35: tmp = J * (-2.0 + (0.25 * (K * K))) elif J <= -1e-310: tmp = U elif J <= 5.8e-243: tmp = -U elif J <= 2.1e-229: tmp = U elif J <= 1.7e+101: tmp = -2.0 * ((J * (J / U)) + (U * 0.5)) else: tmp = -2.0 * (J + ((U / (J / U)) * 0.125)) return tmp
U = abs(U) function code(J, K, U) tmp = 0.0 if (J <= -2.2e+35) tmp = Float64(J * Float64(-2.0 + Float64(0.25 * Float64(K * K)))); elseif (J <= -1e-310) tmp = U; elseif (J <= 5.8e-243) tmp = Float64(-U); elseif (J <= 2.1e-229) tmp = U; elseif (J <= 1.7e+101) tmp = Float64(-2.0 * Float64(Float64(J * Float64(J / U)) + Float64(U * 0.5))); else tmp = Float64(-2.0 * Float64(J + Float64(Float64(U / Float64(J / U)) * 0.125))); end return tmp end
U = abs(U) function tmp_2 = code(J, K, U) tmp = 0.0; if (J <= -2.2e+35) tmp = J * (-2.0 + (0.25 * (K * K))); elseif (J <= -1e-310) tmp = U; elseif (J <= 5.8e-243) tmp = -U; elseif (J <= 2.1e-229) tmp = U; elseif (J <= 1.7e+101) tmp = -2.0 * ((J * (J / U)) + (U * 0.5)); else tmp = -2.0 * (J + ((U / (J / U)) * 0.125)); end tmp_2 = tmp; end
NOTE: U should be positive before calling this function code[J_, K_, U_] := If[LessEqual[J, -2.2e+35], N[(J * N[(-2.0 + N[(0.25 * N[(K * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[J, -1e-310], U, If[LessEqual[J, 5.8e-243], (-U), If[LessEqual[J, 2.1e-229], U, If[LessEqual[J, 1.7e+101], N[(-2.0 * N[(N[(J * N[(J / U), $MachinePrecision]), $MachinePrecision] + N[(U * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-2.0 * N[(J + N[(N[(U / N[(J / U), $MachinePrecision]), $MachinePrecision] * 0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
\mathbf{if}\;J \leq -2.2 \cdot 10^{+35}:\\
\;\;\;\;J \cdot \left(-2 + 0.25 \cdot \left(K \cdot K\right)\right)\\
\mathbf{elif}\;J \leq -1 \cdot 10^{-310}:\\
\;\;\;\;U\\
\mathbf{elif}\;J \leq 5.8 \cdot 10^{-243}:\\
\;\;\;\;-U\\
\mathbf{elif}\;J \leq 2.1 \cdot 10^{-229}:\\
\;\;\;\;U\\
\mathbf{elif}\;J \leq 1.7 \cdot 10^{+101}:\\
\;\;\;\;-2 \cdot \left(J \cdot \frac{J}{U} + U \cdot 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \left(J + \frac{U}{\frac{J}{U}} \cdot 0.125\right)\\
\end{array}
\end{array}
if J < -2.1999999999999999e35Initial program 95.2%
*-commutative95.2%
associate-*l*95.2%
unpow295.2%
hypot-1-def99.9%
*-commutative99.9%
associate-*l*99.9%
Simplified99.9%
Taylor expanded in J around inf 75.0%
associate-*r*75.0%
*-commutative75.0%
*-commutative75.0%
associate-*r*75.0%
*-commutative75.0%
Simplified75.0%
Taylor expanded in K around 0 45.7%
+-commutative45.7%
associate-*r*45.7%
distribute-rgt-out45.7%
unpow245.7%
Simplified45.7%
if -2.1999999999999999e35 < J < -9.999999999999969e-311 or 5.79999999999999953e-243 < J < 2.09999999999999983e-229Initial program 44.4%
*-commutative44.4%
associate-*l*44.4%
unpow244.4%
hypot-1-def75.1%
*-commutative75.1%
associate-*l*75.1%
Simplified75.1%
Taylor expanded in U around -inf 40.5%
if -9.999999999999969e-311 < J < 5.79999999999999953e-243Initial program 32.6%
*-commutative32.6%
associate-*l*32.6%
unpow232.6%
hypot-1-def61.1%
*-commutative61.1%
associate-*l*61.1%
Simplified61.1%
Taylor expanded in J around 0 42.6%
neg-mul-142.6%
Simplified42.6%
if 2.09999999999999983e-229 < J < 1.70000000000000009e101Initial program 68.1%
*-commutative68.1%
associate-*l*68.1%
unpow268.1%
hypot-1-def84.8%
*-commutative84.8%
associate-*l*84.8%
Simplified84.8%
Taylor expanded in K around 0 35.8%
*-commutative35.8%
unpow235.8%
unpow235.8%
Simplified35.8%
Taylor expanded in J around 0 28.3%
*-commutative28.3%
fma-def28.3%
unpow228.3%
Simplified28.3%
fma-udef28.3%
+-commutative28.3%
associate-*r/28.3%
*-commutative28.3%
Applied egg-rr28.3%
if 1.70000000000000009e101 < J Initial program 99.6%
*-commutative99.6%
associate-*l*99.6%
unpow299.6%
hypot-1-def99.7%
*-commutative99.7%
associate-*l*99.7%
Simplified99.7%
Taylor expanded in K around 0 39.9%
*-commutative39.9%
unpow239.9%
unpow239.9%
Simplified39.9%
Taylor expanded in J around inf 40.7%
*-commutative40.7%
fma-def40.7%
unpow240.7%
associate-*r/41.4%
Simplified41.4%
fma-udef41.4%
clear-num41.4%
un-div-inv41.4%
Applied egg-rr41.4%
Final simplification38.7%
NOTE: U should be positive before calling this function
(FPCore (J K U)
:precision binary64
(if (<= J -2.1e+64)
(* -2.0 J)
(if (<= J -1e-310)
U
(if (<= J 5.8e-243)
(- U)
(if (<= J 3.1e-229) U (if (<= J 3.7e+99) (- U) (* -2.0 J)))))))U = abs(U);
double code(double J, double K, double U) {
double tmp;
if (J <= -2.1e+64) {
tmp = -2.0 * J;
} else if (J <= -1e-310) {
tmp = U;
} else if (J <= 5.8e-243) {
tmp = -U;
} else if (J <= 3.1e-229) {
tmp = U;
} else if (J <= 3.7e+99) {
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.1d+64)) then
tmp = (-2.0d0) * j
else if (j <= (-1d-310)) then
tmp = u
else if (j <= 5.8d-243) then
tmp = -u
else if (j <= 3.1d-229) then
tmp = u
else if (j <= 3.7d+99) 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.1e+64) {
tmp = -2.0 * J;
} else if (J <= -1e-310) {
tmp = U;
} else if (J <= 5.8e-243) {
tmp = -U;
} else if (J <= 3.1e-229) {
tmp = U;
} else if (J <= 3.7e+99) {
tmp = -U;
} else {
tmp = -2.0 * J;
}
return tmp;
}
U = abs(U) def code(J, K, U): tmp = 0 if J <= -2.1e+64: tmp = -2.0 * J elif J <= -1e-310: tmp = U elif J <= 5.8e-243: tmp = -U elif J <= 3.1e-229: tmp = U elif J <= 3.7e+99: tmp = -U else: tmp = -2.0 * J return tmp
U = abs(U) function code(J, K, U) tmp = 0.0 if (J <= -2.1e+64) tmp = Float64(-2.0 * J); elseif (J <= -1e-310) tmp = U; elseif (J <= 5.8e-243) tmp = Float64(-U); elseif (J <= 3.1e-229) tmp = U; elseif (J <= 3.7e+99) 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.1e+64) tmp = -2.0 * J; elseif (J <= -1e-310) tmp = U; elseif (J <= 5.8e-243) tmp = -U; elseif (J <= 3.1e-229) tmp = U; elseif (J <= 3.7e+99) 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.1e+64], N[(-2.0 * J), $MachinePrecision], If[LessEqual[J, -1e-310], U, If[LessEqual[J, 5.8e-243], (-U), If[LessEqual[J, 3.1e-229], U, If[LessEqual[J, 3.7e+99], (-U), N[(-2.0 * J), $MachinePrecision]]]]]]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
\mathbf{if}\;J \leq -2.1 \cdot 10^{+64}:\\
\;\;\;\;-2 \cdot J\\
\mathbf{elif}\;J \leq -1 \cdot 10^{-310}:\\
\;\;\;\;U\\
\mathbf{elif}\;J \leq 5.8 \cdot 10^{-243}:\\
\;\;\;\;-U\\
\mathbf{elif}\;J \leq 3.1 \cdot 10^{-229}:\\
\;\;\;\;U\\
\mathbf{elif}\;J \leq 3.7 \cdot 10^{+99}:\\
\;\;\;\;-U\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot J\\
\end{array}
\end{array}
if J < -2.1e64 or 3.7000000000000001e99 < J Initial program 97.8%
*-commutative97.8%
associate-*l*97.8%
unpow297.8%
hypot-1-def99.8%
*-commutative99.8%
associate-*l*99.8%
Simplified99.8%
Taylor expanded in K around 0 41.9%
*-commutative41.9%
unpow241.9%
unpow241.9%
Simplified41.9%
Taylor expanded in J around inf 46.0%
if -2.1e64 < J < -9.999999999999969e-311 or 5.79999999999999953e-243 < J < 3.1000000000000001e-229Initial program 48.8%
*-commutative48.8%
associate-*l*48.8%
unpow248.8%
hypot-1-def77.6%
*-commutative77.6%
associate-*l*77.6%
Simplified77.6%
Taylor expanded in U around -inf 39.2%
if -9.999999999999969e-311 < J < 5.79999999999999953e-243 or 3.1000000000000001e-229 < J < 3.7000000000000001e99Initial program 61.0%
*-commutative61.0%
associate-*l*61.0%
unpow261.0%
hypot-1-def80.0%
*-commutative80.0%
associate-*l*80.0%
Simplified80.0%
Taylor expanded in J around 0 31.2%
neg-mul-131.2%
Simplified31.2%
Final simplification38.9%
NOTE: U should be positive before calling this function
(FPCore (J K U)
:precision binary64
(if (<= J -4.8e+40)
(* J (+ -2.0 (* 0.25 (* K K))))
(if (<= J -1e-310)
U
(if (<= J 4.6e-243)
(- U)
(if (<= J 2.2e-229) U (if (<= J 1.9e+101) (- U) (* -2.0 J)))))))U = abs(U);
double code(double J, double K, double U) {
double tmp;
if (J <= -4.8e+40) {
tmp = J * (-2.0 + (0.25 * (K * K)));
} else if (J <= -1e-310) {
tmp = U;
} else if (J <= 4.6e-243) {
tmp = -U;
} else if (J <= 2.2e-229) {
tmp = U;
} else if (J <= 1.9e+101) {
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 <= (-4.8d+40)) then
tmp = j * ((-2.0d0) + (0.25d0 * (k * k)))
else if (j <= (-1d-310)) then
tmp = u
else if (j <= 4.6d-243) then
tmp = -u
else if (j <= 2.2d-229) then
tmp = u
else if (j <= 1.9d+101) 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 <= -4.8e+40) {
tmp = J * (-2.0 + (0.25 * (K * K)));
} else if (J <= -1e-310) {
tmp = U;
} else if (J <= 4.6e-243) {
tmp = -U;
} else if (J <= 2.2e-229) {
tmp = U;
} else if (J <= 1.9e+101) {
tmp = -U;
} else {
tmp = -2.0 * J;
}
return tmp;
}
U = abs(U) def code(J, K, U): tmp = 0 if J <= -4.8e+40: tmp = J * (-2.0 + (0.25 * (K * K))) elif J <= -1e-310: tmp = U elif J <= 4.6e-243: tmp = -U elif J <= 2.2e-229: tmp = U elif J <= 1.9e+101: tmp = -U else: tmp = -2.0 * J return tmp
U = abs(U) function code(J, K, U) tmp = 0.0 if (J <= -4.8e+40) tmp = Float64(J * Float64(-2.0 + Float64(0.25 * Float64(K * K)))); elseif (J <= -1e-310) tmp = U; elseif (J <= 4.6e-243) tmp = Float64(-U); elseif (J <= 2.2e-229) tmp = U; elseif (J <= 1.9e+101) 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 <= -4.8e+40) tmp = J * (-2.0 + (0.25 * (K * K))); elseif (J <= -1e-310) tmp = U; elseif (J <= 4.6e-243) tmp = -U; elseif (J <= 2.2e-229) tmp = U; elseif (J <= 1.9e+101) 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, -4.8e+40], N[(J * N[(-2.0 + N[(0.25 * N[(K * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[J, -1e-310], U, If[LessEqual[J, 4.6e-243], (-U), If[LessEqual[J, 2.2e-229], U, If[LessEqual[J, 1.9e+101], (-U), N[(-2.0 * J), $MachinePrecision]]]]]]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
\mathbf{if}\;J \leq -4.8 \cdot 10^{+40}:\\
\;\;\;\;J \cdot \left(-2 + 0.25 \cdot \left(K \cdot K\right)\right)\\
\mathbf{elif}\;J \leq -1 \cdot 10^{-310}:\\
\;\;\;\;U\\
\mathbf{elif}\;J \leq 4.6 \cdot 10^{-243}:\\
\;\;\;\;-U\\
\mathbf{elif}\;J \leq 2.2 \cdot 10^{-229}:\\
\;\;\;\;U\\
\mathbf{elif}\;J \leq 1.9 \cdot 10^{+101}:\\
\;\;\;\;-U\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot J\\
\end{array}
\end{array}
if J < -4.8e40Initial program 95.2%
*-commutative95.2%
associate-*l*95.2%
unpow295.2%
hypot-1-def99.9%
*-commutative99.9%
associate-*l*99.9%
Simplified99.9%
Taylor expanded in J around inf 75.0%
associate-*r*75.0%
*-commutative75.0%
*-commutative75.0%
associate-*r*75.0%
*-commutative75.0%
Simplified75.0%
Taylor expanded in K around 0 45.7%
+-commutative45.7%
associate-*r*45.7%
distribute-rgt-out45.7%
unpow245.7%
Simplified45.7%
if -4.8e40 < J < -9.999999999999969e-311 or 4.6e-243 < J < 2.1999999999999999e-229Initial program 44.4%
*-commutative44.4%
associate-*l*44.4%
unpow244.4%
hypot-1-def75.1%
*-commutative75.1%
associate-*l*75.1%
Simplified75.1%
Taylor expanded in U around -inf 40.5%
if -9.999999999999969e-311 < J < 4.6e-243 or 2.1999999999999999e-229 < J < 1.8999999999999999e101Initial program 61.0%
*-commutative61.0%
associate-*l*61.0%
unpow261.0%
hypot-1-def80.0%
*-commutative80.0%
associate-*l*80.0%
Simplified80.0%
Taylor expanded in J around 0 31.2%
neg-mul-131.2%
Simplified31.2%
if 1.8999999999999999e101 < J Initial program 99.6%
*-commutative99.6%
associate-*l*99.6%
unpow299.6%
hypot-1-def99.7%
*-commutative99.7%
associate-*l*99.7%
Simplified99.7%
Taylor expanded in K around 0 39.9%
*-commutative39.9%
unpow239.9%
unpow239.9%
Simplified39.9%
Taylor expanded in J around inf 41.4%
Final simplification38.7%
NOTE: U should be positive before calling this function (FPCore (J K U) :precision binary64 (if (<= J 1e-308) U (if (<= J 5.8e-243) (- U) (if (<= J 2.1e-229) U (- U)))))
U = abs(U);
double code(double J, double K, double U) {
double tmp;
if (J <= 1e-308) {
tmp = U;
} else if (J <= 5.8e-243) {
tmp = -U;
} else if (J <= 2.1e-229) {
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-308) then
tmp = u
else if (j <= 5.8d-243) then
tmp = -u
else if (j <= 2.1d-229) 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-308) {
tmp = U;
} else if (J <= 5.8e-243) {
tmp = -U;
} else if (J <= 2.1e-229) {
tmp = U;
} else {
tmp = -U;
}
return tmp;
}
U = abs(U) def code(J, K, U): tmp = 0 if J <= 1e-308: tmp = U elif J <= 5.8e-243: tmp = -U elif J <= 2.1e-229: tmp = U else: tmp = -U return tmp
U = abs(U) function code(J, K, U) tmp = 0.0 if (J <= 1e-308) tmp = U; elseif (J <= 5.8e-243) tmp = Float64(-U); elseif (J <= 2.1e-229) 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-308) tmp = U; elseif (J <= 5.8e-243) tmp = -U; elseif (J <= 2.1e-229) 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-308], U, If[LessEqual[J, 5.8e-243], (-U), If[LessEqual[J, 2.1e-229], U, (-U)]]]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
\mathbf{if}\;J \leq 10^{-308}:\\
\;\;\;\;U\\
\mathbf{elif}\;J \leq 5.8 \cdot 10^{-243}:\\
\;\;\;\;-U\\
\mathbf{elif}\;J \leq 2.1 \cdot 10^{-229}:\\
\;\;\;\;U\\
\mathbf{else}:\\
\;\;\;\;-U\\
\end{array}
\end{array}
if J < 9.9999999999999991e-309 or 5.79999999999999953e-243 < J < 2.09999999999999983e-229Initial program 67.1%
*-commutative67.1%
associate-*l*67.1%
unpow267.1%
hypot-1-def86.2%
*-commutative86.2%
associate-*l*86.2%
Simplified86.2%
Taylor expanded in U around -inf 28.1%
if 9.9999999999999991e-309 < J < 5.79999999999999953e-243 or 2.09999999999999983e-229 < J Initial program 73.6%
*-commutative73.6%
associate-*l*73.6%
unpow273.6%
hypot-1-def86.4%
*-commutative86.4%
associate-*l*86.4%
Simplified86.4%
Taylor expanded in J around 0 23.8%
neg-mul-123.8%
Simplified23.8%
Final simplification26.0%
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 70.3%
*-commutative70.3%
associate-*l*70.3%
unpow270.3%
hypot-1-def86.3%
*-commutative86.3%
associate-*l*86.3%
Simplified86.3%
Taylor expanded in U around -inf 30.3%
Final simplification30.3%
herbie shell --seed 2023192
(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)))))