Average Error: 18.3 → 9.9
Time: 22.2s
Precision: binary64
Cost: 21144
\[\left(\left(-2 \cdot J\right) \cdot \cos \left(\frac{K}{2}\right)\right) \cdot \sqrt{1 + {\left(\frac{U}{\left(2 \cdot J\right) \cdot \cos \left(\frac{K}{2}\right)}\right)}^{2}} \]
\[\begin{array}{l} t_0 := J \cdot \cos \left(\frac{K}{2}\right)\\ t_1 := -2 \cdot \left(t_0 \cdot \mathsf{hypot}\left(1, \frac{U}{2 \cdot t_0}\right)\right)\\ \mathbf{if}\;J \leq -5.407221669367018 \cdot 10^{-193}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;J \leq -4.4901932983253626 \cdot 10^{-271}:\\ \;\;\;\;U\\ \mathbf{elif}\;J \leq 2.7798137026854894 \cdot 10^{-292}:\\ \;\;\;\;-U\\ \mathbf{elif}\;J \leq 3.1339674957080726 \cdot 10^{-250}:\\ \;\;\;\;U\\ \mathbf{elif}\;J \leq 9.614076072178369 \cdot 10^{-236}:\\ \;\;\;\;-U\\ \mathbf{elif}\;J \leq 1.7600164228302432 \cdot 10^{-178}:\\ \;\;\;\;U\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
(FPCore (J K U)
 :precision binary64
 (*
  (* (* -2.0 J) (cos (/ K 2.0)))
  (sqrt (+ 1.0 (pow (/ U (* (* 2.0 J) (cos (/ K 2.0)))) 2.0)))))
(FPCore (J K U)
 :precision binary64
 (let* ((t_0 (* J (cos (/ K 2.0))))
        (t_1 (* -2.0 (* t_0 (hypot 1.0 (/ U (* 2.0 t_0)))))))
   (if (<= J -5.407221669367018e-193)
     t_1
     (if (<= J -4.4901932983253626e-271)
       U
       (if (<= J 2.7798137026854894e-292)
         (- U)
         (if (<= J 3.1339674957080726e-250)
           U
           (if (<= J 9.614076072178369e-236)
             (- U)
             (if (<= J 1.7600164228302432e-178) U t_1))))))))
double code(double J, double K, double U) {
	return ((-2.0 * J) * cos((K / 2.0))) * sqrt((1.0 + pow((U / ((2.0 * J) * cos((K / 2.0)))), 2.0)));
}
double code(double J, double K, double U) {
	double t_0 = J * cos((K / 2.0));
	double t_1 = -2.0 * (t_0 * hypot(1.0, (U / (2.0 * t_0))));
	double tmp;
	if (J <= -5.407221669367018e-193) {
		tmp = t_1;
	} else if (J <= -4.4901932983253626e-271) {
		tmp = U;
	} else if (J <= 2.7798137026854894e-292) {
		tmp = -U;
	} else if (J <= 3.1339674957080726e-250) {
		tmp = U;
	} else if (J <= 9.614076072178369e-236) {
		tmp = -U;
	} else if (J <= 1.7600164228302432e-178) {
		tmp = U;
	} else {
		tmp = t_1;
	}
	return tmp;
}
public static double code(double J, double K, double U) {
	return ((-2.0 * J) * Math.cos((K / 2.0))) * Math.sqrt((1.0 + Math.pow((U / ((2.0 * J) * Math.cos((K / 2.0)))), 2.0)));
}
public static double code(double J, double K, double U) {
	double t_0 = J * Math.cos((K / 2.0));
	double t_1 = -2.0 * (t_0 * Math.hypot(1.0, (U / (2.0 * t_0))));
	double tmp;
	if (J <= -5.407221669367018e-193) {
		tmp = t_1;
	} else if (J <= -4.4901932983253626e-271) {
		tmp = U;
	} else if (J <= 2.7798137026854894e-292) {
		tmp = -U;
	} else if (J <= 3.1339674957080726e-250) {
		tmp = U;
	} else if (J <= 9.614076072178369e-236) {
		tmp = -U;
	} else if (J <= 1.7600164228302432e-178) {
		tmp = U;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(J, K, U):
	return ((-2.0 * J) * math.cos((K / 2.0))) * math.sqrt((1.0 + math.pow((U / ((2.0 * J) * math.cos((K / 2.0)))), 2.0)))
def code(J, K, U):
	t_0 = J * math.cos((K / 2.0))
	t_1 = -2.0 * (t_0 * math.hypot(1.0, (U / (2.0 * t_0))))
	tmp = 0
	if J <= -5.407221669367018e-193:
		tmp = t_1
	elif J <= -4.4901932983253626e-271:
		tmp = U
	elif J <= 2.7798137026854894e-292:
		tmp = -U
	elif J <= 3.1339674957080726e-250:
		tmp = U
	elif J <= 9.614076072178369e-236:
		tmp = -U
	elif J <= 1.7600164228302432e-178:
		tmp = U
	else:
		tmp = t_1
	return tmp
function code(J, K, U)
	return Float64(Float64(Float64(-2.0 * J) * cos(Float64(K / 2.0))) * sqrt(Float64(1.0 + (Float64(U / Float64(Float64(2.0 * J) * cos(Float64(K / 2.0)))) ^ 2.0))))
end
function code(J, K, U)
	t_0 = Float64(J * cos(Float64(K / 2.0)))
	t_1 = Float64(-2.0 * Float64(t_0 * hypot(1.0, Float64(U / Float64(2.0 * t_0)))))
	tmp = 0.0
	if (J <= -5.407221669367018e-193)
		tmp = t_1;
	elseif (J <= -4.4901932983253626e-271)
		tmp = U;
	elseif (J <= 2.7798137026854894e-292)
		tmp = Float64(-U);
	elseif (J <= 3.1339674957080726e-250)
		tmp = U;
	elseif (J <= 9.614076072178369e-236)
		tmp = Float64(-U);
	elseif (J <= 1.7600164228302432e-178)
		tmp = U;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp = code(J, K, U)
	tmp = ((-2.0 * J) * cos((K / 2.0))) * sqrt((1.0 + ((U / ((2.0 * J) * cos((K / 2.0)))) ^ 2.0)));
end
function tmp_2 = code(J, K, U)
	t_0 = J * cos((K / 2.0));
	t_1 = -2.0 * (t_0 * hypot(1.0, (U / (2.0 * t_0))));
	tmp = 0.0;
	if (J <= -5.407221669367018e-193)
		tmp = t_1;
	elseif (J <= -4.4901932983253626e-271)
		tmp = U;
	elseif (J <= 2.7798137026854894e-292)
		tmp = -U;
	elseif (J <= 3.1339674957080726e-250)
		tmp = U;
	elseif (J <= 9.614076072178369e-236)
		tmp = -U;
	elseif (J <= 1.7600164228302432e-178)
		tmp = U;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[J_, K_, U_] := N[(N[(N[(-2.0 * J), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(1.0 + N[Power[N[(U / N[(N[(2.0 * J), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
code[J_, K_, U_] := Block[{t$95$0 = N[(J * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(-2.0 * N[(t$95$0 * N[Sqrt[1.0 ^ 2 + N[(U / N[(2.0 * t$95$0), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[J, -5.407221669367018e-193], t$95$1, If[LessEqual[J, -4.4901932983253626e-271], U, If[LessEqual[J, 2.7798137026854894e-292], (-U), If[LessEqual[J, 3.1339674957080726e-250], U, If[LessEqual[J, 9.614076072178369e-236], (-U), If[LessEqual[J, 1.7600164228302432e-178], U, t$95$1]]]]]]]]
\left(\left(-2 \cdot J\right) \cdot \cos \left(\frac{K}{2}\right)\right) \cdot \sqrt{1 + {\left(\frac{U}{\left(2 \cdot J\right) \cdot \cos \left(\frac{K}{2}\right)}\right)}^{2}}
\begin{array}{l}
t_0 := J \cdot \cos \left(\frac{K}{2}\right)\\
t_1 := -2 \cdot \left(t_0 \cdot \mathsf{hypot}\left(1, \frac{U}{2 \cdot t_0}\right)\right)\\
\mathbf{if}\;J \leq -5.407221669367018 \cdot 10^{-193}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;J \leq -4.4901932983253626 \cdot 10^{-271}:\\
\;\;\;\;U\\

\mathbf{elif}\;J \leq 2.7798137026854894 \cdot 10^{-292}:\\
\;\;\;\;-U\\

\mathbf{elif}\;J \leq 3.1339674957080726 \cdot 10^{-250}:\\
\;\;\;\;U\\

\mathbf{elif}\;J \leq 9.614076072178369 \cdot 10^{-236}:\\
\;\;\;\;-U\\

\mathbf{elif}\;J \leq 1.7600164228302432 \cdot 10^{-178}:\\
\;\;\;\;U\\

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 3 regimes
  2. if J < -5.40722166936701813e-193 or 1.76001642283024315e-178 < J

    1. Initial program 12.4

      \[\left(\left(-2 \cdot J\right) \cdot \cos \left(\frac{K}{2}\right)\right) \cdot \sqrt{1 + {\left(\frac{U}{\left(2 \cdot J\right) \cdot \cos \left(\frac{K}{2}\right)}\right)}^{2}} \]
    2. Simplified3.7

      \[\leadsto \color{blue}{-2 \cdot \left(\mathsf{hypot}\left(1, \frac{U}{2 \cdot \left(J \cdot \cos \left(\frac{K}{2}\right)\right)}\right) \cdot \left(J \cdot \cos \left(\frac{K}{2}\right)\right)\right)} \]

    if -5.40722166936701813e-193 < J < -4.4901932983253626e-271 or 2.7798137026854894e-292 < J < 3.13396749570807255e-250 or 9.61407607217836879e-236 < J < 1.76001642283024315e-178

    1. Initial program 39.4

      \[\left(\left(-2 \cdot J\right) \cdot \cos \left(\frac{K}{2}\right)\right) \cdot \sqrt{1 + {\left(\frac{U}{\left(2 \cdot J\right) \cdot \cos \left(\frac{K}{2}\right)}\right)}^{2}} \]
    2. Simplified23.7

      \[\leadsto \color{blue}{-2 \cdot \left(\mathsf{hypot}\left(1, \frac{U}{2 \cdot \left(J \cdot \cos \left(\frac{K}{2}\right)\right)}\right) \cdot \left(J \cdot \cos \left(\frac{K}{2}\right)\right)\right)} \]
    3. Taylor expanded in U around -inf 35.0

      \[\leadsto -2 \cdot \color{blue}{\left(-0.5 \cdot U\right)} \]
    4. Taylor expanded in U around 0 35.0

      \[\leadsto \color{blue}{U} \]

    if -4.4901932983253626e-271 < J < 2.7798137026854894e-292 or 3.13396749570807255e-250 < J < 9.61407607217836879e-236

    1. Initial program 46.5

      \[\left(\left(-2 \cdot J\right) \cdot \cos \left(\frac{K}{2}\right)\right) \cdot \sqrt{1 + {\left(\frac{U}{\left(2 \cdot J\right) \cdot \cos \left(\frac{K}{2}\right)}\right)}^{2}} \]
    2. Simplified29.6

      \[\leadsto \color{blue}{-2 \cdot \left(\mathsf{hypot}\left(1, \frac{U}{2 \cdot \left(J \cdot \cos \left(\frac{K}{2}\right)\right)}\right) \cdot \left(J \cdot \cos \left(\frac{K}{2}\right)\right)\right)} \]
    3. Applied egg-rr30.3

      \[\leadsto -2 \cdot \left(\mathsf{hypot}\left(1, \frac{U}{2 \cdot \left(J \cdot \cos \left(\frac{K}{2}\right)\right)}\right) \cdot \color{blue}{{\left(\sqrt[3]{J \cdot \cos \left(K \cdot 0.5\right)}\right)}^{3}}\right) \]
    4. Applied egg-rr29.9

      \[\leadsto -2 \cdot \left(\mathsf{hypot}\left(1, \frac{U}{2 \cdot \left(J \cdot \cos \left(\frac{K}{2}\right)\right)}\right) \cdot \color{blue}{\left(\left(J \cdot {\left(\sqrt[3]{\cos \left(K \cdot 0.5\right)}\right)}^{2}\right) \cdot \sqrt[3]{\cos \left(K \cdot 0.5\right)}\right)}\right) \]
    5. Taylor expanded in U around inf 31.6

      \[\leadsto -2 \cdot \color{blue}{\left(0.5 \cdot U\right)} \]
    6. Taylor expanded in U around 0 31.6

      \[\leadsto \color{blue}{-1 \cdot U} \]
    7. Simplified31.6

      \[\leadsto \color{blue}{-U} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification9.9

    \[\leadsto \begin{array}{l} \mathbf{if}\;J \leq -5.407221669367018 \cdot 10^{-193}:\\ \;\;\;\;-2 \cdot \left(\left(J \cdot \cos \left(\frac{K}{2}\right)\right) \cdot \mathsf{hypot}\left(1, \frac{U}{2 \cdot \left(J \cdot \cos \left(\frac{K}{2}\right)\right)}\right)\right)\\ \mathbf{elif}\;J \leq -4.4901932983253626 \cdot 10^{-271}:\\ \;\;\;\;U\\ \mathbf{elif}\;J \leq 2.7798137026854894 \cdot 10^{-292}:\\ \;\;\;\;-U\\ \mathbf{elif}\;J \leq 3.1339674957080726 \cdot 10^{-250}:\\ \;\;\;\;U\\ \mathbf{elif}\;J \leq 9.614076072178369 \cdot 10^{-236}:\\ \;\;\;\;-U\\ \mathbf{elif}\;J \leq 1.7600164228302432 \cdot 10^{-178}:\\ \;\;\;\;U\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \left(\left(J \cdot \cos \left(\frac{K}{2}\right)\right) \cdot \mathsf{hypot}\left(1, \frac{U}{2 \cdot \left(J \cdot \cos \left(\frac{K}{2}\right)\right)}\right)\right)\\ \end{array} \]

Alternatives

Alternative 1
Error21.2
Cost14736
\[\begin{array}{l} t_0 := -2 \cdot \left(J \cdot \cos \left(K \cdot 0.5\right)\right)\\ \mathbf{if}\;\frac{K}{2} \leq -2 \cdot 10^{+264}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;\frac{K}{2} \leq -1 \cdot 10^{+206}:\\ \;\;\;\;-U\\ \mathbf{elif}\;\frac{K}{2} \leq -0.05:\\ \;\;\;\;t_0\\ \mathbf{elif}\;\frac{K}{2} \leq 2 \cdot 10^{-13}:\\ \;\;\;\;-2 \cdot \left(J \cdot \mathsf{hypot}\left(1, \frac{U}{2 \cdot \left(J \cdot \cos \left(\frac{K}{2}\right)\right)}\right)\right)\\ \mathbf{elif}\;\frac{K}{2} \leq 5 \cdot 10^{+194}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;\frac{K}{2} \leq 5 \cdot 10^{+224}:\\ \;\;\;\;-2 \cdot \left(U \cdot -0.5 + \left(J \cdot \frac{J}{U}\right) \cdot \left(-0.5 + -0.5 \cdot \cos K\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 2
Error17.8
Cost14488
\[\begin{array}{l} t_0 := -2 \cdot \left(\left(J \cdot \cos \left(\frac{K}{2}\right)\right) \cdot \mathsf{hypot}\left(1, \frac{U}{J \cdot 2}\right)\right)\\ \mathbf{if}\;J \leq -1.112123401272729 \cdot 10^{-92}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;J \leq -4.4901932983253626 \cdot 10^{-271}:\\ \;\;\;\;U\\ \mathbf{elif}\;J \leq 2.7798137026854894 \cdot 10^{-292}:\\ \;\;\;\;-U\\ \mathbf{elif}\;J \leq 3.1339674957080726 \cdot 10^{-250}:\\ \;\;\;\;U\\ \mathbf{elif}\;J \leq 9.614076072178369 \cdot 10^{-236}:\\ \;\;\;\;-U\\ \mathbf{elif}\;J \leq 1.7600164228302432 \cdot 10^{-178}:\\ \;\;\;\;U\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 3
Error27.5
Cost8940
\[\begin{array}{l} t_0 := -2 \cdot \left(U \cdot -0.5 + \left(J \cdot \frac{J}{U}\right) \cdot \left(-0.5 + -0.5 \cdot \cos K\right)\right)\\ t_1 := -2 \cdot \left(J \cdot \cos \left(K \cdot 0.5\right)\right)\\ \mathbf{if}\;J \leq -9.706203699812085 \cdot 10^{+38}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;J \leq -1.3717742236812826 \cdot 10^{-33}:\\ \;\;\;\;-U\\ \mathbf{elif}\;J \leq -2.3108588166833224 \cdot 10^{-58}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;J \leq -1.112123401272729 \cdot 10^{-92}:\\ \;\;\;\;-U\\ \mathbf{elif}\;J \leq -4.4901932983253626 \cdot 10^{-271}:\\ \;\;\;\;U\\ \mathbf{elif}\;J \leq 2.7798137026854894 \cdot 10^{-292}:\\ \;\;\;\;-U\\ \mathbf{elif}\;J \leq 3.1339674957080726 \cdot 10^{-250}:\\ \;\;\;\;U\\ \mathbf{elif}\;J \leq 9.614076072178369 \cdot 10^{-236}:\\ \;\;\;\;-U\\ \mathbf{elif}\;J \leq 8.139644730068876 \cdot 10^{-85}:\\ \;\;\;\;U\\ \mathbf{elif}\;J \leq 3.796490840369312 \cdot 10^{-29}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;J \leq 1.3189139956482617 \cdot 10^{+29}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 4
Error27.5
Cost8940
\[\begin{array}{l} t_0 := -2 \cdot \left(J \cdot \cos \left(K \cdot 0.5\right)\right)\\ \mathbf{if}\;J \leq -9.706203699812085 \cdot 10^{+38}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;J \leq -1.3717742236812826 \cdot 10^{-33}:\\ \;\;\;\;-U\\ \mathbf{elif}\;J \leq -2.3108588166833224 \cdot 10^{-58}:\\ \;\;\;\;-2 \cdot \left(U \cdot -0.5 + \frac{J \cdot J}{U} \cdot \frac{-1 - \cos K}{2}\right)\\ \mathbf{elif}\;J \leq -1.112123401272729 \cdot 10^{-92}:\\ \;\;\;\;-U\\ \mathbf{elif}\;J \leq -4.4901932983253626 \cdot 10^{-271}:\\ \;\;\;\;U\\ \mathbf{elif}\;J \leq 2.7798137026854894 \cdot 10^{-292}:\\ \;\;\;\;-U\\ \mathbf{elif}\;J \leq 3.1339674957080726 \cdot 10^{-250}:\\ \;\;\;\;U\\ \mathbf{elif}\;J \leq 9.614076072178369 \cdot 10^{-236}:\\ \;\;\;\;-U\\ \mathbf{elif}\;J \leq 8.139644730068876 \cdot 10^{-85}:\\ \;\;\;\;U\\ \mathbf{elif}\;J \leq 3.796490840369312 \cdot 10^{-29}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;J \leq 1.3189139956482617 \cdot 10^{+29}:\\ \;\;\;\;-2 \cdot \left(U \cdot -0.5 + \left(J \cdot \frac{J}{U}\right) \cdot \left(-0.5 + -0.5 \cdot \cos K\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 5
Error27.5
Cost8300
\[\begin{array}{l} t_0 := -2 \cdot \left(J \cdot \cos \left(K \cdot 0.5\right)\right)\\ \mathbf{if}\;J \leq -9.706203699812085 \cdot 10^{+38}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;J \leq -1.3717742236812826 \cdot 10^{-33}:\\ \;\;\;\;-U\\ \mathbf{elif}\;J \leq -2.3108588166833224 \cdot 10^{-58}:\\ \;\;\;\;-2 \cdot \left(U \cdot -0.5 - \frac{J}{\frac{U}{J}}\right)\\ \mathbf{elif}\;J \leq -1.112123401272729 \cdot 10^{-92}:\\ \;\;\;\;-U\\ \mathbf{elif}\;J \leq -4.4901932983253626 \cdot 10^{-271}:\\ \;\;\;\;U\\ \mathbf{elif}\;J \leq 2.7798137026854894 \cdot 10^{-292}:\\ \;\;\;\;-U\\ \mathbf{elif}\;J \leq 3.1339674957080726 \cdot 10^{-250}:\\ \;\;\;\;U\\ \mathbf{elif}\;J \leq 9.614076072178369 \cdot 10^{-236}:\\ \;\;\;\;-U\\ \mathbf{elif}\;J \leq 8.139644730068876 \cdot 10^{-85}:\\ \;\;\;\;U\\ \mathbf{elif}\;J \leq 3.796490840369312 \cdot 10^{-29}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;J \leq 1.3189139956482617 \cdot 10^{+29}:\\ \;\;\;\;U\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 6
Error38.4
Cost1316
\[\begin{array}{l} \mathbf{if}\;U \leq -1.1240578658321223 \cdot 10^{+164}:\\ \;\;\;\;U\\ \mathbf{elif}\;U \leq -1.0758961733910796 \cdot 10^{+126}:\\ \;\;\;\;-U\\ \mathbf{elif}\;U \leq -12249631411.58905:\\ \;\;\;\;U\\ \mathbf{elif}\;U \leq 1.1203710663136834 \cdot 10^{-5}:\\ \;\;\;\;J \cdot -2\\ \mathbf{elif}\;U \leq 6.875217985527028 \cdot 10^{+80}:\\ \;\;\;\;U\\ \mathbf{elif}\;U \leq 2.857098725848094 \cdot 10^{+86}:\\ \;\;\;\;J \cdot -2\\ \mathbf{elif}\;U \leq 5.5278834144233005 \cdot 10^{+128}:\\ \;\;\;\;-U\\ \mathbf{elif}\;U \leq 4.713430986836766 \cdot 10^{+219}:\\ \;\;\;\;U\\ \mathbf{elif}\;U \leq 7.044830528882503 \cdot 10^{+276}:\\ \;\;\;\;-U\\ \mathbf{else}:\\ \;\;\;\;U\\ \end{array} \]
Alternative 7
Error38.4
Cost1316
\[\begin{array}{l} \mathbf{if}\;U \leq -1.1240578658321223 \cdot 10^{+164}:\\ \;\;\;\;-2 \cdot \left(U \cdot -0.5 - \frac{J}{\frac{U}{J}}\right)\\ \mathbf{elif}\;U \leq -1.0758961733910796 \cdot 10^{+126}:\\ \;\;\;\;-U\\ \mathbf{elif}\;U \leq -12249631411.58905:\\ \;\;\;\;U\\ \mathbf{elif}\;U \leq 1.1203710663136834 \cdot 10^{-5}:\\ \;\;\;\;J \cdot -2\\ \mathbf{elif}\;U \leq 6.875217985527028 \cdot 10^{+80}:\\ \;\;\;\;U\\ \mathbf{elif}\;U \leq 2.857098725848094 \cdot 10^{+86}:\\ \;\;\;\;J \cdot -2\\ \mathbf{elif}\;U \leq 5.5278834144233005 \cdot 10^{+128}:\\ \;\;\;\;-U\\ \mathbf{elif}\;U \leq 4.713430986836766 \cdot 10^{+219}:\\ \;\;\;\;U\\ \mathbf{elif}\;U \leq 7.044830528882503 \cdot 10^{+276}:\\ \;\;\;\;-U\\ \mathbf{else}:\\ \;\;\;\;U\\ \end{array} \]
Alternative 8
Error47.0
Cost1184
\[\begin{array}{l} \mathbf{if}\;U \leq -1.1240578658321223 \cdot 10^{+164}:\\ \;\;\;\;U\\ \mathbf{elif}\;U \leq -1.0758961733910796 \cdot 10^{+126}:\\ \;\;\;\;-U\\ \mathbf{elif}\;U \leq 3.603943909920846 \cdot 10^{-90}:\\ \;\;\;\;U\\ \mathbf{elif}\;U \leq 2.999894301940446 \cdot 10^{-12}:\\ \;\;\;\;-U\\ \mathbf{elif}\;U \leq 6.875217985527028 \cdot 10^{+80}:\\ \;\;\;\;U\\ \mathbf{elif}\;U \leq 5.5278834144233005 \cdot 10^{+128}:\\ \;\;\;\;-U\\ \mathbf{elif}\;U \leq 4.713430986836766 \cdot 10^{+219}:\\ \;\;\;\;U\\ \mathbf{elif}\;U \leq 7.044830528882503 \cdot 10^{+276}:\\ \;\;\;\;-U\\ \mathbf{else}:\\ \;\;\;\;U\\ \end{array} \]
Alternative 9
Error47.0
Cost64
\[U \]

Error

Reproduce

herbie shell --seed 2022217 
(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)))))