# ?

Average Error: 41.4 → 5.5
Time: 2.1min
Precision: binary64
Cost: 48456

# ?

$\left(\left(\left(0 \leq NN \land NN \leq 1000\right) \land \left(0 \leq MM \land MM \leq 1000\right)\right) \land \left(0 \leq N1 \land N1 \leq 1000\right)\right) \land \left(0 \leq N \land N \leq 1000\right)$
$\sqrt{\frac{\left(4 \cdot NN\right) \cdot NN}{\left(\left(\left(\left(\left(NN + MM\right) \cdot \left(NN - MM\right)\right) \cdot \left(\left(N1 - N\right) + NN\right)\right) \cdot \left(\left(N - N1\right) + NN\right)\right) \cdot \left(\left(\left(N + N1\right) - NN\right) + 1\right)\right) \cdot \left(\left(\left(N + N1\right) + NN\right) + 1\right)}} \cdot \left(\left(2 \cdot NN + 1\right) \cdot \left(2 \cdot NN - 1\right)\right)$
$\begin{array}{l} t_0 := \left(NN + \left(N - N1\right)\right) \cdot \left(N1 - \left(-1 + \left(NN - N\right)\right)\right)\\ t_1 := \left(\left(N1 + N\right) - NN\right) + 1\\ t_2 := \sqrt{\frac{NN \cdot \left(4 \cdot NN\right)}{\left(\left(\left(\left(N1 - N\right) - NN\right) \cdot \left(\left(\left(NN + MM\right) \cdot \left(NN - MM\right)\right) \cdot \left(\left(N - N1\right) - NN\right)\right)\right) \cdot t_1\right) \cdot \left(1 + \left(NN + \left(N1 + N\right)\right)\right)}} \cdot \left(\left(1 + NN \cdot 2\right) \cdot \left(NN \cdot 2 + -1\right)\right)\\ t_3 := \frac{NN}{NN + \left(\left(N1 + N\right) + 1\right)}\\ t_4 := NN + \left(N1 - N\right)\\ t_5 := \mathsf{fma}\left(2, NN, 1\right) \cdot \mathsf{fma}\left(2, NN, -1\right)\\ \mathbf{if}\;t_2 \leq -2 \cdot 10^{-62}:\\ \;\;\;\;\sqrt{\frac{\frac{NN}{\frac{t_4}{\frac{NN}{\left(NN + N\right) - N1}}}}{NN + MM} \cdot \frac{\frac{4}{t_1 \cdot \left(NN - \left(\left(-1 - N\right) - N1\right)\right)}}{NN - MM}} \cdot \left(\mathsf{fma}\left(NN, 2, 1\right) \cdot \mathsf{fma}\left(NN, 2, -1\right)\right)\\ \mathbf{elif}\;t_2 \leq 0:\\ \;\;\;\;\left(\sqrt{\frac{4 \cdot NN}{\left(NN + MM\right) \cdot \left(\left(NN - MM\right) \cdot \left(t_4 \cdot t_0\right)\right)}} \cdot \sqrt{t_3}\right) \cdot t_5\\ \mathbf{else}:\\ \;\;\;\;t_5 \cdot \sqrt{\frac{t_3 \cdot \left(\frac{\frac{NN}{NN - MM}}{t_4} \cdot \frac{4}{NN + MM}\right)}{t_0}}\\ \end{array}$
(FPCore (NN MM N1 N)
:precision binary64
(*
(sqrt
(/
(* (* 4.0 NN) NN)
(*
(*
(* (* (* (+ NN MM) (- NN MM)) (+ (- N1 N) NN)) (+ (- N N1) NN))
(+ (- (+ N N1) NN) 1.0))
(+ (+ (+ N N1) NN) 1.0))))
(* (+ (* 2.0 NN) 1.0) (- (* 2.0 NN) 1.0))))
(FPCore (NN MM N1 N)
:precision binary64
(let* ((t_0 (* (+ NN (- N N1)) (- N1 (+ -1.0 (- NN N)))))
(t_1 (+ (- (+ N1 N) NN) 1.0))
(t_2
(*
(sqrt
(/
(* NN (* 4.0 NN))
(*
(*
(* (- (- N1 N) NN) (* (* (+ NN MM) (- NN MM)) (- (- N N1) NN)))
t_1)
(+ 1.0 (+ NN (+ N1 N))))))
(* (+ 1.0 (* NN 2.0)) (+ (* NN 2.0) -1.0))))
(t_3 (/ NN (+ NN (+ (+ N1 N) 1.0))))
(t_4 (+ NN (- N1 N)))
(t_5 (* (fma 2.0 NN 1.0) (fma 2.0 NN -1.0))))
(if (<= t_2 -2e-62)
(*
(sqrt
(*
(/ (/ NN (/ t_4 (/ NN (- (+ NN N) N1)))) (+ NN MM))
(/ (/ 4.0 (* t_1 (- NN (- (- -1.0 N) N1)))) (- NN MM))))
(* (fma NN 2.0 1.0) (fma NN 2.0 -1.0)))
(if (<= t_2 0.0)
(*
(*
(sqrt (/ (* 4.0 NN) (* (+ NN MM) (* (- NN MM) (* t_4 t_0)))))
(sqrt t_3))
t_5)
(*
t_5
(sqrt
(/ (* t_3 (* (/ (/ NN (- NN MM)) t_4) (/ 4.0 (+ NN MM)))) t_0)))))))
double code(double NN, double MM, double N1, double N) {
return sqrt((((4.0 * NN) * NN) / ((((((NN + MM) * (NN - MM)) * ((N1 - N) + NN)) * ((N - N1) + NN)) * (((N + N1) - NN) + 1.0)) * (((N + N1) + NN) + 1.0)))) * (((2.0 * NN) + 1.0) * ((2.0 * NN) - 1.0));
}
double code(double NN, double MM, double N1, double N) {
double t_0 = (NN + (N - N1)) * (N1 - (-1.0 + (NN - N)));
double t_1 = ((N1 + N) - NN) + 1.0;
double t_2 = sqrt(((NN * (4.0 * NN)) / (((((N1 - N) - NN) * (((NN + MM) * (NN - MM)) * ((N - N1) - NN))) * t_1) * (1.0 + (NN + (N1 + N)))))) * ((1.0 + (NN * 2.0)) * ((NN * 2.0) + -1.0));
double t_3 = NN / (NN + ((N1 + N) + 1.0));
double t_4 = NN + (N1 - N);
double t_5 = fma(2.0, NN, 1.0) * fma(2.0, NN, -1.0);
double tmp;
if (t_2 <= -2e-62) {
tmp = sqrt((((NN / (t_4 / (NN / ((NN + N) - N1)))) / (NN + MM)) * ((4.0 / (t_1 * (NN - ((-1.0 - N) - N1)))) / (NN - MM)))) * (fma(NN, 2.0, 1.0) * fma(NN, 2.0, -1.0));
} else if (t_2 <= 0.0) {
tmp = (sqrt(((4.0 * NN) / ((NN + MM) * ((NN - MM) * (t_4 * t_0))))) * sqrt(t_3)) * t_5;
} else {
tmp = t_5 * sqrt(((t_3 * (((NN / (NN - MM)) / t_4) * (4.0 / (NN + MM)))) / t_0));
}
return tmp;
}
function code(NN, MM, N1, N)
return Float64(sqrt(Float64(Float64(Float64(4.0 * NN) * NN) / Float64(Float64(Float64(Float64(Float64(Float64(NN + MM) * Float64(NN - MM)) * Float64(Float64(N1 - N) + NN)) * Float64(Float64(N - N1) + NN)) * Float64(Float64(Float64(N + N1) - NN) + 1.0)) * Float64(Float64(Float64(N + N1) + NN) + 1.0)))) * Float64(Float64(Float64(2.0 * NN) + 1.0) * Float64(Float64(2.0 * NN) - 1.0)))
end
function code(NN, MM, N1, N)
t_0 = Float64(Float64(NN + Float64(N - N1)) * Float64(N1 - Float64(-1.0 + Float64(NN - N))))
t_1 = Float64(Float64(Float64(N1 + N) - NN) + 1.0)
t_2 = Float64(sqrt(Float64(Float64(NN * Float64(4.0 * NN)) / Float64(Float64(Float64(Float64(Float64(N1 - N) - NN) * Float64(Float64(Float64(NN + MM) * Float64(NN - MM)) * Float64(Float64(N - N1) - NN))) * t_1) * Float64(1.0 + Float64(NN + Float64(N1 + N)))))) * Float64(Float64(1.0 + Float64(NN * 2.0)) * Float64(Float64(NN * 2.0) + -1.0)))
t_3 = Float64(NN / Float64(NN + Float64(Float64(N1 + N) + 1.0)))
t_4 = Float64(NN + Float64(N1 - N))
t_5 = Float64(fma(2.0, NN, 1.0) * fma(2.0, NN, -1.0))
tmp = 0.0
if (t_2 <= -2e-62)
tmp = Float64(sqrt(Float64(Float64(Float64(NN / Float64(t_4 / Float64(NN / Float64(Float64(NN + N) - N1)))) / Float64(NN + MM)) * Float64(Float64(4.0 / Float64(t_1 * Float64(NN - Float64(Float64(-1.0 - N) - N1)))) / Float64(NN - MM)))) * Float64(fma(NN, 2.0, 1.0) * fma(NN, 2.0, -1.0)));
elseif (t_2 <= 0.0)
tmp = Float64(Float64(sqrt(Float64(Float64(4.0 * NN) / Float64(Float64(NN + MM) * Float64(Float64(NN - MM) * Float64(t_4 * t_0))))) * sqrt(t_3)) * t_5);
else
tmp = Float64(t_5 * sqrt(Float64(Float64(t_3 * Float64(Float64(Float64(NN / Float64(NN - MM)) / t_4) * Float64(4.0 / Float64(NN + MM)))) / t_0)));
end
return tmp
end
code[NN_, MM_, N1_, N_] := N[(N[Sqrt[N[(N[(N[(4.0 * NN), $MachinePrecision] * NN),$MachinePrecision] / N[(N[(N[(N[(N[(N[(NN + MM), $MachinePrecision] * N[(NN - MM),$MachinePrecision]), $MachinePrecision] * N[(N[(N1 - N),$MachinePrecision] + NN), $MachinePrecision]),$MachinePrecision] * N[(N[(N - N1), $MachinePrecision] + NN),$MachinePrecision]), $MachinePrecision] * N[(N[(N[(N + N1),$MachinePrecision] - NN), $MachinePrecision] + 1.0),$MachinePrecision]), $MachinePrecision] * N[(N[(N[(N + N1),$MachinePrecision] + NN), $MachinePrecision] + 1.0),$MachinePrecision]), $MachinePrecision]),$MachinePrecision]], $MachinePrecision] * N[(N[(N[(2.0 * NN),$MachinePrecision] + 1.0), $MachinePrecision] * N[(N[(2.0 * NN),$MachinePrecision] - 1.0), $MachinePrecision]),$MachinePrecision]), $MachinePrecision] code[NN_, MM_, N1_, N_] := Block[{t$95$0 = N[(N[(NN + N[(N - N1),$MachinePrecision]), $MachinePrecision] * N[(N1 - N[(-1.0 + N[(NN - N),$MachinePrecision]), $MachinePrecision]),$MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(N1 + N),$MachinePrecision] - NN), $MachinePrecision] + 1.0),$MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[N[(N[(NN * N[(4.0 * NN), $MachinePrecision]),$MachinePrecision] / N[(N[(N[(N[(N[(N1 - N), $MachinePrecision] - NN),$MachinePrecision] * N[(N[(N[(NN + MM), $MachinePrecision] * N[(NN - MM),$MachinePrecision]), $MachinePrecision] * N[(N[(N - N1),$MachinePrecision] - NN), $MachinePrecision]),$MachinePrecision]), $MachinePrecision] * t$95$1),$MachinePrecision] * N[(1.0 + N[(NN + N[(N1 + N), $MachinePrecision]),$MachinePrecision]), $MachinePrecision]),$MachinePrecision]), $MachinePrecision]],$MachinePrecision] * N[(N[(1.0 + N[(NN * 2.0), $MachinePrecision]),$MachinePrecision] * N[(N[(NN * 2.0), $MachinePrecision] + -1.0),$MachinePrecision]), $MachinePrecision]),$MachinePrecision]}, Block[{t$95$3 = N[(NN / N[(NN + N[(N[(N1 + N), $MachinePrecision] + 1.0),$MachinePrecision]), $MachinePrecision]),$MachinePrecision]}, Block[{t$95$4 = N[(NN + N[(N1 - N), $MachinePrecision]),$MachinePrecision]}, Block[{t$95$5 = N[(N[(2.0 * NN + 1.0), $MachinePrecision] * N[(2.0 * NN + -1.0),$MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -2e-62], N[(N[Sqrt[N[(N[(N[(NN / N[(t$95$4 / N[(NN / N[(N[(NN + N),$MachinePrecision] - N1), $MachinePrecision]),$MachinePrecision]), $MachinePrecision]),$MachinePrecision] / N[(NN + MM), $MachinePrecision]),$MachinePrecision] * N[(N[(4.0 / N[(t$95$1 * N[(NN - N[(N[(-1.0 - N), $MachinePrecision] - N1),$MachinePrecision]), $MachinePrecision]),$MachinePrecision]), $MachinePrecision] / N[(NN - MM),$MachinePrecision]), $MachinePrecision]),$MachinePrecision]], $MachinePrecision] * N[(N[(NN * 2.0 + 1.0),$MachinePrecision] * N[(NN * 2.0 + -1.0), $MachinePrecision]),$MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 0.0], N[(N[(N[Sqrt[N[(N[(4.0 * NN),$MachinePrecision] / N[(N[(NN + MM), $MachinePrecision] * N[(N[(NN - MM),$MachinePrecision] * N[(t$95$4 * t$95$0), $MachinePrecision]),$MachinePrecision]), $MachinePrecision]),$MachinePrecision]], $MachinePrecision] * N[Sqrt[t$95$3],$MachinePrecision]), $MachinePrecision] * t$95$5),$MachinePrecision], N[(t$95$5 * N[Sqrt[N[(N[(t$95$3 * N[(N[(N[(NN / N[(NN - MM), $MachinePrecision]),$MachinePrecision] / t$95$4), $MachinePrecision] * N[(4.0 / N[(NN + MM),$MachinePrecision]), $MachinePrecision]),$MachinePrecision]), $MachinePrecision] / t$95$0),$MachinePrecision]], $MachinePrecision]),$MachinePrecision]]]]]]]]]
\sqrt{\frac{\left(4 \cdot NN\right) \cdot NN}{\left(\left(\left(\left(\left(NN + MM\right) \cdot \left(NN - MM\right)\right) \cdot \left(\left(N1 - N\right) + NN\right)\right) \cdot \left(\left(N - N1\right) + NN\right)\right) \cdot \left(\left(\left(N + N1\right) - NN\right) + 1\right)\right) \cdot \left(\left(\left(N + N1\right) + NN\right) + 1\right)}} \cdot \left(\left(2 \cdot NN + 1\right) \cdot \left(2 \cdot NN - 1\right)\right)
\begin{array}{l}
t_0 := \left(NN + \left(N - N1\right)\right) \cdot \left(N1 - \left(-1 + \left(NN - N\right)\right)\right)\\
t_1 := \left(\left(N1 + N\right) - NN\right) + 1\\
t_2 := \sqrt{\frac{NN \cdot \left(4 \cdot NN\right)}{\left(\left(\left(\left(N1 - N\right) - NN\right) \cdot \left(\left(\left(NN + MM\right) \cdot \left(NN - MM\right)\right) \cdot \left(\left(N - N1\right) - NN\right)\right)\right) \cdot t_1\right) \cdot \left(1 + \left(NN + \left(N1 + N\right)\right)\right)}} \cdot \left(\left(1 + NN \cdot 2\right) \cdot \left(NN \cdot 2 + -1\right)\right)\\
t_3 := \frac{NN}{NN + \left(\left(N1 + N\right) + 1\right)}\\
t_4 := NN + \left(N1 - N\right)\\
t_5 := \mathsf{fma}\left(2, NN, 1\right) \cdot \mathsf{fma}\left(2, NN, -1\right)\\
\mathbf{if}\;t_2 \leq -2 \cdot 10^{-62}:\\
\;\;\;\;\sqrt{\frac{\frac{NN}{\frac{t_4}{\frac{NN}{\left(NN + N\right) - N1}}}}{NN + MM} \cdot \frac{\frac{4}{t_1 \cdot \left(NN - \left(\left(-1 - N\right) - N1\right)\right)}}{NN - MM}} \cdot \left(\mathsf{fma}\left(NN, 2, 1\right) \cdot \mathsf{fma}\left(NN, 2, -1\right)\right)\\

\mathbf{elif}\;t_2 \leq 0:\\
\;\;\;\;\left(\sqrt{\frac{4 \cdot NN}{\left(NN + MM\right) \cdot \left(\left(NN - MM\right) \cdot \left(t_4 \cdot t_0\right)\right)}} \cdot \sqrt{t_3}\right) \cdot t_5\\

\mathbf{else}:\\
\;\;\;\;t_5 \cdot \sqrt{\frac{t_3 \cdot \left(\frac{\frac{NN}{NN - MM}}{t_4} \cdot \frac{4}{NN + MM}\right)}{t_0}}\\

\end{array}

# Derivation?

1. Split input into 3 regimes
2. ## if (*.f64 (sqrt.f64 (/.f64 (*.f64 (*.f64 4 NN) NN) (*.f64 (*.f64 (*.f64 (*.f64 (*.f64 (+.f64 NN MM) (-.f64 NN MM)) (+.f64 (-.f64 N1 N) NN)) (+.f64 (-.f64 N N1) NN)) (+.f64 (-.f64 (+.f64 N N1) NN) 1)) (+.f64 (+.f64 (+.f64 N N1) NN) 1)))) (*.f64 (+.f64 (*.f64 2 NN) 1) (-.f64 (*.f64 2 NN) 1))) < -2.0000000000000001e-62

1. Initial program 17.0

$\sqrt{\frac{\left(4 \cdot NN\right) \cdot NN}{\left(\left(\left(\left(\left(NN + MM\right) \cdot \left(NN - MM\right)\right) \cdot \left(\left(N1 - N\right) + NN\right)\right) \cdot \left(\left(N - N1\right) + NN\right)\right) \cdot \left(\left(\left(N + N1\right) - NN\right) + 1\right)\right) \cdot \left(\left(\left(N + N1\right) + NN\right) + 1\right)}} \cdot \left(\left(2 \cdot NN + 1\right) \cdot \left(2 \cdot NN - 1\right)\right)$
2. Simplified1.5

$\leadsto \color{blue}{\sqrt{\frac{\frac{NN \cdot NN}{\left(N1 - \left(N - NN\right)\right) \cdot \left(N - \left(N1 - NN\right)\right)}}{\left(NN + MM\right) \cdot \left(NN - MM\right)} \cdot \frac{4}{\left(N1 + \left(\left(N - NN\right) + 1\right)\right) \cdot \left(\left(NN + N1\right) + \left(N + 1\right)\right)}} \cdot \left(\mathsf{fma}\left(NN, 2, 1\right) \cdot \mathsf{fma}\left(NN, 2, -1\right)\right)}$
Proof
[Start]17.0 $\sqrt{\frac{\left(4 \cdot NN\right) \cdot NN}{\left(\left(\left(\left(\left(NN + MM\right) \cdot \left(NN - MM\right)\right) \cdot \left(\left(N1 - N\right) + NN\right)\right) \cdot \left(\left(N - N1\right) + NN\right)\right) \cdot \left(\left(\left(N + N1\right) - NN\right) + 1\right)\right) \cdot \left(\left(\left(N + N1\right) + NN\right) + 1\right)}} \cdot \left(\left(2 \cdot NN + 1\right) \cdot \left(2 \cdot NN - 1\right)\right)$
3. Applied egg-rr0.9

$\leadsto \color{blue}{\left(1 \cdot \sqrt{\frac{\frac{NN}{\frac{\left(NN + \left(N1 - N\right)\right) \cdot \left(NN + \left(N - N1\right)\right)}{NN}} \cdot \frac{4}{\left(1 + \left(\left(N1 + N\right) - NN\right)\right) \cdot \left(NN + \left(\left(N1 + N\right) + 1\right)\right)}}{\left(NN + MM\right) \cdot \left(NN - MM\right)}}\right)} \cdot \left(\mathsf{fma}\left(NN, 2, 1\right) \cdot \mathsf{fma}\left(NN, 2, -1\right)\right)$
4. Simplified0.8

$\leadsto \color{blue}{\sqrt{\frac{\frac{NN}{\frac{NN + \left(N1 - N\right)}{\frac{NN}{\left(NN + N\right) - N1}}}}{NN + MM} \cdot \frac{\frac{4}{\left(1 + \left(\left(N1 + N\right) - NN\right)\right) \cdot \left(NN + \left(N1 + \left(N + 1\right)\right)\right)}}{NN - MM}}} \cdot \left(\mathsf{fma}\left(NN, 2, 1\right) \cdot \mathsf{fma}\left(NN, 2, -1\right)\right)$
Proof
[Start]0.9 $\left(1 \cdot \sqrt{\frac{\frac{NN}{\frac{\left(NN + \left(N1 - N\right)\right) \cdot \left(NN + \left(N - N1\right)\right)}{NN}} \cdot \frac{4}{\left(1 + \left(\left(N1 + N\right) - NN\right)\right) \cdot \left(NN + \left(\left(N1 + N\right) + 1\right)\right)}}{\left(NN + MM\right) \cdot \left(NN - MM\right)}}\right) \cdot \left(\mathsf{fma}\left(NN, 2, 1\right) \cdot \mathsf{fma}\left(NN, 2, -1\right)\right)$ $\color{blue}{\sqrt{\frac{\frac{NN}{\frac{\left(NN + \left(N1 - N\right)\right) \cdot \left(NN + \left(N - N1\right)\right)}{NN}} \cdot \frac{4}{\left(1 + \left(\left(N1 + N\right) - NN\right)\right) \cdot \left(NN + \left(\left(N1 + N\right) + 1\right)\right)}}{\left(NN + MM\right) \cdot \left(NN - MM\right)}}} \cdot \left(\mathsf{fma}\left(NN, 2, 1\right) \cdot \mathsf{fma}\left(NN, 2, -1\right)\right)$ $\sqrt{\frac{\frac{NN}{\frac{\left(NN + \left(N1 - N\right)\right) \cdot \left(NN + \left(N - N1\right)\right)}{NN}} \cdot \frac{4}{\left(1 + \left(\left(N1 + N\right) - NN\right)\right) \cdot \left(NN + \left(\left(N1 + N\right) + 1\right)\right)}}{\color{blue}{\left(MM + NN\right)} \cdot \left(NN - MM\right)}} \cdot \left(\mathsf{fma}\left(NN, 2, 1\right) \cdot \mathsf{fma}\left(NN, 2, -1\right)\right)$ $\sqrt{\color{blue}{\frac{\frac{NN}{\frac{\left(NN + \left(N1 - N\right)\right) \cdot \left(NN + \left(N - N1\right)\right)}{NN}}}{MM + NN} \cdot \frac{\frac{4}{\left(1 + \left(\left(N1 + N\right) - NN\right)\right) \cdot \left(NN + \left(\left(N1 + N\right) + 1\right)\right)}}{NN - MM}}} \cdot \left(\mathsf{fma}\left(NN, 2, 1\right) \cdot \mathsf{fma}\left(NN, 2, -1\right)\right)$

## if -2.0000000000000001e-62 < (*.f64 (sqrt.f64 (/.f64 (*.f64 (*.f64 4 NN) NN) (*.f64 (*.f64 (*.f64 (*.f64 (*.f64 (+.f64 NN MM) (-.f64 NN MM)) (+.f64 (-.f64 N1 N) NN)) (+.f64 (-.f64 N N1) NN)) (+.f64 (-.f64 (+.f64 N N1) NN) 1)) (+.f64 (+.f64 (+.f64 N N1) NN) 1)))) (*.f64 (+.f64 (*.f64 2 NN) 1) (-.f64 (*.f64 2 NN) 1))) < -0.0

1. Initial program 56.1

$\sqrt{\frac{\left(4 \cdot NN\right) \cdot NN}{\left(\left(\left(\left(\left(NN + MM\right) \cdot \left(NN - MM\right)\right) \cdot \left(\left(N1 - N\right) + NN\right)\right) \cdot \left(\left(N - N1\right) + NN\right)\right) \cdot \left(\left(\left(N + N1\right) - NN\right) + 1\right)\right) \cdot \left(\left(\left(N + N1\right) + NN\right) + 1\right)}} \cdot \left(\left(2 \cdot NN + 1\right) \cdot \left(2 \cdot NN - 1\right)\right)$
2. Simplified20.0

$\leadsto \color{blue}{\sqrt{\frac{4 \cdot NN}{\left(\left(NN + MM\right) \cdot \left(\left(NN - MM\right) \cdot \left(NN + \left(N1 - N\right)\right)\right)\right) \cdot \left(\left(NN + \left(N - N1\right)\right) \cdot \left(\left(\left(N1 + N\right) - NN\right) + 1\right)\right)} \cdot \frac{NN}{\left(N1 + N\right) + \left(NN + 1\right)}} \cdot \left(\mathsf{fma}\left(2, NN, 1\right) \cdot \mathsf{fma}\left(2, NN, -1\right)\right)}$
Proof
[Start]56.1 $\sqrt{\frac{\left(4 \cdot NN\right) \cdot NN}{\left(\left(\left(\left(\left(NN + MM\right) \cdot \left(NN - MM\right)\right) \cdot \left(\left(N1 - N\right) + NN\right)\right) \cdot \left(\left(N - N1\right) + NN\right)\right) \cdot \left(\left(\left(N + N1\right) - NN\right) + 1\right)\right) \cdot \left(\left(\left(N + N1\right) + NN\right) + 1\right)}} \cdot \left(\left(2 \cdot NN + 1\right) \cdot \left(2 \cdot NN - 1\right)\right)$
3. Applied egg-rr2.4

$\leadsto \color{blue}{\left(\sqrt{\frac{4 \cdot NN}{\left(NN + MM\right) \cdot \left(\left(NN - MM\right) \cdot \left(\left(NN + \left(N1 - N\right)\right) \cdot \left(\left(NN + \left(N - N1\right)\right) \cdot \left(N1 + \left(\left(N - NN\right) + 1\right)\right)\right)\right)\right)}} \cdot \sqrt{\frac{NN}{NN + \left(1 + \left(N1 + N\right)\right)}}\right)} \cdot \left(\mathsf{fma}\left(2, NN, 1\right) \cdot \mathsf{fma}\left(2, NN, -1\right)\right)$

## if -0.0 < (*.f64 (sqrt.f64 (/.f64 (*.f64 (*.f64 4 NN) NN) (*.f64 (*.f64 (*.f64 (*.f64 (*.f64 (+.f64 NN MM) (-.f64 NN MM)) (+.f64 (-.f64 N1 N) NN)) (+.f64 (-.f64 N N1) NN)) (+.f64 (-.f64 (+.f64 N N1) NN) 1)) (+.f64 (+.f64 (+.f64 N N1) NN) 1)))) (*.f64 (+.f64 (*.f64 2 NN) 1) (-.f64 (*.f64 2 NN) 1)))

1. Initial program 63.8

$\sqrt{\frac{\left(4 \cdot NN\right) \cdot NN}{\left(\left(\left(\left(\left(NN + MM\right) \cdot \left(NN - MM\right)\right) \cdot \left(\left(N1 - N\right) + NN\right)\right) \cdot \left(\left(N - N1\right) + NN\right)\right) \cdot \left(\left(\left(N + N1\right) - NN\right) + 1\right)\right) \cdot \left(\left(\left(N + N1\right) + NN\right) + 1\right)}} \cdot \left(\left(2 \cdot NN + 1\right) \cdot \left(2 \cdot NN - 1\right)\right)$
2. Simplified63.8

$\leadsto \color{blue}{\sqrt{\frac{4 \cdot NN}{\left(\left(NN + MM\right) \cdot \left(\left(NN - MM\right) \cdot \left(NN + \left(N1 - N\right)\right)\right)\right) \cdot \left(\left(NN + \left(N - N1\right)\right) \cdot \left(\left(\left(N1 + N\right) - NN\right) + 1\right)\right)} \cdot \frac{NN}{\left(N1 + N\right) + \left(NN + 1\right)}} \cdot \left(\mathsf{fma}\left(2, NN, 1\right) \cdot \mathsf{fma}\left(2, NN, -1\right)\right)}$
Proof
[Start]63.8 $\sqrt{\frac{\left(4 \cdot NN\right) \cdot NN}{\left(\left(\left(\left(\left(NN + MM\right) \cdot \left(NN - MM\right)\right) \cdot \left(\left(N1 - N\right) + NN\right)\right) \cdot \left(\left(N - N1\right) + NN\right)\right) \cdot \left(\left(\left(N + N1\right) - NN\right) + 1\right)\right) \cdot \left(\left(\left(N + N1\right) + NN\right) + 1\right)}} \cdot \left(\left(2 \cdot NN + 1\right) \cdot \left(2 \cdot NN - 1\right)\right)$
3. Applied egg-rr51.6

$\leadsto \sqrt{\color{blue}{\frac{\frac{4 \cdot NN}{\left(NN + MM\right) \cdot \left(\left(NN - MM\right) \cdot \left(NN + \left(N1 - N\right)\right)\right)} \cdot \frac{NN}{NN + \left(1 + \left(N1 + N\right)\right)}}{\left(NN + \left(N - N1\right)\right) \cdot \left(N1 + \left(\left(N - NN\right) + 1\right)\right)}}} \cdot \left(\mathsf{fma}\left(2, NN, 1\right) \cdot \mathsf{fma}\left(2, NN, -1\right)\right)$
4. Applied egg-rr19.4

$\leadsto \sqrt{\frac{\color{blue}{\left(\frac{NN}{\left(NN - MM\right) \cdot \left(NN + \left(N1 - N\right)\right)} \cdot \frac{4}{NN + MM}\right)} \cdot \frac{NN}{NN + \left(1 + \left(N1 + N\right)\right)}}{\left(NN + \left(N - N1\right)\right) \cdot \left(N1 + \left(\left(N - NN\right) + 1\right)\right)}} \cdot \left(\mathsf{fma}\left(2, NN, 1\right) \cdot \mathsf{fma}\left(2, NN, -1\right)\right)$
5. Simplified13.0

$\leadsto \sqrt{\frac{\color{blue}{\left(\frac{\frac{NN}{NN - MM}}{NN + \left(N1 - N\right)} \cdot \frac{4}{NN + MM}\right)} \cdot \frac{NN}{NN + \left(1 + \left(N1 + N\right)\right)}}{\left(NN + \left(N - N1\right)\right) \cdot \left(N1 + \left(\left(N - NN\right) + 1\right)\right)}} \cdot \left(\mathsf{fma}\left(2, NN, 1\right) \cdot \mathsf{fma}\left(2, NN, -1\right)\right)$
Proof
[Start]19.4 $\sqrt{\frac{\left(\frac{NN}{\left(NN - MM\right) \cdot \left(NN + \left(N1 - N\right)\right)} \cdot \frac{4}{NN + MM}\right) \cdot \frac{NN}{NN + \left(1 + \left(N1 + N\right)\right)}}{\left(NN + \left(N - N1\right)\right) \cdot \left(N1 + \left(\left(N - NN\right) + 1\right)\right)}} \cdot \left(\mathsf{fma}\left(2, NN, 1\right) \cdot \mathsf{fma}\left(2, NN, -1\right)\right)$ $\sqrt{\frac{\left(\frac{NN}{\left(NN - MM\right) \cdot \color{blue}{\left(\left(NN + N1\right) - N\right)}} \cdot \frac{4}{NN + MM}\right) \cdot \frac{NN}{NN + \left(1 + \left(N1 + N\right)\right)}}{\left(NN + \left(N - N1\right)\right) \cdot \left(N1 + \left(\left(N - NN\right) + 1\right)\right)}} \cdot \left(\mathsf{fma}\left(2, NN, 1\right) \cdot \mathsf{fma}\left(2, NN, -1\right)\right)$ $\sqrt{\frac{\left(\frac{NN}{\left(NN - MM\right) \cdot \left(\color{blue}{\left(N1 + NN\right)} - N\right)} \cdot \frac{4}{NN + MM}\right) \cdot \frac{NN}{NN + \left(1 + \left(N1 + N\right)\right)}}{\left(NN + \left(N - N1\right)\right) \cdot \left(N1 + \left(\left(N - NN\right) + 1\right)\right)}} \cdot \left(\mathsf{fma}\left(2, NN, 1\right) \cdot \mathsf{fma}\left(2, NN, -1\right)\right)$ $\sqrt{\frac{\left(\color{blue}{\frac{\frac{NN}{NN - MM}}{\left(N1 + NN\right) - N}} \cdot \frac{4}{NN + MM}\right) \cdot \frac{NN}{NN + \left(1 + \left(N1 + N\right)\right)}}{\left(NN + \left(N - N1\right)\right) \cdot \left(N1 + \left(\left(N - NN\right) + 1\right)\right)}} \cdot \left(\mathsf{fma}\left(2, NN, 1\right) \cdot \mathsf{fma}\left(2, NN, -1\right)\right)$ $\sqrt{\frac{\left(\frac{\frac{NN}{NN - MM}}{\color{blue}{\left(NN + N1\right)} - N} \cdot \frac{4}{NN + MM}\right) \cdot \frac{NN}{NN + \left(1 + \left(N1 + N\right)\right)}}{\left(NN + \left(N - N1\right)\right) \cdot \left(N1 + \left(\left(N - NN\right) + 1\right)\right)}} \cdot \left(\mathsf{fma}\left(2, NN, 1\right) \cdot \mathsf{fma}\left(2, NN, -1\right)\right)$ $\sqrt{\frac{\left(\frac{\frac{NN}{NN - MM}}{\color{blue}{NN + \left(N1 - N\right)}} \cdot \frac{4}{NN + MM}\right) \cdot \frac{NN}{NN + \left(1 + \left(N1 + N\right)\right)}}{\left(NN + \left(N - N1\right)\right) \cdot \left(N1 + \left(\left(N - NN\right) + 1\right)\right)}} \cdot \left(\mathsf{fma}\left(2, NN, 1\right) \cdot \mathsf{fma}\left(2, NN, -1\right)\right)$
3. Recombined 3 regimes into one program.
4. Final simplification5.5

$\leadsto \begin{array}{l} \mathbf{if}\;\sqrt{\frac{NN \cdot \left(4 \cdot NN\right)}{\left(\left(\left(\left(N1 - N\right) - NN\right) \cdot \left(\left(\left(NN + MM\right) \cdot \left(NN - MM\right)\right) \cdot \left(\left(N - N1\right) - NN\right)\right)\right) \cdot \left(\left(\left(N1 + N\right) - NN\right) + 1\right)\right) \cdot \left(1 + \left(NN + \left(N1 + N\right)\right)\right)}} \cdot \left(\left(1 + NN \cdot 2\right) \cdot \left(NN \cdot 2 + -1\right)\right) \leq -2 \cdot 10^{-62}:\\ \;\;\;\;\sqrt{\frac{\frac{NN}{\frac{NN + \left(N1 - N\right)}{\frac{NN}{\left(NN + N\right) - N1}}}}{NN + MM} \cdot \frac{\frac{4}{\left(\left(\left(N1 + N\right) - NN\right) + 1\right) \cdot \left(NN - \left(\left(-1 - N\right) - N1\right)\right)}}{NN - MM}} \cdot \left(\mathsf{fma}\left(NN, 2, 1\right) \cdot \mathsf{fma}\left(NN, 2, -1\right)\right)\\ \mathbf{elif}\;\sqrt{\frac{NN \cdot \left(4 \cdot NN\right)}{\left(\left(\left(\left(N1 - N\right) - NN\right) \cdot \left(\left(\left(NN + MM\right) \cdot \left(NN - MM\right)\right) \cdot \left(\left(N - N1\right) - NN\right)\right)\right) \cdot \left(\left(\left(N1 + N\right) - NN\right) + 1\right)\right) \cdot \left(1 + \left(NN + \left(N1 + N\right)\right)\right)}} \cdot \left(\left(1 + NN \cdot 2\right) \cdot \left(NN \cdot 2 + -1\right)\right) \leq 0:\\ \;\;\;\;\left(\sqrt{\frac{4 \cdot NN}{\left(NN + MM\right) \cdot \left(\left(NN - MM\right) \cdot \left(\left(NN + \left(N1 - N\right)\right) \cdot \left(\left(NN + \left(N - N1\right)\right) \cdot \left(N1 - \left(-1 + \left(NN - N\right)\right)\right)\right)\right)\right)}} \cdot \sqrt{\frac{NN}{NN + \left(\left(N1 + N\right) + 1\right)}}\right) \cdot \left(\mathsf{fma}\left(2, NN, 1\right) \cdot \mathsf{fma}\left(2, NN, -1\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\mathsf{fma}\left(2, NN, 1\right) \cdot \mathsf{fma}\left(2, NN, -1\right)\right) \cdot \sqrt{\frac{\frac{NN}{NN + \left(\left(N1 + N\right) + 1\right)} \cdot \left(\frac{\frac{NN}{NN - MM}}{NN + \left(N1 - N\right)} \cdot \frac{4}{NN + MM}\right)}{\left(NN + \left(N - N1\right)\right) \cdot \left(N1 - \left(-1 + \left(NN - N\right)\right)\right)}}\\ \end{array}$

# Alternatives

Alternative 1
Error5.5
Cost42056
$\begin{array}{l} t_0 := \left(1 + NN \cdot 2\right) \cdot \left(NN \cdot 2 + -1\right)\\ t_1 := \left(\left(N1 + N\right) - NN\right) + 1\\ t_2 := NN + \left(N1 - N\right)\\ t_3 := \sqrt{\frac{NN \cdot \left(4 \cdot NN\right)}{\left(\left(\left(\left(N1 - N\right) - NN\right) \cdot \left(\left(\left(NN + MM\right) \cdot \left(NN - MM\right)\right) \cdot \left(\left(N - N1\right) - NN\right)\right)\right) \cdot t_1\right) \cdot \left(1 + \left(NN + \left(N1 + N\right)\right)\right)}} \cdot t_0\\ t_4 := NN + \left(N - N1\right)\\ \mathbf{if}\;t_3 \leq -2 \cdot 10^{-62}:\\ \;\;\;\;\sqrt{\frac{\frac{NN}{\frac{t_2}{\frac{NN}{\left(NN + N\right) - N1}}}}{NN + MM} \cdot \frac{\frac{4}{t_1 \cdot \left(NN - \left(\left(-1 - N\right) - N1\right)\right)}}{NN - MM}} \cdot \left(\mathsf{fma}\left(NN, 2, 1\right) \cdot \mathsf{fma}\left(NN, 2, -1\right)\right)\\ \mathbf{elif}\;t_3 \leq 0:\\ \;\;\;\;t_0 \cdot \left(\sqrt{\frac{4 \cdot NN}{\left(\left(NN + MM\right) \cdot \left(t_2 \cdot \left(\left(NN - MM\right) \cdot t_4\right)\right)\right) \cdot \left(N - \left(\left(NN + -1\right) - N1\right)\right)}} \cdot \sqrt{\frac{NN}{NN + \left(N + \left(N1 + 1\right)\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\mathsf{fma}\left(2, NN, 1\right) \cdot \mathsf{fma}\left(2, NN, -1\right)\right) \cdot \sqrt{\frac{\frac{NN}{NN + \left(\left(N1 + N\right) + 1\right)} \cdot \left(\frac{\frac{NN}{NN - MM}}{t_2} \cdot \frac{4}{NN + MM}\right)}{t_4 \cdot \left(N1 - \left(-1 + \left(NN - N\right)\right)\right)}}\\ \end{array}$
Alternative 2
Error14.6
Cost35912
$\begin{array}{l} t_0 := \left(1 + NN \cdot 2\right) \cdot \left(NN \cdot 2 + -1\right)\\ t_1 := \left(N1 + 1\right) - NN\\ t_2 := \sqrt{\frac{NN \cdot \left(4 \cdot NN\right)}{\left(\left(\left(\left(N1 - N\right) - NN\right) \cdot \left(\left(\left(NN + MM\right) \cdot \left(NN - MM\right)\right) \cdot \left(\left(N - N1\right) - NN\right)\right)\right) \cdot \left(\left(\left(N1 + N\right) - NN\right) + 1\right)\right) \cdot \left(1 + \left(NN + \left(N1 + N\right)\right)\right)}} \cdot t_0\\ t_3 := NN + \left(N1 - N\right)\\ t_4 := 1 + \left(NN + N1\right)\\ \mathbf{if}\;t_2 \leq -2 \cdot 10^{+70}:\\ \;\;\;\;t_0 \cdot \sqrt{\frac{4}{\left(NN + N1\right) \cdot \left(t_4 \cdot \left(\left(NN - N1\right) \cdot t_1\right)\right) + N \cdot \left(\left(NN + N1\right) \cdot \left(\left(-1 - \left(NN + N1\right)\right) \cdot \left(NN + \left(-1 - N1\right)\right) + \left(NN - N1\right) \cdot \left(2 + N1 \cdot 2\right)\right) + t_4 \cdot \left(t_1 \cdot \left(N1 - NN\right)\right)\right)}}\\ \mathbf{elif}\;t_2 \leq 0:\\ \;\;\;\;t_0 \cdot \left(\sqrt{\frac{4 \cdot NN}{\left(\left(NN + MM\right) \cdot \left(t_3 \cdot \left(\left(NN - MM\right) \cdot \left(NN + \left(N - N1\right)\right)\right)\right)\right) \cdot \left(N - \left(\left(NN + -1\right) - N1\right)\right)}} \cdot \sqrt{\frac{NN}{NN + \left(N + \left(N1 + 1\right)\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;t_0 \cdot \sqrt{\frac{NN}{NN + \left(\left(N1 + N\right) + 1\right)} \cdot \left(\frac{4}{NN + MM} \cdot \frac{\frac{NN}{NN - MM}}{t_3 \cdot \left(\left(N - \left(N1 - NN\right)\right) \cdot \left(N + \left(1 + \left(N1 - NN\right)\right)\right)\right)}\right)}\\ \end{array}$
Alternative 3
Error23.5
Cost29512
$\begin{array}{l} t_0 := \left(1 + NN \cdot 2\right) \cdot \left(NN \cdot 2 + -1\right)\\ t_1 := 1 + \left(N1 - NN\right)\\ t_2 := \sqrt{\frac{NN \cdot \left(4 \cdot NN\right)}{\left(\left(\left(\left(N1 - N\right) - NN\right) \cdot \left(\left(\left(NN + MM\right) \cdot \left(NN - MM\right)\right) \cdot \left(\left(N - N1\right) - NN\right)\right)\right) \cdot \left(\left(\left(N1 + N\right) - NN\right) + 1\right)\right) \cdot \left(1 + \left(NN + \left(N1 + N\right)\right)\right)}} \cdot t_0\\ \mathbf{if}\;t_2 \leq -5 \cdot 10^{+66}:\\ \;\;\;\;t_0 \cdot \sqrt{\frac{\frac{4}{NN + N1}}{\left(\left(NN - N1\right) \cdot \left(NN + \left(N1 + 1\right)\right)\right) \cdot t_1}}\\ \mathbf{elif}\;t_2 \leq 0:\\ \;\;\;\;t_0 \cdot \left(2 \cdot \left(NN \cdot \sqrt{\frac{1}{\left(N + \left(NN + 1\right)\right) \cdot \left(\left(NN + MM\right) \cdot \left(\left(\left(NN + N\right) \cdot \left(NN - N\right)\right) \cdot \left(\left(NN - MM\right) \cdot \left(N - \left(NN + -1\right)\right)\right)\right)\right)}}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t_0 \cdot \sqrt{\frac{NN}{NN + \left(\left(N1 + N\right) + 1\right)} \cdot \frac{\frac{\frac{NN}{NN - MM}}{\left(NN + \left(N1 - N\right)\right) \cdot \left(\left(N - \left(N1 - NN\right)\right) \cdot \left(N + t_1\right)\right)}}{\frac{NN + MM}{4}}}\\ \end{array}$
Alternative 4
Error23.5
Cost29512
$\begin{array}{l} t_0 := \left(1 + NN \cdot 2\right) \cdot \left(NN \cdot 2 + -1\right)\\ t_1 := 1 + \left(N1 - NN\right)\\ t_2 := \sqrt{\frac{NN \cdot \left(4 \cdot NN\right)}{\left(\left(\left(\left(N1 - N\right) - NN\right) \cdot \left(\left(\left(NN + MM\right) \cdot \left(NN - MM\right)\right) \cdot \left(\left(N - N1\right) - NN\right)\right)\right) \cdot \left(\left(\left(N1 + N\right) - NN\right) + 1\right)\right) \cdot \left(1 + \left(NN + \left(N1 + N\right)\right)\right)}} \cdot t_0\\ \mathbf{if}\;t_2 \leq -5 \cdot 10^{+66}:\\ \;\;\;\;t_0 \cdot \sqrt{\frac{\frac{4}{NN + N1}}{\left(\left(NN - N1\right) \cdot \left(NN + \left(N1 + 1\right)\right)\right) \cdot t_1}}\\ \mathbf{elif}\;t_2 \leq 0:\\ \;\;\;\;t_0 \cdot \left(2 \cdot \left(NN \cdot \sqrt{\frac{1}{\left(N + \left(NN + 1\right)\right) \cdot \left(\left(NN + MM\right) \cdot \left(\left(\left(NN + N\right) \cdot \left(NN - N\right)\right) \cdot \left(\left(NN - MM\right) \cdot \left(N - \left(NN + -1\right)\right)\right)\right)\right)}}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t_0 \cdot \sqrt{\frac{NN}{NN + \left(\left(N1 + N\right) + 1\right)} \cdot \left(\frac{4}{NN + MM} \cdot \frac{\frac{NN}{NN - MM}}{\left(NN + \left(N1 - N\right)\right) \cdot \left(\left(N - \left(N1 - NN\right)\right) \cdot \left(N + t_1\right)\right)}\right)}\\ \end{array}$
Alternative 5
Error23.5
Cost29512
$\begin{array}{l} t_0 := \left(1 + NN \cdot 2\right) \cdot \left(NN \cdot 2 + -1\right)\\ t_1 := \left(N1 + 1\right) - NN\\ t_2 := \sqrt{\frac{NN \cdot \left(4 \cdot NN\right)}{\left(\left(\left(\left(N1 - N\right) - NN\right) \cdot \left(\left(\left(NN + MM\right) \cdot \left(NN - MM\right)\right) \cdot \left(\left(N - N1\right) - NN\right)\right)\right) \cdot \left(\left(\left(N1 + N\right) - NN\right) + 1\right)\right) \cdot \left(1 + \left(NN + \left(N1 + N\right)\right)\right)}} \cdot t_0\\ t_3 := 1 + \left(NN + N1\right)\\ \mathbf{if}\;t_2 \leq -2 \cdot 10^{+75}:\\ \;\;\;\;t_0 \cdot \sqrt{\frac{4}{\left(NN + N1\right) \cdot \left(t_3 \cdot \left(\left(NN - N1\right) \cdot t_1\right)\right) + N \cdot \left(\left(NN + N1\right) \cdot \left(\left(-1 - \left(NN + N1\right)\right) \cdot \left(NN + \left(-1 - N1\right)\right) + \left(NN - N1\right) \cdot \left(2 + N1 \cdot 2\right)\right) + t_3 \cdot \left(t_1 \cdot \left(N1 - NN\right)\right)\right)}}\\ \mathbf{elif}\;t_2 \leq 0:\\ \;\;\;\;t_0 \cdot \left(2 \cdot \left(NN \cdot \sqrt{\frac{1}{\left(N + \left(NN + 1\right)\right) \cdot \left(\left(NN + MM\right) \cdot \left(\left(\left(NN + N\right) \cdot \left(NN - N\right)\right) \cdot \left(\left(NN - MM\right) \cdot \left(N - \left(NN + -1\right)\right)\right)\right)\right)}}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t_0 \cdot \sqrt{\frac{NN}{NN + \left(\left(N1 + N\right) + 1\right)} \cdot \left(\frac{4}{NN + MM} \cdot \frac{\frac{NN}{NN - MM}}{\left(NN + \left(N1 - N\right)\right) \cdot \left(\left(N - \left(N1 - NN\right)\right) \cdot \left(N + \left(1 + \left(N1 - NN\right)\right)\right)\right)}\right)}\\ \end{array}$
Alternative 6
Error23.3
Cost22600
$\begin{array}{l} t_0 := NN + \left(N1 - N\right)\\ t_1 := \left(1 + NN \cdot 2\right) \cdot \left(NN \cdot 2 + -1\right)\\ t_2 := NN + \left(N - N1\right)\\ t_3 := \left(N1 + N\right) + 1\\ \mathbf{if}\;N \leq 2.35 \cdot 10^{-185}:\\ \;\;\;\;t_1 \cdot \frac{\sqrt{\frac{4}{N1 + \left(NN - N\right)}}}{\sqrt{t_2 \cdot \left({t_3}^{2} - NN \cdot NN\right)}}\\ \mathbf{elif}\;N \leq 4.8 \cdot 10^{-158}:\\ \;\;\;\;\left(\mathsf{fma}\left(2, NN, 1\right) \cdot \mathsf{fma}\left(2, NN, -1\right)\right) \cdot \sqrt{\left(\frac{NN}{t_2 \cdot \left(N1 - \left(-1 + \left(NN - N\right)\right)\right)} \cdot \frac{4}{\left(NN + MM\right) \cdot \left(\left(NN - MM\right) \cdot t_0\right)}\right) \cdot \frac{NN}{\left(N1 + N\right) + \left(NN + 1\right)}}\\ \mathbf{elif}\;N \leq 3.2 \cdot 10^{-11}:\\ \;\;\;\;t_1 \cdot \sqrt{\frac{NN}{NN + t_3} \cdot \left(\frac{4}{NN + MM} \cdot \frac{\frac{NN}{NN - MM}}{t_0 \cdot \left(\left(N - \left(N1 - NN\right)\right) \cdot \left(N + \left(1 + \left(N1 - NN\right)\right)\right)\right)}\right)}\\ \mathbf{else}:\\ \;\;\;\;t_1 \cdot \left(\sqrt{\frac{4 \cdot NN}{\left(\left(NN + MM\right) \cdot \left(t_0 \cdot \left(\left(NN - MM\right) \cdot t_2\right)\right)\right) \cdot \left(N - \left(\left(NN + -1\right) - N1\right)\right)}} \cdot \sqrt{\frac{NN}{NN + \left(N + \left(N1 + 1\right)\right)}}\right)\\ \end{array}$
Alternative 7
Error19.5
Cost22600
$\begin{array}{l} t_0 := NN + \left(N1 - N\right)\\ t_1 := \left(1 + NN \cdot 2\right) \cdot \left(NN \cdot 2 + -1\right)\\ t_2 := NN + \left(N - N1\right)\\ t_3 := \left(N1 + N\right) + 1\\ \mathbf{if}\;N \leq 6.5 \cdot 10^{-234}:\\ \;\;\;\;t_1 \cdot \frac{\sqrt{\frac{4}{N1 + \left(NN - N\right)}}}{\sqrt{t_2 \cdot \left({t_3}^{2} - NN \cdot NN\right)}}\\ \mathbf{elif}\;N \leq 8 \cdot 10^{-109}:\\ \;\;\;\;\left(\mathsf{fma}\left(NN, 2, 1\right) \cdot \mathsf{fma}\left(NN, 2, -1\right)\right) \cdot \sqrt{\frac{\frac{NN}{\left(NN + N\right) - N1} \cdot \frac{NN}{t_0}}{\left(NN + MM\right) \cdot \left(NN - MM\right)} \cdot \frac{4}{\left(\left(-1 + \left(NN - N\right)\right) - N1\right) \cdot \left(\left(-1 - N\right) - \left(NN + N1\right)\right)}}\\ \mathbf{elif}\;N \leq 8.5 \cdot 10^{-14}:\\ \;\;\;\;t_1 \cdot \sqrt{\frac{NN}{NN + t_3} \cdot \left(\frac{4}{NN + MM} \cdot \frac{\frac{NN}{NN - MM}}{t_0 \cdot \left(\left(N - \left(N1 - NN\right)\right) \cdot \left(N + \left(1 + \left(N1 - NN\right)\right)\right)\right)}\right)}\\ \mathbf{else}:\\ \;\;\;\;t_1 \cdot \left(\sqrt{\frac{4 \cdot NN}{\left(\left(NN + MM\right) \cdot \left(t_0 \cdot \left(\left(NN - MM\right) \cdot t_2\right)\right)\right) \cdot \left(N - \left(\left(NN + -1\right) - N1\right)\right)}} \cdot \sqrt{\frac{NN}{NN + \left(N + \left(N1 + 1\right)\right)}}\right)\\ \end{array}$
Alternative 8
Error17.5
Cost22600
$\begin{array}{l} t_0 := \left(1 + NN \cdot 2\right) \cdot \left(NN \cdot 2 + -1\right)\\ t_1 := \left(N1 + N\right) + 1\\ t_2 := NN + \left(N - N1\right)\\ t_3 := NN + \left(N1 - N\right)\\ \mathbf{if}\;N \leq 6.5 \cdot 10^{-234}:\\ \;\;\;\;t_0 \cdot \frac{\sqrt{\frac{4}{N1 + \left(NN - N\right)}}}{\sqrt{t_2 \cdot \left({t_1}^{2} - NN \cdot NN\right)}}\\ \mathbf{elif}\;N \leq 1.75 \cdot 10^{-91}:\\ \;\;\;\;\sqrt{\frac{\frac{NN}{\frac{t_3}{\frac{NN}{\left(NN + N\right) - N1}}}}{NN + MM} \cdot \frac{\frac{4}{\left(\left(\left(N1 + N\right) - NN\right) + 1\right) \cdot \left(NN - \left(\left(-1 - N\right) - N1\right)\right)}}{NN - MM}} \cdot \left(\mathsf{fma}\left(NN, 2, 1\right) \cdot \mathsf{fma}\left(NN, 2, -1\right)\right)\\ \mathbf{elif}\;N \leq 2.4 \cdot 10^{-11}:\\ \;\;\;\;t_0 \cdot \sqrt{\frac{NN}{NN + t_1} \cdot \left(\frac{4}{NN + MM} \cdot \frac{\frac{NN}{NN - MM}}{t_3 \cdot \left(\left(N - \left(N1 - NN\right)\right) \cdot \left(N + \left(1 + \left(N1 - NN\right)\right)\right)\right)}\right)}\\ \mathbf{else}:\\ \;\;\;\;t_0 \cdot \left(\sqrt{\frac{4 \cdot NN}{\left(\left(NN + MM\right) \cdot \left(t_3 \cdot \left(\left(NN - MM\right) \cdot t_2\right)\right)\right) \cdot \left(N - \left(\left(NN + -1\right) - N1\right)\right)}} \cdot \sqrt{\frac{NN}{NN + \left(N + \left(N1 + 1\right)\right)}}\right)\\ \end{array}$
Alternative 9
Error24.0
Cost22472
$\begin{array}{l} t_0 := NN + \left(N1 - N\right)\\ t_1 := \left(1 + NN \cdot 2\right) \cdot \left(NN \cdot 2 + -1\right)\\ t_2 := NN + \left(N - N1\right)\\ t_3 := \left(N1 + N\right) + 1\\ \mathbf{if}\;N \leq 5.2 \cdot 10^{-170}:\\ \;\;\;\;t_1 \cdot \frac{\sqrt{\frac{4}{N1 + \left(NN - N\right)}}}{\sqrt{t_2 \cdot \left({t_3}^{2} - NN \cdot NN\right)}}\\ \mathbf{elif}\;N \leq 1.35 \cdot 10^{-164}:\\ \;\;\;\;\left(\mathsf{fma}\left(NN, 2, 1\right) \cdot \mathsf{fma}\left(NN, 2, -1\right)\right) \cdot \sqrt{\frac{4}{\left(\left(-1 + \left(NN - N\right)\right) - N1\right) \cdot \left(\left(-1 - N\right) - \left(NN + N1\right)\right)} \cdot \left(\frac{NN}{t_0} \cdot \left(\frac{NN}{\left(NN + N\right) - N1} \cdot \frac{-1}{MM \cdot MM}\right)\right)}\\ \mathbf{elif}\;N \leq 2.6 \cdot 10^{-13}:\\ \;\;\;\;t_1 \cdot \sqrt{\frac{NN}{NN + t_3} \cdot \left(\frac{4}{NN + MM} \cdot \frac{\frac{NN}{NN - MM}}{t_0 \cdot \left(\left(N - \left(N1 - NN\right)\right) \cdot \left(N + \left(1 + \left(N1 - NN\right)\right)\right)\right)}\right)}\\ \mathbf{else}:\\ \;\;\;\;t_1 \cdot \left(\sqrt{\frac{4 \cdot NN}{\left(\left(NN + MM\right) \cdot \left(t_0 \cdot \left(\left(NN - MM\right) \cdot t_2\right)\right)\right) \cdot \left(N - \left(\left(NN + -1\right) - N1\right)\right)}} \cdot \sqrt{\frac{NN}{NN + \left(N + \left(N1 + 1\right)\right)}}\right)\\ \end{array}$
Alternative 10
Error23.6
Cost21636
$\begin{array}{l} t_0 := NN + \left(N1 - N\right)\\ t_1 := \left(1 + NN \cdot 2\right) \cdot \left(NN \cdot 2 + -1\right)\\ t_2 := NN + \left(N - N1\right)\\ t_3 := \left(N1 + N\right) + 1\\ \mathbf{if}\;N \leq 1.3 \cdot 10^{-171}:\\ \;\;\;\;t_1 \cdot \frac{\sqrt{\frac{4}{N1 + \left(NN - N\right)}}}{\sqrt{t_2 \cdot \left({t_3}^{2} - NN \cdot NN\right)}}\\ \mathbf{elif}\;N \leq 8.8 \cdot 10^{-11}:\\ \;\;\;\;t_1 \cdot \sqrt{\frac{NN}{NN + t_3} \cdot \left(\frac{4}{NN + MM} \cdot \frac{\frac{NN}{NN - MM}}{t_0 \cdot \left(\left(N - \left(N1 - NN\right)\right) \cdot \left(N + \left(1 + \left(N1 - NN\right)\right)\right)\right)}\right)}\\ \mathbf{else}:\\ \;\;\;\;t_1 \cdot \left(\sqrt{\frac{4 \cdot NN}{\left(\left(NN + MM\right) \cdot \left(t_0 \cdot \left(\left(NN - MM\right) \cdot t_2\right)\right)\right) \cdot \left(N - \left(\left(NN + -1\right) - N1\right)\right)}} \cdot \sqrt{\frac{NN}{NN + \left(N + \left(N1 + 1\right)\right)}}\right)\\ \end{array}$
Alternative 11
Error19.5
Cost9924
$\begin{array}{l} t_0 := \left(1 + NN \cdot 2\right) \cdot \left(NN \cdot 2 + -1\right)\\ t_1 := NN + \left(N1 - N\right)\\ t_2 := \frac{NN}{NN + \left(\left(N1 + N\right) + 1\right)}\\ t_3 := N + \left(1 + \left(N1 - NN\right)\right)\\ \mathbf{if}\;NN \leq 2 \cdot 10^{-147}:\\ \;\;\;\;t_0 \cdot \sqrt{t_2 \cdot \left(\frac{\frac{NN}{MM}}{t_1 \cdot \left(\left(N - \left(N1 - NN\right)\right) \cdot t_3\right)} \cdot \frac{-4}{NN + MM}\right)}\\ \mathbf{else}:\\ \;\;\;\;t_0 \cdot \sqrt{t_2 \cdot \left(\frac{4}{NN + MM} \cdot \frac{NN}{t_3 \cdot \left(\left(NN + \left(N - N1\right)\right) \cdot \left(\left(NN - MM\right) \cdot t_1\right)\right)}\right)}\\ \end{array}$
Alternative 12
Error35.1
Cost9808
$\begin{array}{l} t_0 := N - \left(NN + -1\right)\\ t_1 := \left(1 + NN \cdot 2\right) \cdot \left(NN \cdot 2 + -1\right)\\ t_2 := t_1 \cdot \sqrt{\frac{NN}{NN + \left(\left(N1 + N\right) + 1\right)} \cdot \left(\frac{NN}{MM \cdot \left(\left(N1 - N\right) \cdot \left(\left(N - N1\right) \cdot \left(N + \left(N1 + 1\right)\right)\right)\right)} \cdot \frac{-4}{NN + MM}\right)}\\ t_3 := N + \left(NN + 1\right)\\ \mathbf{if}\;N \leq 1.9 \cdot 10^{-113}:\\ \;\;\;\;t_1 \cdot \sqrt{\frac{\frac{4}{NN + N1}}{\left(\left(NN - N1\right) \cdot \left(NN + \left(N1 + 1\right)\right)\right) \cdot \left(1 + \left(N1 - NN\right)\right)}}\\ \mathbf{elif}\;N \leq 4.9 \cdot 10^{-96}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;N \leq 6.5 \cdot 10^{-62}:\\ \;\;\;\;t_1 \cdot \left(2 \cdot \left(NN \cdot \sqrt{\frac{1}{t_3 \cdot \left(\left(NN + MM\right) \cdot \left(\left(\left(NN + N\right) \cdot \left(NN - N\right)\right) \cdot \left(\left(NN - MM\right) \cdot t_0\right)\right)\right)}}\right)\right)\\ \mathbf{elif}\;N \leq 3.9 \cdot 10^{-21}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_1 \cdot \left(2 \cdot \left(NN \cdot \sqrt{\frac{1}{t_3 \cdot \left(\left(\left(NN + MM\right) \cdot \left(NN - N\right)\right) \cdot \left(t_0 \cdot \left(\left(NN - MM\right) \cdot \left(NN + N\right)\right)\right)\right)}}\right)\right)\\ \end{array}$
Alternative 13
Error22.5
Cost9796
$\begin{array}{l} t_0 := \frac{NN}{NN + \left(\left(N1 + N\right) + 1\right)}\\ t_1 := \left(1 + NN \cdot 2\right) \cdot \left(NN \cdot 2 + -1\right)\\ \mathbf{if}\;NN \leq 1.8 \cdot 10^{-146}:\\ \;\;\;\;t_1 \cdot \sqrt{t_0 \cdot \left(\frac{\frac{NN}{MM}}{\left(NN + \left(N1 - N\right)\right) \cdot \left(\left(N - \left(N1 - NN\right)\right) \cdot \left(N + \left(1 + \left(N1 - NN\right)\right)\right)\right)} \cdot \frac{-4}{NN + MM}\right)}\\ \mathbf{else}:\\ \;\;\;\;t_1 \cdot \sqrt{t_0 \cdot \left(\frac{4}{NN + MM} \cdot \frac{NN}{\left(N - NN\right) \cdot \left(\left(NN + N\right) \cdot \left(\left(N - \left(NN + -1\right)\right) \cdot \left(MM - NN\right)\right)\right)}\right)}\\ \end{array}$
Alternative 14
Error33.6
Cost9540
$\begin{array}{l} t_0 := N - \left(NN + -1\right)\\ t_1 := \left(1 + NN \cdot 2\right) \cdot \left(NN \cdot 2 + -1\right)\\ \mathbf{if}\;MM \leq 2.7 \cdot 10^{-59}:\\ \;\;\;\;t_1 \cdot \sqrt{\frac{NN}{NN + \left(\left(N1 + N\right) + 1\right)} \cdot \left(\frac{4}{NN + MM} \cdot \frac{NN}{\left(N - NN\right) \cdot \left(\left(NN + N\right) \cdot \left(t_0 \cdot \left(MM - NN\right)\right)\right)}\right)}\\ \mathbf{else}:\\ \;\;\;\;t_1 \cdot \left(2 \cdot \left(NN \cdot \sqrt{\frac{1}{\left(N + \left(NN + 1\right)\right) \cdot \left(\left(NN + MM\right) \cdot \left(\left(\left(NN + N\right) \cdot \left(NN - N\right)\right) \cdot \left(\left(NN - MM\right) \cdot t_0\right)\right)\right)}}\right)\right)\\ \end{array}$
Alternative 15
Error35.4
Cost9412
$\begin{array}{l} t_0 := 1 + NN \cdot 2\\ \mathbf{if}\;N \leq 1.6 \cdot 10^{-113}:\\ \;\;\;\;\left(t_0 \cdot \left(NN \cdot 2 + -1\right)\right) \cdot \sqrt{\frac{\frac{4}{NN + N1}}{\left(\left(NN - N1\right) \cdot \left(NN + \left(N1 + 1\right)\right)\right) \cdot \left(1 + \left(N1 - NN\right)\right)}}\\ \mathbf{else}:\\ \;\;\;\;\left(\left(NN \cdot \sqrt{\frac{1}{\left(N + \left(NN + 1\right)\right) \cdot \left(\left(NN + MM\right) \cdot \left(\left(N - NN\right) \cdot \left(\left(NN + N\right) \cdot \left(\left(\left(N + 1\right) - NN\right) \cdot \left(MM - NN\right)\right)\right)\right)\right)}}\right) \cdot -2\right) \cdot \left(t_0 \cdot \left(1 + NN \cdot -2\right)\right)\\ \end{array}$
Alternative 16
Error35.4
Cost9412
$\begin{array}{l} t_0 := \left(1 + NN \cdot 2\right) \cdot \left(NN \cdot 2 + -1\right)\\ \mathbf{if}\;N \leq 1.6 \cdot 10^{-113}:\\ \;\;\;\;t_0 \cdot \sqrt{\frac{\frac{4}{NN + N1}}{\left(\left(NN - N1\right) \cdot \left(NN + \left(N1 + 1\right)\right)\right) \cdot \left(1 + \left(N1 - NN\right)\right)}}\\ \mathbf{else}:\\ \;\;\;\;t_0 \cdot \left(2 \cdot \left(NN \cdot \sqrt{\frac{1}{\left(N + \left(NN + 1\right)\right) \cdot \left(\left(\left(NN + MM\right) \cdot \left(NN - N\right)\right) \cdot \left(\left(N - \left(NN + -1\right)\right) \cdot \left(\left(NN - MM\right) \cdot \left(NN + N\right)\right)\right)\right)}}\right)\right)\\ \end{array}$
Alternative 17
Error35.4
Cost9412
$\begin{array}{l} t_0 := \left(1 + NN \cdot 2\right) \cdot \left(NN \cdot 2 + -1\right)\\ \mathbf{if}\;N \leq 2.15 \cdot 10^{-113}:\\ \;\;\;\;t_0 \cdot \sqrt{\frac{\frac{4}{NN + N1}}{\left(\left(NN - N1\right) \cdot \left(NN + \left(N1 + 1\right)\right)\right) \cdot \left(1 + \left(N1 - NN\right)\right)}}\\ \mathbf{else}:\\ \;\;\;\;t_0 \cdot \left(2 \cdot \left(NN \cdot \sqrt{\frac{1}{\left(N + \left(NN + 1\right)\right) \cdot \left(\left(NN + MM\right) \cdot \left(\left(\left(NN + N\right) \cdot \left(NN - N\right)\right) \cdot \left(\left(NN - MM\right) \cdot \left(N - \left(NN + -1\right)\right)\right)\right)\right)}}\right)\right)\\ \end{array}$
Alternative 18
Error42.7
Cost8512
$\left(\left(1 + NN \cdot 2\right) \cdot \left(NN \cdot 2 + -1\right)\right) \cdot \sqrt{\frac{4}{\left(\left(NN - N1\right) \cdot \left(\left(N1 + 1\right) - NN\right)\right) \cdot \left(\left(NN + N1\right) \cdot \left(NN + \left(N1 + 1\right)\right)\right)}}$
Alternative 19
Error42.7
Cost8512
$\left(\left(1 + NN \cdot 2\right) \cdot \left(NN \cdot 2 + -1\right)\right) \cdot \sqrt{\frac{\frac{4}{NN + N1}}{\left(\left(NN - N1\right) \cdot \left(NN + \left(N1 + 1\right)\right)\right) \cdot \left(1 + \left(N1 - NN\right)\right)}}$
Alternative 20
Error63.7
Cost8256
$\left(\left(1 + NN \cdot 2\right) \cdot \left(NN \cdot 2 + -1\right)\right) \cdot \sqrt{\frac{4}{\left(\left(NN + N1\right) - N\right) \cdot \left(\left(\left(NN + N\right) - N1\right) \cdot \left(N \cdot N\right)\right)}}$
Alternative 21
Error64.0
Cost7616
$\left(\left(1 + NN \cdot 2\right) \cdot \left(1 + NN \cdot -2\right)\right) \cdot \frac{\sqrt{-1} \cdot -2}{NN \cdot NN}$

# Reproduce?

herbie shell --seed 1
(FPCore (NN MM N1 N)
:name "sqrt((4*NN*NN)/((NN+MM)*(NN-MM)*(N1-N+NN)*(N-N1+NN)*(N+N1-NN+1)*(N+N1+NN+1)))*((2*NN+1)*(2*NN-1))"
:precision binary64
:pre (and (and (and (and (<= 0.0 NN) (<= NN 1000.0)) (and (<= 0.0 MM) (<= MM 1000.0))) (and (<= 0.0 N1) (<= N1 1000.0))) (and (<= 0.0 N) (<= N 1000.0)))
(* (sqrt (/ (* (* 4.0 NN) NN) (* (* (* (* (* (+ NN MM) (- NN MM)) (+ (- N1 N) NN)) (+ (- N N1) NN)) (+ (- (+ N N1) NN) 1.0)) (+ (+ (+ N N1) NN) 1.0)))) (* (+ (* 2.0 NN) 1.0) (- (* 2.0 NN) 1.0))))