
(FPCore (J K U) :precision binary64 (let* ((t_0 (cos (/ K 2.0)))) (* (* (* -2.0 J) t_0) (sqrt (+ 1.0 (pow (/ U (* (* 2.0 J) t_0)) 2.0))))))
double code(double J, double K, double U) {
double t_0 = cos((K / 2.0));
return ((-2.0 * J) * t_0) * sqrt((1.0 + pow((U / ((2.0 * J) * t_0)), 2.0)));
}
real(8) function code(j, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: t_0
t_0 = cos((k / 2.0d0))
code = (((-2.0d0) * j) * t_0) * sqrt((1.0d0 + ((u / ((2.0d0 * j) * t_0)) ** 2.0d0)))
end function
public static double code(double J, double K, double U) {
double t_0 = Math.cos((K / 2.0));
return ((-2.0 * J) * t_0) * Math.sqrt((1.0 + Math.pow((U / ((2.0 * J) * t_0)), 2.0)));
}
def code(J, K, U): t_0 = math.cos((K / 2.0)) return ((-2.0 * J) * t_0) * math.sqrt((1.0 + math.pow((U / ((2.0 * J) * t_0)), 2.0)))
function code(J, K, U) t_0 = cos(Float64(K / 2.0)) return Float64(Float64(Float64(-2.0 * J) * t_0) * sqrt(Float64(1.0 + (Float64(U / Float64(Float64(2.0 * J) * t_0)) ^ 2.0)))) end
function tmp = code(J, K, U) t_0 = cos((K / 2.0)); tmp = ((-2.0 * J) * t_0) * sqrt((1.0 + ((U / ((2.0 * J) * t_0)) ^ 2.0))); end
code[J_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, N[(N[(N[(-2.0 * J), $MachinePrecision] * t$95$0), $MachinePrecision] * N[Sqrt[N[(1.0 + N[Power[N[(U / N[(N[(2.0 * J), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\left(\left(-2 \cdot J\right) \cdot t_0\right) \cdot \sqrt{1 + {\left(\frac{U}{\left(2 \cdot J\right) \cdot t_0}\right)}^{2}}
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (J K U) :precision binary64 (let* ((t_0 (cos (/ K 2.0)))) (* (* (* -2.0 J) t_0) (sqrt (+ 1.0 (pow (/ U (* (* 2.0 J) t_0)) 2.0))))))
double code(double J, double K, double U) {
double t_0 = cos((K / 2.0));
return ((-2.0 * J) * t_0) * sqrt((1.0 + pow((U / ((2.0 * J) * t_0)), 2.0)));
}
real(8) function code(j, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: t_0
t_0 = cos((k / 2.0d0))
code = (((-2.0d0) * j) * t_0) * sqrt((1.0d0 + ((u / ((2.0d0 * j) * t_0)) ** 2.0d0)))
end function
public static double code(double J, double K, double U) {
double t_0 = Math.cos((K / 2.0));
return ((-2.0 * J) * t_0) * Math.sqrt((1.0 + Math.pow((U / ((2.0 * J) * t_0)), 2.0)));
}
def code(J, K, U): t_0 = math.cos((K / 2.0)) return ((-2.0 * J) * t_0) * math.sqrt((1.0 + math.pow((U / ((2.0 * J) * t_0)), 2.0)))
function code(J, K, U) t_0 = cos(Float64(K / 2.0)) return Float64(Float64(Float64(-2.0 * J) * t_0) * sqrt(Float64(1.0 + (Float64(U / Float64(Float64(2.0 * J) * t_0)) ^ 2.0)))) end
function tmp = code(J, K, U) t_0 = cos((K / 2.0)); tmp = ((-2.0 * J) * t_0) * sqrt((1.0 + ((U / ((2.0 * J) * t_0)) ^ 2.0))); end
code[J_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, N[(N[(N[(-2.0 * J), $MachinePrecision] * t$95$0), $MachinePrecision] * N[Sqrt[N[(1.0 + N[Power[N[(U / N[(N[(2.0 * J), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\left(\left(-2 \cdot J\right) \cdot t_0\right) \cdot \sqrt{1 + {\left(\frac{U}{\left(2 \cdot J\right) \cdot t_0}\right)}^{2}}
\end{array}
\end{array}
NOTE: U should be positive before calling this function
(FPCore (J K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0)))
(t_1
(*
(* (* -2.0 J) t_0)
(sqrt (+ 1.0 (pow (/ U (* t_0 (* J 2.0))) 2.0))))))
(if (<= t_1 (- INFINITY))
(- U)
(if (<= t_1 2e+307)
(* (* J (* -2.0 t_0)) (hypot 1.0 (/ U (* J (* 2.0 t_0)))))
U))))U = abs(U);
double code(double J, double K, double U) {
double t_0 = cos((K / 2.0));
double 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 <= 2e+307) {
tmp = (J * (-2.0 * t_0)) * hypot(1.0, (U / (J * (2.0 * t_0))));
} else {
tmp = U;
}
return tmp;
}
U = Math.abs(U);
public static double code(double J, double K, double U) {
double t_0 = Math.cos((K / 2.0));
double 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 <= 2e+307) {
tmp = (J * (-2.0 * t_0)) * Math.hypot(1.0, (U / (J * (2.0 * t_0))));
} else {
tmp = U;
}
return tmp;
}
U = abs(U) def code(J, K, U): t_0 = math.cos((K / 2.0)) 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 <= 2e+307: tmp = (J * (-2.0 * t_0)) * math.hypot(1.0, (U / (J * (2.0 * t_0)))) else: tmp = U return tmp
U = abs(U) function code(J, K, U) t_0 = cos(Float64(K / 2.0)) 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 <= 2e+307) tmp = Float64(Float64(J * Float64(-2.0 * t_0)) * hypot(1.0, Float64(U / Float64(J * Float64(2.0 * t_0))))); 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 <= 2e+307) tmp = (J * (-2.0 * t_0)) * hypot(1.0, (U / (J * (2.0 * t_0)))); else tmp = U; end tmp_2 = tmp; end
NOTE: U should be positive before calling this function
code[J_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, 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, 2e+307], 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], 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 2 \cdot 10^{+307}:\\
\;\;\;\;\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)\\
\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.5%
*-commutative5.5%
associate-*l*5.5%
unpow25.5%
hypot-1-def49.8%
*-commutative49.8%
associate-*l*49.8%
Simplified49.8%
Taylor expanded in J around 0 47.0%
neg-mul-147.0%
Simplified47.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)))) < 1.99999999999999997e307Initial program 99.8%
*-commutative99.8%
associate-*l*99.8%
unpow299.8%
hypot-1-def99.8%
*-commutative99.8%
associate-*l*99.8%
Simplified99.8%
if 1.99999999999999997e307 < (*.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 6.3%
*-commutative6.3%
associate-*l*6.3%
unpow26.3%
hypot-1-def31.4%
*-commutative31.4%
associate-*l*31.4%
Simplified31.4%
Taylor expanded in U around -inf 56.1%
Final simplification87.8%
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 -2.1e-113)
t_0
(if (<= J -8.4e-255)
(fma 2.0 (/ (/ (+ 1.0 (cos K)) 2.0) (/ U (* J J))) U)
(if (<= J 1.5e-170) (- 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 <= -2.1e-113) {
tmp = t_0;
} else if (J <= -8.4e-255) {
tmp = fma(2.0, (((1.0 + cos(K)) / 2.0) / (U / (J * J))), U);
} else if (J <= 1.5e-170) {
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 <= -2.1e-113) tmp = t_0; elseif (J <= -8.4e-255) tmp = fma(2.0, Float64(Float64(Float64(1.0 + cos(K)) / 2.0) / Float64(U / Float64(J * J))), U); elseif (J <= 1.5e-170) tmp = Float64(-U); else tmp = t_0; end return tmp end
NOTE: U should be positive before calling this function
code[J_, K_, U_] := Block[{t$95$0 = N[(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, -2.1e-113], t$95$0, If[LessEqual[J, -8.4e-255], N[(2.0 * N[(N[(N[(1.0 + N[Cos[K], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision] / N[(U / N[(J * J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + U), $MachinePrecision], If[LessEqual[J, 1.5e-170], (-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 -2.1 \cdot 10^{-113}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;J \leq -8.4 \cdot 10^{-255}:\\
\;\;\;\;\mathsf{fma}\left(2, \frac{\frac{1 + \cos K}{2}}{\frac{U}{J \cdot J}}, U\right)\\
\mathbf{elif}\;J \leq 1.5 \cdot 10^{-170}:\\
\;\;\;\;-U\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if J < -2.1e-113 or 1.50000000000000007e-170 < J Initial program 86.4%
*-commutative86.4%
associate-*l*86.4%
unpow286.4%
hypot-1-def92.9%
*-commutative92.9%
associate-*l*92.9%
Simplified92.9%
Taylor expanded in K around 0 82.1%
if -2.1e-113 < J < -8.3999999999999999e-255Initial program 39.1%
*-commutative39.1%
associate-*l*39.1%
unpow239.1%
hypot-1-def53.0%
*-commutative53.0%
associate-*l*53.0%
Simplified53.0%
Taylor expanded in U around -inf 54.7%
fma-def54.7%
associate-/l*54.7%
unpow254.7%
Simplified54.7%
unpow254.7%
*-commutative54.7%
metadata-eval54.7%
div-inv54.7%
*-commutative54.7%
metadata-eval54.7%
div-inv54.7%
cos-mult54.7%
div-inv54.7%
metadata-eval54.7%
div-inv54.7%
metadata-eval54.7%
div-inv54.7%
metadata-eval54.7%
div-inv54.7%
metadata-eval54.7%
Applied egg-rr54.7%
+-commutative54.7%
+-inverses54.7%
cos-054.7%
distribute-lft-out54.7%
metadata-eval54.7%
*-rgt-identity54.7%
Simplified54.7%
if -8.3999999999999999e-255 < J < 1.50000000000000007e-170Initial program 42.1%
*-commutative42.1%
associate-*l*42.1%
unpow242.1%
hypot-1-def59.5%
*-commutative59.5%
associate-*l*59.5%
Simplified59.5%
Taylor expanded in J around 0 37.9%
neg-mul-137.9%
Simplified37.9%
Final simplification74.3%
NOTE: U should be positive before calling this function
(FPCore (J K U)
:precision binary64
(let* ((t_0 (* (* -2.0 J) (hypot 1.0 (* -0.5 (/ U J)))))
(t_1 (* (* -2.0 J) (cos (* K 0.5)))))
(if (<= U 3e-193)
t_1
(if (<= U 3.2e-89)
t_0
(if (<= U 1.45e+57)
t_1
(if (<= U 1.8e+250) t_0 (if (<= U 3.4e+281) (- U) U)))))))U = abs(U);
double code(double J, double K, double U) {
double t_0 = (-2.0 * J) * hypot(1.0, (-0.5 * (U / J)));
double t_1 = (-2.0 * J) * cos((K * 0.5));
double tmp;
if (U <= 3e-193) {
tmp = t_1;
} else if (U <= 3.2e-89) {
tmp = t_0;
} else if (U <= 1.45e+57) {
tmp = t_1;
} else if (U <= 1.8e+250) {
tmp = t_0;
} else if (U <= 3.4e+281) {
tmp = -U;
} else {
tmp = U;
}
return tmp;
}
U = Math.abs(U);
public static double code(double J, double K, double U) {
double t_0 = (-2.0 * J) * Math.hypot(1.0, (-0.5 * (U / J)));
double t_1 = (-2.0 * J) * Math.cos((K * 0.5));
double tmp;
if (U <= 3e-193) {
tmp = t_1;
} else if (U <= 3.2e-89) {
tmp = t_0;
} else if (U <= 1.45e+57) {
tmp = t_1;
} else if (U <= 1.8e+250) {
tmp = t_0;
} else if (U <= 3.4e+281) {
tmp = -U;
} else {
tmp = U;
}
return tmp;
}
U = abs(U) def code(J, K, U): t_0 = (-2.0 * J) * math.hypot(1.0, (-0.5 * (U / J))) t_1 = (-2.0 * J) * math.cos((K * 0.5)) tmp = 0 if U <= 3e-193: tmp = t_1 elif U <= 3.2e-89: tmp = t_0 elif U <= 1.45e+57: tmp = t_1 elif U <= 1.8e+250: tmp = t_0 elif U <= 3.4e+281: tmp = -U else: tmp = U return tmp
U = abs(U) function code(J, K, U) t_0 = Float64(Float64(-2.0 * J) * hypot(1.0, Float64(-0.5 * Float64(U / J)))) t_1 = Float64(Float64(-2.0 * J) * cos(Float64(K * 0.5))) tmp = 0.0 if (U <= 3e-193) tmp = t_1; elseif (U <= 3.2e-89) tmp = t_0; elseif (U <= 1.45e+57) tmp = t_1; elseif (U <= 1.8e+250) tmp = t_0; elseif (U <= 3.4e+281) tmp = Float64(-U); else tmp = U; end return tmp end
U = abs(U) function tmp_2 = code(J, K, U) t_0 = (-2.0 * J) * hypot(1.0, (-0.5 * (U / J))); t_1 = (-2.0 * J) * cos((K * 0.5)); tmp = 0.0; if (U <= 3e-193) tmp = t_1; elseif (U <= 3.2e-89) tmp = t_0; elseif (U <= 1.45e+57) tmp = t_1; elseif (U <= 1.8e+250) tmp = t_0; elseif (U <= 3.4e+281) tmp = -U; 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[(N[(-2.0 * J), $MachinePrecision] * N[Sqrt[1.0 ^ 2 + N[(-0.5 * N[(U / J), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(-2.0 * J), $MachinePrecision] * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[U, 3e-193], t$95$1, If[LessEqual[U, 3.2e-89], t$95$0, If[LessEqual[U, 1.45e+57], t$95$1, If[LessEqual[U, 1.8e+250], t$95$0, If[LessEqual[U, 3.4e+281], (-U), U]]]]]]]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
t_0 := \left(-2 \cdot J\right) \cdot \mathsf{hypot}\left(1, -0.5 \cdot \frac{U}{J}\right)\\
t_1 := \left(-2 \cdot J\right) \cdot \cos \left(K \cdot 0.5\right)\\
\mathbf{if}\;U \leq 3 \cdot 10^{-193}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;U \leq 3.2 \cdot 10^{-89}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;U \leq 1.45 \cdot 10^{+57}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;U \leq 1.8 \cdot 10^{+250}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;U \leq 3.4 \cdot 10^{+281}:\\
\;\;\;\;-U\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\end{array}
if U < 2.9999999999999999e-193 or 3.19999999999999998e-89 < U < 1.4500000000000001e57Initial program 79.2%
*-commutative79.2%
associate-*l*79.2%
unpow279.2%
hypot-1-def88.5%
*-commutative88.5%
associate-*l*88.5%
Simplified88.5%
Taylor expanded in J around inf 58.6%
*-commutative58.6%
*-commutative58.6%
associate-*r*58.6%
*-commutative58.6%
Simplified58.6%
if 2.9999999999999999e-193 < U < 3.19999999999999998e-89 or 1.4500000000000001e57 < U < 1.7999999999999999e250Initial program 77.4%
*-commutative77.4%
associate-*l*77.4%
unpow277.4%
hypot-1-def83.9%
*-commutative83.9%
associate-*l*83.9%
Simplified83.9%
add-cube-cbrt82.1%
pow382.1%
Applied egg-rr82.1%
cbrt-prod81.6%
unpow-prod-down81.6%
*-commutative81.6%
associate-/r*81.6%
Applied egg-rr81.6%
Taylor expanded in K around 0 33.9%
*-commutative33.9%
associate-*l*33.9%
*-commutative33.9%
unpow233.9%
unpow233.9%
times-frac62.1%
metadata-eval62.1%
swap-sqr62.1%
hypot-1-def68.6%
*-commutative68.6%
*-commutative68.6%
Simplified68.6%
if 1.7999999999999999e250 < U < 3.40000000000000011e281Initial program 47.1%
*-commutative47.1%
associate-*l*47.1%
unpow247.1%
hypot-1-def53.7%
*-commutative53.7%
associate-*l*53.7%
Simplified53.7%
Taylor expanded in J around 0 71.5%
neg-mul-171.5%
Simplified71.5%
if 3.40000000000000011e281 < U Initial program 59.8%
*-commutative59.8%
associate-*l*59.8%
unpow259.8%
hypot-1-def70.0%
*-commutative70.0%
associate-*l*70.0%
Simplified70.0%
Taylor expanded in U around -inf 83.6%
Final simplification62.5%
NOTE: U should be positive before calling this function
(FPCore (J K U)
:precision binary64
(if (<= U 1.66e+131)
(* (* -2.0 J) (cos (* K 0.5)))
(if (<= U 4.7e+231)
(- (* (* -2.0 J) (/ J U)) U)
(if (<= U 5.2e+255) U (if (<= U 4e+281) (- U) U)))))U = abs(U);
double code(double J, double K, double U) {
double tmp;
if (U <= 1.66e+131) {
tmp = (-2.0 * J) * cos((K * 0.5));
} else if (U <= 4.7e+231) {
tmp = ((-2.0 * J) * (J / U)) - U;
} else if (U <= 5.2e+255) {
tmp = U;
} else if (U <= 4e+281) {
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 (u <= 1.66d+131) then
tmp = ((-2.0d0) * j) * cos((k * 0.5d0))
else if (u <= 4.7d+231) then
tmp = (((-2.0d0) * j) * (j / u)) - u
else if (u <= 5.2d+255) then
tmp = u
else if (u <= 4d+281) 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 (U <= 1.66e+131) {
tmp = (-2.0 * J) * Math.cos((K * 0.5));
} else if (U <= 4.7e+231) {
tmp = ((-2.0 * J) * (J / U)) - U;
} else if (U <= 5.2e+255) {
tmp = U;
} else if (U <= 4e+281) {
tmp = -U;
} else {
tmp = U;
}
return tmp;
}
U = abs(U) def code(J, K, U): tmp = 0 if U <= 1.66e+131: tmp = (-2.0 * J) * math.cos((K * 0.5)) elif U <= 4.7e+231: tmp = ((-2.0 * J) * (J / U)) - U elif U <= 5.2e+255: tmp = U elif U <= 4e+281: tmp = -U else: tmp = U return tmp
U = abs(U) function code(J, K, U) tmp = 0.0 if (U <= 1.66e+131) tmp = Float64(Float64(-2.0 * J) * cos(Float64(K * 0.5))); elseif (U <= 4.7e+231) tmp = Float64(Float64(Float64(-2.0 * J) * Float64(J / U)) - U); elseif (U <= 5.2e+255) tmp = U; elseif (U <= 4e+281) tmp = Float64(-U); else tmp = U; end return tmp end
U = abs(U) function tmp_2 = code(J, K, U) tmp = 0.0; if (U <= 1.66e+131) tmp = (-2.0 * J) * cos((K * 0.5)); elseif (U <= 4.7e+231) tmp = ((-2.0 * J) * (J / U)) - U; elseif (U <= 5.2e+255) tmp = U; elseif (U <= 4e+281) 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[U, 1.66e+131], N[(N[(-2.0 * J), $MachinePrecision] * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[U, 4.7e+231], N[(N[(N[(-2.0 * J), $MachinePrecision] * N[(J / U), $MachinePrecision]), $MachinePrecision] - U), $MachinePrecision], If[LessEqual[U, 5.2e+255], U, If[LessEqual[U, 4e+281], (-U), U]]]]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
\mathbf{if}\;U \leq 1.66 \cdot 10^{+131}:\\
\;\;\;\;\left(-2 \cdot J\right) \cdot \cos \left(K \cdot 0.5\right)\\
\mathbf{elif}\;U \leq 4.7 \cdot 10^{+231}:\\
\;\;\;\;\left(-2 \cdot J\right) \cdot \frac{J}{U} - U\\
\mathbf{elif}\;U \leq 5.2 \cdot 10^{+255}:\\
\;\;\;\;U\\
\mathbf{elif}\;U \leq 4 \cdot 10^{+281}:\\
\;\;\;\;-U\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\end{array}
if U < 1.65999999999999992e131Initial program 80.7%
*-commutative80.7%
associate-*l*80.7%
unpow280.7%
hypot-1-def89.2%
*-commutative89.2%
associate-*l*89.2%
Simplified89.2%
Taylor expanded in J around inf 60.1%
*-commutative60.1%
*-commutative60.1%
associate-*r*60.1%
*-commutative60.1%
Simplified60.1%
if 1.65999999999999992e131 < U < 4.70000000000000006e231Initial program 68.3%
*-commutative68.3%
associate-*l*68.3%
unpow268.3%
hypot-1-def80.1%
*-commutative80.1%
associate-*l*80.1%
Simplified80.1%
Taylor expanded in K around 0 10.9%
associate-*r*10.9%
unpow210.9%
unpow210.9%
Simplified10.9%
clear-num10.9%
inv-pow10.9%
Applied egg-rr10.9%
unpow-110.9%
times-frac55.4%
Simplified55.4%
Taylor expanded in J around 0 38.2%
mul-1-neg38.2%
unsub-neg38.2%
unpow238.2%
associate-*r/46.1%
associate-*r*46.1%
*-commutative46.1%
Simplified46.1%
if 4.70000000000000006e231 < U < 5.20000000000000019e255 or 4.0000000000000001e281 < U Initial program 51.3%
*-commutative51.3%
associate-*l*51.3%
unpow251.3%
hypot-1-def56.7%
*-commutative56.7%
associate-*l*56.7%
Simplified56.7%
Taylor expanded in U around -inf 68.3%
if 5.20000000000000019e255 < U < 4.0000000000000001e281Initial program 53.8%
*-commutative53.8%
associate-*l*53.8%
unpow253.8%
hypot-1-def61.5%
*-commutative61.5%
associate-*l*61.5%
Simplified61.5%
Taylor expanded in J around 0 75.0%
neg-mul-175.0%
Simplified75.0%
Final simplification60.1%
NOTE: U should be positive before calling this function
(FPCore (J K U)
:precision binary64
(if (<= J -6e+142)
(* -2.0 J)
(if (<= J -1.46e+41)
U
(if (<= J -3.8e-32)
(* J (+ -2.0 (* 0.25 (* K K))))
(if (<= J -8.4e-255)
U
(if (<= J 7.2e+84) (- (* (* -2.0 J) (/ J U)) U) (* -2.0 J)))))))U = abs(U);
double code(double J, double K, double U) {
double tmp;
if (J <= -6e+142) {
tmp = -2.0 * J;
} else if (J <= -1.46e+41) {
tmp = U;
} else if (J <= -3.8e-32) {
tmp = J * (-2.0 + (0.25 * (K * K)));
} else if (J <= -8.4e-255) {
tmp = U;
} else if (J <= 7.2e+84) {
tmp = ((-2.0 * J) * (J / U)) - 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 <= (-6d+142)) then
tmp = (-2.0d0) * j
else if (j <= (-1.46d+41)) then
tmp = u
else if (j <= (-3.8d-32)) then
tmp = j * ((-2.0d0) + (0.25d0 * (k * k)))
else if (j <= (-8.4d-255)) then
tmp = u
else if (j <= 7.2d+84) then
tmp = (((-2.0d0) * j) * (j / u)) - 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 <= -6e+142) {
tmp = -2.0 * J;
} else if (J <= -1.46e+41) {
tmp = U;
} else if (J <= -3.8e-32) {
tmp = J * (-2.0 + (0.25 * (K * K)));
} else if (J <= -8.4e-255) {
tmp = U;
} else if (J <= 7.2e+84) {
tmp = ((-2.0 * J) * (J / U)) - U;
} else {
tmp = -2.0 * J;
}
return tmp;
}
U = abs(U) def code(J, K, U): tmp = 0 if J <= -6e+142: tmp = -2.0 * J elif J <= -1.46e+41: tmp = U elif J <= -3.8e-32: tmp = J * (-2.0 + (0.25 * (K * K))) elif J <= -8.4e-255: tmp = U elif J <= 7.2e+84: tmp = ((-2.0 * J) * (J / U)) - U else: tmp = -2.0 * J return tmp
U = abs(U) function code(J, K, U) tmp = 0.0 if (J <= -6e+142) tmp = Float64(-2.0 * J); elseif (J <= -1.46e+41) tmp = U; elseif (J <= -3.8e-32) tmp = Float64(J * Float64(-2.0 + Float64(0.25 * Float64(K * K)))); elseif (J <= -8.4e-255) tmp = U; elseif (J <= 7.2e+84) tmp = Float64(Float64(Float64(-2.0 * J) * Float64(J / U)) - 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 <= -6e+142) tmp = -2.0 * J; elseif (J <= -1.46e+41) tmp = U; elseif (J <= -3.8e-32) tmp = J * (-2.0 + (0.25 * (K * K))); elseif (J <= -8.4e-255) tmp = U; elseif (J <= 7.2e+84) tmp = ((-2.0 * J) * (J / U)) - 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, -6e+142], N[(-2.0 * J), $MachinePrecision], If[LessEqual[J, -1.46e+41], U, If[LessEqual[J, -3.8e-32], N[(J * N[(-2.0 + N[(0.25 * N[(K * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[J, -8.4e-255], U, If[LessEqual[J, 7.2e+84], N[(N[(N[(-2.0 * J), $MachinePrecision] * N[(J / U), $MachinePrecision]), $MachinePrecision] - U), $MachinePrecision], N[(-2.0 * J), $MachinePrecision]]]]]]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
\mathbf{if}\;J \leq -6 \cdot 10^{+142}:\\
\;\;\;\;-2 \cdot J\\
\mathbf{elif}\;J \leq -1.46 \cdot 10^{+41}:\\
\;\;\;\;U\\
\mathbf{elif}\;J \leq -3.8 \cdot 10^{-32}:\\
\;\;\;\;J \cdot \left(-2 + 0.25 \cdot \left(K \cdot K\right)\right)\\
\mathbf{elif}\;J \leq -8.4 \cdot 10^{-255}:\\
\;\;\;\;U\\
\mathbf{elif}\;J \leq 7.2 \cdot 10^{+84}:\\
\;\;\;\;\left(-2 \cdot J\right) \cdot \frac{J}{U} - U\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot J\\
\end{array}
\end{array}
if J < -5.99999999999999949e142 or 7.1999999999999999e84 < J Initial program 98.9%
*-commutative98.9%
associate-*l*98.9%
unpow298.9%
hypot-1-def99.9%
*-commutative99.9%
associate-*l*99.9%
Simplified99.9%
Taylor expanded in K around 0 40.5%
associate-*r*40.5%
unpow240.5%
unpow240.5%
Simplified40.5%
Taylor expanded in U around 0 46.2%
if -5.99999999999999949e142 < J < -1.4600000000000001e41 or -3.80000000000000008e-32 < J < -8.3999999999999999e-255Initial program 60.1%
*-commutative60.1%
associate-*l*60.1%
unpow260.1%
hypot-1-def71.7%
*-commutative71.7%
associate-*l*71.7%
Simplified71.7%
Taylor expanded in U around -inf 42.2%
if -1.4600000000000001e41 < J < -3.80000000000000008e-32Initial program 99.9%
*-commutative99.9%
associate-*l*99.9%
unpow299.9%
hypot-1-def99.9%
*-commutative99.9%
associate-*l*99.9%
Simplified99.9%
Taylor expanded in J around inf 99.9%
*-commutative99.9%
*-commutative99.9%
associate-*r*99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in K around 0 72.3%
+-commutative72.3%
associate-*r*72.3%
distribute-rgt-out72.3%
unpow272.3%
Simplified72.3%
if -8.3999999999999999e-255 < J < 7.1999999999999999e84Initial program 60.6%
*-commutative60.6%
associate-*l*60.6%
unpow260.6%
hypot-1-def76.4%
*-commutative76.4%
associate-*l*76.4%
Simplified76.4%
Taylor expanded in K around 0 26.2%
associate-*r*26.2%
unpow226.2%
unpow226.2%
Simplified26.2%
clear-num26.2%
inv-pow26.2%
Applied egg-rr26.2%
unpow-126.2%
times-frac40.5%
Simplified40.5%
Taylor expanded in J around 0 36.3%
mul-1-neg36.3%
unsub-neg36.3%
unpow236.3%
associate-*r/36.3%
associate-*r*36.3%
*-commutative36.3%
Simplified36.3%
Final simplification43.0%
NOTE: U should be positive before calling this function
(FPCore (J K U)
:precision binary64
(if (<= J -9.8e+142)
(* -2.0 J)
(if (<= J -1.62e+34)
(* J (* -2.0 (- (/ U (* -2.0 J)) (/ J U))))
(if (<= J -3.1e-32)
(* J (+ -2.0 (* 0.25 (* K K))))
(if (<= J -8.4e-255)
U
(if (<= J 6.5e+85) (- (* (* -2.0 J) (/ J U)) U) (* -2.0 J)))))))U = abs(U);
double code(double J, double K, double U) {
double tmp;
if (J <= -9.8e+142) {
tmp = -2.0 * J;
} else if (J <= -1.62e+34) {
tmp = J * (-2.0 * ((U / (-2.0 * J)) - (J / U)));
} else if (J <= -3.1e-32) {
tmp = J * (-2.0 + (0.25 * (K * K)));
} else if (J <= -8.4e-255) {
tmp = U;
} else if (J <= 6.5e+85) {
tmp = ((-2.0 * J) * (J / U)) - 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 <= (-9.8d+142)) then
tmp = (-2.0d0) * j
else if (j <= (-1.62d+34)) then
tmp = j * ((-2.0d0) * ((u / ((-2.0d0) * j)) - (j / u)))
else if (j <= (-3.1d-32)) then
tmp = j * ((-2.0d0) + (0.25d0 * (k * k)))
else if (j <= (-8.4d-255)) then
tmp = u
else if (j <= 6.5d+85) then
tmp = (((-2.0d0) * j) * (j / u)) - 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 <= -9.8e+142) {
tmp = -2.0 * J;
} else if (J <= -1.62e+34) {
tmp = J * (-2.0 * ((U / (-2.0 * J)) - (J / U)));
} else if (J <= -3.1e-32) {
tmp = J * (-2.0 + (0.25 * (K * K)));
} else if (J <= -8.4e-255) {
tmp = U;
} else if (J <= 6.5e+85) {
tmp = ((-2.0 * J) * (J / U)) - U;
} else {
tmp = -2.0 * J;
}
return tmp;
}
U = abs(U) def code(J, K, U): tmp = 0 if J <= -9.8e+142: tmp = -2.0 * J elif J <= -1.62e+34: tmp = J * (-2.0 * ((U / (-2.0 * J)) - (J / U))) elif J <= -3.1e-32: tmp = J * (-2.0 + (0.25 * (K * K))) elif J <= -8.4e-255: tmp = U elif J <= 6.5e+85: tmp = ((-2.0 * J) * (J / U)) - U else: tmp = -2.0 * J return tmp
U = abs(U) function code(J, K, U) tmp = 0.0 if (J <= -9.8e+142) tmp = Float64(-2.0 * J); elseif (J <= -1.62e+34) tmp = Float64(J * Float64(-2.0 * Float64(Float64(U / Float64(-2.0 * J)) - Float64(J / U)))); elseif (J <= -3.1e-32) tmp = Float64(J * Float64(-2.0 + Float64(0.25 * Float64(K * K)))); elseif (J <= -8.4e-255) tmp = U; elseif (J <= 6.5e+85) tmp = Float64(Float64(Float64(-2.0 * J) * Float64(J / U)) - 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 <= -9.8e+142) tmp = -2.0 * J; elseif (J <= -1.62e+34) tmp = J * (-2.0 * ((U / (-2.0 * J)) - (J / U))); elseif (J <= -3.1e-32) tmp = J * (-2.0 + (0.25 * (K * K))); elseif (J <= -8.4e-255) tmp = U; elseif (J <= 6.5e+85) tmp = ((-2.0 * J) * (J / U)) - 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, -9.8e+142], N[(-2.0 * J), $MachinePrecision], If[LessEqual[J, -1.62e+34], N[(J * N[(-2.0 * N[(N[(U / N[(-2.0 * J), $MachinePrecision]), $MachinePrecision] - N[(J / U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[J, -3.1e-32], N[(J * N[(-2.0 + N[(0.25 * N[(K * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[J, -8.4e-255], U, If[LessEqual[J, 6.5e+85], N[(N[(N[(-2.0 * J), $MachinePrecision] * N[(J / U), $MachinePrecision]), $MachinePrecision] - U), $MachinePrecision], N[(-2.0 * J), $MachinePrecision]]]]]]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
\mathbf{if}\;J \leq -9.8 \cdot 10^{+142}:\\
\;\;\;\;-2 \cdot J\\
\mathbf{elif}\;J \leq -1.62 \cdot 10^{+34}:\\
\;\;\;\;J \cdot \left(-2 \cdot \left(\frac{U}{-2 \cdot J} - \frac{J}{U}\right)\right)\\
\mathbf{elif}\;J \leq -3.1 \cdot 10^{-32}:\\
\;\;\;\;J \cdot \left(-2 + 0.25 \cdot \left(K \cdot K\right)\right)\\
\mathbf{elif}\;J \leq -8.4 \cdot 10^{-255}:\\
\;\;\;\;U\\
\mathbf{elif}\;J \leq 6.5 \cdot 10^{+85}:\\
\;\;\;\;\left(-2 \cdot J\right) \cdot \frac{J}{U} - U\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot J\\
\end{array}
\end{array}
if J < -9.80000000000000101e142 or 6.4999999999999994e85 < J Initial program 98.9%
*-commutative98.9%
associate-*l*98.9%
unpow298.9%
hypot-1-def99.9%
*-commutative99.9%
associate-*l*99.9%
Simplified99.9%
Taylor expanded in K around 0 40.5%
associate-*r*40.5%
unpow240.5%
unpow240.5%
Simplified40.5%
Taylor expanded in U around 0 46.2%
if -9.80000000000000101e142 < J < -1.62000000000000006e34Initial program 93.8%
*-commutative93.8%
associate-*l*93.8%
unpow293.8%
hypot-1-def99.8%
*-commutative99.8%
associate-*l*99.8%
Simplified99.8%
Taylor expanded in K around 0 43.4%
associate-*r*43.4%
unpow243.4%
unpow243.4%
Simplified43.4%
Taylor expanded in U around -inf 29.0%
mul-1-neg29.0%
unsub-neg29.0%
metadata-eval29.0%
times-frac29.0%
*-lft-identity29.0%
Simplified29.0%
if -1.62000000000000006e34 < J < -3.10000000000000011e-32Initial program 99.9%
*-commutative99.9%
associate-*l*99.9%
unpow299.9%
hypot-1-def99.9%
*-commutative99.9%
associate-*l*99.9%
Simplified99.9%
Taylor expanded in J around inf 99.9%
*-commutative99.9%
*-commutative99.9%
associate-*r*99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in K around 0 72.3%
+-commutative72.3%
associate-*r*72.3%
distribute-rgt-out72.3%
unpow272.3%
Simplified72.3%
if -3.10000000000000011e-32 < J < -8.3999999999999999e-255Initial program 50.2%
*-commutative50.2%
associate-*l*50.2%
unpow250.2%
hypot-1-def63.4%
*-commutative63.4%
associate-*l*63.4%
Simplified63.4%
Taylor expanded in U around -inf 46.1%
if -8.3999999999999999e-255 < J < 6.4999999999999994e85Initial program 60.6%
*-commutative60.6%
associate-*l*60.6%
unpow260.6%
hypot-1-def76.4%
*-commutative76.4%
associate-*l*76.4%
Simplified76.4%
Taylor expanded in K around 0 26.2%
associate-*r*26.2%
unpow226.2%
unpow226.2%
Simplified26.2%
clear-num26.2%
inv-pow26.2%
Applied egg-rr26.2%
unpow-126.2%
times-frac40.5%
Simplified40.5%
Taylor expanded in J around 0 36.3%
mul-1-neg36.3%
unsub-neg36.3%
unpow236.3%
associate-*r/36.3%
associate-*r*36.3%
*-commutative36.3%
Simplified36.3%
Final simplification43.0%
NOTE: U should be positive before calling this function
(FPCore (J K U)
:precision binary64
(if (<= J -1.4e+142)
(* -2.0 J)
(if (<= J -9.8e+36)
U
(if (<= J -2.25e-32)
(* J (+ -2.0 (* 0.25 (* K K))))
(if (<= J -8.4e-255) U (if (<= J 5.8e+83) (- U) (* -2.0 J)))))))U = abs(U);
double code(double J, double K, double U) {
double tmp;
if (J <= -1.4e+142) {
tmp = -2.0 * J;
} else if (J <= -9.8e+36) {
tmp = U;
} else if (J <= -2.25e-32) {
tmp = J * (-2.0 + (0.25 * (K * K)));
} else if (J <= -8.4e-255) {
tmp = U;
} else if (J <= 5.8e+83) {
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.4d+142)) then
tmp = (-2.0d0) * j
else if (j <= (-9.8d+36)) then
tmp = u
else if (j <= (-2.25d-32)) then
tmp = j * ((-2.0d0) + (0.25d0 * (k * k)))
else if (j <= (-8.4d-255)) then
tmp = u
else if (j <= 5.8d+83) 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.4e+142) {
tmp = -2.0 * J;
} else if (J <= -9.8e+36) {
tmp = U;
} else if (J <= -2.25e-32) {
tmp = J * (-2.0 + (0.25 * (K * K)));
} else if (J <= -8.4e-255) {
tmp = U;
} else if (J <= 5.8e+83) {
tmp = -U;
} else {
tmp = -2.0 * J;
}
return tmp;
}
U = abs(U) def code(J, K, U): tmp = 0 if J <= -1.4e+142: tmp = -2.0 * J elif J <= -9.8e+36: tmp = U elif J <= -2.25e-32: tmp = J * (-2.0 + (0.25 * (K * K))) elif J <= -8.4e-255: tmp = U elif J <= 5.8e+83: tmp = -U else: tmp = -2.0 * J return tmp
U = abs(U) function code(J, K, U) tmp = 0.0 if (J <= -1.4e+142) tmp = Float64(-2.0 * J); elseif (J <= -9.8e+36) tmp = U; elseif (J <= -2.25e-32) tmp = Float64(J * Float64(-2.0 + Float64(0.25 * Float64(K * K)))); elseif (J <= -8.4e-255) tmp = U; elseif (J <= 5.8e+83) 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.4e+142) tmp = -2.0 * J; elseif (J <= -9.8e+36) tmp = U; elseif (J <= -2.25e-32) tmp = J * (-2.0 + (0.25 * (K * K))); elseif (J <= -8.4e-255) tmp = U; elseif (J <= 5.8e+83) 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.4e+142], N[(-2.0 * J), $MachinePrecision], If[LessEqual[J, -9.8e+36], U, If[LessEqual[J, -2.25e-32], N[(J * N[(-2.0 + N[(0.25 * N[(K * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[J, -8.4e-255], U, If[LessEqual[J, 5.8e+83], (-U), N[(-2.0 * J), $MachinePrecision]]]]]]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
\mathbf{if}\;J \leq -1.4 \cdot 10^{+142}:\\
\;\;\;\;-2 \cdot J\\
\mathbf{elif}\;J \leq -9.8 \cdot 10^{+36}:\\
\;\;\;\;U\\
\mathbf{elif}\;J \leq -2.25 \cdot 10^{-32}:\\
\;\;\;\;J \cdot \left(-2 + 0.25 \cdot \left(K \cdot K\right)\right)\\
\mathbf{elif}\;J \leq -8.4 \cdot 10^{-255}:\\
\;\;\;\;U\\
\mathbf{elif}\;J \leq 5.8 \cdot 10^{+83}:\\
\;\;\;\;-U\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot J\\
\end{array}
\end{array}
if J < -1.4e142 or 5.79999999999999999e83 < J Initial program 98.9%
*-commutative98.9%
associate-*l*98.9%
unpow298.9%
hypot-1-def99.9%
*-commutative99.9%
associate-*l*99.9%
Simplified99.9%
Taylor expanded in K around 0 40.5%
associate-*r*40.5%
unpow240.5%
unpow240.5%
Simplified40.5%
Taylor expanded in U around 0 46.2%
if -1.4e142 < J < -9.79999999999999962e36 or -2.25000000000000002e-32 < J < -8.3999999999999999e-255Initial program 60.1%
*-commutative60.1%
associate-*l*60.1%
unpow260.1%
hypot-1-def71.7%
*-commutative71.7%
associate-*l*71.7%
Simplified71.7%
Taylor expanded in U around -inf 42.2%
if -9.79999999999999962e36 < J < -2.25000000000000002e-32Initial program 99.9%
*-commutative99.9%
associate-*l*99.9%
unpow299.9%
hypot-1-def99.9%
*-commutative99.9%
associate-*l*99.9%
Simplified99.9%
Taylor expanded in J around inf 99.9%
*-commutative99.9%
*-commutative99.9%
associate-*r*99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in K around 0 72.3%
+-commutative72.3%
associate-*r*72.3%
distribute-rgt-out72.3%
unpow272.3%
Simplified72.3%
if -8.3999999999999999e-255 < J < 5.79999999999999999e83Initial program 60.6%
*-commutative60.6%
associate-*l*60.6%
unpow260.6%
hypot-1-def76.4%
*-commutative76.4%
associate-*l*76.4%
Simplified76.4%
Taylor expanded in J around 0 36.3%
neg-mul-136.3%
Simplified36.3%
Final simplification43.1%
NOTE: U should be positive before calling this function
(FPCore (J K U)
:precision binary64
(if (<= J -4.4e+142)
(* -2.0 J)
(if (<= J -1e+43)
U
(if (<= J -1.85e-68)
(* -2.0 J)
(if (<= J -8.4e-255) U (if (<= J 2e+84) (- U) (* -2.0 J)))))))U = abs(U);
double code(double J, double K, double U) {
double tmp;
if (J <= -4.4e+142) {
tmp = -2.0 * J;
} else if (J <= -1e+43) {
tmp = U;
} else if (J <= -1.85e-68) {
tmp = -2.0 * J;
} else if (J <= -8.4e-255) {
tmp = U;
} else if (J <= 2e+84) {
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.4d+142)) then
tmp = (-2.0d0) * j
else if (j <= (-1d+43)) then
tmp = u
else if (j <= (-1.85d-68)) then
tmp = (-2.0d0) * j
else if (j <= (-8.4d-255)) then
tmp = u
else if (j <= 2d+84) 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.4e+142) {
tmp = -2.0 * J;
} else if (J <= -1e+43) {
tmp = U;
} else if (J <= -1.85e-68) {
tmp = -2.0 * J;
} else if (J <= -8.4e-255) {
tmp = U;
} else if (J <= 2e+84) {
tmp = -U;
} else {
tmp = -2.0 * J;
}
return tmp;
}
U = abs(U) def code(J, K, U): tmp = 0 if J <= -4.4e+142: tmp = -2.0 * J elif J <= -1e+43: tmp = U elif J <= -1.85e-68: tmp = -2.0 * J elif J <= -8.4e-255: tmp = U elif J <= 2e+84: tmp = -U else: tmp = -2.0 * J return tmp
U = abs(U) function code(J, K, U) tmp = 0.0 if (J <= -4.4e+142) tmp = Float64(-2.0 * J); elseif (J <= -1e+43) tmp = U; elseif (J <= -1.85e-68) tmp = Float64(-2.0 * J); elseif (J <= -8.4e-255) tmp = U; elseif (J <= 2e+84) 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.4e+142) tmp = -2.0 * J; elseif (J <= -1e+43) tmp = U; elseif (J <= -1.85e-68) tmp = -2.0 * J; elseif (J <= -8.4e-255) tmp = U; elseif (J <= 2e+84) 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.4e+142], N[(-2.0 * J), $MachinePrecision], If[LessEqual[J, -1e+43], U, If[LessEqual[J, -1.85e-68], N[(-2.0 * J), $MachinePrecision], If[LessEqual[J, -8.4e-255], U, If[LessEqual[J, 2e+84], (-U), N[(-2.0 * J), $MachinePrecision]]]]]]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
\mathbf{if}\;J \leq -4.4 \cdot 10^{+142}:\\
\;\;\;\;-2 \cdot J\\
\mathbf{elif}\;J \leq -1 \cdot 10^{+43}:\\
\;\;\;\;U\\
\mathbf{elif}\;J \leq -1.85 \cdot 10^{-68}:\\
\;\;\;\;-2 \cdot J\\
\mathbf{elif}\;J \leq -8.4 \cdot 10^{-255}:\\
\;\;\;\;U\\
\mathbf{elif}\;J \leq 2 \cdot 10^{+84}:\\
\;\;\;\;-U\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot J\\
\end{array}
\end{array}
if J < -4.39999999999999974e142 or -1.00000000000000001e43 < J < -1.85000000000000001e-68 or 2.00000000000000012e84 < J Initial program 98.1%
*-commutative98.1%
associate-*l*98.1%
unpow298.1%
hypot-1-def99.9%
*-commutative99.9%
associate-*l*99.9%
Simplified99.9%
Taylor expanded in K around 0 43.4%
associate-*r*43.4%
unpow243.4%
unpow243.4%
Simplified43.4%
Taylor expanded in U around 0 48.3%
if -4.39999999999999974e142 < J < -1.00000000000000001e43 or -1.85000000000000001e-68 < J < -8.3999999999999999e-255Initial program 59.7%
*-commutative59.7%
associate-*l*59.7%
unpow259.7%
hypot-1-def70.3%
*-commutative70.3%
associate-*l*70.3%
Simplified70.3%
Taylor expanded in U around -inf 44.0%
if -8.3999999999999999e-255 < J < 2.00000000000000012e84Initial program 60.6%
*-commutative60.6%
associate-*l*60.6%
unpow260.6%
hypot-1-def76.4%
*-commutative76.4%
associate-*l*76.4%
Simplified76.4%
Taylor expanded in J around 0 36.3%
neg-mul-136.3%
Simplified36.3%
Final simplification43.4%
NOTE: U should be positive before calling this function (FPCore (J K U) :precision binary64 (if (<= J -8.4e-255) U (- U)))
U = abs(U);
double code(double J, double K, double U) {
double tmp;
if (J <= -8.4e-255) {
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.4d-255)) 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.4e-255) {
tmp = U;
} else {
tmp = -U;
}
return tmp;
}
U = abs(U) def code(J, K, U): tmp = 0 if J <= -8.4e-255: tmp = U else: tmp = -U return tmp
U = abs(U) function code(J, K, U) tmp = 0.0 if (J <= -8.4e-255) 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.4e-255) 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.4e-255], U, (-U)]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
\mathbf{if}\;J \leq -8.4 \cdot 10^{-255}:\\
\;\;\;\;U\\
\mathbf{else}:\\
\;\;\;\;-U\\
\end{array}
\end{array}
if J < -8.3999999999999999e-255Initial program 77.2%
*-commutative77.2%
associate-*l*77.2%
unpow277.2%
hypot-1-def83.8%
*-commutative83.8%
associate-*l*83.8%
Simplified83.8%
Taylor expanded in U around -inf 30.7%
if -8.3999999999999999e-255 < J Initial program 75.6%
*-commutative75.6%
associate-*l*75.6%
unpow275.6%
hypot-1-def85.8%
*-commutative85.8%
associate-*l*85.8%
Simplified85.8%
Taylor expanded in J around 0 28.5%
neg-mul-128.5%
Simplified28.5%
Final simplification29.5%
NOTE: U should be positive before calling this function (FPCore (J K U) :precision binary64 U)
U = abs(U);
double code(double J, double K, double U) {
return U;
}
NOTE: U should be positive before calling this function
real(8) function code(j, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: k
real(8), intent (in) :: u
code = u
end function
U = Math.abs(U);
public static double code(double J, double K, double U) {
return U;
}
U = abs(U) def code(J, K, U): return U
U = abs(U) function code(J, K, U) return U end
U = abs(U) function tmp = code(J, K, U) tmp = U; end
NOTE: U should be positive before calling this function code[J_, K_, U_] := U
\begin{array}{l}
U = |U|\\
\\
U
\end{array}
Initial program 76.4%
*-commutative76.4%
associate-*l*76.4%
unpow276.4%
hypot-1-def84.9%
*-commutative84.9%
associate-*l*84.9%
Simplified84.9%
Taylor expanded in U around -inf 28.8%
Final simplification28.8%
herbie shell --seed 2023215
(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)))))