
(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 11 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+308)
(* (* 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 <= 1e+308) {
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 <= 1e+308) {
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 <= 1e+308: 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 <= 1e+308) 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 <= 1e+308) 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, 1e+308], 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 10^{+308}:\\
\;\;\;\;\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%
associate-*r*5.5%
*-commutative5.5%
associate-*l*5.5%
*-commutative5.5%
unpow25.5%
hypot-1-def55.9%
*-commutative55.9%
associate-*l*55.9%
Simplified55.9%
Taylor expanded in J around 0 53.3%
neg-mul-153.3%
Simplified53.3%
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)))) < 1e308Initial program 99.8%
*-commutative99.8%
associate-*l*99.8%
unpow299.8%
hypot-1-def99.9%
*-commutative99.9%
associate-*l*99.9%
Simplified99.9%
if 1e308 < (*.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.9%
*-commutative4.9%
associate-*l*4.9%
associate-*r*4.9%
*-commutative4.9%
associate-*l*4.9%
*-commutative4.9%
unpow24.9%
hypot-1-def60.9%
*-commutative60.9%
associate-*l*60.9%
Simplified60.9%
Taylor expanded in U around -inf 53.3%
Final simplification87.5%
NOTE: U should be positive before calling this function
(FPCore (J K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= U 2.05e+246)
(* J (* t_0 (* -2.0 (hypot 1.0 (/ U (* J (* 2.0 t_0)))))))
(- U))))U = abs(U);
double code(double J, double K, double U) {
double t_0 = cos((K / 2.0));
double tmp;
if (U <= 2.05e+246) {
tmp = J * (t_0 * (-2.0 * hypot(1.0, (U / (J * (2.0 * t_0))))));
} else {
tmp = -U;
}
return tmp;
}
U = Math.abs(U);
public static double code(double J, double K, double U) {
double t_0 = Math.cos((K / 2.0));
double tmp;
if (U <= 2.05e+246) {
tmp = J * (t_0 * (-2.0 * Math.hypot(1.0, (U / (J * (2.0 * t_0))))));
} else {
tmp = -U;
}
return tmp;
}
U = abs(U) def code(J, K, U): t_0 = math.cos((K / 2.0)) tmp = 0 if U <= 2.05e+246: tmp = J * (t_0 * (-2.0 * math.hypot(1.0, (U / (J * (2.0 * t_0)))))) else: tmp = -U return tmp
U = abs(U) function code(J, K, U) t_0 = cos(Float64(K / 2.0)) tmp = 0.0 if (U <= 2.05e+246) tmp = Float64(J * Float64(t_0 * Float64(-2.0 * hypot(1.0, Float64(U / Float64(J * Float64(2.0 * t_0))))))); else tmp = Float64(-U); end return tmp end
U = abs(U) function tmp_2 = code(J, K, U) t_0 = cos((K / 2.0)); tmp = 0.0; if (U <= 2.05e+246) tmp = J * (t_0 * (-2.0 * hypot(1.0, (U / (J * (2.0 * t_0)))))); else tmp = -U; end tmp_2 = tmp; end
NOTE: U should be positive before calling this function
code[J_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[U, 2.05e+246], 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], (-U)]]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;U \leq 2.05 \cdot 10^{+246}:\\
\;\;\;\;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)\\
\mathbf{else}:\\
\;\;\;\;-U\\
\end{array}
\end{array}
if U < 2.04999999999999988e246Initial program 76.7%
*-commutative76.7%
associate-*l*76.7%
associate-*r*76.7%
*-commutative76.7%
associate-*l*76.7%
*-commutative76.7%
unpow276.7%
hypot-1-def90.3%
*-commutative90.3%
associate-*l*90.3%
Simplified90.3%
if 2.04999999999999988e246 < U Initial program 18.6%
*-commutative18.6%
associate-*l*18.6%
associate-*r*18.6%
*-commutative18.6%
associate-*l*18.6%
*-commutative18.6%
unpow218.6%
hypot-1-def49.0%
*-commutative49.0%
associate-*l*49.0%
Simplified49.0%
Taylor expanded in J around 0 77.8%
neg-mul-177.8%
Simplified77.8%
Final simplification89.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.8e-234)
t_0
(if (<= J -5e-310) U (if (<= J 3.1e-196) (- 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.8e-234) {
tmp = t_0;
} else if (J <= -5e-310) {
tmp = U;
} else if (J <= 3.1e-196) {
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 <= -2.8e-234) {
tmp = t_0;
} else if (J <= -5e-310) {
tmp = U;
} else if (J <= 3.1e-196) {
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 <= -2.8e-234: tmp = t_0 elif J <= -5e-310: tmp = U elif J <= 3.1e-196: 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.8e-234) tmp = t_0; elseif (J <= -5e-310) tmp = U; elseif (J <= 3.1e-196) 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 <= -2.8e-234) tmp = t_0; elseif (J <= -5e-310) tmp = U; elseif (J <= 3.1e-196) 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, -2.8e-234], t$95$0, If[LessEqual[J, -5e-310], U, If[LessEqual[J, 3.1e-196], (-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.8 \cdot 10^{-234}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;J \leq -5 \cdot 10^{-310}:\\
\;\;\;\;U\\
\mathbf{elif}\;J \leq 3.1 \cdot 10^{-196}:\\
\;\;\;\;-U\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if J < -2.7999999999999999e-234 or 3.09999999999999993e-196 < J Initial program 80.7%
*-commutative80.7%
associate-*l*80.7%
unpow280.7%
hypot-1-def93.9%
*-commutative93.9%
associate-*l*93.9%
Simplified93.9%
Taylor expanded in K around 0 80.4%
if -2.7999999999999999e-234 < J < -4.999999999999985e-310Initial program 36.3%
*-commutative36.3%
associate-*l*36.3%
associate-*r*36.3%
*-commutative36.3%
associate-*l*36.3%
*-commutative36.3%
unpow236.3%
hypot-1-def62.0%
*-commutative62.0%
associate-*l*62.0%
Simplified62.0%
Taylor expanded in U around -inf 54.3%
if -4.999999999999985e-310 < J < 3.09999999999999993e-196Initial program 44.2%
*-commutative44.2%
associate-*l*44.2%
associate-*r*44.2%
*-commutative44.2%
associate-*l*44.1%
*-commutative44.1%
unpow244.1%
hypot-1-def60.2%
*-commutative60.2%
associate-*l*60.2%
Simplified60.2%
Taylor expanded in J around 0 55.0%
neg-mul-155.0%
Simplified55.0%
Final simplification76.5%
NOTE: U should be positive before calling this function
(FPCore (J K U)
:precision binary64
(let* ((t_0 (* J (/ J U))) (t_1 (* J (* -2.0 (cos (* K 0.5))))))
(if (<= J -2.1e-52)
t_1
(if (<= J -1.1e-129)
(+ U (* 2.0 t_0))
(if (<= J -2.3e-165)
t_1
(if (<= J -2.75e-238)
(- U)
(if (<= J -5e-310)
U
(if (<= J 1.25e-40) (- (* -2.0 t_0) U) t_1))))))))U = abs(U);
double code(double J, double K, double U) {
double t_0 = J * (J / U);
double t_1 = J * (-2.0 * cos((K * 0.5)));
double tmp;
if (J <= -2.1e-52) {
tmp = t_1;
} else if (J <= -1.1e-129) {
tmp = U + (2.0 * t_0);
} else if (J <= -2.3e-165) {
tmp = t_1;
} else if (J <= -2.75e-238) {
tmp = -U;
} else if (J <= -5e-310) {
tmp = U;
} else if (J <= 1.25e-40) {
tmp = (-2.0 * t_0) - U;
} else {
tmp = t_1;
}
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) :: t_1
real(8) :: tmp
t_0 = j * (j / u)
t_1 = j * ((-2.0d0) * cos((k * 0.5d0)))
if (j <= (-2.1d-52)) then
tmp = t_1
else if (j <= (-1.1d-129)) then
tmp = u + (2.0d0 * t_0)
else if (j <= (-2.3d-165)) then
tmp = t_1
else if (j <= (-2.75d-238)) then
tmp = -u
else if (j <= (-5d-310)) then
tmp = u
else if (j <= 1.25d-40) then
tmp = ((-2.0d0) * t_0) - u
else
tmp = t_1
end if
code = tmp
end function
U = Math.abs(U);
public static double code(double J, double K, double U) {
double t_0 = J * (J / U);
double t_1 = J * (-2.0 * Math.cos((K * 0.5)));
double tmp;
if (J <= -2.1e-52) {
tmp = t_1;
} else if (J <= -1.1e-129) {
tmp = U + (2.0 * t_0);
} else if (J <= -2.3e-165) {
tmp = t_1;
} else if (J <= -2.75e-238) {
tmp = -U;
} else if (J <= -5e-310) {
tmp = U;
} else if (J <= 1.25e-40) {
tmp = (-2.0 * t_0) - U;
} else {
tmp = t_1;
}
return tmp;
}
U = abs(U) def code(J, K, U): t_0 = J * (J / U) t_1 = J * (-2.0 * math.cos((K * 0.5))) tmp = 0 if J <= -2.1e-52: tmp = t_1 elif J <= -1.1e-129: tmp = U + (2.0 * t_0) elif J <= -2.3e-165: tmp = t_1 elif J <= -2.75e-238: tmp = -U elif J <= -5e-310: tmp = U elif J <= 1.25e-40: tmp = (-2.0 * t_0) - U else: tmp = t_1 return tmp
U = abs(U) function code(J, K, U) t_0 = Float64(J * Float64(J / U)) t_1 = Float64(J * Float64(-2.0 * cos(Float64(K * 0.5)))) tmp = 0.0 if (J <= -2.1e-52) tmp = t_1; elseif (J <= -1.1e-129) tmp = Float64(U + Float64(2.0 * t_0)); elseif (J <= -2.3e-165) tmp = t_1; elseif (J <= -2.75e-238) tmp = Float64(-U); elseif (J <= -5e-310) tmp = U; elseif (J <= 1.25e-40) tmp = Float64(Float64(-2.0 * t_0) - U); else tmp = t_1; end return tmp end
U = abs(U) function tmp_2 = code(J, K, U) t_0 = J * (J / U); t_1 = J * (-2.0 * cos((K * 0.5))); tmp = 0.0; if (J <= -2.1e-52) tmp = t_1; elseif (J <= -1.1e-129) tmp = U + (2.0 * t_0); elseif (J <= -2.3e-165) tmp = t_1; elseif (J <= -2.75e-238) tmp = -U; elseif (J <= -5e-310) tmp = U; elseif (J <= 1.25e-40) tmp = (-2.0 * t_0) - 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[(J * N[(J / U), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(J * N[(-2.0 * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[J, -2.1e-52], t$95$1, If[LessEqual[J, -1.1e-129], N[(U + N[(2.0 * t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[J, -2.3e-165], t$95$1, If[LessEqual[J, -2.75e-238], (-U), If[LessEqual[J, -5e-310], U, If[LessEqual[J, 1.25e-40], N[(N[(-2.0 * t$95$0), $MachinePrecision] - U), $MachinePrecision], t$95$1]]]]]]]]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
t_0 := J \cdot \frac{J}{U}\\
t_1 := J \cdot \left(-2 \cdot \cos \left(K \cdot 0.5\right)\right)\\
\mathbf{if}\;J \leq -2.1 \cdot 10^{-52}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;J \leq -1.1 \cdot 10^{-129}:\\
\;\;\;\;U + 2 \cdot t_0\\
\mathbf{elif}\;J \leq -2.3 \cdot 10^{-165}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;J \leq -2.75 \cdot 10^{-238}:\\
\;\;\;\;-U\\
\mathbf{elif}\;J \leq -5 \cdot 10^{-310}:\\
\;\;\;\;U\\
\mathbf{elif}\;J \leq 1.25 \cdot 10^{-40}:\\
\;\;\;\;-2 \cdot t_0 - U\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if J < -2.0999999999999999e-52 or -1.10000000000000001e-129 < J < -2.3e-165 or 1.24999999999999991e-40 < J Initial program 92.0%
*-commutative92.0%
associate-*l*92.0%
associate-*r*92.0%
*-commutative92.0%
associate-*l*91.9%
*-commutative91.9%
unpow291.9%
hypot-1-def98.7%
*-commutative98.7%
associate-*l*98.7%
Simplified98.7%
Taylor expanded in U around 0 74.7%
if -2.0999999999999999e-52 < J < -1.10000000000000001e-129Initial program 65.2%
*-commutative65.2%
associate-*l*65.2%
associate-*r*65.2%
*-commutative65.2%
associate-*l*65.2%
*-commutative65.2%
unpow265.2%
hypot-1-def99.7%
*-commutative99.7%
associate-*l*99.7%
Simplified99.7%
Taylor expanded in U around -inf 46.9%
fma-def46.9%
associate-/l*46.9%
unpow246.9%
Simplified46.9%
Taylor expanded in K around 0 46.9%
unpow246.9%
associate-/l*46.9%
Simplified46.9%
fma-udef46.9%
div-inv46.9%
clear-num46.9%
Applied egg-rr46.9%
if -2.3e-165 < J < -2.74999999999999997e-238Initial program 44.5%
*-commutative44.5%
associate-*l*44.5%
associate-*r*44.5%
*-commutative44.5%
associate-*l*44.4%
*-commutative44.4%
unpow244.4%
hypot-1-def69.8%
*-commutative69.8%
associate-*l*69.8%
Simplified69.8%
Taylor expanded in J around 0 38.6%
neg-mul-138.6%
Simplified38.6%
if -2.74999999999999997e-238 < J < -4.999999999999985e-310Initial program 44.4%
*-commutative44.4%
associate-*l*44.4%
associate-*r*44.4%
*-commutative44.4%
associate-*l*44.4%
*-commutative44.4%
unpow244.4%
hypot-1-def68.4%
*-commutative68.4%
associate-*l*68.4%
Simplified68.4%
Taylor expanded in U around -inf 51.1%
if -4.999999999999985e-310 < J < 1.24999999999999991e-40Initial program 48.5%
*-commutative48.5%
associate-*l*48.5%
unpow248.5%
hypot-1-def72.1%
*-commutative72.1%
associate-*l*72.1%
Simplified72.1%
Taylor expanded in K around 0 56.6%
Taylor expanded in K around 0 55.5%
Taylor expanded in J around 0 43.8%
fma-def43.8%
unpow243.8%
associate-*r/43.7%
neg-mul-143.7%
fma-neg43.7%
Simplified43.7%
Final simplification62.3%
NOTE: U should be positive before calling this function (FPCore (J K U) :precision binary64 (if (<= K 1.75e-6) (* (* -2.0 J) (hypot 1.0 (/ U (* J 2.0)))) (* J (* -2.0 (cos (* K 0.5))))))
U = abs(U);
double code(double J, double K, double U) {
double tmp;
if (K <= 1.75e-6) {
tmp = (-2.0 * J) * hypot(1.0, (U / (J * 2.0)));
} else {
tmp = J * (-2.0 * cos((K * 0.5)));
}
return tmp;
}
U = Math.abs(U);
public static double code(double J, double K, double U) {
double tmp;
if (K <= 1.75e-6) {
tmp = (-2.0 * J) * Math.hypot(1.0, (U / (J * 2.0)));
} else {
tmp = J * (-2.0 * Math.cos((K * 0.5)));
}
return tmp;
}
U = abs(U) def code(J, K, U): tmp = 0 if K <= 1.75e-6: tmp = (-2.0 * J) * math.hypot(1.0, (U / (J * 2.0))) else: tmp = J * (-2.0 * math.cos((K * 0.5))) return tmp
U = abs(U) function code(J, K, U) tmp = 0.0 if (K <= 1.75e-6) tmp = Float64(Float64(-2.0 * J) * hypot(1.0, Float64(U / Float64(J * 2.0)))); else tmp = Float64(J * Float64(-2.0 * cos(Float64(K * 0.5)))); end return tmp end
U = abs(U) function tmp_2 = code(J, K, U) tmp = 0.0; if (K <= 1.75e-6) tmp = (-2.0 * J) * hypot(1.0, (U / (J * 2.0))); else tmp = J * (-2.0 * cos((K * 0.5))); end tmp_2 = tmp; end
NOTE: U should be positive before calling this function code[J_, K_, U_] := If[LessEqual[K, 1.75e-6], N[(N[(-2.0 * J), $MachinePrecision] * N[Sqrt[1.0 ^ 2 + N[(U / N[(J * 2.0), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision], N[(J * N[(-2.0 * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
\mathbf{if}\;K \leq 1.75 \cdot 10^{-6}:\\
\;\;\;\;\left(-2 \cdot J\right) \cdot \mathsf{hypot}\left(1, \frac{U}{J \cdot 2}\right)\\
\mathbf{else}:\\
\;\;\;\;J \cdot \left(-2 \cdot \cos \left(K \cdot 0.5\right)\right)\\
\end{array}
\end{array}
if K < 1.74999999999999997e-6Initial program 74.9%
*-commutative74.9%
associate-*l*74.9%
unpow274.9%
hypot-1-def89.5%
*-commutative89.5%
associate-*l*89.5%
Simplified89.5%
Taylor expanded in K around 0 80.9%
Taylor expanded in K around 0 72.3%
if 1.74999999999999997e-6 < K Initial program 74.1%
*-commutative74.1%
associate-*l*74.1%
associate-*r*74.1%
*-commutative74.1%
associate-*l*74.1%
*-commutative74.1%
unpow274.1%
hypot-1-def87.0%
*-commutative87.0%
associate-*l*87.0%
Simplified87.0%
Taylor expanded in U around 0 50.2%
Final simplification66.6%
NOTE: U should be positive before calling this function
(FPCore (J K U)
:precision binary64
(if (<= J -1.15e-38)
(* -2.0 J)
(if (<= J 8e-309)
U
(if (<= J 7.8e+111) (- U) (* J (+ -2.0 (* 0.25 (* K K))))))))U = abs(U);
double code(double J, double K, double U) {
double tmp;
if (J <= -1.15e-38) {
tmp = -2.0 * J;
} else if (J <= 8e-309) {
tmp = U;
} else if (J <= 7.8e+111) {
tmp = -U;
} else {
tmp = J * (-2.0 + (0.25 * (K * K)));
}
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.15d-38)) then
tmp = (-2.0d0) * j
else if (j <= 8d-309) then
tmp = u
else if (j <= 7.8d+111) then
tmp = -u
else
tmp = j * ((-2.0d0) + (0.25d0 * (k * k)))
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.15e-38) {
tmp = -2.0 * J;
} else if (J <= 8e-309) {
tmp = U;
} else if (J <= 7.8e+111) {
tmp = -U;
} else {
tmp = J * (-2.0 + (0.25 * (K * K)));
}
return tmp;
}
U = abs(U) def code(J, K, U): tmp = 0 if J <= -1.15e-38: tmp = -2.0 * J elif J <= 8e-309: tmp = U elif J <= 7.8e+111: tmp = -U else: tmp = J * (-2.0 + (0.25 * (K * K))) return tmp
U = abs(U) function code(J, K, U) tmp = 0.0 if (J <= -1.15e-38) tmp = Float64(-2.0 * J); elseif (J <= 8e-309) tmp = U; elseif (J <= 7.8e+111) tmp = Float64(-U); else tmp = Float64(J * Float64(-2.0 + Float64(0.25 * Float64(K * K)))); end return tmp end
U = abs(U) function tmp_2 = code(J, K, U) tmp = 0.0; if (J <= -1.15e-38) tmp = -2.0 * J; elseif (J <= 8e-309) tmp = U; elseif (J <= 7.8e+111) tmp = -U; else tmp = J * (-2.0 + (0.25 * (K * K))); end tmp_2 = tmp; end
NOTE: U should be positive before calling this function code[J_, K_, U_] := If[LessEqual[J, -1.15e-38], N[(-2.0 * J), $MachinePrecision], If[LessEqual[J, 8e-309], U, If[LessEqual[J, 7.8e+111], (-U), N[(J * N[(-2.0 + N[(0.25 * N[(K * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
\mathbf{if}\;J \leq -1.15 \cdot 10^{-38}:\\
\;\;\;\;-2 \cdot J\\
\mathbf{elif}\;J \leq 8 \cdot 10^{-309}:\\
\;\;\;\;U\\
\mathbf{elif}\;J \leq 7.8 \cdot 10^{+111}:\\
\;\;\;\;-U\\
\mathbf{else}:\\
\;\;\;\;J \cdot \left(-2 + 0.25 \cdot \left(K \cdot K\right)\right)\\
\end{array}
\end{array}
if J < -1.15000000000000001e-38Initial program 93.0%
*-commutative93.0%
associate-*l*93.0%
associate-*r*93.0%
*-commutative93.0%
associate-*l*93.0%
*-commutative93.0%
unpow293.0%
hypot-1-def99.8%
*-commutative99.8%
associate-*l*99.8%
Simplified99.8%
Taylor expanded in U around 0 80.6%
Taylor expanded in K around 0 49.8%
if -1.15000000000000001e-38 < J < 8.0000000000000003e-309Initial program 59.3%
*-commutative59.3%
associate-*l*59.3%
associate-*r*59.3%
*-commutative59.3%
associate-*l*59.3%
*-commutative59.3%
unpow259.3%
hypot-1-def81.3%
*-commutative81.3%
associate-*l*81.3%
Simplified81.3%
Taylor expanded in U around -inf 37.7%
if 8.0000000000000003e-309 < J < 7.79999999999999958e111Initial program 63.7%
*-commutative63.7%
associate-*l*63.7%
associate-*r*63.7%
*-commutative63.7%
associate-*l*63.7%
*-commutative63.7%
unpow263.7%
hypot-1-def82.4%
*-commutative82.4%
associate-*l*82.4%
Simplified82.4%
Taylor expanded in J around 0 34.8%
neg-mul-134.8%
Simplified34.8%
if 7.79999999999999958e111 < J Initial program 99.9%
*-commutative99.9%
associate-*l*99.9%
associate-*r*99.9%
*-commutative99.9%
associate-*l*99.9%
*-commutative99.9%
unpow299.9%
hypot-1-def99.9%
*-commutative99.9%
associate-*l*99.9%
Simplified99.9%
Taylor expanded in U around 0 94.5%
Taylor expanded in K around 0 63.1%
associate-*r*63.1%
distribute-rgt-out63.1%
unpow263.1%
Simplified63.1%
Final simplification42.8%
NOTE: U should be positive before calling this function
(FPCore (J K U)
:precision binary64
(if (<= J -2.15e-38)
(* -2.0 J)
(if (<= J -5e-310)
(+ U (* 2.0 (* J (/ J U))))
(if (<= J 6.8e+111) (- U) (* J (+ -2.0 (* 0.25 (* K K))))))))U = abs(U);
double code(double J, double K, double U) {
double tmp;
if (J <= -2.15e-38) {
tmp = -2.0 * J;
} else if (J <= -5e-310) {
tmp = U + (2.0 * (J * (J / U)));
} else if (J <= 6.8e+111) {
tmp = -U;
} else {
tmp = J * (-2.0 + (0.25 * (K * K)));
}
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.15d-38)) then
tmp = (-2.0d0) * j
else if (j <= (-5d-310)) then
tmp = u + (2.0d0 * (j * (j / u)))
else if (j <= 6.8d+111) then
tmp = -u
else
tmp = j * ((-2.0d0) + (0.25d0 * (k * k)))
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.15e-38) {
tmp = -2.0 * J;
} else if (J <= -5e-310) {
tmp = U + (2.0 * (J * (J / U)));
} else if (J <= 6.8e+111) {
tmp = -U;
} else {
tmp = J * (-2.0 + (0.25 * (K * K)));
}
return tmp;
}
U = abs(U) def code(J, K, U): tmp = 0 if J <= -2.15e-38: tmp = -2.0 * J elif J <= -5e-310: tmp = U + (2.0 * (J * (J / U))) elif J <= 6.8e+111: tmp = -U else: tmp = J * (-2.0 + (0.25 * (K * K))) return tmp
U = abs(U) function code(J, K, U) tmp = 0.0 if (J <= -2.15e-38) tmp = Float64(-2.0 * J); elseif (J <= -5e-310) tmp = Float64(U + Float64(2.0 * Float64(J * Float64(J / U)))); elseif (J <= 6.8e+111) tmp = Float64(-U); else tmp = Float64(J * Float64(-2.0 + Float64(0.25 * Float64(K * K)))); end return tmp end
U = abs(U) function tmp_2 = code(J, K, U) tmp = 0.0; if (J <= -2.15e-38) tmp = -2.0 * J; elseif (J <= -5e-310) tmp = U + (2.0 * (J * (J / U))); elseif (J <= 6.8e+111) tmp = -U; else tmp = J * (-2.0 + (0.25 * (K * K))); end tmp_2 = tmp; end
NOTE: U should be positive before calling this function code[J_, K_, U_] := If[LessEqual[J, -2.15e-38], N[(-2.0 * J), $MachinePrecision], If[LessEqual[J, -5e-310], N[(U + N[(2.0 * N[(J * N[(J / U), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[J, 6.8e+111], (-U), N[(J * N[(-2.0 + N[(0.25 * N[(K * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
\mathbf{if}\;J \leq -2.15 \cdot 10^{-38}:\\
\;\;\;\;-2 \cdot J\\
\mathbf{elif}\;J \leq -5 \cdot 10^{-310}:\\
\;\;\;\;U + 2 \cdot \left(J \cdot \frac{J}{U}\right)\\
\mathbf{elif}\;J \leq 6.8 \cdot 10^{+111}:\\
\;\;\;\;-U\\
\mathbf{else}:\\
\;\;\;\;J \cdot \left(-2 + 0.25 \cdot \left(K \cdot K\right)\right)\\
\end{array}
\end{array}
if J < -2.1500000000000001e-38Initial program 93.0%
*-commutative93.0%
associate-*l*93.0%
associate-*r*93.0%
*-commutative93.0%
associate-*l*93.0%
*-commutative93.0%
unpow293.0%
hypot-1-def99.8%
*-commutative99.8%
associate-*l*99.8%
Simplified99.8%
Taylor expanded in U around 0 80.6%
Taylor expanded in K around 0 49.8%
if -2.1500000000000001e-38 < J < -4.999999999999985e-310Initial program 59.3%
*-commutative59.3%
associate-*l*59.3%
associate-*r*59.3%
*-commutative59.3%
associate-*l*59.3%
*-commutative59.3%
unpow259.3%
hypot-1-def81.3%
*-commutative81.3%
associate-*l*81.3%
Simplified81.3%
Taylor expanded in U around -inf 38.0%
fma-def38.0%
associate-/l*38.0%
unpow238.0%
Simplified38.0%
Taylor expanded in K around 0 38.0%
unpow238.0%
associate-/l*37.9%
Simplified37.9%
fma-udef37.9%
div-inv37.9%
clear-num37.9%
Applied egg-rr37.9%
if -4.999999999999985e-310 < J < 6.8000000000000003e111Initial program 63.7%
*-commutative63.7%
associate-*l*63.7%
associate-*r*63.7%
*-commutative63.7%
associate-*l*63.7%
*-commutative63.7%
unpow263.7%
hypot-1-def82.4%
*-commutative82.4%
associate-*l*82.4%
Simplified82.4%
Taylor expanded in J around 0 34.8%
neg-mul-134.8%
Simplified34.8%
if 6.8000000000000003e111 < J Initial program 99.9%
*-commutative99.9%
associate-*l*99.9%
associate-*r*99.9%
*-commutative99.9%
associate-*l*99.9%
*-commutative99.9%
unpow299.9%
hypot-1-def99.9%
*-commutative99.9%
associate-*l*99.9%
Simplified99.9%
Taylor expanded in U around 0 94.5%
Taylor expanded in K around 0 63.1%
associate-*r*63.1%
distribute-rgt-out63.1%
unpow263.1%
Simplified63.1%
Final simplification42.8%
NOTE: U should be positive before calling this function
(FPCore (J K U)
:precision binary64
(let* ((t_0 (* J (/ J U))))
(if (<= J -1.25e-38)
(* -2.0 J)
(if (<= J -5e-310)
(+ U (* 2.0 t_0))
(if (<= J 7.2e+111)
(- (* -2.0 t_0) U)
(* J (+ -2.0 (* 0.25 (* K K)))))))))U = abs(U);
double code(double J, double K, double U) {
double t_0 = J * (J / U);
double tmp;
if (J <= -1.25e-38) {
tmp = -2.0 * J;
} else if (J <= -5e-310) {
tmp = U + (2.0 * t_0);
} else if (J <= 7.2e+111) {
tmp = (-2.0 * t_0) - U;
} else {
tmp = J * (-2.0 + (0.25 * (K * K)));
}
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 * (j / u)
if (j <= (-1.25d-38)) then
tmp = (-2.0d0) * j
else if (j <= (-5d-310)) then
tmp = u + (2.0d0 * t_0)
else if (j <= 7.2d+111) then
tmp = ((-2.0d0) * t_0) - u
else
tmp = j * ((-2.0d0) + (0.25d0 * (k * k)))
end if
code = tmp
end function
U = Math.abs(U);
public static double code(double J, double K, double U) {
double t_0 = J * (J / U);
double tmp;
if (J <= -1.25e-38) {
tmp = -2.0 * J;
} else if (J <= -5e-310) {
tmp = U + (2.0 * t_0);
} else if (J <= 7.2e+111) {
tmp = (-2.0 * t_0) - U;
} else {
tmp = J * (-2.0 + (0.25 * (K * K)));
}
return tmp;
}
U = abs(U) def code(J, K, U): t_0 = J * (J / U) tmp = 0 if J <= -1.25e-38: tmp = -2.0 * J elif J <= -5e-310: tmp = U + (2.0 * t_0) elif J <= 7.2e+111: tmp = (-2.0 * t_0) - U else: tmp = J * (-2.0 + (0.25 * (K * K))) return tmp
U = abs(U) function code(J, K, U) t_0 = Float64(J * Float64(J / U)) tmp = 0.0 if (J <= -1.25e-38) tmp = Float64(-2.0 * J); elseif (J <= -5e-310) tmp = Float64(U + Float64(2.0 * t_0)); elseif (J <= 7.2e+111) tmp = Float64(Float64(-2.0 * t_0) - U); else tmp = Float64(J * Float64(-2.0 + Float64(0.25 * Float64(K * K)))); end return tmp end
U = abs(U) function tmp_2 = code(J, K, U) t_0 = J * (J / U); tmp = 0.0; if (J <= -1.25e-38) tmp = -2.0 * J; elseif (J <= -5e-310) tmp = U + (2.0 * t_0); elseif (J <= 7.2e+111) tmp = (-2.0 * t_0) - U; else tmp = J * (-2.0 + (0.25 * (K * K))); 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[(J / U), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[J, -1.25e-38], N[(-2.0 * J), $MachinePrecision], If[LessEqual[J, -5e-310], N[(U + N[(2.0 * t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[J, 7.2e+111], N[(N[(-2.0 * t$95$0), $MachinePrecision] - U), $MachinePrecision], N[(J * N[(-2.0 + N[(0.25 * N[(K * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
t_0 := J \cdot \frac{J}{U}\\
\mathbf{if}\;J \leq -1.25 \cdot 10^{-38}:\\
\;\;\;\;-2 \cdot J\\
\mathbf{elif}\;J \leq -5 \cdot 10^{-310}:\\
\;\;\;\;U + 2 \cdot t_0\\
\mathbf{elif}\;J \leq 7.2 \cdot 10^{+111}:\\
\;\;\;\;-2 \cdot t_0 - U\\
\mathbf{else}:\\
\;\;\;\;J \cdot \left(-2 + 0.25 \cdot \left(K \cdot K\right)\right)\\
\end{array}
\end{array}
if J < -1.25000000000000008e-38Initial program 93.0%
*-commutative93.0%
associate-*l*93.0%
associate-*r*93.0%
*-commutative93.0%
associate-*l*93.0%
*-commutative93.0%
unpow293.0%
hypot-1-def99.8%
*-commutative99.8%
associate-*l*99.8%
Simplified99.8%
Taylor expanded in U around 0 80.6%
Taylor expanded in K around 0 49.8%
if -1.25000000000000008e-38 < J < -4.999999999999985e-310Initial program 59.3%
*-commutative59.3%
associate-*l*59.3%
associate-*r*59.3%
*-commutative59.3%
associate-*l*59.3%
*-commutative59.3%
unpow259.3%
hypot-1-def81.3%
*-commutative81.3%
associate-*l*81.3%
Simplified81.3%
Taylor expanded in U around -inf 38.0%
fma-def38.0%
associate-/l*38.0%
unpow238.0%
Simplified38.0%
Taylor expanded in K around 0 38.0%
unpow238.0%
associate-/l*37.9%
Simplified37.9%
fma-udef37.9%
div-inv37.9%
clear-num37.9%
Applied egg-rr37.9%
if -4.999999999999985e-310 < J < 7.2000000000000004e111Initial program 63.7%
*-commutative63.7%
associate-*l*63.7%
unpow263.7%
hypot-1-def82.4%
*-commutative82.4%
associate-*l*82.4%
Simplified82.4%
Taylor expanded in K around 0 65.1%
Taylor expanded in K around 0 58.4%
Taylor expanded in J around 0 34.7%
fma-def34.7%
unpow234.7%
associate-*r/34.6%
neg-mul-134.6%
fma-neg34.6%
Simplified34.6%
if 7.2000000000000004e111 < J Initial program 99.9%
*-commutative99.9%
associate-*l*99.9%
associate-*r*99.9%
*-commutative99.9%
associate-*l*99.9%
*-commutative99.9%
unpow299.9%
hypot-1-def99.9%
*-commutative99.9%
associate-*l*99.9%
Simplified99.9%
Taylor expanded in U around 0 94.5%
Taylor expanded in K around 0 63.1%
associate-*r*63.1%
distribute-rgt-out63.1%
unpow263.1%
Simplified63.1%
Final simplification42.8%
NOTE: U should be positive before calling this function (FPCore (J K U) :precision binary64 (if (<= J -4e-40) (* -2.0 J) (if (<= J -1.3e-305) U (if (<= J 1.05e+110) (- U) (* -2.0 J)))))
U = abs(U);
double code(double J, double K, double U) {
double tmp;
if (J <= -4e-40) {
tmp = -2.0 * J;
} else if (J <= -1.3e-305) {
tmp = U;
} else if (J <= 1.05e+110) {
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 <= (-4d-40)) then
tmp = (-2.0d0) * j
else if (j <= (-1.3d-305)) then
tmp = u
else if (j <= 1.05d+110) 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 <= -4e-40) {
tmp = -2.0 * J;
} else if (J <= -1.3e-305) {
tmp = U;
} else if (J <= 1.05e+110) {
tmp = -U;
} else {
tmp = -2.0 * J;
}
return tmp;
}
U = abs(U) def code(J, K, U): tmp = 0 if J <= -4e-40: tmp = -2.0 * J elif J <= -1.3e-305: tmp = U elif J <= 1.05e+110: tmp = -U else: tmp = -2.0 * J return tmp
U = abs(U) function code(J, K, U) tmp = 0.0 if (J <= -4e-40) tmp = Float64(-2.0 * J); elseif (J <= -1.3e-305) tmp = U; elseif (J <= 1.05e+110) 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 <= -4e-40) tmp = -2.0 * J; elseif (J <= -1.3e-305) tmp = U; elseif (J <= 1.05e+110) 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, -4e-40], N[(-2.0 * J), $MachinePrecision], If[LessEqual[J, -1.3e-305], U, If[LessEqual[J, 1.05e+110], (-U), N[(-2.0 * J), $MachinePrecision]]]]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
\mathbf{if}\;J \leq -4 \cdot 10^{-40}:\\
\;\;\;\;-2 \cdot J\\
\mathbf{elif}\;J \leq -1.3 \cdot 10^{-305}:\\
\;\;\;\;U\\
\mathbf{elif}\;J \leq 1.05 \cdot 10^{+110}:\\
\;\;\;\;-U\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot J\\
\end{array}
\end{array}
if J < -3.9999999999999997e-40 or 1.05000000000000007e110 < J Initial program 94.3%
*-commutative94.3%
associate-*l*94.3%
associate-*r*94.3%
*-commutative94.3%
associate-*l*94.3%
*-commutative94.3%
unpow294.3%
hypot-1-def99.9%
*-commutative99.9%
associate-*l*99.9%
Simplified99.9%
Taylor expanded in U around 0 84.2%
Taylor expanded in K around 0 53.7%
if -3.9999999999999997e-40 < J < -1.3000000000000001e-305Initial program 59.3%
*-commutative59.3%
associate-*l*59.3%
associate-*r*59.3%
*-commutative59.3%
associate-*l*59.3%
*-commutative59.3%
unpow259.3%
hypot-1-def81.3%
*-commutative81.3%
associate-*l*81.3%
Simplified81.3%
Taylor expanded in U around -inf 37.7%
if -1.3000000000000001e-305 < J < 1.05000000000000007e110Initial program 63.9%
*-commutative63.9%
associate-*l*63.9%
associate-*r*63.9%
*-commutative63.9%
associate-*l*63.9%
*-commutative63.9%
unpow263.9%
hypot-1-def82.0%
*-commutative82.0%
associate-*l*82.0%
Simplified82.0%
Taylor expanded in J around 0 34.4%
neg-mul-134.4%
Simplified34.4%
Final simplification42.7%
NOTE: U should be positive before calling this function (FPCore (J K U) :precision binary64 (if (<= J -1.3e-305) U (- U)))
U = abs(U);
double code(double J, double K, double U) {
double tmp;
if (J <= -1.3e-305) {
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 <= (-1.3d-305)) 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 <= -1.3e-305) {
tmp = U;
} else {
tmp = -U;
}
return tmp;
}
U = abs(U) def code(J, K, U): tmp = 0 if J <= -1.3e-305: tmp = U else: tmp = -U return tmp
U = abs(U) function code(J, K, U) tmp = 0.0 if (J <= -1.3e-305) 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 <= -1.3e-305) 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, -1.3e-305], U, (-U)]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
\mathbf{if}\;J \leq -1.3 \cdot 10^{-305}:\\
\;\;\;\;U\\
\mathbf{else}:\\
\;\;\;\;-U\\
\end{array}
\end{array}
if J < -1.3000000000000001e-305Initial program 77.1%
*-commutative77.1%
associate-*l*77.1%
associate-*r*77.1%
*-commutative77.1%
associate-*l*77.0%
*-commutative77.0%
unpow277.0%
hypot-1-def91.1%
*-commutative91.1%
associate-*l*91.1%
Simplified91.1%
Taylor expanded in U around -inf 23.9%
if -1.3000000000000001e-305 < J Initial program 72.3%
*-commutative72.3%
associate-*l*72.3%
associate-*r*72.3%
*-commutative72.3%
associate-*l*72.3%
*-commutative72.3%
unpow272.3%
hypot-1-def86.5%
*-commutative86.5%
associate-*l*86.5%
Simplified86.5%
Taylor expanded in J around 0 27.3%
neg-mul-127.3%
Simplified27.3%
Final simplification25.6%
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 74.7%
*-commutative74.7%
associate-*l*74.7%
associate-*r*74.7%
*-commutative74.7%
associate-*l*74.7%
*-commutative74.7%
unpow274.7%
hypot-1-def88.8%
*-commutative88.8%
associate-*l*88.8%
Simplified88.8%
Taylor expanded in U around -inf 27.5%
Final simplification27.5%
herbie shell --seed 2023240
(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)))))