ABCF->ab-angle b

Percentage Accurate: 19.3% → 54.0%
Time: 34.9s
Alternatives: 13
Speedup: 6.1×

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 13 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.3% 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: 54.0% accurate, 0.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 := \mathsf{fma}\left(A, C \cdot -4, {B_m}^{2}\right)\\ t_1 := \sqrt{2 \cdot t_0}\\ t_2 := \mathsf{fma}\left(B_m, B_m, A \cdot \left(C \cdot -4\right)\right)\\ t_3 := {B_m}^{2} - \left(4 \cdot A\right) \cdot C\\ t_4 := \frac{-\sqrt{\left(2 \cdot \left(t_3 \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{B_m}^{2} + {\left(A - C\right)}^{2}}\right)}}{t_3}\\ \mathbf{if}\;t_4 \leq -\infty:\\ \;\;\;\;\frac{t_1 \cdot \left(-\sqrt{F \cdot \left(A + A\right)}\right)}{t_0}\\ \mathbf{elif}\;t_4 \leq -4 \cdot 10^{-211}:\\ \;\;\;\;\frac{t_1 \cdot \left(-\sqrt{F \cdot \left(A + \left(C - \mathsf{hypot}\left(B_m, A - C\right)\right)\right)}\right)}{t_0}\\ \mathbf{elif}\;t_4 \leq 2 \cdot 10^{+225}:\\ \;\;\;\;\frac{-\sqrt{\left(F \cdot t_2\right) \cdot \left(2 \cdot \left(A + \left(A + -0.5 \cdot \frac{{A}^{2} + \left({B_m}^{2} - {\left(-A\right)}^{2}\right)}{C}\right)\right)\right)}}{t_2}\\ \mathbf{elif}\;t_4 \leq \infty:\\ \;\;\;\;\sqrt{\frac{-F}{C}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{2}}{B_m} \cdot \left(-\sqrt{F \cdot \left(A - \mathsf{hypot}\left(B_m, A\right)\right)}\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
 (let* ((t_0 (fma A (* C -4.0) (pow B_m 2.0)))
        (t_1 (sqrt (* 2.0 t_0)))
        (t_2 (fma B_m B_m (* A (* C -4.0))))
        (t_3 (- (pow B_m 2.0) (* (* 4.0 A) C)))
        (t_4
         (/
          (-
           (sqrt
            (*
             (* 2.0 (* t_3 F))
             (- (+ A C) (sqrt (+ (pow B_m 2.0) (pow (- A C) 2.0)))))))
          t_3)))
   (if (<= t_4 (- INFINITY))
     (/ (* t_1 (- (sqrt (* F (+ A A))))) t_0)
     (if (<= t_4 -4e-211)
       (/ (* t_1 (- (sqrt (* F (+ A (- C (hypot B_m (- A C)))))))) t_0)
       (if (<= t_4 2e+225)
         (/
          (-
           (sqrt
            (*
             (* F t_2)
             (*
              2.0
              (+
               A
               (+
                A
                (*
                 -0.5
                 (/ (+ (pow A 2.0) (- (pow B_m 2.0) (pow (- A) 2.0))) C))))))))
          t_2)
         (if (<= t_4 INFINITY)
           (sqrt (/ (- F) C))
           (* (/ (sqrt 2.0) B_m) (- (sqrt (* F (- A (hypot B_m 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) {
	double t_0 = fma(A, (C * -4.0), pow(B_m, 2.0));
	double t_1 = sqrt((2.0 * t_0));
	double t_2 = fma(B_m, B_m, (A * (C * -4.0)));
	double t_3 = pow(B_m, 2.0) - ((4.0 * A) * C);
	double t_4 = -sqrt(((2.0 * (t_3 * F)) * ((A + C) - sqrt((pow(B_m, 2.0) + pow((A - C), 2.0)))))) / t_3;
	double tmp;
	if (t_4 <= -((double) INFINITY)) {
		tmp = (t_1 * -sqrt((F * (A + A)))) / t_0;
	} else if (t_4 <= -4e-211) {
		tmp = (t_1 * -sqrt((F * (A + (C - hypot(B_m, (A - C))))))) / t_0;
	} else if (t_4 <= 2e+225) {
		tmp = -sqrt(((F * t_2) * (2.0 * (A + (A + (-0.5 * ((pow(A, 2.0) + (pow(B_m, 2.0) - pow(-A, 2.0))) / C))))))) / t_2;
	} else if (t_4 <= ((double) INFINITY)) {
		tmp = sqrt((-F / C));
	} else {
		tmp = (sqrt(2.0) / B_m) * -sqrt((F * (A - hypot(B_m, A))));
	}
	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(A, Float64(C * -4.0), (B_m ^ 2.0))
	t_1 = sqrt(Float64(2.0 * t_0))
	t_2 = fma(B_m, B_m, Float64(A * Float64(C * -4.0)))
	t_3 = Float64((B_m ^ 2.0) - Float64(Float64(4.0 * A) * C))
	t_4 = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_3 * F)) * Float64(Float64(A + C) - sqrt(Float64((B_m ^ 2.0) + (Float64(A - C) ^ 2.0))))))) / t_3)
	tmp = 0.0
	if (t_4 <= Float64(-Inf))
		tmp = Float64(Float64(t_1 * Float64(-sqrt(Float64(F * Float64(A + A))))) / t_0);
	elseif (t_4 <= -4e-211)
		tmp = Float64(Float64(t_1 * Float64(-sqrt(Float64(F * Float64(A + Float64(C - hypot(B_m, Float64(A - C)))))))) / t_0);
	elseif (t_4 <= 2e+225)
		tmp = Float64(Float64(-sqrt(Float64(Float64(F * t_2) * Float64(2.0 * Float64(A + Float64(A + Float64(-0.5 * Float64(Float64((A ^ 2.0) + Float64((B_m ^ 2.0) - (Float64(-A) ^ 2.0))) / C)))))))) / t_2);
	elseif (t_4 <= Inf)
		tmp = sqrt(Float64(Float64(-F) / C));
	else
		tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(-sqrt(Float64(F * Float64(A - hypot(B_m, A))))));
	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] + N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(2.0 * t$95$0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[Power[B$95$m, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$3 * 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]) / t$95$3), $MachinePrecision]}, If[LessEqual[t$95$4, (-Infinity)], N[(N[(t$95$1 * (-N[Sqrt[N[(F * N[(A + A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$0), $MachinePrecision], If[LessEqual[t$95$4, -4e-211], N[(N[(t$95$1 * (-N[Sqrt[N[(F * N[(A + N[(C - N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$0), $MachinePrecision], If[LessEqual[t$95$4, 2e+225], N[((-N[Sqrt[N[(N[(F * t$95$2), $MachinePrecision] * N[(2.0 * N[(A + N[(A + N[(-0.5 * N[(N[(N[Power[A, 2.0], $MachinePrecision] + N[(N[Power[B$95$m, 2.0], $MachinePrecision] - N[Power[(-A), 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$2), $MachinePrecision], If[LessEqual[t$95$4, Infinity], N[Sqrt[N[((-F) / C), $MachinePrecision]], $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * (-N[Sqrt[N[(F * N[(A - N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $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}
t_0 := \mathsf{fma}\left(A, C \cdot -4, {B_m}^{2}\right)\\
t_1 := \sqrt{2 \cdot t_0}\\
t_2 := \mathsf{fma}\left(B_m, B_m, A \cdot \left(C \cdot -4\right)\right)\\
t_3 := {B_m}^{2} - \left(4 \cdot A\right) \cdot C\\
t_4 := \frac{-\sqrt{\left(2 \cdot \left(t_3 \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{B_m}^{2} + {\left(A - C\right)}^{2}}\right)}}{t_3}\\
\mathbf{if}\;t_4 \leq -\infty:\\
\;\;\;\;\frac{t_1 \cdot \left(-\sqrt{F \cdot \left(A + A\right)}\right)}{t_0}\\

\mathbf{elif}\;t_4 \leq -4 \cdot 10^{-211}:\\
\;\;\;\;\frac{t_1 \cdot \left(-\sqrt{F \cdot \left(A + \left(C - \mathsf{hypot}\left(B_m, A - C\right)\right)\right)}\right)}{t_0}\\

\mathbf{elif}\;t_4 \leq 2 \cdot 10^{+225}:\\
\;\;\;\;\frac{-\sqrt{\left(F \cdot t_2\right) \cdot \left(2 \cdot \left(A + \left(A + -0.5 \cdot \frac{{A}^{2} + \left({B_m}^{2} - {\left(-A\right)}^{2}\right)}{C}\right)\right)\right)}}{t_2}\\

\mathbf{elif}\;t_4 \leq \infty:\\
\;\;\;\;\sqrt{\frac{-F}{C}}\\

\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B_m} \cdot \left(-\sqrt{F \cdot \left(A - \mathsf{hypot}\left(B_m, A\right)\right)}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 2 (*.f64 (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)) F)) (-.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))))) (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C))) < -inf.0

    1. Initial program 3.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. Simplified10.8%

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

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

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

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

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

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

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

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

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

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

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

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

    if -inf.0 < (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 2 (*.f64 (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)) F)) (-.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))))) (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C))) < -4.00000000000000034e-211

    1. Initial program 98.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. Simplified79.4%

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

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

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

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

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

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

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

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

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

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

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

    if -4.00000000000000034e-211 < (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 2 (*.f64 (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)) F)) (-.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))))) (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C))) < 1.99999999999999986e225

    1. Initial program 17.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. Simplified21.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. Taylor expanded in C around inf 42.2%

      \[\leadsto \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 + \color{blue}{\left(A + -0.5 \cdot \frac{\left({A}^{2} + {B}^{2}\right) - {\left(-1 \cdot A\right)}^{2}}{C}\right)}\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
    5. Step-by-step derivation
      1. associate--l+42.2%

        \[\leadsto \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(A + -0.5 \cdot \frac{\color{blue}{{A}^{2} + \left({B}^{2} - {\left(-1 \cdot A\right)}^{2}\right)}}{C}\right)\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
      2. mul-1-neg42.2%

        \[\leadsto \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(A + -0.5 \cdot \frac{{A}^{2} + \left({B}^{2} - {\color{blue}{\left(-A\right)}}^{2}\right)}{C}\right)\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
    6. Simplified42.2%

      \[\leadsto \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 + \color{blue}{\left(A + -0.5 \cdot \frac{{A}^{2} + \left({B}^{2} - {\left(-A\right)}^{2}\right)}{C}\right)}\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]

    if 1.99999999999999986e225 < (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 2 (*.f64 (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)) F)) (-.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))))) (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C))) < +inf.0

    1. Initial program 4.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. Simplified57.1%

      \[\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. add-sqr-sqrt56.4%

        \[\leadsto \color{blue}{\sqrt{\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)}} \cdot \sqrt{\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)}}} \]
      2. sqrt-unprod39.9%

        \[\leadsto \color{blue}{\sqrt{\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)} \cdot \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. frac-times29.9%

        \[\leadsto \sqrt{\color{blue}{\frac{\left(-\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)}\right) \cdot \left(-\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)}\right)}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}}} \]
    5. Applied egg-rr29.9%

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

      \[\leadsto \sqrt{\color{blue}{-1 \cdot \frac{F}{C}}} \]
    7. Step-by-step derivation
      1. mul-1-neg48.8%

        \[\leadsto \sqrt{\color{blue}{-\frac{F}{C}}} \]
    8. Simplified48.8%

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

    if +inf.0 < (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 2 (*.f64 (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)) F)) (-.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))))) (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 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. Simplified2.7%

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

      \[\leadsto \color{blue}{-1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}\right)} \]
    5. Step-by-step derivation
      1. associate-*r*1.9%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(-\frac{\sqrt{2}}{B}\right) \cdot \sqrt{F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)}} \]
  3. Recombined 5 regimes into one program.
  4. Final simplification37.7%

    \[\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)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \leq -\infty:\\ \;\;\;\;\frac{\sqrt{2 \cdot \mathsf{fma}\left(A, C \cdot -4, {B}^{2}\right)} \cdot \left(-\sqrt{F \cdot \left(A + A\right)}\right)}{\mathsf{fma}\left(A, C \cdot -4, {B}^{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)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \leq -4 \cdot 10^{-211}:\\ \;\;\;\;\frac{\sqrt{2 \cdot \mathsf{fma}\left(A, C \cdot -4, {B}^{2}\right)} \cdot \left(-\sqrt{F \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)}\right)}{\mathsf{fma}\left(A, C \cdot -4, {B}^{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)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \leq 2 \cdot 10^{+225}:\\ \;\;\;\;\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(A + -0.5 \cdot \frac{{A}^{2} + \left({B}^{2} - {\left(-A\right)}^{2}\right)}{C}\right)\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\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)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \leq \infty:\\ \;\;\;\;\sqrt{\frac{-F}{C}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 54.1% accurate, 0.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 := \mathsf{fma}\left(B_m, B_m, A \cdot \left(C \cdot -4\right)\right)\\ t_1 := F \cdot t_0\\ t_2 := \mathsf{fma}\left(A, C \cdot -4, {B_m}^{2}\right)\\ t_3 := {B_m}^{2} - \left(4 \cdot A\right) \cdot C\\ t_4 := \frac{-\sqrt{\left(2 \cdot \left(t_3 \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{B_m}^{2} + {\left(A - C\right)}^{2}}\right)}}{t_3}\\ \mathbf{if}\;t_4 \leq -\infty:\\ \;\;\;\;\frac{\sqrt{2 \cdot t_2} \cdot \left(-\sqrt{F \cdot \left(A + A\right)}\right)}{t_2}\\ \mathbf{elif}\;t_4 \leq -4 \cdot 10^{-211}:\\ \;\;\;\;\frac{-\sqrt{t_1 \cdot \left(2 \cdot \left(A + \left(C - \mathsf{hypot}\left(B_m, A - C\right)\right)\right)\right)}}{t_0}\\ \mathbf{elif}\;t_4 \leq 2 \cdot 10^{+225}:\\ \;\;\;\;\frac{-\sqrt{t_1 \cdot \left(2 \cdot \left(A + \left(A + -0.5 \cdot \frac{{A}^{2} + \left({B_m}^{2} - {\left(-A\right)}^{2}\right)}{C}\right)\right)\right)}}{t_0}\\ \mathbf{elif}\;t_4 \leq \infty:\\ \;\;\;\;\sqrt{\frac{-F}{C}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{2}}{B_m} \cdot \left(-\sqrt{F \cdot \left(A - \mathsf{hypot}\left(B_m, A\right)\right)}\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
 (let* ((t_0 (fma B_m B_m (* A (* C -4.0))))
        (t_1 (* F t_0))
        (t_2 (fma A (* C -4.0) (pow B_m 2.0)))
        (t_3 (- (pow B_m 2.0) (* (* 4.0 A) C)))
        (t_4
         (/
          (-
           (sqrt
            (*
             (* 2.0 (* t_3 F))
             (- (+ A C) (sqrt (+ (pow B_m 2.0) (pow (- A C) 2.0)))))))
          t_3)))
   (if (<= t_4 (- INFINITY))
     (/ (* (sqrt (* 2.0 t_2)) (- (sqrt (* F (+ A A))))) t_2)
     (if (<= t_4 -4e-211)
       (/ (- (sqrt (* t_1 (* 2.0 (+ A (- C (hypot B_m (- A C)))))))) t_0)
       (if (<= t_4 2e+225)
         (/
          (-
           (sqrt
            (*
             t_1
             (*
              2.0
              (+
               A
               (+
                A
                (*
                 -0.5
                 (/ (+ (pow A 2.0) (- (pow B_m 2.0) (pow (- A) 2.0))) C))))))))
          t_0)
         (if (<= t_4 INFINITY)
           (sqrt (/ (- F) C))
           (* (/ (sqrt 2.0) B_m) (- (sqrt (* F (- A (hypot B_m 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) {
	double t_0 = fma(B_m, B_m, (A * (C * -4.0)));
	double t_1 = F * t_0;
	double t_2 = fma(A, (C * -4.0), pow(B_m, 2.0));
	double t_3 = pow(B_m, 2.0) - ((4.0 * A) * C);
	double t_4 = -sqrt(((2.0 * (t_3 * F)) * ((A + C) - sqrt((pow(B_m, 2.0) + pow((A - C), 2.0)))))) / t_3;
	double tmp;
	if (t_4 <= -((double) INFINITY)) {
		tmp = (sqrt((2.0 * t_2)) * -sqrt((F * (A + A)))) / t_2;
	} else if (t_4 <= -4e-211) {
		tmp = -sqrt((t_1 * (2.0 * (A + (C - hypot(B_m, (A - C))))))) / t_0;
	} else if (t_4 <= 2e+225) {
		tmp = -sqrt((t_1 * (2.0 * (A + (A + (-0.5 * ((pow(A, 2.0) + (pow(B_m, 2.0) - pow(-A, 2.0))) / C))))))) / t_0;
	} else if (t_4 <= ((double) INFINITY)) {
		tmp = sqrt((-F / C));
	} else {
		tmp = (sqrt(2.0) / B_m) * -sqrt((F * (A - hypot(B_m, A))));
	}
	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)))
	t_1 = Float64(F * t_0)
	t_2 = fma(A, Float64(C * -4.0), (B_m ^ 2.0))
	t_3 = Float64((B_m ^ 2.0) - Float64(Float64(4.0 * A) * C))
	t_4 = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_3 * F)) * Float64(Float64(A + C) - sqrt(Float64((B_m ^ 2.0) + (Float64(A - C) ^ 2.0))))))) / t_3)
	tmp = 0.0
	if (t_4 <= Float64(-Inf))
		tmp = Float64(Float64(sqrt(Float64(2.0 * t_2)) * Float64(-sqrt(Float64(F * Float64(A + A))))) / t_2);
	elseif (t_4 <= -4e-211)
		tmp = Float64(Float64(-sqrt(Float64(t_1 * Float64(2.0 * Float64(A + Float64(C - hypot(B_m, Float64(A - C)))))))) / t_0);
	elseif (t_4 <= 2e+225)
		tmp = Float64(Float64(-sqrt(Float64(t_1 * Float64(2.0 * Float64(A + Float64(A + Float64(-0.5 * Float64(Float64((A ^ 2.0) + Float64((B_m ^ 2.0) - (Float64(-A) ^ 2.0))) / C)))))))) / t_0);
	elseif (t_4 <= Inf)
		tmp = sqrt(Float64(Float64(-F) / C));
	else
		tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(-sqrt(Float64(F * Float64(A - hypot(B_m, A))))));
	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]}, Block[{t$95$1 = N[(F * t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(A * N[(C * -4.0), $MachinePrecision] + N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[Power[B$95$m, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$3 * 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]) / t$95$3), $MachinePrecision]}, If[LessEqual[t$95$4, (-Infinity)], N[(N[(N[Sqrt[N[(2.0 * t$95$2), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(F * N[(A + A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$2), $MachinePrecision], If[LessEqual[t$95$4, -4e-211], N[((-N[Sqrt[N[(t$95$1 * N[(2.0 * N[(A + N[(C - N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[t$95$4, 2e+225], N[((-N[Sqrt[N[(t$95$1 * N[(2.0 * N[(A + N[(A + N[(-0.5 * N[(N[(N[Power[A, 2.0], $MachinePrecision] + N[(N[Power[B$95$m, 2.0], $MachinePrecision] - N[Power[(-A), 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[t$95$4, Infinity], N[Sqrt[N[((-F) / C), $MachinePrecision]], $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * (-N[Sqrt[N[(F * N[(A - N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $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}
t_0 := \mathsf{fma}\left(B_m, B_m, A \cdot \left(C \cdot -4\right)\right)\\
t_1 := F \cdot t_0\\
t_2 := \mathsf{fma}\left(A, C \cdot -4, {B_m}^{2}\right)\\
t_3 := {B_m}^{2} - \left(4 \cdot A\right) \cdot C\\
t_4 := \frac{-\sqrt{\left(2 \cdot \left(t_3 \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{B_m}^{2} + {\left(A - C\right)}^{2}}\right)}}{t_3}\\
\mathbf{if}\;t_4 \leq -\infty:\\
\;\;\;\;\frac{\sqrt{2 \cdot t_2} \cdot \left(-\sqrt{F \cdot \left(A + A\right)}\right)}{t_2}\\

\mathbf{elif}\;t_4 \leq -4 \cdot 10^{-211}:\\
\;\;\;\;\frac{-\sqrt{t_1 \cdot \left(2 \cdot \left(A + \left(C - \mathsf{hypot}\left(B_m, A - C\right)\right)\right)\right)}}{t_0}\\

\mathbf{elif}\;t_4 \leq 2 \cdot 10^{+225}:\\
\;\;\;\;\frac{-\sqrt{t_1 \cdot \left(2 \cdot \left(A + \left(A + -0.5 \cdot \frac{{A}^{2} + \left({B_m}^{2} - {\left(-A\right)}^{2}\right)}{C}\right)\right)\right)}}{t_0}\\

\mathbf{elif}\;t_4 \leq \infty:\\
\;\;\;\;\sqrt{\frac{-F}{C}}\\

\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B_m} \cdot \left(-\sqrt{F \cdot \left(A - \mathsf{hypot}\left(B_m, A\right)\right)}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 2 (*.f64 (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)) F)) (-.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))))) (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C))) < -inf.0

    1. Initial program 3.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. Simplified10.8%

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

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

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

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

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

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

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

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

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

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

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

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

    if -inf.0 < (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 2 (*.f64 (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)) F)) (-.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))))) (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C))) < -4.00000000000000034e-211

    1. Initial program 98.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. Simplified98.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

    if -4.00000000000000034e-211 < (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 2 (*.f64 (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)) F)) (-.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))))) (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C))) < 1.99999999999999986e225

    1. Initial program 17.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. Simplified21.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. Taylor expanded in C around inf 42.2%

      \[\leadsto \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 + \color{blue}{\left(A + -0.5 \cdot \frac{\left({A}^{2} + {B}^{2}\right) - {\left(-1 \cdot A\right)}^{2}}{C}\right)}\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
    5. Step-by-step derivation
      1. associate--l+42.2%

        \[\leadsto \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(A + -0.5 \cdot \frac{\color{blue}{{A}^{2} + \left({B}^{2} - {\left(-1 \cdot A\right)}^{2}\right)}}{C}\right)\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
      2. mul-1-neg42.2%

        \[\leadsto \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(A + -0.5 \cdot \frac{{A}^{2} + \left({B}^{2} - {\color{blue}{\left(-A\right)}}^{2}\right)}{C}\right)\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
    6. Simplified42.2%

      \[\leadsto \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 + \color{blue}{\left(A + -0.5 \cdot \frac{{A}^{2} + \left({B}^{2} - {\left(-A\right)}^{2}\right)}{C}\right)}\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]

    if 1.99999999999999986e225 < (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 2 (*.f64 (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)) F)) (-.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))))) (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C))) < +inf.0

    1. Initial program 4.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. Simplified57.1%

      \[\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. add-sqr-sqrt56.4%

        \[\leadsto \color{blue}{\sqrt{\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)}} \cdot \sqrt{\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)}}} \]
      2. sqrt-unprod39.9%

        \[\leadsto \color{blue}{\sqrt{\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)} \cdot \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. frac-times29.9%

        \[\leadsto \sqrt{\color{blue}{\frac{\left(-\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)}\right) \cdot \left(-\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)}\right)}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}}} \]
    5. Applied egg-rr29.9%

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

      \[\leadsto \sqrt{\color{blue}{-1 \cdot \frac{F}{C}}} \]
    7. Step-by-step derivation
      1. mul-1-neg48.8%

        \[\leadsto \sqrt{\color{blue}{-\frac{F}{C}}} \]
    8. Simplified48.8%

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

    if +inf.0 < (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 2 (*.f64 (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)) F)) (-.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))))) (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 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. Simplified2.7%

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

      \[\leadsto \color{blue}{-1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}\right)} \]
    5. Step-by-step derivation
      1. associate-*r*1.9%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(-\frac{\sqrt{2}}{B}\right) \cdot \sqrt{F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)}} \]
  3. Recombined 5 regimes into one program.
  4. Final simplification37.6%

    \[\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)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \leq -\infty:\\ \;\;\;\;\frac{\sqrt{2 \cdot \mathsf{fma}\left(A, C \cdot -4, {B}^{2}\right)} \cdot \left(-\sqrt{F \cdot \left(A + A\right)}\right)}{\mathsf{fma}\left(A, C \cdot -4, {B}^{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)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \leq -4 \cdot 10^{-211}:\\ \;\;\;\;\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}\;\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)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \leq 2 \cdot 10^{+225}:\\ \;\;\;\;\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(A + -0.5 \cdot \frac{{A}^{2} + \left({B}^{2} - {\left(-A\right)}^{2}\right)}{C}\right)\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\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)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \leq \infty:\\ \;\;\;\;\sqrt{\frac{-F}{C}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 46.5% accurate, 1.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} t_0 := \frac{-\sqrt{-8 \cdot \left(\left(F \cdot \left(A + A\right)\right) \cdot \left(A \cdot C\right)\right)}}{\mathsf{fma}\left(A, C \cdot -4, {B_m}^{2}\right)}\\ \mathbf{if}\;{B_m}^{2} \leq 2 \cdot 10^{-80}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;{B_m}^{2} \leq 20000000000:\\ \;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(A + \left(C - \mathsf{hypot}\left(B_m, A - C\right)\right)\right)\right) \cdot \left({B_m}^{2} \cdot F\right)}}{\mathsf{fma}\left(B_m, B_m, A \cdot \left(C \cdot -4\right)\right)}\\ \mathbf{elif}\;{B_m}^{2} \leq 4 \cdot 10^{+38}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{2}}{B_m} \cdot \left(-\sqrt{F \cdot \left(A - \mathsf{hypot}\left(B_m, A\right)\right)}\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
 (let* ((t_0
         (/
          (- (sqrt (* -8.0 (* (* F (+ A A)) (* A C)))))
          (fma A (* C -4.0) (pow B_m 2.0)))))
   (if (<= (pow B_m 2.0) 2e-80)
     t_0
     (if (<= (pow B_m 2.0) 20000000000.0)
       (/
        (-
         (sqrt
          (* (* 2.0 (+ A (- C (hypot B_m (- A C))))) (* (pow B_m 2.0) F))))
        (fma B_m B_m (* A (* C -4.0))))
       (if (<= (pow B_m 2.0) 4e+38)
         t_0
         (* (/ (sqrt 2.0) B_m) (- (sqrt (* F (- A (hypot B_m 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) {
	double t_0 = -sqrt((-8.0 * ((F * (A + A)) * (A * C)))) / fma(A, (C * -4.0), pow(B_m, 2.0));
	double tmp;
	if (pow(B_m, 2.0) <= 2e-80) {
		tmp = t_0;
	} else if (pow(B_m, 2.0) <= 20000000000.0) {
		tmp = -sqrt(((2.0 * (A + (C - hypot(B_m, (A - C))))) * (pow(B_m, 2.0) * F))) / fma(B_m, B_m, (A * (C * -4.0)));
	} else if (pow(B_m, 2.0) <= 4e+38) {
		tmp = t_0;
	} else {
		tmp = (sqrt(2.0) / B_m) * -sqrt((F * (A - hypot(B_m, A))));
	}
	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(-sqrt(Float64(-8.0 * Float64(Float64(F * Float64(A + A)) * Float64(A * C))))) / fma(A, Float64(C * -4.0), (B_m ^ 2.0)))
	tmp = 0.0
	if ((B_m ^ 2.0) <= 2e-80)
		tmp = t_0;
	elseif ((B_m ^ 2.0) <= 20000000000.0)
		tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(A + Float64(C - hypot(B_m, Float64(A - C))))) * Float64((B_m ^ 2.0) * F)))) / fma(B_m, B_m, Float64(A * Float64(C * -4.0))));
	elseif ((B_m ^ 2.0) <= 4e+38)
		tmp = t_0;
	else
		tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(-sqrt(Float64(F * Float64(A - hypot(B_m, A))))));
	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[Sqrt[N[(-8.0 * N[(N[(F * N[(A + A), $MachinePrecision]), $MachinePrecision] * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(A * N[(C * -4.0), $MachinePrecision] + N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e-80], t$95$0, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 20000000000.0], N[((-N[Sqrt[N[(N[(2.0 * N[(A + N[(C - N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Power[B$95$m, 2.0], $MachinePrecision] * F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 4e+38], t$95$0, N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * (-N[Sqrt[N[(F * N[(A - N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $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}
t_0 := \frac{-\sqrt{-8 \cdot \left(\left(F \cdot \left(A + A\right)\right) \cdot \left(A \cdot C\right)\right)}}{\mathsf{fma}\left(A, C \cdot -4, {B_m}^{2}\right)}\\
\mathbf{if}\;{B_m}^{2} \leq 2 \cdot 10^{-80}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;{B_m}^{2} \leq 20000000000:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(A + \left(C - \mathsf{hypot}\left(B_m, A - C\right)\right)\right)\right) \cdot \left({B_m}^{2} \cdot F\right)}}{\mathsf{fma}\left(B_m, B_m, A \cdot \left(C \cdot -4\right)\right)}\\

\mathbf{elif}\;{B_m}^{2} \leq 4 \cdot 10^{+38}:\\
\;\;\;\;t_0\\

\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B_m} \cdot \left(-\sqrt{F \cdot \left(A - \mathsf{hypot}\left(B_m, A\right)\right)}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (pow.f64 B 2) < 1.99999999999999992e-80 or 2e10 < (pow.f64 B 2) < 3.99999999999999991e38

    1. Initial program 19.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. Simplified26.1%

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

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

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

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

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

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

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

    if 1.99999999999999992e-80 < (pow.f64 B 2) < 2e10

    1. Initial program 47.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. Simplified49.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 B around inf 46.9%

      \[\leadsto \frac{-\sqrt{\color{blue}{\left({B}^{2} \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)} \]

    if 3.99999999999999991e38 < (pow.f64 B 2)

    1. Initial program 14.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. Simplified11.4%

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

      \[\leadsto \color{blue}{-1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}\right)} \]
    5. Step-by-step derivation
      1. associate-*r*7.2%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(-\frac{\sqrt{2}}{B}\right) \cdot \sqrt{F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification28.7%

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

Alternative 4: 47.3% accurate, 1.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} t_0 := A - \mathsf{hypot}\left(B_m, A\right)\\ t_1 := \mathsf{fma}\left(A, C \cdot -4, {B_m}^{2}\right)\\ t_2 := \mathsf{fma}\left(B_m, B_m, A \cdot \left(C \cdot -4\right)\right)\\ t_3 := F \cdot \left(A + A\right)\\ t_4 := \frac{-\sqrt{-8 \cdot \left(t_3 \cdot \left(A \cdot C\right)\right)}}{t_1}\\ \mathbf{if}\;B_m \leq 4.2 \cdot 10^{-166}:\\ \;\;\;\;t_4\\ \mathbf{elif}\;B_m \leq 5.8 \cdot 10^{-126}:\\ \;\;\;\;\frac{\sqrt{2 \cdot t_1} \cdot \left(-\sqrt{t_3}\right)}{t_1}\\ \mathbf{elif}\;B_m \leq 2.7 \cdot 10^{-50}:\\ \;\;\;\;t_4\\ \mathbf{elif}\;B_m \leq 2.6 \cdot 10^{+36}:\\ \;\;\;\;\frac{-\sqrt{\left(F \cdot t_2\right) \cdot \left(2 \cdot t_0\right)}}{t_2}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{2}}{B_m} \cdot \left(-\sqrt{F \cdot t_0}\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
 (let* ((t_0 (- A (hypot B_m A)))
        (t_1 (fma A (* C -4.0) (pow B_m 2.0)))
        (t_2 (fma B_m B_m (* A (* C -4.0))))
        (t_3 (* F (+ A A)))
        (t_4 (/ (- (sqrt (* -8.0 (* t_3 (* A C))))) t_1)))
   (if (<= B_m 4.2e-166)
     t_4
     (if (<= B_m 5.8e-126)
       (/ (* (sqrt (* 2.0 t_1)) (- (sqrt t_3))) t_1)
       (if (<= B_m 2.7e-50)
         t_4
         (if (<= B_m 2.6e+36)
           (/ (- (sqrt (* (* F t_2) (* 2.0 t_0)))) t_2)
           (* (/ (sqrt 2.0) B_m) (- (sqrt (* F t_0))))))))))
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 - hypot(B_m, A);
	double t_1 = fma(A, (C * -4.0), pow(B_m, 2.0));
	double t_2 = fma(B_m, B_m, (A * (C * -4.0)));
	double t_3 = F * (A + A);
	double t_4 = -sqrt((-8.0 * (t_3 * (A * C)))) / t_1;
	double tmp;
	if (B_m <= 4.2e-166) {
		tmp = t_4;
	} else if (B_m <= 5.8e-126) {
		tmp = (sqrt((2.0 * t_1)) * -sqrt(t_3)) / t_1;
	} else if (B_m <= 2.7e-50) {
		tmp = t_4;
	} else if (B_m <= 2.6e+36) {
		tmp = -sqrt(((F * t_2) * (2.0 * t_0))) / t_2;
	} else {
		tmp = (sqrt(2.0) / B_m) * -sqrt((F * t_0));
	}
	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 - hypot(B_m, A))
	t_1 = fma(A, Float64(C * -4.0), (B_m ^ 2.0))
	t_2 = fma(B_m, B_m, Float64(A * Float64(C * -4.0)))
	t_3 = Float64(F * Float64(A + A))
	t_4 = Float64(Float64(-sqrt(Float64(-8.0 * Float64(t_3 * Float64(A * C))))) / t_1)
	tmp = 0.0
	if (B_m <= 4.2e-166)
		tmp = t_4;
	elseif (B_m <= 5.8e-126)
		tmp = Float64(Float64(sqrt(Float64(2.0 * t_1)) * Float64(-sqrt(t_3))) / t_1);
	elseif (B_m <= 2.7e-50)
		tmp = t_4;
	elseif (B_m <= 2.6e+36)
		tmp = Float64(Float64(-sqrt(Float64(Float64(F * t_2) * Float64(2.0 * t_0)))) / t_2);
	else
		tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(-sqrt(Float64(F * t_0))));
	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[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(A * N[(C * -4.0), $MachinePrecision] + N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(F * N[(A + A), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[((-N[Sqrt[N[(-8.0 * N[(t$95$3 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision]}, If[LessEqual[B$95$m, 4.2e-166], t$95$4, If[LessEqual[B$95$m, 5.8e-126], N[(N[(N[Sqrt[N[(2.0 * t$95$1), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[t$95$3], $MachinePrecision])), $MachinePrecision] / t$95$1), $MachinePrecision], If[LessEqual[B$95$m, 2.7e-50], t$95$4, If[LessEqual[B$95$m, 2.6e+36], N[((-N[Sqrt[N[(N[(F * t$95$2), $MachinePrecision] * N[(2.0 * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$2), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * (-N[Sqrt[N[(F * t$95$0), $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 - \mathsf{hypot}\left(B_m, A\right)\\
t_1 := \mathsf{fma}\left(A, C \cdot -4, {B_m}^{2}\right)\\
t_2 := \mathsf{fma}\left(B_m, B_m, A \cdot \left(C \cdot -4\right)\right)\\
t_3 := F \cdot \left(A + A\right)\\
t_4 := \frac{-\sqrt{-8 \cdot \left(t_3 \cdot \left(A \cdot C\right)\right)}}{t_1}\\
\mathbf{if}\;B_m \leq 4.2 \cdot 10^{-166}:\\
\;\;\;\;t_4\\

\mathbf{elif}\;B_m \leq 5.8 \cdot 10^{-126}:\\
\;\;\;\;\frac{\sqrt{2 \cdot t_1} \cdot \left(-\sqrt{t_3}\right)}{t_1}\\

\mathbf{elif}\;B_m \leq 2.7 \cdot 10^{-50}:\\
\;\;\;\;t_4\\

\mathbf{elif}\;B_m \leq 2.6 \cdot 10^{+36}:\\
\;\;\;\;\frac{-\sqrt{\left(F \cdot t_2\right) \cdot \left(2 \cdot t_0\right)}}{t_2}\\

\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B_m} \cdot \left(-\sqrt{F \cdot t_0}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if B < 4.1999999999999999e-166 or 5.79999999999999975e-126 < B < 2.7e-50

    1. Initial program 19.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. Simplified22.5%

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

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

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

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

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

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

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

    if 4.1999999999999999e-166 < B < 5.79999999999999975e-126

    1. Initial program 16.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. Simplified18.7%

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.7e-50 < B < 2.6000000000000001e36

    1. Initial program 45.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. Simplified50.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 C around 0 56.2%

      \[\leadsto \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 + \color{blue}{-1 \cdot \sqrt{{A}^{2} + {B}^{2}}}\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
    5. Step-by-step derivation
      1. mul-1-neg56.2%

        \[\leadsto \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 + \color{blue}{\left(-\sqrt{{A}^{2} + {B}^{2}}\right)}\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
      2. +-commutative56.2%

        \[\leadsto \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(-\sqrt{\color{blue}{{B}^{2} + {A}^{2}}}\right)\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
      3. unpow256.2%

        \[\leadsto \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(-\sqrt{\color{blue}{B \cdot B} + {A}^{2}}\right)\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
      4. unpow256.2%

        \[\leadsto \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(-\sqrt{B \cdot B + \color{blue}{A \cdot A}}\right)\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
      5. hypot-def56.4%

        \[\leadsto \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(-\color{blue}{\mathsf{hypot}\left(B, A\right)}\right)\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
    6. Simplified56.4%

      \[\leadsto \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 + \color{blue}{\left(-\mathsf{hypot}\left(B, A\right)\right)}\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]

    if 2.6000000000000001e36 < B

    1. Initial program 9.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. Simplified6.8%

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

      \[\leadsto \color{blue}{-1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}\right)} \]
    5. Step-by-step derivation
      1. associate-*r*11.9%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(-\frac{\sqrt{2}}{B}\right) \cdot \sqrt{F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)}} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification28.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;B \leq 4.2 \cdot 10^{-166}:\\ \;\;\;\;\frac{-\sqrt{-8 \cdot \left(\left(F \cdot \left(A + A\right)\right) \cdot \left(A \cdot C\right)\right)}}{\mathsf{fma}\left(A, C \cdot -4, {B}^{2}\right)}\\ \mathbf{elif}\;B \leq 5.8 \cdot 10^{-126}:\\ \;\;\;\;\frac{\sqrt{2 \cdot \mathsf{fma}\left(A, C \cdot -4, {B}^{2}\right)} \cdot \left(-\sqrt{F \cdot \left(A + A\right)}\right)}{\mathsf{fma}\left(A, C \cdot -4, {B}^{2}\right)}\\ \mathbf{elif}\;B \leq 2.7 \cdot 10^{-50}:\\ \;\;\;\;\frac{-\sqrt{-8 \cdot \left(\left(F \cdot \left(A + A\right)\right) \cdot \left(A \cdot C\right)\right)}}{\mathsf{fma}\left(A, C \cdot -4, {B}^{2}\right)}\\ \mathbf{elif}\;B \leq 2.6 \cdot 10^{+36}:\\ \;\;\;\;\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 - \mathsf{hypot}\left(B, A\right)\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 47.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 := A - \mathsf{hypot}\left(B_m, A\right)\\ t_2 := \frac{-\sqrt{-8 \cdot \left(\left(F \cdot \left(A + A\right)\right) \cdot \left(A \cdot C\right)\right)}}{\mathsf{fma}\left(A, C \cdot -4, {B_m}^{2}\right)}\\ t_3 := \mathsf{fma}\left(B_m, B_m, t_0\right)\\ \mathbf{if}\;B_m \leq 5.5 \cdot 10^{-163}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;B_m \leq 8.5 \cdot 10^{-127}:\\ \;\;\;\;\frac{\mathsf{hypot}\left(B_m, \sqrt{t_0}\right) \cdot \left(-\sqrt{F \cdot \left(2 \cdot \left(A + \left(C - \mathsf{hypot}\left(B_m, A - C\right)\right)\right)\right)}\right)}{t_3}\\ \mathbf{elif}\;B_m \leq 1.05 \cdot 10^{-50}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;B_m \leq 2.35 \cdot 10^{+36}:\\ \;\;\;\;\frac{-\sqrt{\left(F \cdot t_3\right) \cdot \left(2 \cdot t_1\right)}}{t_3}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{2}}{B_m} \cdot \left(-\sqrt{F \cdot t_1}\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
 (let* ((t_0 (* A (* C -4.0)))
        (t_1 (- A (hypot B_m A)))
        (t_2
         (/
          (- (sqrt (* -8.0 (* (* F (+ A A)) (* A C)))))
          (fma A (* C -4.0) (pow B_m 2.0))))
        (t_3 (fma B_m B_m t_0)))
   (if (<= B_m 5.5e-163)
     t_2
     (if (<= B_m 8.5e-127)
       (/
        (*
         (hypot B_m (sqrt t_0))
         (- (sqrt (* F (* 2.0 (+ A (- C (hypot B_m (- A C)))))))))
        t_3)
       (if (<= B_m 1.05e-50)
         t_2
         (if (<= B_m 2.35e+36)
           (/ (- (sqrt (* (* F t_3) (* 2.0 t_1)))) t_3)
           (* (/ (sqrt 2.0) B_m) (- (sqrt (* F t_1))))))))))
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 = A - hypot(B_m, A);
	double t_2 = -sqrt((-8.0 * ((F * (A + A)) * (A * C)))) / fma(A, (C * -4.0), pow(B_m, 2.0));
	double t_3 = fma(B_m, B_m, t_0);
	double tmp;
	if (B_m <= 5.5e-163) {
		tmp = t_2;
	} else if (B_m <= 8.5e-127) {
		tmp = (hypot(B_m, sqrt(t_0)) * -sqrt((F * (2.0 * (A + (C - hypot(B_m, (A - C)))))))) / t_3;
	} else if (B_m <= 1.05e-50) {
		tmp = t_2;
	} else if (B_m <= 2.35e+36) {
		tmp = -sqrt(((F * t_3) * (2.0 * t_1))) / t_3;
	} else {
		tmp = (sqrt(2.0) / B_m) * -sqrt((F * t_1));
	}
	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 = Float64(A - hypot(B_m, A))
	t_2 = Float64(Float64(-sqrt(Float64(-8.0 * Float64(Float64(F * Float64(A + A)) * Float64(A * C))))) / fma(A, Float64(C * -4.0), (B_m ^ 2.0)))
	t_3 = fma(B_m, B_m, t_0)
	tmp = 0.0
	if (B_m <= 5.5e-163)
		tmp = t_2;
	elseif (B_m <= 8.5e-127)
		tmp = Float64(Float64(hypot(B_m, sqrt(t_0)) * Float64(-sqrt(Float64(F * Float64(2.0 * Float64(A + Float64(C - hypot(B_m, Float64(A - C))))))))) / t_3);
	elseif (B_m <= 1.05e-50)
		tmp = t_2;
	elseif (B_m <= 2.35e+36)
		tmp = Float64(Float64(-sqrt(Float64(Float64(F * t_3) * Float64(2.0 * t_1)))) / t_3);
	else
		tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(-sqrt(Float64(F * t_1))));
	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[(A - N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[((-N[Sqrt[N[(-8.0 * N[(N[(F * N[(A + A), $MachinePrecision]), $MachinePrecision] * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(A * N[(C * -4.0), $MachinePrecision] + N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(B$95$m * B$95$m + t$95$0), $MachinePrecision]}, If[LessEqual[B$95$m, 5.5e-163], t$95$2, If[LessEqual[B$95$m, 8.5e-127], N[(N[(N[Sqrt[B$95$m ^ 2 + N[Sqrt[t$95$0], $MachinePrecision] ^ 2], $MachinePrecision] * (-N[Sqrt[N[(F * N[(2.0 * N[(A + N[(C - N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$3), $MachinePrecision], If[LessEqual[B$95$m, 1.05e-50], t$95$2, If[LessEqual[B$95$m, 2.35e+36], N[((-N[Sqrt[N[(N[(F * t$95$3), $MachinePrecision] * N[(2.0 * t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$3), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * (-N[Sqrt[N[(F * t$95$1), $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 := A - \mathsf{hypot}\left(B_m, A\right)\\
t_2 := \frac{-\sqrt{-8 \cdot \left(\left(F \cdot \left(A + A\right)\right) \cdot \left(A \cdot C\right)\right)}}{\mathsf{fma}\left(A, C \cdot -4, {B_m}^{2}\right)}\\
t_3 := \mathsf{fma}\left(B_m, B_m, t_0\right)\\
\mathbf{if}\;B_m \leq 5.5 \cdot 10^{-163}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;B_m \leq 8.5 \cdot 10^{-127}:\\
\;\;\;\;\frac{\mathsf{hypot}\left(B_m, \sqrt{t_0}\right) \cdot \left(-\sqrt{F \cdot \left(2 \cdot \left(A + \left(C - \mathsf{hypot}\left(B_m, A - C\right)\right)\right)\right)}\right)}{t_3}\\

\mathbf{elif}\;B_m \leq 1.05 \cdot 10^{-50}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;B_m \leq 2.35 \cdot 10^{+36}:\\
\;\;\;\;\frac{-\sqrt{\left(F \cdot t_3\right) \cdot \left(2 \cdot t_1\right)}}{t_3}\\

\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B_m} \cdot \left(-\sqrt{F \cdot t_1}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if B < 5.4999999999999998e-163 or 8.5e-127 < B < 1.05e-50

    1. Initial program 19.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. Simplified22.9%

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

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

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

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

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

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

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

    if 5.4999999999999998e-163 < B < 8.5e-127

    1. Initial program 2.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. Simplified2.3%

      \[\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. add-sqr-sqrt2.3%

        \[\leadsto \frac{-\sqrt{\color{blue}{\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)} \cdot \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)} \]
      2. sqr-neg2.3%

        \[\leadsto \frac{-\sqrt{\color{blue}{\left(-\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)}\right) \cdot \left(-\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)}\right)}}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
      3. sqrt-unprod1.9%

        \[\leadsto \frac{-\color{blue}{\sqrt{-\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)}} \cdot \sqrt{-\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)} \]
      4. add-sqr-sqrt2.0%

        \[\leadsto \frac{-\color{blue}{\left(-\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)}\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
      5. neg-sub02.0%

        \[\leadsto \frac{-\color{blue}{\left(0 - \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)}\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
      6. sub-neg2.0%

        \[\leadsto \frac{-\color{blue}{\left(0 + \left(-\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)}\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
      7. add-sqr-sqrt1.9%

        \[\leadsto \frac{-\left(0 + \color{blue}{\sqrt{-\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)}} \cdot \sqrt{-\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)}}}\right)}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
    5. Applied egg-rr18.3%

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

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

        \[\leadsto \frac{-\mathsf{hypot}\left(B, \sqrt{A \cdot \left(C \cdot -4\right)}\right) \cdot \sqrt{F \cdot \left(2 \cdot \color{blue}{\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)} \]
    7. Simplified18.3%

      \[\leadsto \frac{-\color{blue}{\mathsf{hypot}\left(B, \sqrt{A \cdot \left(C \cdot -4\right)}\right) \cdot \sqrt{F \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)} \]

    if 1.05e-50 < B < 2.34999999999999994e36

    1. Initial program 45.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. Simplified50.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 C around 0 56.2%

      \[\leadsto \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 + \color{blue}{-1 \cdot \sqrt{{A}^{2} + {B}^{2}}}\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
    5. Step-by-step derivation
      1. mul-1-neg56.2%

        \[\leadsto \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 + \color{blue}{\left(-\sqrt{{A}^{2} + {B}^{2}}\right)}\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
      2. +-commutative56.2%

        \[\leadsto \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(-\sqrt{\color{blue}{{B}^{2} + {A}^{2}}}\right)\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
      3. unpow256.2%

        \[\leadsto \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(-\sqrt{\color{blue}{B \cdot B} + {A}^{2}}\right)\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
      4. unpow256.2%

        \[\leadsto \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(-\sqrt{B \cdot B + \color{blue}{A \cdot A}}\right)\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
      5. hypot-def56.4%

        \[\leadsto \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(-\color{blue}{\mathsf{hypot}\left(B, A\right)}\right)\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
    6. Simplified56.4%

      \[\leadsto \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 + \color{blue}{\left(-\mathsf{hypot}\left(B, A\right)\right)}\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]

    if 2.34999999999999994e36 < B

    1. Initial program 9.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. Simplified6.8%

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

      \[\leadsto \color{blue}{-1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}\right)} \]
    5. Step-by-step derivation
      1. associate-*r*11.9%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(-\frac{\sqrt{2}}{B}\right) \cdot \sqrt{F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)}} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification29.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;B \leq 5.5 \cdot 10^{-163}:\\ \;\;\;\;\frac{-\sqrt{-8 \cdot \left(\left(F \cdot \left(A + A\right)\right) \cdot \left(A \cdot C\right)\right)}}{\mathsf{fma}\left(A, C \cdot -4, {B}^{2}\right)}\\ \mathbf{elif}\;B \leq 8.5 \cdot 10^{-127}:\\ \;\;\;\;\frac{\mathsf{hypot}\left(B, \sqrt{A \cdot \left(C \cdot -4\right)}\right) \cdot \left(-\sqrt{F \cdot \left(2 \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)}\right)}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}\\ \mathbf{elif}\;B \leq 1.05 \cdot 10^{-50}:\\ \;\;\;\;\frac{-\sqrt{-8 \cdot \left(\left(F \cdot \left(A + A\right)\right) \cdot \left(A \cdot C\right)\right)}}{\mathsf{fma}\left(A, C \cdot -4, {B}^{2}\right)}\\ \mathbf{elif}\;B \leq 2.35 \cdot 10^{+36}:\\ \;\;\;\;\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 - \mathsf{hypot}\left(B, A\right)\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 47.3% 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 - \mathsf{hypot}\left(B_m, A\right)\\ t_1 := A \cdot \left(C \cdot -4\right)\\ t_2 := \mathsf{fma}\left(B_m, B_m, t_1\right)\\ t_3 := \frac{-\sqrt{-8 \cdot \left(\left(F \cdot \left(A + A\right)\right) \cdot \left(A \cdot C\right)\right)}}{\mathsf{fma}\left(A, C \cdot -4, {B_m}^{2}\right)}\\ \mathbf{if}\;B_m \leq 6.6 \cdot 10^{-163}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;B_m \leq 6.2 \cdot 10^{-140}:\\ \;\;\;\;\frac{-\sqrt{F \cdot \left(2 \cdot \left(\left(A + C\right) - \mathsf{hypot}\left(B_m, A - C\right)\right)\right)}}{\mathsf{hypot}\left(B_m, \sqrt{t_1}\right)}\\ \mathbf{elif}\;B_m \leq 2.5 \cdot 10^{-50}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;B_m \leq 9.2 \cdot 10^{+35}:\\ \;\;\;\;\frac{-\sqrt{\left(F \cdot t_2\right) \cdot \left(2 \cdot t_0\right)}}{t_2}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{2}}{B_m} \cdot \left(-\sqrt{F \cdot t_0}\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
 (let* ((t_0 (- A (hypot B_m A)))
        (t_1 (* A (* C -4.0)))
        (t_2 (fma B_m B_m t_1))
        (t_3
         (/
          (- (sqrt (* -8.0 (* (* F (+ A A)) (* A C)))))
          (fma A (* C -4.0) (pow B_m 2.0)))))
   (if (<= B_m 6.6e-163)
     t_3
     (if (<= B_m 6.2e-140)
       (/
        (- (sqrt (* F (* 2.0 (- (+ A C) (hypot B_m (- A C)))))))
        (hypot B_m (sqrt t_1)))
       (if (<= B_m 2.5e-50)
         t_3
         (if (<= B_m 9.2e+35)
           (/ (- (sqrt (* (* F t_2) (* 2.0 t_0)))) t_2)
           (* (/ (sqrt 2.0) B_m) (- (sqrt (* F t_0))))))))))
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 - hypot(B_m, A);
	double t_1 = A * (C * -4.0);
	double t_2 = fma(B_m, B_m, t_1);
	double t_3 = -sqrt((-8.0 * ((F * (A + A)) * (A * C)))) / fma(A, (C * -4.0), pow(B_m, 2.0));
	double tmp;
	if (B_m <= 6.6e-163) {
		tmp = t_3;
	} else if (B_m <= 6.2e-140) {
		tmp = -sqrt((F * (2.0 * ((A + C) - hypot(B_m, (A - C)))))) / hypot(B_m, sqrt(t_1));
	} else if (B_m <= 2.5e-50) {
		tmp = t_3;
	} else if (B_m <= 9.2e+35) {
		tmp = -sqrt(((F * t_2) * (2.0 * t_0))) / t_2;
	} else {
		tmp = (sqrt(2.0) / B_m) * -sqrt((F * t_0));
	}
	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 - hypot(B_m, A))
	t_1 = Float64(A * Float64(C * -4.0))
	t_2 = fma(B_m, B_m, t_1)
	t_3 = Float64(Float64(-sqrt(Float64(-8.0 * Float64(Float64(F * Float64(A + A)) * Float64(A * C))))) / fma(A, Float64(C * -4.0), (B_m ^ 2.0)))
	tmp = 0.0
	if (B_m <= 6.6e-163)
		tmp = t_3;
	elseif (B_m <= 6.2e-140)
		tmp = Float64(Float64(-sqrt(Float64(F * Float64(2.0 * Float64(Float64(A + C) - hypot(B_m, Float64(A - C))))))) / hypot(B_m, sqrt(t_1)));
	elseif (B_m <= 2.5e-50)
		tmp = t_3;
	elseif (B_m <= 9.2e+35)
		tmp = Float64(Float64(-sqrt(Float64(Float64(F * t_2) * Float64(2.0 * t_0)))) / t_2);
	else
		tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(-sqrt(Float64(F * t_0))));
	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[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(B$95$m * B$95$m + t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[((-N[Sqrt[N[(-8.0 * N[(N[(F * N[(A + A), $MachinePrecision]), $MachinePrecision] * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(A * N[(C * -4.0), $MachinePrecision] + N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B$95$m, 6.6e-163], t$95$3, If[LessEqual[B$95$m, 6.2e-140], N[((-N[Sqrt[N[(F * N[(2.0 * N[(N[(A + C), $MachinePrecision] - N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[Sqrt[B$95$m ^ 2 + N[Sqrt[t$95$1], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision], If[LessEqual[B$95$m, 2.5e-50], t$95$3, If[LessEqual[B$95$m, 9.2e+35], N[((-N[Sqrt[N[(N[(F * t$95$2), $MachinePrecision] * N[(2.0 * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$2), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * (-N[Sqrt[N[(F * t$95$0), $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 - \mathsf{hypot}\left(B_m, A\right)\\
t_1 := A \cdot \left(C \cdot -4\right)\\
t_2 := \mathsf{fma}\left(B_m, B_m, t_1\right)\\
t_3 := \frac{-\sqrt{-8 \cdot \left(\left(F \cdot \left(A + A\right)\right) \cdot \left(A \cdot C\right)\right)}}{\mathsf{fma}\left(A, C \cdot -4, {B_m}^{2}\right)}\\
\mathbf{if}\;B_m \leq 6.6 \cdot 10^{-163}:\\
\;\;\;\;t_3\\

\mathbf{elif}\;B_m \leq 6.2 \cdot 10^{-140}:\\
\;\;\;\;\frac{-\sqrt{F \cdot \left(2 \cdot \left(\left(A + C\right) - \mathsf{hypot}\left(B_m, A - C\right)\right)\right)}}{\mathsf{hypot}\left(B_m, \sqrt{t_1}\right)}\\

\mathbf{elif}\;B_m \leq 2.5 \cdot 10^{-50}:\\
\;\;\;\;t_3\\

\mathbf{elif}\;B_m \leq 9.2 \cdot 10^{+35}:\\
\;\;\;\;\frac{-\sqrt{\left(F \cdot t_2\right) \cdot \left(2 \cdot t_0\right)}}{t_2}\\

\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B_m} \cdot \left(-\sqrt{F \cdot t_0}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if B < 6.60000000000000002e-163 or 6.1999999999999998e-140 < B < 2.49999999999999984e-50

    1. Initial program 19.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. Simplified22.8%

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

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

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

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

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

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

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

    if 6.60000000000000002e-163 < B < 6.1999999999999998e-140

    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. Simplified1.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. Step-by-step derivation
      1. neg-mul-11.6%

        \[\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(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)} \]
      2. add-sqr-sqrt1.6%

        \[\leadsto \frac{-1 \cdot \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)}}{\color{blue}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \cdot \sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}}} \]
      3. times-frac1.6%

        \[\leadsto \color{blue}{\frac{-1}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}} \cdot \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)}}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}}} \]
      4. fma-udef1.6%

        \[\leadsto \frac{-1}{\sqrt{\color{blue}{B \cdot B + A \cdot \left(C \cdot -4\right)}}} \cdot \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)}}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}} \]
      5. add-sqr-sqrt1.6%

        \[\leadsto \frac{-1}{\sqrt{B \cdot B + \color{blue}{\sqrt{A \cdot \left(C \cdot -4\right)} \cdot \sqrt{A \cdot \left(C \cdot -4\right)}}}} \cdot \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)}}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}} \]
      6. hypot-def1.6%

        \[\leadsto \frac{-1}{\color{blue}{\mathsf{hypot}\left(B, \sqrt{A \cdot \left(C \cdot -4\right)}\right)}} \cdot \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)}}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}} \]
    5. Applied egg-rr25.9%

      \[\leadsto \color{blue}{\frac{-1}{\mathsf{hypot}\left(B, \sqrt{A \cdot \left(C \cdot -4\right)}\right)} \cdot \frac{\mathsf{hypot}\left(B, \sqrt{A \cdot \left(C \cdot -4\right)}\right) \cdot \sqrt{F \cdot \left(2 \cdot \left(\left(A + C\right) - \mathsf{hypot}\left(B, A - C\right)\right)\right)}}{\mathsf{hypot}\left(B, \sqrt{A \cdot \left(C \cdot -4\right)}\right)}} \]
    6. Step-by-step derivation
      1. associate-*l/25.9%

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

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

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

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

      \[\leadsto \color{blue}{\frac{-\frac{\mathsf{hypot}\left(B, \sqrt{A \cdot \left(C \cdot -4\right)}\right)}{\frac{\mathsf{hypot}\left(B, \sqrt{A \cdot \left(C \cdot -4\right)}\right)}{\sqrt{F \cdot \left(2 \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)}}}}{\mathsf{hypot}\left(B, \sqrt{A \cdot \left(C \cdot -4\right)}\right)}} \]
    8. Step-by-step derivation
      1. associate-/r/25.9%

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

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

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

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

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

        \[\leadsto \frac{-\color{blue}{1} \cdot \sqrt{F \cdot \left(2 \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)}}{\mathsf{hypot}\left(B, \sqrt{A \cdot \left(C \cdot -4\right)}\right)} \]
      7. *-un-lft-identity26.8%

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

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

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

    if 2.49999999999999984e-50 < B < 9.1999999999999993e35

    1. Initial program 45.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. Simplified50.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 C around 0 56.2%

      \[\leadsto \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 + \color{blue}{-1 \cdot \sqrt{{A}^{2} + {B}^{2}}}\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
    5. Step-by-step derivation
      1. mul-1-neg56.2%

        \[\leadsto \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 + \color{blue}{\left(-\sqrt{{A}^{2} + {B}^{2}}\right)}\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
      2. +-commutative56.2%

        \[\leadsto \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(-\sqrt{\color{blue}{{B}^{2} + {A}^{2}}}\right)\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
      3. unpow256.2%

        \[\leadsto \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(-\sqrt{\color{blue}{B \cdot B} + {A}^{2}}\right)\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
      4. unpow256.2%

        \[\leadsto \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(-\sqrt{B \cdot B + \color{blue}{A \cdot A}}\right)\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
      5. hypot-def56.4%

        \[\leadsto \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(-\color{blue}{\mathsf{hypot}\left(B, A\right)}\right)\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
    6. Simplified56.4%

      \[\leadsto \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 + \color{blue}{\left(-\mathsf{hypot}\left(B, A\right)\right)}\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]

    if 9.1999999999999993e35 < B

    1. Initial program 9.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. Simplified6.8%

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

      \[\leadsto \color{blue}{-1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}\right)} \]
    5. Step-by-step derivation
      1. associate-*r*11.9%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(-\frac{\sqrt{2}}{B}\right) \cdot \sqrt{F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)}} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification29.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;B \leq 6.6 \cdot 10^{-163}:\\ \;\;\;\;\frac{-\sqrt{-8 \cdot \left(\left(F \cdot \left(A + A\right)\right) \cdot \left(A \cdot C\right)\right)}}{\mathsf{fma}\left(A, C \cdot -4, {B}^{2}\right)}\\ \mathbf{elif}\;B \leq 6.2 \cdot 10^{-140}:\\ \;\;\;\;\frac{-\sqrt{F \cdot \left(2 \cdot \left(\left(A + C\right) - \mathsf{hypot}\left(B, A - C\right)\right)\right)}}{\mathsf{hypot}\left(B, \sqrt{A \cdot \left(C \cdot -4\right)}\right)}\\ \mathbf{elif}\;B \leq 2.5 \cdot 10^{-50}:\\ \;\;\;\;\frac{-\sqrt{-8 \cdot \left(\left(F \cdot \left(A + A\right)\right) \cdot \left(A \cdot C\right)\right)}}{\mathsf{fma}\left(A, C \cdot -4, {B}^{2}\right)}\\ \mathbf{elif}\;B \leq 9.2 \cdot 10^{+35}:\\ \;\;\;\;\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 - \mathsf{hypot}\left(B, A\right)\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 47.0% 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} \mathbf{if}\;{B_m}^{2} \leq 2 \cdot 10^{-80}:\\ \;\;\;\;\frac{-\sqrt{-8 \cdot \left(\left(F \cdot \left(A + A\right)\right) \cdot \left(A \cdot C\right)\right)}}{\mathsf{fma}\left(A, C \cdot -4, {B_m}^{2}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{2}}{B_m} \cdot \left(-\sqrt{F \cdot \left(A - \mathsf{hypot}\left(B_m, A\right)\right)}\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) 2e-80)
   (/
    (- (sqrt (* -8.0 (* (* F (+ A A)) (* A C)))))
    (fma A (* C -4.0) (pow B_m 2.0)))
   (* (/ (sqrt 2.0) B_m) (- (sqrt (* F (- A (hypot B_m 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) {
	double tmp;
	if (pow(B_m, 2.0) <= 2e-80) {
		tmp = -sqrt((-8.0 * ((F * (A + A)) * (A * C)))) / fma(A, (C * -4.0), pow(B_m, 2.0));
	} else {
		tmp = (sqrt(2.0) / B_m) * -sqrt((F * (A - hypot(B_m, A))));
	}
	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) <= 2e-80)
		tmp = Float64(Float64(-sqrt(Float64(-8.0 * Float64(Float64(F * Float64(A + A)) * Float64(A * C))))) / fma(A, Float64(C * -4.0), (B_m ^ 2.0)));
	else
		tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(-sqrt(Float64(F * Float64(A - hypot(B_m, A))))));
	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[N[Power[B$95$m, 2.0], $MachinePrecision], 2e-80], N[((-N[Sqrt[N[(-8.0 * N[(N[(F * N[(A + A), $MachinePrecision]), $MachinePrecision] * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(A * N[(C * -4.0), $MachinePrecision] + N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * (-N[Sqrt[N[(F * N[(A - N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $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 2 \cdot 10^{-80}:\\
\;\;\;\;\frac{-\sqrt{-8 \cdot \left(\left(F \cdot \left(A + A\right)\right) \cdot \left(A \cdot C\right)\right)}}{\mathsf{fma}\left(A, C \cdot -4, {B_m}^{2}\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B_m} \cdot \left(-\sqrt{F \cdot \left(A - \mathsf{hypot}\left(B_m, A\right)\right)}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (pow.f64 B 2) < 1.99999999999999992e-80

    1. Initial program 19.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. Simplified26.4%

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

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

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

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

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

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

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

    if 1.99999999999999992e-80 < (pow.f64 B 2)

    1. Initial program 18.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. Simplified16.5%

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

      \[\leadsto \color{blue}{-1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}\right)} \]
    5. Step-by-step derivation
      1. associate-*r*10.5%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(-\frac{\sqrt{2}}{B}\right) \cdot \sqrt{F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification26.5%

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

Alternative 8: 43.0% 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} t_0 := \frac{\sqrt{2}}{B_m}\\ \mathbf{if}\;F \leq -1.7 \cdot 10^{+253}:\\ \;\;\;\;\left(-t_0\right) \cdot \sqrt{F \cdot \frac{{B_m}^{2} \cdot -0.5}{C}}\\ \mathbf{elif}\;F \leq -1.56 \cdot 10^{-307}:\\ \;\;\;\;t_0 \cdot \left(-\sqrt{F \cdot \left(A - \mathsf{hypot}\left(B_m, A\right)\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{-F}{C}}\\ \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 (/ (sqrt 2.0) B_m)))
   (if (<= F -1.7e+253)
     (* (- t_0) (sqrt (* F (/ (* (pow B_m 2.0) -0.5) C))))
     (if (<= F -1.56e-307)
       (* t_0 (- (sqrt (* F (- A (hypot B_m A))))))
       (sqrt (/ (- F) C))))))
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 = sqrt(2.0) / B_m;
	double tmp;
	if (F <= -1.7e+253) {
		tmp = -t_0 * sqrt((F * ((pow(B_m, 2.0) * -0.5) / C)));
	} else if (F <= -1.56e-307) {
		tmp = t_0 * -sqrt((F * (A - hypot(B_m, A))));
	} else {
		tmp = sqrt((-F / C));
	}
	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 t_0 = Math.sqrt(2.0) / B_m;
	double tmp;
	if (F <= -1.7e+253) {
		tmp = -t_0 * Math.sqrt((F * ((Math.pow(B_m, 2.0) * -0.5) / C)));
	} else if (F <= -1.56e-307) {
		tmp = t_0 * -Math.sqrt((F * (A - Math.hypot(B_m, A))));
	} else {
		tmp = Math.sqrt((-F / C));
	}
	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):
	t_0 = math.sqrt(2.0) / B_m
	tmp = 0
	if F <= -1.7e+253:
		tmp = -t_0 * math.sqrt((F * ((math.pow(B_m, 2.0) * -0.5) / C)))
	elif F <= -1.56e-307:
		tmp = t_0 * -math.sqrt((F * (A - math.hypot(B_m, A))))
	else:
		tmp = math.sqrt((-F / C))
	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(sqrt(2.0) / B_m)
	tmp = 0.0
	if (F <= -1.7e+253)
		tmp = Float64(Float64(-t_0) * sqrt(Float64(F * Float64(Float64((B_m ^ 2.0) * -0.5) / C))));
	elseif (F <= -1.56e-307)
		tmp = Float64(t_0 * Float64(-sqrt(Float64(F * Float64(A - hypot(B_m, A))))));
	else
		tmp = sqrt(Float64(Float64(-F) / C));
	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)
	t_0 = sqrt(2.0) / B_m;
	tmp = 0.0;
	if (F <= -1.7e+253)
		tmp = -t_0 * sqrt((F * (((B_m ^ 2.0) * -0.5) / C)));
	elseif (F <= -1.56e-307)
		tmp = t_0 * -sqrt((F * (A - hypot(B_m, A))));
	else
		tmp = sqrt((-F / C));
	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_] := Block[{t$95$0 = N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision]}, If[LessEqual[F, -1.7e+253], N[((-t$95$0) * N[Sqrt[N[(F * N[(N[(N[Power[B$95$m, 2.0], $MachinePrecision] * -0.5), $MachinePrecision] / C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, -1.56e-307], N[(t$95$0 * (-N[Sqrt[N[(F * N[(A - N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[Sqrt[N[((-F) / C), $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{\sqrt{2}}{B_m}\\
\mathbf{if}\;F \leq -1.7 \cdot 10^{+253}:\\
\;\;\;\;\left(-t_0\right) \cdot \sqrt{F \cdot \frac{{B_m}^{2} \cdot -0.5}{C}}\\

\mathbf{elif}\;F \leq -1.56 \cdot 10^{-307}:\\
\;\;\;\;t_0 \cdot \left(-\sqrt{F \cdot \left(A - \mathsf{hypot}\left(B_m, A\right)\right)}\right)\\

\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{-F}{C}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if F < -1.70000000000000009e253

    1. Initial program 13.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. Simplified14.9%

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

      \[\leadsto \color{blue}{-1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(C - \sqrt{{B}^{2} + {C}^{2}}\right)}\right)} \]
    5. Step-by-step derivation
      1. associate-*r*2.3%

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

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

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

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

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

      \[\leadsto \color{blue}{\left(-\frac{\sqrt{2}}{B}\right) \cdot \sqrt{F \cdot \left(C - \mathsf{hypot}\left(B, C\right)\right)}} \]
    7. Taylor expanded in C around inf 12.2%

      \[\leadsto \left(-\frac{\sqrt{2}}{B}\right) \cdot \sqrt{F \cdot \color{blue}{\left(-0.5 \cdot \frac{{B}^{2}}{C}\right)}} \]
    8. Step-by-step derivation
      1. associate-*r/12.2%

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

      \[\leadsto \left(-\frac{\sqrt{2}}{B}\right) \cdot \sqrt{F \cdot \color{blue}{\frac{-0.5 \cdot {B}^{2}}{C}}} \]

    if -1.70000000000000009e253 < F < -1.56e-307

    1. Initial program 19.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. Simplified18.8%

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

      \[\leadsto \color{blue}{-1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}\right)} \]
    5. Step-by-step derivation
      1. associate-*r*9.2%

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

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

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

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

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

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

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

    if -1.56e-307 < F

    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. Simplified40.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. Step-by-step derivation
      1. add-sqr-sqrt40.2%

        \[\leadsto \color{blue}{\sqrt{\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)}} \cdot \sqrt{\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)}}} \]
      2. sqrt-unprod31.8%

        \[\leadsto \color{blue}{\sqrt{\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)} \cdot \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. frac-times28.5%

        \[\leadsto \sqrt{\color{blue}{\frac{\left(-\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)}\right) \cdot \left(-\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)}\right)}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}}} \]
    5. Applied egg-rr31.4%

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

      \[\leadsto \sqrt{\color{blue}{-1 \cdot \frac{F}{C}}} \]
    7. Step-by-step derivation
      1. mul-1-neg48.6%

        \[\leadsto \sqrt{\color{blue}{-\frac{F}{C}}} \]
    8. Simplified48.6%

      \[\leadsto \sqrt{\color{blue}{-\frac{F}{C}}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification21.5%

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

Alternative 9: 42.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}\;F \leq -1.56 \cdot 10^{-307}:\\ \;\;\;\;\frac{\sqrt{2}}{B_m} \cdot \left(-\sqrt{F \cdot \left(A - \mathsf{hypot}\left(B_m, A\right)\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{-F}{C}}\\ \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 (<= F -1.56e-307)
   (* (/ (sqrt 2.0) B_m) (- (sqrt (* F (- A (hypot B_m A))))))
   (sqrt (/ (- F) C))))
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 (F <= -1.56e-307) {
		tmp = (sqrt(2.0) / B_m) * -sqrt((F * (A - hypot(B_m, A))));
	} else {
		tmp = sqrt((-F / C));
	}
	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 (F <= -1.56e-307) {
		tmp = (Math.sqrt(2.0) / B_m) * -Math.sqrt((F * (A - Math.hypot(B_m, A))));
	} else {
		tmp = Math.sqrt((-F / C));
	}
	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 F <= -1.56e-307:
		tmp = (math.sqrt(2.0) / B_m) * -math.sqrt((F * (A - math.hypot(B_m, A))))
	else:
		tmp = math.sqrt((-F / C))
	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 (F <= -1.56e-307)
		tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(-sqrt(Float64(F * Float64(A - hypot(B_m, A))))));
	else
		tmp = sqrt(Float64(Float64(-F) / C));
	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 (F <= -1.56e-307)
		tmp = (sqrt(2.0) / B_m) * -sqrt((F * (A - hypot(B_m, A))));
	else
		tmp = sqrt((-F / C));
	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[F, -1.56e-307], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * (-N[Sqrt[N[(F * N[(A - N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[Sqrt[N[((-F) / C), $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}\;F \leq -1.56 \cdot 10^{-307}:\\
\;\;\;\;\frac{\sqrt{2}}{B_m} \cdot \left(-\sqrt{F \cdot \left(A - \mathsf{hypot}\left(B_m, A\right)\right)}\right)\\

\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{-F}{C}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if F < -1.56e-307

    1. Initial program 18.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. Simplified18.5%

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

      \[\leadsto \color{blue}{-1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}\right)} \]
    5. Step-by-step derivation
      1. associate-*r*8.7%

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

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

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

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

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

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

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

    if -1.56e-307 < F

    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. Simplified40.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. Step-by-step derivation
      1. add-sqr-sqrt40.2%

        \[\leadsto \color{blue}{\sqrt{\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)}} \cdot \sqrt{\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)}}} \]
      2. sqrt-unprod31.8%

        \[\leadsto \color{blue}{\sqrt{\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)} \cdot \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. frac-times28.5%

        \[\leadsto \sqrt{\color{blue}{\frac{\left(-\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)}\right) \cdot \left(-\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)}\right)}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}}} \]
    5. Applied egg-rr31.4%

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

      \[\leadsto \sqrt{\color{blue}{-1 \cdot \frac{F}{C}}} \]
    7. Step-by-step derivation
      1. mul-1-neg48.6%

        \[\leadsto \sqrt{\color{blue}{-\frac{F}{C}}} \]
    8. Simplified48.6%

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

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

Alternative 10: 35.3% accurate, 2.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 := \sqrt{\frac{-F}{C}}\\ \mathbf{if}\;A \leq -1.32 \cdot 10^{+154}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;A \leq -7 \cdot 10^{+24}:\\ \;\;\;\;\frac{-\sqrt{-16 \cdot \left({A}^{2} \cdot \left(C \cdot F\right)\right)}}{A \cdot \left(C \cdot -4\right)}\\ \mathbf{elif}\;A \leq 6.8 \cdot 10^{-155}:\\ \;\;\;\;\left(-\frac{\sqrt{2}}{B_m}\right) \cdot \sqrt{B_m \cdot \left(-F\right)}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \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 (sqrt (/ (- F) C))))
   (if (<= A -1.32e+154)
     t_0
     (if (<= A -7e+24)
       (/ (- (sqrt (* -16.0 (* (pow A 2.0) (* C F))))) (* A (* C -4.0)))
       (if (<= A 6.8e-155)
         (* (- (/ (sqrt 2.0) B_m)) (sqrt (* B_m (- F))))
         t_0)))))
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 = sqrt((-F / C));
	double tmp;
	if (A <= -1.32e+154) {
		tmp = t_0;
	} else if (A <= -7e+24) {
		tmp = -sqrt((-16.0 * (pow(A, 2.0) * (C * F)))) / (A * (C * -4.0));
	} else if (A <= 6.8e-155) {
		tmp = -(sqrt(2.0) / B_m) * sqrt((B_m * -F));
	} else {
		tmp = t_0;
	}
	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) :: t_0
    real(8) :: tmp
    t_0 = sqrt((-f / c))
    if (a <= (-1.32d+154)) then
        tmp = t_0
    else if (a <= (-7d+24)) then
        tmp = -sqrt(((-16.0d0) * ((a ** 2.0d0) * (c * f)))) / (a * (c * (-4.0d0)))
    else if (a <= 6.8d-155) then
        tmp = -(sqrt(2.0d0) / b_m) * sqrt((b_m * -f))
    else
        tmp = t_0
    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 t_0 = Math.sqrt((-F / C));
	double tmp;
	if (A <= -1.32e+154) {
		tmp = t_0;
	} else if (A <= -7e+24) {
		tmp = -Math.sqrt((-16.0 * (Math.pow(A, 2.0) * (C * F)))) / (A * (C * -4.0));
	} else if (A <= 6.8e-155) {
		tmp = -(Math.sqrt(2.0) / B_m) * Math.sqrt((B_m * -F));
	} else {
		tmp = t_0;
	}
	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):
	t_0 = math.sqrt((-F / C))
	tmp = 0
	if A <= -1.32e+154:
		tmp = t_0
	elif A <= -7e+24:
		tmp = -math.sqrt((-16.0 * (math.pow(A, 2.0) * (C * F)))) / (A * (C * -4.0))
	elif A <= 6.8e-155:
		tmp = -(math.sqrt(2.0) / B_m) * math.sqrt((B_m * -F))
	else:
		tmp = t_0
	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 = sqrt(Float64(Float64(-F) / C))
	tmp = 0.0
	if (A <= -1.32e+154)
		tmp = t_0;
	elseif (A <= -7e+24)
		tmp = Float64(Float64(-sqrt(Float64(-16.0 * Float64((A ^ 2.0) * Float64(C * F))))) / Float64(A * Float64(C * -4.0)));
	elseif (A <= 6.8e-155)
		tmp = Float64(Float64(-Float64(sqrt(2.0) / B_m)) * sqrt(Float64(B_m * Float64(-F))));
	else
		tmp = t_0;
	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)
	t_0 = sqrt((-F / C));
	tmp = 0.0;
	if (A <= -1.32e+154)
		tmp = t_0;
	elseif (A <= -7e+24)
		tmp = -sqrt((-16.0 * ((A ^ 2.0) * (C * F)))) / (A * (C * -4.0));
	elseif (A <= 6.8e-155)
		tmp = -(sqrt(2.0) / B_m) * sqrt((B_m * -F));
	else
		tmp = t_0;
	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_] := Block[{t$95$0 = N[Sqrt[N[((-F) / C), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[A, -1.32e+154], t$95$0, If[LessEqual[A, -7e+24], N[((-N[Sqrt[N[(-16.0 * N[(N[Power[A, 2.0], $MachinePrecision] * N[(C * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[A, 6.8e-155], N[((-N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision]) * N[Sqrt[N[(B$95$m * (-F)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\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 := \sqrt{\frac{-F}{C}}\\
\mathbf{if}\;A \leq -1.32 \cdot 10^{+154}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;A \leq -7 \cdot 10^{+24}:\\
\;\;\;\;\frac{-\sqrt{-16 \cdot \left({A}^{2} \cdot \left(C \cdot F\right)\right)}}{A \cdot \left(C \cdot -4\right)}\\

\mathbf{elif}\;A \leq 6.8 \cdot 10^{-155}:\\
\;\;\;\;\left(-\frac{\sqrt{2}}{B_m}\right) \cdot \sqrt{B_m \cdot \left(-F\right)}\\

\mathbf{else}:\\
\;\;\;\;t_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if A < -1.31999999999999998e154 or 6.8e-155 < A

    1. Initial program 7.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. Simplified15.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. Step-by-step derivation
      1. add-sqr-sqrt5.7%

        \[\leadsto \color{blue}{\sqrt{\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)}} \cdot \sqrt{\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)}}} \]
      2. sqrt-unprod4.0%

        \[\leadsto \color{blue}{\sqrt{\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)} \cdot \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. frac-times2.8%

        \[\leadsto \sqrt{\color{blue}{\frac{\left(-\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)}\right) \cdot \left(-\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)}\right)}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}}} \]
    5. Applied egg-rr3.4%

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

      \[\leadsto \sqrt{\color{blue}{-1 \cdot \frac{F}{C}}} \]
    7. Step-by-step derivation
      1. mul-1-neg17.5%

        \[\leadsto \sqrt{\color{blue}{-\frac{F}{C}}} \]
    8. Simplified17.5%

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

    if -1.31999999999999998e154 < A < -7.0000000000000004e24

    1. Initial program 43.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. Simplified47.4%

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

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

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

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

      \[\leadsto \frac{-\sqrt{-16 \cdot \left({A}^{2} \cdot \left(F \cdot C\right)\right)}}{\color{blue}{-4 \cdot \left(A \cdot C\right)}} \]
    8. Step-by-step derivation
      1. *-commutative31.8%

        \[\leadsto \frac{-\sqrt{-16 \cdot \left({A}^{2} \cdot \left(F \cdot C\right)\right)}}{\color{blue}{\left(A \cdot C\right) \cdot -4}} \]
      2. associate-*r*31.8%

        \[\leadsto \frac{-\sqrt{-16 \cdot \left({A}^{2} \cdot \left(F \cdot C\right)\right)}}{\color{blue}{A \cdot \left(C \cdot -4\right)}} \]
    9. Simplified31.8%

      \[\leadsto \frac{-\sqrt{-16 \cdot \left({A}^{2} \cdot \left(F \cdot C\right)\right)}}{\color{blue}{A \cdot \left(C \cdot -4\right)}} \]

    if -7.0000000000000004e24 < A < 6.8e-155

    1. Initial program 27.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. Simplified23.8%

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

      \[\leadsto \color{blue}{-1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(C - \sqrt{{B}^{2} + {C}^{2}}\right)}\right)} \]
    5. Step-by-step derivation
      1. associate-*r*11.2%

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

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

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

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

        \[\leadsto \left(-\frac{\sqrt{2}}{B}\right) \cdot \sqrt{F \cdot \left(C - \color{blue}{\mathsf{hypot}\left(B, C\right)}\right)} \]
    6. Simplified21.0%

      \[\leadsto \color{blue}{\left(-\frac{\sqrt{2}}{B}\right) \cdot \sqrt{F \cdot \left(C - \mathsf{hypot}\left(B, C\right)\right)}} \]
    7. Taylor expanded in C around 0 18.5%

      \[\leadsto \left(-\frac{\sqrt{2}}{B}\right) \cdot \sqrt{\color{blue}{-1 \cdot \left(B \cdot F\right)}} \]
    8. Step-by-step derivation
      1. associate-*r*18.5%

        \[\leadsto \left(-\frac{\sqrt{2}}{B}\right) \cdot \sqrt{\color{blue}{\left(-1 \cdot B\right) \cdot F}} \]
      2. mul-1-neg18.5%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;A \leq -1.32 \cdot 10^{+154}:\\ \;\;\;\;\sqrt{\frac{-F}{C}}\\ \mathbf{elif}\;A \leq -7 \cdot 10^{+24}:\\ \;\;\;\;\frac{-\sqrt{-16 \cdot \left({A}^{2} \cdot \left(C \cdot F\right)\right)}}{A \cdot \left(C \cdot -4\right)}\\ \mathbf{elif}\;A \leq 6.8 \cdot 10^{-155}:\\ \;\;\;\;\left(-\frac{\sqrt{2}}{B}\right) \cdot \sqrt{B \cdot \left(-F\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{-F}{C}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 33.5% accurate, 3.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}\;A \leq -1.26 \cdot 10^{+153} \lor \neg \left(A \leq 6 \cdot 10^{-154}\right):\\ \;\;\;\;\sqrt{\frac{-F}{C}}\\ \mathbf{else}:\\ \;\;\;\;\left(-\frac{\sqrt{2}}{B_m}\right) \cdot \sqrt{B_m \cdot \left(-F\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 (or (<= A -1.26e+153) (not (<= A 6e-154)))
   (sqrt (/ (- F) C))
   (* (- (/ (sqrt 2.0) B_m)) (sqrt (* B_m (- F))))))
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 ((A <= -1.26e+153) || !(A <= 6e-154)) {
		tmp = sqrt((-F / C));
	} else {
		tmp = -(sqrt(2.0) / B_m) * sqrt((B_m * -F));
	}
	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 ((a <= (-1.26d+153)) .or. (.not. (a <= 6d-154))) then
        tmp = sqrt((-f / c))
    else
        tmp = -(sqrt(2.0d0) / b_m) * sqrt((b_m * -f))
    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 ((A <= -1.26e+153) || !(A <= 6e-154)) {
		tmp = Math.sqrt((-F / C));
	} else {
		tmp = -(Math.sqrt(2.0) / B_m) * Math.sqrt((B_m * -F));
	}
	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 (A <= -1.26e+153) or not (A <= 6e-154):
		tmp = math.sqrt((-F / C))
	else:
		tmp = -(math.sqrt(2.0) / B_m) * math.sqrt((B_m * -F))
	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 ((A <= -1.26e+153) || !(A <= 6e-154))
		tmp = sqrt(Float64(Float64(-F) / C));
	else
		tmp = Float64(Float64(-Float64(sqrt(2.0) / B_m)) * sqrt(Float64(B_m * Float64(-F))));
	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 ((A <= -1.26e+153) || ~((A <= 6e-154)))
		tmp = sqrt((-F / C));
	else
		tmp = -(sqrt(2.0) / B_m) * sqrt((B_m * -F));
	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[Or[LessEqual[A, -1.26e+153], N[Not[LessEqual[A, 6e-154]], $MachinePrecision]], N[Sqrt[N[((-F) / C), $MachinePrecision]], $MachinePrecision], N[((-N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision]) * N[Sqrt[N[(B$95$m * (-F)), $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}\;A \leq -1.26 \cdot 10^{+153} \lor \neg \left(A \leq 6 \cdot 10^{-154}\right):\\
\;\;\;\;\sqrt{\frac{-F}{C}}\\

\mathbf{else}:\\
\;\;\;\;\left(-\frac{\sqrt{2}}{B_m}\right) \cdot \sqrt{B_m \cdot \left(-F\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if A < -1.25999999999999991e153 or 6.0000000000000005e-154 < A

    1. Initial program 8.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. Simplified16.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. Step-by-step derivation
      1. add-sqr-sqrt6.3%

        \[\leadsto \color{blue}{\sqrt{\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)}} \cdot \sqrt{\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)}}} \]
      2. sqrt-unprod4.7%

        \[\leadsto \color{blue}{\sqrt{\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)} \cdot \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. frac-times3.5%

        \[\leadsto \sqrt{\color{blue}{\frac{\left(-\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)}\right) \cdot \left(-\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)}\right)}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}}} \]
    5. Applied egg-rr4.1%

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

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

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

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

    if -1.25999999999999991e153 < A < 6.0000000000000005e-154

    1. Initial program 31.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. Simplified28.9%

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

      \[\leadsto \color{blue}{-1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(C - \sqrt{{B}^{2} + {C}^{2}}\right)}\right)} \]
    5. Step-by-step derivation
      1. associate-*r*9.2%

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

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

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

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

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

      \[\leadsto \color{blue}{\left(-\frac{\sqrt{2}}{B}\right) \cdot \sqrt{F \cdot \left(C - \mathsf{hypot}\left(B, C\right)\right)}} \]
    7. Taylor expanded in C around 0 17.4%

      \[\leadsto \left(-\frac{\sqrt{2}}{B}\right) \cdot \sqrt{\color{blue}{-1 \cdot \left(B \cdot F\right)}} \]
    8. Step-by-step derivation
      1. associate-*r*17.4%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;A \leq -1.26 \cdot 10^{+153} \lor \neg \left(A \leq 6 \cdot 10^{-154}\right):\\ \;\;\;\;\sqrt{\frac{-F}{C}}\\ \mathbf{else}:\\ \;\;\;\;\left(-\frac{\sqrt{2}}{B}\right) \cdot \sqrt{B \cdot \left(-F\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 2.1% accurate, 6.1× 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 sqrt(Float64(-Float64(F / 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 19.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. Simplified26.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. add-sqr-sqrt6.6%

      \[\leadsto \color{blue}{\sqrt{\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)}} \cdot \sqrt{\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)}}} \]
    2. sqrt-unprod5.8%

      \[\leadsto \color{blue}{\sqrt{\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)} \cdot \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. frac-times5.1%

      \[\leadsto \sqrt{\color{blue}{\frac{\left(-\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)}\right) \cdot \left(-\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)}\right)}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}}} \]
  5. Applied egg-rr5.4%

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

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

      \[\leadsto \sqrt{\color{blue}{-\frac{F}{A}}} \]
  8. Simplified11.8%

    \[\leadsto \sqrt{\color{blue}{-\frac{F}{A}}} \]
  9. Final simplification11.8%

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

Alternative 13: 20.1% accurate, 6.1× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ [A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\ \\ \sqrt{\frac{-F}{C}} \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) C)))
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 / C));
}
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 / c))
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 / C));
}
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 / C))
B_m = abs(B)
A, B_m, C, F = sort([A, B_m, C, F])
function code(A, B_m, C, F)
	return sqrt(Float64(Float64(-F) / C))
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 / C));
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) / C), $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}{C}}
\end{array}
Derivation
  1. Initial program 19.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. Simplified26.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. add-sqr-sqrt6.6%

      \[\leadsto \color{blue}{\sqrt{\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)}} \cdot \sqrt{\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)}}} \]
    2. sqrt-unprod5.8%

      \[\leadsto \color{blue}{\sqrt{\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)} \cdot \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. frac-times5.1%

      \[\leadsto \sqrt{\color{blue}{\frac{\left(-\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)}\right) \cdot \left(-\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)}\right)}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}}} \]
  5. Applied egg-rr5.4%

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

    \[\leadsto \sqrt{\color{blue}{-1 \cdot \frac{F}{C}}} \]
  7. Step-by-step derivation
    1. mul-1-neg13.1%

      \[\leadsto \sqrt{\color{blue}{-\frac{F}{C}}} \]
  8. Simplified13.1%

    \[\leadsto \sqrt{\color{blue}{-\frac{F}{C}}} \]
  9. Final simplification13.1%

    \[\leadsto \sqrt{\frac{-F}{C}} \]
  10. Add Preprocessing

Reproduce

?
herbie shell --seed 2024011 
(FPCore (A B C F)
  :name "ABCF->ab-angle b"
  :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))))