
(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}
(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)))))))
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))));
}
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))));
}
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))))
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
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
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}
\\
\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 78.4%
*-commutative78.4%
associate-*l*78.4%
unpow278.4%
hypot-1-def90.4%
*-commutative90.4%
associate-*l*90.4%
Simplified90.4%
Final simplification90.4%
(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)))))))))
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))))));
}
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))))));
}
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))))))
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
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
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}
\\
\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 78.4%
*-commutative78.4%
associate-*l*78.4%
associate-*r*78.4%
*-commutative78.4%
associate-*l*78.4%
*-commutative78.4%
unpow278.4%
hypot-1-def90.3%
*-commutative90.3%
associate-*l*90.3%
Simplified90.3%
Final simplification90.3%
(FPCore (J K U)
:precision binary64
(if (<= U -9.5e+236)
(+ U (* J (/ 2.0 (/ U J))))
(if (<= U -3.2e+170)
(- U)
(if (<= U -4.2e+134)
U
(if (<= U 5e+274)
(* (* J (* -2.0 (cos (/ K 2.0)))) (hypot 1.0 (/ U (/ J 0.5))))
(- U))))))
double code(double J, double K, double U) {
double tmp;
if (U <= -9.5e+236) {
tmp = U + (J * (2.0 / (U / J)));
} else if (U <= -3.2e+170) {
tmp = -U;
} else if (U <= -4.2e+134) {
tmp = U;
} else if (U <= 5e+274) {
tmp = (J * (-2.0 * cos((K / 2.0)))) * hypot(1.0, (U / (J / 0.5)));
} else {
tmp = -U;
}
return tmp;
}
public static double code(double J, double K, double U) {
double tmp;
if (U <= -9.5e+236) {
tmp = U + (J * (2.0 / (U / J)));
} else if (U <= -3.2e+170) {
tmp = -U;
} else if (U <= -4.2e+134) {
tmp = U;
} else if (U <= 5e+274) {
tmp = (J * (-2.0 * Math.cos((K / 2.0)))) * Math.hypot(1.0, (U / (J / 0.5)));
} else {
tmp = -U;
}
return tmp;
}
def code(J, K, U): tmp = 0 if U <= -9.5e+236: tmp = U + (J * (2.0 / (U / J))) elif U <= -3.2e+170: tmp = -U elif U <= -4.2e+134: tmp = U elif U <= 5e+274: tmp = (J * (-2.0 * math.cos((K / 2.0)))) * math.hypot(1.0, (U / (J / 0.5))) else: tmp = -U return tmp
function code(J, K, U) tmp = 0.0 if (U <= -9.5e+236) tmp = Float64(U + Float64(J * Float64(2.0 / Float64(U / J)))); elseif (U <= -3.2e+170) tmp = Float64(-U); elseif (U <= -4.2e+134) tmp = U; elseif (U <= 5e+274) tmp = Float64(Float64(J * Float64(-2.0 * cos(Float64(K / 2.0)))) * hypot(1.0, Float64(U / Float64(J / 0.5)))); else tmp = Float64(-U); end return tmp end
function tmp_2 = code(J, K, U) tmp = 0.0; if (U <= -9.5e+236) tmp = U + (J * (2.0 / (U / J))); elseif (U <= -3.2e+170) tmp = -U; elseif (U <= -4.2e+134) tmp = U; elseif (U <= 5e+274) tmp = (J * (-2.0 * cos((K / 2.0)))) * hypot(1.0, (U / (J / 0.5))); else tmp = -U; end tmp_2 = tmp; end
code[J_, K_, U_] := If[LessEqual[U, -9.5e+236], N[(U + N[(J * N[(2.0 / N[(U / J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[U, -3.2e+170], (-U), If[LessEqual[U, -4.2e+134], U, If[LessEqual[U, 5e+274], 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 / 0.5), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision], (-U)]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;U \leq -9.5 \cdot 10^{+236}:\\
\;\;\;\;U + J \cdot \frac{2}{\frac{U}{J}}\\
\mathbf{elif}\;U \leq -3.2 \cdot 10^{+170}:\\
\;\;\;\;-U\\
\mathbf{elif}\;U \leq -4.2 \cdot 10^{+134}:\\
\;\;\;\;U\\
\mathbf{elif}\;U \leq 5 \cdot 10^{+274}:\\
\;\;\;\;\left(J \cdot \left(-2 \cdot \cos \left(\frac{K}{2}\right)\right)\right) \cdot \mathsf{hypot}\left(1, \frac{U}{\frac{J}{0.5}}\right)\\
\mathbf{else}:\\
\;\;\;\;-U\\
\end{array}
\end{array}
if U < -9.4999999999999999e236Initial program 37.9%
*-commutative37.9%
associate-*l*37.9%
associate-*r*37.9%
*-commutative37.9%
associate-*l*37.9%
*-commutative37.9%
unpow237.9%
hypot-1-def53.1%
*-commutative53.1%
associate-*l*53.1%
Simplified53.1%
Taylor expanded in U around -inf 29.5%
Taylor expanded in K around 0 29.5%
*-commutative29.5%
+-commutative29.5%
distribute-lft-in29.5%
associate-*r/52.4%
associate-*l/60.6%
*-inverses60.6%
*-lft-identity60.6%
associate-*r/60.6%
associate-/l*60.6%
Simplified60.6%
if -9.4999999999999999e236 < U < -3.19999999999999979e170 or 4.9999999999999998e274 < U Initial program 48.6%
*-commutative48.6%
associate-*l*48.6%
associate-*r*48.6%
*-commutative48.6%
associate-*l*48.5%
*-commutative48.5%
unpow248.5%
hypot-1-def59.6%
*-commutative59.6%
associate-*l*59.6%
Simplified59.6%
Taylor expanded in J around 0 72.7%
neg-mul-172.7%
Simplified72.7%
if -3.19999999999999979e170 < U < -4.2000000000000002e134Initial program 61.6%
*-commutative61.6%
associate-*l*61.6%
associate-*r*61.6%
*-commutative61.6%
associate-*l*61.6%
*-commutative61.6%
unpow261.6%
hypot-1-def61.6%
*-commutative61.6%
associate-*l*61.6%
Simplified61.6%
Taylor expanded in U around -inf 100.0%
if -4.2000000000000002e134 < U < 4.9999999999999998e274Initial program 84.6%
*-commutative84.6%
associate-*l*84.6%
unpow284.6%
hypot-1-def96.7%
*-commutative96.7%
associate-*l*96.7%
Simplified96.7%
Taylor expanded in K around 0 81.6%
associate-*r/81.6%
*-commutative81.6%
associate-/l*81.6%
Simplified81.6%
Final simplification80.1%
(FPCore (J K U)
:precision binary64
(let* ((t_0 (+ U (* J (/ 2.0 (/ U J))))))
(if (<= U -1.2e+237)
t_0
(if (<= U -2.2e+169)
(- U)
(if (<= U -6e-10)
U
(if (<= U 2.5e+55)
(* J (* -2.0 (cos (* K 0.5))))
(if (<= U 1.6e+208)
(- (* -2.0 (/ J (/ U J))) U)
(if (<= U 1.42e+267) t_0 (- U)))))))))
double code(double J, double K, double U) {
double t_0 = U + (J * (2.0 / (U / J)));
double tmp;
if (U <= -1.2e+237) {
tmp = t_0;
} else if (U <= -2.2e+169) {
tmp = -U;
} else if (U <= -6e-10) {
tmp = U;
} else if (U <= 2.5e+55) {
tmp = J * (-2.0 * cos((K * 0.5)));
} else if (U <= 1.6e+208) {
tmp = (-2.0 * (J / (U / J))) - U;
} else if (U <= 1.42e+267) {
tmp = t_0;
} else {
tmp = -U;
}
return tmp;
}
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 = u + (j * (2.0d0 / (u / j)))
if (u <= (-1.2d+237)) then
tmp = t_0
else if (u <= (-2.2d+169)) then
tmp = -u
else if (u <= (-6d-10)) then
tmp = u
else if (u <= 2.5d+55) then
tmp = j * ((-2.0d0) * cos((k * 0.5d0)))
else if (u <= 1.6d+208) then
tmp = ((-2.0d0) * (j / (u / j))) - u
else if (u <= 1.42d+267) then
tmp = t_0
else
tmp = -u
end if
code = tmp
end function
public static double code(double J, double K, double U) {
double t_0 = U + (J * (2.0 / (U / J)));
double tmp;
if (U <= -1.2e+237) {
tmp = t_0;
} else if (U <= -2.2e+169) {
tmp = -U;
} else if (U <= -6e-10) {
tmp = U;
} else if (U <= 2.5e+55) {
tmp = J * (-2.0 * Math.cos((K * 0.5)));
} else if (U <= 1.6e+208) {
tmp = (-2.0 * (J / (U / J))) - U;
} else if (U <= 1.42e+267) {
tmp = t_0;
} else {
tmp = -U;
}
return tmp;
}
def code(J, K, U): t_0 = U + (J * (2.0 / (U / J))) tmp = 0 if U <= -1.2e+237: tmp = t_0 elif U <= -2.2e+169: tmp = -U elif U <= -6e-10: tmp = U elif U <= 2.5e+55: tmp = J * (-2.0 * math.cos((K * 0.5))) elif U <= 1.6e+208: tmp = (-2.0 * (J / (U / J))) - U elif U <= 1.42e+267: tmp = t_0 else: tmp = -U return tmp
function code(J, K, U) t_0 = Float64(U + Float64(J * Float64(2.0 / Float64(U / J)))) tmp = 0.0 if (U <= -1.2e+237) tmp = t_0; elseif (U <= -2.2e+169) tmp = Float64(-U); elseif (U <= -6e-10) tmp = U; elseif (U <= 2.5e+55) tmp = Float64(J * Float64(-2.0 * cos(Float64(K * 0.5)))); elseif (U <= 1.6e+208) tmp = Float64(Float64(-2.0 * Float64(J / Float64(U / J))) - U); elseif (U <= 1.42e+267) tmp = t_0; else tmp = Float64(-U); end return tmp end
function tmp_2 = code(J, K, U) t_0 = U + (J * (2.0 / (U / J))); tmp = 0.0; if (U <= -1.2e+237) tmp = t_0; elseif (U <= -2.2e+169) tmp = -U; elseif (U <= -6e-10) tmp = U; elseif (U <= 2.5e+55) tmp = J * (-2.0 * cos((K * 0.5))); elseif (U <= 1.6e+208) tmp = (-2.0 * (J / (U / J))) - U; elseif (U <= 1.42e+267) tmp = t_0; else tmp = -U; end tmp_2 = tmp; end
code[J_, K_, U_] := Block[{t$95$0 = N[(U + N[(J * N[(2.0 / N[(U / J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[U, -1.2e+237], t$95$0, If[LessEqual[U, -2.2e+169], (-U), If[LessEqual[U, -6e-10], U, If[LessEqual[U, 2.5e+55], N[(J * N[(-2.0 * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[U, 1.6e+208], N[(N[(-2.0 * N[(J / N[(U / J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - U), $MachinePrecision], If[LessEqual[U, 1.42e+267], t$95$0, (-U)]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + J \cdot \frac{2}{\frac{U}{J}}\\
\mathbf{if}\;U \leq -1.2 \cdot 10^{+237}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;U \leq -2.2 \cdot 10^{+169}:\\
\;\;\;\;-U\\
\mathbf{elif}\;U \leq -6 \cdot 10^{-10}:\\
\;\;\;\;U\\
\mathbf{elif}\;U \leq 2.5 \cdot 10^{+55}:\\
\;\;\;\;J \cdot \left(-2 \cdot \cos \left(K \cdot 0.5\right)\right)\\
\mathbf{elif}\;U \leq 1.6 \cdot 10^{+208}:\\
\;\;\;\;-2 \cdot \frac{J}{\frac{U}{J}} - U\\
\mathbf{elif}\;U \leq 1.42 \cdot 10^{+267}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;-U\\
\end{array}
\end{array}
if U < -1.1999999999999999e237 or 1.6000000000000001e208 < U < 1.42000000000000003e267Initial program 55.7%
*-commutative55.7%
associate-*l*55.7%
associate-*r*55.7%
*-commutative55.7%
associate-*l*55.7%
*-commutative55.7%
unpow255.7%
hypot-1-def65.4%
*-commutative65.4%
associate-*l*65.4%
Simplified65.4%
Taylor expanded in U around -inf 37.8%
Taylor expanded in K around 0 37.0%
*-commutative37.0%
+-commutative37.0%
distribute-lft-in37.0%
associate-*r/40.6%
associate-*l/61.7%
*-inverses61.7%
*-lft-identity61.7%
associate-*r/61.7%
associate-/l*61.7%
Simplified61.7%
if -1.1999999999999999e237 < U < -2.2e169 or 1.42000000000000003e267 < U Initial program 48.6%
*-commutative48.6%
associate-*l*48.6%
associate-*r*48.6%
*-commutative48.6%
associate-*l*48.5%
*-commutative48.5%
unpow248.5%
hypot-1-def59.6%
*-commutative59.6%
associate-*l*59.6%
Simplified59.6%
Taylor expanded in J around 0 72.7%
neg-mul-172.7%
Simplified72.7%
if -2.2e169 < U < -6e-10Initial program 69.6%
*-commutative69.6%
associate-*l*69.6%
associate-*r*69.6%
*-commutative69.6%
associate-*l*69.7%
*-commutative69.7%
unpow269.7%
hypot-1-def91.7%
*-commutative91.7%
associate-*l*91.7%
Simplified91.7%
Taylor expanded in U around -inf 61.0%
if -6e-10 < U < 2.50000000000000023e55Initial program 92.7%
*-commutative92.7%
associate-*l*92.7%
associate-*r*92.7%
*-commutative92.7%
associate-*l*92.7%
*-commutative92.7%
unpow292.7%
hypot-1-def99.8%
*-commutative99.8%
associate-*l*99.8%
Simplified99.8%
Taylor expanded in U around 0 77.9%
if 2.50000000000000023e55 < U < 1.6000000000000001e208Initial program 54.1%
*-commutative54.1%
associate-*l*54.1%
unpow254.1%
hypot-1-def82.2%
*-commutative82.2%
associate-*l*82.2%
Simplified82.2%
Taylor expanded in K around 0 55.3%
associate-*r/55.3%
*-commutative55.3%
associate-/l*55.3%
Simplified55.3%
Taylor expanded in K around 0 67.0%
Taylor expanded in J around 0 52.9%
neg-mul-152.9%
unsub-neg52.9%
associate-*r/52.9%
unpow252.9%
Simplified52.9%
Taylor expanded in J around 0 52.9%
unpow252.9%
associate-/l*56.5%
Simplified56.5%
Final simplification71.6%
(FPCore (J K U) :precision binary64 (if (or (<= K -2.75e+31) (not (<= K 0.095))) (* J (* -2.0 (cos (* K 0.5)))) (* (hypot 1.0 (/ U (/ J 0.5))) (* J -2.0))))
double code(double J, double K, double U) {
double tmp;
if ((K <= -2.75e+31) || !(K <= 0.095)) {
tmp = J * (-2.0 * cos((K * 0.5)));
} else {
tmp = hypot(1.0, (U / (J / 0.5))) * (J * -2.0);
}
return tmp;
}
public static double code(double J, double K, double U) {
double tmp;
if ((K <= -2.75e+31) || !(K <= 0.095)) {
tmp = J * (-2.0 * Math.cos((K * 0.5)));
} else {
tmp = Math.hypot(1.0, (U / (J / 0.5))) * (J * -2.0);
}
return tmp;
}
def code(J, K, U): tmp = 0 if (K <= -2.75e+31) or not (K <= 0.095): tmp = J * (-2.0 * math.cos((K * 0.5))) else: tmp = math.hypot(1.0, (U / (J / 0.5))) * (J * -2.0) return tmp
function code(J, K, U) tmp = 0.0 if ((K <= -2.75e+31) || !(K <= 0.095)) tmp = Float64(J * Float64(-2.0 * cos(Float64(K * 0.5)))); else tmp = Float64(hypot(1.0, Float64(U / Float64(J / 0.5))) * Float64(J * -2.0)); end return tmp end
function tmp_2 = code(J, K, U) tmp = 0.0; if ((K <= -2.75e+31) || ~((K <= 0.095))) tmp = J * (-2.0 * cos((K * 0.5))); else tmp = hypot(1.0, (U / (J / 0.5))) * (J * -2.0); end tmp_2 = tmp; end
code[J_, K_, U_] := If[Or[LessEqual[K, -2.75e+31], N[Not[LessEqual[K, 0.095]], $MachinePrecision]], N[(J * N[(-2.0 * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[1.0 ^ 2 + N[(U / N[(J / 0.5), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision] * N[(J * -2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;K \leq -2.75 \cdot 10^{+31} \lor \neg \left(K \leq 0.095\right):\\
\;\;\;\;J \cdot \left(-2 \cdot \cos \left(K \cdot 0.5\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{hypot}\left(1, \frac{U}{\frac{J}{0.5}}\right) \cdot \left(J \cdot -2\right)\\
\end{array}
\end{array}
if K < -2.75000000000000001e31 or 0.095000000000000001 < K Initial program 79.5%
*-commutative79.5%
associate-*l*79.5%
associate-*r*79.5%
*-commutative79.5%
associate-*l*79.5%
*-commutative79.5%
unpow279.5%
hypot-1-def88.5%
*-commutative88.5%
associate-*l*88.5%
Simplified88.5%
Taylor expanded in U around 0 54.8%
if -2.75000000000000001e31 < K < 0.095000000000000001Initial program 77.4%
*-commutative77.4%
associate-*l*77.4%
unpow277.4%
hypot-1-def92.1%
*-commutative92.1%
associate-*l*92.1%
Simplified92.1%
Taylor expanded in K around 0 87.7%
associate-*r/87.7%
*-commutative87.7%
associate-/l*87.7%
Simplified87.7%
Taylor expanded in K around 0 91.4%
Final simplification73.4%
(FPCore (J K U)
:precision binary64
(let* ((t_0 (+ U (* J (/ 2.0 (/ U J))))))
(if (<= U -1.35e+237)
t_0
(if (<= U -1.65e+170)
(- U)
(if (<= U -4.4e-17)
U
(if (<= U 6.6e-84)
(* J -2.0)
(if (<= U 1.86e+208) (- U) (if (<= U 5e+266) t_0 (- U)))))))))
double code(double J, double K, double U) {
double t_0 = U + (J * (2.0 / (U / J)));
double tmp;
if (U <= -1.35e+237) {
tmp = t_0;
} else if (U <= -1.65e+170) {
tmp = -U;
} else if (U <= -4.4e-17) {
tmp = U;
} else if (U <= 6.6e-84) {
tmp = J * -2.0;
} else if (U <= 1.86e+208) {
tmp = -U;
} else if (U <= 5e+266) {
tmp = t_0;
} else {
tmp = -U;
}
return tmp;
}
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 = u + (j * (2.0d0 / (u / j)))
if (u <= (-1.35d+237)) then
tmp = t_0
else if (u <= (-1.65d+170)) then
tmp = -u
else if (u <= (-4.4d-17)) then
tmp = u
else if (u <= 6.6d-84) then
tmp = j * (-2.0d0)
else if (u <= 1.86d+208) then
tmp = -u
else if (u <= 5d+266) then
tmp = t_0
else
tmp = -u
end if
code = tmp
end function
public static double code(double J, double K, double U) {
double t_0 = U + (J * (2.0 / (U / J)));
double tmp;
if (U <= -1.35e+237) {
tmp = t_0;
} else if (U <= -1.65e+170) {
tmp = -U;
} else if (U <= -4.4e-17) {
tmp = U;
} else if (U <= 6.6e-84) {
tmp = J * -2.0;
} else if (U <= 1.86e+208) {
tmp = -U;
} else if (U <= 5e+266) {
tmp = t_0;
} else {
tmp = -U;
}
return tmp;
}
def code(J, K, U): t_0 = U + (J * (2.0 / (U / J))) tmp = 0 if U <= -1.35e+237: tmp = t_0 elif U <= -1.65e+170: tmp = -U elif U <= -4.4e-17: tmp = U elif U <= 6.6e-84: tmp = J * -2.0 elif U <= 1.86e+208: tmp = -U elif U <= 5e+266: tmp = t_0 else: tmp = -U return tmp
function code(J, K, U) t_0 = Float64(U + Float64(J * Float64(2.0 / Float64(U / J)))) tmp = 0.0 if (U <= -1.35e+237) tmp = t_0; elseif (U <= -1.65e+170) tmp = Float64(-U); elseif (U <= -4.4e-17) tmp = U; elseif (U <= 6.6e-84) tmp = Float64(J * -2.0); elseif (U <= 1.86e+208) tmp = Float64(-U); elseif (U <= 5e+266) tmp = t_0; else tmp = Float64(-U); end return tmp end
function tmp_2 = code(J, K, U) t_0 = U + (J * (2.0 / (U / J))); tmp = 0.0; if (U <= -1.35e+237) tmp = t_0; elseif (U <= -1.65e+170) tmp = -U; elseif (U <= -4.4e-17) tmp = U; elseif (U <= 6.6e-84) tmp = J * -2.0; elseif (U <= 1.86e+208) tmp = -U; elseif (U <= 5e+266) tmp = t_0; else tmp = -U; end tmp_2 = tmp; end
code[J_, K_, U_] := Block[{t$95$0 = N[(U + N[(J * N[(2.0 / N[(U / J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[U, -1.35e+237], t$95$0, If[LessEqual[U, -1.65e+170], (-U), If[LessEqual[U, -4.4e-17], U, If[LessEqual[U, 6.6e-84], N[(J * -2.0), $MachinePrecision], If[LessEqual[U, 1.86e+208], (-U), If[LessEqual[U, 5e+266], t$95$0, (-U)]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + J \cdot \frac{2}{\frac{U}{J}}\\
\mathbf{if}\;U \leq -1.35 \cdot 10^{+237}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;U \leq -1.65 \cdot 10^{+170}:\\
\;\;\;\;-U\\
\mathbf{elif}\;U \leq -4.4 \cdot 10^{-17}:\\
\;\;\;\;U\\
\mathbf{elif}\;U \leq 6.6 \cdot 10^{-84}:\\
\;\;\;\;J \cdot -2\\
\mathbf{elif}\;U \leq 1.86 \cdot 10^{+208}:\\
\;\;\;\;-U\\
\mathbf{elif}\;U \leq 5 \cdot 10^{+266}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;-U\\
\end{array}
\end{array}
if U < -1.35e237 or 1.85999999999999993e208 < U < 4.9999999999999999e266Initial program 55.7%
*-commutative55.7%
associate-*l*55.7%
associate-*r*55.7%
*-commutative55.7%
associate-*l*55.7%
*-commutative55.7%
unpow255.7%
hypot-1-def65.4%
*-commutative65.4%
associate-*l*65.4%
Simplified65.4%
Taylor expanded in U around -inf 37.8%
Taylor expanded in K around 0 37.0%
*-commutative37.0%
+-commutative37.0%
distribute-lft-in37.0%
associate-*r/40.6%
associate-*l/61.7%
*-inverses61.7%
*-lft-identity61.7%
associate-*r/61.7%
associate-/l*61.7%
Simplified61.7%
if -1.35e237 < U < -1.65000000000000012e170 or 6.59999999999999968e-84 < U < 1.85999999999999993e208 or 4.9999999999999999e266 < U Initial program 58.1%
*-commutative58.1%
associate-*l*58.1%
associate-*r*58.1%
*-commutative58.1%
associate-*l*58.0%
*-commutative58.0%
unpow258.0%
hypot-1-def81.5%
*-commutative81.5%
associate-*l*81.5%
Simplified81.5%
Taylor expanded in J around 0 51.8%
neg-mul-151.8%
Simplified51.8%
if -1.65000000000000012e170 < U < -4.4e-17Initial program 69.6%
*-commutative69.6%
associate-*l*69.6%
associate-*r*69.6%
*-commutative69.6%
associate-*l*69.7%
*-commutative69.7%
unpow269.7%
hypot-1-def91.7%
*-commutative91.7%
associate-*l*91.7%
Simplified91.7%
Taylor expanded in U around -inf 61.0%
if -4.4e-17 < U < 6.59999999999999968e-84Initial program 98.2%
*-commutative98.2%
associate-*l*98.2%
associate-*r*98.2%
*-commutative98.2%
associate-*l*98.1%
*-commutative98.1%
unpow298.1%
hypot-1-def99.8%
*-commutative99.8%
associate-*l*99.8%
Simplified99.8%
Taylor expanded in U around 0 84.4%
Taylor expanded in K around 0 48.5%
Final simplification52.2%
(FPCore (J K U)
:precision binary64
(let* ((t_0 (+ U (* J (/ 2.0 (/ U J))))))
(if (<= U -1e+237)
t_0
(if (<= U -2.3e+171)
(- U)
(if (<= U -1.8e-16)
U
(if (<= U 3.3e-82)
(* J -2.0)
(if (<= U 4.2e+212)
(- (* -2.0 (/ J (/ U J))) U)
(if (<= U 5e+266) t_0 (- U)))))))))
double code(double J, double K, double U) {
double t_0 = U + (J * (2.0 / (U / J)));
double tmp;
if (U <= -1e+237) {
tmp = t_0;
} else if (U <= -2.3e+171) {
tmp = -U;
} else if (U <= -1.8e-16) {
tmp = U;
} else if (U <= 3.3e-82) {
tmp = J * -2.0;
} else if (U <= 4.2e+212) {
tmp = (-2.0 * (J / (U / J))) - U;
} else if (U <= 5e+266) {
tmp = t_0;
} else {
tmp = -U;
}
return tmp;
}
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 = u + (j * (2.0d0 / (u / j)))
if (u <= (-1d+237)) then
tmp = t_0
else if (u <= (-2.3d+171)) then
tmp = -u
else if (u <= (-1.8d-16)) then
tmp = u
else if (u <= 3.3d-82) then
tmp = j * (-2.0d0)
else if (u <= 4.2d+212) then
tmp = ((-2.0d0) * (j / (u / j))) - u
else if (u <= 5d+266) then
tmp = t_0
else
tmp = -u
end if
code = tmp
end function
public static double code(double J, double K, double U) {
double t_0 = U + (J * (2.0 / (U / J)));
double tmp;
if (U <= -1e+237) {
tmp = t_0;
} else if (U <= -2.3e+171) {
tmp = -U;
} else if (U <= -1.8e-16) {
tmp = U;
} else if (U <= 3.3e-82) {
tmp = J * -2.0;
} else if (U <= 4.2e+212) {
tmp = (-2.0 * (J / (U / J))) - U;
} else if (U <= 5e+266) {
tmp = t_0;
} else {
tmp = -U;
}
return tmp;
}
def code(J, K, U): t_0 = U + (J * (2.0 / (U / J))) tmp = 0 if U <= -1e+237: tmp = t_0 elif U <= -2.3e+171: tmp = -U elif U <= -1.8e-16: tmp = U elif U <= 3.3e-82: tmp = J * -2.0 elif U <= 4.2e+212: tmp = (-2.0 * (J / (U / J))) - U elif U <= 5e+266: tmp = t_0 else: tmp = -U return tmp
function code(J, K, U) t_0 = Float64(U + Float64(J * Float64(2.0 / Float64(U / J)))) tmp = 0.0 if (U <= -1e+237) tmp = t_0; elseif (U <= -2.3e+171) tmp = Float64(-U); elseif (U <= -1.8e-16) tmp = U; elseif (U <= 3.3e-82) tmp = Float64(J * -2.0); elseif (U <= 4.2e+212) tmp = Float64(Float64(-2.0 * Float64(J / Float64(U / J))) - U); elseif (U <= 5e+266) tmp = t_0; else tmp = Float64(-U); end return tmp end
function tmp_2 = code(J, K, U) t_0 = U + (J * (2.0 / (U / J))); tmp = 0.0; if (U <= -1e+237) tmp = t_0; elseif (U <= -2.3e+171) tmp = -U; elseif (U <= -1.8e-16) tmp = U; elseif (U <= 3.3e-82) tmp = J * -2.0; elseif (U <= 4.2e+212) tmp = (-2.0 * (J / (U / J))) - U; elseif (U <= 5e+266) tmp = t_0; else tmp = -U; end tmp_2 = tmp; end
code[J_, K_, U_] := Block[{t$95$0 = N[(U + N[(J * N[(2.0 / N[(U / J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[U, -1e+237], t$95$0, If[LessEqual[U, -2.3e+171], (-U), If[LessEqual[U, -1.8e-16], U, If[LessEqual[U, 3.3e-82], N[(J * -2.0), $MachinePrecision], If[LessEqual[U, 4.2e+212], N[(N[(-2.0 * N[(J / N[(U / J), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - U), $MachinePrecision], If[LessEqual[U, 5e+266], t$95$0, (-U)]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := U + J \cdot \frac{2}{\frac{U}{J}}\\
\mathbf{if}\;U \leq -1 \cdot 10^{+237}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;U \leq -2.3 \cdot 10^{+171}:\\
\;\;\;\;-U\\
\mathbf{elif}\;U \leq -1.8 \cdot 10^{-16}:\\
\;\;\;\;U\\
\mathbf{elif}\;U \leq 3.3 \cdot 10^{-82}:\\
\;\;\;\;J \cdot -2\\
\mathbf{elif}\;U \leq 4.2 \cdot 10^{+212}:\\
\;\;\;\;-2 \cdot \frac{J}{\frac{U}{J}} - U\\
\mathbf{elif}\;U \leq 5 \cdot 10^{+266}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;-U\\
\end{array}
\end{array}
if U < -9.9999999999999994e236 or 4.2e212 < U < 4.9999999999999999e266Initial program 55.7%
*-commutative55.7%
associate-*l*55.7%
associate-*r*55.7%
*-commutative55.7%
associate-*l*55.7%
*-commutative55.7%
unpow255.7%
hypot-1-def65.4%
*-commutative65.4%
associate-*l*65.4%
Simplified65.4%
Taylor expanded in U around -inf 37.8%
Taylor expanded in K around 0 37.0%
*-commutative37.0%
+-commutative37.0%
distribute-lft-in37.0%
associate-*r/40.6%
associate-*l/61.7%
*-inverses61.7%
*-lft-identity61.7%
associate-*r/61.7%
associate-/l*61.7%
Simplified61.7%
if -9.9999999999999994e236 < U < -2.30000000000000017e171 or 4.9999999999999999e266 < U Initial program 48.6%
*-commutative48.6%
associate-*l*48.6%
associate-*r*48.6%
*-commutative48.6%
associate-*l*48.5%
*-commutative48.5%
unpow248.5%
hypot-1-def59.6%
*-commutative59.6%
associate-*l*59.6%
Simplified59.6%
Taylor expanded in J around 0 72.7%
neg-mul-172.7%
Simplified72.7%
if -2.30000000000000017e171 < U < -1.79999999999999991e-16Initial program 69.6%
*-commutative69.6%
associate-*l*69.6%
associate-*r*69.6%
*-commutative69.6%
associate-*l*69.7%
*-commutative69.7%
unpow269.7%
hypot-1-def91.7%
*-commutative91.7%
associate-*l*91.7%
Simplified91.7%
Taylor expanded in U around -inf 61.0%
if -1.79999999999999991e-16 < U < 3.30000000000000022e-82Initial program 98.2%
*-commutative98.2%
associate-*l*98.2%
associate-*r*98.2%
*-commutative98.2%
associate-*l*98.1%
*-commutative98.1%
unpow298.1%
hypot-1-def99.8%
*-commutative99.8%
associate-*l*99.8%
Simplified99.8%
Taylor expanded in U around 0 84.4%
Taylor expanded in K around 0 48.5%
if 3.30000000000000022e-82 < U < 4.2e212Initial program 62.3%
*-commutative62.3%
associate-*l*62.3%
unpow262.3%
hypot-1-def91.3%
*-commutative91.3%
associate-*l*91.3%
Simplified91.3%
Taylor expanded in K around 0 64.3%
associate-*r/64.3%
*-commutative64.3%
associate-/l*64.3%
Simplified64.3%
Taylor expanded in K around 0 62.5%
Taylor expanded in J around 0 40.9%
neg-mul-140.9%
unsub-neg40.9%
associate-*r/40.9%
unpow240.9%
Simplified40.9%
Taylor expanded in J around 0 40.9%
unpow240.9%
associate-/l*42.7%
Simplified42.7%
Final simplification52.3%
(FPCore (J K U)
:precision binary64
(if (<= U -1.2e+237)
U
(if (<= U -1.55e+169)
(- U)
(if (<= U -9.8e-194)
U
(if (<= U 7800000000.0)
(- U)
(if (<= U 1.95e+167)
U
(if (<= U 3.9e+210) (- U) (if (<= U 6.7e+270) U (- U)))))))))
double code(double J, double K, double U) {
double tmp;
if (U <= -1.2e+237) {
tmp = U;
} else if (U <= -1.55e+169) {
tmp = -U;
} else if (U <= -9.8e-194) {
tmp = U;
} else if (U <= 7800000000.0) {
tmp = -U;
} else if (U <= 1.95e+167) {
tmp = U;
} else if (U <= 3.9e+210) {
tmp = -U;
} else if (U <= 6.7e+270) {
tmp = U;
} else {
tmp = -U;
}
return tmp;
}
real(8) function code(j, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if (u <= (-1.2d+237)) then
tmp = u
else if (u <= (-1.55d+169)) then
tmp = -u
else if (u <= (-9.8d-194)) then
tmp = u
else if (u <= 7800000000.0d0) then
tmp = -u
else if (u <= 1.95d+167) then
tmp = u
else if (u <= 3.9d+210) then
tmp = -u
else if (u <= 6.7d+270) then
tmp = u
else
tmp = -u
end if
code = tmp
end function
public static double code(double J, double K, double U) {
double tmp;
if (U <= -1.2e+237) {
tmp = U;
} else if (U <= -1.55e+169) {
tmp = -U;
} else if (U <= -9.8e-194) {
tmp = U;
} else if (U <= 7800000000.0) {
tmp = -U;
} else if (U <= 1.95e+167) {
tmp = U;
} else if (U <= 3.9e+210) {
tmp = -U;
} else if (U <= 6.7e+270) {
tmp = U;
} else {
tmp = -U;
}
return tmp;
}
def code(J, K, U): tmp = 0 if U <= -1.2e+237: tmp = U elif U <= -1.55e+169: tmp = -U elif U <= -9.8e-194: tmp = U elif U <= 7800000000.0: tmp = -U elif U <= 1.95e+167: tmp = U elif U <= 3.9e+210: tmp = -U elif U <= 6.7e+270: tmp = U else: tmp = -U return tmp
function code(J, K, U) tmp = 0.0 if (U <= -1.2e+237) tmp = U; elseif (U <= -1.55e+169) tmp = Float64(-U); elseif (U <= -9.8e-194) tmp = U; elseif (U <= 7800000000.0) tmp = Float64(-U); elseif (U <= 1.95e+167) tmp = U; elseif (U <= 3.9e+210) tmp = Float64(-U); elseif (U <= 6.7e+270) tmp = U; else tmp = Float64(-U); end return tmp end
function tmp_2 = code(J, K, U) tmp = 0.0; if (U <= -1.2e+237) tmp = U; elseif (U <= -1.55e+169) tmp = -U; elseif (U <= -9.8e-194) tmp = U; elseif (U <= 7800000000.0) tmp = -U; elseif (U <= 1.95e+167) tmp = U; elseif (U <= 3.9e+210) tmp = -U; elseif (U <= 6.7e+270) tmp = U; else tmp = -U; end tmp_2 = tmp; end
code[J_, K_, U_] := If[LessEqual[U, -1.2e+237], U, If[LessEqual[U, -1.55e+169], (-U), If[LessEqual[U, -9.8e-194], U, If[LessEqual[U, 7800000000.0], (-U), If[LessEqual[U, 1.95e+167], U, If[LessEqual[U, 3.9e+210], (-U), If[LessEqual[U, 6.7e+270], U, (-U)]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;U \leq -1.2 \cdot 10^{+237}:\\
\;\;\;\;U\\
\mathbf{elif}\;U \leq -1.55 \cdot 10^{+169}:\\
\;\;\;\;-U\\
\mathbf{elif}\;U \leq -9.8 \cdot 10^{-194}:\\
\;\;\;\;U\\
\mathbf{elif}\;U \leq 7800000000:\\
\;\;\;\;-U\\
\mathbf{elif}\;U \leq 1.95 \cdot 10^{+167}:\\
\;\;\;\;U\\
\mathbf{elif}\;U \leq 3.9 \cdot 10^{+210}:\\
\;\;\;\;-U\\
\mathbf{elif}\;U \leq 6.7 \cdot 10^{+270}:\\
\;\;\;\;U\\
\mathbf{else}:\\
\;\;\;\;-U\\
\end{array}
\end{array}
if U < -1.1999999999999999e237 or -1.55e169 < U < -9.80000000000000008e-194 or 7.8e9 < U < 1.9499999999999999e167 or 3.9e210 < U < 6.7e270Initial program 77.8%
*-commutative77.8%
associate-*l*77.8%
associate-*r*77.8%
*-commutative77.8%
associate-*l*77.8%
*-commutative77.8%
unpow277.8%
hypot-1-def89.6%
*-commutative89.6%
associate-*l*89.6%
Simplified89.6%
Taylor expanded in U around -inf 41.6%
if -1.1999999999999999e237 < U < -1.55e169 or -9.80000000000000008e-194 < U < 7.8e9 or 1.9499999999999999e167 < U < 3.9e210 or 6.7e270 < U Initial program 79.0%
*-commutative79.0%
associate-*l*79.0%
associate-*r*79.0%
*-commutative79.0%
associate-*l*78.9%
*-commutative78.9%
unpow278.9%
hypot-1-def90.9%
*-commutative90.9%
associate-*l*90.9%
Simplified90.9%
Taylor expanded in J around 0 33.6%
neg-mul-133.6%
Simplified33.6%
Final simplification37.4%
(FPCore (J K U)
:precision binary64
(if (<= U -1.1e+237)
U
(if (<= U -2.9e+162)
(- U)
(if (<= U -4.5e-14)
U
(if (<= U 1.2e-82)
(* J -2.0)
(if (<= U 1.25e+212) (- U) (if (<= U 2e+269) U (- U))))))))
double code(double J, double K, double U) {
double tmp;
if (U <= -1.1e+237) {
tmp = U;
} else if (U <= -2.9e+162) {
tmp = -U;
} else if (U <= -4.5e-14) {
tmp = U;
} else if (U <= 1.2e-82) {
tmp = J * -2.0;
} else if (U <= 1.25e+212) {
tmp = -U;
} else if (U <= 2e+269) {
tmp = U;
} else {
tmp = -U;
}
return tmp;
}
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.1d+237)) then
tmp = u
else if (u <= (-2.9d+162)) then
tmp = -u
else if (u <= (-4.5d-14)) then
tmp = u
else if (u <= 1.2d-82) then
tmp = j * (-2.0d0)
else if (u <= 1.25d+212) then
tmp = -u
else if (u <= 2d+269) then
tmp = u
else
tmp = -u
end if
code = tmp
end function
public static double code(double J, double K, double U) {
double tmp;
if (U <= -1.1e+237) {
tmp = U;
} else if (U <= -2.9e+162) {
tmp = -U;
} else if (U <= -4.5e-14) {
tmp = U;
} else if (U <= 1.2e-82) {
tmp = J * -2.0;
} else if (U <= 1.25e+212) {
tmp = -U;
} else if (U <= 2e+269) {
tmp = U;
} else {
tmp = -U;
}
return tmp;
}
def code(J, K, U): tmp = 0 if U <= -1.1e+237: tmp = U elif U <= -2.9e+162: tmp = -U elif U <= -4.5e-14: tmp = U elif U <= 1.2e-82: tmp = J * -2.0 elif U <= 1.25e+212: tmp = -U elif U <= 2e+269: tmp = U else: tmp = -U return tmp
function code(J, K, U) tmp = 0.0 if (U <= -1.1e+237) tmp = U; elseif (U <= -2.9e+162) tmp = Float64(-U); elseif (U <= -4.5e-14) tmp = U; elseif (U <= 1.2e-82) tmp = Float64(J * -2.0); elseif (U <= 1.25e+212) tmp = Float64(-U); elseif (U <= 2e+269) tmp = U; else tmp = Float64(-U); end return tmp end
function tmp_2 = code(J, K, U) tmp = 0.0; if (U <= -1.1e+237) tmp = U; elseif (U <= -2.9e+162) tmp = -U; elseif (U <= -4.5e-14) tmp = U; elseif (U <= 1.2e-82) tmp = J * -2.0; elseif (U <= 1.25e+212) tmp = -U; elseif (U <= 2e+269) tmp = U; else tmp = -U; end tmp_2 = tmp; end
code[J_, K_, U_] := If[LessEqual[U, -1.1e+237], U, If[LessEqual[U, -2.9e+162], (-U), If[LessEqual[U, -4.5e-14], U, If[LessEqual[U, 1.2e-82], N[(J * -2.0), $MachinePrecision], If[LessEqual[U, 1.25e+212], (-U), If[LessEqual[U, 2e+269], U, (-U)]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;U \leq -1.1 \cdot 10^{+237}:\\
\;\;\;\;U\\
\mathbf{elif}\;U \leq -2.9 \cdot 10^{+162}:\\
\;\;\;\;-U\\
\mathbf{elif}\;U \leq -4.5 \cdot 10^{-14}:\\
\;\;\;\;U\\
\mathbf{elif}\;U \leq 1.2 \cdot 10^{-82}:\\
\;\;\;\;J \cdot -2\\
\mathbf{elif}\;U \leq 1.25 \cdot 10^{+212}:\\
\;\;\;\;-U\\
\mathbf{elif}\;U \leq 2 \cdot 10^{+269}:\\
\;\;\;\;U\\
\mathbf{else}:\\
\;\;\;\;-U\\
\end{array}
\end{array}
if U < -1.1e237 or -2.90000000000000006e162 < U < -4.4999999999999998e-14 or 1.24999999999999998e212 < U < 2.0000000000000001e269Initial program 64.7%
*-commutative64.7%
associate-*l*64.7%
associate-*r*64.7%
*-commutative64.7%
associate-*l*64.8%
*-commutative64.8%
unpow264.8%
hypot-1-def82.4%
*-commutative82.4%
associate-*l*82.4%
Simplified82.4%
Taylor expanded in U around -inf 61.1%
if -1.1e237 < U < -2.90000000000000006e162 or 1.20000000000000004e-82 < U < 1.24999999999999998e212 or 2.0000000000000001e269 < U Initial program 58.1%
*-commutative58.1%
associate-*l*58.1%
associate-*r*58.1%
*-commutative58.1%
associate-*l*58.0%
*-commutative58.0%
unpow258.0%
hypot-1-def81.5%
*-commutative81.5%
associate-*l*81.5%
Simplified81.5%
Taylor expanded in J around 0 51.8%
neg-mul-151.8%
Simplified51.8%
if -4.4999999999999998e-14 < U < 1.20000000000000004e-82Initial program 98.2%
*-commutative98.2%
associate-*l*98.2%
associate-*r*98.2%
*-commutative98.2%
associate-*l*98.1%
*-commutative98.1%
unpow298.1%
hypot-1-def99.8%
*-commutative99.8%
associate-*l*99.8%
Simplified99.8%
Taylor expanded in U around 0 84.4%
Taylor expanded in K around 0 48.5%
Final simplification52.2%
(FPCore (J K U) :precision binary64 U)
double code(double J, double K, double U) {
return U;
}
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
public static double code(double J, double K, double U) {
return U;
}
def code(J, K, U): return U
function code(J, K, U) return U end
function tmp = code(J, K, U) tmp = U; end
code[J_, K_, U_] := U
\begin{array}{l}
\\
U
\end{array}
Initial program 78.4%
*-commutative78.4%
associate-*l*78.4%
associate-*r*78.4%
*-commutative78.4%
associate-*l*78.4%
*-commutative78.4%
unpow278.4%
hypot-1-def90.3%
*-commutative90.3%
associate-*l*90.3%
Simplified90.3%
Taylor expanded in U around -inf 25.7%
Final simplification25.7%
herbie shell --seed 2023187
(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)))))