ABCF->ab-angle b

Percentage Accurate: 19.2% → 48.8%
Time: 32.5s
Alternatives: 11
Speedup: 5.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 11 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.2% 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: 48.8% accurate, 1.5× speedup?

\[\begin{array}{l} B = |B|\\ [A, C] = \mathsf{sort}([A, C])\\ \\ \begin{array}{l} t_0 := \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)\\ \mathbf{if}\;{B}^{2} \leq 2 \cdot 10^{+107}:\\ \;\;\;\;\frac{-\sqrt{2 \cdot \left(t_0 \cdot \left(F \cdot \left(A + \left(A + -0.5 \cdot \left(B \cdot \frac{B}{C - A}\right)\right)\right)\right)\right)}}{t_0}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{F \cdot \left(A - \mathsf{hypot}\left(A, B\right)\right)} \cdot \left(-\frac{\sqrt{2}}{B}\right)\\ \end{array} \end{array} \]
NOTE: B should be positive before calling this function
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
 :precision binary64
 (let* ((t_0 (fma B B (* A (* C -4.0)))))
   (if (<= (pow B 2.0) 2e+107)
     (/
      (- (sqrt (* 2.0 (* t_0 (* F (+ A (+ A (* -0.5 (* B (/ B (- C A)))))))))))
      t_0)
     (* (sqrt (* F (- A (hypot A B)))) (- (/ (sqrt 2.0) B))))))
B = abs(B);
assert(A < C);
double code(double A, double B, double C, double F) {
	double t_0 = fma(B, B, (A * (C * -4.0)));
	double tmp;
	if (pow(B, 2.0) <= 2e+107) {
		tmp = -sqrt((2.0 * (t_0 * (F * (A + (A + (-0.5 * (B * (B / (C - A)))))))))) / t_0;
	} else {
		tmp = sqrt((F * (A - hypot(A, B)))) * -(sqrt(2.0) / B);
	}
	return tmp;
}
B = abs(B)
A, C = sort([A, C])
function code(A, B, C, F)
	t_0 = fma(B, B, Float64(A * Float64(C * -4.0)))
	tmp = 0.0
	if ((B ^ 2.0) <= 2e+107)
		tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(t_0 * Float64(F * Float64(A + Float64(A + Float64(-0.5 * Float64(B * Float64(B / Float64(C - A))))))))))) / t_0);
	else
		tmp = Float64(sqrt(Float64(F * Float64(A - hypot(A, B)))) * Float64(-Float64(sqrt(2.0) / B)));
	end
	return tmp
end
NOTE: B should be positive before calling this function
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(B * B + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 2e+107], N[((-N[Sqrt[N[(2.0 * N[(t$95$0 * N[(F * N[(A + N[(A + N[(-0.5 * N[(B * N[(B / N[(C - A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[(N[Sqrt[N[(F * N[(A - N[Sqrt[A ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision])), $MachinePrecision]]]
\begin{array}{l}
B = |B|\\
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)\\
\mathbf{if}\;{B}^{2} \leq 2 \cdot 10^{+107}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(t_0 \cdot \left(F \cdot \left(A + \left(A + -0.5 \cdot \left(B \cdot \frac{B}{C - A}\right)\right)\right)\right)\right)}}{t_0}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (pow.f64 B 2) < 1.9999999999999999e107

    1. Initial program 20.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. Simplified34.3%

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

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

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

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

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

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

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

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

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

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

    if 1.9999999999999999e107 < (pow.f64 B 2)

    1. Initial program 12.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. Simplified12.0%

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

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

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

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

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

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

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

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

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

Alternative 2: 46.8% accurate, 1.9× speedup?

\[\begin{array}{l} B = |B|\\ [A, C] = \mathsf{sort}([A, C])\\ \\ \begin{array}{l} t_0 := B \cdot B - \left(A \cdot C\right) \cdot 4\\ t_1 := \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)\\ t_2 := B \cdot B + -4 \cdot \left(A \cdot C\right)\\ \mathbf{if}\;B \leq 1.65 \cdot 10^{-25}:\\ \;\;\;\;\frac{-\sqrt{2 \cdot \left(t_2 \cdot \left(F \cdot \left(A + A\right)\right)\right)}}{t_2}\\ \mathbf{elif}\;B \leq 1.5 \cdot 10^{+16}:\\ \;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(F \cdot t_0\right) \cdot \left(A + \mathsf{fma}\left(-0.5, \frac{A \cdot A + \left(B \cdot B - A \cdot A\right)}{C}, A\right)\right)\right)}}{t_0}\\ \mathbf{elif}\;B \leq 1.02 \cdot 10^{+55}:\\ \;\;\;\;\frac{-\sqrt{2 \cdot \left(t_1 \cdot \left(F \cdot \left(A + \left(A + -0.5 \cdot \frac{B \cdot B}{C}\right)\right)\right)\right)}}{t_1}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{F \cdot \left(A - \mathsf{hypot}\left(A, B\right)\right)} \cdot \left(-\frac{\sqrt{2}}{B}\right)\\ \end{array} \end{array} \]
NOTE: B should be positive before calling this function
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
 :precision binary64
 (let* ((t_0 (- (* B B) (* (* A C) 4.0)))
        (t_1 (fma B B (* A (* C -4.0))))
        (t_2 (+ (* B B) (* -4.0 (* A C)))))
   (if (<= B 1.65e-25)
     (/ (- (sqrt (* 2.0 (* t_2 (* F (+ A A)))))) t_2)
     (if (<= B 1.5e+16)
       (/
        (-
         (sqrt
          (*
           2.0
           (*
            (* F t_0)
            (+ A (fma -0.5 (/ (+ (* A A) (- (* B B) (* A A))) C) A))))))
        t_0)
       (if (<= B 1.02e+55)
         (/
          (- (sqrt (* 2.0 (* t_1 (* F (+ A (+ A (* -0.5 (/ (* B B) C)))))))))
          t_1)
         (* (sqrt (* F (- A (hypot A B)))) (- (/ (sqrt 2.0) B))))))))
B = abs(B);
assert(A < C);
double code(double A, double B, double C, double F) {
	double t_0 = (B * B) - ((A * C) * 4.0);
	double t_1 = fma(B, B, (A * (C * -4.0)));
	double t_2 = (B * B) + (-4.0 * (A * C));
	double tmp;
	if (B <= 1.65e-25) {
		tmp = -sqrt((2.0 * (t_2 * (F * (A + A))))) / t_2;
	} else if (B <= 1.5e+16) {
		tmp = -sqrt((2.0 * ((F * t_0) * (A + fma(-0.5, (((A * A) + ((B * B) - (A * A))) / C), A))))) / t_0;
	} else if (B <= 1.02e+55) {
		tmp = -sqrt((2.0 * (t_1 * (F * (A + (A + (-0.5 * ((B * B) / C)))))))) / t_1;
	} else {
		tmp = sqrt((F * (A - hypot(A, B)))) * -(sqrt(2.0) / B);
	}
	return tmp;
}
B = abs(B)
A, C = sort([A, C])
function code(A, B, C, F)
	t_0 = Float64(Float64(B * B) - Float64(Float64(A * C) * 4.0))
	t_1 = fma(B, B, Float64(A * Float64(C * -4.0)))
	t_2 = Float64(Float64(B * B) + Float64(-4.0 * Float64(A * C)))
	tmp = 0.0
	if (B <= 1.65e-25)
		tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(t_2 * Float64(F * Float64(A + A)))))) / t_2);
	elseif (B <= 1.5e+16)
		tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(Float64(F * t_0) * Float64(A + fma(-0.5, Float64(Float64(Float64(A * A) + Float64(Float64(B * B) - Float64(A * A))) / C), A)))))) / t_0);
	elseif (B <= 1.02e+55)
		tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(t_1 * Float64(F * Float64(A + Float64(A + Float64(-0.5 * Float64(Float64(B * B) / C))))))))) / t_1);
	else
		tmp = Float64(sqrt(Float64(F * Float64(A - hypot(A, B)))) * Float64(-Float64(sqrt(2.0) / B)));
	end
	return tmp
end
NOTE: B should be positive before calling this function
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] - N[(N[(A * C), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(B * B + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(B * B), $MachinePrecision] + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, 1.65e-25], N[((-N[Sqrt[N[(2.0 * N[(t$95$2 * N[(F * N[(A + A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$2), $MachinePrecision], If[LessEqual[B, 1.5e+16], N[((-N[Sqrt[N[(2.0 * N[(N[(F * t$95$0), $MachinePrecision] * N[(A + N[(-0.5 * N[(N[(N[(A * A), $MachinePrecision] + N[(N[(B * B), $MachinePrecision] - N[(A * A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / C), $MachinePrecision] + A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[B, 1.02e+55], N[((-N[Sqrt[N[(2.0 * N[(t$95$1 * N[(F * N[(A + N[(A + N[(-0.5 * N[(N[(B * B), $MachinePrecision] / C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], N[(N[Sqrt[N[(F * N[(A - N[Sqrt[A ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision])), $MachinePrecision]]]]]]]
\begin{array}{l}
B = |B|\\
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := B \cdot B - \left(A \cdot C\right) \cdot 4\\
t_1 := \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)\\
t_2 := B \cdot B + -4 \cdot \left(A \cdot C\right)\\
\mathbf{if}\;B \leq 1.65 \cdot 10^{-25}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(t_2 \cdot \left(F \cdot \left(A + A\right)\right)\right)}}{t_2}\\

\mathbf{elif}\;B \leq 1.5 \cdot 10^{+16}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(F \cdot t_0\right) \cdot \left(A + \mathsf{fma}\left(-0.5, \frac{A \cdot A + \left(B \cdot B - A \cdot A\right)}{C}, A\right)\right)\right)}}{t_0}\\

\mathbf{elif}\;B \leq 1.02 \cdot 10^{+55}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(t_1 \cdot \left(F \cdot \left(A + \left(A + -0.5 \cdot \frac{B \cdot B}{C}\right)\right)\right)\right)}}{t_1}\\

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


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

    1. Initial program 17.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. Simplified17.7%

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

      \[\leadsto \frac{-\sqrt{2 \cdot \left(\left(\left(B \cdot B - 4 \cdot \left(A \cdot C\right)\right) \cdot F\right) \cdot \color{blue}{\left(A - -1 \cdot A\right)}\right)}}{B \cdot B - 4 \cdot \left(A \cdot C\right)} \]
    4. Step-by-step derivation
      1. cancel-sign-sub-inv17.4%

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

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

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

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

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

        \[\leadsto -\frac{\sqrt{2 \cdot \color{blue}{\left(\left(B \cdot B - 4 \cdot \left(A \cdot C\right)\right) \cdot \left(F \cdot \left(A + A\right)\right)\right)}}}{B \cdot B - 4 \cdot \left(A \cdot C\right)} \]
      3. cancel-sign-sub-inv18.8%

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

        \[\leadsto -\frac{\sqrt{2 \cdot \left(\left(B \cdot B + \color{blue}{-4} \cdot \left(A \cdot C\right)\right) \cdot \left(F \cdot \left(A + A\right)\right)\right)}}{B \cdot B - 4 \cdot \left(A \cdot C\right)} \]
      5. cancel-sign-sub-inv18.8%

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

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

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

    if 1.6499999999999999e-25 < B < 1.5e16

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.5e16 < B < 1.02000000000000002e55

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

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

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

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

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

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

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

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

    if 1.02000000000000002e55 < B

    1. Initial program 13.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. Simplified13.0%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;B \leq 1.65 \cdot 10^{-25}:\\ \;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(B \cdot B + -4 \cdot \left(A \cdot C\right)\right) \cdot \left(F \cdot \left(A + A\right)\right)\right)}}{B \cdot B + -4 \cdot \left(A \cdot C\right)}\\ \mathbf{elif}\;B \leq 1.5 \cdot 10^{+16}:\\ \;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(F \cdot \left(B \cdot B - \left(A \cdot C\right) \cdot 4\right)\right) \cdot \left(A + \mathsf{fma}\left(-0.5, \frac{A \cdot A + \left(B \cdot B - A \cdot A\right)}{C}, A\right)\right)\right)}}{B \cdot B - \left(A \cdot C\right) \cdot 4}\\ \mathbf{elif}\;B \leq 1.02 \cdot 10^{+55}:\\ \;\;\;\;\frac{-\sqrt{2 \cdot \left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(A + \left(A + -0.5 \cdot \frac{B \cdot B}{C}\right)\right)\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{F \cdot \left(A - \mathsf{hypot}\left(A, B\right)\right)} \cdot \left(-\frac{\sqrt{2}}{B}\right)\\ \end{array} \]

Alternative 3: 47.6% accurate, 2.0× speedup?

\[\begin{array}{l} B = |B|\\ [A, C] = \mathsf{sort}([A, C])\\ \\ \begin{array}{l} t_0 := B \cdot B - \left(A \cdot C\right) \cdot 4\\ t_1 := B \cdot B + -4 \cdot \left(A \cdot C\right)\\ \mathbf{if}\;B \leq 1.25 \cdot 10^{-24}:\\ \;\;\;\;\frac{-\sqrt{2 \cdot \left(t_1 \cdot \left(F \cdot \left(A + A\right)\right)\right)}}{t_1}\\ \mathbf{elif}\;B \leq 0.6:\\ \;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(F \cdot t_0\right) \cdot \left(A + \mathsf{fma}\left(-0.5, \frac{A \cdot A + \left(B \cdot B - A \cdot A\right)}{C}, A\right)\right)\right)}}{t_0}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{F \cdot \left(A - \mathsf{hypot}\left(A, B\right)\right)} \cdot \left(-\frac{\sqrt{2}}{B}\right)\\ \end{array} \end{array} \]
NOTE: B should be positive before calling this function
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
 :precision binary64
 (let* ((t_0 (- (* B B) (* (* A C) 4.0))) (t_1 (+ (* B B) (* -4.0 (* A C)))))
   (if (<= B 1.25e-24)
     (/ (- (sqrt (* 2.0 (* t_1 (* F (+ A A)))))) t_1)
     (if (<= B 0.6)
       (/
        (-
         (sqrt
          (*
           2.0
           (*
            (* F t_0)
            (+ A (fma -0.5 (/ (+ (* A A) (- (* B B) (* A A))) C) A))))))
        t_0)
       (* (sqrt (* F (- A (hypot A B)))) (- (/ (sqrt 2.0) B)))))))
B = abs(B);
assert(A < C);
double code(double A, double B, double C, double F) {
	double t_0 = (B * B) - ((A * C) * 4.0);
	double t_1 = (B * B) + (-4.0 * (A * C));
	double tmp;
	if (B <= 1.25e-24) {
		tmp = -sqrt((2.0 * (t_1 * (F * (A + A))))) / t_1;
	} else if (B <= 0.6) {
		tmp = -sqrt((2.0 * ((F * t_0) * (A + fma(-0.5, (((A * A) + ((B * B) - (A * A))) / C), A))))) / t_0;
	} else {
		tmp = sqrt((F * (A - hypot(A, B)))) * -(sqrt(2.0) / B);
	}
	return tmp;
}
B = abs(B)
A, C = sort([A, C])
function code(A, B, C, F)
	t_0 = Float64(Float64(B * B) - Float64(Float64(A * C) * 4.0))
	t_1 = Float64(Float64(B * B) + Float64(-4.0 * Float64(A * C)))
	tmp = 0.0
	if (B <= 1.25e-24)
		tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(t_1 * Float64(F * Float64(A + A)))))) / t_1);
	elseif (B <= 0.6)
		tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(Float64(F * t_0) * Float64(A + fma(-0.5, Float64(Float64(Float64(A * A) + Float64(Float64(B * B) - Float64(A * A))) / C), A)))))) / t_0);
	else
		tmp = Float64(sqrt(Float64(F * Float64(A - hypot(A, B)))) * Float64(-Float64(sqrt(2.0) / B)));
	end
	return tmp
end
NOTE: B should be positive before calling this function
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] - N[(N[(A * C), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(B * B), $MachinePrecision] + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, 1.25e-24], N[((-N[Sqrt[N[(2.0 * N[(t$95$1 * N[(F * N[(A + A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], If[LessEqual[B, 0.6], N[((-N[Sqrt[N[(2.0 * N[(N[(F * t$95$0), $MachinePrecision] * N[(A + N[(-0.5 * N[(N[(N[(A * A), $MachinePrecision] + N[(N[(B * B), $MachinePrecision] - N[(A * A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / C), $MachinePrecision] + A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[(N[Sqrt[N[(F * N[(A - N[Sqrt[A ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision])), $MachinePrecision]]]]]
\begin{array}{l}
B = |B|\\
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := B \cdot B - \left(A \cdot C\right) \cdot 4\\
t_1 := B \cdot B + -4 \cdot \left(A \cdot C\right)\\
\mathbf{if}\;B \leq 1.25 \cdot 10^{-24}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(t_1 \cdot \left(F \cdot \left(A + A\right)\right)\right)}}{t_1}\\

\mathbf{elif}\;B \leq 0.6:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(F \cdot t_0\right) \cdot \left(A + \mathsf{fma}\left(-0.5, \frac{A \cdot A + \left(B \cdot B - A \cdot A\right)}{C}, A\right)\right)\right)}}{t_0}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if B < 1.24999999999999995e-24

    1. Initial program 17.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. Simplified17.7%

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

      \[\leadsto \frac{-\sqrt{2 \cdot \left(\left(\left(B \cdot B - 4 \cdot \left(A \cdot C\right)\right) \cdot F\right) \cdot \color{blue}{\left(A - -1 \cdot A\right)}\right)}}{B \cdot B - 4 \cdot \left(A \cdot C\right)} \]
    4. Step-by-step derivation
      1. cancel-sign-sub-inv17.4%

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

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

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

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

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

        \[\leadsto -\frac{\sqrt{2 \cdot \color{blue}{\left(\left(B \cdot B - 4 \cdot \left(A \cdot C\right)\right) \cdot \left(F \cdot \left(A + A\right)\right)\right)}}}{B \cdot B - 4 \cdot \left(A \cdot C\right)} \]
      3. cancel-sign-sub-inv18.8%

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

        \[\leadsto -\frac{\sqrt{2 \cdot \left(\left(B \cdot B + \color{blue}{-4} \cdot \left(A \cdot C\right)\right) \cdot \left(F \cdot \left(A + A\right)\right)\right)}}{B \cdot B - 4 \cdot \left(A \cdot C\right)} \]
      5. cancel-sign-sub-inv18.8%

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

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

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

    if 1.24999999999999995e-24 < B < 0.599999999999999978

    1. Initial program 3.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 0.599999999999999978 < B

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;B \leq 1.25 \cdot 10^{-24}:\\ \;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(B \cdot B + -4 \cdot \left(A \cdot C\right)\right) \cdot \left(F \cdot \left(A + A\right)\right)\right)}}{B \cdot B + -4 \cdot \left(A \cdot C\right)}\\ \mathbf{elif}\;B \leq 0.6:\\ \;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(F \cdot \left(B \cdot B - \left(A \cdot C\right) \cdot 4\right)\right) \cdot \left(A + \mathsf{fma}\left(-0.5, \frac{A \cdot A + \left(B \cdot B - A \cdot A\right)}{C}, A\right)\right)\right)}}{B \cdot B - \left(A \cdot C\right) \cdot 4}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{F \cdot \left(A - \mathsf{hypot}\left(A, B\right)\right)} \cdot \left(-\frac{\sqrt{2}}{B}\right)\\ \end{array} \]

Alternative 4: 36.3% accurate, 2.6× speedup?

\[\begin{array}{l} B = |B|\\ [A, C] = \mathsf{sort}([A, C])\\ \\ \begin{array}{l} t_0 := B \cdot B - \left(A \cdot C\right) \cdot 4\\ t_1 := F \cdot t_0\\ \mathbf{if}\;C \leq 1.4 \cdot 10^{-25}:\\ \;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(A - \mathsf{hypot}\left(A, B\right)\right) \cdot t_1\right)}}{t_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{-\sqrt{2 \cdot \left(t_1 \cdot \left(A + \mathsf{fma}\left(-0.5, \frac{A \cdot A + \left(B \cdot B - A \cdot A\right)}{C}, A\right)\right)\right)}}{t_0}\\ \end{array} \end{array} \]
NOTE: B should be positive before calling this function
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
 :precision binary64
 (let* ((t_0 (- (* B B) (* (* A C) 4.0))) (t_1 (* F t_0)))
   (if (<= C 1.4e-25)
     (/ (- (sqrt (* 2.0 (* (- A (hypot A B)) t_1)))) t_0)
     (/
      (-
       (sqrt
        (*
         2.0
         (* t_1 (+ A (fma -0.5 (/ (+ (* A A) (- (* B B) (* A A))) C) A))))))
      t_0))))
B = abs(B);
assert(A < C);
double code(double A, double B, double C, double F) {
	double t_0 = (B * B) - ((A * C) * 4.0);
	double t_1 = F * t_0;
	double tmp;
	if (C <= 1.4e-25) {
		tmp = -sqrt((2.0 * ((A - hypot(A, B)) * t_1))) / t_0;
	} else {
		tmp = -sqrt((2.0 * (t_1 * (A + fma(-0.5, (((A * A) + ((B * B) - (A * A))) / C), A))))) / t_0;
	}
	return tmp;
}
B = abs(B)
A, C = sort([A, C])
function code(A, B, C, F)
	t_0 = Float64(Float64(B * B) - Float64(Float64(A * C) * 4.0))
	t_1 = Float64(F * t_0)
	tmp = 0.0
	if (C <= 1.4e-25)
		tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(Float64(A - hypot(A, B)) * t_1)))) / t_0);
	else
		tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(t_1 * Float64(A + fma(-0.5, Float64(Float64(Float64(A * A) + Float64(Float64(B * B) - Float64(A * A))) / C), A)))))) / t_0);
	end
	return tmp
end
NOTE: B should be positive before calling this function
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] - N[(N[(A * C), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(F * t$95$0), $MachinePrecision]}, If[LessEqual[C, 1.4e-25], N[((-N[Sqrt[N[(2.0 * N[(N[(A - N[Sqrt[A ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[((-N[Sqrt[N[(2.0 * N[(t$95$1 * N[(A + N[(-0.5 * N[(N[(N[(A * A), $MachinePrecision] + N[(N[(B * B), $MachinePrecision] - N[(A * A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / C), $MachinePrecision] + A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision]]]]
\begin{array}{l}
B = |B|\\
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := B \cdot B - \left(A \cdot C\right) \cdot 4\\
t_1 := F \cdot t_0\\
\mathbf{if}\;C \leq 1.4 \cdot 10^{-25}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(A - \mathsf{hypot}\left(A, B\right)\right) \cdot t_1\right)}}{t_0}\\

\mathbf{else}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(t_1 \cdot \left(A + \mathsf{fma}\left(-0.5, \frac{A \cdot A + \left(B \cdot B - A \cdot A\right)}{C}, A\right)\right)\right)}}{t_0}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if C < 1.39999999999999994e-25

    1. Initial program 21.7%

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

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

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

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

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

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

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

    if 1.39999999999999994e-25 < C

    1. Initial program 3.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. Simplified3.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 33.9% accurate, 2.7× speedup?

\[\begin{array}{l} B = |B|\\ [A, C] = \mathsf{sort}([A, C])\\ \\ \begin{array}{l} t_0 := B \cdot B - \left(A \cdot C\right) \cdot 4\\ t_1 := B \cdot B + -4 \cdot \left(A \cdot C\right)\\ \mathbf{if}\;B \leq 0.0027:\\ \;\;\;\;\frac{-\sqrt{2 \cdot \left(t_1 \cdot \left(F \cdot \left(A + A\right)\right)\right)}}{t_1}\\ \mathbf{elif}\;B \leq 1.65 \cdot 10^{+153}:\\ \;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(A - \mathsf{hypot}\left(A, B\right)\right) \cdot \left(F \cdot t_0\right)\right)}}{t_0}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{\sqrt{A \cdot F}}{B}\\ \end{array} \end{array} \]
NOTE: B should be positive before calling this function
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
 :precision binary64
 (let* ((t_0 (- (* B B) (* (* A C) 4.0))) (t_1 (+ (* B B) (* -4.0 (* A C)))))
   (if (<= B 0.0027)
     (/ (- (sqrt (* 2.0 (* t_1 (* F (+ A A)))))) t_1)
     (if (<= B 1.65e+153)
       (/ (- (sqrt (* 2.0 (* (- A (hypot A B)) (* F t_0))))) t_0)
       (* -2.0 (/ (sqrt (* A F)) B))))))
B = abs(B);
assert(A < C);
double code(double A, double B, double C, double F) {
	double t_0 = (B * B) - ((A * C) * 4.0);
	double t_1 = (B * B) + (-4.0 * (A * C));
	double tmp;
	if (B <= 0.0027) {
		tmp = -sqrt((2.0 * (t_1 * (F * (A + A))))) / t_1;
	} else if (B <= 1.65e+153) {
		tmp = -sqrt((2.0 * ((A - hypot(A, B)) * (F * t_0)))) / t_0;
	} else {
		tmp = -2.0 * (sqrt((A * F)) / B);
	}
	return tmp;
}
B = Math.abs(B);
assert A < C;
public static double code(double A, double B, double C, double F) {
	double t_0 = (B * B) - ((A * C) * 4.0);
	double t_1 = (B * B) + (-4.0 * (A * C));
	double tmp;
	if (B <= 0.0027) {
		tmp = -Math.sqrt((2.0 * (t_1 * (F * (A + A))))) / t_1;
	} else if (B <= 1.65e+153) {
		tmp = -Math.sqrt((2.0 * ((A - Math.hypot(A, B)) * (F * t_0)))) / t_0;
	} else {
		tmp = -2.0 * (Math.sqrt((A * F)) / B);
	}
	return tmp;
}
B = abs(B)
[A, C] = sort([A, C])
def code(A, B, C, F):
	t_0 = (B * B) - ((A * C) * 4.0)
	t_1 = (B * B) + (-4.0 * (A * C))
	tmp = 0
	if B <= 0.0027:
		tmp = -math.sqrt((2.0 * (t_1 * (F * (A + A))))) / t_1
	elif B <= 1.65e+153:
		tmp = -math.sqrt((2.0 * ((A - math.hypot(A, B)) * (F * t_0)))) / t_0
	else:
		tmp = -2.0 * (math.sqrt((A * F)) / B)
	return tmp
B = abs(B)
A, C = sort([A, C])
function code(A, B, C, F)
	t_0 = Float64(Float64(B * B) - Float64(Float64(A * C) * 4.0))
	t_1 = Float64(Float64(B * B) + Float64(-4.0 * Float64(A * C)))
	tmp = 0.0
	if (B <= 0.0027)
		tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(t_1 * Float64(F * Float64(A + A)))))) / t_1);
	elseif (B <= 1.65e+153)
		tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(Float64(A - hypot(A, B)) * Float64(F * t_0))))) / t_0);
	else
		tmp = Float64(-2.0 * Float64(sqrt(Float64(A * F)) / B));
	end
	return tmp
end
B = abs(B)
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
	t_0 = (B * B) - ((A * C) * 4.0);
	t_1 = (B * B) + (-4.0 * (A * C));
	tmp = 0.0;
	if (B <= 0.0027)
		tmp = -sqrt((2.0 * (t_1 * (F * (A + A))))) / t_1;
	elseif (B <= 1.65e+153)
		tmp = -sqrt((2.0 * ((A - hypot(A, B)) * (F * t_0)))) / t_0;
	else
		tmp = -2.0 * (sqrt((A * F)) / B);
	end
	tmp_2 = tmp;
end
NOTE: B should be positive before calling this function
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] - N[(N[(A * C), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(B * B), $MachinePrecision] + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, 0.0027], N[((-N[Sqrt[N[(2.0 * N[(t$95$1 * N[(F * N[(A + A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], If[LessEqual[B, 1.65e+153], N[((-N[Sqrt[N[(2.0 * N[(N[(A - N[Sqrt[A ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision] * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[(-2.0 * N[(N[Sqrt[N[(A * F), $MachinePrecision]], $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
B = |B|\\
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := B \cdot B - \left(A \cdot C\right) \cdot 4\\
t_1 := B \cdot B + -4 \cdot \left(A \cdot C\right)\\
\mathbf{if}\;B \leq 0.0027:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(t_1 \cdot \left(F \cdot \left(A + A\right)\right)\right)}}{t_1}\\

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

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


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

    1. Initial program 17.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. Simplified17.0%

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

      \[\leadsto \frac{-\sqrt{2 \cdot \left(\left(\left(B \cdot B - 4 \cdot \left(A \cdot C\right)\right) \cdot F\right) \cdot \color{blue}{\left(A - -1 \cdot A\right)}\right)}}{B \cdot B - 4 \cdot \left(A \cdot C\right)} \]
    4. Step-by-step derivation
      1. cancel-sign-sub-inv18.2%

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

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

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

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

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

        \[\leadsto -\frac{\sqrt{2 \cdot \color{blue}{\left(\left(B \cdot B - 4 \cdot \left(A \cdot C\right)\right) \cdot \left(F \cdot \left(A + A\right)\right)\right)}}}{B \cdot B - 4 \cdot \left(A \cdot C\right)} \]
      3. cancel-sign-sub-inv19.6%

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

        \[\leadsto -\frac{\sqrt{2 \cdot \left(\left(B \cdot B + \color{blue}{-4} \cdot \left(A \cdot C\right)\right) \cdot \left(F \cdot \left(A + A\right)\right)\right)}}{B \cdot B - 4 \cdot \left(A \cdot C\right)} \]
      5. cancel-sign-sub-inv19.6%

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

        \[\leadsto -\frac{\sqrt{2 \cdot \left(\left(B \cdot B + -4 \cdot \left(A \cdot C\right)\right) \cdot \left(F \cdot \left(A + A\right)\right)\right)}}{B \cdot B + \color{blue}{-4} \cdot \left(A \cdot C\right)} \]
    7. Applied egg-rr19.6%

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

    if 0.0027000000000000001 < B < 1.64999999999999997e153

    1. Initial program 40.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. Simplified40.5%

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

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

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

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

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

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

    if 1.64999999999999997e153 < B

    1. Initial program 0.0%

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

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

      \[\leadsto \frac{-\sqrt{2 \cdot \left(\left(\left(B \cdot B - 4 \cdot \left(A \cdot C\right)\right) \cdot F\right) \cdot \color{blue}{\left(A - -1 \cdot A\right)}\right)}}{B \cdot B - 4 \cdot \left(A \cdot C\right)} \]
    4. Step-by-step derivation
      1. cancel-sign-sub-inv0.0%

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

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

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

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

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

        \[\leadsto -2 \cdot \color{blue}{\frac{\sqrt{A \cdot F} \cdot 1}{B}} \]
      2. *-rgt-identity10.6%

        \[\leadsto -2 \cdot \frac{\color{blue}{\sqrt{A \cdot F}}}{B} \]
    8. Simplified10.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;B \leq 0.0027:\\ \;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(B \cdot B + -4 \cdot \left(A \cdot C\right)\right) \cdot \left(F \cdot \left(A + A\right)\right)\right)}}{B \cdot B + -4 \cdot \left(A \cdot C\right)}\\ \mathbf{elif}\;B \leq 1.65 \cdot 10^{+153}:\\ \;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(A - \mathsf{hypot}\left(A, B\right)\right) \cdot \left(F \cdot \left(B \cdot B - \left(A \cdot C\right) \cdot 4\right)\right)\right)}}{B \cdot B - \left(A \cdot C\right) \cdot 4}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{\sqrt{A \cdot F}}{B}\\ \end{array} \]

Alternative 6: 31.6% accurate, 4.7× speedup?

\[\begin{array}{l} B = |B|\\ [A, C] = \mathsf{sort}([A, C])\\ \\ \begin{array}{l} t_0 := B \cdot B - \left(A \cdot C\right) \cdot 4\\ t_1 := B \cdot B + -4 \cdot \left(A \cdot C\right)\\ \mathbf{if}\;B \leq 7.2 \cdot 10^{+15}:\\ \;\;\;\;\frac{-\sqrt{2 \cdot \left(t_1 \cdot \left(F \cdot \left(A + A\right)\right)\right)}}{t_1}\\ \mathbf{elif}\;B \leq 7.2 \cdot 10^{+153}:\\ \;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(F \cdot t_0\right) \cdot \left(\left(A + C\right) - B\right)\right)}}{t_0}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{\sqrt{A \cdot F}}{B}\\ \end{array} \end{array} \]
NOTE: B should be positive before calling this function
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
 :precision binary64
 (let* ((t_0 (- (* B B) (* (* A C) 4.0))) (t_1 (+ (* B B) (* -4.0 (* A C)))))
   (if (<= B 7.2e+15)
     (/ (- (sqrt (* 2.0 (* t_1 (* F (+ A A)))))) t_1)
     (if (<= B 7.2e+153)
       (/ (- (sqrt (* 2.0 (* (* F t_0) (- (+ A C) B))))) t_0)
       (* -2.0 (/ (sqrt (* A F)) B))))))
B = abs(B);
assert(A < C);
double code(double A, double B, double C, double F) {
	double t_0 = (B * B) - ((A * C) * 4.0);
	double t_1 = (B * B) + (-4.0 * (A * C));
	double tmp;
	if (B <= 7.2e+15) {
		tmp = -sqrt((2.0 * (t_1 * (F * (A + A))))) / t_1;
	} else if (B <= 7.2e+153) {
		tmp = -sqrt((2.0 * ((F * t_0) * ((A + C) - B)))) / t_0;
	} else {
		tmp = -2.0 * (sqrt((A * F)) / B);
	}
	return tmp;
}
NOTE: B should be positive before calling this function
NOTE: A and C should be sorted in increasing order before calling this function.
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
    real(8) :: t_1
    real(8) :: tmp
    t_0 = (b * b) - ((a * c) * 4.0d0)
    t_1 = (b * b) + ((-4.0d0) * (a * c))
    if (b <= 7.2d+15) then
        tmp = -sqrt((2.0d0 * (t_1 * (f * (a + a))))) / t_1
    else if (b <= 7.2d+153) then
        tmp = -sqrt((2.0d0 * ((f * t_0) * ((a + c) - b)))) / t_0
    else
        tmp = (-2.0d0) * (sqrt((a * f)) / b)
    end if
    code = tmp
end function
B = Math.abs(B);
assert A < C;
public static double code(double A, double B, double C, double F) {
	double t_0 = (B * B) - ((A * C) * 4.0);
	double t_1 = (B * B) + (-4.0 * (A * C));
	double tmp;
	if (B <= 7.2e+15) {
		tmp = -Math.sqrt((2.0 * (t_1 * (F * (A + A))))) / t_1;
	} else if (B <= 7.2e+153) {
		tmp = -Math.sqrt((2.0 * ((F * t_0) * ((A + C) - B)))) / t_0;
	} else {
		tmp = -2.0 * (Math.sqrt((A * F)) / B);
	}
	return tmp;
}
B = abs(B)
[A, C] = sort([A, C])
def code(A, B, C, F):
	t_0 = (B * B) - ((A * C) * 4.0)
	t_1 = (B * B) + (-4.0 * (A * C))
	tmp = 0
	if B <= 7.2e+15:
		tmp = -math.sqrt((2.0 * (t_1 * (F * (A + A))))) / t_1
	elif B <= 7.2e+153:
		tmp = -math.sqrt((2.0 * ((F * t_0) * ((A + C) - B)))) / t_0
	else:
		tmp = -2.0 * (math.sqrt((A * F)) / B)
	return tmp
B = abs(B)
A, C = sort([A, C])
function code(A, B, C, F)
	t_0 = Float64(Float64(B * B) - Float64(Float64(A * C) * 4.0))
	t_1 = Float64(Float64(B * B) + Float64(-4.0 * Float64(A * C)))
	tmp = 0.0
	if (B <= 7.2e+15)
		tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(t_1 * Float64(F * Float64(A + A)))))) / t_1);
	elseif (B <= 7.2e+153)
		tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(Float64(F * t_0) * Float64(Float64(A + C) - B))))) / t_0);
	else
		tmp = Float64(-2.0 * Float64(sqrt(Float64(A * F)) / B));
	end
	return tmp
end
B = abs(B)
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
	t_0 = (B * B) - ((A * C) * 4.0);
	t_1 = (B * B) + (-4.0 * (A * C));
	tmp = 0.0;
	if (B <= 7.2e+15)
		tmp = -sqrt((2.0 * (t_1 * (F * (A + A))))) / t_1;
	elseif (B <= 7.2e+153)
		tmp = -sqrt((2.0 * ((F * t_0) * ((A + C) - B)))) / t_0;
	else
		tmp = -2.0 * (sqrt((A * F)) / B);
	end
	tmp_2 = tmp;
end
NOTE: B should be positive before calling this function
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] - N[(N[(A * C), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(B * B), $MachinePrecision] + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, 7.2e+15], N[((-N[Sqrt[N[(2.0 * N[(t$95$1 * N[(F * N[(A + A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], If[LessEqual[B, 7.2e+153], N[((-N[Sqrt[N[(2.0 * N[(N[(F * t$95$0), $MachinePrecision] * N[(N[(A + C), $MachinePrecision] - B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[(-2.0 * N[(N[Sqrt[N[(A * F), $MachinePrecision]], $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
B = |B|\\
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := B \cdot B - \left(A \cdot C\right) \cdot 4\\
t_1 := B \cdot B + -4 \cdot \left(A \cdot C\right)\\
\mathbf{if}\;B \leq 7.2 \cdot 10^{+15}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(t_1 \cdot \left(F \cdot \left(A + A\right)\right)\right)}}{t_1}\\

\mathbf{elif}\;B \leq 7.2 \cdot 10^{+153}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(F \cdot t_0\right) \cdot \left(\left(A + C\right) - B\right)\right)}}{t_0}\\

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


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

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

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

      \[\leadsto \frac{-\sqrt{2 \cdot \left(\left(\left(B \cdot B - 4 \cdot \left(A \cdot C\right)\right) \cdot F\right) \cdot \color{blue}{\left(A - -1 \cdot A\right)}\right)}}{B \cdot B - 4 \cdot \left(A \cdot C\right)} \]
    4. Step-by-step derivation
      1. cancel-sign-sub-inv18.7%

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

        \[\leadsto \frac{-\sqrt{2 \cdot \left(\left(\left(B \cdot B - 4 \cdot \left(A \cdot C\right)\right) \cdot F\right) \cdot \left(A + \color{blue}{1} \cdot A\right)\right)}}{B \cdot B - 4 \cdot \left(A \cdot C\right)} \]
      3. *-lft-identity18.7%

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

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

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

        \[\leadsto -\frac{\sqrt{2 \cdot \color{blue}{\left(\left(B \cdot B - 4 \cdot \left(A \cdot C\right)\right) \cdot \left(F \cdot \left(A + A\right)\right)\right)}}}{B \cdot B - 4 \cdot \left(A \cdot C\right)} \]
      3. cancel-sign-sub-inv20.1%

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

        \[\leadsto -\frac{\sqrt{2 \cdot \left(\left(B \cdot B + \color{blue}{-4} \cdot \left(A \cdot C\right)\right) \cdot \left(F \cdot \left(A + A\right)\right)\right)}}{B \cdot B - 4 \cdot \left(A \cdot C\right)} \]
      5. cancel-sign-sub-inv20.1%

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

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

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

    if 7.2e15 < B < 7.2000000000000001e153

    1. Initial program 30.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. Simplified30.8%

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

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

    if 7.2000000000000001e153 < B

    1. Initial program 0.0%

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

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

      \[\leadsto \frac{-\sqrt{2 \cdot \left(\left(\left(B \cdot B - 4 \cdot \left(A \cdot C\right)\right) \cdot F\right) \cdot \color{blue}{\left(A - -1 \cdot A\right)}\right)}}{B \cdot B - 4 \cdot \left(A \cdot C\right)} \]
    4. Step-by-step derivation
      1. cancel-sign-sub-inv0.0%

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

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

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

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

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

        \[\leadsto -2 \cdot \color{blue}{\frac{\sqrt{A \cdot F} \cdot 1}{B}} \]
      2. *-rgt-identity10.6%

        \[\leadsto -2 \cdot \frac{\color{blue}{\sqrt{A \cdot F}}}{B} \]
    8. Simplified10.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;B \leq 7.2 \cdot 10^{+15}:\\ \;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(B \cdot B + -4 \cdot \left(A \cdot C\right)\right) \cdot \left(F \cdot \left(A + A\right)\right)\right)}}{B \cdot B + -4 \cdot \left(A \cdot C\right)}\\ \mathbf{elif}\;B \leq 7.2 \cdot 10^{+153}:\\ \;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(F \cdot \left(B \cdot B - \left(A \cdot C\right) \cdot 4\right)\right) \cdot \left(\left(A + C\right) - B\right)\right)}}{B \cdot B - \left(A \cdot C\right) \cdot 4}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{\sqrt{A \cdot F}}{B}\\ \end{array} \]

Alternative 7: 29.8% accurate, 4.9× speedup?

\[\begin{array}{l} B = |B|\\ [A, C] = \mathsf{sort}([A, C])\\ \\ \begin{array}{l} t_0 := B \cdot B + -4 \cdot \left(A \cdot C\right)\\ \mathbf{if}\;B \leq 1.22 \cdot 10^{+98}:\\ \;\;\;\;\frac{-\sqrt{2 \cdot \left(t_0 \cdot \left(F \cdot \left(A + A\right)\right)\right)}}{t_0}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{{\left(A \cdot F\right)}^{0.5}}{B}\\ \end{array} \end{array} \]
NOTE: B should be positive before calling this function
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
 :precision binary64
 (let* ((t_0 (+ (* B B) (* -4.0 (* A C)))))
   (if (<= B 1.22e+98)
     (/ (- (sqrt (* 2.0 (* t_0 (* F (+ A A)))))) t_0)
     (* -2.0 (/ (pow (* A F) 0.5) B)))))
B = abs(B);
assert(A < C);
double code(double A, double B, double C, double F) {
	double t_0 = (B * B) + (-4.0 * (A * C));
	double tmp;
	if (B <= 1.22e+98) {
		tmp = -sqrt((2.0 * (t_0 * (F * (A + A))))) / t_0;
	} else {
		tmp = -2.0 * (pow((A * F), 0.5) / B);
	}
	return tmp;
}
NOTE: B should be positive before calling this function
NOTE: A and C should be sorted in increasing order before calling this function.
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
    real(8) :: tmp
    t_0 = (b * b) + ((-4.0d0) * (a * c))
    if (b <= 1.22d+98) then
        tmp = -sqrt((2.0d0 * (t_0 * (f * (a + a))))) / t_0
    else
        tmp = (-2.0d0) * (((a * f) ** 0.5d0) / b)
    end if
    code = tmp
end function
B = Math.abs(B);
assert A < C;
public static double code(double A, double B, double C, double F) {
	double t_0 = (B * B) + (-4.0 * (A * C));
	double tmp;
	if (B <= 1.22e+98) {
		tmp = -Math.sqrt((2.0 * (t_0 * (F * (A + A))))) / t_0;
	} else {
		tmp = -2.0 * (Math.pow((A * F), 0.5) / B);
	}
	return tmp;
}
B = abs(B)
[A, C] = sort([A, C])
def code(A, B, C, F):
	t_0 = (B * B) + (-4.0 * (A * C))
	tmp = 0
	if B <= 1.22e+98:
		tmp = -math.sqrt((2.0 * (t_0 * (F * (A + A))))) / t_0
	else:
		tmp = -2.0 * (math.pow((A * F), 0.5) / B)
	return tmp
B = abs(B)
A, C = sort([A, C])
function code(A, B, C, F)
	t_0 = Float64(Float64(B * B) + Float64(-4.0 * Float64(A * C)))
	tmp = 0.0
	if (B <= 1.22e+98)
		tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(t_0 * Float64(F * Float64(A + A)))))) / t_0);
	else
		tmp = Float64(-2.0 * Float64((Float64(A * F) ^ 0.5) / B));
	end
	return tmp
end
B = abs(B)
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
	t_0 = (B * B) + (-4.0 * (A * C));
	tmp = 0.0;
	if (B <= 1.22e+98)
		tmp = -sqrt((2.0 * (t_0 * (F * (A + A))))) / t_0;
	else
		tmp = -2.0 * (((A * F) ^ 0.5) / B);
	end
	tmp_2 = tmp;
end
NOTE: B should be positive before calling this function
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, 1.22e+98], N[((-N[Sqrt[N[(2.0 * N[(t$95$0 * N[(F * N[(A + A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[(-2.0 * N[(N[Power[N[(A * F), $MachinePrecision], 0.5], $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
B = |B|\\
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := B \cdot B + -4 \cdot \left(A \cdot C\right)\\
\mathbf{if}\;B \leq 1.22 \cdot 10^{+98}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(t_0 \cdot \left(F \cdot \left(A + A\right)\right)\right)}}{t_0}\\

\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{{\left(A \cdot F\right)}^{0.5}}{B}\\


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

    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. Simplified19.1%

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

      \[\leadsto \frac{-\sqrt{2 \cdot \left(\left(\left(B \cdot B - 4 \cdot \left(A \cdot C\right)\right) \cdot F\right) \cdot \color{blue}{\left(A - -1 \cdot A\right)}\right)}}{B \cdot B - 4 \cdot \left(A \cdot C\right)} \]
    4. Step-by-step derivation
      1. cancel-sign-sub-inv18.2%

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

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

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

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

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

        \[\leadsto -\frac{\sqrt{2 \cdot \color{blue}{\left(\left(B \cdot B - 4 \cdot \left(A \cdot C\right)\right) \cdot \left(F \cdot \left(A + A\right)\right)\right)}}}{B \cdot B - 4 \cdot \left(A \cdot C\right)} \]
      3. cancel-sign-sub-inv19.5%

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

        \[\leadsto -\frac{\sqrt{2 \cdot \left(\left(B \cdot B + \color{blue}{-4} \cdot \left(A \cdot C\right)\right) \cdot \left(F \cdot \left(A + A\right)\right)\right)}}{B \cdot B - 4 \cdot \left(A \cdot C\right)} \]
      5. cancel-sign-sub-inv19.5%

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

        \[\leadsto -\frac{\sqrt{2 \cdot \left(\left(B \cdot B + -4 \cdot \left(A \cdot C\right)\right) \cdot \left(F \cdot \left(A + A\right)\right)\right)}}{B \cdot B + \color{blue}{-4} \cdot \left(A \cdot C\right)} \]
    7. Applied egg-rr19.5%

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

    if 1.22e98 < B

    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. Simplified7.4%

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

      \[\leadsto \frac{-\sqrt{2 \cdot \left(\left(\left(B \cdot B - 4 \cdot \left(A \cdot C\right)\right) \cdot F\right) \cdot \color{blue}{\left(A - -1 \cdot A\right)}\right)}}{B \cdot B - 4 \cdot \left(A \cdot C\right)} \]
    4. Step-by-step derivation
      1. cancel-sign-sub-inv0.2%

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

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

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

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

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

        \[\leadsto -2 \cdot \color{blue}{\frac{\sqrt{A \cdot F} \cdot 1}{B}} \]
      2. *-rgt-identity8.3%

        \[\leadsto -2 \cdot \frac{\color{blue}{\sqrt{A \cdot F}}}{B} \]
    8. Simplified8.3%

      \[\leadsto \color{blue}{-2 \cdot \frac{\sqrt{A \cdot F}}{B}} \]
    9. Step-by-step derivation
      1. pow1/28.6%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;B \leq 1.22 \cdot 10^{+98}:\\ \;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(B \cdot B + -4 \cdot \left(A \cdot C\right)\right) \cdot \left(F \cdot \left(A + A\right)\right)\right)}}{B \cdot B + -4 \cdot \left(A \cdot C\right)}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{{\left(A \cdot F\right)}^{0.5}}{B}\\ \end{array} \]

Alternative 8: 23.2% accurate, 5.0× speedup?

\[\begin{array}{l} B = |B|\\ [A, C] = \mathsf{sort}([A, C])\\ \\ \begin{array}{l} \mathbf{if}\;B \leq 320000:\\ \;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(A + A\right) \cdot \left(-4 \cdot \left(A \cdot \left(C \cdot F\right)\right)\right)\right)}}{B \cdot B - \left(A \cdot C\right) \cdot 4}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{{\left(A \cdot F\right)}^{0.5}}{B}\\ \end{array} \end{array} \]
NOTE: B should be positive before calling this function
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
 :precision binary64
 (if (<= B 320000.0)
   (/
    (- (sqrt (* 2.0 (* (+ A A) (* -4.0 (* A (* C F)))))))
    (- (* B B) (* (* A C) 4.0)))
   (* -2.0 (/ (pow (* A F) 0.5) B))))
B = abs(B);
assert(A < C);
double code(double A, double B, double C, double F) {
	double tmp;
	if (B <= 320000.0) {
		tmp = -sqrt((2.0 * ((A + A) * (-4.0 * (A * (C * F)))))) / ((B * B) - ((A * C) * 4.0));
	} else {
		tmp = -2.0 * (pow((A * F), 0.5) / B);
	}
	return tmp;
}
NOTE: B should be positive before calling this function
NOTE: A and C should be sorted in increasing order before calling this function.
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) :: tmp
    if (b <= 320000.0d0) then
        tmp = -sqrt((2.0d0 * ((a + a) * ((-4.0d0) * (a * (c * f)))))) / ((b * b) - ((a * c) * 4.0d0))
    else
        tmp = (-2.0d0) * (((a * f) ** 0.5d0) / b)
    end if
    code = tmp
end function
B = Math.abs(B);
assert A < C;
public static double code(double A, double B, double C, double F) {
	double tmp;
	if (B <= 320000.0) {
		tmp = -Math.sqrt((2.0 * ((A + A) * (-4.0 * (A * (C * F)))))) / ((B * B) - ((A * C) * 4.0));
	} else {
		tmp = -2.0 * (Math.pow((A * F), 0.5) / B);
	}
	return tmp;
}
B = abs(B)
[A, C] = sort([A, C])
def code(A, B, C, F):
	tmp = 0
	if B <= 320000.0:
		tmp = -math.sqrt((2.0 * ((A + A) * (-4.0 * (A * (C * F)))))) / ((B * B) - ((A * C) * 4.0))
	else:
		tmp = -2.0 * (math.pow((A * F), 0.5) / B)
	return tmp
B = abs(B)
A, C = sort([A, C])
function code(A, B, C, F)
	tmp = 0.0
	if (B <= 320000.0)
		tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(Float64(A + A) * Float64(-4.0 * Float64(A * Float64(C * F))))))) / Float64(Float64(B * B) - Float64(Float64(A * C) * 4.0)));
	else
		tmp = Float64(-2.0 * Float64((Float64(A * F) ^ 0.5) / B));
	end
	return tmp
end
B = abs(B)
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
	tmp = 0.0;
	if (B <= 320000.0)
		tmp = -sqrt((2.0 * ((A + A) * (-4.0 * (A * (C * F)))))) / ((B * B) - ((A * C) * 4.0));
	else
		tmp = -2.0 * (((A * F) ^ 0.5) / B);
	end
	tmp_2 = tmp;
end
NOTE: B should be positive before calling this function
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := If[LessEqual[B, 320000.0], N[((-N[Sqrt[N[(2.0 * N[(N[(A + A), $MachinePrecision] * N[(-4.0 * N[(A * N[(C * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(N[(B * B), $MachinePrecision] - N[(N[(A * C), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-2.0 * N[(N[Power[N[(A * F), $MachinePrecision], 0.5], $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
B = |B|\\
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
\mathbf{if}\;B \leq 320000:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(A + A\right) \cdot \left(-4 \cdot \left(A \cdot \left(C \cdot F\right)\right)\right)\right)}}{B \cdot B - \left(A \cdot C\right) \cdot 4}\\

\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{{\left(A \cdot F\right)}^{0.5}}{B}\\


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

    1. Initial program 17.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. Simplified17.0%

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

      \[\leadsto \frac{-\sqrt{2 \cdot \left(\left(\left(B \cdot B - 4 \cdot \left(A \cdot C\right)\right) \cdot F\right) \cdot \color{blue}{\left(A - -1 \cdot A\right)}\right)}}{B \cdot B - 4 \cdot \left(A \cdot C\right)} \]
    4. Step-by-step derivation
      1. cancel-sign-sub-inv18.2%

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

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

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

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

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

    if 3.2e5 < B

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

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

      \[\leadsto \frac{-\sqrt{2 \cdot \left(\left(\left(B \cdot B - 4 \cdot \left(A \cdot C\right)\right) \cdot F\right) \cdot \color{blue}{\left(A - -1 \cdot A\right)}\right)}}{B \cdot B - 4 \cdot \left(A \cdot C\right)} \]
    4. Step-by-step derivation
      1. cancel-sign-sub-inv5.2%

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

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

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

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

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

        \[\leadsto -2 \cdot \color{blue}{\frac{\sqrt{A \cdot F} \cdot 1}{B}} \]
      2. *-rgt-identity10.2%

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

      \[\leadsto \color{blue}{-2 \cdot \frac{\sqrt{A \cdot F}}{B}} \]
    9. Step-by-step derivation
      1. pow1/210.7%

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

      \[\leadsto -2 \cdot \frac{\color{blue}{{\left(A \cdot F\right)}^{0.5}}}{B} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification13.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;B \leq 320000:\\ \;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(A + A\right) \cdot \left(-4 \cdot \left(A \cdot \left(C \cdot F\right)\right)\right)\right)}}{B \cdot B - \left(A \cdot C\right) \cdot 4}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{{\left(A \cdot F\right)}^{0.5}}{B}\\ \end{array} \]

Alternative 9: 24.3% accurate, 5.1× speedup?

\[\begin{array}{l} B = |B|\\ [A, C] = \mathsf{sort}([A, C])\\ \\ \frac{-\sqrt{2 \cdot \left(\left(A + A\right) \cdot \left(F \cdot \left(C \cdot \left(A \cdot -4\right)\right)\right)\right)}}{B \cdot B - \left(A \cdot C\right) \cdot 4} \end{array} \]
NOTE: B should be positive before calling this function
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
 :precision binary64
 (/
  (- (sqrt (* 2.0 (* (+ A A) (* F (* C (* A -4.0)))))))
  (- (* B B) (* (* A C) 4.0))))
B = abs(B);
assert(A < C);
double code(double A, double B, double C, double F) {
	return -sqrt((2.0 * ((A + A) * (F * (C * (A * -4.0)))))) / ((B * B) - ((A * C) * 4.0));
}
NOTE: B should be positive before calling this function
NOTE: A and C should be sorted in increasing order before calling this function.
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
    code = -sqrt((2.0d0 * ((a + a) * (f * (c * (a * (-4.0d0))))))) / ((b * b) - ((a * c) * 4.0d0))
end function
B = Math.abs(B);
assert A < C;
public static double code(double A, double B, double C, double F) {
	return -Math.sqrt((2.0 * ((A + A) * (F * (C * (A * -4.0)))))) / ((B * B) - ((A * C) * 4.0));
}
B = abs(B)
[A, C] = sort([A, C])
def code(A, B, C, F):
	return -math.sqrt((2.0 * ((A + A) * (F * (C * (A * -4.0)))))) / ((B * B) - ((A * C) * 4.0))
B = abs(B)
A, C = sort([A, C])
function code(A, B, C, F)
	return Float64(Float64(-sqrt(Float64(2.0 * Float64(Float64(A + A) * Float64(F * Float64(C * Float64(A * -4.0))))))) / Float64(Float64(B * B) - Float64(Float64(A * C) * 4.0)))
end
B = abs(B)
A, C = num2cell(sort([A, C])){:}
function tmp = code(A, B, C, F)
	tmp = -sqrt((2.0 * ((A + A) * (F * (C * (A * -4.0)))))) / ((B * B) - ((A * C) * 4.0));
end
NOTE: B should be positive before calling this function
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := N[((-N[Sqrt[N[(2.0 * N[(N[(A + A), $MachinePrecision] * N[(F * N[(C * N[(A * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(N[(B * B), $MachinePrecision] - N[(N[(A * C), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
B = |B|\\
[A, C] = \mathsf{sort}([A, C])\\
\\
\frac{-\sqrt{2 \cdot \left(\left(A + A\right) \cdot \left(F \cdot \left(C \cdot \left(A \cdot -4\right)\right)\right)\right)}}{B \cdot B - \left(A \cdot C\right) \cdot 4}
\end{array}
Derivation
  1. Initial program 17.2%

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

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

    \[\leadsto \frac{-\sqrt{2 \cdot \left(\left(\left(B \cdot B - 4 \cdot \left(A \cdot C\right)\right) \cdot F\right) \cdot \color{blue}{\left(A - -1 \cdot A\right)}\right)}}{B \cdot B - 4 \cdot \left(A \cdot C\right)} \]
  4. Step-by-step derivation
    1. cancel-sign-sub-inv15.4%

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

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

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

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

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

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

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

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

Alternative 10: 9.2% accurate, 5.9× speedup?

\[\begin{array}{l} B = |B|\\ [A, C] = \mathsf{sort}([A, C])\\ \\ -2 \cdot \frac{{\left(A \cdot F\right)}^{0.5}}{B} \end{array} \]
NOTE: B should be positive before calling this function
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F) :precision binary64 (* -2.0 (/ (pow (* A F) 0.5) B)))
B = abs(B);
assert(A < C);
double code(double A, double B, double C, double F) {
	return -2.0 * (pow((A * F), 0.5) / B);
}
NOTE: B should be positive before calling this function
NOTE: A and C should be sorted in increasing order before calling this function.
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
    code = (-2.0d0) * (((a * f) ** 0.5d0) / b)
end function
B = Math.abs(B);
assert A < C;
public static double code(double A, double B, double C, double F) {
	return -2.0 * (Math.pow((A * F), 0.5) / B);
}
B = abs(B)
[A, C] = sort([A, C])
def code(A, B, C, F):
	return -2.0 * (math.pow((A * F), 0.5) / B)
B = abs(B)
A, C = sort([A, C])
function code(A, B, C, F)
	return Float64(-2.0 * Float64((Float64(A * F) ^ 0.5) / B))
end
B = abs(B)
A, C = num2cell(sort([A, C])){:}
function tmp = code(A, B, C, F)
	tmp = -2.0 * (((A * F) ^ 0.5) / B);
end
NOTE: B should be positive before calling this function
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := N[(-2.0 * N[(N[Power[N[(A * F), $MachinePrecision], 0.5], $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
B = |B|\\
[A, C] = \mathsf{sort}([A, C])\\
\\
-2 \cdot \frac{{\left(A \cdot F\right)}^{0.5}}{B}
\end{array}
Derivation
  1. Initial program 17.2%

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

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

    \[\leadsto \frac{-\sqrt{2 \cdot \left(\left(\left(B \cdot B - 4 \cdot \left(A \cdot C\right)\right) \cdot F\right) \cdot \color{blue}{\left(A - -1 \cdot A\right)}\right)}}{B \cdot B - 4 \cdot \left(A \cdot C\right)} \]
  4. Step-by-step derivation
    1. cancel-sign-sub-inv15.4%

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

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

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

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

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

      \[\leadsto -2 \cdot \color{blue}{\frac{\sqrt{A \cdot F} \cdot 1}{B}} \]
    2. *-rgt-identity3.9%

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

    \[\leadsto \color{blue}{-2 \cdot \frac{\sqrt{A \cdot F}}{B}} \]
  9. Step-by-step derivation
    1. pow1/24.1%

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

    \[\leadsto -2 \cdot \frac{\color{blue}{{\left(A \cdot F\right)}^{0.5}}}{B} \]
  11. Final simplification4.1%

    \[\leadsto -2 \cdot \frac{{\left(A \cdot F\right)}^{0.5}}{B} \]

Alternative 11: 9.2% accurate, 5.9× speedup?

\[\begin{array}{l} B = |B|\\ [A, C] = \mathsf{sort}([A, C])\\ \\ -2 \cdot \frac{\sqrt{A \cdot F}}{B} \end{array} \]
NOTE: B should be positive before calling this function
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F) :precision binary64 (* -2.0 (/ (sqrt (* A F)) B)))
B = abs(B);
assert(A < C);
double code(double A, double B, double C, double F) {
	return -2.0 * (sqrt((A * F)) / B);
}
NOTE: B should be positive before calling this function
NOTE: A and C should be sorted in increasing order before calling this function.
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
    code = (-2.0d0) * (sqrt((a * f)) / b)
end function
B = Math.abs(B);
assert A < C;
public static double code(double A, double B, double C, double F) {
	return -2.0 * (Math.sqrt((A * F)) / B);
}
B = abs(B)
[A, C] = sort([A, C])
def code(A, B, C, F):
	return -2.0 * (math.sqrt((A * F)) / B)
B = abs(B)
A, C = sort([A, C])
function code(A, B, C, F)
	return Float64(-2.0 * Float64(sqrt(Float64(A * F)) / B))
end
B = abs(B)
A, C = num2cell(sort([A, C])){:}
function tmp = code(A, B, C, F)
	tmp = -2.0 * (sqrt((A * F)) / B);
end
NOTE: B should be positive before calling this function
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := N[(-2.0 * N[(N[Sqrt[N[(A * F), $MachinePrecision]], $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
B = |B|\\
[A, C] = \mathsf{sort}([A, C])\\
\\
-2 \cdot \frac{\sqrt{A \cdot F}}{B}
\end{array}
Derivation
  1. Initial program 17.2%

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

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

    \[\leadsto \frac{-\sqrt{2 \cdot \left(\left(\left(B \cdot B - 4 \cdot \left(A \cdot C\right)\right) \cdot F\right) \cdot \color{blue}{\left(A - -1 \cdot A\right)}\right)}}{B \cdot B - 4 \cdot \left(A \cdot C\right)} \]
  4. Step-by-step derivation
    1. cancel-sign-sub-inv15.4%

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

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

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

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

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

      \[\leadsto -2 \cdot \color{blue}{\frac{\sqrt{A \cdot F} \cdot 1}{B}} \]
    2. *-rgt-identity3.9%

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

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

    \[\leadsto -2 \cdot \frac{\sqrt{A \cdot F}}{B} \]

Reproduce

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