
(FPCore (J K U) :precision binary64 (let* ((t_0 (cos (/ K 2.0)))) (* (* (* -2.0 J) t_0) (sqrt (+ 1.0 (pow (/ U (* (* 2.0 J) t_0)) 2.0))))))
double code(double J, double K, double U) {
double t_0 = cos((K / 2.0));
return ((-2.0 * J) * t_0) * sqrt((1.0 + pow((U / ((2.0 * J) * t_0)), 2.0)));
}
real(8) function code(j, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: t_0
t_0 = cos((k / 2.0d0))
code = (((-2.0d0) * j) * t_0) * sqrt((1.0d0 + ((u / ((2.0d0 * j) * t_0)) ** 2.0d0)))
end function
public static double code(double J, double K, double U) {
double t_0 = Math.cos((K / 2.0));
return ((-2.0 * J) * t_0) * Math.sqrt((1.0 + Math.pow((U / ((2.0 * J) * t_0)), 2.0)));
}
def code(J, K, U): t_0 = math.cos((K / 2.0)) return ((-2.0 * J) * t_0) * math.sqrt((1.0 + math.pow((U / ((2.0 * J) * t_0)), 2.0)))
function code(J, K, U) t_0 = cos(Float64(K / 2.0)) return Float64(Float64(Float64(-2.0 * J) * t_0) * sqrt(Float64(1.0 + (Float64(U / Float64(Float64(2.0 * J) * t_0)) ^ 2.0)))) end
function tmp = code(J, K, U) t_0 = cos((K / 2.0)); tmp = ((-2.0 * J) * t_0) * sqrt((1.0 + ((U / ((2.0 * J) * t_0)) ^ 2.0))); end
code[J_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, N[(N[(N[(-2.0 * J), $MachinePrecision] * t$95$0), $MachinePrecision] * N[Sqrt[N[(1.0 + N[Power[N[(U / N[(N[(2.0 * J), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\left(\left(-2 \cdot J\right) \cdot t_0\right) \cdot \sqrt{1 + {\left(\frac{U}{\left(2 \cdot J\right) \cdot t_0}\right)}^{2}}
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (J K U) :precision binary64 (let* ((t_0 (cos (/ K 2.0)))) (* (* (* -2.0 J) t_0) (sqrt (+ 1.0 (pow (/ U (* (* 2.0 J) t_0)) 2.0))))))
double code(double J, double K, double U) {
double t_0 = cos((K / 2.0));
return ((-2.0 * J) * t_0) * sqrt((1.0 + pow((U / ((2.0 * J) * t_0)), 2.0)));
}
real(8) function code(j, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: t_0
t_0 = cos((k / 2.0d0))
code = (((-2.0d0) * j) * t_0) * sqrt((1.0d0 + ((u / ((2.0d0 * j) * t_0)) ** 2.0d0)))
end function
public static double code(double J, double K, double U) {
double t_0 = Math.cos((K / 2.0));
return ((-2.0 * J) * t_0) * Math.sqrt((1.0 + Math.pow((U / ((2.0 * J) * t_0)), 2.0)));
}
def code(J, K, U): t_0 = math.cos((K / 2.0)) return ((-2.0 * J) * t_0) * math.sqrt((1.0 + math.pow((U / ((2.0 * J) * t_0)), 2.0)))
function code(J, K, U) t_0 = cos(Float64(K / 2.0)) return Float64(Float64(Float64(-2.0 * J) * t_0) * sqrt(Float64(1.0 + (Float64(U / Float64(Float64(2.0 * J) * t_0)) ^ 2.0)))) end
function tmp = code(J, K, U) t_0 = cos((K / 2.0)); tmp = ((-2.0 * J) * t_0) * sqrt((1.0 + ((U / ((2.0 * J) * t_0)) ^ 2.0))); end
code[J_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, N[(N[(N[(-2.0 * J), $MachinePrecision] * t$95$0), $MachinePrecision] * N[Sqrt[N[(1.0 + N[Power[N[(U / N[(N[(2.0 * J), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\left(\left(-2 \cdot J\right) \cdot t_0\right) \cdot \sqrt{1 + {\left(\frac{U}{\left(2 \cdot J\right) \cdot t_0}\right)}^{2}}
\end{array}
\end{array}
NOTE: U should be positive before calling this function
(FPCore (J K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0)))
(t_1
(*
(* (* -2.0 J) t_0)
(sqrt (+ 1.0 (pow (/ U (* t_0 (* J 2.0))) 2.0))))))
(if (<= t_1 (- INFINITY)) (- U) (if (<= t_1 5e+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 <= 5e+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 <= 5e+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 <= 5e+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 <= 5e+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 <= 5e+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, 5e+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 5 \cdot 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 6.1%
*-commutative6.1%
associate-*l*6.1%
associate-*r*6.1%
*-commutative6.1%
associate-*l*6.1%
*-commutative6.1%
unpow26.1%
hypot-1-def56.1%
*-commutative56.1%
associate-*l*56.1%
Simplified56.1%
Taylor expanded in J around 0 58.6%
neg-mul-158.6%
Simplified58.6%
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)))) < 5e307Initial program 99.8%
if 5e307 < (*.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 7.7%
*-commutative7.7%
associate-*l*7.7%
associate-*r*7.7%
*-commutative7.7%
associate-*l*7.7%
*-commutative7.7%
unpow27.7%
hypot-1-def55.1%
*-commutative55.1%
associate-*l*55.1%
Simplified55.1%
Taylor expanded in U around -inf 62.8%
Final simplification88.2%
NOTE: U should be positive before calling this function
(FPCore (J K U)
:precision binary64
(let* ((t_0 (cos (* K 0.5)))
(t_1 (hypot 1.0 (/ U (* J 2.0))))
(t_2 (* (* (* -2.0 J) t_1) t_0)))
(if (<= J -7.8e-125)
t_2
(if (<= J 8.2e-298)
U
(if (<= J 8.6e-159)
(- U)
(if (<= J 5.5e-121)
(* J (+ 1.0 (fma t_1 (* -2.0 t_0) -1.0)))
(if (<= J 5.6e-65) (- U) t_2)))))))U = abs(U);
double code(double J, double K, double U) {
double t_0 = cos((K * 0.5));
double t_1 = hypot(1.0, (U / (J * 2.0)));
double t_2 = ((-2.0 * J) * t_1) * t_0;
double tmp;
if (J <= -7.8e-125) {
tmp = t_2;
} else if (J <= 8.2e-298) {
tmp = U;
} else if (J <= 8.6e-159) {
tmp = -U;
} else if (J <= 5.5e-121) {
tmp = J * (1.0 + fma(t_1, (-2.0 * t_0), -1.0));
} else if (J <= 5.6e-65) {
tmp = -U;
} else {
tmp = t_2;
}
return tmp;
}
U = abs(U) function code(J, K, U) t_0 = cos(Float64(K * 0.5)) t_1 = hypot(1.0, Float64(U / Float64(J * 2.0))) t_2 = Float64(Float64(Float64(-2.0 * J) * t_1) * t_0) tmp = 0.0 if (J <= -7.8e-125) tmp = t_2; elseif (J <= 8.2e-298) tmp = U; elseif (J <= 8.6e-159) tmp = Float64(-U); elseif (J <= 5.5e-121) tmp = Float64(J * Float64(1.0 + fma(t_1, Float64(-2.0 * t_0), -1.0))); elseif (J <= 5.6e-65) tmp = Float64(-U); else tmp = t_2; 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[Sqrt[1.0 ^ 2 + N[(U / N[(J * 2.0), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(-2.0 * J), $MachinePrecision] * t$95$1), $MachinePrecision] * t$95$0), $MachinePrecision]}, If[LessEqual[J, -7.8e-125], t$95$2, If[LessEqual[J, 8.2e-298], U, If[LessEqual[J, 8.6e-159], (-U), If[LessEqual[J, 5.5e-121], N[(J * N[(1.0 + N[(t$95$1 * N[(-2.0 * t$95$0), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[J, 5.6e-65], (-U), t$95$2]]]]]]]]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
t_0 := \cos \left(K \cdot 0.5\right)\\
t_1 := \mathsf{hypot}\left(1, \frac{U}{J \cdot 2}\right)\\
t_2 := \left(\left(-2 \cdot J\right) \cdot t_1\right) \cdot t_0\\
\mathbf{if}\;J \leq -7.8 \cdot 10^{-125}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;J \leq 8.2 \cdot 10^{-298}:\\
\;\;\;\;U\\
\mathbf{elif}\;J \leq 8.6 \cdot 10^{-159}:\\
\;\;\;\;-U\\
\mathbf{elif}\;J \leq 5.5 \cdot 10^{-121}:\\
\;\;\;\;J \cdot \left(1 + \mathsf{fma}\left(t_1, -2 \cdot t_0, -1\right)\right)\\
\mathbf{elif}\;J \leq 5.6 \cdot 10^{-65}:\\
\;\;\;\;-U\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if J < -7.79999999999999965e-125 or 5.6000000000000001e-65 < J Initial program 88.9%
*-commutative88.9%
associate-*l*88.9%
associate-*r*88.9%
*-commutative88.9%
associate-*l*88.8%
*-commutative88.8%
unpow288.8%
hypot-1-def98.4%
*-commutative98.4%
associate-*l*98.4%
Simplified98.4%
add-cube-cbrt96.8%
pow396.8%
Applied egg-rr96.8%
rem-cube-cbrt98.4%
associate-*r*98.4%
*-commutative98.4%
associate-*r*98.5%
Applied egg-rr98.5%
Taylor expanded in K around 0 85.3%
if -7.79999999999999965e-125 < J < 8.1999999999999997e-298Initial program 28.5%
*-commutative28.5%
associate-*l*28.5%
associate-*r*28.5%
*-commutative28.5%
associate-*l*28.5%
*-commutative28.5%
unpow228.5%
hypot-1-def62.2%
*-commutative62.2%
associate-*l*62.2%
Simplified62.2%
Taylor expanded in U around -inf 60.9%
if 8.1999999999999997e-298 < J < 8.6e-159 or 5.50000000000000031e-121 < J < 5.6000000000000001e-65Initial program 54.9%
*-commutative54.9%
associate-*l*54.9%
associate-*r*54.9%
*-commutative54.9%
associate-*l*54.8%
*-commutative54.8%
unpow254.8%
hypot-1-def67.6%
*-commutative67.6%
associate-*l*67.6%
Simplified67.6%
Taylor expanded in J around 0 40.3%
neg-mul-140.3%
Simplified40.3%
if 8.6e-159 < J < 5.50000000000000031e-121Initial program 78.6%
*-commutative78.6%
associate-*l*78.6%
associate-*r*78.6%
*-commutative78.6%
associate-*l*78.6%
*-commutative78.6%
unpow278.6%
hypot-1-def99.7%
*-commutative99.7%
associate-*l*99.7%
Simplified99.7%
expm1-log1p-u31.8%
associate-*r*31.8%
*-commutative31.8%
associate-*l*31.8%
div-inv31.8%
metadata-eval31.8%
*-commutative31.8%
*-commutative31.8%
associate-*l*31.8%
div-inv31.8%
metadata-eval31.8%
*-commutative31.8%
Applied egg-rr31.8%
expm1-udef31.8%
sub-neg31.8%
log1p-udef31.8%
add-exp-log99.7%
*-commutative99.7%
*-commutative99.7%
associate-*l*99.7%
metadata-eval99.7%
Applied egg-rr99.7%
associate-+l+99.7%
metadata-eval99.7%
sub-neg99.7%
*-commutative99.7%
fma-neg99.7%
*-commutative99.7%
*-commutative99.7%
*-commutative99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in K around 0 88.9%
*-commutative88.9%
Simplified88.9%
Final simplification72.5%
NOTE: U should be positive before calling this function (FPCore (J K U) :precision binary64 (let* ((t_0 (cos (/ K 2.0)))) (* J (* t_0 (* -2.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 * (t_0 * (-2.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 * (t_0 * (-2.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 * (t_0 * (-2.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(J * Float64(t_0 * Float64(-2.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 * (t_0 * (-2.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[(J * N[(t$95$0 * N[(-2.0 * N[Sqrt[1.0 ^ 2 + N[(U / N[(J * N[(2.0 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
J \cdot \left(t_0 \cdot \left(-2 \cdot \mathsf{hypot}\left(1, \frac{U}{J \cdot \left(2 \cdot t_0\right)}\right)\right)\right)
\end{array}
\end{array}
Initial program 72.2%
*-commutative72.2%
associate-*l*72.2%
associate-*r*72.2%
*-commutative72.2%
associate-*l*72.1%
*-commutative72.1%
unpow272.1%
hypot-1-def86.6%
*-commutative86.6%
associate-*l*86.6%
Simplified86.6%
Final simplification86.6%
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 72.2%
*-commutative72.2%
associate-*l*72.2%
unpow272.2%
hypot-1-def86.7%
*-commutative86.7%
associate-*l*86.7%
Simplified86.7%
Final simplification86.7%
NOTE: U should be positive before calling this function
(FPCore (J K U)
:precision binary64
(let* ((t_0 (* (* J (* -2.0 (cos (/ K 2.0)))) (hypot 1.0 (/ U (* J 2.0))))))
(if (<= J -1.5e-124)
t_0
(if (<= J 8.2e-298)
U
(if (or (<= J 2.25e-150) (and (not (<= J 8.5e-122)) (<= J 6.8e-65)))
(- U)
t_0)))))U = abs(U);
double code(double J, double K, double U) {
double t_0 = (J * (-2.0 * cos((K / 2.0)))) * hypot(1.0, (U / (J * 2.0)));
double tmp;
if (J <= -1.5e-124) {
tmp = t_0;
} else if (J <= 8.2e-298) {
tmp = U;
} else if ((J <= 2.25e-150) || (!(J <= 8.5e-122) && (J <= 6.8e-65))) {
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 = (J * (-2.0 * Math.cos((K / 2.0)))) * Math.hypot(1.0, (U / (J * 2.0)));
double tmp;
if (J <= -1.5e-124) {
tmp = t_0;
} else if (J <= 8.2e-298) {
tmp = U;
} else if ((J <= 2.25e-150) || (!(J <= 8.5e-122) && (J <= 6.8e-65))) {
tmp = -U;
} else {
tmp = t_0;
}
return tmp;
}
U = abs(U) def code(J, K, U): t_0 = (J * (-2.0 * math.cos((K / 2.0)))) * math.hypot(1.0, (U / (J * 2.0))) tmp = 0 if J <= -1.5e-124: tmp = t_0 elif J <= 8.2e-298: tmp = U elif (J <= 2.25e-150) or (not (J <= 8.5e-122) and (J <= 6.8e-65)): tmp = -U else: tmp = t_0 return tmp
U = abs(U) function code(J, K, U) t_0 = Float64(Float64(J * Float64(-2.0 * cos(Float64(K / 2.0)))) * hypot(1.0, Float64(U / Float64(J * 2.0)))) tmp = 0.0 if (J <= -1.5e-124) tmp = t_0; elseif (J <= 8.2e-298) tmp = U; elseif ((J <= 2.25e-150) || (!(J <= 8.5e-122) && (J <= 6.8e-65))) tmp = Float64(-U); else tmp = t_0; end return tmp end
U = abs(U) function tmp_2 = code(J, K, U) t_0 = (J * (-2.0 * cos((K / 2.0)))) * hypot(1.0, (U / (J * 2.0))); tmp = 0.0; if (J <= -1.5e-124) tmp = t_0; elseif (J <= 8.2e-298) tmp = U; elseif ((J <= 2.25e-150) || (~((J <= 8.5e-122)) && (J <= 6.8e-65))) 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[(N[(J * N[(-2.0 * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[1.0 ^ 2 + N[(U / N[(J * 2.0), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[J, -1.5e-124], t$95$0, If[LessEqual[J, 8.2e-298], U, If[Or[LessEqual[J, 2.25e-150], And[N[Not[LessEqual[J, 8.5e-122]], $MachinePrecision], LessEqual[J, 6.8e-65]]], (-U), t$95$0]]]]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
t_0 := \left(J \cdot \left(-2 \cdot \cos \left(\frac{K}{2}\right)\right)\right) \cdot \mathsf{hypot}\left(1, \frac{U}{J \cdot 2}\right)\\
\mathbf{if}\;J \leq -1.5 \cdot 10^{-124}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;J \leq 8.2 \cdot 10^{-298}:\\
\;\;\;\;U\\
\mathbf{elif}\;J \leq 2.25 \cdot 10^{-150} \lor \neg \left(J \leq 8.5 \cdot 10^{-122}\right) \land J \leq 6.8 \cdot 10^{-65}:\\
\;\;\;\;-U\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if J < -1.5e-124 or 2.2500000000000001e-150 < J < 8.50000000000000003e-122 or 6.79999999999999973e-65 < J Initial program 88.4%
*-commutative88.4%
associate-*l*88.4%
unpow288.4%
hypot-1-def98.6%
*-commutative98.6%
associate-*l*98.6%
Simplified98.6%
Taylor expanded in K around 0 85.5%
if -1.5e-124 < J < 8.1999999999999997e-298Initial program 28.5%
*-commutative28.5%
associate-*l*28.5%
associate-*r*28.5%
*-commutative28.5%
associate-*l*28.5%
*-commutative28.5%
unpow228.5%
hypot-1-def62.2%
*-commutative62.2%
associate-*l*62.2%
Simplified62.2%
Taylor expanded in U around -inf 60.9%
if 8.1999999999999997e-298 < J < 2.2500000000000001e-150 or 8.50000000000000003e-122 < J < 6.79999999999999973e-65Initial program 54.9%
*-commutative54.9%
associate-*l*54.9%
associate-*r*54.9%
*-commutative54.9%
associate-*l*54.8%
*-commutative54.8%
unpow254.8%
hypot-1-def67.6%
*-commutative67.6%
associate-*l*67.6%
Simplified67.6%
Taylor expanded in J around 0 40.3%
neg-mul-140.3%
Simplified40.3%
Final simplification72.5%
NOTE: U should be positive before calling this function
(FPCore (J K U)
:precision binary64
(let* ((t_0 (hypot 1.0 (/ U (* J 2.0))))
(t_1 (* (* (* -2.0 J) t_0) (cos (* K 0.5)))))
(if (<= J -1.3e-123)
t_1
(if (<= J 8.2e-298)
U
(if (<= J 7e-154)
(- U)
(if (<= J 5.5e-122)
(* (* J (* -2.0 (cos (/ K 2.0)))) t_0)
(if (<= J 1.6e-64) (- U) t_1)))))))U = abs(U);
double code(double J, double K, double U) {
double t_0 = hypot(1.0, (U / (J * 2.0)));
double t_1 = ((-2.0 * J) * t_0) * cos((K * 0.5));
double tmp;
if (J <= -1.3e-123) {
tmp = t_1;
} else if (J <= 8.2e-298) {
tmp = U;
} else if (J <= 7e-154) {
tmp = -U;
} else if (J <= 5.5e-122) {
tmp = (J * (-2.0 * cos((K / 2.0)))) * t_0;
} else if (J <= 1.6e-64) {
tmp = -U;
} else {
tmp = t_1;
}
return tmp;
}
U = Math.abs(U);
public static double code(double J, double K, double U) {
double t_0 = Math.hypot(1.0, (U / (J * 2.0)));
double t_1 = ((-2.0 * J) * t_0) * Math.cos((K * 0.5));
double tmp;
if (J <= -1.3e-123) {
tmp = t_1;
} else if (J <= 8.2e-298) {
tmp = U;
} else if (J <= 7e-154) {
tmp = -U;
} else if (J <= 5.5e-122) {
tmp = (J * (-2.0 * Math.cos((K / 2.0)))) * t_0;
} else if (J <= 1.6e-64) {
tmp = -U;
} else {
tmp = t_1;
}
return tmp;
}
U = abs(U) def code(J, K, U): t_0 = math.hypot(1.0, (U / (J * 2.0))) t_1 = ((-2.0 * J) * t_0) * math.cos((K * 0.5)) tmp = 0 if J <= -1.3e-123: tmp = t_1 elif J <= 8.2e-298: tmp = U elif J <= 7e-154: tmp = -U elif J <= 5.5e-122: tmp = (J * (-2.0 * math.cos((K / 2.0)))) * t_0 elif J <= 1.6e-64: tmp = -U else: tmp = t_1 return tmp
U = abs(U) function code(J, K, U) t_0 = hypot(1.0, Float64(U / Float64(J * 2.0))) t_1 = Float64(Float64(Float64(-2.0 * J) * t_0) * cos(Float64(K * 0.5))) tmp = 0.0 if (J <= -1.3e-123) tmp = t_1; elseif (J <= 8.2e-298) tmp = U; elseif (J <= 7e-154) tmp = Float64(-U); elseif (J <= 5.5e-122) tmp = Float64(Float64(J * Float64(-2.0 * cos(Float64(K / 2.0)))) * t_0); elseif (J <= 1.6e-64) tmp = Float64(-U); else tmp = t_1; end return tmp end
U = abs(U) function tmp_2 = code(J, K, U) t_0 = hypot(1.0, (U / (J * 2.0))); t_1 = ((-2.0 * J) * t_0) * cos((K * 0.5)); tmp = 0.0; if (J <= -1.3e-123) tmp = t_1; elseif (J <= 8.2e-298) tmp = U; elseif (J <= 7e-154) tmp = -U; elseif (J <= 5.5e-122) tmp = (J * (-2.0 * cos((K / 2.0)))) * t_0; elseif (J <= 1.6e-64) tmp = -U; else tmp = t_1; end tmp_2 = tmp; end
NOTE: U should be positive before calling this function
code[J_, K_, U_] := Block[{t$95$0 = N[Sqrt[1.0 ^ 2 + N[(U / N[(J * 2.0), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(-2.0 * J), $MachinePrecision] * t$95$0), $MachinePrecision] * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[J, -1.3e-123], t$95$1, If[LessEqual[J, 8.2e-298], U, If[LessEqual[J, 7e-154], (-U), If[LessEqual[J, 5.5e-122], N[(N[(J * N[(-2.0 * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[J, 1.6e-64], (-U), t$95$1]]]]]]]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
t_0 := \mathsf{hypot}\left(1, \frac{U}{J \cdot 2}\right)\\
t_1 := \left(\left(-2 \cdot J\right) \cdot t_0\right) \cdot \cos \left(K \cdot 0.5\right)\\
\mathbf{if}\;J \leq -1.3 \cdot 10^{-123}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;J \leq 8.2 \cdot 10^{-298}:\\
\;\;\;\;U\\
\mathbf{elif}\;J \leq 7 \cdot 10^{-154}:\\
\;\;\;\;-U\\
\mathbf{elif}\;J \leq 5.5 \cdot 10^{-122}:\\
\;\;\;\;\left(J \cdot \left(-2 \cdot \cos \left(\frac{K}{2}\right)\right)\right) \cdot t_0\\
\mathbf{elif}\;J \leq 1.6 \cdot 10^{-64}:\\
\;\;\;\;-U\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if J < -1.29999999999999998e-123 or 1.59999999999999988e-64 < J Initial program 88.9%
*-commutative88.9%
associate-*l*88.9%
associate-*r*88.9%
*-commutative88.9%
associate-*l*88.8%
*-commutative88.8%
unpow288.8%
hypot-1-def98.4%
*-commutative98.4%
associate-*l*98.4%
Simplified98.4%
add-cube-cbrt96.8%
pow396.8%
Applied egg-rr96.8%
rem-cube-cbrt98.4%
associate-*r*98.4%
*-commutative98.4%
associate-*r*98.5%
Applied egg-rr98.5%
Taylor expanded in K around 0 85.3%
if -1.29999999999999998e-123 < J < 8.1999999999999997e-298Initial program 28.5%
*-commutative28.5%
associate-*l*28.5%
associate-*r*28.5%
*-commutative28.5%
associate-*l*28.5%
*-commutative28.5%
unpow228.5%
hypot-1-def62.2%
*-commutative62.2%
associate-*l*62.2%
Simplified62.2%
Taylor expanded in U around -inf 60.9%
if 8.1999999999999997e-298 < J < 7.0000000000000001e-154 or 5.50000000000000053e-122 < J < 1.59999999999999988e-64Initial program 54.9%
*-commutative54.9%
associate-*l*54.9%
associate-*r*54.9%
*-commutative54.9%
associate-*l*54.8%
*-commutative54.8%
unpow254.8%
hypot-1-def67.6%
*-commutative67.6%
associate-*l*67.6%
Simplified67.6%
Taylor expanded in J around 0 40.3%
neg-mul-140.3%
Simplified40.3%
if 7.0000000000000001e-154 < J < 5.50000000000000053e-122Initial program 78.6%
*-commutative78.6%
associate-*l*78.6%
unpow278.6%
hypot-1-def99.8%
*-commutative99.8%
associate-*l*99.8%
Simplified99.8%
Taylor expanded in K around 0 88.9%
Final simplification72.5%
NOTE: U should be positive before calling this function
(FPCore (J K U)
:precision binary64
(let* ((t_0 (* J (* -2.0 (cos (* K 0.5))))))
(if (<= J -4.5e+32)
t_0
(if (<= J -6.2e-32)
(* J (+ 1.0 (/ U J)))
(if (<= J -2.1e-122)
(- U)
(if (<= J 2.3e-296) U (if (<= J 4.5e-61) (- U) t_0)))))))U = abs(U);
double code(double J, double K, double U) {
double t_0 = J * (-2.0 * cos((K * 0.5)));
double tmp;
if (J <= -4.5e+32) {
tmp = t_0;
} else if (J <= -6.2e-32) {
tmp = J * (1.0 + (U / J));
} else if (J <= -2.1e-122) {
tmp = -U;
} else if (J <= 2.3e-296) {
tmp = U;
} else if (J <= 4.5e-61) {
tmp = -U;
} else {
tmp = t_0;
}
return tmp;
}
NOTE: U should be positive before calling this function
real(8) function code(j, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: t_0
real(8) :: tmp
t_0 = j * ((-2.0d0) * cos((k * 0.5d0)))
if (j <= (-4.5d+32)) then
tmp = t_0
else if (j <= (-6.2d-32)) then
tmp = j * (1.0d0 + (u / j))
else if (j <= (-2.1d-122)) then
tmp = -u
else if (j <= 2.3d-296) then
tmp = u
else if (j <= 4.5d-61) then
tmp = -u
else
tmp = t_0
end if
code = tmp
end function
U = Math.abs(U);
public static double code(double J, double K, double U) {
double t_0 = J * (-2.0 * Math.cos((K * 0.5)));
double tmp;
if (J <= -4.5e+32) {
tmp = t_0;
} else if (J <= -6.2e-32) {
tmp = J * (1.0 + (U / J));
} else if (J <= -2.1e-122) {
tmp = -U;
} else if (J <= 2.3e-296) {
tmp = U;
} else if (J <= 4.5e-61) {
tmp = -U;
} else {
tmp = t_0;
}
return tmp;
}
U = abs(U) def code(J, K, U): t_0 = J * (-2.0 * math.cos((K * 0.5))) tmp = 0 if J <= -4.5e+32: tmp = t_0 elif J <= -6.2e-32: tmp = J * (1.0 + (U / J)) elif J <= -2.1e-122: tmp = -U elif J <= 2.3e-296: tmp = U elif J <= 4.5e-61: tmp = -U else: tmp = t_0 return tmp
U = abs(U) function code(J, K, U) t_0 = Float64(J * Float64(-2.0 * cos(Float64(K * 0.5)))) tmp = 0.0 if (J <= -4.5e+32) tmp = t_0; elseif (J <= -6.2e-32) tmp = Float64(J * Float64(1.0 + Float64(U / J))); elseif (J <= -2.1e-122) tmp = Float64(-U); elseif (J <= 2.3e-296) tmp = U; elseif (J <= 4.5e-61) tmp = Float64(-U); else tmp = t_0; end return tmp end
U = abs(U) function tmp_2 = code(J, K, U) t_0 = J * (-2.0 * cos((K * 0.5))); tmp = 0.0; if (J <= -4.5e+32) tmp = t_0; elseif (J <= -6.2e-32) tmp = J * (1.0 + (U / J)); elseif (J <= -2.1e-122) tmp = -U; elseif (J <= 2.3e-296) tmp = U; elseif (J <= 4.5e-61) tmp = -U; else tmp = t_0; end tmp_2 = tmp; end
NOTE: U should be positive before calling this function
code[J_, K_, U_] := Block[{t$95$0 = N[(J * N[(-2.0 * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[J, -4.5e+32], t$95$0, If[LessEqual[J, -6.2e-32], N[(J * N[(1.0 + N[(U / J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[J, -2.1e-122], (-U), If[LessEqual[J, 2.3e-296], U, If[LessEqual[J, 4.5e-61], (-U), t$95$0]]]]]]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
t_0 := J \cdot \left(-2 \cdot \cos \left(K \cdot 0.5\right)\right)\\
\mathbf{if}\;J \leq -4.5 \cdot 10^{+32}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;J \leq -6.2 \cdot 10^{-32}:\\
\;\;\;\;J \cdot \left(1 + \frac{U}{J}\right)\\
\mathbf{elif}\;J \leq -2.1 \cdot 10^{-122}:\\
\;\;\;\;-U\\
\mathbf{elif}\;J \leq 2.3 \cdot 10^{-296}:\\
\;\;\;\;U\\
\mathbf{elif}\;J \leq 4.5 \cdot 10^{-61}:\\
\;\;\;\;-U\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if J < -4.5000000000000003e32 or 4.5e-61 < J Initial program 94.0%
*-commutative94.0%
associate-*l*94.0%
associate-*r*94.0%
*-commutative94.0%
associate-*l*94.0%
*-commutative94.0%
unpow294.0%
hypot-1-def99.7%
*-commutative99.7%
associate-*l*99.7%
Simplified99.7%
Taylor expanded in U around 0 72.9%
if -4.5000000000000003e32 < J < -6.20000000000000021e-32Initial program 61.2%
*-commutative61.2%
associate-*l*61.2%
associate-*r*61.2%
*-commutative61.2%
associate-*l*61.0%
*-commutative61.0%
unpow261.0%
hypot-1-def99.5%
*-commutative99.5%
associate-*l*99.5%
Simplified99.5%
expm1-log1p-u31.8%
associate-*r*31.8%
*-commutative31.8%
associate-*l*31.8%
div-inv31.8%
metadata-eval31.8%
*-commutative31.8%
*-commutative31.8%
associate-*l*31.8%
div-inv31.8%
metadata-eval31.8%
*-commutative31.8%
Applied egg-rr31.8%
expm1-udef31.6%
sub-neg31.6%
log1p-udef31.6%
add-exp-log99.3%
*-commutative99.3%
*-commutative99.3%
associate-*l*99.3%
metadata-eval99.3%
Applied egg-rr99.3%
associate-+l+99.4%
metadata-eval99.4%
sub-neg99.4%
*-commutative99.4%
fma-neg99.4%
*-commutative99.4%
*-commutative99.4%
*-commutative99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in U around -inf 45.6%
if -6.20000000000000021e-32 < J < -2.09999999999999992e-122 or 2.30000000000000004e-296 < J < 4.5e-61Initial program 59.3%
*-commutative59.3%
associate-*l*59.3%
associate-*r*59.3%
*-commutative59.3%
associate-*l*59.2%
*-commutative59.2%
unpow259.2%
hypot-1-def74.6%
*-commutative74.6%
associate-*l*74.6%
Simplified74.6%
Taylor expanded in J around 0 37.1%
neg-mul-137.1%
Simplified37.1%
if -2.09999999999999992e-122 < J < 2.30000000000000004e-296Initial program 28.5%
*-commutative28.5%
associate-*l*28.5%
associate-*r*28.5%
*-commutative28.5%
associate-*l*28.5%
*-commutative28.5%
unpow228.5%
hypot-1-def62.2%
*-commutative62.2%
associate-*l*62.2%
Simplified62.2%
Taylor expanded in U around -inf 60.9%
Final simplification59.4%
NOTE: U should be positive before calling this function
(FPCore (J K U)
:precision binary64
(if (<= K 0.96)
(* J (* -2.0 (hypot 1.0 (* 0.5 (/ U J)))))
(if (or (<= K 2.9e+183) (not (<= K 6e+200)))
(* J (* -2.0 (cos (* K 0.5))))
(- U))))U = abs(U);
double code(double J, double K, double U) {
double tmp;
if (K <= 0.96) {
tmp = J * (-2.0 * hypot(1.0, (0.5 * (U / J))));
} else if ((K <= 2.9e+183) || !(K <= 6e+200)) {
tmp = J * (-2.0 * cos((K * 0.5)));
} else {
tmp = -U;
}
return tmp;
}
U = Math.abs(U);
public static double code(double J, double K, double U) {
double tmp;
if (K <= 0.96) {
tmp = J * (-2.0 * Math.hypot(1.0, (0.5 * (U / J))));
} else if ((K <= 2.9e+183) || !(K <= 6e+200)) {
tmp = J * (-2.0 * Math.cos((K * 0.5)));
} else {
tmp = -U;
}
return tmp;
}
U = abs(U) def code(J, K, U): tmp = 0 if K <= 0.96: tmp = J * (-2.0 * math.hypot(1.0, (0.5 * (U / J)))) elif (K <= 2.9e+183) or not (K <= 6e+200): tmp = J * (-2.0 * math.cos((K * 0.5))) else: tmp = -U return tmp
U = abs(U) function code(J, K, U) tmp = 0.0 if (K <= 0.96) tmp = Float64(J * Float64(-2.0 * hypot(1.0, Float64(0.5 * Float64(U / J))))); elseif ((K <= 2.9e+183) || !(K <= 6e+200)) tmp = Float64(J * Float64(-2.0 * cos(Float64(K * 0.5)))); else tmp = Float64(-U); end return tmp end
U = abs(U) function tmp_2 = code(J, K, U) tmp = 0.0; if (K <= 0.96) tmp = J * (-2.0 * hypot(1.0, (0.5 * (U / J)))); elseif ((K <= 2.9e+183) || ~((K <= 6e+200))) tmp = J * (-2.0 * cos((K * 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[K, 0.96], N[(J * N[(-2.0 * N[Sqrt[1.0 ^ 2 + N[(0.5 * N[(U / J), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[K, 2.9e+183], N[Not[LessEqual[K, 6e+200]], $MachinePrecision]], N[(J * N[(-2.0 * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], (-U)]]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
\mathbf{if}\;K \leq 0.96:\\
\;\;\;\;J \cdot \left(-2 \cdot \mathsf{hypot}\left(1, 0.5 \cdot \frac{U}{J}\right)\right)\\
\mathbf{elif}\;K \leq 2.9 \cdot 10^{+183} \lor \neg \left(K \leq 6 \cdot 10^{+200}\right):\\
\;\;\;\;J \cdot \left(-2 \cdot \cos \left(K \cdot 0.5\right)\right)\\
\mathbf{else}:\\
\;\;\;\;-U\\
\end{array}
\end{array}
if K < 0.95999999999999996Initial program 74.2%
*-commutative74.2%
associate-*l*74.2%
associate-*r*74.2%
*-commutative74.2%
associate-*l*74.1%
*-commutative74.1%
unpow274.1%
hypot-1-def88.5%
*-commutative88.5%
associate-*l*88.5%
Simplified88.5%
Taylor expanded in K around 0 38.9%
associate-*r*38.9%
unpow238.9%
unpow238.9%
Simplified38.9%
expm1-log1p-u38.2%
expm1-udef38.2%
add-sqr-sqrt38.2%
hypot-1-def38.2%
sqrt-prod38.2%
metadata-eval38.2%
times-frac52.8%
sqrt-prod34.9%
add-sqr-sqrt64.8%
Applied egg-rr64.8%
expm1-def64.8%
expm1-log1p67.6%
Simplified67.6%
if 0.95999999999999996 < K < 2.9000000000000001e183 or 5.99999999999999982e200 < K Initial program 65.2%
*-commutative65.2%
associate-*l*65.2%
associate-*r*65.2%
*-commutative65.2%
associate-*l*65.1%
*-commutative65.1%
unpow265.1%
hypot-1-def80.8%
*-commutative80.8%
associate-*l*80.8%
Simplified80.8%
Taylor expanded in U around 0 45.8%
if 2.9000000000000001e183 < K < 5.99999999999999982e200Initial program 81.8%
*-commutative81.8%
associate-*l*81.8%
associate-*r*81.8%
*-commutative81.8%
associate-*l*81.2%
*-commutative81.2%
unpow281.2%
hypot-1-def81.2%
*-commutative81.2%
associate-*l*81.2%
Simplified81.2%
Taylor expanded in J around 0 41.3%
neg-mul-141.3%
Simplified41.3%
Final simplification62.0%
NOTE: U should be positive before calling this function
(FPCore (J K U)
:precision binary64
(let* ((t_0 (* J (+ 1.0 (/ U J)))))
(if (<= J -1.55e+247)
(* -2.0 J)
(if (<= J -1.6e+180)
t_0
(if (<= J -8e+37)
(* -2.0 J)
(if (<= J -1.55e-42)
t_0
(if (<= J -2.1e-122)
(- U)
(if (<= J 8.2e-298) U (if (<= J 2.1e+88) (- U) (* -2.0 J))))))))))U = abs(U);
double code(double J, double K, double U) {
double t_0 = J * (1.0 + (U / J));
double tmp;
if (J <= -1.55e+247) {
tmp = -2.0 * J;
} else if (J <= -1.6e+180) {
tmp = t_0;
} else if (J <= -8e+37) {
tmp = -2.0 * J;
} else if (J <= -1.55e-42) {
tmp = t_0;
} else if (J <= -2.1e-122) {
tmp = -U;
} else if (J <= 8.2e-298) {
tmp = U;
} else if (J <= 2.1e+88) {
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) :: t_0
real(8) :: tmp
t_0 = j * (1.0d0 + (u / j))
if (j <= (-1.55d+247)) then
tmp = (-2.0d0) * j
else if (j <= (-1.6d+180)) then
tmp = t_0
else if (j <= (-8d+37)) then
tmp = (-2.0d0) * j
else if (j <= (-1.55d-42)) then
tmp = t_0
else if (j <= (-2.1d-122)) then
tmp = -u
else if (j <= 8.2d-298) then
tmp = u
else if (j <= 2.1d+88) 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 t_0 = J * (1.0 + (U / J));
double tmp;
if (J <= -1.55e+247) {
tmp = -2.0 * J;
} else if (J <= -1.6e+180) {
tmp = t_0;
} else if (J <= -8e+37) {
tmp = -2.0 * J;
} else if (J <= -1.55e-42) {
tmp = t_0;
} else if (J <= -2.1e-122) {
tmp = -U;
} else if (J <= 8.2e-298) {
tmp = U;
} else if (J <= 2.1e+88) {
tmp = -U;
} else {
tmp = -2.0 * J;
}
return tmp;
}
U = abs(U) def code(J, K, U): t_0 = J * (1.0 + (U / J)) tmp = 0 if J <= -1.55e+247: tmp = -2.0 * J elif J <= -1.6e+180: tmp = t_0 elif J <= -8e+37: tmp = -2.0 * J elif J <= -1.55e-42: tmp = t_0 elif J <= -2.1e-122: tmp = -U elif J <= 8.2e-298: tmp = U elif J <= 2.1e+88: tmp = -U else: tmp = -2.0 * J return tmp
U = abs(U) function code(J, K, U) t_0 = Float64(J * Float64(1.0 + Float64(U / J))) tmp = 0.0 if (J <= -1.55e+247) tmp = Float64(-2.0 * J); elseif (J <= -1.6e+180) tmp = t_0; elseif (J <= -8e+37) tmp = Float64(-2.0 * J); elseif (J <= -1.55e-42) tmp = t_0; elseif (J <= -2.1e-122) tmp = Float64(-U); elseif (J <= 8.2e-298) tmp = U; elseif (J <= 2.1e+88) tmp = Float64(-U); else tmp = Float64(-2.0 * J); end return tmp end
U = abs(U) function tmp_2 = code(J, K, U) t_0 = J * (1.0 + (U / J)); tmp = 0.0; if (J <= -1.55e+247) tmp = -2.0 * J; elseif (J <= -1.6e+180) tmp = t_0; elseif (J <= -8e+37) tmp = -2.0 * J; elseif (J <= -1.55e-42) tmp = t_0; elseif (J <= -2.1e-122) tmp = -U; elseif (J <= 8.2e-298) tmp = U; elseif (J <= 2.1e+88) 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_] := Block[{t$95$0 = N[(J * N[(1.0 + N[(U / J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[J, -1.55e+247], N[(-2.0 * J), $MachinePrecision], If[LessEqual[J, -1.6e+180], t$95$0, If[LessEqual[J, -8e+37], N[(-2.0 * J), $MachinePrecision], If[LessEqual[J, -1.55e-42], t$95$0, If[LessEqual[J, -2.1e-122], (-U), If[LessEqual[J, 8.2e-298], U, If[LessEqual[J, 2.1e+88], (-U), N[(-2.0 * J), $MachinePrecision]]]]]]]]]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
t_0 := J \cdot \left(1 + \frac{U}{J}\right)\\
\mathbf{if}\;J \leq -1.55 \cdot 10^{+247}:\\
\;\;\;\;-2 \cdot J\\
\mathbf{elif}\;J \leq -1.6 \cdot 10^{+180}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;J \leq -8 \cdot 10^{+37}:\\
\;\;\;\;-2 \cdot J\\
\mathbf{elif}\;J \leq -1.55 \cdot 10^{-42}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;J \leq -2.1 \cdot 10^{-122}:\\
\;\;\;\;-U\\
\mathbf{elif}\;J \leq 8.2 \cdot 10^{-298}:\\
\;\;\;\;U\\
\mathbf{elif}\;J \leq 2.1 \cdot 10^{+88}:\\
\;\;\;\;-U\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot J\\
\end{array}
\end{array}
if J < -1.5499999999999999e247 or -1.59999999999999997e180 < J < -7.99999999999999963e37 or 2.1e88 < J Initial program 98.7%
*-commutative98.7%
associate-*l*98.7%
associate-*r*98.7%
*-commutative98.7%
associate-*l*98.7%
*-commutative98.7%
unpow298.7%
hypot-1-def99.8%
*-commutative99.8%
associate-*l*99.8%
Simplified99.8%
Taylor expanded in K around 0 45.6%
associate-*r*45.6%
unpow245.6%
unpow245.6%
Simplified45.6%
Taylor expanded in U around 0 49.2%
if -1.5499999999999999e247 < J < -1.59999999999999997e180 or -7.99999999999999963e37 < J < -1.5500000000000001e-42Initial program 82.4%
*-commutative82.4%
associate-*l*82.4%
associate-*r*82.4%
*-commutative82.4%
associate-*l*82.3%
*-commutative82.3%
unpow282.3%
hypot-1-def99.4%
*-commutative99.4%
associate-*l*99.4%
Simplified99.4%
expm1-log1p-u47.0%
associate-*r*47.0%
*-commutative47.0%
associate-*l*47.0%
div-inv47.0%
metadata-eval47.0%
*-commutative47.0%
*-commutative47.0%
associate-*l*47.0%
div-inv47.0%
metadata-eval47.0%
*-commutative47.0%
Applied egg-rr47.0%
expm1-udef46.8%
sub-neg46.8%
log1p-udef46.7%
add-exp-log99.1%
*-commutative99.1%
*-commutative99.1%
associate-*l*99.1%
metadata-eval99.1%
Applied egg-rr99.1%
associate-+l+99.4%
metadata-eval99.4%
sub-neg99.4%
*-commutative99.4%
fma-neg99.4%
*-commutative99.4%
*-commutative99.4%
*-commutative99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in U around -inf 33.3%
if -1.5500000000000001e-42 < J < -2.09999999999999992e-122 or 8.1999999999999997e-298 < J < 2.1e88Initial program 65.6%
*-commutative65.6%
associate-*l*65.6%
associate-*r*65.6%
*-commutative65.6%
associate-*l*65.5%
*-commutative65.5%
unpow265.5%
hypot-1-def82.3%
*-commutative82.3%
associate-*l*82.3%
Simplified82.3%
Taylor expanded in J around 0 31.5%
neg-mul-131.5%
Simplified31.5%
if -2.09999999999999992e-122 < J < 8.1999999999999997e-298Initial program 28.5%
*-commutative28.5%
associate-*l*28.5%
associate-*r*28.5%
*-commutative28.5%
associate-*l*28.5%
*-commutative28.5%
unpow228.5%
hypot-1-def62.2%
*-commutative62.2%
associate-*l*62.2%
Simplified62.2%
Taylor expanded in U around -inf 60.9%
Final simplification41.9%
NOTE: U should be positive before calling this function (FPCore (J K U) :precision binary64 (if (<= J -1.35e+38) (* -2.0 J) (if (<= J 8.2e-298) U (if (<= J 2.5e+89) (- U) (* -2.0 J)))))
U = abs(U);
double code(double J, double K, double U) {
double tmp;
if (J <= -1.35e+38) {
tmp = -2.0 * J;
} else if (J <= 8.2e-298) {
tmp = U;
} else if (J <= 2.5e+89) {
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.35d+38)) then
tmp = (-2.0d0) * j
else if (j <= 8.2d-298) then
tmp = u
else if (j <= 2.5d+89) 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.35e+38) {
tmp = -2.0 * J;
} else if (J <= 8.2e-298) {
tmp = U;
} else if (J <= 2.5e+89) {
tmp = -U;
} else {
tmp = -2.0 * J;
}
return tmp;
}
U = abs(U) def code(J, K, U): tmp = 0 if J <= -1.35e+38: tmp = -2.0 * J elif J <= 8.2e-298: tmp = U elif J <= 2.5e+89: tmp = -U else: tmp = -2.0 * J return tmp
U = abs(U) function code(J, K, U) tmp = 0.0 if (J <= -1.35e+38) tmp = Float64(-2.0 * J); elseif (J <= 8.2e-298) tmp = U; elseif (J <= 2.5e+89) 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.35e+38) tmp = -2.0 * J; elseif (J <= 8.2e-298) tmp = U; elseif (J <= 2.5e+89) 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.35e+38], N[(-2.0 * J), $MachinePrecision], If[LessEqual[J, 8.2e-298], U, If[LessEqual[J, 2.5e+89], (-U), N[(-2.0 * J), $MachinePrecision]]]]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
\mathbf{if}\;J \leq -1.35 \cdot 10^{+38}:\\
\;\;\;\;-2 \cdot J\\
\mathbf{elif}\;J \leq 8.2 \cdot 10^{-298}:\\
\;\;\;\;U\\
\mathbf{elif}\;J \leq 2.5 \cdot 10^{+89}:\\
\;\;\;\;-U\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot J\\
\end{array}
\end{array}
if J < -1.34999999999999998e38 or 2.49999999999999992e89 < J Initial program 98.8%
*-commutative98.8%
associate-*l*98.8%
associate-*r*98.8%
*-commutative98.8%
associate-*l*98.8%
*-commutative98.8%
unpow298.8%
hypot-1-def99.7%
*-commutative99.7%
associate-*l*99.7%
Simplified99.7%
Taylor expanded in K around 0 40.2%
associate-*r*40.2%
unpow240.2%
unpow240.2%
Simplified40.2%
Taylor expanded in U around 0 43.6%
if -1.34999999999999998e38 < J < 8.1999999999999997e-298Initial program 41.5%
*-commutative41.5%
associate-*l*41.5%
associate-*r*41.5%
*-commutative41.5%
associate-*l*41.4%
*-commutative41.4%
unpow241.4%
hypot-1-def73.7%
*-commutative73.7%
associate-*l*73.7%
Simplified73.7%
Taylor expanded in U around -inf 50.3%
if 8.1999999999999997e-298 < J < 2.49999999999999992e89Initial program 66.3%
*-commutative66.3%
associate-*l*66.3%
associate-*r*66.3%
*-commutative66.3%
associate-*l*66.2%
*-commutative66.2%
unpow266.2%
hypot-1-def82.1%
*-commutative82.1%
associate-*l*82.1%
Simplified82.1%
Taylor expanded in J around 0 30.0%
neg-mul-130.0%
Simplified30.0%
Final simplification40.3%
NOTE: U should be positive before calling this function (FPCore (J K U) :precision binary64 (if (<= J 8.2e-298) U (- U)))
U = abs(U);
double code(double J, double K, double U) {
double tmp;
if (J <= 8.2e-298) {
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 <= 8.2d-298) 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 <= 8.2e-298) {
tmp = U;
} else {
tmp = -U;
}
return tmp;
}
U = abs(U) def code(J, K, U): tmp = 0 if J <= 8.2e-298: tmp = U else: tmp = -U return tmp
U = abs(U) function code(J, K, U) tmp = 0.0 if (J <= 8.2e-298) 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 <= 8.2e-298) 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, 8.2e-298], U, (-U)]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
\mathbf{if}\;J \leq 8.2 \cdot 10^{-298}:\\
\;\;\;\;U\\
\mathbf{else}:\\
\;\;\;\;-U\\
\end{array}
\end{array}
if J < 8.1999999999999997e-298Initial program 68.0%
*-commutative68.0%
associate-*l*68.0%
associate-*r*68.0%
*-commutative68.0%
associate-*l*67.9%
*-commutative67.9%
unpow267.9%
hypot-1-def85.8%
*-commutative85.8%
associate-*l*85.8%
Simplified85.8%
Taylor expanded in U around -inf 32.8%
if 8.1999999999999997e-298 < J Initial program 76.1%
*-commutative76.1%
associate-*l*76.1%
associate-*r*76.1%
*-commutative76.1%
associate-*l*76.0%
*-commutative76.0%
unpow276.0%
hypot-1-def87.2%
*-commutative87.2%
associate-*l*87.2%
Simplified87.2%
Taylor expanded in J around 0 23.4%
neg-mul-123.4%
Simplified23.4%
Final simplification27.9%
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 72.2%
*-commutative72.2%
associate-*l*72.2%
associate-*r*72.2%
*-commutative72.2%
associate-*l*72.1%
*-commutative72.1%
unpow272.1%
hypot-1-def86.6%
*-commutative86.6%
associate-*l*86.6%
Simplified86.6%
Taylor expanded in U around -inf 31.7%
Final simplification31.7%
herbie shell --seed 2023252
(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)))))