Average Error: 18.3 → 8.6
Time: 19.2s
Precision: binary64
Cost: 47300
\[\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 := \cos \left(\frac{K}{2}\right)\\ t_1 := \cos \left(K \cdot 0.5\right)\\ \mathbf{if}\;\left(t_0 \cdot \left(-2 \cdot J\right)\right) \cdot \sqrt{1 + {\left(\frac{U}{t_0 \cdot \left(J \cdot 2\right)}\right)}^{2}} \leq 2 \cdot 10^{+306}:\\ \;\;\;\;\left(J \cdot \mathsf{hypot}\left(1, \frac{U}{\left(J \cdot 2\right) \cdot t_1}\right)\right) \cdot \left(-2 \cdot t_1\right)\\ \mathbf{else}:\\ \;\;\;\;U\\ \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 (cos (/ K 2.0))) (t_1 (cos (* K 0.5))))
   (if (<=
        (* (* t_0 (* -2.0 J)) (sqrt (+ 1.0 (pow (/ U (* t_0 (* J 2.0))) 2.0))))
        2e+306)
     (* (* J (hypot 1.0 (/ U (* (* J 2.0) t_1)))) (* -2.0 t_1))
     U)))
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 = cos((K / 2.0));
	double t_1 = cos((K * 0.5));
	double tmp;
	if (((t_0 * (-2.0 * J)) * sqrt((1.0 + pow((U / (t_0 * (J * 2.0))), 2.0)))) <= 2e+306) {
		tmp = (J * hypot(1.0, (U / ((J * 2.0) * t_1)))) * (-2.0 * t_1);
	} else {
		tmp = U;
	}
	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 = Math.cos((K / 2.0));
	double t_1 = Math.cos((K * 0.5));
	double tmp;
	if (((t_0 * (-2.0 * J)) * Math.sqrt((1.0 + Math.pow((U / (t_0 * (J * 2.0))), 2.0)))) <= 2e+306) {
		tmp = (J * Math.hypot(1.0, (U / ((J * 2.0) * t_1)))) * (-2.0 * t_1);
	} else {
		tmp = U;
	}
	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 = math.cos((K / 2.0))
	t_1 = math.cos((K * 0.5))
	tmp = 0
	if ((t_0 * (-2.0 * J)) * math.sqrt((1.0 + math.pow((U / (t_0 * (J * 2.0))), 2.0)))) <= 2e+306:
		tmp = (J * math.hypot(1.0, (U / ((J * 2.0) * t_1)))) * (-2.0 * t_1)
	else:
		tmp = U
	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 = cos(Float64(K / 2.0))
	t_1 = cos(Float64(K * 0.5))
	tmp = 0.0
	if (Float64(Float64(t_0 * Float64(-2.0 * J)) * sqrt(Float64(1.0 + (Float64(U / Float64(t_0 * Float64(J * 2.0))) ^ 2.0)))) <= 2e+306)
		tmp = Float64(Float64(J * hypot(1.0, Float64(U / Float64(Float64(J * 2.0) * t_1)))) * Float64(-2.0 * t_1));
	else
		tmp = U;
	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 = cos((K / 2.0));
	t_1 = cos((K * 0.5));
	tmp = 0.0;
	if (((t_0 * (-2.0 * J)) * sqrt((1.0 + ((U / (t_0 * (J * 2.0))) ^ 2.0)))) <= 2e+306)
		tmp = (J * hypot(1.0, (U / ((J * 2.0) * t_1)))) * (-2.0 * t_1);
	else
		tmp = U;
	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[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(N[(t$95$0 * N[(-2.0 * J), $MachinePrecision]), $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], 2e+306], N[(N[(J * N[Sqrt[1.0 ^ 2 + N[(U / N[(N[(J * 2.0), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[(-2.0 * t$95$1), $MachinePrecision]), $MachinePrecision], U]]]
\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 := \cos \left(\frac{K}{2}\right)\\
t_1 := \cos \left(K \cdot 0.5\right)\\
\mathbf{if}\;\left(t_0 \cdot \left(-2 \cdot J\right)\right) \cdot \sqrt{1 + {\left(\frac{U}{t_0 \cdot \left(J \cdot 2\right)}\right)}^{2}} \leq 2 \cdot 10^{+306}:\\
\;\;\;\;\left(J \cdot \mathsf{hypot}\left(1, \frac{U}{\left(J \cdot 2\right) \cdot t_1}\right)\right) \cdot \left(-2 \cdot t_1\right)\\

\mathbf{else}:\\
\;\;\;\;U\\


\end{array}

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 2 regimes
  2. 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)))) < 2.00000000000000003e306

    1. Initial program 10.7

      \[\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. Simplified4.7

      \[\leadsto \color{blue}{J \cdot \left(\mathsf{hypot}\left(1, \frac{U}{\cos \left(\frac{K}{2}\right) \cdot \left(J \cdot 2\right)}\right) \cdot \left(-2 \cdot \cos \left(\frac{K}{2}\right)\right)\right)} \]
      Proof
      (*.f64 J (*.f64 (hypot.f64 1 (/.f64 U (*.f64 (cos.f64 (/.f64 K 2)) (*.f64 J 2)))) (*.f64 -2 (cos.f64 (/.f64 K 2))))): 0 points increase in error, 0 points decrease in error
      (*.f64 J (*.f64 (hypot.f64 1 (/.f64 U (*.f64 (cos.f64 (/.f64 K 2)) (Rewrite<= *-commutative_binary64 (*.f64 2 J))))) (*.f64 -2 (cos.f64 (/.f64 K 2))))): 0 points increase in error, 0 points decrease in error
      (*.f64 J (*.f64 (hypot.f64 1 (/.f64 U (Rewrite<= *-commutative_binary64 (*.f64 (*.f64 2 J) (cos.f64 (/.f64 K 2)))))) (*.f64 -2 (cos.f64 (/.f64 K 2))))): 0 points increase in error, 0 points decrease in error
      (*.f64 J (*.f64 (Rewrite<= hypot-1-def_binary64 (sqrt.f64 (+.f64 1 (*.f64 (/.f64 U (*.f64 (*.f64 2 J) (cos.f64 (/.f64 K 2)))) (/.f64 U (*.f64 (*.f64 2 J) (cos.f64 (/.f64 K 2)))))))) (*.f64 -2 (cos.f64 (/.f64 K 2))))): 33 points increase in error, 0 points decrease in error
      (*.f64 J (*.f64 (sqrt.f64 (+.f64 1 (Rewrite<= unpow2_binary64 (pow.f64 (/.f64 U (*.f64 (*.f64 2 J) (cos.f64 (/.f64 K 2)))) 2)))) (*.f64 -2 (cos.f64 (/.f64 K 2))))): 0 points increase in error, 0 points decrease in error
      (*.f64 J (Rewrite=> *-commutative_binary64 (*.f64 (*.f64 -2 (cos.f64 (/.f64 K 2))) (sqrt.f64 (+.f64 1 (pow.f64 (/.f64 U (*.f64 (*.f64 2 J) (cos.f64 (/.f64 K 2)))) 2)))))): 0 points increase in error, 0 points decrease in error
      (*.f64 J (Rewrite<= associate-*r*_binary64 (*.f64 -2 (*.f64 (cos.f64 (/.f64 K 2)) (sqrt.f64 (+.f64 1 (pow.f64 (/.f64 U (*.f64 (*.f64 2 J) (cos.f64 (/.f64 K 2)))) 2))))))): 0 points increase in error, 0 points decrease in error
      (Rewrite<= associate-*l*_binary64 (*.f64 (*.f64 J -2) (*.f64 (cos.f64 (/.f64 K 2)) (sqrt.f64 (+.f64 1 (pow.f64 (/.f64 U (*.f64 (*.f64 2 J) (cos.f64 (/.f64 K 2)))) 2)))))): 0 points increase in error, 0 points decrease in error
      (*.f64 (Rewrite<= *-commutative_binary64 (*.f64 -2 J)) (*.f64 (cos.f64 (/.f64 K 2)) (sqrt.f64 (+.f64 1 (pow.f64 (/.f64 U (*.f64 (*.f64 2 J) (cos.f64 (/.f64 K 2)))) 2))))): 0 points increase in error, 0 points decrease in error
      (Rewrite<= associate-*l*_binary64 (*.f64 (*.f64 (*.f64 -2 J) (cos.f64 (/.f64 K 2))) (sqrt.f64 (+.f64 1 (pow.f64 (/.f64 U (*.f64 (*.f64 2 J) (cos.f64 (/.f64 K 2)))) 2))))): 1 points increase in error, 11 points decrease in error
    3. Applied egg-rr5.8

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

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

    if 2.00000000000000003e306 < (*.f64 (*.f64 (*.f64 -2 J) (cos.f64 (/.f64 K 2))) (sqrt.f64 (+.f64 1 (pow.f64 (/.f64 U (*.f64 (*.f64 2 J) (cos.f64 (/.f64 K 2)))) 2))))

    1. Initial program 63.2

      \[\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. Simplified28.5

      \[\leadsto \color{blue}{J \cdot \left(\mathsf{hypot}\left(1, \frac{U}{\cos \left(\frac{K}{2}\right) \cdot \left(J \cdot 2\right)}\right) \cdot \left(-2 \cdot \cos \left(\frac{K}{2}\right)\right)\right)} \]
      Proof
      (*.f64 J (*.f64 (hypot.f64 1 (/.f64 U (*.f64 (cos.f64 (/.f64 K 2)) (*.f64 J 2)))) (*.f64 -2 (cos.f64 (/.f64 K 2))))): 0 points increase in error, 0 points decrease in error
      (*.f64 J (*.f64 (hypot.f64 1 (/.f64 U (*.f64 (cos.f64 (/.f64 K 2)) (Rewrite<= *-commutative_binary64 (*.f64 2 J))))) (*.f64 -2 (cos.f64 (/.f64 K 2))))): 0 points increase in error, 0 points decrease in error
      (*.f64 J (*.f64 (hypot.f64 1 (/.f64 U (Rewrite<= *-commutative_binary64 (*.f64 (*.f64 2 J) (cos.f64 (/.f64 K 2)))))) (*.f64 -2 (cos.f64 (/.f64 K 2))))): 0 points increase in error, 0 points decrease in error
      (*.f64 J (*.f64 (Rewrite<= hypot-1-def_binary64 (sqrt.f64 (+.f64 1 (*.f64 (/.f64 U (*.f64 (*.f64 2 J) (cos.f64 (/.f64 K 2)))) (/.f64 U (*.f64 (*.f64 2 J) (cos.f64 (/.f64 K 2)))))))) (*.f64 -2 (cos.f64 (/.f64 K 2))))): 33 points increase in error, 0 points decrease in error
      (*.f64 J (*.f64 (sqrt.f64 (+.f64 1 (Rewrite<= unpow2_binary64 (pow.f64 (/.f64 U (*.f64 (*.f64 2 J) (cos.f64 (/.f64 K 2)))) 2)))) (*.f64 -2 (cos.f64 (/.f64 K 2))))): 0 points increase in error, 0 points decrease in error
      (*.f64 J (Rewrite=> *-commutative_binary64 (*.f64 (*.f64 -2 (cos.f64 (/.f64 K 2))) (sqrt.f64 (+.f64 1 (pow.f64 (/.f64 U (*.f64 (*.f64 2 J) (cos.f64 (/.f64 K 2)))) 2)))))): 0 points increase in error, 0 points decrease in error
      (*.f64 J (Rewrite<= associate-*r*_binary64 (*.f64 -2 (*.f64 (cos.f64 (/.f64 K 2)) (sqrt.f64 (+.f64 1 (pow.f64 (/.f64 U (*.f64 (*.f64 2 J) (cos.f64 (/.f64 K 2)))) 2))))))): 0 points increase in error, 0 points decrease in error
      (Rewrite<= associate-*l*_binary64 (*.f64 (*.f64 J -2) (*.f64 (cos.f64 (/.f64 K 2)) (sqrt.f64 (+.f64 1 (pow.f64 (/.f64 U (*.f64 (*.f64 2 J) (cos.f64 (/.f64 K 2)))) 2)))))): 0 points increase in error, 0 points decrease in error
      (*.f64 (Rewrite<= *-commutative_binary64 (*.f64 -2 J)) (*.f64 (cos.f64 (/.f64 K 2)) (sqrt.f64 (+.f64 1 (pow.f64 (/.f64 U (*.f64 (*.f64 2 J) (cos.f64 (/.f64 K 2)))) 2))))): 0 points increase in error, 0 points decrease in error
      (Rewrite<= associate-*l*_binary64 (*.f64 (*.f64 (*.f64 -2 J) (cos.f64 (/.f64 K 2))) (sqrt.f64 (+.f64 1 (pow.f64 (/.f64 U (*.f64 (*.f64 2 J) (cos.f64 (/.f64 K 2)))) 2))))): 1 points increase in error, 11 points decrease in error
    3. Taylor expanded in K around 0 63.6

      \[\leadsto \color{blue}{-2 \cdot \left(\sqrt{1 + 0.25 \cdot \frac{{U}^{2}}{{J}^{2}}} \cdot J\right)} \]
    4. Simplified63.4

      \[\leadsto \color{blue}{\sqrt{\mathsf{fma}\left(0.25, \frac{U}{J} \cdot \frac{U}{J}, 1\right)} \cdot \left(J \cdot -2\right)} \]
      Proof
      (*.f64 (sqrt.f64 (fma.f64 1/4 (*.f64 (/.f64 U J) (/.f64 U J)) 1)) (*.f64 J -2)): 0 points increase in error, 0 points decrease in error
      (*.f64 (sqrt.f64 (fma.f64 1/4 (Rewrite<= times-frac_binary64 (/.f64 (*.f64 U U) (*.f64 J J))) 1)) (*.f64 J -2)): 46 points increase in error, 3 points decrease in error
      (*.f64 (sqrt.f64 (fma.f64 1/4 (/.f64 (Rewrite<= unpow2_binary64 (pow.f64 U 2)) (*.f64 J J)) 1)) (*.f64 J -2)): 0 points increase in error, 0 points decrease in error
      (*.f64 (sqrt.f64 (fma.f64 1/4 (/.f64 (pow.f64 U 2) (Rewrite<= unpow2_binary64 (pow.f64 J 2))) 1)) (*.f64 J -2)): 0 points increase in error, 0 points decrease in error
      (*.f64 (sqrt.f64 (Rewrite<= fma-def_binary64 (+.f64 (*.f64 1/4 (/.f64 (pow.f64 U 2) (pow.f64 J 2))) 1))) (*.f64 J -2)): 0 points increase in error, 0 points decrease in error
      (*.f64 (sqrt.f64 (Rewrite<= +-commutative_binary64 (+.f64 1 (*.f64 1/4 (/.f64 (pow.f64 U 2) (pow.f64 J 2)))))) (*.f64 J -2)): 0 points increase in error, 0 points decrease in error
      (Rewrite<= associate-*l*_binary64 (*.f64 (*.f64 (sqrt.f64 (+.f64 1 (*.f64 1/4 (/.f64 (pow.f64 U 2) (pow.f64 J 2))))) J) -2)): 0 points increase in error, 0 points decrease in error
      (Rewrite<= *-commutative_binary64 (*.f64 -2 (*.f64 (sqrt.f64 (+.f64 1 (*.f64 1/4 (/.f64 (pow.f64 U 2) (pow.f64 J 2))))) J))): 0 points increase in error, 0 points decrease in error
    5. Taylor expanded in U around -inf 31.4

      \[\leadsto \color{blue}{U} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification8.6

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(\cos \left(\frac{K}{2}\right) \cdot \left(-2 \cdot J\right)\right) \cdot \sqrt{1 + {\left(\frac{U}{\cos \left(\frac{K}{2}\right) \cdot \left(J \cdot 2\right)}\right)}^{2}} \leq 2 \cdot 10^{+306}:\\ \;\;\;\;\left(J \cdot \mathsf{hypot}\left(1, \frac{U}{\left(J \cdot 2\right) \cdot \cos \left(K \cdot 0.5\right)}\right)\right) \cdot \left(-2 \cdot \cos \left(K \cdot 0.5\right)\right)\\ \mathbf{else}:\\ \;\;\;\;U\\ \end{array} \]

Alternatives

Alternative 1
Error16.8
Cost13960
\[\begin{array}{l} \mathbf{if}\;U \leq -1.890002561498521 \cdot 10^{+179}:\\ \;\;\;\;U\\ \mathbf{elif}\;U \leq 2.5599760365168285 \cdot 10^{+229}:\\ \;\;\;\;\left(\cos \left(\frac{K}{2}\right) \cdot \left(-2 \cdot J\right)\right) \cdot \mathsf{hypot}\left(1, 0.5 \cdot \frac{U}{J}\right)\\ \mathbf{else}:\\ \;\;\;\;U\\ \end{array} \]
Alternative 2
Error27.5
Cost7888
\[\begin{array}{l} t_0 := J \cdot \left(-2 \cdot \cos \left(K \cdot 0.5\right)\right)\\ \mathbf{if}\;U \leq -7.509153478492834 \cdot 10^{+56}:\\ \;\;\;\;U\\ \mathbf{elif}\;U \leq 2.1643678618369995 \cdot 10^{-133}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;U \leq 2.8723561608757963 \cdot 10^{-84}:\\ \;\;\;\;\left(-2 \cdot J\right) \cdot \sqrt{1 + 0.25 \cdot \left(\frac{U}{J} \cdot \frac{U}{J}\right)}\\ \mathbf{elif}\;U \leq 2.0682147269950717 \cdot 10^{+35}:\\ \;\;\;\;t_0 + \frac{U}{J} \cdot \left(U \cdot -0.25\right)\\ \mathbf{elif}\;U \leq 4.6649191171322224 \cdot 10^{+108}:\\ \;\;\;\;U\\ \mathbf{elif}\;U \leq 2.5599760365168285 \cdot 10^{+229}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;U\\ \end{array} \]
Alternative 3
Error27.2
Cost7376
\[\begin{array}{l} t_0 := J \cdot \left(-2 \cdot \cos \left(K \cdot 0.5\right)\right)\\ \mathbf{if}\;U \leq -7.509153478492834 \cdot 10^{+56}:\\ \;\;\;\;U\\ \mathbf{elif}\;U \leq 2.0682147269950717 \cdot 10^{+35}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;U \leq 4.6649191171322224 \cdot 10^{+108}:\\ \;\;\;\;U\\ \mathbf{elif}\;U \leq 2.5599760365168285 \cdot 10^{+229}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;U\\ \end{array} \]
Alternative 4
Error37.7
Cost1116
\[\begin{array}{l} \mathbf{if}\;J \leq -1.1797990684181379 \cdot 10^{-26}:\\ \;\;\;\;-2 \cdot J\\ \mathbf{elif}\;J \leq -1.200607791964246 \cdot 10^{-81}:\\ \;\;\;\;U\\ \mathbf{elif}\;J \leq -6.363955357020148 \cdot 10^{-169}:\\ \;\;\;\;-U\\ \mathbf{elif}\;J \leq -2.027678991683289 \cdot 10^{-273}:\\ \;\;\;\;U\\ \mathbf{elif}\;J \leq 8.230462987396467 \cdot 10^{-273}:\\ \;\;\;\;-U\\ \mathbf{elif}\;J \leq 6.99801920754704 \cdot 10^{-195}:\\ \;\;\;\;U\\ \mathbf{elif}\;J \leq 1.7739290511688193 \cdot 10^{-125}:\\ \;\;\;\;-U\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot J\\ \end{array} \]
Alternative 5
Error37.7
Cost1116
\[\begin{array}{l} \mathbf{if}\;J \leq -1.1797990684181379 \cdot 10^{-26}:\\ \;\;\;\;-2 \cdot J\\ \mathbf{elif}\;J \leq -1.200607791964246 \cdot 10^{-81}:\\ \;\;\;\;U\\ \mathbf{elif}\;J \leq -6.363955357020148 \cdot 10^{-169}:\\ \;\;\;\;\frac{J \cdot U}{-J}\\ \mathbf{elif}\;J \leq -2.027678991683289 \cdot 10^{-273}:\\ \;\;\;\;U\\ \mathbf{elif}\;J \leq 8.230462987396467 \cdot 10^{-273}:\\ \;\;\;\;-U\\ \mathbf{elif}\;J \leq 6.99801920754704 \cdot 10^{-195}:\\ \;\;\;\;U\\ \mathbf{elif}\;J \leq 1.7739290511688193 \cdot 10^{-125}:\\ \;\;\;\;-U\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot J\\ \end{array} \]
Alternative 6
Error46.4
Cost920
\[\begin{array}{l} \mathbf{if}\;J \leq -1.200607791964246 \cdot 10^{-81}:\\ \;\;\;\;U\\ \mathbf{elif}\;J \leq -9.4863694884569 \cdot 10^{-188}:\\ \;\;\;\;-U\\ \mathbf{elif}\;J \leq -2.027678991683289 \cdot 10^{-273}:\\ \;\;\;\;U\\ \mathbf{elif}\;J \leq 8.230462987396467 \cdot 10^{-273}:\\ \;\;\;\;-U\\ \mathbf{elif}\;J \leq 6.99801920754704 \cdot 10^{-195}:\\ \;\;\;\;U\\ \mathbf{elif}\;J \leq 1.7739290511688193 \cdot 10^{-125}:\\ \;\;\;\;-U\\ \mathbf{else}:\\ \;\;\;\;U\\ \end{array} \]
Alternative 7
Error46.3
Cost64
\[U \]

Error

Reproduce

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