?

Average Error: 18.2 → 9.6
Time: 33.4s
Precision: binary64
Cost: 80776

?

\[\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(-2 \cdot J\right) \cdot t_0\right) \cdot \sqrt{1 + {\left(\frac{U}{\left(2 \cdot J\right) \cdot t_0}\right)}^{2}}\\ \mathbf{if}\;t_1 \leq -\infty:\\ \;\;\;\;-U\\ \mathbf{elif}\;t_1 \leq 10^{+303}:\\ \;\;\;\;t_1\\ \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
         (*
          (* (* -2.0 J) t_0)
          (sqrt (+ 1.0 (pow (/ U (* (* 2.0 J) t_0)) 2.0))))))
   (if (<= t_1 (- INFINITY)) (- U) (if (<= t_1 1e+303) 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 = ((-2.0 * J) * t_0) * sqrt((1.0 + pow((U / ((2.0 * J) * t_0)), 2.0)));
	double tmp;
	if (t_1 <= -((double) INFINITY)) {
		tmp = -U;
	} else if (t_1 <= 1e+303) {
		tmp = 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 = ((-2.0 * J) * t_0) * Math.sqrt((1.0 + Math.pow((U / ((2.0 * J) * t_0)), 2.0)));
	double tmp;
	if (t_1 <= -Double.POSITIVE_INFINITY) {
		tmp = -U;
	} else if (t_1 <= 1e+303) {
		tmp = 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 = ((-2.0 * J) * t_0) * math.sqrt((1.0 + math.pow((U / ((2.0 * J) * t_0)), 2.0)))
	tmp = 0
	if t_1 <= -math.inf:
		tmp = -U
	elif t_1 <= 1e+303:
		tmp = 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 = Float64(Float64(Float64(-2.0 * J) * t_0) * sqrt(Float64(1.0 + (Float64(U / Float64(Float64(2.0 * J) * t_0)) ^ 2.0))))
	tmp = 0.0
	if (t_1 <= Float64(-Inf))
		tmp = Float64(-U);
	elseif (t_1 <= 1e+303)
		tmp = 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 = ((-2.0 * J) * t_0) * sqrt((1.0 + ((U / ((2.0 * J) * t_0)) ^ 2.0)));
	tmp = 0.0;
	if (t_1 <= -Inf)
		tmp = -U;
	elseif (t_1 <= 1e+303)
		tmp = 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[(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]}, If[LessEqual[t$95$1, (-Infinity)], (-U), If[LessEqual[t$95$1, 1e+303], t$95$1, 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 := \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}}\\
\mathbf{if}\;t_1 \leq -\infty:\\
\;\;\;\;-U\\

\mathbf{elif}\;t_1 \leq 10^{+303}:\\
\;\;\;\;t_1\\

\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 3 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)))) < -inf.0

    1. Initial program 64.0

      \[\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. Simplified64.0

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

      [Start]64.0

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

      rational.json-simplify-2 [=>]64.0

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

      rational.json-simplify-43 [=>]64.0

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

      trig.json-simplify-24 [=>]64.0

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

      trig.json-simplify-24 [=>]64.0

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

      rational.json-simplify-8 [=>]64.0

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

      rational.json-simplify-2 [=>]64.0

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

      rational.json-simplify-10 [=>]64.0

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

      rational.json-simplify-47 [=>]64.0

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

      metadata-eval [=>]64.0

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

      rational.json-simplify-49 [<=]64.0

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

      rational.json-simplify-2 [=>]64.0

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

      rational.json-simplify-49 [=>]64.0

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

      metadata-eval [=>]64.0

      \[ \left(-2 \cdot J\right) \cdot \left(\cos \left(K \cdot \color{blue}{0.5}\right) \cdot \sqrt{1 + {\left(\frac{U}{\left(2 \cdot J\right) \cdot \cos \left(\frac{K}{2}\right)}\right)}^{2}}\right) \]
    3. Taylor expanded in J around 0 33.2

      \[\leadsto \color{blue}{-1 \cdot U} \]
    4. Simplified33.2

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

      [Start]33.2

      \[ -1 \cdot U \]

      rational.json-simplify-2 [=>]33.2

      \[ \color{blue}{U \cdot -1} \]

      rational.json-simplify-8 [<=]33.2

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

    if -inf.0 < (*.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)))) < 1e303

    1. Initial program 0.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}} \]

    if 1e303 < (*.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 61.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. Simplified61.2

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

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

      rational.json-simplify-2 [=>]61.2

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

      rational.json-simplify-43 [=>]61.2

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

      trig.json-simplify-24 [=>]61.2

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

      trig.json-simplify-24 [=>]61.2

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

      rational.json-simplify-8 [=>]61.2

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

      rational.json-simplify-2 [=>]61.2

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

      rational.json-simplify-10 [=>]61.2

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

      rational.json-simplify-47 [=>]61.2

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

      metadata-eval [=>]61.2

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

      rational.json-simplify-49 [<=]61.2

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

      rational.json-simplify-2 [=>]61.2

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

      rational.json-simplify-49 [=>]61.2

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

      metadata-eval [=>]61.2

      \[ \left(-2 \cdot J\right) \cdot \left(\cos \left(K \cdot \color{blue}{0.5}\right) \cdot \sqrt{1 + {\left(\frac{U}{\left(2 \cdot J\right) \cdot \cos \left(\frac{K}{2}\right)}\right)}^{2}}\right) \]
    3. Taylor expanded in U around -inf 32.7

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

    \[\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}{\left(2 \cdot J\right) \cdot \cos \left(\frac{K}{2}\right)}\right)}^{2}} \leq -\infty:\\ \;\;\;\;-U\\ \mathbf{elif}\;\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}} \leq 10^{+303}:\\ \;\;\;\;\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}}\\ \mathbf{else}:\\ \;\;\;\;U\\ \end{array} \]

Alternatives

Alternative 1
Error17.9
Cost27804
\[\begin{array}{l} t_0 := \cos \left(K \cdot 0.5\right)\\ t_1 := \left(-2 \cdot J\right) \cdot \left(t_0 \cdot \sqrt{1 + {\left(\frac{U}{J \cdot \left(2 \cdot t_0\right)}\right)}^{2}}\right)\\ \mathbf{if}\;J \leq -3300:\\ \;\;\;\;t_1\\ \mathbf{elif}\;J \leq -2.4 \cdot 10^{-10}:\\ \;\;\;\;-U\\ \mathbf{elif}\;J \leq -1.2 \cdot 10^{-95}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;J \leq -1.15 \cdot 10^{-172}:\\ \;\;\;\;-U\\ \mathbf{elif}\;J \leq -2 \cdot 10^{-230}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;J \leq 9.4 \cdot 10^{-297}:\\ \;\;\;\;U\\ \mathbf{elif}\;J \leq 1.75 \cdot 10^{-174}:\\ \;\;\;\;-U\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 2
Error22.7
Cost21148
\[\begin{array}{l} t_0 := \sqrt{1 + {\left(\frac{U}{J + J}\right)}^{2}}\\ t_1 := \left(\left(-2 \cdot J\right) \cdot \cos \left(\frac{K}{2}\right)\right) \cdot t_0\\ \mathbf{if}\;J \leq -3300:\\ \;\;\;\;t_1\\ \mathbf{elif}\;J \leq -5.8 \cdot 10^{-53}:\\ \;\;\;\;-U\\ \mathbf{elif}\;J \leq -2 \cdot 10^{-76}:\\ \;\;\;\;\left(J \cdot -2\right) \cdot t_0\\ \mathbf{elif}\;J \leq -1.7 \cdot 10^{-98}:\\ \;\;\;\;2 \cdot \frac{{J}^{2}}{U} + U\\ \mathbf{elif}\;J \leq -7.5 \cdot 10^{-231}:\\ \;\;\;\;-U\\ \mathbf{elif}\;J \leq 4.5 \cdot 10^{-299}:\\ \;\;\;\;U\\ \mathbf{elif}\;J \leq 9.4 \cdot 10^{-175}:\\ \;\;\;\;-U\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 3
Error26.7
Cost13964
\[\begin{array}{l} t_0 := \cos \left(0.5 \cdot K\right) \cdot \left(J \cdot -2\right)\\ \mathbf{if}\;J \leq -3300:\\ \;\;\;\;t_0\\ \mathbf{elif}\;J \leq -1.1 \cdot 10^{-52}:\\ \;\;\;\;-U\\ \mathbf{elif}\;J \leq -3.2 \cdot 10^{-76}:\\ \;\;\;\;\left(J \cdot -2\right) \cdot \sqrt{1 + {\left(U \cdot \frac{0.5}{J}\right)}^{2}}\\ \mathbf{elif}\;J \leq -4.6 \cdot 10^{-97}:\\ \;\;\;\;2 \cdot \frac{{J}^{2}}{U} + U\\ \mathbf{elif}\;J \leq -1.45 \cdot 10^{-230}:\\ \;\;\;\;-U\\ \mathbf{elif}\;J \leq 4.05 \cdot 10^{-302}:\\ \;\;\;\;U\\ \mathbf{elif}\;J \leq 1.3 \cdot 10^{-151}:\\ \;\;\;\;-U\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 4
Error26.6
Cost13964
\[\begin{array}{l} t_0 := \cos \left(0.5 \cdot K\right) \cdot \left(J \cdot -2\right)\\ \mathbf{if}\;J \leq -3300:\\ \;\;\;\;t_0\\ \mathbf{elif}\;J \leq -6.2 \cdot 10^{-53}:\\ \;\;\;\;-U\\ \mathbf{elif}\;J \leq -1.8 \cdot 10^{-76}:\\ \;\;\;\;\left(J \cdot -2\right) \cdot \sqrt{1 + {\left(\frac{U}{J + J}\right)}^{2}}\\ \mathbf{elif}\;J \leq -4.6 \cdot 10^{-97}:\\ \;\;\;\;2 \cdot \frac{{J}^{2}}{U} + U\\ \mathbf{elif}\;J \leq -8.5 \cdot 10^{-231}:\\ \;\;\;\;-U\\ \mathbf{elif}\;J \leq 4.4 \cdot 10^{-297}:\\ \;\;\;\;U\\ \mathbf{elif}\;J \leq 7.5 \cdot 10^{-151}:\\ \;\;\;\;-U\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 5
Error26.6
Cost7772
\[\begin{array}{l} t_0 := \cos \left(0.5 \cdot K\right) \cdot \left(J \cdot -2\right)\\ \mathbf{if}\;J \leq -3300:\\ \;\;\;\;t_0\\ \mathbf{elif}\;J \leq -5.6 \cdot 10^{-70}:\\ \;\;\;\;-U\\ \mathbf{elif}\;J \leq -5.2 \cdot 10^{-76}:\\ \;\;\;\;-2 \cdot J\\ \mathbf{elif}\;J \leq -4.6 \cdot 10^{-97}:\\ \;\;\;\;U\\ \mathbf{elif}\;J \leq -5.8 \cdot 10^{-231}:\\ \;\;\;\;-U\\ \mathbf{elif}\;J \leq 1.02 \cdot 10^{-296}:\\ \;\;\;\;U\\ \mathbf{elif}\;J \leq 1.5 \cdot 10^{-151}:\\ \;\;\;\;-U\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 6
Error26.6
Cost7772
\[\begin{array}{l} t_0 := \cos \left(0.5 \cdot K\right) \cdot \left(J \cdot -2\right)\\ \mathbf{if}\;J \leq -3400:\\ \;\;\;\;t_0\\ \mathbf{elif}\;J \leq -1.3 \cdot 10^{-70}:\\ \;\;\;\;-U\\ \mathbf{elif}\;J \leq -8 \cdot 10^{-76}:\\ \;\;\;\;-2 \cdot J\\ \mathbf{elif}\;J \leq -4.6 \cdot 10^{-97}:\\ \;\;\;\;2 \cdot \frac{{J}^{2}}{U} + U\\ \mathbf{elif}\;J \leq -9.5 \cdot 10^{-232}:\\ \;\;\;\;-U\\ \mathbf{elif}\;J \leq 3.5 \cdot 10^{-296}:\\ \;\;\;\;U\\ \mathbf{elif}\;J \leq 4.2 \cdot 10^{-151}:\\ \;\;\;\;-U\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 7
Error38.4
Cost984
\[\begin{array}{l} \mathbf{if}\;J \leq -8500:\\ \;\;\;\;-2 \cdot J\\ \mathbf{elif}\;J \leq -1.1 \cdot 10^{-231}:\\ \;\;\;\;-U\\ \mathbf{elif}\;J \leq 1.6 \cdot 10^{-292}:\\ \;\;\;\;U\\ \mathbf{elif}\;J \leq 1.42 \cdot 10^{-105}:\\ \;\;\;\;-U\\ \mathbf{elif}\;J \leq 2.4 \cdot 10^{-32}:\\ \;\;\;\;U\\ \mathbf{elif}\;J \leq 3 \cdot 10^{+109}:\\ \;\;\;\;-U\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot J\\ \end{array} \]
Alternative 8
Error47.1
Cost656
\[\begin{array}{l} \mathbf{if}\;J \leq -2.3 \cdot 10^{-230}:\\ \;\;\;\;-U\\ \mathbf{elif}\;J \leq 1.38 \cdot 10^{-300}:\\ \;\;\;\;U\\ \mathbf{elif}\;J \leq 1.52 \cdot 10^{-107}:\\ \;\;\;\;-U\\ \mathbf{elif}\;J \leq 9 \cdot 10^{-33}:\\ \;\;\;\;U\\ \mathbf{else}:\\ \;\;\;\;-U\\ \end{array} \]
Alternative 9
Error46.7
Cost64
\[U \]

Error

Reproduce?

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