Average Error: 17.8 → 8.2
Time: 48.3s
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)\\ \mathbf{if}\;\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}} \leq 5 \cdot 10^{+307}:\\ \;\;\;\;\left(-2 \cdot J\right) \cdot \left(t_0 \cdot \mathsf{hypot}\left(1, 0.5 \cdot \frac{\frac{U}{J}}{\cos \left(K \cdot 0.5\right)}\right)\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))))
   (if (<=
        (* (* (* -2.0 J) t_0) (sqrt (+ 1.0 (pow (/ U (* t_0 (* J 2.0))) 2.0))))
        5e+307)
     (* (* -2.0 J) (* t_0 (hypot 1.0 (* 0.5 (/ (/ U J) (cos (* K 0.5)))))))
     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 tmp;
	if ((((-2.0 * J) * t_0) * sqrt((1.0 + pow((U / (t_0 * (J * 2.0))), 2.0)))) <= 5e+307) {
		tmp = (-2.0 * J) * (t_0 * hypot(1.0, (0.5 * ((U / J) / cos((K * 0.5))))));
	} 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 tmp;
	if ((((-2.0 * J) * t_0) * Math.sqrt((1.0 + Math.pow((U / (t_0 * (J * 2.0))), 2.0)))) <= 5e+307) {
		tmp = (-2.0 * J) * (t_0 * Math.hypot(1.0, (0.5 * ((U / J) / Math.cos((K * 0.5))))));
	} 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))
	tmp = 0
	if (((-2.0 * J) * t_0) * math.sqrt((1.0 + math.pow((U / (t_0 * (J * 2.0))), 2.0)))) <= 5e+307:
		tmp = (-2.0 * J) * (t_0 * math.hypot(1.0, (0.5 * ((U / J) / math.cos((K * 0.5))))))
	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))
	tmp = 0.0
	if (Float64(Float64(Float64(-2.0 * J) * t_0) * sqrt(Float64(1.0 + (Float64(U / Float64(t_0 * Float64(J * 2.0))) ^ 2.0)))) <= 5e+307)
		tmp = Float64(Float64(-2.0 * J) * Float64(t_0 * hypot(1.0, Float64(0.5 * Float64(Float64(U / J) / cos(Float64(K * 0.5)))))));
	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));
	tmp = 0.0;
	if ((((-2.0 * J) * t_0) * sqrt((1.0 + ((U / (t_0 * (J * 2.0))) ^ 2.0)))) <= 5e+307)
		tmp = (-2.0 * J) * (t_0 * hypot(1.0, (0.5 * ((U / J) / cos((K * 0.5))))));
	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]}, If[LessEqual[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], 5e+307], N[(N[(-2.0 * J), $MachinePrecision] * N[(t$95$0 * N[Sqrt[1.0 ^ 2 + N[(0.5 * N[(N[(U / J), $MachinePrecision] / N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $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)\\
\mathbf{if}\;\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}} \leq 5 \cdot 10^{+307}:\\
\;\;\;\;\left(-2 \cdot J\right) \cdot \left(t_0 \cdot \mathsf{hypot}\left(1, 0.5 \cdot \frac{\frac{U}{J}}{\cos \left(K \cdot 0.5\right)}\right)\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)))) < 5e307

    1. Initial program 10.3

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

      \[\leadsto \color{blue}{\left(-2 \cdot J\right) \cdot \left(\cos \left(\frac{K}{2}\right) \cdot \mathsf{hypot}\left(1, \frac{U}{J \cdot \left(2 \cdot \cos \left(\frac{K}{2}\right)\right)}\right)\right)} \]
      Proof
      (*.f64 (*.f64 -2 J) (*.f64 (cos.f64 (/.f64 K 2)) (hypot.f64 1 (/.f64 U (*.f64 J (*.f64 2 (cos.f64 (/.f64 K 2)))))))): 0 points increase in error, 0 points decrease in error
      (*.f64 (*.f64 -2 J) (*.f64 (cos.f64 (/.f64 K 2)) (hypot.f64 1 (/.f64 U (Rewrite<= associate-*l*_binary64 (*.f64 (*.f64 J 2) (cos.f64 (/.f64 K 2)))))))): 0 points increase in error, 0 points decrease in error
      (*.f64 (*.f64 -2 J) (*.f64 (cos.f64 (/.f64 K 2)) (hypot.f64 1 (/.f64 U (*.f64 (Rewrite<= *-commutative_binary64 (*.f64 2 J)) (cos.f64 (/.f64 K 2))))))): 0 points increase in error, 0 points decrease in error
      (*.f64 (*.f64 -2 J) (*.f64 (cos.f64 (/.f64 K 2)) (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)))))))))): 35 points increase in error, 0 points decrease in error
      (*.f64 (*.f64 -2 J) (*.f64 (cos.f64 (/.f64 K 2)) (sqrt.f64 (+.f64 1 (Rewrite<= unpow2_binary64 (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))))): 0 points increase in error, 10 points decrease in error
    3. Taylor expanded in U around 0 4.6

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

      \[\leadsto \left(-2 \cdot J\right) \cdot \left(\cos \left(\frac{K}{2}\right) \cdot \mathsf{hypot}\left(1, \color{blue}{0.5 \cdot \frac{\frac{U}{J}}{\cos \left(0.5 \cdot K\right)}}\right)\right) \]
      Proof
      (*.f64 1/2 (/.f64 (/.f64 U J) (cos.f64 (*.f64 1/2 K)))): 0 points increase in error, 0 points decrease in error
      (*.f64 1/2 (Rewrite<= associate-/r*_binary64 (/.f64 U (*.f64 J (cos.f64 (*.f64 1/2 K)))))): 16 points increase in error, 24 points decrease in error
      (*.f64 1/2 (/.f64 U (Rewrite<= *-commutative_binary64 (*.f64 (cos.f64 (*.f64 1/2 K)) J)))): 0 points increase in error, 0 points decrease in error

    if 5e307 < (*.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.8

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

      \[\leadsto \color{blue}{\left(-2 \cdot J\right) \cdot \left(\cos \left(\frac{K}{2}\right) \cdot \mathsf{hypot}\left(1, \frac{U}{J \cdot \left(2 \cdot \cos \left(\frac{K}{2}\right)\right)}\right)\right)} \]
      Proof
      (*.f64 (*.f64 -2 J) (*.f64 (cos.f64 (/.f64 K 2)) (hypot.f64 1 (/.f64 U (*.f64 J (*.f64 2 (cos.f64 (/.f64 K 2)))))))): 0 points increase in error, 0 points decrease in error
      (*.f64 (*.f64 -2 J) (*.f64 (cos.f64 (/.f64 K 2)) (hypot.f64 1 (/.f64 U (Rewrite<= associate-*l*_binary64 (*.f64 (*.f64 J 2) (cos.f64 (/.f64 K 2)))))))): 0 points increase in error, 0 points decrease in error
      (*.f64 (*.f64 -2 J) (*.f64 (cos.f64 (/.f64 K 2)) (hypot.f64 1 (/.f64 U (*.f64 (Rewrite<= *-commutative_binary64 (*.f64 2 J)) (cos.f64 (/.f64 K 2))))))): 0 points increase in error, 0 points decrease in error
      (*.f64 (*.f64 -2 J) (*.f64 (cos.f64 (/.f64 K 2)) (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)))))))))): 35 points increase in error, 0 points decrease in error
      (*.f64 (*.f64 -2 J) (*.f64 (cos.f64 (/.f64 K 2)) (sqrt.f64 (+.f64 1 (Rewrite<= unpow2_binary64 (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))))): 0 points increase in error, 10 points decrease in error
    3. Taylor expanded in U around -inf 52.3

      \[\leadsto \color{blue}{2 \cdot \left(\sqrt{\frac{0.25}{{\cos \left(0.5 \cdot K\right)}^{2} \cdot {J}^{2}}} \cdot \left(\cos \left(0.5 \cdot K\right) \cdot \left(U \cdot J\right)\right)\right)} \]
    4. Simplified52.3

      \[\leadsto \color{blue}{\left(2 \cdot \sqrt{\frac{0.25}{{\cos \left(0.5 \cdot K\right)}^{2} \cdot \left(J \cdot J\right)}}\right) \cdot \left(\cos \left(0.5 \cdot K\right) \cdot \left(U \cdot J\right)\right)} \]
      Proof
      (*.f64 (*.f64 2 (sqrt.f64 (/.f64 1/4 (*.f64 (pow.f64 (cos.f64 (*.f64 1/2 K)) 2) (*.f64 J J))))) (*.f64 (cos.f64 (*.f64 1/2 K)) (*.f64 U J))): 0 points increase in error, 0 points decrease in error
      (*.f64 (*.f64 2 (sqrt.f64 (/.f64 1/4 (*.f64 (pow.f64 (cos.f64 (*.f64 1/2 K)) 2) (Rewrite<= unpow2_binary64 (pow.f64 J 2)))))) (*.f64 (cos.f64 (*.f64 1/2 K)) (*.f64 U J))): 0 points increase in error, 0 points decrease in error
      (Rewrite<= associate-*r*_binary64 (*.f64 2 (*.f64 (sqrt.f64 (/.f64 1/4 (*.f64 (pow.f64 (cos.f64 (*.f64 1/2 K)) 2) (pow.f64 J 2)))) (*.f64 (cos.f64 (*.f64 1/2 K)) (*.f64 U J))))): 0 points increase in error, 0 points decrease in error
    5. Taylor expanded in K around inf 52.3

      \[\leadsto \color{blue}{2 \cdot \left(\sqrt{\frac{0.25}{{\cos \left(0.5 \cdot K\right)}^{2} \cdot {J}^{2}}} \cdot \left(\cos \left(0.5 \cdot K\right) \cdot \left(U \cdot J\right)\right)\right)} \]
    6. Simplified33.5

      \[\leadsto \color{blue}{\frac{0.5}{J \cdot \cos \left(K \cdot 0.5\right)} \cdot \left(\left(\cos \left(K \cdot 0.5\right) \cdot \left(J \cdot U\right)\right) \cdot 2\right)} \]
      Proof
      (*.f64 (/.f64 1/2 (*.f64 J (cos.f64 (*.f64 K 1/2)))) (*.f64 (*.f64 (cos.f64 (*.f64 K 1/2)) (*.f64 J U)) 2)): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (Rewrite<= metadata-eval (fabs.f64 1/2)) (*.f64 J (cos.f64 (*.f64 K 1/2)))) (*.f64 (*.f64 (cos.f64 (*.f64 K 1/2)) (*.f64 J U)) 2)): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (fabs.f64 1/2) (*.f64 J (cos.f64 (Rewrite<= *-commutative_binary64 (*.f64 1/2 K))))) (*.f64 (*.f64 (cos.f64 (*.f64 K 1/2)) (*.f64 J U)) 2)): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (fabs.f64 1/2) (Rewrite<= *-commutative_binary64 (*.f64 (cos.f64 (*.f64 1/2 K)) J))) (*.f64 (*.f64 (cos.f64 (*.f64 K 1/2)) (*.f64 J U)) 2)): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (fabs.f64 1/2) (Rewrite<= unpow1_binary64 (pow.f64 (*.f64 (cos.f64 (*.f64 1/2 K)) J) 1))) (*.f64 (*.f64 (cos.f64 (*.f64 K 1/2)) (*.f64 J U)) 2)): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (fabs.f64 1/2) (Rewrite=> sqr-pow_binary64 (*.f64 (pow.f64 (*.f64 (cos.f64 (*.f64 1/2 K)) J) (/.f64 1 2)) (pow.f64 (*.f64 (cos.f64 (*.f64 1/2 K)) J) (/.f64 1 2))))) (*.f64 (*.f64 (cos.f64 (*.f64 K 1/2)) (*.f64 J U)) 2)): 130 points increase in error, 18 points decrease in error
      (*.f64 (/.f64 (fabs.f64 1/2) (Rewrite<= fabs-sqr_binary64 (fabs.f64 (*.f64 (pow.f64 (*.f64 (cos.f64 (*.f64 1/2 K)) J) (/.f64 1 2)) (pow.f64 (*.f64 (cos.f64 (*.f64 1/2 K)) J) (/.f64 1 2)))))) (*.f64 (*.f64 (cos.f64 (*.f64 K 1/2)) (*.f64 J U)) 2)): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (fabs.f64 1/2) (fabs.f64 (Rewrite<= sqr-pow_binary64 (pow.f64 (*.f64 (cos.f64 (*.f64 1/2 K)) J) 1)))) (*.f64 (*.f64 (cos.f64 (*.f64 K 1/2)) (*.f64 J U)) 2)): 18 points increase in error, 130 points decrease in error
      (*.f64 (/.f64 (fabs.f64 1/2) (fabs.f64 (Rewrite=> unpow1_binary64 (*.f64 (cos.f64 (*.f64 1/2 K)) J)))) (*.f64 (*.f64 (cos.f64 (*.f64 K 1/2)) (*.f64 J U)) 2)): 0 points increase in error, 0 points decrease in error
      (*.f64 (Rewrite<= fabs-div_binary64 (fabs.f64 (/.f64 1/2 (*.f64 (cos.f64 (*.f64 1/2 K)) J)))) (*.f64 (*.f64 (cos.f64 (*.f64 K 1/2)) (*.f64 J U)) 2)): 0 points increase in error, 0 points decrease in error
      (*.f64 (Rewrite<= rem-sqrt-square_binary64 (sqrt.f64 (*.f64 (/.f64 1/2 (*.f64 (cos.f64 (*.f64 1/2 K)) J)) (/.f64 1/2 (*.f64 (cos.f64 (*.f64 1/2 K)) J))))) (*.f64 (*.f64 (cos.f64 (*.f64 K 1/2)) (*.f64 J U)) 2)): 79 points increase in error, 25 points decrease in error
      (*.f64 (sqrt.f64 (Rewrite=> associate-*r/_binary64 (/.f64 (*.f64 (/.f64 1/2 (*.f64 (cos.f64 (*.f64 1/2 K)) J)) 1/2) (*.f64 (cos.f64 (*.f64 1/2 K)) J)))) (*.f64 (*.f64 (cos.f64 (*.f64 K 1/2)) (*.f64 J U)) 2)): 1 points increase in error, 0 points decrease in error
      (*.f64 (sqrt.f64 (/.f64 (Rewrite=> associate-*l/_binary64 (/.f64 (*.f64 1/2 1/2) (*.f64 (cos.f64 (*.f64 1/2 K)) J))) (*.f64 (cos.f64 (*.f64 1/2 K)) J))) (*.f64 (*.f64 (cos.f64 (*.f64 K 1/2)) (*.f64 J U)) 2)): 0 points increase in error, 0 points decrease in error
      (*.f64 (sqrt.f64 (/.f64 (/.f64 (Rewrite=> metadata-eval 1/4) (*.f64 (cos.f64 (*.f64 1/2 K)) J)) (*.f64 (cos.f64 (*.f64 1/2 K)) J))) (*.f64 (*.f64 (cos.f64 (*.f64 K 1/2)) (*.f64 J U)) 2)): 0 points increase in error, 0 points decrease in error
      (*.f64 (sqrt.f64 (Rewrite<= associate-/r*_binary64 (/.f64 1/4 (*.f64 (*.f64 (cos.f64 (*.f64 1/2 K)) J) (*.f64 (cos.f64 (*.f64 1/2 K)) J))))) (*.f64 (*.f64 (cos.f64 (*.f64 K 1/2)) (*.f64 J U)) 2)): 10 points increase in error, 8 points decrease in error
      (*.f64 (sqrt.f64 (/.f64 1/4 (Rewrite<= unpow2_binary64 (pow.f64 (*.f64 (cos.f64 (*.f64 1/2 K)) J) 2)))) (*.f64 (*.f64 (cos.f64 (*.f64 K 1/2)) (*.f64 J U)) 2)): 0 points increase in error, 0 points decrease in error
      (*.f64 (sqrt.f64 (/.f64 1/4 (Rewrite=> unpow2_binary64 (*.f64 (*.f64 (cos.f64 (*.f64 1/2 K)) J) (*.f64 (cos.f64 (*.f64 1/2 K)) J))))) (*.f64 (*.f64 (cos.f64 (*.f64 K 1/2)) (*.f64 J U)) 2)): 0 points increase in error, 0 points decrease in error
      (*.f64 (sqrt.f64 (/.f64 1/4 (Rewrite<= unswap-sqr_binary64 (*.f64 (*.f64 (cos.f64 (*.f64 1/2 K)) (cos.f64 (*.f64 1/2 K))) (*.f64 J J))))) (*.f64 (*.f64 (cos.f64 (*.f64 K 1/2)) (*.f64 J U)) 2)): 14 points increase in error, 6 points decrease in error
      (*.f64 (sqrt.f64 (/.f64 1/4 (*.f64 (Rewrite<= unpow2_binary64 (pow.f64 (cos.f64 (*.f64 1/2 K)) 2)) (*.f64 J J)))) (*.f64 (*.f64 (cos.f64 (*.f64 K 1/2)) (*.f64 J U)) 2)): 0 points increase in error, 0 points decrease in error
      (*.f64 (sqrt.f64 (/.f64 1/4 (*.f64 (pow.f64 (cos.f64 (*.f64 1/2 K)) 2) (Rewrite<= unpow2_binary64 (pow.f64 J 2))))) (*.f64 (*.f64 (cos.f64 (*.f64 K 1/2)) (*.f64 J U)) 2)): 0 points increase in error, 0 points decrease in error
      (*.f64 (sqrt.f64 (/.f64 1/4 (Rewrite<= *-commutative_binary64 (*.f64 (pow.f64 J 2) (pow.f64 (cos.f64 (*.f64 1/2 K)) 2))))) (*.f64 (*.f64 (cos.f64 (*.f64 K 1/2)) (*.f64 J U)) 2)): 0 points increase in error, 0 points decrease in error
      (*.f64 (sqrt.f64 (/.f64 1/4 (*.f64 (pow.f64 J 2) (pow.f64 (cos.f64 (*.f64 1/2 K)) 2)))) (*.f64 (*.f64 (cos.f64 (Rewrite<= *-commutative_binary64 (*.f64 1/2 K))) (*.f64 J U)) 2)): 0 points increase in error, 0 points decrease in error
      (Rewrite<= associate-*l*_binary64 (*.f64 (*.f64 (sqrt.f64 (/.f64 1/4 (*.f64 (pow.f64 J 2) (pow.f64 (cos.f64 (*.f64 1/2 K)) 2)))) (*.f64 (cos.f64 (*.f64 1/2 K)) (*.f64 J U))) 2)): 0 points increase in error, 0 points decrease in error
      (*.f64 (*.f64 (sqrt.f64 (/.f64 1/4 (Rewrite=> *-commutative_binary64 (*.f64 (pow.f64 (cos.f64 (*.f64 1/2 K)) 2) (pow.f64 J 2))))) (*.f64 (cos.f64 (*.f64 1/2 K)) (*.f64 J U))) 2): 0 points increase in error, 0 points decrease in error
      (*.f64 (*.f64 (sqrt.f64 (/.f64 1/4 (*.f64 (pow.f64 (cos.f64 (*.f64 1/2 K)) 2) (pow.f64 J 2)))) (*.f64 (cos.f64 (*.f64 1/2 K)) (Rewrite<= *-commutative_binary64 (*.f64 U J)))) 2): 0 points increase in error, 0 points decrease in error
      (Rewrite<= *-commutative_binary64 (*.f64 2 (*.f64 (sqrt.f64 (/.f64 1/4 (*.f64 (pow.f64 (cos.f64 (*.f64 1/2 K)) 2) (pow.f64 J 2)))) (*.f64 (cos.f64 (*.f64 1/2 K)) (*.f64 U J))))): 0 points increase in error, 0 points decrease in error
    7. Taylor expanded in J around 0 30.0

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

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

Alternatives

Alternative 1
Error19.8
Cost27020
\[\begin{array}{l} t_0 := \left(-2 \cdot J\right) \cdot \mathsf{hypot}\left(1, 0.5 \cdot \frac{U}{J}\right)\\ t_1 := \cos \left(\frac{K}{2}\right)\\ t_2 := \left(-2 \cdot J\right) \cdot \cos \left(K \cdot 0.5\right)\\ \mathbf{if}\;t_1 \leq -0.02:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t_1 \leq 0.26:\\ \;\;\;\;t_0\\ \mathbf{elif}\;t_1 \leq 0.9995:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 2
Error17.3
Cost14356
\[\begin{array}{l} t_0 := \left(-2 \cdot J\right) \cdot \left(\cos \left(\frac{K}{2}\right) \cdot \mathsf{hypot}\left(1, \frac{U}{J \cdot 2}\right)\right)\\ t_1 := \left(-2 \cdot J\right) \cdot \mathsf{hypot}\left(1, 0.5 \cdot \frac{U}{J}\right)\\ \mathbf{if}\;J \leq -1.9 \cdot 10^{-216}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;J \leq -2.25 \cdot 10^{-246}:\\ \;\;\;\;U\\ \mathbf{elif}\;J \leq -2 \cdot 10^{-290}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;J \leq 1.52 \cdot 10^{-263}:\\ \;\;\;\;-2 \cdot \left(U \cdot 0.5\right)\\ \mathbf{elif}\;J \leq 4.5 \cdot 10^{-46}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 3
Error25.6
Cost7376
\[\begin{array}{l} t_0 := \left(-2 \cdot J\right) \cdot \cos \left(K \cdot 0.5\right)\\ \mathbf{if}\;J \leq -1.8 \cdot 10^{-84}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;J \leq -2.5 \cdot 10^{-275}:\\ \;\;\;\;U\\ \mathbf{elif}\;J \leq 7.2 \cdot 10^{-269}:\\ \;\;\;\;-2 \cdot \left(U \cdot 0.5\right)\\ \mathbf{elif}\;J \leq 1.95 \cdot 10^{-125}:\\ \;\;\;\;U\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 4
Error38.1
Cost716
\[\begin{array}{l} \mathbf{if}\;U \leq -5.8 \cdot 10^{-26}:\\ \;\;\;\;U\\ \mathbf{elif}\;U \leq 8 \cdot 10^{+29}:\\ \;\;\;\;-2 \cdot J\\ \mathbf{elif}\;U \leq 10^{+204}:\\ \;\;\;\;-2 \cdot \left(U \cdot 0.5\right)\\ \mathbf{else}:\\ \;\;\;\;U\\ \end{array} \]
Alternative 5
Error37.6
Cost456
\[\begin{array}{l} \mathbf{if}\;U \leq -4.2 \cdot 10^{-24}:\\ \;\;\;\;U\\ \mathbf{elif}\;U \leq 1.15 \cdot 10^{+20}:\\ \;\;\;\;-2 \cdot J\\ \mathbf{else}:\\ \;\;\;\;U\\ \end{array} \]
Alternative 6
Error46.6
Cost64
\[U \]

Error

Reproduce

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