ABCF->ab-angle a

Percentage Accurate: 19.9% → 51.6%
Time: 21.7s
Alternatives: 14
Speedup: 6.0×

Specification

?
\[\begin{array}{l} \\ \begin{array}{l} t_0 := {B}^{2} - \left(4 \cdot A\right) \cdot C\\ \frac{-\sqrt{\left(2 \cdot \left(t\_0 \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{t\_0} \end{array} \end{array} \]
(FPCore (A B C F)
 :precision binary64
 (let* ((t_0 (- (pow B 2.0) (* (* 4.0 A) C))))
   (/
    (-
     (sqrt
      (*
       (* 2.0 (* t_0 F))
       (+ (+ A C) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0)))))))
    t_0)))
double code(double A, double B, double C, double F) {
	double t_0 = pow(B, 2.0) - ((4.0 * A) * C);
	return -sqrt(((2.0 * (t_0 * F)) * ((A + C) + sqrt((pow((A - C), 2.0) + pow(B, 2.0)))))) / t_0;
}
real(8) function code(a, b, c, f)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8), intent (in) :: f
    real(8) :: t_0
    t_0 = (b ** 2.0d0) - ((4.0d0 * a) * c)
    code = -sqrt(((2.0d0 * (t_0 * f)) * ((a + c) + sqrt((((a - c) ** 2.0d0) + (b ** 2.0d0)))))) / t_0
end function
public static double code(double A, double B, double C, double F) {
	double t_0 = Math.pow(B, 2.0) - ((4.0 * A) * C);
	return -Math.sqrt(((2.0 * (t_0 * F)) * ((A + C) + Math.sqrt((Math.pow((A - C), 2.0) + Math.pow(B, 2.0)))))) / t_0;
}
def code(A, B, C, F):
	t_0 = math.pow(B, 2.0) - ((4.0 * A) * C)
	return -math.sqrt(((2.0 * (t_0 * F)) * ((A + C) + math.sqrt((math.pow((A - C), 2.0) + math.pow(B, 2.0)))))) / t_0
function code(A, B, C, F)
	t_0 = Float64((B ^ 2.0) - Float64(Float64(4.0 * A) * C))
	return Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_0 * F)) * Float64(Float64(A + C) + sqrt(Float64((Float64(A - C) ^ 2.0) + (B ^ 2.0))))))) / t_0)
end
function tmp = code(A, B, C, F)
	t_0 = (B ^ 2.0) - ((4.0 * A) * C);
	tmp = -sqrt(((2.0 * (t_0 * F)) * ((A + C) + sqrt((((A - C) ^ 2.0) + (B ^ 2.0)))))) / t_0;
end
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[Power[B, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$0 * F), $MachinePrecision]), $MachinePrecision] * N[(N[(A + C), $MachinePrecision] + N[Sqrt[N[(N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[B, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := {B}^{2} - \left(4 \cdot A\right) \cdot C\\
\frac{-\sqrt{\left(2 \cdot \left(t\_0 \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{t\_0}
\end{array}
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 14 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 19.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {B}^{2} - \left(4 \cdot A\right) \cdot C\\ \frac{-\sqrt{\left(2 \cdot \left(t\_0 \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{t\_0} \end{array} \end{array} \]
(FPCore (A B C F)
 :precision binary64
 (let* ((t_0 (- (pow B 2.0) (* (* 4.0 A) C))))
   (/
    (-
     (sqrt
      (*
       (* 2.0 (* t_0 F))
       (+ (+ A C) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0)))))))
    t_0)))
double code(double A, double B, double C, double F) {
	double t_0 = pow(B, 2.0) - ((4.0 * A) * C);
	return -sqrt(((2.0 * (t_0 * F)) * ((A + C) + sqrt((pow((A - C), 2.0) + pow(B, 2.0)))))) / t_0;
}
real(8) function code(a, b, c, f)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8), intent (in) :: f
    real(8) :: t_0
    t_0 = (b ** 2.0d0) - ((4.0d0 * a) * c)
    code = -sqrt(((2.0d0 * (t_0 * f)) * ((a + c) + sqrt((((a - c) ** 2.0d0) + (b ** 2.0d0)))))) / t_0
end function
public static double code(double A, double B, double C, double F) {
	double t_0 = Math.pow(B, 2.0) - ((4.0 * A) * C);
	return -Math.sqrt(((2.0 * (t_0 * F)) * ((A + C) + Math.sqrt((Math.pow((A - C), 2.0) + Math.pow(B, 2.0)))))) / t_0;
}
def code(A, B, C, F):
	t_0 = math.pow(B, 2.0) - ((4.0 * A) * C)
	return -math.sqrt(((2.0 * (t_0 * F)) * ((A + C) + math.sqrt((math.pow((A - C), 2.0) + math.pow(B, 2.0)))))) / t_0
function code(A, B, C, F)
	t_0 = Float64((B ^ 2.0) - Float64(Float64(4.0 * A) * C))
	return Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_0 * F)) * Float64(Float64(A + C) + sqrt(Float64((Float64(A - C) ^ 2.0) + (B ^ 2.0))))))) / t_0)
end
function tmp = code(A, B, C, F)
	t_0 = (B ^ 2.0) - ((4.0 * A) * C);
	tmp = -sqrt(((2.0 * (t_0 * F)) * ((A + C) + sqrt((((A - C) ^ 2.0) + (B ^ 2.0)))))) / t_0;
end
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[Power[B, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$0 * F), $MachinePrecision]), $MachinePrecision] * N[(N[(A + C), $MachinePrecision] + N[Sqrt[N[(N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[B, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := {B}^{2} - \left(4 \cdot A\right) \cdot C\\
\frac{-\sqrt{\left(2 \cdot \left(t\_0 \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{t\_0}
\end{array}
\end{array}

Alternative 1: 51.6% accurate, 1.4× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ [A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\ \\ \begin{array}{l} t_0 := A \cdot \left(C \cdot -4\right)\\ t_1 := \mathsf{fma}\left(B\_m, B\_m, t\_0\right)\\ t_2 := -t\_1\\ t_3 := \mathsf{hypot}\left(B\_m, A - C\right)\\ \mathbf{if}\;B\_m \leq 1.16 \cdot 10^{-221}:\\ \;\;\;\;\frac{-1}{\frac{\mathsf{hypot}\left(B\_m, \sqrt{t\_0}\right)}{\sqrt{4 \cdot F} \cdot \sqrt{C}}}\\ \mathbf{elif}\;B\_m \leq 5.4 \cdot 10^{-69}:\\ \;\;\;\;\frac{\sqrt{t\_1 \cdot \left(F \cdot \left(4 \cdot C\right)\right)}}{t\_2}\\ \mathbf{elif}\;B\_m \leq 7.2 \cdot 10^{+87}:\\ \;\;\;\;\frac{\sqrt{\left(F \cdot t\_1\right) \cdot \left(2 \cdot \left(A + \left(C + t\_3\right)\right)\right)}}{t\_2}\\ \mathbf{elif}\;B\_m \leq 5 \cdot 10^{+149}:\\ \;\;\;\;\sqrt{2} \cdot \left(-\sqrt{F \cdot \frac{\left(A + C\right) + t\_3}{{B\_m}^{2}}}\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{2} \cdot \frac{\sqrt{F}}{-\sqrt{B\_m}}\\ \end{array} \end{array} \]
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
 :precision binary64
 (let* ((t_0 (* A (* C -4.0)))
        (t_1 (fma B_m B_m t_0))
        (t_2 (- t_1))
        (t_3 (hypot B_m (- A C))))
   (if (<= B_m 1.16e-221)
     (/ -1.0 (/ (hypot B_m (sqrt t_0)) (* (sqrt (* 4.0 F)) (sqrt C))))
     (if (<= B_m 5.4e-69)
       (/ (sqrt (* t_1 (* F (* 4.0 C)))) t_2)
       (if (<= B_m 7.2e+87)
         (/ (sqrt (* (* F t_1) (* 2.0 (+ A (+ C t_3))))) t_2)
         (if (<= B_m 5e+149)
           (* (sqrt 2.0) (- (sqrt (* F (/ (+ (+ A C) t_3) (pow B_m 2.0))))))
           (* (sqrt 2.0) (/ (sqrt F) (- (sqrt B_m))))))))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
	double t_0 = A * (C * -4.0);
	double t_1 = fma(B_m, B_m, t_0);
	double t_2 = -t_1;
	double t_3 = hypot(B_m, (A - C));
	double tmp;
	if (B_m <= 1.16e-221) {
		tmp = -1.0 / (hypot(B_m, sqrt(t_0)) / (sqrt((4.0 * F)) * sqrt(C)));
	} else if (B_m <= 5.4e-69) {
		tmp = sqrt((t_1 * (F * (4.0 * C)))) / t_2;
	} else if (B_m <= 7.2e+87) {
		tmp = sqrt(((F * t_1) * (2.0 * (A + (C + t_3))))) / t_2;
	} else if (B_m <= 5e+149) {
		tmp = sqrt(2.0) * -sqrt((F * (((A + C) + t_3) / pow(B_m, 2.0))));
	} else {
		tmp = sqrt(2.0) * (sqrt(F) / -sqrt(B_m));
	}
	return tmp;
}
B_m = abs(B)
A, B_m, C, F = sort([A, B_m, C, F])
function code(A, B_m, C, F)
	t_0 = Float64(A * Float64(C * -4.0))
	t_1 = fma(B_m, B_m, t_0)
	t_2 = Float64(-t_1)
	t_3 = hypot(B_m, Float64(A - C))
	tmp = 0.0
	if (B_m <= 1.16e-221)
		tmp = Float64(-1.0 / Float64(hypot(B_m, sqrt(t_0)) / Float64(sqrt(Float64(4.0 * F)) * sqrt(C))));
	elseif (B_m <= 5.4e-69)
		tmp = Float64(sqrt(Float64(t_1 * Float64(F * Float64(4.0 * C)))) / t_2);
	elseif (B_m <= 7.2e+87)
		tmp = Float64(sqrt(Float64(Float64(F * t_1) * Float64(2.0 * Float64(A + Float64(C + t_3))))) / t_2);
	elseif (B_m <= 5e+149)
		tmp = Float64(sqrt(2.0) * Float64(-sqrt(Float64(F * Float64(Float64(Float64(A + C) + t_3) / (B_m ^ 2.0))))));
	else
		tmp = Float64(sqrt(2.0) * Float64(sqrt(F) / Float64(-sqrt(B_m))));
	end
	return tmp
end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(B$95$m * B$95$m + t$95$0), $MachinePrecision]}, Block[{t$95$2 = (-t$95$1)}, Block[{t$95$3 = N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]}, If[LessEqual[B$95$m, 1.16e-221], N[(-1.0 / N[(N[Sqrt[B$95$m ^ 2 + N[Sqrt[t$95$0], $MachinePrecision] ^ 2], $MachinePrecision] / N[(N[Sqrt[N[(4.0 * F), $MachinePrecision]], $MachinePrecision] * N[Sqrt[C], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B$95$m, 5.4e-69], N[(N[Sqrt[N[(t$95$1 * N[(F * N[(4.0 * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$2), $MachinePrecision], If[LessEqual[B$95$m, 7.2e+87], N[(N[Sqrt[N[(N[(F * t$95$1), $MachinePrecision] * N[(2.0 * N[(A + N[(C + t$95$3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$2), $MachinePrecision], If[LessEqual[B$95$m, 5e+149], N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F * N[(N[(N[(A + C), $MachinePrecision] + t$95$3), $MachinePrecision] / N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * N[(N[Sqrt[F], $MachinePrecision] / (-N[Sqrt[B$95$m], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := A \cdot \left(C \cdot -4\right)\\
t_1 := \mathsf{fma}\left(B\_m, B\_m, t\_0\right)\\
t_2 := -t\_1\\
t_3 := \mathsf{hypot}\left(B\_m, A - C\right)\\
\mathbf{if}\;B\_m \leq 1.16 \cdot 10^{-221}:\\
\;\;\;\;\frac{-1}{\frac{\mathsf{hypot}\left(B\_m, \sqrt{t\_0}\right)}{\sqrt{4 \cdot F} \cdot \sqrt{C}}}\\

\mathbf{elif}\;B\_m \leq 5.4 \cdot 10^{-69}:\\
\;\;\;\;\frac{\sqrt{t\_1 \cdot \left(F \cdot \left(4 \cdot C\right)\right)}}{t\_2}\\

\mathbf{elif}\;B\_m \leq 7.2 \cdot 10^{+87}:\\
\;\;\;\;\frac{\sqrt{\left(F \cdot t\_1\right) \cdot \left(2 \cdot \left(A + \left(C + t\_3\right)\right)\right)}}{t\_2}\\

\mathbf{elif}\;B\_m \leq 5 \cdot 10^{+149}:\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{F \cdot \frac{\left(A + C\right) + t\_3}{{B\_m}^{2}}}\right)\\

\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \frac{\sqrt{F}}{-\sqrt{B\_m}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if B < 1.1600000000000001e-221

    1. Initial program 21.7%

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Simplified24.6%

      \[\leadsto \color{blue}{\frac{\sqrt{\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot F\right) \cdot \left(2 \cdot \left(A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}} \]
    3. Add Preprocessing
    4. Taylor expanded in A around -inf 10.8%

      \[\leadsto \frac{\sqrt{\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot F\right) \cdot \color{blue}{\left(4 \cdot C\right)}}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
    5. Step-by-step derivation
      1. *-commutative10.8%

        \[\leadsto \frac{\sqrt{\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot F\right) \cdot \color{blue}{\left(C \cdot 4\right)}}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
    6. Simplified10.8%

      \[\leadsto \frac{\sqrt{\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot F\right) \cdot \color{blue}{\left(C \cdot 4\right)}}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
    7. Step-by-step derivation
      1. clear-num10.8%

        \[\leadsto \color{blue}{\frac{1}{\frac{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot F\right) \cdot \left(C \cdot 4\right)}}}} \]
      2. inv-pow10.8%

        \[\leadsto \color{blue}{{\left(\frac{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot F\right) \cdot \left(C \cdot 4\right)}}\right)}^{-1}} \]
      3. associate-*l*11.5%

        \[\leadsto {\left(\frac{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\color{blue}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}}\right)}^{-1} \]
    8. Applied egg-rr11.5%

      \[\leadsto \color{blue}{{\left(\frac{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}\right)}^{-1}} \]
    9. Step-by-step derivation
      1. unpow-111.5%

        \[\leadsto \color{blue}{\frac{1}{\frac{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}}} \]
    10. Simplified11.5%

      \[\leadsto \color{blue}{\frac{1}{\frac{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}}} \]
    11. Step-by-step derivation
      1. neg-sub011.5%

        \[\leadsto \frac{1}{\frac{\color{blue}{0 - \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}} \]
      2. metadata-eval11.5%

        \[\leadsto \frac{1}{\frac{\color{blue}{\log 1} - \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}} \]
      3. div-sub9.1%

        \[\leadsto \frac{1}{\color{blue}{\frac{\log 1}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}} - \frac{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}}} \]
      4. metadata-eval9.1%

        \[\leadsto \frac{1}{\frac{\color{blue}{0}}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}} - \frac{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}} \]
      5. *-commutative9.1%

        \[\leadsto \frac{1}{\frac{0}{\sqrt{\color{blue}{\left(F \cdot \left(C \cdot 4\right)\right) \cdot \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}}} - \frac{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}} \]
      6. sqrt-prod4.9%

        \[\leadsto \frac{1}{\frac{0}{\color{blue}{\sqrt{F \cdot \left(C \cdot 4\right)} \cdot \sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}}} - \frac{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}} \]
      7. fma-undefine4.9%

        \[\leadsto \frac{1}{\frac{0}{\sqrt{F \cdot \left(C \cdot 4\right)} \cdot \sqrt{\color{blue}{B \cdot B + A \cdot \left(C \cdot -4\right)}}} - \frac{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}} \]
      8. add-sqr-sqrt4.7%

        \[\leadsto \frac{1}{\frac{0}{\sqrt{F \cdot \left(C \cdot 4\right)} \cdot \sqrt{B \cdot B + \color{blue}{\sqrt{A \cdot \left(C \cdot -4\right)} \cdot \sqrt{A \cdot \left(C \cdot -4\right)}}}} - \frac{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}} \]
      9. hypot-define4.7%

        \[\leadsto \frac{1}{\frac{0}{\sqrt{F \cdot \left(C \cdot 4\right)} \cdot \color{blue}{\mathsf{hypot}\left(B, \sqrt{A \cdot \left(C \cdot -4\right)}\right)}} - \frac{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}} \]
      10. associate-*r*4.7%

        \[\leadsto \frac{1}{\frac{0}{\sqrt{F \cdot \left(C \cdot 4\right)} \cdot \mathsf{hypot}\left(B, \sqrt{\color{blue}{\left(A \cdot C\right) \cdot -4}}\right)} - \frac{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}} \]
    12. Applied egg-rr7.3%

      \[\leadsto \frac{1}{\color{blue}{\frac{0}{\sqrt{F \cdot \left(C \cdot 4\right)} \cdot \mathsf{hypot}\left(B, \sqrt{\left(A \cdot C\right) \cdot -4}\right)} - \frac{\mathsf{fma}\left(B, B, \left(A \cdot C\right) \cdot -4\right)}{\sqrt{F \cdot \left(C \cdot 4\right)} \cdot \mathsf{hypot}\left(B, \sqrt{\left(A \cdot C\right) \cdot -4}\right)}}} \]
    13. Step-by-step derivation
      1. div09.5%

        \[\leadsto \frac{1}{\color{blue}{0} - \frac{\mathsf{fma}\left(B, B, \left(A \cdot C\right) \cdot -4\right)}{\sqrt{F \cdot \left(C \cdot 4\right)} \cdot \mathsf{hypot}\left(B, \sqrt{\left(A \cdot C\right) \cdot -4}\right)}} \]
      2. neg-sub09.6%

        \[\leadsto \frac{1}{\color{blue}{-\frac{\mathsf{fma}\left(B, B, \left(A \cdot C\right) \cdot -4\right)}{\sqrt{F \cdot \left(C \cdot 4\right)} \cdot \mathsf{hypot}\left(B, \sqrt{\left(A \cdot C\right) \cdot -4}\right)}}} \]
    14. Simplified10.5%

      \[\leadsto \frac{1}{\color{blue}{-\frac{\mathsf{hypot}\left(B, \sqrt{A \cdot \left(C \cdot -4\right)}\right)}{\sqrt{F \cdot \left(4 \cdot C\right)}}}} \]
    15. Step-by-step derivation
      1. pow1/210.5%

        \[\leadsto \frac{1}{-\frac{\mathsf{hypot}\left(B, \sqrt{A \cdot \left(C \cdot -4\right)}\right)}{\color{blue}{{\left(F \cdot \left(4 \cdot C\right)\right)}^{0.5}}}} \]
      2. associate-*r*10.5%

        \[\leadsto \frac{1}{-\frac{\mathsf{hypot}\left(B, \sqrt{A \cdot \left(C \cdot -4\right)}\right)}{{\color{blue}{\left(\left(F \cdot 4\right) \cdot C\right)}}^{0.5}}} \]
      3. unpow-prod-down11.2%

        \[\leadsto \frac{1}{-\frac{\mathsf{hypot}\left(B, \sqrt{A \cdot \left(C \cdot -4\right)}\right)}{\color{blue}{{\left(F \cdot 4\right)}^{0.5} \cdot {C}^{0.5}}}} \]
      4. pow1/211.2%

        \[\leadsto \frac{1}{-\frac{\mathsf{hypot}\left(B, \sqrt{A \cdot \left(C \cdot -4\right)}\right)}{{\left(F \cdot 4\right)}^{0.5} \cdot \color{blue}{\sqrt{C}}}} \]
    16. Applied egg-rr11.2%

      \[\leadsto \frac{1}{-\frac{\mathsf{hypot}\left(B, \sqrt{A \cdot \left(C \cdot -4\right)}\right)}{\color{blue}{{\left(F \cdot 4\right)}^{0.5} \cdot \sqrt{C}}}} \]
    17. Step-by-step derivation
      1. unpow1/211.2%

        \[\leadsto \frac{1}{-\frac{\mathsf{hypot}\left(B, \sqrt{A \cdot \left(C \cdot -4\right)}\right)}{\color{blue}{\sqrt{F \cdot 4}} \cdot \sqrt{C}}} \]
    18. Simplified11.2%

      \[\leadsto \frac{1}{-\frac{\mathsf{hypot}\left(B, \sqrt{A \cdot \left(C \cdot -4\right)}\right)}{\color{blue}{\sqrt{F \cdot 4} \cdot \sqrt{C}}}} \]

    if 1.1600000000000001e-221 < B < 5.3999999999999995e-69

    1. Initial program 31.7%

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Simplified36.4%

      \[\leadsto \color{blue}{\frac{\sqrt{\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot F\right) \cdot \left(2 \cdot \left(A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}} \]
    3. Add Preprocessing
    4. Taylor expanded in A around -inf 8.2%

      \[\leadsto \frac{\sqrt{\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot F\right) \cdot \color{blue}{\left(4 \cdot C\right)}}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
    5. Step-by-step derivation
      1. *-commutative8.2%

        \[\leadsto \frac{\sqrt{\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot F\right) \cdot \color{blue}{\left(C \cdot 4\right)}}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
    6. Simplified8.2%

      \[\leadsto \frac{\sqrt{\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot F\right) \cdot \color{blue}{\left(C \cdot 4\right)}}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
    7. Step-by-step derivation
      1. *-un-lft-identity8.2%

        \[\leadsto \frac{\color{blue}{1 \cdot \sqrt{\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot F\right) \cdot \left(C \cdot 4\right)}}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
      2. associate-*l*11.1%

        \[\leadsto \frac{1 \cdot \sqrt{\color{blue}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
    8. Applied egg-rr11.1%

      \[\leadsto \frac{\color{blue}{1 \cdot \sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
    9. Step-by-step derivation
      1. *-lft-identity11.1%

        \[\leadsto \frac{\color{blue}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
    10. Simplified11.1%

      \[\leadsto \frac{\color{blue}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]

    if 5.3999999999999995e-69 < B < 7.19999999999999988e87

    1. Initial program 33.1%

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Simplified47.6%

      \[\leadsto \color{blue}{\frac{\sqrt{\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot F\right) \cdot \left(2 \cdot \left(A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}} \]
    3. Add Preprocessing

    if 7.19999999999999988e87 < B < 4.9999999999999999e149

    1. Initial program 27.8%

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Add Preprocessing
    3. Taylor expanded in F around 0 21.6%

      \[\leadsto \color{blue}{-1 \cdot \left(\sqrt{\frac{F \cdot \left(A + \left(C + \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right)\right)}{{B}^{2} - 4 \cdot \left(A \cdot C\right)}} \cdot \sqrt{2}\right)} \]
    4. Simplified48.8%

      \[\leadsto \color{blue}{-\sqrt{2} \cdot \sqrt{F \cdot \frac{\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)}}} \]
    5. Taylor expanded in C around 0 48.8%

      \[\leadsto -\sqrt{2} \cdot \sqrt{F \cdot \frac{\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)}{\color{blue}{{B}^{2}}}} \]

    if 4.9999999999999999e149 < B

    1. Initial program 0.0%

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Add Preprocessing
    3. Taylor expanded in B around inf 44.3%

      \[\leadsto \color{blue}{-1 \cdot \left(\sqrt{\frac{F}{B}} \cdot \sqrt{2}\right)} \]
    4. Step-by-step derivation
      1. mul-1-neg44.3%

        \[\leadsto \color{blue}{-\sqrt{\frac{F}{B}} \cdot \sqrt{2}} \]
      2. *-commutative44.3%

        \[\leadsto -\color{blue}{\sqrt{2} \cdot \sqrt{\frac{F}{B}}} \]
    5. Simplified44.3%

      \[\leadsto \color{blue}{-\sqrt{2} \cdot \sqrt{\frac{F}{B}}} \]
    6. Step-by-step derivation
      1. sqrt-div66.9%

        \[\leadsto -\sqrt{2} \cdot \color{blue}{\frac{\sqrt{F}}{\sqrt{B}}} \]
    7. Applied egg-rr66.9%

      \[\leadsto -\sqrt{2} \cdot \color{blue}{\frac{\sqrt{F}}{\sqrt{B}}} \]
  3. Recombined 5 regimes into one program.
  4. Final simplification22.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;B \leq 1.16 \cdot 10^{-221}:\\ \;\;\;\;\frac{-1}{\frac{\mathsf{hypot}\left(B, \sqrt{A \cdot \left(C \cdot -4\right)}\right)}{\sqrt{4 \cdot F} \cdot \sqrt{C}}}\\ \mathbf{elif}\;B \leq 5.4 \cdot 10^{-69}:\\ \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(4 \cdot C\right)\right)}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}\\ \mathbf{elif}\;B \leq 7.2 \cdot 10^{+87}:\\ \;\;\;\;\frac{\sqrt{\left(F \cdot \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)\right) \cdot \left(2 \cdot \left(A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}\\ \mathbf{elif}\;B \leq 5 \cdot 10^{+149}:\\ \;\;\;\;\sqrt{2} \cdot \left(-\sqrt{F \cdot \frac{\left(A + C\right) + \mathsf{hypot}\left(B, A - C\right)}{{B}^{2}}}\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{2} \cdot \frac{\sqrt{F}}{-\sqrt{B}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 54.5% accurate, 0.3× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ [A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\ \\ \begin{array}{l} t_0 := \frac{\left(A + C\right) + \mathsf{hypot}\left(B\_m, A - C\right)}{\mathsf{fma}\left(-4, A \cdot C, {B\_m}^{2}\right)}\\ t_1 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\ t_2 := \left(4 \cdot A\right) \cdot C\\ t_3 := \frac{\sqrt{\left(2 \cdot \left(\left({B\_m}^{2} - t\_2\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{B\_m}^{2} + {\left(A - C\right)}^{2}}\right)}}{t\_2 - {B\_m}^{2}}\\ \mathbf{if}\;t\_3 \leq -2 \cdot 10^{-228}:\\ \;\;\;\;\left(\sqrt{t\_0} \cdot \sqrt{F}\right) \cdot \left(-\sqrt{2}\right)\\ \mathbf{elif}\;t\_3 \leq 0:\\ \;\;\;\;\sqrt{F \cdot t\_0} \cdot \left(-e^{\log 2 \cdot 0.5}\right)\\ \mathbf{elif}\;t\_3 \leq \infty:\\ \;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot t\_1\right)} \cdot \sqrt{A + \left(C + \mathsf{hypot}\left(A - C, B\_m\right)\right)}}{-t\_1}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{2} \cdot \frac{\sqrt{F}}{-\sqrt{B\_m}}\\ \end{array} \end{array} \]
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
 :precision binary64
 (let* ((t_0
         (/ (+ (+ A C) (hypot B_m (- A C))) (fma -4.0 (* A C) (pow B_m 2.0))))
        (t_1 (fma B_m B_m (* A (* C -4.0))))
        (t_2 (* (* 4.0 A) C))
        (t_3
         (/
          (sqrt
           (*
            (* 2.0 (* (- (pow B_m 2.0) t_2) F))
            (+ (+ A C) (sqrt (+ (pow B_m 2.0) (pow (- A C) 2.0))))))
          (- t_2 (pow B_m 2.0)))))
   (if (<= t_3 -2e-228)
     (* (* (sqrt t_0) (sqrt F)) (- (sqrt 2.0)))
     (if (<= t_3 0.0)
       (* (sqrt (* F t_0)) (- (exp (* (log 2.0) 0.5))))
       (if (<= t_3 INFINITY)
         (/
          (* (sqrt (* 2.0 (* F t_1))) (sqrt (+ A (+ C (hypot (- A C) B_m)))))
          (- t_1))
         (* (sqrt 2.0) (/ (sqrt F) (- (sqrt B_m)))))))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
	double t_0 = ((A + C) + hypot(B_m, (A - C))) / fma(-4.0, (A * C), pow(B_m, 2.0));
	double t_1 = fma(B_m, B_m, (A * (C * -4.0)));
	double t_2 = (4.0 * A) * C;
	double t_3 = sqrt(((2.0 * ((pow(B_m, 2.0) - t_2) * F)) * ((A + C) + sqrt((pow(B_m, 2.0) + pow((A - C), 2.0)))))) / (t_2 - pow(B_m, 2.0));
	double tmp;
	if (t_3 <= -2e-228) {
		tmp = (sqrt(t_0) * sqrt(F)) * -sqrt(2.0);
	} else if (t_3 <= 0.0) {
		tmp = sqrt((F * t_0)) * -exp((log(2.0) * 0.5));
	} else if (t_3 <= ((double) INFINITY)) {
		tmp = (sqrt((2.0 * (F * t_1))) * sqrt((A + (C + hypot((A - C), B_m))))) / -t_1;
	} else {
		tmp = sqrt(2.0) * (sqrt(F) / -sqrt(B_m));
	}
	return tmp;
}
B_m = abs(B)
A, B_m, C, F = sort([A, B_m, C, F])
function code(A, B_m, C, F)
	t_0 = Float64(Float64(Float64(A + C) + hypot(B_m, Float64(A - C))) / fma(-4.0, Float64(A * C), (B_m ^ 2.0)))
	t_1 = fma(B_m, B_m, Float64(A * Float64(C * -4.0)))
	t_2 = Float64(Float64(4.0 * A) * C)
	t_3 = Float64(sqrt(Float64(Float64(2.0 * Float64(Float64((B_m ^ 2.0) - t_2) * F)) * Float64(Float64(A + C) + sqrt(Float64((B_m ^ 2.0) + (Float64(A - C) ^ 2.0)))))) / Float64(t_2 - (B_m ^ 2.0)))
	tmp = 0.0
	if (t_3 <= -2e-228)
		tmp = Float64(Float64(sqrt(t_0) * sqrt(F)) * Float64(-sqrt(2.0)));
	elseif (t_3 <= 0.0)
		tmp = Float64(sqrt(Float64(F * t_0)) * Float64(-exp(Float64(log(2.0) * 0.5))));
	elseif (t_3 <= Inf)
		tmp = Float64(Float64(sqrt(Float64(2.0 * Float64(F * t_1))) * sqrt(Float64(A + Float64(C + hypot(Float64(A - C), B_m))))) / Float64(-t_1));
	else
		tmp = Float64(sqrt(2.0) * Float64(sqrt(F) / Float64(-sqrt(B_m))));
	end
	return tmp
end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(N[(N[(A + C), $MachinePrecision] + N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] / N[(-4.0 * N[(A * C), $MachinePrecision] + N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]}, Block[{t$95$3 = N[(N[Sqrt[N[(N[(2.0 * N[(N[(N[Power[B$95$m, 2.0], $MachinePrecision] - t$95$2), $MachinePrecision] * F), $MachinePrecision]), $MachinePrecision] * N[(N[(A + C), $MachinePrecision] + N[Sqrt[N[(N[Power[B$95$m, 2.0], $MachinePrecision] + N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(t$95$2 - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, -2e-228], N[(N[(N[Sqrt[t$95$0], $MachinePrecision] * N[Sqrt[F], $MachinePrecision]), $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision], If[LessEqual[t$95$3, 0.0], N[(N[Sqrt[N[(F * t$95$0), $MachinePrecision]], $MachinePrecision] * (-N[Exp[N[(N[Log[2.0], $MachinePrecision] * 0.5), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[t$95$3, Infinity], N[(N[(N[Sqrt[N[(2.0 * N[(F * t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(A + N[(C + N[Sqrt[N[(A - C), $MachinePrecision] ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / (-t$95$1)), $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * N[(N[Sqrt[F], $MachinePrecision] / (-N[Sqrt[B$95$m], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := \frac{\left(A + C\right) + \mathsf{hypot}\left(B\_m, A - C\right)}{\mathsf{fma}\left(-4, A \cdot C, {B\_m}^{2}\right)}\\
t_1 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\
t_2 := \left(4 \cdot A\right) \cdot C\\
t_3 := \frac{\sqrt{\left(2 \cdot \left(\left({B\_m}^{2} - t\_2\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{B\_m}^{2} + {\left(A - C\right)}^{2}}\right)}}{t\_2 - {B\_m}^{2}}\\
\mathbf{if}\;t\_3 \leq -2 \cdot 10^{-228}:\\
\;\;\;\;\left(\sqrt{t\_0} \cdot \sqrt{F}\right) \cdot \left(-\sqrt{2}\right)\\

\mathbf{elif}\;t\_3 \leq 0:\\
\;\;\;\;\sqrt{F \cdot t\_0} \cdot \left(-e^{\log 2 \cdot 0.5}\right)\\

\mathbf{elif}\;t\_3 \leq \infty:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot t\_1\right)} \cdot \sqrt{A + \left(C + \mathsf{hypot}\left(A - C, B\_m\right)\right)}}{-t\_1}\\

\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \frac{\sqrt{F}}{-\sqrt{B\_m}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 #s(literal 2 binary64) (*.f64 (-.f64 (pow.f64 B #s(literal 2 binary64)) (*.f64 (*.f64 #s(literal 4 binary64) A) C)) F)) (+.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64)))))))) (-.f64 (pow.f64 B #s(literal 2 binary64)) (*.f64 (*.f64 #s(literal 4 binary64) A) C))) < -2.00000000000000007e-228

    1. Initial program 48.9%

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Add Preprocessing
    3. Taylor expanded in F around 0 42.7%

      \[\leadsto \color{blue}{-1 \cdot \left(\sqrt{\frac{F \cdot \left(A + \left(C + \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right)\right)}{{B}^{2} - 4 \cdot \left(A \cdot C\right)}} \cdot \sqrt{2}\right)} \]
    4. Simplified58.8%

      \[\leadsto \color{blue}{-\sqrt{2} \cdot \sqrt{F \cdot \frac{\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)}}} \]
    5. Step-by-step derivation
      1. pow1/258.8%

        \[\leadsto -\sqrt{2} \cdot \color{blue}{{\left(F \cdot \frac{\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)}\right)}^{0.5}} \]
      2. *-commutative58.8%

        \[\leadsto -\sqrt{2} \cdot {\color{blue}{\left(\frac{\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)} \cdot F\right)}}^{0.5} \]
      3. metadata-eval58.8%

        \[\leadsto -\sqrt{2} \cdot {\left(\frac{\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)} \cdot F\right)}^{\color{blue}{\left(0.25 \cdot 2\right)}} \]
      4. unpow-prod-down78.0%

        \[\leadsto -\sqrt{2} \cdot \color{blue}{\left({\left(\frac{\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)}\right)}^{\left(0.25 \cdot 2\right)} \cdot {F}^{\left(0.25 \cdot 2\right)}\right)} \]
      5. metadata-eval78.0%

        \[\leadsto -\sqrt{2} \cdot \left({\left(\frac{\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)}\right)}^{\color{blue}{0.5}} \cdot {F}^{\left(0.25 \cdot 2\right)}\right) \]
      6. pow1/278.0%

        \[\leadsto -\sqrt{2} \cdot \left(\color{blue}{\sqrt{\frac{\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)}}} \cdot {F}^{\left(0.25 \cdot 2\right)}\right) \]
      7. metadata-eval78.0%

        \[\leadsto -\sqrt{2} \cdot \left(\sqrt{\frac{\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)}} \cdot {F}^{\color{blue}{0.5}}\right) \]
      8. pow1/278.0%

        \[\leadsto -\sqrt{2} \cdot \left(\sqrt{\frac{\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)}} \cdot \color{blue}{\sqrt{F}}\right) \]
    6. Applied egg-rr78.0%

      \[\leadsto -\sqrt{2} \cdot \color{blue}{\left(\sqrt{\frac{\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)}} \cdot \sqrt{F}\right)} \]

    if -2.00000000000000007e-228 < (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 #s(literal 2 binary64) (*.f64 (-.f64 (pow.f64 B #s(literal 2 binary64)) (*.f64 (*.f64 #s(literal 4 binary64) A) C)) F)) (+.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64)))))))) (-.f64 (pow.f64 B #s(literal 2 binary64)) (*.f64 (*.f64 #s(literal 4 binary64) A) C))) < 0.0

    1. Initial program 22.7%

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Add Preprocessing
    3. Taylor expanded in F around 0 26.5%

      \[\leadsto \color{blue}{-1 \cdot \left(\sqrt{\frac{F \cdot \left(A + \left(C + \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right)\right)}{{B}^{2} - 4 \cdot \left(A \cdot C\right)}} \cdot \sqrt{2}\right)} \]
    4. Simplified41.9%

      \[\leadsto \color{blue}{-\sqrt{2} \cdot \sqrt{F \cdot \frac{\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)}}} \]
    5. Step-by-step derivation
      1. pow1/241.9%

        \[\leadsto -\color{blue}{{2}^{0.5}} \cdot \sqrt{F \cdot \frac{\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)}} \]
      2. metadata-eval41.9%

        \[\leadsto -{2}^{\color{blue}{\left(0.25 \cdot 2\right)}} \cdot \sqrt{F \cdot \frac{\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)}} \]
      3. pow-to-exp41.9%

        \[\leadsto -\color{blue}{e^{\log 2 \cdot \left(0.25 \cdot 2\right)}} \cdot \sqrt{F \cdot \frac{\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)}} \]
      4. metadata-eval41.9%

        \[\leadsto -e^{\log 2 \cdot \color{blue}{0.5}} \cdot \sqrt{F \cdot \frac{\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)}} \]
    6. Applied egg-rr41.9%

      \[\leadsto -\color{blue}{e^{\log 2 \cdot 0.5}} \cdot \sqrt{F \cdot \frac{\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)}} \]

    if 0.0 < (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 #s(literal 2 binary64) (*.f64 (-.f64 (pow.f64 B #s(literal 2 binary64)) (*.f64 (*.f64 #s(literal 4 binary64) A) C)) F)) (+.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64)))))))) (-.f64 (pow.f64 B #s(literal 2 binary64)) (*.f64 (*.f64 #s(literal 4 binary64) A) C))) < +inf.0

    1. Initial program 49.2%

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Simplified67.7%

      \[\leadsto \color{blue}{\frac{\sqrt{\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot F\right) \cdot \left(2 \cdot \left(A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. associate-*r*67.7%

        \[\leadsto \frac{\sqrt{\color{blue}{\left(\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot F\right) \cdot 2\right) \cdot \left(A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)\right)}}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
      2. associate-+r+67.7%

        \[\leadsto \frac{\sqrt{\left(\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot F\right) \cdot 2\right) \cdot \color{blue}{\left(\left(A + C\right) + \mathsf{hypot}\left(B, A - C\right)\right)}}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
      3. hypot-undefine49.2%

        \[\leadsto \frac{\sqrt{\left(\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot F\right) \cdot 2\right) \cdot \left(\left(A + C\right) + \color{blue}{\sqrt{B \cdot B + \left(A - C\right) \cdot \left(A - C\right)}}\right)}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
      4. unpow249.2%

        \[\leadsto \frac{\sqrt{\left(\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot F\right) \cdot 2\right) \cdot \left(\left(A + C\right) + \sqrt{\color{blue}{{B}^{2}} + \left(A - C\right) \cdot \left(A - C\right)}\right)}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
      5. unpow249.2%

        \[\leadsto \frac{\sqrt{\left(\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot F\right) \cdot 2\right) \cdot \left(\left(A + C\right) + \sqrt{{B}^{2} + \color{blue}{{\left(A - C\right)}^{2}}}\right)}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
      6. +-commutative49.2%

        \[\leadsto \frac{\sqrt{\left(\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot F\right) \cdot 2\right) \cdot \left(\left(A + C\right) + \sqrt{\color{blue}{{\left(A - C\right)}^{2} + {B}^{2}}}\right)}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
      7. sqrt-prod53.7%

        \[\leadsto \frac{\color{blue}{\sqrt{\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot F\right) \cdot 2} \cdot \sqrt{\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}}}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
      8. *-commutative53.7%

        \[\leadsto \frac{\sqrt{\color{blue}{\left(F \cdot \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)\right)} \cdot 2} \cdot \sqrt{\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
      9. associate-+l+53.7%

        \[\leadsto \frac{\sqrt{\left(F \cdot \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)\right) \cdot 2} \cdot \sqrt{\color{blue}{A + \left(C + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
    5. Applied egg-rr94.9%

      \[\leadsto \frac{\color{blue}{\sqrt{\left(F \cdot \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)\right) \cdot 2} \cdot \sqrt{A + \left(C + \mathsf{hypot}\left(A - C, B\right)\right)}}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]

    if +inf.0 < (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 #s(literal 2 binary64) (*.f64 (-.f64 (pow.f64 B #s(literal 2 binary64)) (*.f64 (*.f64 #s(literal 4 binary64) A) C)) F)) (+.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64)))))))) (-.f64 (pow.f64 B #s(literal 2 binary64)) (*.f64 (*.f64 #s(literal 4 binary64) A) C)))

    1. Initial program 0.0%

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Add Preprocessing
    3. Taylor expanded in B around inf 10.9%

      \[\leadsto \color{blue}{-1 \cdot \left(\sqrt{\frac{F}{B}} \cdot \sqrt{2}\right)} \]
    4. Step-by-step derivation
      1. mul-1-neg10.9%

        \[\leadsto \color{blue}{-\sqrt{\frac{F}{B}} \cdot \sqrt{2}} \]
      2. *-commutative10.9%

        \[\leadsto -\color{blue}{\sqrt{2} \cdot \sqrt{\frac{F}{B}}} \]
    5. Simplified10.9%

      \[\leadsto \color{blue}{-\sqrt{2} \cdot \sqrt{\frac{F}{B}}} \]
    6. Step-by-step derivation
      1. sqrt-div15.3%

        \[\leadsto -\sqrt{2} \cdot \color{blue}{\frac{\sqrt{F}}{\sqrt{B}}} \]
    7. Applied egg-rr15.3%

      \[\leadsto -\sqrt{2} \cdot \color{blue}{\frac{\sqrt{F}}{\sqrt{B}}} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification44.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right)}}{\left(4 \cdot A\right) \cdot C - {B}^{2}} \leq -2 \cdot 10^{-228}:\\ \;\;\;\;\left(\sqrt{\frac{\left(A + C\right) + \mathsf{hypot}\left(B, A - C\right)}{\mathsf{fma}\left(-4, A \cdot C, {B}^{2}\right)}} \cdot \sqrt{F}\right) \cdot \left(-\sqrt{2}\right)\\ \mathbf{elif}\;\frac{\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right)}}{\left(4 \cdot A\right) \cdot C - {B}^{2}} \leq 0:\\ \;\;\;\;\sqrt{F \cdot \frac{\left(A + C\right) + \mathsf{hypot}\left(B, A - C\right)}{\mathsf{fma}\left(-4, A \cdot C, {B}^{2}\right)}} \cdot \left(-e^{\log 2 \cdot 0.5}\right)\\ \mathbf{elif}\;\frac{\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right)}}{\left(4 \cdot A\right) \cdot C - {B}^{2}} \leq \infty:\\ \;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)\right)} \cdot \sqrt{A + \left(C + \mathsf{hypot}\left(A - C, B\right)\right)}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{2} \cdot \frac{\sqrt{F}}{-\sqrt{B}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 53.0% accurate, 1.2× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ [A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\ \\ \begin{array}{l} t_0 := A \cdot \left(C \cdot -4\right)\\ t_1 := \mathsf{fma}\left(B\_m, B\_m, t\_0\right)\\ \mathbf{if}\;B\_m \leq 1.6 \cdot 10^{-221}:\\ \;\;\;\;\frac{-1}{\frac{\mathsf{hypot}\left(B\_m, \sqrt{t\_0}\right)}{\sqrt{4 \cdot F} \cdot \sqrt{C}}}\\ \mathbf{elif}\;B\_m \leq 3.2 \cdot 10^{-119}:\\ \;\;\;\;\frac{\sqrt{t\_1 \cdot \left(F \cdot \left(4 \cdot C\right)\right)}}{-t\_1}\\ \mathbf{elif}\;B\_m \leq 5.6 \cdot 10^{+147}:\\ \;\;\;\;\sqrt{F \cdot \frac{\left(A + C\right) + \mathsf{hypot}\left(B\_m, A - C\right)}{\mathsf{fma}\left(-4, A \cdot C, {B\_m}^{2}\right)}} \cdot \left(-\sqrt{2}\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{2} \cdot \frac{\sqrt{F}}{-\sqrt{B\_m}}\\ \end{array} \end{array} \]
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
 :precision binary64
 (let* ((t_0 (* A (* C -4.0))) (t_1 (fma B_m B_m t_0)))
   (if (<= B_m 1.6e-221)
     (/ -1.0 (/ (hypot B_m (sqrt t_0)) (* (sqrt (* 4.0 F)) (sqrt C))))
     (if (<= B_m 3.2e-119)
       (/ (sqrt (* t_1 (* F (* 4.0 C)))) (- t_1))
       (if (<= B_m 5.6e+147)
         (*
          (sqrt
           (*
            F
            (/
             (+ (+ A C) (hypot B_m (- A C)))
             (fma -4.0 (* A C) (pow B_m 2.0)))))
          (- (sqrt 2.0)))
         (* (sqrt 2.0) (/ (sqrt F) (- (sqrt B_m)))))))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
	double t_0 = A * (C * -4.0);
	double t_1 = fma(B_m, B_m, t_0);
	double tmp;
	if (B_m <= 1.6e-221) {
		tmp = -1.0 / (hypot(B_m, sqrt(t_0)) / (sqrt((4.0 * F)) * sqrt(C)));
	} else if (B_m <= 3.2e-119) {
		tmp = sqrt((t_1 * (F * (4.0 * C)))) / -t_1;
	} else if (B_m <= 5.6e+147) {
		tmp = sqrt((F * (((A + C) + hypot(B_m, (A - C))) / fma(-4.0, (A * C), pow(B_m, 2.0))))) * -sqrt(2.0);
	} else {
		tmp = sqrt(2.0) * (sqrt(F) / -sqrt(B_m));
	}
	return tmp;
}
B_m = abs(B)
A, B_m, C, F = sort([A, B_m, C, F])
function code(A, B_m, C, F)
	t_0 = Float64(A * Float64(C * -4.0))
	t_1 = fma(B_m, B_m, t_0)
	tmp = 0.0
	if (B_m <= 1.6e-221)
		tmp = Float64(-1.0 / Float64(hypot(B_m, sqrt(t_0)) / Float64(sqrt(Float64(4.0 * F)) * sqrt(C))));
	elseif (B_m <= 3.2e-119)
		tmp = Float64(sqrt(Float64(t_1 * Float64(F * Float64(4.0 * C)))) / Float64(-t_1));
	elseif (B_m <= 5.6e+147)
		tmp = Float64(sqrt(Float64(F * Float64(Float64(Float64(A + C) + hypot(B_m, Float64(A - C))) / fma(-4.0, Float64(A * C), (B_m ^ 2.0))))) * Float64(-sqrt(2.0)));
	else
		tmp = Float64(sqrt(2.0) * Float64(sqrt(F) / Float64(-sqrt(B_m))));
	end
	return tmp
end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(B$95$m * B$95$m + t$95$0), $MachinePrecision]}, If[LessEqual[B$95$m, 1.6e-221], N[(-1.0 / N[(N[Sqrt[B$95$m ^ 2 + N[Sqrt[t$95$0], $MachinePrecision] ^ 2], $MachinePrecision] / N[(N[Sqrt[N[(4.0 * F), $MachinePrecision]], $MachinePrecision] * N[Sqrt[C], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B$95$m, 3.2e-119], N[(N[Sqrt[N[(t$95$1 * N[(F * N[(4.0 * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-t$95$1)), $MachinePrecision], If[LessEqual[B$95$m, 5.6e+147], N[(N[Sqrt[N[(F * N[(N[(N[(A + C), $MachinePrecision] + N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] / N[(-4.0 * N[(A * C), $MachinePrecision] + N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * N[(N[Sqrt[F], $MachinePrecision] / (-N[Sqrt[B$95$m], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := A \cdot \left(C \cdot -4\right)\\
t_1 := \mathsf{fma}\left(B\_m, B\_m, t\_0\right)\\
\mathbf{if}\;B\_m \leq 1.6 \cdot 10^{-221}:\\
\;\;\;\;\frac{-1}{\frac{\mathsf{hypot}\left(B\_m, \sqrt{t\_0}\right)}{\sqrt{4 \cdot F} \cdot \sqrt{C}}}\\

\mathbf{elif}\;B\_m \leq 3.2 \cdot 10^{-119}:\\
\;\;\;\;\frac{\sqrt{t\_1 \cdot \left(F \cdot \left(4 \cdot C\right)\right)}}{-t\_1}\\

\mathbf{elif}\;B\_m \leq 5.6 \cdot 10^{+147}:\\
\;\;\;\;\sqrt{F \cdot \frac{\left(A + C\right) + \mathsf{hypot}\left(B\_m, A - C\right)}{\mathsf{fma}\left(-4, A \cdot C, {B\_m}^{2}\right)}} \cdot \left(-\sqrt{2}\right)\\

\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \frac{\sqrt{F}}{-\sqrt{B\_m}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if B < 1.60000000000000008e-221

    1. Initial program 21.7%

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Simplified24.6%

      \[\leadsto \color{blue}{\frac{\sqrt{\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot F\right) \cdot \left(2 \cdot \left(A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}} \]
    3. Add Preprocessing
    4. Taylor expanded in A around -inf 10.8%

      \[\leadsto \frac{\sqrt{\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot F\right) \cdot \color{blue}{\left(4 \cdot C\right)}}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
    5. Step-by-step derivation
      1. *-commutative10.8%

        \[\leadsto \frac{\sqrt{\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot F\right) \cdot \color{blue}{\left(C \cdot 4\right)}}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
    6. Simplified10.8%

      \[\leadsto \frac{\sqrt{\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot F\right) \cdot \color{blue}{\left(C \cdot 4\right)}}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
    7. Step-by-step derivation
      1. clear-num10.8%

        \[\leadsto \color{blue}{\frac{1}{\frac{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot F\right) \cdot \left(C \cdot 4\right)}}}} \]
      2. inv-pow10.8%

        \[\leadsto \color{blue}{{\left(\frac{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot F\right) \cdot \left(C \cdot 4\right)}}\right)}^{-1}} \]
      3. associate-*l*11.5%

        \[\leadsto {\left(\frac{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\color{blue}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}}\right)}^{-1} \]
    8. Applied egg-rr11.5%

      \[\leadsto \color{blue}{{\left(\frac{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}\right)}^{-1}} \]
    9. Step-by-step derivation
      1. unpow-111.5%

        \[\leadsto \color{blue}{\frac{1}{\frac{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}}} \]
    10. Simplified11.5%

      \[\leadsto \color{blue}{\frac{1}{\frac{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}}} \]
    11. Step-by-step derivation
      1. neg-sub011.5%

        \[\leadsto \frac{1}{\frac{\color{blue}{0 - \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}} \]
      2. metadata-eval11.5%

        \[\leadsto \frac{1}{\frac{\color{blue}{\log 1} - \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}} \]
      3. div-sub9.1%

        \[\leadsto \frac{1}{\color{blue}{\frac{\log 1}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}} - \frac{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}}} \]
      4. metadata-eval9.1%

        \[\leadsto \frac{1}{\frac{\color{blue}{0}}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}} - \frac{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}} \]
      5. *-commutative9.1%

        \[\leadsto \frac{1}{\frac{0}{\sqrt{\color{blue}{\left(F \cdot \left(C \cdot 4\right)\right) \cdot \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}}} - \frac{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}} \]
      6. sqrt-prod4.9%

        \[\leadsto \frac{1}{\frac{0}{\color{blue}{\sqrt{F \cdot \left(C \cdot 4\right)} \cdot \sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}}} - \frac{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}} \]
      7. fma-undefine4.9%

        \[\leadsto \frac{1}{\frac{0}{\sqrt{F \cdot \left(C \cdot 4\right)} \cdot \sqrt{\color{blue}{B \cdot B + A \cdot \left(C \cdot -4\right)}}} - \frac{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}} \]
      8. add-sqr-sqrt4.7%

        \[\leadsto \frac{1}{\frac{0}{\sqrt{F \cdot \left(C \cdot 4\right)} \cdot \sqrt{B \cdot B + \color{blue}{\sqrt{A \cdot \left(C \cdot -4\right)} \cdot \sqrt{A \cdot \left(C \cdot -4\right)}}}} - \frac{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}} \]
      9. hypot-define4.7%

        \[\leadsto \frac{1}{\frac{0}{\sqrt{F \cdot \left(C \cdot 4\right)} \cdot \color{blue}{\mathsf{hypot}\left(B, \sqrt{A \cdot \left(C \cdot -4\right)}\right)}} - \frac{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}} \]
      10. associate-*r*4.7%

        \[\leadsto \frac{1}{\frac{0}{\sqrt{F \cdot \left(C \cdot 4\right)} \cdot \mathsf{hypot}\left(B, \sqrt{\color{blue}{\left(A \cdot C\right) \cdot -4}}\right)} - \frac{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}} \]
    12. Applied egg-rr7.3%

      \[\leadsto \frac{1}{\color{blue}{\frac{0}{\sqrt{F \cdot \left(C \cdot 4\right)} \cdot \mathsf{hypot}\left(B, \sqrt{\left(A \cdot C\right) \cdot -4}\right)} - \frac{\mathsf{fma}\left(B, B, \left(A \cdot C\right) \cdot -4\right)}{\sqrt{F \cdot \left(C \cdot 4\right)} \cdot \mathsf{hypot}\left(B, \sqrt{\left(A \cdot C\right) \cdot -4}\right)}}} \]
    13. Step-by-step derivation
      1. div09.5%

        \[\leadsto \frac{1}{\color{blue}{0} - \frac{\mathsf{fma}\left(B, B, \left(A \cdot C\right) \cdot -4\right)}{\sqrt{F \cdot \left(C \cdot 4\right)} \cdot \mathsf{hypot}\left(B, \sqrt{\left(A \cdot C\right) \cdot -4}\right)}} \]
      2. neg-sub09.6%

        \[\leadsto \frac{1}{\color{blue}{-\frac{\mathsf{fma}\left(B, B, \left(A \cdot C\right) \cdot -4\right)}{\sqrt{F \cdot \left(C \cdot 4\right)} \cdot \mathsf{hypot}\left(B, \sqrt{\left(A \cdot C\right) \cdot -4}\right)}}} \]
    14. Simplified10.5%

      \[\leadsto \frac{1}{\color{blue}{-\frac{\mathsf{hypot}\left(B, \sqrt{A \cdot \left(C \cdot -4\right)}\right)}{\sqrt{F \cdot \left(4 \cdot C\right)}}}} \]
    15. Step-by-step derivation
      1. pow1/210.5%

        \[\leadsto \frac{1}{-\frac{\mathsf{hypot}\left(B, \sqrt{A \cdot \left(C \cdot -4\right)}\right)}{\color{blue}{{\left(F \cdot \left(4 \cdot C\right)\right)}^{0.5}}}} \]
      2. associate-*r*10.5%

        \[\leadsto \frac{1}{-\frac{\mathsf{hypot}\left(B, \sqrt{A \cdot \left(C \cdot -4\right)}\right)}{{\color{blue}{\left(\left(F \cdot 4\right) \cdot C\right)}}^{0.5}}} \]
      3. unpow-prod-down11.2%

        \[\leadsto \frac{1}{-\frac{\mathsf{hypot}\left(B, \sqrt{A \cdot \left(C \cdot -4\right)}\right)}{\color{blue}{{\left(F \cdot 4\right)}^{0.5} \cdot {C}^{0.5}}}} \]
      4. pow1/211.2%

        \[\leadsto \frac{1}{-\frac{\mathsf{hypot}\left(B, \sqrt{A \cdot \left(C \cdot -4\right)}\right)}{{\left(F \cdot 4\right)}^{0.5} \cdot \color{blue}{\sqrt{C}}}} \]
    16. Applied egg-rr11.2%

      \[\leadsto \frac{1}{-\frac{\mathsf{hypot}\left(B, \sqrt{A \cdot \left(C \cdot -4\right)}\right)}{\color{blue}{{\left(F \cdot 4\right)}^{0.5} \cdot \sqrt{C}}}} \]
    17. Step-by-step derivation
      1. unpow1/211.2%

        \[\leadsto \frac{1}{-\frac{\mathsf{hypot}\left(B, \sqrt{A \cdot \left(C \cdot -4\right)}\right)}{\color{blue}{\sqrt{F \cdot 4}} \cdot \sqrt{C}}} \]
    18. Simplified11.2%

      \[\leadsto \frac{1}{-\frac{\mathsf{hypot}\left(B, \sqrt{A \cdot \left(C \cdot -4\right)}\right)}{\color{blue}{\sqrt{F \cdot 4} \cdot \sqrt{C}}}} \]

    if 1.60000000000000008e-221 < B < 3.19999999999999993e-119

    1. Initial program 26.8%

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Simplified35.2%

      \[\leadsto \color{blue}{\frac{\sqrt{\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot F\right) \cdot \left(2 \cdot \left(A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}} \]
    3. Add Preprocessing
    4. Taylor expanded in A around -inf 15.0%

      \[\leadsto \frac{\sqrt{\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot F\right) \cdot \color{blue}{\left(4 \cdot C\right)}}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
    5. Step-by-step derivation
      1. *-commutative15.0%

        \[\leadsto \frac{\sqrt{\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot F\right) \cdot \color{blue}{\left(C \cdot 4\right)}}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
    6. Simplified15.0%

      \[\leadsto \frac{\sqrt{\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot F\right) \cdot \color{blue}{\left(C \cdot 4\right)}}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
    7. Step-by-step derivation
      1. *-un-lft-identity15.0%

        \[\leadsto \frac{\color{blue}{1 \cdot \sqrt{\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot F\right) \cdot \left(C \cdot 4\right)}}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
      2. associate-*l*14.9%

        \[\leadsto \frac{1 \cdot \sqrt{\color{blue}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
    8. Applied egg-rr14.9%

      \[\leadsto \frac{\color{blue}{1 \cdot \sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
    9. Step-by-step derivation
      1. *-lft-identity14.9%

        \[\leadsto \frac{\color{blue}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
    10. Simplified14.9%

      \[\leadsto \frac{\color{blue}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]

    if 3.19999999999999993e-119 < B < 5.6000000000000002e147

    1. Initial program 32.7%

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Add Preprocessing
    3. Taylor expanded in F around 0 30.6%

      \[\leadsto \color{blue}{-1 \cdot \left(\sqrt{\frac{F \cdot \left(A + \left(C + \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right)\right)}{{B}^{2} - 4 \cdot \left(A \cdot C\right)}} \cdot \sqrt{2}\right)} \]
    4. Simplified49.8%

      \[\leadsto \color{blue}{-\sqrt{2} \cdot \sqrt{F \cdot \frac{\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)}}} \]

    if 5.6000000000000002e147 < B

    1. Initial program 0.0%

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Add Preprocessing
    3. Taylor expanded in B around inf 44.3%

      \[\leadsto \color{blue}{-1 \cdot \left(\sqrt{\frac{F}{B}} \cdot \sqrt{2}\right)} \]
    4. Step-by-step derivation
      1. mul-1-neg44.3%

        \[\leadsto \color{blue}{-\sqrt{\frac{F}{B}} \cdot \sqrt{2}} \]
      2. *-commutative44.3%

        \[\leadsto -\color{blue}{\sqrt{2} \cdot \sqrt{\frac{F}{B}}} \]
    5. Simplified44.3%

      \[\leadsto \color{blue}{-\sqrt{2} \cdot \sqrt{\frac{F}{B}}} \]
    6. Step-by-step derivation
      1. sqrt-div66.9%

        \[\leadsto -\sqrt{2} \cdot \color{blue}{\frac{\sqrt{F}}{\sqrt{B}}} \]
    7. Applied egg-rr66.9%

      \[\leadsto -\sqrt{2} \cdot \color{blue}{\frac{\sqrt{F}}{\sqrt{B}}} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification25.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;B \leq 1.6 \cdot 10^{-221}:\\ \;\;\;\;\frac{-1}{\frac{\mathsf{hypot}\left(B, \sqrt{A \cdot \left(C \cdot -4\right)}\right)}{\sqrt{4 \cdot F} \cdot \sqrt{C}}}\\ \mathbf{elif}\;B \leq 3.2 \cdot 10^{-119}:\\ \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(4 \cdot C\right)\right)}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}\\ \mathbf{elif}\;B \leq 5.6 \cdot 10^{+147}:\\ \;\;\;\;\sqrt{F \cdot \frac{\left(A + C\right) + \mathsf{hypot}\left(B, A - C\right)}{\mathsf{fma}\left(-4, A \cdot C, {B}^{2}\right)}} \cdot \left(-\sqrt{2}\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{2} \cdot \frac{\sqrt{F}}{-\sqrt{B}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 47.5% accurate, 1.2× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ [A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\ \\ \begin{array}{l} \mathbf{if}\;{B\_m}^{2} \leq 10^{+26}:\\ \;\;\;\;-\sqrt{\frac{F}{-A}}\\ \mathbf{elif}\;{B\_m}^{2} \leq 10^{+292}:\\ \;\;\;\;\sqrt{F \cdot \left(A + \mathsf{hypot}\left(B\_m, A\right)\right)} \cdot \frac{\sqrt{2}}{-B\_m}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{2} \cdot \frac{\sqrt{F}}{-\sqrt{B\_m}}\\ \end{array} \end{array} \]
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
 :precision binary64
 (if (<= (pow B_m 2.0) 1e+26)
   (- (sqrt (/ F (- A))))
   (if (<= (pow B_m 2.0) 1e+292)
     (* (sqrt (* F (+ A (hypot B_m A)))) (/ (sqrt 2.0) (- B_m)))
     (* (sqrt 2.0) (/ (sqrt F) (- (sqrt B_m)))))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
	double tmp;
	if (pow(B_m, 2.0) <= 1e+26) {
		tmp = -sqrt((F / -A));
	} else if (pow(B_m, 2.0) <= 1e+292) {
		tmp = sqrt((F * (A + hypot(B_m, A)))) * (sqrt(2.0) / -B_m);
	} else {
		tmp = sqrt(2.0) * (sqrt(F) / -sqrt(B_m));
	}
	return tmp;
}
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
	double tmp;
	if (Math.pow(B_m, 2.0) <= 1e+26) {
		tmp = -Math.sqrt((F / -A));
	} else if (Math.pow(B_m, 2.0) <= 1e+292) {
		tmp = Math.sqrt((F * (A + Math.hypot(B_m, A)))) * (Math.sqrt(2.0) / -B_m);
	} else {
		tmp = Math.sqrt(2.0) * (Math.sqrt(F) / -Math.sqrt(B_m));
	}
	return tmp;
}
B_m = math.fabs(B)
[A, B_m, C, F] = sort([A, B_m, C, F])
def code(A, B_m, C, F):
	tmp = 0
	if math.pow(B_m, 2.0) <= 1e+26:
		tmp = -math.sqrt((F / -A))
	elif math.pow(B_m, 2.0) <= 1e+292:
		tmp = math.sqrt((F * (A + math.hypot(B_m, A)))) * (math.sqrt(2.0) / -B_m)
	else:
		tmp = math.sqrt(2.0) * (math.sqrt(F) / -math.sqrt(B_m))
	return tmp
B_m = abs(B)
A, B_m, C, F = sort([A, B_m, C, F])
function code(A, B_m, C, F)
	tmp = 0.0
	if ((B_m ^ 2.0) <= 1e+26)
		tmp = Float64(-sqrt(Float64(F / Float64(-A))));
	elseif ((B_m ^ 2.0) <= 1e+292)
		tmp = Float64(sqrt(Float64(F * Float64(A + hypot(B_m, A)))) * Float64(sqrt(2.0) / Float64(-B_m)));
	else
		tmp = Float64(sqrt(2.0) * Float64(sqrt(F) / Float64(-sqrt(B_m))));
	end
	return tmp
end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
	tmp = 0.0;
	if ((B_m ^ 2.0) <= 1e+26)
		tmp = -sqrt((F / -A));
	elseif ((B_m ^ 2.0) <= 1e+292)
		tmp = sqrt((F * (A + hypot(B_m, A)))) * (sqrt(2.0) / -B_m);
	else
		tmp = sqrt(2.0) * (sqrt(F) / -sqrt(B_m));
	end
	tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 1e+26], (-N[Sqrt[N[(F / (-A)), $MachinePrecision]], $MachinePrecision]), If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 1e+292], N[(N[Sqrt[N[(F * N[(A + N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[2.0], $MachinePrecision] / (-B$95$m)), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * N[(N[Sqrt[F], $MachinePrecision] / (-N[Sqrt[B$95$m], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;{B\_m}^{2} \leq 10^{+26}:\\
\;\;\;\;-\sqrt{\frac{F}{-A}}\\

\mathbf{elif}\;{B\_m}^{2} \leq 10^{+292}:\\
\;\;\;\;\sqrt{F \cdot \left(A + \mathsf{hypot}\left(B\_m, A\right)\right)} \cdot \frac{\sqrt{2}}{-B\_m}\\

\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \frac{\sqrt{F}}{-\sqrt{B\_m}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (pow.f64 B #s(literal 2 binary64)) < 1.00000000000000005e26

    1. Initial program 28.5%

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Add Preprocessing
    3. Taylor expanded in F around 0 22.1%

      \[\leadsto \color{blue}{-1 \cdot \left(\sqrt{\frac{F \cdot \left(A + \left(C + \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right)\right)}{{B}^{2} - 4 \cdot \left(A \cdot C\right)}} \cdot \sqrt{2}\right)} \]
    4. Simplified38.2%

      \[\leadsto \color{blue}{-\sqrt{2} \cdot \sqrt{F \cdot \frac{\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)}}} \]
    5. Step-by-step derivation
      1. *-commutative38.2%

        \[\leadsto -\color{blue}{\sqrt{F \cdot \frac{\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)}} \cdot \sqrt{2}} \]
      2. pow1/238.2%

        \[\leadsto -\color{blue}{{\left(F \cdot \frac{\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)}\right)}^{0.5}} \cdot \sqrt{2} \]
      3. metadata-eval38.2%

        \[\leadsto -{\left(F \cdot \frac{\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)}\right)}^{\color{blue}{\left(0.25 \cdot 2\right)}} \cdot \sqrt{2} \]
      4. pow1/238.2%

        \[\leadsto -{\left(F \cdot \frac{\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)}\right)}^{\left(0.25 \cdot 2\right)} \cdot \color{blue}{{2}^{0.5}} \]
      5. metadata-eval38.2%

        \[\leadsto -{\left(F \cdot \frac{\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)}\right)}^{\left(0.25 \cdot 2\right)} \cdot {2}^{\color{blue}{\left(0.25 \cdot 2\right)}} \]
      6. pow-prod-down38.3%

        \[\leadsto -\color{blue}{{\left(\left(F \cdot \frac{\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)}\right) \cdot 2\right)}^{\left(0.25 \cdot 2\right)}} \]
      7. associate-*r/37.5%

        \[\leadsto -{\left(\color{blue}{\frac{F \cdot \left(\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)}} \cdot 2\right)}^{\left(0.25 \cdot 2\right)} \]
      8. metadata-eval37.5%

        \[\leadsto -{\left(\frac{F \cdot \left(\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)} \cdot 2\right)}^{\color{blue}{0.5}} \]
    6. Applied egg-rr37.5%

      \[\leadsto -\color{blue}{{\left(\frac{F \cdot \left(\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)} \cdot 2\right)}^{0.5}} \]
    7. Step-by-step derivation
      1. unpow1/237.5%

        \[\leadsto -\color{blue}{\sqrt{\frac{F \cdot \left(\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)} \cdot 2}} \]
    8. Simplified37.5%

      \[\leadsto -\color{blue}{\sqrt{\frac{F \cdot \left(\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)} \cdot 2}} \]
    9. Taylor expanded in C around inf 23.9%

      \[\leadsto -\sqrt{\color{blue}{-1 \cdot \frac{F}{A}}} \]
    10. Step-by-step derivation
      1. mul-1-neg23.9%

        \[\leadsto -\sqrt{\color{blue}{-\frac{F}{A}}} \]
    11. Simplified23.9%

      \[\leadsto -\sqrt{\color{blue}{-\frac{F}{A}}} \]

    if 1.00000000000000005e26 < (pow.f64 B #s(literal 2 binary64)) < 1e292

    1. Initial program 30.0%

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Add Preprocessing
    3. Taylor expanded in C around 0 14.0%

      \[\leadsto \color{blue}{-1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A + \sqrt{{A}^{2} + {B}^{2}}\right)}\right)} \]
    4. Step-by-step derivation
      1. mul-1-neg14.0%

        \[\leadsto \color{blue}{-\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A + \sqrt{{A}^{2} + {B}^{2}}\right)}} \]
      2. *-commutative14.0%

        \[\leadsto -\color{blue}{\sqrt{F \cdot \left(A + \sqrt{{A}^{2} + {B}^{2}}\right)} \cdot \frac{\sqrt{2}}{B}} \]
      3. *-commutative14.0%

        \[\leadsto -\sqrt{\color{blue}{\left(A + \sqrt{{A}^{2} + {B}^{2}}\right) \cdot F}} \cdot \frac{\sqrt{2}}{B} \]
      4. +-commutative14.0%

        \[\leadsto -\sqrt{\left(A + \sqrt{\color{blue}{{B}^{2} + {A}^{2}}}\right) \cdot F} \cdot \frac{\sqrt{2}}{B} \]
      5. unpow214.0%

        \[\leadsto -\sqrt{\left(A + \sqrt{\color{blue}{B \cdot B} + {A}^{2}}\right) \cdot F} \cdot \frac{\sqrt{2}}{B} \]
      6. unpow214.0%

        \[\leadsto -\sqrt{\left(A + \sqrt{B \cdot B + \color{blue}{A \cdot A}}\right) \cdot F} \cdot \frac{\sqrt{2}}{B} \]
      7. hypot-define14.5%

        \[\leadsto -\sqrt{\left(A + \color{blue}{\mathsf{hypot}\left(B, A\right)}\right) \cdot F} \cdot \frac{\sqrt{2}}{B} \]
    5. Simplified14.5%

      \[\leadsto \color{blue}{-\sqrt{\left(A + \mathsf{hypot}\left(B, A\right)\right) \cdot F} \cdot \frac{\sqrt{2}}{B}} \]

    if 1e292 < (pow.f64 B #s(literal 2 binary64))

    1. Initial program 1.6%

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Add Preprocessing
    3. Taylor expanded in B around inf 18.9%

      \[\leadsto \color{blue}{-1 \cdot \left(\sqrt{\frac{F}{B}} \cdot \sqrt{2}\right)} \]
    4. Step-by-step derivation
      1. mul-1-neg18.9%

        \[\leadsto \color{blue}{-\sqrt{\frac{F}{B}} \cdot \sqrt{2}} \]
      2. *-commutative18.9%

        \[\leadsto -\color{blue}{\sqrt{2} \cdot \sqrt{\frac{F}{B}}} \]
    5. Simplified18.9%

      \[\leadsto \color{blue}{-\sqrt{2} \cdot \sqrt{\frac{F}{B}}} \]
    6. Step-by-step derivation
      1. sqrt-div26.6%

        \[\leadsto -\sqrt{2} \cdot \color{blue}{\frac{\sqrt{F}}{\sqrt{B}}} \]
    7. Applied egg-rr26.6%

      \[\leadsto -\sqrt{2} \cdot \color{blue}{\frac{\sqrt{F}}{\sqrt{B}}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification22.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;{B}^{2} \leq 10^{+26}:\\ \;\;\;\;-\sqrt{\frac{F}{-A}}\\ \mathbf{elif}\;{B}^{2} \leq 10^{+292}:\\ \;\;\;\;\sqrt{F \cdot \left(A + \mathsf{hypot}\left(B, A\right)\right)} \cdot \frac{\sqrt{2}}{-B}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{2} \cdot \frac{\sqrt{F}}{-\sqrt{B}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 51.4% accurate, 1.5× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ [A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\ \\ \begin{array}{l} t_0 := A \cdot \left(C \cdot -4\right)\\ t_1 := \mathsf{fma}\left(B\_m, B\_m, t\_0\right)\\ \mathbf{if}\;B\_m \leq 7 \cdot 10^{-222}:\\ \;\;\;\;\frac{-1}{\frac{\mathsf{hypot}\left(B\_m, \sqrt{t\_0}\right)}{\sqrt{4 \cdot F} \cdot \sqrt{C}}}\\ \mathbf{elif}\;B\_m \leq 8000000000000:\\ \;\;\;\;\frac{\sqrt{t\_1 \cdot \left(F \cdot \left(4 \cdot C\right)\right)}}{-t\_1}\\ \mathbf{elif}\;B\_m \leq 2.9 \cdot 10^{+147}:\\ \;\;\;\;\sqrt{2} \cdot \left(-\sqrt{F \cdot \frac{\left(A + C\right) + \mathsf{hypot}\left(B\_m, A - C\right)}{{B\_m}^{2}}}\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{2} \cdot \frac{\sqrt{F}}{-\sqrt{B\_m}}\\ \end{array} \end{array} \]
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
 :precision binary64
 (let* ((t_0 (* A (* C -4.0))) (t_1 (fma B_m B_m t_0)))
   (if (<= B_m 7e-222)
     (/ -1.0 (/ (hypot B_m (sqrt t_0)) (* (sqrt (* 4.0 F)) (sqrt C))))
     (if (<= B_m 8000000000000.0)
       (/ (sqrt (* t_1 (* F (* 4.0 C)))) (- t_1))
       (if (<= B_m 2.9e+147)
         (*
          (sqrt 2.0)
          (- (sqrt (* F (/ (+ (+ A C) (hypot B_m (- A C))) (pow B_m 2.0))))))
         (* (sqrt 2.0) (/ (sqrt F) (- (sqrt B_m)))))))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
	double t_0 = A * (C * -4.0);
	double t_1 = fma(B_m, B_m, t_0);
	double tmp;
	if (B_m <= 7e-222) {
		tmp = -1.0 / (hypot(B_m, sqrt(t_0)) / (sqrt((4.0 * F)) * sqrt(C)));
	} else if (B_m <= 8000000000000.0) {
		tmp = sqrt((t_1 * (F * (4.0 * C)))) / -t_1;
	} else if (B_m <= 2.9e+147) {
		tmp = sqrt(2.0) * -sqrt((F * (((A + C) + hypot(B_m, (A - C))) / pow(B_m, 2.0))));
	} else {
		tmp = sqrt(2.0) * (sqrt(F) / -sqrt(B_m));
	}
	return tmp;
}
B_m = abs(B)
A, B_m, C, F = sort([A, B_m, C, F])
function code(A, B_m, C, F)
	t_0 = Float64(A * Float64(C * -4.0))
	t_1 = fma(B_m, B_m, t_0)
	tmp = 0.0
	if (B_m <= 7e-222)
		tmp = Float64(-1.0 / Float64(hypot(B_m, sqrt(t_0)) / Float64(sqrt(Float64(4.0 * F)) * sqrt(C))));
	elseif (B_m <= 8000000000000.0)
		tmp = Float64(sqrt(Float64(t_1 * Float64(F * Float64(4.0 * C)))) / Float64(-t_1));
	elseif (B_m <= 2.9e+147)
		tmp = Float64(sqrt(2.0) * Float64(-sqrt(Float64(F * Float64(Float64(Float64(A + C) + hypot(B_m, Float64(A - C))) / (B_m ^ 2.0))))));
	else
		tmp = Float64(sqrt(2.0) * Float64(sqrt(F) / Float64(-sqrt(B_m))));
	end
	return tmp
end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(B$95$m * B$95$m + t$95$0), $MachinePrecision]}, If[LessEqual[B$95$m, 7e-222], N[(-1.0 / N[(N[Sqrt[B$95$m ^ 2 + N[Sqrt[t$95$0], $MachinePrecision] ^ 2], $MachinePrecision] / N[(N[Sqrt[N[(4.0 * F), $MachinePrecision]], $MachinePrecision] * N[Sqrt[C], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B$95$m, 8000000000000.0], N[(N[Sqrt[N[(t$95$1 * N[(F * N[(4.0 * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-t$95$1)), $MachinePrecision], If[LessEqual[B$95$m, 2.9e+147], N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F * N[(N[(N[(A + C), $MachinePrecision] + N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] / N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * N[(N[Sqrt[F], $MachinePrecision] / (-N[Sqrt[B$95$m], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := A \cdot \left(C \cdot -4\right)\\
t_1 := \mathsf{fma}\left(B\_m, B\_m, t\_0\right)\\
\mathbf{if}\;B\_m \leq 7 \cdot 10^{-222}:\\
\;\;\;\;\frac{-1}{\frac{\mathsf{hypot}\left(B\_m, \sqrt{t\_0}\right)}{\sqrt{4 \cdot F} \cdot \sqrt{C}}}\\

\mathbf{elif}\;B\_m \leq 8000000000000:\\
\;\;\;\;\frac{\sqrt{t\_1 \cdot \left(F \cdot \left(4 \cdot C\right)\right)}}{-t\_1}\\

\mathbf{elif}\;B\_m \leq 2.9 \cdot 10^{+147}:\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{F \cdot \frac{\left(A + C\right) + \mathsf{hypot}\left(B\_m, A - C\right)}{{B\_m}^{2}}}\right)\\

\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \frac{\sqrt{F}}{-\sqrt{B\_m}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if B < 7.00000000000000049e-222

    1. Initial program 21.7%

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Simplified24.6%

      \[\leadsto \color{blue}{\frac{\sqrt{\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot F\right) \cdot \left(2 \cdot \left(A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}} \]
    3. Add Preprocessing
    4. Taylor expanded in A around -inf 10.8%

      \[\leadsto \frac{\sqrt{\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot F\right) \cdot \color{blue}{\left(4 \cdot C\right)}}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
    5. Step-by-step derivation
      1. *-commutative10.8%

        \[\leadsto \frac{\sqrt{\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot F\right) \cdot \color{blue}{\left(C \cdot 4\right)}}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
    6. Simplified10.8%

      \[\leadsto \frac{\sqrt{\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot F\right) \cdot \color{blue}{\left(C \cdot 4\right)}}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
    7. Step-by-step derivation
      1. clear-num10.8%

        \[\leadsto \color{blue}{\frac{1}{\frac{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot F\right) \cdot \left(C \cdot 4\right)}}}} \]
      2. inv-pow10.8%

        \[\leadsto \color{blue}{{\left(\frac{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot F\right) \cdot \left(C \cdot 4\right)}}\right)}^{-1}} \]
      3. associate-*l*11.5%

        \[\leadsto {\left(\frac{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\color{blue}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}}\right)}^{-1} \]
    8. Applied egg-rr11.5%

      \[\leadsto \color{blue}{{\left(\frac{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}\right)}^{-1}} \]
    9. Step-by-step derivation
      1. unpow-111.5%

        \[\leadsto \color{blue}{\frac{1}{\frac{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}}} \]
    10. Simplified11.5%

      \[\leadsto \color{blue}{\frac{1}{\frac{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}}} \]
    11. Step-by-step derivation
      1. neg-sub011.5%

        \[\leadsto \frac{1}{\frac{\color{blue}{0 - \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}} \]
      2. metadata-eval11.5%

        \[\leadsto \frac{1}{\frac{\color{blue}{\log 1} - \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}} \]
      3. div-sub9.1%

        \[\leadsto \frac{1}{\color{blue}{\frac{\log 1}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}} - \frac{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}}} \]
      4. metadata-eval9.1%

        \[\leadsto \frac{1}{\frac{\color{blue}{0}}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}} - \frac{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}} \]
      5. *-commutative9.1%

        \[\leadsto \frac{1}{\frac{0}{\sqrt{\color{blue}{\left(F \cdot \left(C \cdot 4\right)\right) \cdot \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}}} - \frac{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}} \]
      6. sqrt-prod4.9%

        \[\leadsto \frac{1}{\frac{0}{\color{blue}{\sqrt{F \cdot \left(C \cdot 4\right)} \cdot \sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}}} - \frac{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}} \]
      7. fma-undefine4.9%

        \[\leadsto \frac{1}{\frac{0}{\sqrt{F \cdot \left(C \cdot 4\right)} \cdot \sqrt{\color{blue}{B \cdot B + A \cdot \left(C \cdot -4\right)}}} - \frac{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}} \]
      8. add-sqr-sqrt4.7%

        \[\leadsto \frac{1}{\frac{0}{\sqrt{F \cdot \left(C \cdot 4\right)} \cdot \sqrt{B \cdot B + \color{blue}{\sqrt{A \cdot \left(C \cdot -4\right)} \cdot \sqrt{A \cdot \left(C \cdot -4\right)}}}} - \frac{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}} \]
      9. hypot-define4.7%

        \[\leadsto \frac{1}{\frac{0}{\sqrt{F \cdot \left(C \cdot 4\right)} \cdot \color{blue}{\mathsf{hypot}\left(B, \sqrt{A \cdot \left(C \cdot -4\right)}\right)}} - \frac{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}} \]
      10. associate-*r*4.7%

        \[\leadsto \frac{1}{\frac{0}{\sqrt{F \cdot \left(C \cdot 4\right)} \cdot \mathsf{hypot}\left(B, \sqrt{\color{blue}{\left(A \cdot C\right) \cdot -4}}\right)} - \frac{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}} \]
    12. Applied egg-rr7.3%

      \[\leadsto \frac{1}{\color{blue}{\frac{0}{\sqrt{F \cdot \left(C \cdot 4\right)} \cdot \mathsf{hypot}\left(B, \sqrt{\left(A \cdot C\right) \cdot -4}\right)} - \frac{\mathsf{fma}\left(B, B, \left(A \cdot C\right) \cdot -4\right)}{\sqrt{F \cdot \left(C \cdot 4\right)} \cdot \mathsf{hypot}\left(B, \sqrt{\left(A \cdot C\right) \cdot -4}\right)}}} \]
    13. Step-by-step derivation
      1. div09.5%

        \[\leadsto \frac{1}{\color{blue}{0} - \frac{\mathsf{fma}\left(B, B, \left(A \cdot C\right) \cdot -4\right)}{\sqrt{F \cdot \left(C \cdot 4\right)} \cdot \mathsf{hypot}\left(B, \sqrt{\left(A \cdot C\right) \cdot -4}\right)}} \]
      2. neg-sub09.6%

        \[\leadsto \frac{1}{\color{blue}{-\frac{\mathsf{fma}\left(B, B, \left(A \cdot C\right) \cdot -4\right)}{\sqrt{F \cdot \left(C \cdot 4\right)} \cdot \mathsf{hypot}\left(B, \sqrt{\left(A \cdot C\right) \cdot -4}\right)}}} \]
    14. Simplified10.5%

      \[\leadsto \frac{1}{\color{blue}{-\frac{\mathsf{hypot}\left(B, \sqrt{A \cdot \left(C \cdot -4\right)}\right)}{\sqrt{F \cdot \left(4 \cdot C\right)}}}} \]
    15. Step-by-step derivation
      1. pow1/210.5%

        \[\leadsto \frac{1}{-\frac{\mathsf{hypot}\left(B, \sqrt{A \cdot \left(C \cdot -4\right)}\right)}{\color{blue}{{\left(F \cdot \left(4 \cdot C\right)\right)}^{0.5}}}} \]
      2. associate-*r*10.5%

        \[\leadsto \frac{1}{-\frac{\mathsf{hypot}\left(B, \sqrt{A \cdot \left(C \cdot -4\right)}\right)}{{\color{blue}{\left(\left(F \cdot 4\right) \cdot C\right)}}^{0.5}}} \]
      3. unpow-prod-down11.2%

        \[\leadsto \frac{1}{-\frac{\mathsf{hypot}\left(B, \sqrt{A \cdot \left(C \cdot -4\right)}\right)}{\color{blue}{{\left(F \cdot 4\right)}^{0.5} \cdot {C}^{0.5}}}} \]
      4. pow1/211.2%

        \[\leadsto \frac{1}{-\frac{\mathsf{hypot}\left(B, \sqrt{A \cdot \left(C \cdot -4\right)}\right)}{{\left(F \cdot 4\right)}^{0.5} \cdot \color{blue}{\sqrt{C}}}} \]
    16. Applied egg-rr11.2%

      \[\leadsto \frac{1}{-\frac{\mathsf{hypot}\left(B, \sqrt{A \cdot \left(C \cdot -4\right)}\right)}{\color{blue}{{\left(F \cdot 4\right)}^{0.5} \cdot \sqrt{C}}}} \]
    17. Step-by-step derivation
      1. unpow1/211.2%

        \[\leadsto \frac{1}{-\frac{\mathsf{hypot}\left(B, \sqrt{A \cdot \left(C \cdot -4\right)}\right)}{\color{blue}{\sqrt{F \cdot 4}} \cdot \sqrt{C}}} \]
    18. Simplified11.2%

      \[\leadsto \frac{1}{-\frac{\mathsf{hypot}\left(B, \sqrt{A \cdot \left(C \cdot -4\right)}\right)}{\color{blue}{\sqrt{F \cdot 4} \cdot \sqrt{C}}}} \]

    if 7.00000000000000049e-222 < B < 8e12

    1. Initial program 33.9%

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Simplified44.8%

      \[\leadsto \color{blue}{\frac{\sqrt{\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot F\right) \cdot \left(2 \cdot \left(A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}} \]
    3. Add Preprocessing
    4. Taylor expanded in A around -inf 11.5%

      \[\leadsto \frac{\sqrt{\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot F\right) \cdot \color{blue}{\left(4 \cdot C\right)}}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
    5. Step-by-step derivation
      1. *-commutative11.5%

        \[\leadsto \frac{\sqrt{\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot F\right) \cdot \color{blue}{\left(C \cdot 4\right)}}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
    6. Simplified11.5%

      \[\leadsto \frac{\sqrt{\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot F\right) \cdot \color{blue}{\left(C \cdot 4\right)}}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
    7. Step-by-step derivation
      1. *-un-lft-identity11.5%

        \[\leadsto \frac{\color{blue}{1 \cdot \sqrt{\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot F\right) \cdot \left(C \cdot 4\right)}}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
      2. associate-*l*13.7%

        \[\leadsto \frac{1 \cdot \sqrt{\color{blue}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
    8. Applied egg-rr13.7%

      \[\leadsto \frac{\color{blue}{1 \cdot \sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
    9. Step-by-step derivation
      1. *-lft-identity13.7%

        \[\leadsto \frac{\color{blue}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
    10. Simplified13.7%

      \[\leadsto \frac{\color{blue}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]

    if 8e12 < B < 2.8999999999999998e147

    1. Initial program 27.2%

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Add Preprocessing
    3. Taylor expanded in F around 0 23.9%

      \[\leadsto \color{blue}{-1 \cdot \left(\sqrt{\frac{F \cdot \left(A + \left(C + \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right)\right)}{{B}^{2} - 4 \cdot \left(A \cdot C\right)}} \cdot \sqrt{2}\right)} \]
    4. Simplified43.0%

      \[\leadsto \color{blue}{-\sqrt{2} \cdot \sqrt{F \cdot \frac{\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)}}} \]
    5. Taylor expanded in C around 0 42.9%

      \[\leadsto -\sqrt{2} \cdot \sqrt{F \cdot \frac{\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)}{\color{blue}{{B}^{2}}}} \]

    if 2.8999999999999998e147 < B

    1. Initial program 0.0%

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Add Preprocessing
    3. Taylor expanded in B around inf 44.3%

      \[\leadsto \color{blue}{-1 \cdot \left(\sqrt{\frac{F}{B}} \cdot \sqrt{2}\right)} \]
    4. Step-by-step derivation
      1. mul-1-neg44.3%

        \[\leadsto \color{blue}{-\sqrt{\frac{F}{B}} \cdot \sqrt{2}} \]
      2. *-commutative44.3%

        \[\leadsto -\color{blue}{\sqrt{2} \cdot \sqrt{\frac{F}{B}}} \]
    5. Simplified44.3%

      \[\leadsto \color{blue}{-\sqrt{2} \cdot \sqrt{\frac{F}{B}}} \]
    6. Step-by-step derivation
      1. sqrt-div66.9%

        \[\leadsto -\sqrt{2} \cdot \color{blue}{\frac{\sqrt{F}}{\sqrt{B}}} \]
    7. Applied egg-rr66.9%

      \[\leadsto -\sqrt{2} \cdot \color{blue}{\frac{\sqrt{F}}{\sqrt{B}}} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification20.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;B \leq 7 \cdot 10^{-222}:\\ \;\;\;\;\frac{-1}{\frac{\mathsf{hypot}\left(B, \sqrt{A \cdot \left(C \cdot -4\right)}\right)}{\sqrt{4 \cdot F} \cdot \sqrt{C}}}\\ \mathbf{elif}\;B \leq 8000000000000:\\ \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(4 \cdot C\right)\right)}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}\\ \mathbf{elif}\;B \leq 2.9 \cdot 10^{+147}:\\ \;\;\;\;\sqrt{2} \cdot \left(-\sqrt{F \cdot \frac{\left(A + C\right) + \mathsf{hypot}\left(B, A - C\right)}{{B}^{2}}}\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{2} \cdot \frac{\sqrt{F}}{-\sqrt{B}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 48.8% accurate, 1.5× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ [A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\ \\ \begin{array}{l} t_0 := A \cdot \left(C \cdot -4\right)\\ t_1 := \mathsf{fma}\left(B\_m, B\_m, t\_0\right)\\ \mathbf{if}\;B\_m \leq 3.3 \cdot 10^{-221}:\\ \;\;\;\;\frac{-1}{\frac{\mathsf{hypot}\left(B\_m, \sqrt{t\_0}\right)}{\sqrt{4 \cdot F} \cdot \sqrt{C}}}\\ \mathbf{elif}\;B\_m \leq 1.15 \cdot 10^{+14}:\\ \;\;\;\;\frac{\sqrt{t\_1 \cdot \left(F \cdot \left(4 \cdot C\right)\right)}}{-t\_1}\\ \mathbf{elif}\;B\_m \leq 8.2 \cdot 10^{+145}:\\ \;\;\;\;\sqrt{F \cdot \left(A + \mathsf{hypot}\left(B\_m, A\right)\right)} \cdot \frac{\sqrt{2}}{-B\_m}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{2} \cdot \frac{\sqrt{F}}{-\sqrt{B\_m}}\\ \end{array} \end{array} \]
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
 :precision binary64
 (let* ((t_0 (* A (* C -4.0))) (t_1 (fma B_m B_m t_0)))
   (if (<= B_m 3.3e-221)
     (/ -1.0 (/ (hypot B_m (sqrt t_0)) (* (sqrt (* 4.0 F)) (sqrt C))))
     (if (<= B_m 1.15e+14)
       (/ (sqrt (* t_1 (* F (* 4.0 C)))) (- t_1))
       (if (<= B_m 8.2e+145)
         (* (sqrt (* F (+ A (hypot B_m A)))) (/ (sqrt 2.0) (- B_m)))
         (* (sqrt 2.0) (/ (sqrt F) (- (sqrt B_m)))))))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
	double t_0 = A * (C * -4.0);
	double t_1 = fma(B_m, B_m, t_0);
	double tmp;
	if (B_m <= 3.3e-221) {
		tmp = -1.0 / (hypot(B_m, sqrt(t_0)) / (sqrt((4.0 * F)) * sqrt(C)));
	} else if (B_m <= 1.15e+14) {
		tmp = sqrt((t_1 * (F * (4.0 * C)))) / -t_1;
	} else if (B_m <= 8.2e+145) {
		tmp = sqrt((F * (A + hypot(B_m, A)))) * (sqrt(2.0) / -B_m);
	} else {
		tmp = sqrt(2.0) * (sqrt(F) / -sqrt(B_m));
	}
	return tmp;
}
B_m = abs(B)
A, B_m, C, F = sort([A, B_m, C, F])
function code(A, B_m, C, F)
	t_0 = Float64(A * Float64(C * -4.0))
	t_1 = fma(B_m, B_m, t_0)
	tmp = 0.0
	if (B_m <= 3.3e-221)
		tmp = Float64(-1.0 / Float64(hypot(B_m, sqrt(t_0)) / Float64(sqrt(Float64(4.0 * F)) * sqrt(C))));
	elseif (B_m <= 1.15e+14)
		tmp = Float64(sqrt(Float64(t_1 * Float64(F * Float64(4.0 * C)))) / Float64(-t_1));
	elseif (B_m <= 8.2e+145)
		tmp = Float64(sqrt(Float64(F * Float64(A + hypot(B_m, A)))) * Float64(sqrt(2.0) / Float64(-B_m)));
	else
		tmp = Float64(sqrt(2.0) * Float64(sqrt(F) / Float64(-sqrt(B_m))));
	end
	return tmp
end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(B$95$m * B$95$m + t$95$0), $MachinePrecision]}, If[LessEqual[B$95$m, 3.3e-221], N[(-1.0 / N[(N[Sqrt[B$95$m ^ 2 + N[Sqrt[t$95$0], $MachinePrecision] ^ 2], $MachinePrecision] / N[(N[Sqrt[N[(4.0 * F), $MachinePrecision]], $MachinePrecision] * N[Sqrt[C], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B$95$m, 1.15e+14], N[(N[Sqrt[N[(t$95$1 * N[(F * N[(4.0 * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-t$95$1)), $MachinePrecision], If[LessEqual[B$95$m, 8.2e+145], N[(N[Sqrt[N[(F * N[(A + N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[2.0], $MachinePrecision] / (-B$95$m)), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * N[(N[Sqrt[F], $MachinePrecision] / (-N[Sqrt[B$95$m], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := A \cdot \left(C \cdot -4\right)\\
t_1 := \mathsf{fma}\left(B\_m, B\_m, t\_0\right)\\
\mathbf{if}\;B\_m \leq 3.3 \cdot 10^{-221}:\\
\;\;\;\;\frac{-1}{\frac{\mathsf{hypot}\left(B\_m, \sqrt{t\_0}\right)}{\sqrt{4 \cdot F} \cdot \sqrt{C}}}\\

\mathbf{elif}\;B\_m \leq 1.15 \cdot 10^{+14}:\\
\;\;\;\;\frac{\sqrt{t\_1 \cdot \left(F \cdot \left(4 \cdot C\right)\right)}}{-t\_1}\\

\mathbf{elif}\;B\_m \leq 8.2 \cdot 10^{+145}:\\
\;\;\;\;\sqrt{F \cdot \left(A + \mathsf{hypot}\left(B\_m, A\right)\right)} \cdot \frac{\sqrt{2}}{-B\_m}\\

\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \frac{\sqrt{F}}{-\sqrt{B\_m}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if B < 3.2999999999999999e-221

    1. Initial program 21.7%

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Simplified24.6%

      \[\leadsto \color{blue}{\frac{\sqrt{\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot F\right) \cdot \left(2 \cdot \left(A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}} \]
    3. Add Preprocessing
    4. Taylor expanded in A around -inf 10.8%

      \[\leadsto \frac{\sqrt{\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot F\right) \cdot \color{blue}{\left(4 \cdot C\right)}}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
    5. Step-by-step derivation
      1. *-commutative10.8%

        \[\leadsto \frac{\sqrt{\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot F\right) \cdot \color{blue}{\left(C \cdot 4\right)}}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
    6. Simplified10.8%

      \[\leadsto \frac{\sqrt{\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot F\right) \cdot \color{blue}{\left(C \cdot 4\right)}}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
    7. Step-by-step derivation
      1. clear-num10.8%

        \[\leadsto \color{blue}{\frac{1}{\frac{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot F\right) \cdot \left(C \cdot 4\right)}}}} \]
      2. inv-pow10.8%

        \[\leadsto \color{blue}{{\left(\frac{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot F\right) \cdot \left(C \cdot 4\right)}}\right)}^{-1}} \]
      3. associate-*l*11.5%

        \[\leadsto {\left(\frac{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\color{blue}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}}\right)}^{-1} \]
    8. Applied egg-rr11.5%

      \[\leadsto \color{blue}{{\left(\frac{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}\right)}^{-1}} \]
    9. Step-by-step derivation
      1. unpow-111.5%

        \[\leadsto \color{blue}{\frac{1}{\frac{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}}} \]
    10. Simplified11.5%

      \[\leadsto \color{blue}{\frac{1}{\frac{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}}} \]
    11. Step-by-step derivation
      1. neg-sub011.5%

        \[\leadsto \frac{1}{\frac{\color{blue}{0 - \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}} \]
      2. metadata-eval11.5%

        \[\leadsto \frac{1}{\frac{\color{blue}{\log 1} - \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}} \]
      3. div-sub9.1%

        \[\leadsto \frac{1}{\color{blue}{\frac{\log 1}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}} - \frac{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}}} \]
      4. metadata-eval9.1%

        \[\leadsto \frac{1}{\frac{\color{blue}{0}}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}} - \frac{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}} \]
      5. *-commutative9.1%

        \[\leadsto \frac{1}{\frac{0}{\sqrt{\color{blue}{\left(F \cdot \left(C \cdot 4\right)\right) \cdot \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}}} - \frac{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}} \]
      6. sqrt-prod4.9%

        \[\leadsto \frac{1}{\frac{0}{\color{blue}{\sqrt{F \cdot \left(C \cdot 4\right)} \cdot \sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}}} - \frac{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}} \]
      7. fma-undefine4.9%

        \[\leadsto \frac{1}{\frac{0}{\sqrt{F \cdot \left(C \cdot 4\right)} \cdot \sqrt{\color{blue}{B \cdot B + A \cdot \left(C \cdot -4\right)}}} - \frac{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}} \]
      8. add-sqr-sqrt4.7%

        \[\leadsto \frac{1}{\frac{0}{\sqrt{F \cdot \left(C \cdot 4\right)} \cdot \sqrt{B \cdot B + \color{blue}{\sqrt{A \cdot \left(C \cdot -4\right)} \cdot \sqrt{A \cdot \left(C \cdot -4\right)}}}} - \frac{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}} \]
      9. hypot-define4.7%

        \[\leadsto \frac{1}{\frac{0}{\sqrt{F \cdot \left(C \cdot 4\right)} \cdot \color{blue}{\mathsf{hypot}\left(B, \sqrt{A \cdot \left(C \cdot -4\right)}\right)}} - \frac{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}} \]
      10. associate-*r*4.7%

        \[\leadsto \frac{1}{\frac{0}{\sqrt{F \cdot \left(C \cdot 4\right)} \cdot \mathsf{hypot}\left(B, \sqrt{\color{blue}{\left(A \cdot C\right) \cdot -4}}\right)} - \frac{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}} \]
    12. Applied egg-rr7.3%

      \[\leadsto \frac{1}{\color{blue}{\frac{0}{\sqrt{F \cdot \left(C \cdot 4\right)} \cdot \mathsf{hypot}\left(B, \sqrt{\left(A \cdot C\right) \cdot -4}\right)} - \frac{\mathsf{fma}\left(B, B, \left(A \cdot C\right) \cdot -4\right)}{\sqrt{F \cdot \left(C \cdot 4\right)} \cdot \mathsf{hypot}\left(B, \sqrt{\left(A \cdot C\right) \cdot -4}\right)}}} \]
    13. Step-by-step derivation
      1. div09.5%

        \[\leadsto \frac{1}{\color{blue}{0} - \frac{\mathsf{fma}\left(B, B, \left(A \cdot C\right) \cdot -4\right)}{\sqrt{F \cdot \left(C \cdot 4\right)} \cdot \mathsf{hypot}\left(B, \sqrt{\left(A \cdot C\right) \cdot -4}\right)}} \]
      2. neg-sub09.6%

        \[\leadsto \frac{1}{\color{blue}{-\frac{\mathsf{fma}\left(B, B, \left(A \cdot C\right) \cdot -4\right)}{\sqrt{F \cdot \left(C \cdot 4\right)} \cdot \mathsf{hypot}\left(B, \sqrt{\left(A \cdot C\right) \cdot -4}\right)}}} \]
    14. Simplified10.5%

      \[\leadsto \frac{1}{\color{blue}{-\frac{\mathsf{hypot}\left(B, \sqrt{A \cdot \left(C \cdot -4\right)}\right)}{\sqrt{F \cdot \left(4 \cdot C\right)}}}} \]
    15. Step-by-step derivation
      1. pow1/210.5%

        \[\leadsto \frac{1}{-\frac{\mathsf{hypot}\left(B, \sqrt{A \cdot \left(C \cdot -4\right)}\right)}{\color{blue}{{\left(F \cdot \left(4 \cdot C\right)\right)}^{0.5}}}} \]
      2. associate-*r*10.5%

        \[\leadsto \frac{1}{-\frac{\mathsf{hypot}\left(B, \sqrt{A \cdot \left(C \cdot -4\right)}\right)}{{\color{blue}{\left(\left(F \cdot 4\right) \cdot C\right)}}^{0.5}}} \]
      3. unpow-prod-down11.2%

        \[\leadsto \frac{1}{-\frac{\mathsf{hypot}\left(B, \sqrt{A \cdot \left(C \cdot -4\right)}\right)}{\color{blue}{{\left(F \cdot 4\right)}^{0.5} \cdot {C}^{0.5}}}} \]
      4. pow1/211.2%

        \[\leadsto \frac{1}{-\frac{\mathsf{hypot}\left(B, \sqrt{A \cdot \left(C \cdot -4\right)}\right)}{{\left(F \cdot 4\right)}^{0.5} \cdot \color{blue}{\sqrt{C}}}} \]
    16. Applied egg-rr11.2%

      \[\leadsto \frac{1}{-\frac{\mathsf{hypot}\left(B, \sqrt{A \cdot \left(C \cdot -4\right)}\right)}{\color{blue}{{\left(F \cdot 4\right)}^{0.5} \cdot \sqrt{C}}}} \]
    17. Step-by-step derivation
      1. unpow1/211.2%

        \[\leadsto \frac{1}{-\frac{\mathsf{hypot}\left(B, \sqrt{A \cdot \left(C \cdot -4\right)}\right)}{\color{blue}{\sqrt{F \cdot 4}} \cdot \sqrt{C}}} \]
    18. Simplified11.2%

      \[\leadsto \frac{1}{-\frac{\mathsf{hypot}\left(B, \sqrt{A \cdot \left(C \cdot -4\right)}\right)}{\color{blue}{\sqrt{F \cdot 4} \cdot \sqrt{C}}}} \]

    if 3.2999999999999999e-221 < B < 1.15e14

    1. Initial program 33.9%

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Simplified44.8%

      \[\leadsto \color{blue}{\frac{\sqrt{\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot F\right) \cdot \left(2 \cdot \left(A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}} \]
    3. Add Preprocessing
    4. Taylor expanded in A around -inf 11.5%

      \[\leadsto \frac{\sqrt{\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot F\right) \cdot \color{blue}{\left(4 \cdot C\right)}}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
    5. Step-by-step derivation
      1. *-commutative11.5%

        \[\leadsto \frac{\sqrt{\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot F\right) \cdot \color{blue}{\left(C \cdot 4\right)}}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
    6. Simplified11.5%

      \[\leadsto \frac{\sqrt{\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot F\right) \cdot \color{blue}{\left(C \cdot 4\right)}}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
    7. Step-by-step derivation
      1. *-un-lft-identity11.5%

        \[\leadsto \frac{\color{blue}{1 \cdot \sqrt{\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot F\right) \cdot \left(C \cdot 4\right)}}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
      2. associate-*l*13.7%

        \[\leadsto \frac{1 \cdot \sqrt{\color{blue}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
    8. Applied egg-rr13.7%

      \[\leadsto \frac{\color{blue}{1 \cdot \sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
    9. Step-by-step derivation
      1. *-lft-identity13.7%

        \[\leadsto \frac{\color{blue}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
    10. Simplified13.7%

      \[\leadsto \frac{\color{blue}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]

    if 1.15e14 < B < 8.2000000000000003e145

    1. Initial program 27.2%

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Add Preprocessing
    3. Taylor expanded in C around 0 28.4%

      \[\leadsto \color{blue}{-1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A + \sqrt{{A}^{2} + {B}^{2}}\right)}\right)} \]
    4. Step-by-step derivation
      1. mul-1-neg28.4%

        \[\leadsto \color{blue}{-\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A + \sqrt{{A}^{2} + {B}^{2}}\right)}} \]
      2. *-commutative28.4%

        \[\leadsto -\color{blue}{\sqrt{F \cdot \left(A + \sqrt{{A}^{2} + {B}^{2}}\right)} \cdot \frac{\sqrt{2}}{B}} \]
      3. *-commutative28.4%

        \[\leadsto -\sqrt{\color{blue}{\left(A + \sqrt{{A}^{2} + {B}^{2}}\right) \cdot F}} \cdot \frac{\sqrt{2}}{B} \]
      4. +-commutative28.4%

        \[\leadsto -\sqrt{\left(A + \sqrt{\color{blue}{{B}^{2} + {A}^{2}}}\right) \cdot F} \cdot \frac{\sqrt{2}}{B} \]
      5. unpow228.4%

        \[\leadsto -\sqrt{\left(A + \sqrt{\color{blue}{B \cdot B} + {A}^{2}}\right) \cdot F} \cdot \frac{\sqrt{2}}{B} \]
      6. unpow228.4%

        \[\leadsto -\sqrt{\left(A + \sqrt{B \cdot B + \color{blue}{A \cdot A}}\right) \cdot F} \cdot \frac{\sqrt{2}}{B} \]
      7. hypot-define29.0%

        \[\leadsto -\sqrt{\left(A + \color{blue}{\mathsf{hypot}\left(B, A\right)}\right) \cdot F} \cdot \frac{\sqrt{2}}{B} \]
    5. Simplified29.0%

      \[\leadsto \color{blue}{-\sqrt{\left(A + \mathsf{hypot}\left(B, A\right)\right) \cdot F} \cdot \frac{\sqrt{2}}{B}} \]

    if 8.2000000000000003e145 < B

    1. Initial program 0.0%

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Add Preprocessing
    3. Taylor expanded in B around inf 44.3%

      \[\leadsto \color{blue}{-1 \cdot \left(\sqrt{\frac{F}{B}} \cdot \sqrt{2}\right)} \]
    4. Step-by-step derivation
      1. mul-1-neg44.3%

        \[\leadsto \color{blue}{-\sqrt{\frac{F}{B}} \cdot \sqrt{2}} \]
      2. *-commutative44.3%

        \[\leadsto -\color{blue}{\sqrt{2} \cdot \sqrt{\frac{F}{B}}} \]
    5. Simplified44.3%

      \[\leadsto \color{blue}{-\sqrt{2} \cdot \sqrt{\frac{F}{B}}} \]
    6. Step-by-step derivation
      1. sqrt-div66.9%

        \[\leadsto -\sqrt{2} \cdot \color{blue}{\frac{\sqrt{F}}{\sqrt{B}}} \]
    7. Applied egg-rr66.9%

      \[\leadsto -\sqrt{2} \cdot \color{blue}{\frac{\sqrt{F}}{\sqrt{B}}} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification18.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;B \leq 3.3 \cdot 10^{-221}:\\ \;\;\;\;\frac{-1}{\frac{\mathsf{hypot}\left(B, \sqrt{A \cdot \left(C \cdot -4\right)}\right)}{\sqrt{4 \cdot F} \cdot \sqrt{C}}}\\ \mathbf{elif}\;B \leq 1.15 \cdot 10^{+14}:\\ \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(4 \cdot C\right)\right)}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}\\ \mathbf{elif}\;B \leq 8.2 \cdot 10^{+145}:\\ \;\;\;\;\sqrt{F \cdot \left(A + \mathsf{hypot}\left(B, A\right)\right)} \cdot \frac{\sqrt{2}}{-B}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{2} \cdot \frac{\sqrt{F}}{-\sqrt{B}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 47.7% accurate, 1.9× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ [A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\ \\ \begin{array}{l} t_0 := F \cdot \left(4 \cdot C\right)\\ t_1 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\ \mathbf{if}\;B\_m \leq 2.02 \cdot 10^{-200}:\\ \;\;\;\;\frac{-1}{\mathsf{hypot}\left(B\_m, \sqrt{-4 \cdot \left(A \cdot C\right)}\right) \cdot {t\_0}^{-0.5}}\\ \mathbf{elif}\;B\_m \leq 5 \cdot 10^{+15}:\\ \;\;\;\;\frac{\sqrt{t\_1 \cdot t\_0}}{-t\_1}\\ \mathbf{elif}\;B\_m \leq 1.6 \cdot 10^{+147}:\\ \;\;\;\;\sqrt{F \cdot \left(A + \mathsf{hypot}\left(B\_m, A\right)\right)} \cdot \frac{\sqrt{2}}{-B\_m}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{2} \cdot \frac{\sqrt{F}}{-\sqrt{B\_m}}\\ \end{array} \end{array} \]
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
 :precision binary64
 (let* ((t_0 (* F (* 4.0 C))) (t_1 (fma B_m B_m (* A (* C -4.0)))))
   (if (<= B_m 2.02e-200)
     (/ -1.0 (* (hypot B_m (sqrt (* -4.0 (* A C)))) (pow t_0 -0.5)))
     (if (<= B_m 5e+15)
       (/ (sqrt (* t_1 t_0)) (- t_1))
       (if (<= B_m 1.6e+147)
         (* (sqrt (* F (+ A (hypot B_m A)))) (/ (sqrt 2.0) (- B_m)))
         (* (sqrt 2.0) (/ (sqrt F) (- (sqrt B_m)))))))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
	double t_0 = F * (4.0 * C);
	double t_1 = fma(B_m, B_m, (A * (C * -4.0)));
	double tmp;
	if (B_m <= 2.02e-200) {
		tmp = -1.0 / (hypot(B_m, sqrt((-4.0 * (A * C)))) * pow(t_0, -0.5));
	} else if (B_m <= 5e+15) {
		tmp = sqrt((t_1 * t_0)) / -t_1;
	} else if (B_m <= 1.6e+147) {
		tmp = sqrt((F * (A + hypot(B_m, A)))) * (sqrt(2.0) / -B_m);
	} else {
		tmp = sqrt(2.0) * (sqrt(F) / -sqrt(B_m));
	}
	return tmp;
}
B_m = abs(B)
A, B_m, C, F = sort([A, B_m, C, F])
function code(A, B_m, C, F)
	t_0 = Float64(F * Float64(4.0 * C))
	t_1 = fma(B_m, B_m, Float64(A * Float64(C * -4.0)))
	tmp = 0.0
	if (B_m <= 2.02e-200)
		tmp = Float64(-1.0 / Float64(hypot(B_m, sqrt(Float64(-4.0 * Float64(A * C)))) * (t_0 ^ -0.5)));
	elseif (B_m <= 5e+15)
		tmp = Float64(sqrt(Float64(t_1 * t_0)) / Float64(-t_1));
	elseif (B_m <= 1.6e+147)
		tmp = Float64(sqrt(Float64(F * Float64(A + hypot(B_m, A)))) * Float64(sqrt(2.0) / Float64(-B_m)));
	else
		tmp = Float64(sqrt(2.0) * Float64(sqrt(F) / Float64(-sqrt(B_m))));
	end
	return tmp
end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(F * N[(4.0 * C), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B$95$m, 2.02e-200], N[(-1.0 / N[(N[Sqrt[B$95$m ^ 2 + N[Sqrt[N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] ^ 2], $MachinePrecision] * N[Power[t$95$0, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B$95$m, 5e+15], N[(N[Sqrt[N[(t$95$1 * t$95$0), $MachinePrecision]], $MachinePrecision] / (-t$95$1)), $MachinePrecision], If[LessEqual[B$95$m, 1.6e+147], N[(N[Sqrt[N[(F * N[(A + N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[2.0], $MachinePrecision] / (-B$95$m)), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * N[(N[Sqrt[F], $MachinePrecision] / (-N[Sqrt[B$95$m], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := F \cdot \left(4 \cdot C\right)\\
t_1 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\
\mathbf{if}\;B\_m \leq 2.02 \cdot 10^{-200}:\\
\;\;\;\;\frac{-1}{\mathsf{hypot}\left(B\_m, \sqrt{-4 \cdot \left(A \cdot C\right)}\right) \cdot {t\_0}^{-0.5}}\\

\mathbf{elif}\;B\_m \leq 5 \cdot 10^{+15}:\\
\;\;\;\;\frac{\sqrt{t\_1 \cdot t\_0}}{-t\_1}\\

\mathbf{elif}\;B\_m \leq 1.6 \cdot 10^{+147}:\\
\;\;\;\;\sqrt{F \cdot \left(A + \mathsf{hypot}\left(B\_m, A\right)\right)} \cdot \frac{\sqrt{2}}{-B\_m}\\

\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \frac{\sqrt{F}}{-\sqrt{B\_m}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if B < 2.02000000000000001e-200

    1. Initial program 21.2%

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Simplified24.0%

      \[\leadsto \color{blue}{\frac{\sqrt{\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot F\right) \cdot \left(2 \cdot \left(A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}} \]
    3. Add Preprocessing
    4. Taylor expanded in A around -inf 10.6%

      \[\leadsto \frac{\sqrt{\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot F\right) \cdot \color{blue}{\left(4 \cdot C\right)}}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
    5. Step-by-step derivation
      1. *-commutative10.6%

        \[\leadsto \frac{\sqrt{\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot F\right) \cdot \color{blue}{\left(C \cdot 4\right)}}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
    6. Simplified10.6%

      \[\leadsto \frac{\sqrt{\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot F\right) \cdot \color{blue}{\left(C \cdot 4\right)}}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
    7. Step-by-step derivation
      1. clear-num10.6%

        \[\leadsto \color{blue}{\frac{1}{\frac{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot F\right) \cdot \left(C \cdot 4\right)}}}} \]
      2. inv-pow10.6%

        \[\leadsto \color{blue}{{\left(\frac{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot F\right) \cdot \left(C \cdot 4\right)}}\right)}^{-1}} \]
      3. associate-*l*11.3%

        \[\leadsto {\left(\frac{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\color{blue}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}}\right)}^{-1} \]
    8. Applied egg-rr11.3%

      \[\leadsto \color{blue}{{\left(\frac{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}\right)}^{-1}} \]
    9. Step-by-step derivation
      1. unpow-111.3%

        \[\leadsto \color{blue}{\frac{1}{\frac{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}}} \]
    10. Simplified11.3%

      \[\leadsto \color{blue}{\frac{1}{\frac{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}}} \]
    11. Step-by-step derivation
      1. neg-sub011.3%

        \[\leadsto \frac{1}{\frac{\color{blue}{0 - \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}} \]
      2. metadata-eval11.3%

        \[\leadsto \frac{1}{\frac{\color{blue}{\log 1} - \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}} \]
      3. div-sub8.9%

        \[\leadsto \frac{1}{\color{blue}{\frac{\log 1}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}} - \frac{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}}} \]
      4. metadata-eval8.9%

        \[\leadsto \frac{1}{\frac{\color{blue}{0}}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}} - \frac{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}} \]
      5. *-commutative8.9%

        \[\leadsto \frac{1}{\frac{0}{\sqrt{\color{blue}{\left(F \cdot \left(C \cdot 4\right)\right) \cdot \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}}} - \frac{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}} \]
      6. sqrt-prod4.8%

        \[\leadsto \frac{1}{\frac{0}{\color{blue}{\sqrt{F \cdot \left(C \cdot 4\right)} \cdot \sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}}} - \frac{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}} \]
      7. fma-undefine4.8%

        \[\leadsto \frac{1}{\frac{0}{\sqrt{F \cdot \left(C \cdot 4\right)} \cdot \sqrt{\color{blue}{B \cdot B + A \cdot \left(C \cdot -4\right)}}} - \frac{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}} \]
      8. add-sqr-sqrt4.7%

        \[\leadsto \frac{1}{\frac{0}{\sqrt{F \cdot \left(C \cdot 4\right)} \cdot \sqrt{B \cdot B + \color{blue}{\sqrt{A \cdot \left(C \cdot -4\right)} \cdot \sqrt{A \cdot \left(C \cdot -4\right)}}}} - \frac{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}} \]
      9. hypot-define4.7%

        \[\leadsto \frac{1}{\frac{0}{\sqrt{F \cdot \left(C \cdot 4\right)} \cdot \color{blue}{\mathsf{hypot}\left(B, \sqrt{A \cdot \left(C \cdot -4\right)}\right)}} - \frac{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}} \]
      10. associate-*r*4.7%

        \[\leadsto \frac{1}{\frac{0}{\sqrt{F \cdot \left(C \cdot 4\right)} \cdot \mathsf{hypot}\left(B, \sqrt{\color{blue}{\left(A \cdot C\right) \cdot -4}}\right)} - \frac{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}} \]
    12. Applied egg-rr8.3%

      \[\leadsto \frac{1}{\color{blue}{\frac{0}{\sqrt{F \cdot \left(C \cdot 4\right)} \cdot \mathsf{hypot}\left(B, \sqrt{\left(A \cdot C\right) \cdot -4}\right)} - \frac{\mathsf{fma}\left(B, B, \left(A \cdot C\right) \cdot -4\right)}{\sqrt{F \cdot \left(C \cdot 4\right)} \cdot \mathsf{hypot}\left(B, \sqrt{\left(A \cdot C\right) \cdot -4}\right)}}} \]
    13. Step-by-step derivation
      1. div010.5%

        \[\leadsto \frac{1}{\color{blue}{0} - \frac{\mathsf{fma}\left(B, B, \left(A \cdot C\right) \cdot -4\right)}{\sqrt{F \cdot \left(C \cdot 4\right)} \cdot \mathsf{hypot}\left(B, \sqrt{\left(A \cdot C\right) \cdot -4}\right)}} \]
      2. neg-sub010.6%

        \[\leadsto \frac{1}{\color{blue}{-\frac{\mathsf{fma}\left(B, B, \left(A \cdot C\right) \cdot -4\right)}{\sqrt{F \cdot \left(C \cdot 4\right)} \cdot \mathsf{hypot}\left(B, \sqrt{\left(A \cdot C\right) \cdot -4}\right)}}} \]
    14. Simplified11.5%

      \[\leadsto \frac{1}{\color{blue}{-\frac{\mathsf{hypot}\left(B, \sqrt{A \cdot \left(C \cdot -4\right)}\right)}{\sqrt{F \cdot \left(4 \cdot C\right)}}}} \]
    15. Step-by-step derivation
      1. div-inv11.4%

        \[\leadsto \frac{1}{-\color{blue}{\mathsf{hypot}\left(B, \sqrt{A \cdot \left(C \cdot -4\right)}\right) \cdot \frac{1}{\sqrt{F \cdot \left(4 \cdot C\right)}}}} \]
      2. associate-*r*11.4%

        \[\leadsto \frac{1}{-\mathsf{hypot}\left(B, \sqrt{\color{blue}{\left(A \cdot C\right) \cdot -4}}\right) \cdot \frac{1}{\sqrt{F \cdot \left(4 \cdot C\right)}}} \]
      3. *-commutative11.4%

        \[\leadsto \frac{1}{-\mathsf{hypot}\left(B, \sqrt{\color{blue}{-4 \cdot \left(A \cdot C\right)}}\right) \cdot \frac{1}{\sqrt{F \cdot \left(4 \cdot C\right)}}} \]
      4. *-commutative11.4%

        \[\leadsto \frac{1}{-\mathsf{hypot}\left(B, \sqrt{-4 \cdot \color{blue}{\left(C \cdot A\right)}}\right) \cdot \frac{1}{\sqrt{F \cdot \left(4 \cdot C\right)}}} \]
      5. pow1/211.5%

        \[\leadsto \frac{1}{-\mathsf{hypot}\left(B, \sqrt{-4 \cdot \left(C \cdot A\right)}\right) \cdot \frac{1}{\color{blue}{{\left(F \cdot \left(4 \cdot C\right)\right)}^{0.5}}}} \]
      6. pow-flip11.5%

        \[\leadsto \frac{1}{-\mathsf{hypot}\left(B, \sqrt{-4 \cdot \left(C \cdot A\right)}\right) \cdot \color{blue}{{\left(F \cdot \left(4 \cdot C\right)\right)}^{\left(-0.5\right)}}} \]
      7. *-commutative11.5%

        \[\leadsto \frac{1}{-\mathsf{hypot}\left(B, \sqrt{-4 \cdot \left(C \cdot A\right)}\right) \cdot {\left(F \cdot \color{blue}{\left(C \cdot 4\right)}\right)}^{\left(-0.5\right)}} \]
      8. metadata-eval11.5%

        \[\leadsto \frac{1}{-\mathsf{hypot}\left(B, \sqrt{-4 \cdot \left(C \cdot A\right)}\right) \cdot {\left(F \cdot \left(C \cdot 4\right)\right)}^{\color{blue}{-0.5}}} \]
    16. Applied egg-rr11.5%

      \[\leadsto \frac{1}{-\color{blue}{\mathsf{hypot}\left(B, \sqrt{-4 \cdot \left(C \cdot A\right)}\right) \cdot {\left(F \cdot \left(C \cdot 4\right)\right)}^{-0.5}}} \]

    if 2.02000000000000001e-200 < B < 5e15

    1. Initial program 37.2%

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Simplified49.2%

      \[\leadsto \color{blue}{\frac{\sqrt{\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot F\right) \cdot \left(2 \cdot \left(A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}} \]
    3. Add Preprocessing
    4. Taylor expanded in A around -inf 12.4%

      \[\leadsto \frac{\sqrt{\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot F\right) \cdot \color{blue}{\left(4 \cdot C\right)}}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
    5. Step-by-step derivation
      1. *-commutative12.4%

        \[\leadsto \frac{\sqrt{\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot F\right) \cdot \color{blue}{\left(C \cdot 4\right)}}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
    6. Simplified12.4%

      \[\leadsto \frac{\sqrt{\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot F\right) \cdot \color{blue}{\left(C \cdot 4\right)}}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
    7. Step-by-step derivation
      1. *-un-lft-identity12.4%

        \[\leadsto \frac{\color{blue}{1 \cdot \sqrt{\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot F\right) \cdot \left(C \cdot 4\right)}}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
      2. associate-*l*14.9%

        \[\leadsto \frac{1 \cdot \sqrt{\color{blue}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
    8. Applied egg-rr14.9%

      \[\leadsto \frac{\color{blue}{1 \cdot \sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
    9. Step-by-step derivation
      1. *-lft-identity14.9%

        \[\leadsto \frac{\color{blue}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
    10. Simplified14.9%

      \[\leadsto \frac{\color{blue}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]

    if 5e15 < B < 1.59999999999999989e147

    1. Initial program 27.2%

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Add Preprocessing
    3. Taylor expanded in C around 0 28.4%

      \[\leadsto \color{blue}{-1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A + \sqrt{{A}^{2} + {B}^{2}}\right)}\right)} \]
    4. Step-by-step derivation
      1. mul-1-neg28.4%

        \[\leadsto \color{blue}{-\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A + \sqrt{{A}^{2} + {B}^{2}}\right)}} \]
      2. *-commutative28.4%

        \[\leadsto -\color{blue}{\sqrt{F \cdot \left(A + \sqrt{{A}^{2} + {B}^{2}}\right)} \cdot \frac{\sqrt{2}}{B}} \]
      3. *-commutative28.4%

        \[\leadsto -\sqrt{\color{blue}{\left(A + \sqrt{{A}^{2} + {B}^{2}}\right) \cdot F}} \cdot \frac{\sqrt{2}}{B} \]
      4. +-commutative28.4%

        \[\leadsto -\sqrt{\left(A + \sqrt{\color{blue}{{B}^{2} + {A}^{2}}}\right) \cdot F} \cdot \frac{\sqrt{2}}{B} \]
      5. unpow228.4%

        \[\leadsto -\sqrt{\left(A + \sqrt{\color{blue}{B \cdot B} + {A}^{2}}\right) \cdot F} \cdot \frac{\sqrt{2}}{B} \]
      6. unpow228.4%

        \[\leadsto -\sqrt{\left(A + \sqrt{B \cdot B + \color{blue}{A \cdot A}}\right) \cdot F} \cdot \frac{\sqrt{2}}{B} \]
      7. hypot-define29.0%

        \[\leadsto -\sqrt{\left(A + \color{blue}{\mathsf{hypot}\left(B, A\right)}\right) \cdot F} \cdot \frac{\sqrt{2}}{B} \]
    5. Simplified29.0%

      \[\leadsto \color{blue}{-\sqrt{\left(A + \mathsf{hypot}\left(B, A\right)\right) \cdot F} \cdot \frac{\sqrt{2}}{B}} \]

    if 1.59999999999999989e147 < B

    1. Initial program 0.0%

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Add Preprocessing
    3. Taylor expanded in B around inf 44.3%

      \[\leadsto \color{blue}{-1 \cdot \left(\sqrt{\frac{F}{B}} \cdot \sqrt{2}\right)} \]
    4. Step-by-step derivation
      1. mul-1-neg44.3%

        \[\leadsto \color{blue}{-\sqrt{\frac{F}{B}} \cdot \sqrt{2}} \]
      2. *-commutative44.3%

        \[\leadsto -\color{blue}{\sqrt{2} \cdot \sqrt{\frac{F}{B}}} \]
    5. Simplified44.3%

      \[\leadsto \color{blue}{-\sqrt{2} \cdot \sqrt{\frac{F}{B}}} \]
    6. Step-by-step derivation
      1. sqrt-div66.9%

        \[\leadsto -\sqrt{2} \cdot \color{blue}{\frac{\sqrt{F}}{\sqrt{B}}} \]
    7. Applied egg-rr66.9%

      \[\leadsto -\sqrt{2} \cdot \color{blue}{\frac{\sqrt{F}}{\sqrt{B}}} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification19.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;B \leq 2.02 \cdot 10^{-200}:\\ \;\;\;\;\frac{-1}{\mathsf{hypot}\left(B, \sqrt{-4 \cdot \left(A \cdot C\right)}\right) \cdot {\left(F \cdot \left(4 \cdot C\right)\right)}^{-0.5}}\\ \mathbf{elif}\;B \leq 5 \cdot 10^{+15}:\\ \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(4 \cdot C\right)\right)}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}\\ \mathbf{elif}\;B \leq 1.6 \cdot 10^{+147}:\\ \;\;\;\;\sqrt{F \cdot \left(A + \mathsf{hypot}\left(B, A\right)\right)} \cdot \frac{\sqrt{2}}{-B}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{2} \cdot \frac{\sqrt{F}}{-\sqrt{B}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 47.5% accurate, 1.9× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ [A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\ \\ \begin{array}{l} t_0 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\ \mathbf{if}\;B\_m \leq 1.26 \cdot 10^{-199}:\\ \;\;\;\;\frac{-1}{\mathsf{hypot}\left(B\_m, \sqrt{-4 \cdot \left(A \cdot C\right)}\right) \cdot {\left(F \cdot \left(4 \cdot C\right)\right)}^{-0.5}}\\ \mathbf{elif}\;B\_m \leq 13500000000000:\\ \;\;\;\;\frac{\sqrt{\left(4 \cdot C\right) \cdot \left(F \cdot t\_0\right)}}{-t\_0}\\ \mathbf{elif}\;B\_m \leq 5 \cdot 10^{+146}:\\ \;\;\;\;\sqrt{F \cdot \left(A + \mathsf{hypot}\left(B\_m, A\right)\right)} \cdot \frac{\sqrt{2}}{-B\_m}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{2} \cdot \frac{\sqrt{F}}{-\sqrt{B\_m}}\\ \end{array} \end{array} \]
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
 :precision binary64
 (let* ((t_0 (fma B_m B_m (* A (* C -4.0)))))
   (if (<= B_m 1.26e-199)
     (/
      -1.0
      (* (hypot B_m (sqrt (* -4.0 (* A C)))) (pow (* F (* 4.0 C)) -0.5)))
     (if (<= B_m 13500000000000.0)
       (/ (sqrt (* (* 4.0 C) (* F t_0))) (- t_0))
       (if (<= B_m 5e+146)
         (* (sqrt (* F (+ A (hypot B_m A)))) (/ (sqrt 2.0) (- B_m)))
         (* (sqrt 2.0) (/ (sqrt F) (- (sqrt B_m)))))))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
	double t_0 = fma(B_m, B_m, (A * (C * -4.0)));
	double tmp;
	if (B_m <= 1.26e-199) {
		tmp = -1.0 / (hypot(B_m, sqrt((-4.0 * (A * C)))) * pow((F * (4.0 * C)), -0.5));
	} else if (B_m <= 13500000000000.0) {
		tmp = sqrt(((4.0 * C) * (F * t_0))) / -t_0;
	} else if (B_m <= 5e+146) {
		tmp = sqrt((F * (A + hypot(B_m, A)))) * (sqrt(2.0) / -B_m);
	} else {
		tmp = sqrt(2.0) * (sqrt(F) / -sqrt(B_m));
	}
	return tmp;
}
B_m = abs(B)
A, B_m, C, F = sort([A, B_m, C, F])
function code(A, B_m, C, F)
	t_0 = fma(B_m, B_m, Float64(A * Float64(C * -4.0)))
	tmp = 0.0
	if (B_m <= 1.26e-199)
		tmp = Float64(-1.0 / Float64(hypot(B_m, sqrt(Float64(-4.0 * Float64(A * C)))) * (Float64(F * Float64(4.0 * C)) ^ -0.5)));
	elseif (B_m <= 13500000000000.0)
		tmp = Float64(sqrt(Float64(Float64(4.0 * C) * Float64(F * t_0))) / Float64(-t_0));
	elseif (B_m <= 5e+146)
		tmp = Float64(sqrt(Float64(F * Float64(A + hypot(B_m, A)))) * Float64(sqrt(2.0) / Float64(-B_m)));
	else
		tmp = Float64(sqrt(2.0) * Float64(sqrt(F) / Float64(-sqrt(B_m))));
	end
	return tmp
end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B$95$m, 1.26e-199], N[(-1.0 / N[(N[Sqrt[B$95$m ^ 2 + N[Sqrt[N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] ^ 2], $MachinePrecision] * N[Power[N[(F * N[(4.0 * C), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B$95$m, 13500000000000.0], N[(N[Sqrt[N[(N[(4.0 * C), $MachinePrecision] * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-t$95$0)), $MachinePrecision], If[LessEqual[B$95$m, 5e+146], N[(N[Sqrt[N[(F * N[(A + N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[2.0], $MachinePrecision] / (-B$95$m)), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * N[(N[Sqrt[F], $MachinePrecision] / (-N[Sqrt[B$95$m], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\
\mathbf{if}\;B\_m \leq 1.26 \cdot 10^{-199}:\\
\;\;\;\;\frac{-1}{\mathsf{hypot}\left(B\_m, \sqrt{-4 \cdot \left(A \cdot C\right)}\right) \cdot {\left(F \cdot \left(4 \cdot C\right)\right)}^{-0.5}}\\

\mathbf{elif}\;B\_m \leq 13500000000000:\\
\;\;\;\;\frac{\sqrt{\left(4 \cdot C\right) \cdot \left(F \cdot t\_0\right)}}{-t\_0}\\

\mathbf{elif}\;B\_m \leq 5 \cdot 10^{+146}:\\
\;\;\;\;\sqrt{F \cdot \left(A + \mathsf{hypot}\left(B\_m, A\right)\right)} \cdot \frac{\sqrt{2}}{-B\_m}\\

\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \frac{\sqrt{F}}{-\sqrt{B\_m}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if B < 1.26000000000000006e-199

    1. Initial program 21.2%

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Simplified24.0%

      \[\leadsto \color{blue}{\frac{\sqrt{\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot F\right) \cdot \left(2 \cdot \left(A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}} \]
    3. Add Preprocessing
    4. Taylor expanded in A around -inf 10.6%

      \[\leadsto \frac{\sqrt{\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot F\right) \cdot \color{blue}{\left(4 \cdot C\right)}}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
    5. Step-by-step derivation
      1. *-commutative10.6%

        \[\leadsto \frac{\sqrt{\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot F\right) \cdot \color{blue}{\left(C \cdot 4\right)}}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
    6. Simplified10.6%

      \[\leadsto \frac{\sqrt{\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot F\right) \cdot \color{blue}{\left(C \cdot 4\right)}}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
    7. Step-by-step derivation
      1. clear-num10.6%

        \[\leadsto \color{blue}{\frac{1}{\frac{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot F\right) \cdot \left(C \cdot 4\right)}}}} \]
      2. inv-pow10.6%

        \[\leadsto \color{blue}{{\left(\frac{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot F\right) \cdot \left(C \cdot 4\right)}}\right)}^{-1}} \]
      3. associate-*l*11.3%

        \[\leadsto {\left(\frac{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\color{blue}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}}\right)}^{-1} \]
    8. Applied egg-rr11.3%

      \[\leadsto \color{blue}{{\left(\frac{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}\right)}^{-1}} \]
    9. Step-by-step derivation
      1. unpow-111.3%

        \[\leadsto \color{blue}{\frac{1}{\frac{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}}} \]
    10. Simplified11.3%

      \[\leadsto \color{blue}{\frac{1}{\frac{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}}} \]
    11. Step-by-step derivation
      1. neg-sub011.3%

        \[\leadsto \frac{1}{\frac{\color{blue}{0 - \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}} \]
      2. metadata-eval11.3%

        \[\leadsto \frac{1}{\frac{\color{blue}{\log 1} - \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}} \]
      3. div-sub8.9%

        \[\leadsto \frac{1}{\color{blue}{\frac{\log 1}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}} - \frac{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}}} \]
      4. metadata-eval8.9%

        \[\leadsto \frac{1}{\frac{\color{blue}{0}}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}} - \frac{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}} \]
      5. *-commutative8.9%

        \[\leadsto \frac{1}{\frac{0}{\sqrt{\color{blue}{\left(F \cdot \left(C \cdot 4\right)\right) \cdot \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}}} - \frac{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}} \]
      6. sqrt-prod4.8%

        \[\leadsto \frac{1}{\frac{0}{\color{blue}{\sqrt{F \cdot \left(C \cdot 4\right)} \cdot \sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}}} - \frac{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}} \]
      7. fma-undefine4.8%

        \[\leadsto \frac{1}{\frac{0}{\sqrt{F \cdot \left(C \cdot 4\right)} \cdot \sqrt{\color{blue}{B \cdot B + A \cdot \left(C \cdot -4\right)}}} - \frac{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}} \]
      8. add-sqr-sqrt4.7%

        \[\leadsto \frac{1}{\frac{0}{\sqrt{F \cdot \left(C \cdot 4\right)} \cdot \sqrt{B \cdot B + \color{blue}{\sqrt{A \cdot \left(C \cdot -4\right)} \cdot \sqrt{A \cdot \left(C \cdot -4\right)}}}} - \frac{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}} \]
      9. hypot-define4.7%

        \[\leadsto \frac{1}{\frac{0}{\sqrt{F \cdot \left(C \cdot 4\right)} \cdot \color{blue}{\mathsf{hypot}\left(B, \sqrt{A \cdot \left(C \cdot -4\right)}\right)}} - \frac{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}} \]
      10. associate-*r*4.7%

        \[\leadsto \frac{1}{\frac{0}{\sqrt{F \cdot \left(C \cdot 4\right)} \cdot \mathsf{hypot}\left(B, \sqrt{\color{blue}{\left(A \cdot C\right) \cdot -4}}\right)} - \frac{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(C \cdot 4\right)\right)}}} \]
    12. Applied egg-rr8.3%

      \[\leadsto \frac{1}{\color{blue}{\frac{0}{\sqrt{F \cdot \left(C \cdot 4\right)} \cdot \mathsf{hypot}\left(B, \sqrt{\left(A \cdot C\right) \cdot -4}\right)} - \frac{\mathsf{fma}\left(B, B, \left(A \cdot C\right) \cdot -4\right)}{\sqrt{F \cdot \left(C \cdot 4\right)} \cdot \mathsf{hypot}\left(B, \sqrt{\left(A \cdot C\right) \cdot -4}\right)}}} \]
    13. Step-by-step derivation
      1. div010.5%

        \[\leadsto \frac{1}{\color{blue}{0} - \frac{\mathsf{fma}\left(B, B, \left(A \cdot C\right) \cdot -4\right)}{\sqrt{F \cdot \left(C \cdot 4\right)} \cdot \mathsf{hypot}\left(B, \sqrt{\left(A \cdot C\right) \cdot -4}\right)}} \]
      2. neg-sub010.6%

        \[\leadsto \frac{1}{\color{blue}{-\frac{\mathsf{fma}\left(B, B, \left(A \cdot C\right) \cdot -4\right)}{\sqrt{F \cdot \left(C \cdot 4\right)} \cdot \mathsf{hypot}\left(B, \sqrt{\left(A \cdot C\right) \cdot -4}\right)}}} \]
    14. Simplified11.5%

      \[\leadsto \frac{1}{\color{blue}{-\frac{\mathsf{hypot}\left(B, \sqrt{A \cdot \left(C \cdot -4\right)}\right)}{\sqrt{F \cdot \left(4 \cdot C\right)}}}} \]
    15. Step-by-step derivation
      1. div-inv11.4%

        \[\leadsto \frac{1}{-\color{blue}{\mathsf{hypot}\left(B, \sqrt{A \cdot \left(C \cdot -4\right)}\right) \cdot \frac{1}{\sqrt{F \cdot \left(4 \cdot C\right)}}}} \]
      2. associate-*r*11.4%

        \[\leadsto \frac{1}{-\mathsf{hypot}\left(B, \sqrt{\color{blue}{\left(A \cdot C\right) \cdot -4}}\right) \cdot \frac{1}{\sqrt{F \cdot \left(4 \cdot C\right)}}} \]
      3. *-commutative11.4%

        \[\leadsto \frac{1}{-\mathsf{hypot}\left(B, \sqrt{\color{blue}{-4 \cdot \left(A \cdot C\right)}}\right) \cdot \frac{1}{\sqrt{F \cdot \left(4 \cdot C\right)}}} \]
      4. *-commutative11.4%

        \[\leadsto \frac{1}{-\mathsf{hypot}\left(B, \sqrt{-4 \cdot \color{blue}{\left(C \cdot A\right)}}\right) \cdot \frac{1}{\sqrt{F \cdot \left(4 \cdot C\right)}}} \]
      5. pow1/211.5%

        \[\leadsto \frac{1}{-\mathsf{hypot}\left(B, \sqrt{-4 \cdot \left(C \cdot A\right)}\right) \cdot \frac{1}{\color{blue}{{\left(F \cdot \left(4 \cdot C\right)\right)}^{0.5}}}} \]
      6. pow-flip11.5%

        \[\leadsto \frac{1}{-\mathsf{hypot}\left(B, \sqrt{-4 \cdot \left(C \cdot A\right)}\right) \cdot \color{blue}{{\left(F \cdot \left(4 \cdot C\right)\right)}^{\left(-0.5\right)}}} \]
      7. *-commutative11.5%

        \[\leadsto \frac{1}{-\mathsf{hypot}\left(B, \sqrt{-4 \cdot \left(C \cdot A\right)}\right) \cdot {\left(F \cdot \color{blue}{\left(C \cdot 4\right)}\right)}^{\left(-0.5\right)}} \]
      8. metadata-eval11.5%

        \[\leadsto \frac{1}{-\mathsf{hypot}\left(B, \sqrt{-4 \cdot \left(C \cdot A\right)}\right) \cdot {\left(F \cdot \left(C \cdot 4\right)\right)}^{\color{blue}{-0.5}}} \]
    16. Applied egg-rr11.5%

      \[\leadsto \frac{1}{-\color{blue}{\mathsf{hypot}\left(B, \sqrt{-4 \cdot \left(C \cdot A\right)}\right) \cdot {\left(F \cdot \left(C \cdot 4\right)\right)}^{-0.5}}} \]

    if 1.26000000000000006e-199 < B < 1.35e13

    1. Initial program 37.2%

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Simplified49.2%

      \[\leadsto \color{blue}{\frac{\sqrt{\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot F\right) \cdot \left(2 \cdot \left(A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}} \]
    3. Add Preprocessing
    4. Taylor expanded in A around -inf 12.4%

      \[\leadsto \frac{\sqrt{\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot F\right) \cdot \color{blue}{\left(4 \cdot C\right)}}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
    5. Step-by-step derivation
      1. *-commutative12.4%

        \[\leadsto \frac{\sqrt{\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot F\right) \cdot \color{blue}{\left(C \cdot 4\right)}}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
    6. Simplified12.4%

      \[\leadsto \frac{\sqrt{\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot F\right) \cdot \color{blue}{\left(C \cdot 4\right)}}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]

    if 1.35e13 < B < 4.9999999999999999e146

    1. Initial program 27.2%

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Add Preprocessing
    3. Taylor expanded in C around 0 28.4%

      \[\leadsto \color{blue}{-1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A + \sqrt{{A}^{2} + {B}^{2}}\right)}\right)} \]
    4. Step-by-step derivation
      1. mul-1-neg28.4%

        \[\leadsto \color{blue}{-\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A + \sqrt{{A}^{2} + {B}^{2}}\right)}} \]
      2. *-commutative28.4%

        \[\leadsto -\color{blue}{\sqrt{F \cdot \left(A + \sqrt{{A}^{2} + {B}^{2}}\right)} \cdot \frac{\sqrt{2}}{B}} \]
      3. *-commutative28.4%

        \[\leadsto -\sqrt{\color{blue}{\left(A + \sqrt{{A}^{2} + {B}^{2}}\right) \cdot F}} \cdot \frac{\sqrt{2}}{B} \]
      4. +-commutative28.4%

        \[\leadsto -\sqrt{\left(A + \sqrt{\color{blue}{{B}^{2} + {A}^{2}}}\right) \cdot F} \cdot \frac{\sqrt{2}}{B} \]
      5. unpow228.4%

        \[\leadsto -\sqrt{\left(A + \sqrt{\color{blue}{B \cdot B} + {A}^{2}}\right) \cdot F} \cdot \frac{\sqrt{2}}{B} \]
      6. unpow228.4%

        \[\leadsto -\sqrt{\left(A + \sqrt{B \cdot B + \color{blue}{A \cdot A}}\right) \cdot F} \cdot \frac{\sqrt{2}}{B} \]
      7. hypot-define29.0%

        \[\leadsto -\sqrt{\left(A + \color{blue}{\mathsf{hypot}\left(B, A\right)}\right) \cdot F} \cdot \frac{\sqrt{2}}{B} \]
    5. Simplified29.0%

      \[\leadsto \color{blue}{-\sqrt{\left(A + \mathsf{hypot}\left(B, A\right)\right) \cdot F} \cdot \frac{\sqrt{2}}{B}} \]

    if 4.9999999999999999e146 < B

    1. Initial program 0.0%

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Add Preprocessing
    3. Taylor expanded in B around inf 44.3%

      \[\leadsto \color{blue}{-1 \cdot \left(\sqrt{\frac{F}{B}} \cdot \sqrt{2}\right)} \]
    4. Step-by-step derivation
      1. mul-1-neg44.3%

        \[\leadsto \color{blue}{-\sqrt{\frac{F}{B}} \cdot \sqrt{2}} \]
      2. *-commutative44.3%

        \[\leadsto -\color{blue}{\sqrt{2} \cdot \sqrt{\frac{F}{B}}} \]
    5. Simplified44.3%

      \[\leadsto \color{blue}{-\sqrt{2} \cdot \sqrt{\frac{F}{B}}} \]
    6. Step-by-step derivation
      1. sqrt-div66.9%

        \[\leadsto -\sqrt{2} \cdot \color{blue}{\frac{\sqrt{F}}{\sqrt{B}}} \]
    7. Applied egg-rr66.9%

      \[\leadsto -\sqrt{2} \cdot \color{blue}{\frac{\sqrt{F}}{\sqrt{B}}} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification18.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;B \leq 1.26 \cdot 10^{-199}:\\ \;\;\;\;\frac{-1}{\mathsf{hypot}\left(B, \sqrt{-4 \cdot \left(A \cdot C\right)}\right) \cdot {\left(F \cdot \left(4 \cdot C\right)\right)}^{-0.5}}\\ \mathbf{elif}\;B \leq 13500000000000:\\ \;\;\;\;\frac{\sqrt{\left(4 \cdot C\right) \cdot \left(F \cdot \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)\right)}}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}\\ \mathbf{elif}\;B \leq 5 \cdot 10^{+146}:\\ \;\;\;\;\sqrt{F \cdot \left(A + \mathsf{hypot}\left(B, A\right)\right)} \cdot \frac{\sqrt{2}}{-B}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{2} \cdot \frac{\sqrt{F}}{-\sqrt{B}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 48.4% accurate, 1.9× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ [A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\ \\ \begin{array}{l} \mathbf{if}\;B\_m \leq 7.3 \cdot 10^{-118}:\\ \;\;\;\;-\sqrt{\frac{F}{-A}}\\ \mathbf{elif}\;B\_m \leq 1.05 \cdot 10^{+21}:\\ \;\;\;\;-\sqrt{2 \cdot \frac{F \cdot \left(\left(A + C\right) + \mathsf{hypot}\left(B\_m, A - C\right)\right)}{\mathsf{fma}\left(-4, A \cdot C, B\_m \cdot B\_m\right)}}\\ \mathbf{elif}\;B\_m \leq 10^{+146}:\\ \;\;\;\;\sqrt{F \cdot \left(A + \mathsf{hypot}\left(B\_m, A\right)\right)} \cdot \frac{\sqrt{2}}{-B\_m}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{2} \cdot \frac{\sqrt{F}}{-\sqrt{B\_m}}\\ \end{array} \end{array} \]
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
 :precision binary64
 (if (<= B_m 7.3e-118)
   (- (sqrt (/ F (- A))))
   (if (<= B_m 1.05e+21)
     (-
      (sqrt
       (*
        2.0
        (/
         (* F (+ (+ A C) (hypot B_m (- A C))))
         (fma -4.0 (* A C) (* B_m B_m))))))
     (if (<= B_m 1e+146)
       (* (sqrt (* F (+ A (hypot B_m A)))) (/ (sqrt 2.0) (- B_m)))
       (* (sqrt 2.0) (/ (sqrt F) (- (sqrt B_m))))))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
	double tmp;
	if (B_m <= 7.3e-118) {
		tmp = -sqrt((F / -A));
	} else if (B_m <= 1.05e+21) {
		tmp = -sqrt((2.0 * ((F * ((A + C) + hypot(B_m, (A - C)))) / fma(-4.0, (A * C), (B_m * B_m)))));
	} else if (B_m <= 1e+146) {
		tmp = sqrt((F * (A + hypot(B_m, A)))) * (sqrt(2.0) / -B_m);
	} else {
		tmp = sqrt(2.0) * (sqrt(F) / -sqrt(B_m));
	}
	return tmp;
}
B_m = abs(B)
A, B_m, C, F = sort([A, B_m, C, F])
function code(A, B_m, C, F)
	tmp = 0.0
	if (B_m <= 7.3e-118)
		tmp = Float64(-sqrt(Float64(F / Float64(-A))));
	elseif (B_m <= 1.05e+21)
		tmp = Float64(-sqrt(Float64(2.0 * Float64(Float64(F * Float64(Float64(A + C) + hypot(B_m, Float64(A - C)))) / fma(-4.0, Float64(A * C), Float64(B_m * B_m))))));
	elseif (B_m <= 1e+146)
		tmp = Float64(sqrt(Float64(F * Float64(A + hypot(B_m, A)))) * Float64(sqrt(2.0) / Float64(-B_m)));
	else
		tmp = Float64(sqrt(2.0) * Float64(sqrt(F) / Float64(-sqrt(B_m))));
	end
	return tmp
end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := If[LessEqual[B$95$m, 7.3e-118], (-N[Sqrt[N[(F / (-A)), $MachinePrecision]], $MachinePrecision]), If[LessEqual[B$95$m, 1.05e+21], (-N[Sqrt[N[(2.0 * N[(N[(F * N[(N[(A + C), $MachinePrecision] + N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(-4.0 * N[(A * C), $MachinePrecision] + N[(B$95$m * B$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), If[LessEqual[B$95$m, 1e+146], N[(N[Sqrt[N[(F * N[(A + N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[2.0], $MachinePrecision] / (-B$95$m)), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * N[(N[Sqrt[F], $MachinePrecision] / (-N[Sqrt[B$95$m], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;B\_m \leq 7.3 \cdot 10^{-118}:\\
\;\;\;\;-\sqrt{\frac{F}{-A}}\\

\mathbf{elif}\;B\_m \leq 1.05 \cdot 10^{+21}:\\
\;\;\;\;-\sqrt{2 \cdot \frac{F \cdot \left(\left(A + C\right) + \mathsf{hypot}\left(B\_m, A - C\right)\right)}{\mathsf{fma}\left(-4, A \cdot C, B\_m \cdot B\_m\right)}}\\

\mathbf{elif}\;B\_m \leq 10^{+146}:\\
\;\;\;\;\sqrt{F \cdot \left(A + \mathsf{hypot}\left(B\_m, A\right)\right)} \cdot \frac{\sqrt{2}}{-B\_m}\\

\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \frac{\sqrt{F}}{-\sqrt{B\_m}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if B < 7.2999999999999999e-118

    1. Initial program 22.2%

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Add Preprocessing
    3. Taylor expanded in F around 0 15.2%

      \[\leadsto \color{blue}{-1 \cdot \left(\sqrt{\frac{F \cdot \left(A + \left(C + \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right)\right)}{{B}^{2} - 4 \cdot \left(A \cdot C\right)}} \cdot \sqrt{2}\right)} \]
    4. Simplified31.0%

      \[\leadsto \color{blue}{-\sqrt{2} \cdot \sqrt{F \cdot \frac{\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)}}} \]
    5. Step-by-step derivation
      1. *-commutative31.0%

        \[\leadsto -\color{blue}{\sqrt{F \cdot \frac{\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)}} \cdot \sqrt{2}} \]
      2. pow1/231.0%

        \[\leadsto -\color{blue}{{\left(F \cdot \frac{\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)}\right)}^{0.5}} \cdot \sqrt{2} \]
      3. metadata-eval31.0%

        \[\leadsto -{\left(F \cdot \frac{\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)}\right)}^{\color{blue}{\left(0.25 \cdot 2\right)}} \cdot \sqrt{2} \]
      4. pow1/231.0%

        \[\leadsto -{\left(F \cdot \frac{\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)}\right)}^{\left(0.25 \cdot 2\right)} \cdot \color{blue}{{2}^{0.5}} \]
      5. metadata-eval31.0%

        \[\leadsto -{\left(F \cdot \frac{\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)}\right)}^{\left(0.25 \cdot 2\right)} \cdot {2}^{\color{blue}{\left(0.25 \cdot 2\right)}} \]
      6. pow-prod-down31.1%

        \[\leadsto -\color{blue}{{\left(\left(F \cdot \frac{\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)}\right) \cdot 2\right)}^{\left(0.25 \cdot 2\right)}} \]
      7. associate-*r/28.1%

        \[\leadsto -{\left(\color{blue}{\frac{F \cdot \left(\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)}} \cdot 2\right)}^{\left(0.25 \cdot 2\right)} \]
      8. metadata-eval28.1%

        \[\leadsto -{\left(\frac{F \cdot \left(\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)} \cdot 2\right)}^{\color{blue}{0.5}} \]
    6. Applied egg-rr28.1%

      \[\leadsto -\color{blue}{{\left(\frac{F \cdot \left(\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)} \cdot 2\right)}^{0.5}} \]
    7. Step-by-step derivation
      1. unpow1/228.1%

        \[\leadsto -\color{blue}{\sqrt{\frac{F \cdot \left(\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)} \cdot 2}} \]
    8. Simplified28.1%

      \[\leadsto -\color{blue}{\sqrt{\frac{F \cdot \left(\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)} \cdot 2}} \]
    9. Taylor expanded in C around inf 18.5%

      \[\leadsto -\sqrt{\color{blue}{-1 \cdot \frac{F}{A}}} \]
    10. Step-by-step derivation
      1. mul-1-neg18.5%

        \[\leadsto -\sqrt{\color{blue}{-\frac{F}{A}}} \]
    11. Simplified18.5%

      \[\leadsto -\sqrt{\color{blue}{-\frac{F}{A}}} \]

    if 7.2999999999999999e-118 < B < 1.05e21

    1. Initial program 40.4%

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Add Preprocessing
    3. Taylor expanded in F around 0 39.6%

      \[\leadsto \color{blue}{-1 \cdot \left(\sqrt{\frac{F \cdot \left(A + \left(C + \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right)\right)}{{B}^{2} - 4 \cdot \left(A \cdot C\right)}} \cdot \sqrt{2}\right)} \]
    4. Simplified58.0%

      \[\leadsto \color{blue}{-\sqrt{2} \cdot \sqrt{F \cdot \frac{\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)}}} \]
    5. Step-by-step derivation
      1. *-commutative58.0%

        \[\leadsto -\color{blue}{\sqrt{F \cdot \frac{\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)}} \cdot \sqrt{2}} \]
      2. pow1/258.0%

        \[\leadsto -\color{blue}{{\left(F \cdot \frac{\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)}\right)}^{0.5}} \cdot \sqrt{2} \]
      3. metadata-eval58.0%

        \[\leadsto -{\left(F \cdot \frac{\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)}\right)}^{\color{blue}{\left(0.25 \cdot 2\right)}} \cdot \sqrt{2} \]
      4. pow1/258.0%

        \[\leadsto -{\left(F \cdot \frac{\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)}\right)}^{\left(0.25 \cdot 2\right)} \cdot \color{blue}{{2}^{0.5}} \]
      5. metadata-eval58.0%

        \[\leadsto -{\left(F \cdot \frac{\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)}\right)}^{\left(0.25 \cdot 2\right)} \cdot {2}^{\color{blue}{\left(0.25 \cdot 2\right)}} \]
      6. pow-prod-down58.4%

        \[\leadsto -\color{blue}{{\left(\left(F \cdot \frac{\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)}\right) \cdot 2\right)}^{\left(0.25 \cdot 2\right)}} \]
      7. associate-*r/58.3%

        \[\leadsto -{\left(\color{blue}{\frac{F \cdot \left(\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)}} \cdot 2\right)}^{\left(0.25 \cdot 2\right)} \]
      8. metadata-eval58.3%

        \[\leadsto -{\left(\frac{F \cdot \left(\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)} \cdot 2\right)}^{\color{blue}{0.5}} \]
    6. Applied egg-rr58.3%

      \[\leadsto -\color{blue}{{\left(\frac{F \cdot \left(\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)} \cdot 2\right)}^{0.5}} \]
    7. Step-by-step derivation
      1. unpow1/258.3%

        \[\leadsto -\color{blue}{\sqrt{\frac{F \cdot \left(\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)} \cdot 2}} \]
    8. Simplified58.3%

      \[\leadsto -\color{blue}{\sqrt{\frac{F \cdot \left(\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)} \cdot 2}} \]
    9. Step-by-step derivation
      1. unpow258.3%

        \[\leadsto -\sqrt{\frac{F \cdot \left(\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)\right)}{\mathsf{fma}\left(-4, C \cdot A, \color{blue}{B \cdot B}\right)} \cdot 2} \]
    10. Applied egg-rr58.3%

      \[\leadsto -\sqrt{\frac{F \cdot \left(\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)\right)}{\mathsf{fma}\left(-4, C \cdot A, \color{blue}{B \cdot B}\right)} \cdot 2} \]

    if 1.05e21 < B < 9.99999999999999934e145

    1. Initial program 24.4%

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Add Preprocessing
    3. Taylor expanded in C around 0 25.7%

      \[\leadsto \color{blue}{-1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A + \sqrt{{A}^{2} + {B}^{2}}\right)}\right)} \]
    4. Step-by-step derivation
      1. mul-1-neg25.7%

        \[\leadsto \color{blue}{-\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A + \sqrt{{A}^{2} + {B}^{2}}\right)}} \]
      2. *-commutative25.7%

        \[\leadsto -\color{blue}{\sqrt{F \cdot \left(A + \sqrt{{A}^{2} + {B}^{2}}\right)} \cdot \frac{\sqrt{2}}{B}} \]
      3. *-commutative25.7%

        \[\leadsto -\sqrt{\color{blue}{\left(A + \sqrt{{A}^{2} + {B}^{2}}\right) \cdot F}} \cdot \frac{\sqrt{2}}{B} \]
      4. +-commutative25.7%

        \[\leadsto -\sqrt{\left(A + \sqrt{\color{blue}{{B}^{2} + {A}^{2}}}\right) \cdot F} \cdot \frac{\sqrt{2}}{B} \]
      5. unpow225.7%

        \[\leadsto -\sqrt{\left(A + \sqrt{\color{blue}{B \cdot B} + {A}^{2}}\right) \cdot F} \cdot \frac{\sqrt{2}}{B} \]
      6. unpow225.7%

        \[\leadsto -\sqrt{\left(A + \sqrt{B \cdot B + \color{blue}{A \cdot A}}\right) \cdot F} \cdot \frac{\sqrt{2}}{B} \]
      7. hypot-define26.3%

        \[\leadsto -\sqrt{\left(A + \color{blue}{\mathsf{hypot}\left(B, A\right)}\right) \cdot F} \cdot \frac{\sqrt{2}}{B} \]
    5. Simplified26.3%

      \[\leadsto \color{blue}{-\sqrt{\left(A + \mathsf{hypot}\left(B, A\right)\right) \cdot F} \cdot \frac{\sqrt{2}}{B}} \]

    if 9.99999999999999934e145 < B

    1. Initial program 0.0%

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Add Preprocessing
    3. Taylor expanded in B around inf 44.3%

      \[\leadsto \color{blue}{-1 \cdot \left(\sqrt{\frac{F}{B}} \cdot \sqrt{2}\right)} \]
    4. Step-by-step derivation
      1. mul-1-neg44.3%

        \[\leadsto \color{blue}{-\sqrt{\frac{F}{B}} \cdot \sqrt{2}} \]
      2. *-commutative44.3%

        \[\leadsto -\color{blue}{\sqrt{2} \cdot \sqrt{\frac{F}{B}}} \]
    5. Simplified44.3%

      \[\leadsto \color{blue}{-\sqrt{2} \cdot \sqrt{\frac{F}{B}}} \]
    6. Step-by-step derivation
      1. sqrt-div66.9%

        \[\leadsto -\sqrt{2} \cdot \color{blue}{\frac{\sqrt{F}}{\sqrt{B}}} \]
    7. Applied egg-rr66.9%

      \[\leadsto -\sqrt{2} \cdot \color{blue}{\frac{\sqrt{F}}{\sqrt{B}}} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification28.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;B \leq 7.3 \cdot 10^{-118}:\\ \;\;\;\;-\sqrt{\frac{F}{-A}}\\ \mathbf{elif}\;B \leq 1.05 \cdot 10^{+21}:\\ \;\;\;\;-\sqrt{2 \cdot \frac{F \cdot \left(\left(A + C\right) + \mathsf{hypot}\left(B, A - C\right)\right)}{\mathsf{fma}\left(-4, A \cdot C, B \cdot B\right)}}\\ \mathbf{elif}\;B \leq 10^{+146}:\\ \;\;\;\;\sqrt{F \cdot \left(A + \mathsf{hypot}\left(B, A\right)\right)} \cdot \frac{\sqrt{2}}{-B}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{2} \cdot \frac{\sqrt{F}}{-\sqrt{B}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 39.7% accurate, 2.0× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ [A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\ \\ \begin{array}{l} \mathbf{if}\;{B\_m}^{2} \leq 10^{+26}:\\ \;\;\;\;-\sqrt{\frac{F}{-A}}\\ \mathbf{else}:\\ \;\;\;\;-\sqrt{2 \cdot \left|\frac{F}{B\_m}\right|}\\ \end{array} \end{array} \]
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
 :precision binary64
 (if (<= (pow B_m 2.0) 1e+26)
   (- (sqrt (/ F (- A))))
   (- (sqrt (* 2.0 (fabs (/ F B_m)))))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
	double tmp;
	if (pow(B_m, 2.0) <= 1e+26) {
		tmp = -sqrt((F / -A));
	} else {
		tmp = -sqrt((2.0 * fabs((F / B_m))));
	}
	return tmp;
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
    real(8), intent (in) :: a
    real(8), intent (in) :: b_m
    real(8), intent (in) :: c
    real(8), intent (in) :: f
    real(8) :: tmp
    if ((b_m ** 2.0d0) <= 1d+26) then
        tmp = -sqrt((f / -a))
    else
        tmp = -sqrt((2.0d0 * abs((f / b_m))))
    end if
    code = tmp
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
	double tmp;
	if (Math.pow(B_m, 2.0) <= 1e+26) {
		tmp = -Math.sqrt((F / -A));
	} else {
		tmp = -Math.sqrt((2.0 * Math.abs((F / B_m))));
	}
	return tmp;
}
B_m = math.fabs(B)
[A, B_m, C, F] = sort([A, B_m, C, F])
def code(A, B_m, C, F):
	tmp = 0
	if math.pow(B_m, 2.0) <= 1e+26:
		tmp = -math.sqrt((F / -A))
	else:
		tmp = -math.sqrt((2.0 * math.fabs((F / B_m))))
	return tmp
B_m = abs(B)
A, B_m, C, F = sort([A, B_m, C, F])
function code(A, B_m, C, F)
	tmp = 0.0
	if ((B_m ^ 2.0) <= 1e+26)
		tmp = Float64(-sqrt(Float64(F / Float64(-A))));
	else
		tmp = Float64(-sqrt(Float64(2.0 * abs(Float64(F / B_m)))));
	end
	return tmp
end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
	tmp = 0.0;
	if ((B_m ^ 2.0) <= 1e+26)
		tmp = -sqrt((F / -A));
	else
		tmp = -sqrt((2.0 * abs((F / B_m))));
	end
	tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 1e+26], (-N[Sqrt[N[(F / (-A)), $MachinePrecision]], $MachinePrecision]), (-N[Sqrt[N[(2.0 * N[Abs[N[(F / B$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision])]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;{B\_m}^{2} \leq 10^{+26}:\\
\;\;\;\;-\sqrt{\frac{F}{-A}}\\

\mathbf{else}:\\
\;\;\;\;-\sqrt{2 \cdot \left|\frac{F}{B\_m}\right|}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (pow.f64 B #s(literal 2 binary64)) < 1.00000000000000005e26

    1. Initial program 28.5%

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Add Preprocessing
    3. Taylor expanded in F around 0 22.1%

      \[\leadsto \color{blue}{-1 \cdot \left(\sqrt{\frac{F \cdot \left(A + \left(C + \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right)\right)}{{B}^{2} - 4 \cdot \left(A \cdot C\right)}} \cdot \sqrt{2}\right)} \]
    4. Simplified38.2%

      \[\leadsto \color{blue}{-\sqrt{2} \cdot \sqrt{F \cdot \frac{\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)}}} \]
    5. Step-by-step derivation
      1. *-commutative38.2%

        \[\leadsto -\color{blue}{\sqrt{F \cdot \frac{\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)}} \cdot \sqrt{2}} \]
      2. pow1/238.2%

        \[\leadsto -\color{blue}{{\left(F \cdot \frac{\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)}\right)}^{0.5}} \cdot \sqrt{2} \]
      3. metadata-eval38.2%

        \[\leadsto -{\left(F \cdot \frac{\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)}\right)}^{\color{blue}{\left(0.25 \cdot 2\right)}} \cdot \sqrt{2} \]
      4. pow1/238.2%

        \[\leadsto -{\left(F \cdot \frac{\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)}\right)}^{\left(0.25 \cdot 2\right)} \cdot \color{blue}{{2}^{0.5}} \]
      5. metadata-eval38.2%

        \[\leadsto -{\left(F \cdot \frac{\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)}\right)}^{\left(0.25 \cdot 2\right)} \cdot {2}^{\color{blue}{\left(0.25 \cdot 2\right)}} \]
      6. pow-prod-down38.3%

        \[\leadsto -\color{blue}{{\left(\left(F \cdot \frac{\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)}\right) \cdot 2\right)}^{\left(0.25 \cdot 2\right)}} \]
      7. associate-*r/37.5%

        \[\leadsto -{\left(\color{blue}{\frac{F \cdot \left(\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)}} \cdot 2\right)}^{\left(0.25 \cdot 2\right)} \]
      8. metadata-eval37.5%

        \[\leadsto -{\left(\frac{F \cdot \left(\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)} \cdot 2\right)}^{\color{blue}{0.5}} \]
    6. Applied egg-rr37.5%

      \[\leadsto -\color{blue}{{\left(\frac{F \cdot \left(\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)} \cdot 2\right)}^{0.5}} \]
    7. Step-by-step derivation
      1. unpow1/237.5%

        \[\leadsto -\color{blue}{\sqrt{\frac{F \cdot \left(\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)} \cdot 2}} \]
    8. Simplified37.5%

      \[\leadsto -\color{blue}{\sqrt{\frac{F \cdot \left(\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)} \cdot 2}} \]
    9. Taylor expanded in C around inf 23.9%

      \[\leadsto -\sqrt{\color{blue}{-1 \cdot \frac{F}{A}}} \]
    10. Step-by-step derivation
      1. mul-1-neg23.9%

        \[\leadsto -\sqrt{\color{blue}{-\frac{F}{A}}} \]
    11. Simplified23.9%

      \[\leadsto -\sqrt{\color{blue}{-\frac{F}{A}}} \]

    if 1.00000000000000005e26 < (pow.f64 B #s(literal 2 binary64))

    1. Initial program 15.3%

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Add Preprocessing
    3. Taylor expanded in B around inf 16.9%

      \[\leadsto \color{blue}{-1 \cdot \left(\sqrt{\frac{F}{B}} \cdot \sqrt{2}\right)} \]
    4. Step-by-step derivation
      1. mul-1-neg16.9%

        \[\leadsto \color{blue}{-\sqrt{\frac{F}{B}} \cdot \sqrt{2}} \]
      2. *-commutative16.9%

        \[\leadsto -\color{blue}{\sqrt{2} \cdot \sqrt{\frac{F}{B}}} \]
    5. Simplified16.9%

      \[\leadsto \color{blue}{-\sqrt{2} \cdot \sqrt{\frac{F}{B}}} \]
    6. Step-by-step derivation
      1. *-commutative16.9%

        \[\leadsto -\color{blue}{\sqrt{\frac{F}{B}} \cdot \sqrt{2}} \]
      2. pow1/216.9%

        \[\leadsto -\color{blue}{{\left(\frac{F}{B}\right)}^{0.5}} \cdot \sqrt{2} \]
      3. metadata-eval16.9%

        \[\leadsto -{\left(\frac{F}{B}\right)}^{\color{blue}{\left(0.25 \cdot 2\right)}} \cdot \sqrt{2} \]
      4. pow1/216.9%

        \[\leadsto -{\left(\frac{F}{B}\right)}^{\left(0.25 \cdot 2\right)} \cdot \color{blue}{{2}^{0.5}} \]
      5. metadata-eval16.9%

        \[\leadsto -{\left(\frac{F}{B}\right)}^{\left(0.25 \cdot 2\right)} \cdot {2}^{\color{blue}{\left(0.25 \cdot 2\right)}} \]
      6. pow-prod-down17.0%

        \[\leadsto -\color{blue}{{\left(\frac{F}{B} \cdot 2\right)}^{\left(0.25 \cdot 2\right)}} \]
      7. metadata-eval17.0%

        \[\leadsto -{\left(\frac{F}{B} \cdot 2\right)}^{\color{blue}{0.5}} \]
    7. Applied egg-rr17.0%

      \[\leadsto -\color{blue}{{\left(\frac{F}{B} \cdot 2\right)}^{0.5}} \]
    8. Step-by-step derivation
      1. unpow1/217.0%

        \[\leadsto -\color{blue}{\sqrt{\frac{F}{B} \cdot 2}} \]
    9. Simplified17.0%

      \[\leadsto -\color{blue}{\sqrt{\frac{F}{B} \cdot 2}} \]
    10. Step-by-step derivation
      1. add-sqr-sqrt16.9%

        \[\leadsto -\sqrt{\color{blue}{\left(\sqrt{\frac{F}{B}} \cdot \sqrt{\frac{F}{B}}\right)} \cdot 2} \]
      2. sqrt-unprod31.4%

        \[\leadsto -\sqrt{\color{blue}{\sqrt{\frac{F}{B} \cdot \frac{F}{B}}} \cdot 2} \]
      3. pow231.4%

        \[\leadsto -\sqrt{\sqrt{\color{blue}{{\left(\frac{F}{B}\right)}^{2}}} \cdot 2} \]
    11. Applied egg-rr31.4%

      \[\leadsto -\sqrt{\color{blue}{\sqrt{{\left(\frac{F}{B}\right)}^{2}}} \cdot 2} \]
    12. Step-by-step derivation
      1. unpow231.4%

        \[\leadsto -\sqrt{\sqrt{\color{blue}{\frac{F}{B} \cdot \frac{F}{B}}} \cdot 2} \]
      2. rem-sqrt-square42.9%

        \[\leadsto -\sqrt{\color{blue}{\left|\frac{F}{B}\right|} \cdot 2} \]
    13. Simplified42.9%

      \[\leadsto -\sqrt{\color{blue}{\left|\frac{F}{B}\right|} \cdot 2} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification32.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;{B}^{2} \leq 10^{+26}:\\ \;\;\;\;-\sqrt{\frac{F}{-A}}\\ \mathbf{else}:\\ \;\;\;\;-\sqrt{2 \cdot \left|\frac{F}{B}\right|}\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 46.8% accurate, 2.0× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ [A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\ \\ \begin{array}{l} \mathbf{if}\;B\_m \leq 5.5 \cdot 10^{+14}:\\ \;\;\;\;-\sqrt{\frac{F}{-A}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{2} \cdot \frac{\sqrt{F}}{-\sqrt{B\_m}}\\ \end{array} \end{array} \]
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
 :precision binary64
 (if (<= B_m 5.5e+14)
   (- (sqrt (/ F (- A))))
   (* (sqrt 2.0) (/ (sqrt F) (- (sqrt B_m))))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
	double tmp;
	if (B_m <= 5.5e+14) {
		tmp = -sqrt((F / -A));
	} else {
		tmp = sqrt(2.0) * (sqrt(F) / -sqrt(B_m));
	}
	return tmp;
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
    real(8), intent (in) :: a
    real(8), intent (in) :: b_m
    real(8), intent (in) :: c
    real(8), intent (in) :: f
    real(8) :: tmp
    if (b_m <= 5.5d+14) then
        tmp = -sqrt((f / -a))
    else
        tmp = sqrt(2.0d0) * (sqrt(f) / -sqrt(b_m))
    end if
    code = tmp
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
	double tmp;
	if (B_m <= 5.5e+14) {
		tmp = -Math.sqrt((F / -A));
	} else {
		tmp = Math.sqrt(2.0) * (Math.sqrt(F) / -Math.sqrt(B_m));
	}
	return tmp;
}
B_m = math.fabs(B)
[A, B_m, C, F] = sort([A, B_m, C, F])
def code(A, B_m, C, F):
	tmp = 0
	if B_m <= 5.5e+14:
		tmp = -math.sqrt((F / -A))
	else:
		tmp = math.sqrt(2.0) * (math.sqrt(F) / -math.sqrt(B_m))
	return tmp
B_m = abs(B)
A, B_m, C, F = sort([A, B_m, C, F])
function code(A, B_m, C, F)
	tmp = 0.0
	if (B_m <= 5.5e+14)
		tmp = Float64(-sqrt(Float64(F / Float64(-A))));
	else
		tmp = Float64(sqrt(2.0) * Float64(sqrt(F) / Float64(-sqrt(B_m))));
	end
	return tmp
end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
	tmp = 0.0;
	if (B_m <= 5.5e+14)
		tmp = -sqrt((F / -A));
	else
		tmp = sqrt(2.0) * (sqrt(F) / -sqrt(B_m));
	end
	tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := If[LessEqual[B$95$m, 5.5e+14], (-N[Sqrt[N[(F / (-A)), $MachinePrecision]], $MachinePrecision]), N[(N[Sqrt[2.0], $MachinePrecision] * N[(N[Sqrt[F], $MachinePrecision] / (-N[Sqrt[B$95$m], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;B\_m \leq 5.5 \cdot 10^{+14}:\\
\;\;\;\;-\sqrt{\frac{F}{-A}}\\

\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \frac{\sqrt{F}}{-\sqrt{B\_m}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if B < 5.5e14

    1. Initial program 24.3%

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Add Preprocessing
    3. Taylor expanded in F around 0 18.1%

      \[\leadsto \color{blue}{-1 \cdot \left(\sqrt{\frac{F \cdot \left(A + \left(C + \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right)\right)}{{B}^{2} - 4 \cdot \left(A \cdot C\right)}} \cdot \sqrt{2}\right)} \]
    4. Simplified34.4%

      \[\leadsto \color{blue}{-\sqrt{2} \cdot \sqrt{F \cdot \frac{\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)}}} \]
    5. Step-by-step derivation
      1. *-commutative34.4%

        \[\leadsto -\color{blue}{\sqrt{F \cdot \frac{\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)}} \cdot \sqrt{2}} \]
      2. pow1/234.4%

        \[\leadsto -\color{blue}{{\left(F \cdot \frac{\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)}\right)}^{0.5}} \cdot \sqrt{2} \]
      3. metadata-eval34.4%

        \[\leadsto -{\left(F \cdot \frac{\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)}\right)}^{\color{blue}{\left(0.25 \cdot 2\right)}} \cdot \sqrt{2} \]
      4. pow1/234.4%

        \[\leadsto -{\left(F \cdot \frac{\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)}\right)}^{\left(0.25 \cdot 2\right)} \cdot \color{blue}{{2}^{0.5}} \]
      5. metadata-eval34.4%

        \[\leadsto -{\left(F \cdot \frac{\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)}\right)}^{\left(0.25 \cdot 2\right)} \cdot {2}^{\color{blue}{\left(0.25 \cdot 2\right)}} \]
      6. pow-prod-down34.5%

        \[\leadsto -\color{blue}{{\left(\left(F \cdot \frac{\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)}\right) \cdot 2\right)}^{\left(0.25 \cdot 2\right)}} \]
      7. associate-*r/31.9%

        \[\leadsto -{\left(\color{blue}{\frac{F \cdot \left(\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)}} \cdot 2\right)}^{\left(0.25 \cdot 2\right)} \]
      8. metadata-eval31.9%

        \[\leadsto -{\left(\frac{F \cdot \left(\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)} \cdot 2\right)}^{\color{blue}{0.5}} \]
    6. Applied egg-rr31.9%

      \[\leadsto -\color{blue}{{\left(\frac{F \cdot \left(\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)} \cdot 2\right)}^{0.5}} \]
    7. Step-by-step derivation
      1. unpow1/231.9%

        \[\leadsto -\color{blue}{\sqrt{\frac{F \cdot \left(\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)} \cdot 2}} \]
    8. Simplified31.9%

      \[\leadsto -\color{blue}{\sqrt{\frac{F \cdot \left(\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)} \cdot 2}} \]
    9. Taylor expanded in C around inf 18.2%

      \[\leadsto -\sqrt{\color{blue}{-1 \cdot \frac{F}{A}}} \]
    10. Step-by-step derivation
      1. mul-1-neg18.2%

        \[\leadsto -\sqrt{\color{blue}{-\frac{F}{A}}} \]
    11. Simplified18.2%

      \[\leadsto -\sqrt{\color{blue}{-\frac{F}{A}}} \]

    if 5.5e14 < B

    1. Initial program 14.1%

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Add Preprocessing
    3. Taylor expanded in B around inf 37.0%

      \[\leadsto \color{blue}{-1 \cdot \left(\sqrt{\frac{F}{B}} \cdot \sqrt{2}\right)} \]
    4. Step-by-step derivation
      1. mul-1-neg37.0%

        \[\leadsto \color{blue}{-\sqrt{\frac{F}{B}} \cdot \sqrt{2}} \]
      2. *-commutative37.0%

        \[\leadsto -\color{blue}{\sqrt{2} \cdot \sqrt{\frac{F}{B}}} \]
    5. Simplified37.0%

      \[\leadsto \color{blue}{-\sqrt{2} \cdot \sqrt{\frac{F}{B}}} \]
    6. Step-by-step derivation
      1. sqrt-div49.6%

        \[\leadsto -\sqrt{2} \cdot \color{blue}{\frac{\sqrt{F}}{\sqrt{B}}} \]
    7. Applied egg-rr49.6%

      \[\leadsto -\sqrt{2} \cdot \color{blue}{\frac{\sqrt{F}}{\sqrt{B}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification24.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;B \leq 5.5 \cdot 10^{+14}:\\ \;\;\;\;-\sqrt{\frac{F}{-A}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{2} \cdot \frac{\sqrt{F}}{-\sqrt{B}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 39.7% accurate, 5.7× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ [A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\ \\ \begin{array}{l} \mathbf{if}\;B\_m \leq 2.15 \cdot 10^{+15}:\\ \;\;\;\;-\sqrt{\frac{F}{-A}}\\ \mathbf{else}:\\ \;\;\;\;-\sqrt{\frac{2 \cdot F}{B\_m}}\\ \end{array} \end{array} \]
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
 :precision binary64
 (if (<= B_m 2.15e+15) (- (sqrt (/ F (- A)))) (- (sqrt (/ (* 2.0 F) B_m)))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
	double tmp;
	if (B_m <= 2.15e+15) {
		tmp = -sqrt((F / -A));
	} else {
		tmp = -sqrt(((2.0 * F) / B_m));
	}
	return tmp;
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
    real(8), intent (in) :: a
    real(8), intent (in) :: b_m
    real(8), intent (in) :: c
    real(8), intent (in) :: f
    real(8) :: tmp
    if (b_m <= 2.15d+15) then
        tmp = -sqrt((f / -a))
    else
        tmp = -sqrt(((2.0d0 * f) / b_m))
    end if
    code = tmp
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
	double tmp;
	if (B_m <= 2.15e+15) {
		tmp = -Math.sqrt((F / -A));
	} else {
		tmp = -Math.sqrt(((2.0 * F) / B_m));
	}
	return tmp;
}
B_m = math.fabs(B)
[A, B_m, C, F] = sort([A, B_m, C, F])
def code(A, B_m, C, F):
	tmp = 0
	if B_m <= 2.15e+15:
		tmp = -math.sqrt((F / -A))
	else:
		tmp = -math.sqrt(((2.0 * F) / B_m))
	return tmp
B_m = abs(B)
A, B_m, C, F = sort([A, B_m, C, F])
function code(A, B_m, C, F)
	tmp = 0.0
	if (B_m <= 2.15e+15)
		tmp = Float64(-sqrt(Float64(F / Float64(-A))));
	else
		tmp = Float64(-sqrt(Float64(Float64(2.0 * F) / B_m)));
	end
	return tmp
end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
	tmp = 0.0;
	if (B_m <= 2.15e+15)
		tmp = -sqrt((F / -A));
	else
		tmp = -sqrt(((2.0 * F) / B_m));
	end
	tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := If[LessEqual[B$95$m, 2.15e+15], (-N[Sqrt[N[(F / (-A)), $MachinePrecision]], $MachinePrecision]), (-N[Sqrt[N[(N[(2.0 * F), $MachinePrecision] / B$95$m), $MachinePrecision]], $MachinePrecision])]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;B\_m \leq 2.15 \cdot 10^{+15}:\\
\;\;\;\;-\sqrt{\frac{F}{-A}}\\

\mathbf{else}:\\
\;\;\;\;-\sqrt{\frac{2 \cdot F}{B\_m}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if B < 2.15e15

    1. Initial program 24.3%

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Add Preprocessing
    3. Taylor expanded in F around 0 18.1%

      \[\leadsto \color{blue}{-1 \cdot \left(\sqrt{\frac{F \cdot \left(A + \left(C + \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right)\right)}{{B}^{2} - 4 \cdot \left(A \cdot C\right)}} \cdot \sqrt{2}\right)} \]
    4. Simplified34.4%

      \[\leadsto \color{blue}{-\sqrt{2} \cdot \sqrt{F \cdot \frac{\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)}}} \]
    5. Step-by-step derivation
      1. *-commutative34.4%

        \[\leadsto -\color{blue}{\sqrt{F \cdot \frac{\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)}} \cdot \sqrt{2}} \]
      2. pow1/234.4%

        \[\leadsto -\color{blue}{{\left(F \cdot \frac{\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)}\right)}^{0.5}} \cdot \sqrt{2} \]
      3. metadata-eval34.4%

        \[\leadsto -{\left(F \cdot \frac{\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)}\right)}^{\color{blue}{\left(0.25 \cdot 2\right)}} \cdot \sqrt{2} \]
      4. pow1/234.4%

        \[\leadsto -{\left(F \cdot \frac{\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)}\right)}^{\left(0.25 \cdot 2\right)} \cdot \color{blue}{{2}^{0.5}} \]
      5. metadata-eval34.4%

        \[\leadsto -{\left(F \cdot \frac{\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)}\right)}^{\left(0.25 \cdot 2\right)} \cdot {2}^{\color{blue}{\left(0.25 \cdot 2\right)}} \]
      6. pow-prod-down34.5%

        \[\leadsto -\color{blue}{{\left(\left(F \cdot \frac{\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)}\right) \cdot 2\right)}^{\left(0.25 \cdot 2\right)}} \]
      7. associate-*r/31.9%

        \[\leadsto -{\left(\color{blue}{\frac{F \cdot \left(\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)}} \cdot 2\right)}^{\left(0.25 \cdot 2\right)} \]
      8. metadata-eval31.9%

        \[\leadsto -{\left(\frac{F \cdot \left(\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)} \cdot 2\right)}^{\color{blue}{0.5}} \]
    6. Applied egg-rr31.9%

      \[\leadsto -\color{blue}{{\left(\frac{F \cdot \left(\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)} \cdot 2\right)}^{0.5}} \]
    7. Step-by-step derivation
      1. unpow1/231.9%

        \[\leadsto -\color{blue}{\sqrt{\frac{F \cdot \left(\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)} \cdot 2}} \]
    8. Simplified31.9%

      \[\leadsto -\color{blue}{\sqrt{\frac{F \cdot \left(\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)} \cdot 2}} \]
    9. Taylor expanded in C around inf 18.2%

      \[\leadsto -\sqrt{\color{blue}{-1 \cdot \frac{F}{A}}} \]
    10. Step-by-step derivation
      1. mul-1-neg18.2%

        \[\leadsto -\sqrt{\color{blue}{-\frac{F}{A}}} \]
    11. Simplified18.2%

      \[\leadsto -\sqrt{\color{blue}{-\frac{F}{A}}} \]

    if 2.15e15 < B

    1. Initial program 14.1%

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Add Preprocessing
    3. Taylor expanded in B around inf 37.0%

      \[\leadsto \color{blue}{-1 \cdot \left(\sqrt{\frac{F}{B}} \cdot \sqrt{2}\right)} \]
    4. Step-by-step derivation
      1. mul-1-neg37.0%

        \[\leadsto \color{blue}{-\sqrt{\frac{F}{B}} \cdot \sqrt{2}} \]
      2. *-commutative37.0%

        \[\leadsto -\color{blue}{\sqrt{2} \cdot \sqrt{\frac{F}{B}}} \]
    5. Simplified37.0%

      \[\leadsto \color{blue}{-\sqrt{2} \cdot \sqrt{\frac{F}{B}}} \]
    6. Step-by-step derivation
      1. *-commutative37.0%

        \[\leadsto -\color{blue}{\sqrt{\frac{F}{B}} \cdot \sqrt{2}} \]
      2. pow1/237.0%

        \[\leadsto -\color{blue}{{\left(\frac{F}{B}\right)}^{0.5}} \cdot \sqrt{2} \]
      3. metadata-eval37.0%

        \[\leadsto -{\left(\frac{F}{B}\right)}^{\color{blue}{\left(0.25 \cdot 2\right)}} \cdot \sqrt{2} \]
      4. pow1/237.0%

        \[\leadsto -{\left(\frac{F}{B}\right)}^{\left(0.25 \cdot 2\right)} \cdot \color{blue}{{2}^{0.5}} \]
      5. metadata-eval37.0%

        \[\leadsto -{\left(\frac{F}{B}\right)}^{\left(0.25 \cdot 2\right)} \cdot {2}^{\color{blue}{\left(0.25 \cdot 2\right)}} \]
      6. pow-prod-down37.2%

        \[\leadsto -\color{blue}{{\left(\frac{F}{B} \cdot 2\right)}^{\left(0.25 \cdot 2\right)}} \]
      7. metadata-eval37.2%

        \[\leadsto -{\left(\frac{F}{B} \cdot 2\right)}^{\color{blue}{0.5}} \]
    7. Applied egg-rr37.2%

      \[\leadsto -\color{blue}{{\left(\frac{F}{B} \cdot 2\right)}^{0.5}} \]
    8. Step-by-step derivation
      1. unpow1/237.2%

        \[\leadsto -\color{blue}{\sqrt{\frac{F}{B} \cdot 2}} \]
    9. Simplified37.2%

      \[\leadsto -\color{blue}{\sqrt{\frac{F}{B} \cdot 2}} \]
    10. Taylor expanded in F around 0 37.2%

      \[\leadsto -\sqrt{\color{blue}{2 \cdot \frac{F}{B}}} \]
    11. Step-by-step derivation
      1. associate-*r/37.3%

        \[\leadsto -\sqrt{\color{blue}{\frac{2 \cdot F}{B}}} \]
      2. *-commutative37.3%

        \[\leadsto -\sqrt{\frac{\color{blue}{F \cdot 2}}{B}} \]
    12. Simplified37.3%

      \[\leadsto -\sqrt{\color{blue}{\frac{F \cdot 2}{B}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification22.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;B \leq 2.15 \cdot 10^{+15}:\\ \;\;\;\;-\sqrt{\frac{F}{-A}}\\ \mathbf{else}:\\ \;\;\;\;-\sqrt{\frac{2 \cdot F}{B}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 13: 39.7% accurate, 5.7× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ [A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\ \\ \begin{array}{l} \mathbf{if}\;B\_m \leq 1.45 \cdot 10^{+15}:\\ \;\;\;\;-\sqrt{\frac{F}{-A}}\\ \mathbf{else}:\\ \;\;\;\;-\sqrt{2 \cdot \frac{F}{B\_m}}\\ \end{array} \end{array} \]
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
 :precision binary64
 (if (<= B_m 1.45e+15) (- (sqrt (/ F (- A)))) (- (sqrt (* 2.0 (/ F B_m))))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
	double tmp;
	if (B_m <= 1.45e+15) {
		tmp = -sqrt((F / -A));
	} else {
		tmp = -sqrt((2.0 * (F / B_m)));
	}
	return tmp;
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
    real(8), intent (in) :: a
    real(8), intent (in) :: b_m
    real(8), intent (in) :: c
    real(8), intent (in) :: f
    real(8) :: tmp
    if (b_m <= 1.45d+15) then
        tmp = -sqrt((f / -a))
    else
        tmp = -sqrt((2.0d0 * (f / b_m)))
    end if
    code = tmp
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
	double tmp;
	if (B_m <= 1.45e+15) {
		tmp = -Math.sqrt((F / -A));
	} else {
		tmp = -Math.sqrt((2.0 * (F / B_m)));
	}
	return tmp;
}
B_m = math.fabs(B)
[A, B_m, C, F] = sort([A, B_m, C, F])
def code(A, B_m, C, F):
	tmp = 0
	if B_m <= 1.45e+15:
		tmp = -math.sqrt((F / -A))
	else:
		tmp = -math.sqrt((2.0 * (F / B_m)))
	return tmp
B_m = abs(B)
A, B_m, C, F = sort([A, B_m, C, F])
function code(A, B_m, C, F)
	tmp = 0.0
	if (B_m <= 1.45e+15)
		tmp = Float64(-sqrt(Float64(F / Float64(-A))));
	else
		tmp = Float64(-sqrt(Float64(2.0 * Float64(F / B_m))));
	end
	return tmp
end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
	tmp = 0.0;
	if (B_m <= 1.45e+15)
		tmp = -sqrt((F / -A));
	else
		tmp = -sqrt((2.0 * (F / B_m)));
	end
	tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := If[LessEqual[B$95$m, 1.45e+15], (-N[Sqrt[N[(F / (-A)), $MachinePrecision]], $MachinePrecision]), (-N[Sqrt[N[(2.0 * N[(F / B$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;B\_m \leq 1.45 \cdot 10^{+15}:\\
\;\;\;\;-\sqrt{\frac{F}{-A}}\\

\mathbf{else}:\\
\;\;\;\;-\sqrt{2 \cdot \frac{F}{B\_m}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if B < 1.45e15

    1. Initial program 24.3%

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Add Preprocessing
    3. Taylor expanded in F around 0 18.1%

      \[\leadsto \color{blue}{-1 \cdot \left(\sqrt{\frac{F \cdot \left(A + \left(C + \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right)\right)}{{B}^{2} - 4 \cdot \left(A \cdot C\right)}} \cdot \sqrt{2}\right)} \]
    4. Simplified34.4%

      \[\leadsto \color{blue}{-\sqrt{2} \cdot \sqrt{F \cdot \frac{\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)}}} \]
    5. Step-by-step derivation
      1. *-commutative34.4%

        \[\leadsto -\color{blue}{\sqrt{F \cdot \frac{\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)}} \cdot \sqrt{2}} \]
      2. pow1/234.4%

        \[\leadsto -\color{blue}{{\left(F \cdot \frac{\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)}\right)}^{0.5}} \cdot \sqrt{2} \]
      3. metadata-eval34.4%

        \[\leadsto -{\left(F \cdot \frac{\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)}\right)}^{\color{blue}{\left(0.25 \cdot 2\right)}} \cdot \sqrt{2} \]
      4. pow1/234.4%

        \[\leadsto -{\left(F \cdot \frac{\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)}\right)}^{\left(0.25 \cdot 2\right)} \cdot \color{blue}{{2}^{0.5}} \]
      5. metadata-eval34.4%

        \[\leadsto -{\left(F \cdot \frac{\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)}\right)}^{\left(0.25 \cdot 2\right)} \cdot {2}^{\color{blue}{\left(0.25 \cdot 2\right)}} \]
      6. pow-prod-down34.5%

        \[\leadsto -\color{blue}{{\left(\left(F \cdot \frac{\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)}\right) \cdot 2\right)}^{\left(0.25 \cdot 2\right)}} \]
      7. associate-*r/31.9%

        \[\leadsto -{\left(\color{blue}{\frac{F \cdot \left(\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)}} \cdot 2\right)}^{\left(0.25 \cdot 2\right)} \]
      8. metadata-eval31.9%

        \[\leadsto -{\left(\frac{F \cdot \left(\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)} \cdot 2\right)}^{\color{blue}{0.5}} \]
    6. Applied egg-rr31.9%

      \[\leadsto -\color{blue}{{\left(\frac{F \cdot \left(\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)} \cdot 2\right)}^{0.5}} \]
    7. Step-by-step derivation
      1. unpow1/231.9%

        \[\leadsto -\color{blue}{\sqrt{\frac{F \cdot \left(\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)} \cdot 2}} \]
    8. Simplified31.9%

      \[\leadsto -\color{blue}{\sqrt{\frac{F \cdot \left(\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)} \cdot 2}} \]
    9. Taylor expanded in C around inf 18.2%

      \[\leadsto -\sqrt{\color{blue}{-1 \cdot \frac{F}{A}}} \]
    10. Step-by-step derivation
      1. mul-1-neg18.2%

        \[\leadsto -\sqrt{\color{blue}{-\frac{F}{A}}} \]
    11. Simplified18.2%

      \[\leadsto -\sqrt{\color{blue}{-\frac{F}{A}}} \]

    if 1.45e15 < B

    1. Initial program 14.1%

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Add Preprocessing
    3. Taylor expanded in B around inf 37.0%

      \[\leadsto \color{blue}{-1 \cdot \left(\sqrt{\frac{F}{B}} \cdot \sqrt{2}\right)} \]
    4. Step-by-step derivation
      1. mul-1-neg37.0%

        \[\leadsto \color{blue}{-\sqrt{\frac{F}{B}} \cdot \sqrt{2}} \]
      2. *-commutative37.0%

        \[\leadsto -\color{blue}{\sqrt{2} \cdot \sqrt{\frac{F}{B}}} \]
    5. Simplified37.0%

      \[\leadsto \color{blue}{-\sqrt{2} \cdot \sqrt{\frac{F}{B}}} \]
    6. Step-by-step derivation
      1. *-commutative37.0%

        \[\leadsto -\color{blue}{\sqrt{\frac{F}{B}} \cdot \sqrt{2}} \]
      2. pow1/237.0%

        \[\leadsto -\color{blue}{{\left(\frac{F}{B}\right)}^{0.5}} \cdot \sqrt{2} \]
      3. metadata-eval37.0%

        \[\leadsto -{\left(\frac{F}{B}\right)}^{\color{blue}{\left(0.25 \cdot 2\right)}} \cdot \sqrt{2} \]
      4. pow1/237.0%

        \[\leadsto -{\left(\frac{F}{B}\right)}^{\left(0.25 \cdot 2\right)} \cdot \color{blue}{{2}^{0.5}} \]
      5. metadata-eval37.0%

        \[\leadsto -{\left(\frac{F}{B}\right)}^{\left(0.25 \cdot 2\right)} \cdot {2}^{\color{blue}{\left(0.25 \cdot 2\right)}} \]
      6. pow-prod-down37.2%

        \[\leadsto -\color{blue}{{\left(\frac{F}{B} \cdot 2\right)}^{\left(0.25 \cdot 2\right)}} \]
      7. metadata-eval37.2%

        \[\leadsto -{\left(\frac{F}{B} \cdot 2\right)}^{\color{blue}{0.5}} \]
    7. Applied egg-rr37.2%

      \[\leadsto -\color{blue}{{\left(\frac{F}{B} \cdot 2\right)}^{0.5}} \]
    8. Step-by-step derivation
      1. unpow1/237.2%

        \[\leadsto -\color{blue}{\sqrt{\frac{F}{B} \cdot 2}} \]
    9. Simplified37.2%

      \[\leadsto -\color{blue}{\sqrt{\frac{F}{B} \cdot 2}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification22.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;B \leq 1.45 \cdot 10^{+15}:\\ \;\;\;\;-\sqrt{\frac{F}{-A}}\\ \mathbf{else}:\\ \;\;\;\;-\sqrt{2 \cdot \frac{F}{B}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 14: 28.6% accurate, 6.0× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ [A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\ \\ -\sqrt{\frac{F}{-A}} \end{array} \]
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F) :precision binary64 (- (sqrt (/ F (- A)))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
	return -sqrt((F / -A));
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
    real(8), intent (in) :: a
    real(8), intent (in) :: b_m
    real(8), intent (in) :: c
    real(8), intent (in) :: f
    code = -sqrt((f / -a))
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
	return -Math.sqrt((F / -A));
}
B_m = math.fabs(B)
[A, B_m, C, F] = sort([A, B_m, C, F])
def code(A, B_m, C, F):
	return -math.sqrt((F / -A))
B_m = abs(B)
A, B_m, C, F = sort([A, B_m, C, F])
function code(A, B_m, C, F)
	return Float64(-sqrt(Float64(F / Float64(-A))))
end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp = code(A, B_m, C, F)
	tmp = -sqrt((F / -A));
end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := (-N[Sqrt[N[(F / (-A)), $MachinePrecision]], $MachinePrecision])
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
-\sqrt{\frac{F}{-A}}
\end{array}
Derivation
  1. Initial program 22.2%

    \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
  2. Add Preprocessing
  3. Taylor expanded in F around 0 17.0%

    \[\leadsto \color{blue}{-1 \cdot \left(\sqrt{\frac{F \cdot \left(A + \left(C + \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right)\right)}{{B}^{2} - 4 \cdot \left(A \cdot C\right)}} \cdot \sqrt{2}\right)} \]
  4. Simplified32.4%

    \[\leadsto \color{blue}{-\sqrt{2} \cdot \sqrt{F \cdot \frac{\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)}}} \]
  5. Step-by-step derivation
    1. *-commutative32.4%

      \[\leadsto -\color{blue}{\sqrt{F \cdot \frac{\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)}} \cdot \sqrt{2}} \]
    2. pow1/232.4%

      \[\leadsto -\color{blue}{{\left(F \cdot \frac{\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)}\right)}^{0.5}} \cdot \sqrt{2} \]
    3. metadata-eval32.4%

      \[\leadsto -{\left(F \cdot \frac{\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)}\right)}^{\color{blue}{\left(0.25 \cdot 2\right)}} \cdot \sqrt{2} \]
    4. pow1/232.4%

      \[\leadsto -{\left(F \cdot \frac{\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)}\right)}^{\left(0.25 \cdot 2\right)} \cdot \color{blue}{{2}^{0.5}} \]
    5. metadata-eval32.4%

      \[\leadsto -{\left(F \cdot \frac{\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)}\right)}^{\left(0.25 \cdot 2\right)} \cdot {2}^{\color{blue}{\left(0.25 \cdot 2\right)}} \]
    6. pow-prod-down32.4%

      \[\leadsto -\color{blue}{{\left(\left(F \cdot \frac{\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)}\right) \cdot 2\right)}^{\left(0.25 \cdot 2\right)}} \]
    7. associate-*r/29.1%

      \[\leadsto -{\left(\color{blue}{\frac{F \cdot \left(\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)}} \cdot 2\right)}^{\left(0.25 \cdot 2\right)} \]
    8. metadata-eval29.1%

      \[\leadsto -{\left(\frac{F \cdot \left(\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)} \cdot 2\right)}^{\color{blue}{0.5}} \]
  6. Applied egg-rr29.1%

    \[\leadsto -\color{blue}{{\left(\frac{F \cdot \left(\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)} \cdot 2\right)}^{0.5}} \]
  7. Step-by-step derivation
    1. unpow1/229.1%

      \[\leadsto -\color{blue}{\sqrt{\frac{F \cdot \left(\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)} \cdot 2}} \]
  8. Simplified29.1%

    \[\leadsto -\color{blue}{\sqrt{\frac{F \cdot \left(\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)\right)}{\mathsf{fma}\left(-4, C \cdot A, {B}^{2}\right)} \cdot 2}} \]
  9. Taylor expanded in C around inf 18.1%

    \[\leadsto -\sqrt{\color{blue}{-1 \cdot \frac{F}{A}}} \]
  10. Step-by-step derivation
    1. mul-1-neg18.1%

      \[\leadsto -\sqrt{\color{blue}{-\frac{F}{A}}} \]
  11. Simplified18.1%

    \[\leadsto -\sqrt{\color{blue}{-\frac{F}{A}}} \]
  12. Final simplification18.1%

    \[\leadsto -\sqrt{\frac{F}{-A}} \]
  13. Add Preprocessing

Reproduce

?
herbie shell --seed 2024172 
(FPCore (A B C F)
  :name "ABCF->ab-angle a"
  :precision binary64
  (/ (- (sqrt (* (* 2.0 (* (- (pow B 2.0) (* (* 4.0 A) C)) F)) (+ (+ A C) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0))))))) (- (pow B 2.0) (* (* 4.0 A) C))))