?

Average Error: 18.5 → 10.3
Time: 19.5s
Precision: binary64
Cost: 20880

?

\[\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 := \left(\left(J \cdot -2\right) \cdot t_0\right) \cdot \mathsf{hypot}\left(1, \frac{U}{2 \cdot \left(J \cdot t_0\right)}\right)\\ t_2 := \cos \left(K \cdot 0.5\right)\\ t_3 := \frac{-2}{\frac{\frac{U}{J}}{J \cdot {t_2}^{2}}} - U\\ \mathbf{if}\;J \leq -5 \cdot 10^{-134}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;J \leq -7 \cdot 10^{-245}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;J \leq -6 \cdot 10^{-275}:\\ \;\;\;\;-2 \cdot \left(t_0 \cdot \left(J \cdot \mathsf{hypot}\left(1, U \cdot \frac{\frac{0.5}{J}}{t_2}\right)\right)\right)\\ \mathbf{elif}\;J \leq 1.1 \cdot 10^{-237}:\\ \;\;\;\;t_3\\ \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 (cos (/ K 2.0)))
        (t_1 (* (* (* J -2.0) t_0) (hypot 1.0 (/ U (* 2.0 (* J t_0))))))
        (t_2 (cos (* K 0.5)))
        (t_3 (- (/ -2.0 (/ (/ U J) (* J (pow t_2 2.0)))) U)))
   (if (<= J -5e-134)
     t_1
     (if (<= J -7e-245)
       t_3
       (if (<= J -6e-275)
         (* -2.0 (* t_0 (* J (hypot 1.0 (* U (/ (/ 0.5 J) t_2))))))
         (if (<= J 1.1e-237) t_3 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 = cos((K / 2.0));
	double t_1 = ((J * -2.0) * t_0) * hypot(1.0, (U / (2.0 * (J * t_0))));
	double t_2 = cos((K * 0.5));
	double t_3 = (-2.0 / ((U / J) / (J * pow(t_2, 2.0)))) - U;
	double tmp;
	if (J <= -5e-134) {
		tmp = t_1;
	} else if (J <= -7e-245) {
		tmp = t_3;
	} else if (J <= -6e-275) {
		tmp = -2.0 * (t_0 * (J * hypot(1.0, (U * ((0.5 / J) / t_2)))));
	} else if (J <= 1.1e-237) {
		tmp = t_3;
	} 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 = Math.cos((K / 2.0));
	double t_1 = ((J * -2.0) * t_0) * Math.hypot(1.0, (U / (2.0 * (J * t_0))));
	double t_2 = Math.cos((K * 0.5));
	double t_3 = (-2.0 / ((U / J) / (J * Math.pow(t_2, 2.0)))) - U;
	double tmp;
	if (J <= -5e-134) {
		tmp = t_1;
	} else if (J <= -7e-245) {
		tmp = t_3;
	} else if (J <= -6e-275) {
		tmp = -2.0 * (t_0 * (J * Math.hypot(1.0, (U * ((0.5 / J) / t_2)))));
	} else if (J <= 1.1e-237) {
		tmp = t_3;
	} 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 = math.cos((K / 2.0))
	t_1 = ((J * -2.0) * t_0) * math.hypot(1.0, (U / (2.0 * (J * t_0))))
	t_2 = math.cos((K * 0.5))
	t_3 = (-2.0 / ((U / J) / (J * math.pow(t_2, 2.0)))) - U
	tmp = 0
	if J <= -5e-134:
		tmp = t_1
	elif J <= -7e-245:
		tmp = t_3
	elif J <= -6e-275:
		tmp = -2.0 * (t_0 * (J * math.hypot(1.0, (U * ((0.5 / J) / t_2)))))
	elif J <= 1.1e-237:
		tmp = t_3
	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 = cos(Float64(K / 2.0))
	t_1 = Float64(Float64(Float64(J * -2.0) * t_0) * hypot(1.0, Float64(U / Float64(2.0 * Float64(J * t_0)))))
	t_2 = cos(Float64(K * 0.5))
	t_3 = Float64(Float64(-2.0 / Float64(Float64(U / J) / Float64(J * (t_2 ^ 2.0)))) - U)
	tmp = 0.0
	if (J <= -5e-134)
		tmp = t_1;
	elseif (J <= -7e-245)
		tmp = t_3;
	elseif (J <= -6e-275)
		tmp = Float64(-2.0 * Float64(t_0 * Float64(J * hypot(1.0, Float64(U * Float64(Float64(0.5 / J) / t_2))))));
	elseif (J <= 1.1e-237)
		tmp = t_3;
	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 = cos((K / 2.0));
	t_1 = ((J * -2.0) * t_0) * hypot(1.0, (U / (2.0 * (J * t_0))));
	t_2 = cos((K * 0.5));
	t_3 = (-2.0 / ((U / J) / (J * (t_2 ^ 2.0)))) - U;
	tmp = 0.0;
	if (J <= -5e-134)
		tmp = t_1;
	elseif (J <= -7e-245)
		tmp = t_3;
	elseif (J <= -6e-275)
		tmp = -2.0 * (t_0 * (J * hypot(1.0, (U * ((0.5 / J) / t_2)))));
	elseif (J <= 1.1e-237)
		tmp = t_3;
	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[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(J * -2.0), $MachinePrecision] * t$95$0), $MachinePrecision] * N[Sqrt[1.0 ^ 2 + N[(U / N[(2.0 * N[(J * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(N[(-2.0 / N[(N[(U / J), $MachinePrecision] / N[(J * N[Power[t$95$2, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - U), $MachinePrecision]}, If[LessEqual[J, -5e-134], t$95$1, If[LessEqual[J, -7e-245], t$95$3, If[LessEqual[J, -6e-275], N[(-2.0 * N[(t$95$0 * N[(J * N[Sqrt[1.0 ^ 2 + N[(U * N[(N[(0.5 / J), $MachinePrecision] / t$95$2), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[J, 1.1e-237], t$95$3, 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 := \cos \left(\frac{K}{2}\right)\\
t_1 := \left(\left(J \cdot -2\right) \cdot t_0\right) \cdot \mathsf{hypot}\left(1, \frac{U}{2 \cdot \left(J \cdot t_0\right)}\right)\\
t_2 := \cos \left(K \cdot 0.5\right)\\
t_3 := \frac{-2}{\frac{\frac{U}{J}}{J \cdot {t_2}^{2}}} - U\\
\mathbf{if}\;J \leq -5 \cdot 10^{-134}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;J \leq -7 \cdot 10^{-245}:\\
\;\;\;\;t_3\\

\mathbf{elif}\;J \leq -6 \cdot 10^{-275}:\\
\;\;\;\;-2 \cdot \left(t_0 \cdot \left(J \cdot \mathsf{hypot}\left(1, U \cdot \frac{\frac{0.5}{J}}{t_2}\right)\right)\right)\\

\mathbf{elif}\;J \leq 1.1 \cdot 10^{-237}:\\
\;\;\;\;t_3\\

\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.0000000000000003e-134 or 1.09999999999999999e-237 < J

    1. Initial program 12.9

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

      \[\leadsto \color{blue}{\left(\left(-2 \cdot J\right) \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)} \]
      Proof

      [Start]12.9

      \[ \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}} \]

      unpow2 [=>]12.9

      \[ \left(\left(-2 \cdot J\right) \cdot \cos \left(\frac{K}{2}\right)\right) \cdot \sqrt{1 + \color{blue}{\frac{U}{\left(2 \cdot J\right) \cdot \cos \left(\frac{K}{2}\right)} \cdot \frac{U}{\left(2 \cdot J\right) \cdot \cos \left(\frac{K}{2}\right)}}} \]

      hypot-1-def [=>]4.3

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

      associate-*l* [=>]4.3

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

    if -5.0000000000000003e-134 < J < -7.00000000000000033e-245 or -6.000000000000001e-275 < J < 1.09999999999999999e-237

    1. Initial program 41.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}} \]
    2. Simplified23.8

      \[\leadsto \color{blue}{\left(\left(-2 \cdot J\right) \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)} \]
      Proof

      [Start]41.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}} \]

      unpow2 [=>]41.1

      \[ \left(\left(-2 \cdot J\right) \cdot \cos \left(\frac{K}{2}\right)\right) \cdot \sqrt{1 + \color{blue}{\frac{U}{\left(2 \cdot J\right) \cdot \cos \left(\frac{K}{2}\right)} \cdot \frac{U}{\left(2 \cdot J\right) \cdot \cos \left(\frac{K}{2}\right)}}} \]

      hypot-1-def [=>]23.8

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

      associate-*l* [=>]23.8

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

      \[\leadsto \color{blue}{-2 \cdot \frac{{\cos \left(0.5 \cdot K\right)}^{2} \cdot {J}^{2}}{U} + -1 \cdot U} \]
    4. Simplified35.2

      \[\leadsto \color{blue}{\frac{-2}{\frac{\frac{U}{J}}{J \cdot {\cos \left(0.5 \cdot K\right)}^{2}}} - U} \]
      Proof

      [Start]35.2

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

      mul-1-neg [=>]35.2

      \[ -2 \cdot \frac{{\cos \left(0.5 \cdot K\right)}^{2} \cdot {J}^{2}}{U} + \color{blue}{\left(-U\right)} \]

      unsub-neg [=>]35.2

      \[ \color{blue}{-2 \cdot \frac{{\cos \left(0.5 \cdot K\right)}^{2} \cdot {J}^{2}}{U} - U} \]

      associate-*r/ [=>]35.2

      \[ \color{blue}{\frac{-2 \cdot \left({\cos \left(0.5 \cdot K\right)}^{2} \cdot {J}^{2}\right)}{U}} - U \]

      associate-/l* [=>]35.2

      \[ \color{blue}{\frac{-2}{\frac{U}{{\cos \left(0.5 \cdot K\right)}^{2} \cdot {J}^{2}}}} - U \]

      *-commutative [=>]35.2

      \[ \frac{-2}{\frac{U}{\color{blue}{{J}^{2} \cdot {\cos \left(0.5 \cdot K\right)}^{2}}}} - U \]

      unpow2 [=>]35.2

      \[ \frac{-2}{\frac{U}{\color{blue}{\left(J \cdot J\right)} \cdot {\cos \left(0.5 \cdot K\right)}^{2}}} - U \]

      associate-*l* [=>]35.2

      \[ \frac{-2}{\frac{U}{\color{blue}{J \cdot \left(J \cdot {\cos \left(0.5 \cdot K\right)}^{2}\right)}}} - U \]

      associate-/r* [=>]35.2

      \[ \frac{-2}{\color{blue}{\frac{\frac{U}{J}}{J \cdot {\cos \left(0.5 \cdot K\right)}^{2}}}} - U \]

    if -7.00000000000000033e-245 < J < -6.000000000000001e-275

    1. Initial program 38.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. Simplified25.5

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

      [Start]38.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}} \]

      associate-*l* [=>]38.7

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

      associate-*l* [=>]38.7

      \[ \color{blue}{-2 \cdot \left(\left(J \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}}\right)} \]

      *-commutative [=>]38.7

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

      associate-*l* [=>]38.7

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

      unpow2 [=>]38.7

      \[ -2 \cdot \left(\cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \sqrt{1 + \color{blue}{\frac{U}{\left(2 \cdot J\right) \cdot \cos \left(\frac{K}{2}\right)} \cdot \frac{U}{\left(2 \cdot J\right) \cdot \cos \left(\frac{K}{2}\right)}}}\right)\right) \]

      hypot-1-def [=>]25.5

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

      associate-*l* [=>]25.5

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

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

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

      [Start]25.5

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

      associate-*r/ [=>]25.5

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

      *-commutative [=>]25.5

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

      *-commutative [<=]25.5

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

      associate-*l/ [<=]25.6

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

      *-commutative [=>]25.6

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

      associate-/r* [=>]25.5

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

      *-commutative [=>]25.5

      \[ -2 \cdot \left(\cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \mathsf{hypot}\left(1, U \cdot \frac{\frac{0.5}{J}}{\cos \color{blue}{\left(0.5 \cdot K\right)}}\right)\right)\right) \]
  3. Recombined 3 regimes into one program.
  4. Final simplification10.3

    \[\leadsto \begin{array}{l} \mathbf{if}\;J \leq -5 \cdot 10^{-134}:\\ \;\;\;\;\left(\left(J \cdot -2\right) \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)\\ \mathbf{elif}\;J \leq -7 \cdot 10^{-245}:\\ \;\;\;\;\frac{-2}{\frac{\frac{U}{J}}{J \cdot {\cos \left(K \cdot 0.5\right)}^{2}}} - U\\ \mathbf{elif}\;J \leq -6 \cdot 10^{-275}:\\ \;\;\;\;-2 \cdot \left(\cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \mathsf{hypot}\left(1, U \cdot \frac{\frac{0.5}{J}}{\cos \left(K \cdot 0.5\right)}\right)\right)\right)\\ \mathbf{elif}\;J \leq 1.1 \cdot 10^{-237}:\\ \;\;\;\;\frac{-2}{\frac{\frac{U}{J}}{J \cdot {\cos \left(K \cdot 0.5\right)}^{2}}} - U\\ \mathbf{else}:\\ \;\;\;\;\left(\left(J \cdot -2\right) \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)\\ \end{array} \]

Alternatives

Alternative 1
Error10.4
Cost20882
\[\begin{array}{l} t_0 := \cos \left(K \cdot 0.5\right)\\ \mathbf{if}\;J \leq -5 \cdot 10^{-134} \lor \neg \left(J \leq -8.6 \cdot 10^{-245}\right) \land \left(J \leq -2.8 \cdot 10^{-274} \lor \neg \left(J \leq 2.9 \cdot 10^{-237}\right)\right):\\ \;\;\;\;-2 \cdot \left(\cos \left(\frac{K}{2}\right) \cdot \left(J \cdot \mathsf{hypot}\left(1, U \cdot \frac{\frac{0.5}{J}}{t_0}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{-2}{\frac{\frac{U}{J}}{J \cdot {t_0}^{2}}} - U\\ \end{array} \]
Alternative 2
Error10.4
Cost20880
\[\begin{array}{l} t_0 := \cos \left(\frac{K}{2}\right)\\ t_1 := -2 \cdot \left(t_0 \cdot \left(J \cdot \mathsf{hypot}\left(1, \frac{U}{2 \cdot \left(J \cdot t_0\right)}\right)\right)\right)\\ t_2 := \cos \left(K \cdot 0.5\right)\\ t_3 := \frac{-2}{\frac{\frac{U}{J}}{J \cdot {t_2}^{2}}} - U\\ \mathbf{if}\;J \leq -5 \cdot 10^{-134}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;J \leq -9.6 \cdot 10^{-245}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;J \leq -3.2 \cdot 10^{-275}:\\ \;\;\;\;-2 \cdot \left(t_0 \cdot \left(J \cdot \mathsf{hypot}\left(1, U \cdot \frac{\frac{0.5}{J}}{t_2}\right)\right)\right)\\ \mathbf{elif}\;J \leq 1.2 \cdot 10^{-237}:\\ \;\;\;\;t_3\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 3
Error17.2
Cost13960
\[\begin{array}{l} \mathbf{if}\;U \leq -4.4 \cdot 10^{+207}:\\ \;\;\;\;-U\\ \mathbf{elif}\;U \leq 3.8 \cdot 10^{+123}:\\ \;\;\;\;\left(\left(J \cdot -2\right) \cdot \cos \left(\frac{K}{2}\right)\right) \cdot \mathsf{hypot}\left(1, \frac{U}{J \cdot 2}\right)\\ \mathbf{elif}\;U \leq 6.9 \cdot 10^{+143}:\\ \;\;\;\;-U\\ \mathbf{elif}\;U \leq 3.85 \cdot 10^{+230}:\\ \;\;\;\;\left(J \cdot -2\right) \cdot \mathsf{hypot}\left(1, \frac{U \cdot 0.5}{J}\right)\\ \mathbf{else}:\\ \;\;\;\;-U\\ \end{array} \]
Alternative 4
Error17.2
Cost13960
\[\begin{array}{l} \mathbf{if}\;U \leq -5.5 \cdot 10^{+207}:\\ \;\;\;\;-U\\ \mathbf{elif}\;U \leq 2.4 \cdot 10^{+123}:\\ \;\;\;\;\left(\left(J \cdot -2\right) \cdot \cos \left(\frac{K}{2}\right)\right) \cdot \mathsf{hypot}\left(1, \frac{U}{J \cdot 2}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{-2}{\frac{\frac{U}{J}}{J \cdot {\cos \left(K \cdot 0.5\right)}^{2}}} - U\\ \end{array} \]
Alternative 5
Error26.3
Cost7376
\[\begin{array}{l} \mathbf{if}\;U \leq -4 \cdot 10^{+207}:\\ \;\;\;\;-U\\ \mathbf{elif}\;U \leq -2.8 \cdot 10^{+113}:\\ \;\;\;\;U\\ \mathbf{elif}\;U \leq -9.5 \cdot 10^{+15}:\\ \;\;\;\;-U\\ \mathbf{elif}\;U \leq 2.1 \cdot 10^{+106}:\\ \;\;\;\;\left(J \cdot -2\right) \cdot \cos \left(K \cdot 0.5\right)\\ \mathbf{else}:\\ \;\;\;\;-U\\ \end{array} \]
Alternative 6
Error24.0
Cost7304
\[\begin{array}{l} \mathbf{if}\;U \leq -4.8 \cdot 10^{+210}:\\ \;\;\;\;-U\\ \mathbf{elif}\;U \leq -1.25 \cdot 10^{-134}:\\ \;\;\;\;\left(J \cdot -2\right) \cdot \mathsf{hypot}\left(1, \frac{U \cdot 0.5}{J}\right)\\ \mathbf{elif}\;U \leq 3.2 \cdot 10^{+106}:\\ \;\;\;\;\left(J \cdot -2\right) \cdot \cos \left(K \cdot 0.5\right)\\ \mathbf{else}:\\ \;\;\;\;-U\\ \end{array} \]
Alternative 7
Error37.9
Cost720
\[\begin{array}{l} \mathbf{if}\;U \leq -5.2 \cdot 10^{+207}:\\ \;\;\;\;-U\\ \mathbf{elif}\;U \leq -1.7 \cdot 10^{+109}:\\ \;\;\;\;U\\ \mathbf{elif}\;U \leq -6000000000:\\ \;\;\;\;-U\\ \mathbf{elif}\;U \leq 6 \cdot 10^{+71}:\\ \;\;\;\;J \cdot -2\\ \mathbf{else}:\\ \;\;\;\;-U\\ \end{array} \]
Alternative 8
Error46.4
Cost656
\[\begin{array}{l} \mathbf{if}\;K \leq -3.1 \cdot 10^{-43}:\\ \;\;\;\;-U\\ \mathbf{elif}\;K \leq -1.45 \cdot 10^{-135}:\\ \;\;\;\;U\\ \mathbf{elif}\;K \leq 2.7 \cdot 10^{-76}:\\ \;\;\;\;-U\\ \mathbf{elif}\;K \leq 1.25 \cdot 10^{+86}:\\ \;\;\;\;U\\ \mathbf{else}:\\ \;\;\;\;-U\\ \end{array} \]
Alternative 9
Error46.9
Cost64
\[U \]

Error

Reproduce?

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