ABCF->ab-angle b

Percentage Accurate: 18.4% → 46.4%
Time: 25.3s
Alternatives: 11
Speedup: 2.8×

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: 18.4% 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: 46.4% accurate, 0.9× 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)\\ t_1 := -\sqrt{2}\\ t_2 := \mathsf{fma}\left(A, C \cdot -4, {B}^{2}\right)\\ \mathbf{if}\;B \leq 4.9 \cdot 10^{-115}:\\ \;\;\;\;\frac{\sqrt{t_2 \cdot \left(F \cdot \left(A \cdot 2\right)\right)} \cdot t_1}{t_2}\\ \mathbf{elif}\;B \leq 9 \cdot 10^{+36}:\\ \;\;\;\;\frac{-\sqrt{2 \cdot \left(t_0 \cdot \left(F \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)\right)}}{t_0}\\ \mathbf{elif}\;B \leq 1.28 \cdot 10^{+64}:\\ \;\;\;\;\frac{{\left(2 \cdot t_0\right)}^{0.5} \cdot \left(-\sqrt{F \cdot \left(A + \left(A + -0.5 \cdot \frac{{A}^{2} + \left({B}^{2} - {A}^{2}\right)}{C}\right)\right)}\right)}{t_0}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)} \cdot \frac{t_1}{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 (fma B B (* A (* C -4.0))))
        (t_1 (- (sqrt 2.0)))
        (t_2 (fma A (* C -4.0) (pow B 2.0))))
   (if (<= B 4.9e-115)
     (/ (* (sqrt (* t_2 (* F (* A 2.0)))) t_1) t_2)
     (if (<= B 9e+36)
       (/ (- (sqrt (* 2.0 (* t_0 (* F (+ A (- C (hypot B (- A C))))))))) t_0)
       (if (<= B 1.28e+64)
         (/
          (*
           (pow (* 2.0 t_0) 0.5)
           (-
            (sqrt
             (*
              F
              (+
               A
               (+
                A
                (*
                 -0.5
                 (/ (+ (pow A 2.0) (- (pow B 2.0) (pow A 2.0))) C))))))))
          t_0)
         (* (sqrt (* F (- A (hypot B A)))) (/ t_1 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 t_1 = -sqrt(2.0);
	double t_2 = fma(A, (C * -4.0), pow(B, 2.0));
	double tmp;
	if (B <= 4.9e-115) {
		tmp = (sqrt((t_2 * (F * (A * 2.0)))) * t_1) / t_2;
	} else if (B <= 9e+36) {
		tmp = -sqrt((2.0 * (t_0 * (F * (A + (C - hypot(B, (A - C)))))))) / t_0;
	} else if (B <= 1.28e+64) {
		tmp = (pow((2.0 * t_0), 0.5) * -sqrt((F * (A + (A + (-0.5 * ((pow(A, 2.0) + (pow(B, 2.0) - pow(A, 2.0))) / C))))))) / t_0;
	} else {
		tmp = sqrt((F * (A - hypot(B, A)))) * (t_1 / 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)))
	t_1 = Float64(-sqrt(2.0))
	t_2 = fma(A, Float64(C * -4.0), (B ^ 2.0))
	tmp = 0.0
	if (B <= 4.9e-115)
		tmp = Float64(Float64(sqrt(Float64(t_2 * Float64(F * Float64(A * 2.0)))) * t_1) / t_2);
	elseif (B <= 9e+36)
		tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(t_0 * Float64(F * Float64(A + Float64(C - hypot(B, Float64(A - C))))))))) / t_0);
	elseif (B <= 1.28e+64)
		tmp = Float64(Float64((Float64(2.0 * t_0) ^ 0.5) * Float64(-sqrt(Float64(F * Float64(A + Float64(A + Float64(-0.5 * Float64(Float64((A ^ 2.0) + Float64((B ^ 2.0) - (A ^ 2.0))) / C)))))))) / t_0);
	else
		tmp = Float64(sqrt(Float64(F * Float64(A - hypot(B, A)))) * Float64(t_1 / 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]}, Block[{t$95$1 = (-N[Sqrt[2.0], $MachinePrecision])}, Block[{t$95$2 = N[(A * N[(C * -4.0), $MachinePrecision] + N[Power[B, 2.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, 4.9e-115], N[(N[(N[Sqrt[N[(t$95$2 * N[(F * N[(A * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$1), $MachinePrecision] / t$95$2), $MachinePrecision], If[LessEqual[B, 9e+36], N[((-N[Sqrt[N[(2.0 * N[(t$95$0 * N[(F * N[(A + N[(C - N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[B, 1.28e+64], N[(N[(N[Power[N[(2.0 * t$95$0), $MachinePrecision], 0.5], $MachinePrecision] * (-N[Sqrt[N[(F * N[(A + N[(A + N[(-0.5 * N[(N[(N[Power[A, 2.0], $MachinePrecision] + N[(N[Power[B, 2.0], $MachinePrecision] - N[Power[A, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$0), $MachinePrecision], N[(N[Sqrt[N[(F * N[(A - N[Sqrt[B ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(t$95$1 / 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)\\
t_1 := -\sqrt{2}\\
t_2 := \mathsf{fma}\left(A, C \cdot -4, {B}^{2}\right)\\
\mathbf{if}\;B \leq 4.9 \cdot 10^{-115}:\\
\;\;\;\;\frac{\sqrt{t_2 \cdot \left(F \cdot \left(A \cdot 2\right)\right)} \cdot t_1}{t_2}\\

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

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

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


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

    1. Initial program 14.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. Simplified20.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 4.89999999999999989e-115 < B < 8.99999999999999994e36

    1. Initial program 38.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. Simplified45.7%

      \[\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(\left(A + C\right) - \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}} \]
    3. Step-by-step derivation
      1. associate--l+46.0%

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

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

    if 8.99999999999999994e36 < B < 1.28000000000000004e64

    1. Initial program 34.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. Simplified35.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(\left(A + C\right) - \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}} \]
    3. Step-by-step derivation
      1. pow1/235.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.28000000000000004e64 < B

    1. Initial program 9.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. Simplified9.2%

      \[\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(\left(A + C\right) - \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}} \]
    3. Taylor expanded in C around 0 12.9%

      \[\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-neg12.9%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;B \leq 4.9 \cdot 10^{-115}:\\ \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(A, C \cdot -4, {B}^{2}\right) \cdot \left(F \cdot \left(A \cdot 2\right)\right)} \cdot \left(-\sqrt{2}\right)}{\mathsf{fma}\left(A, C \cdot -4, {B}^{2}\right)}\\ \mathbf{elif}\;B \leq 9 \cdot 10^{+36}:\\ \;\;\;\;\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, A - C\right)\right)\right)\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}\\ \mathbf{elif}\;B \leq 1.28 \cdot 10^{+64}:\\ \;\;\;\;\frac{{\left(2 \cdot \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)\right)}^{0.5} \cdot \left(-\sqrt{F \cdot \left(A + \left(A + -0.5 \cdot \frac{{A}^{2} + \left({B}^{2} - {A}^{2}\right)}{C}\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(B, A\right)\right)} \cdot \frac{-\sqrt{2}}{B}\\ \end{array} \]

Alternative 2: 46.3% accurate, 1.0× 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)\\ t_1 := -\sqrt{2}\\ t_2 := \mathsf{fma}\left(B, B, -4 \cdot \left(A \cdot C\right)\right)\\ t_3 := \mathsf{fma}\left(A, C \cdot -4, {B}^{2}\right)\\ \mathbf{if}\;B \leq 4.9 \cdot 10^{-115}:\\ \;\;\;\;\frac{\sqrt{t_3 \cdot \left(F \cdot \left(A \cdot 2\right)\right)} \cdot t_1}{t_3}\\ \mathbf{elif}\;B \leq 1.02 \cdot 10^{+23}:\\ \;\;\;\;\frac{-\sqrt{2 \cdot \left(t_0 \cdot \left(F \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)\right)}}{t_0}\\ \mathbf{elif}\;B \leq 1.2 \cdot 10^{+67}:\\ \;\;\;\;\sqrt{\left(A + \left(A + -0.5 \cdot \frac{{A}^{2} + \left({B}^{2} - {A}^{2}\right)}{C}\right)\right) \cdot \left(2 \cdot \left(F \cdot t_2\right)\right)} \cdot \frac{-1}{t_2}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)} \cdot \frac{t_1}{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 (fma B B (* A (* C -4.0))))
        (t_1 (- (sqrt 2.0)))
        (t_2 (fma B B (* -4.0 (* A C))))
        (t_3 (fma A (* C -4.0) (pow B 2.0))))
   (if (<= B 4.9e-115)
     (/ (* (sqrt (* t_3 (* F (* A 2.0)))) t_1) t_3)
     (if (<= B 1.02e+23)
       (/ (- (sqrt (* 2.0 (* t_0 (* F (+ A (- C (hypot B (- A C))))))))) t_0)
       (if (<= B 1.2e+67)
         (*
          (sqrt
           (*
            (+
             A
             (+ A (* -0.5 (/ (+ (pow A 2.0) (- (pow B 2.0) (pow A 2.0))) C))))
            (* 2.0 (* F t_2))))
          (/ -1.0 t_2))
         (* (sqrt (* F (- A (hypot B A)))) (/ t_1 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 t_1 = -sqrt(2.0);
	double t_2 = fma(B, B, (-4.0 * (A * C)));
	double t_3 = fma(A, (C * -4.0), pow(B, 2.0));
	double tmp;
	if (B <= 4.9e-115) {
		tmp = (sqrt((t_3 * (F * (A * 2.0)))) * t_1) / t_3;
	} else if (B <= 1.02e+23) {
		tmp = -sqrt((2.0 * (t_0 * (F * (A + (C - hypot(B, (A - C)))))))) / t_0;
	} else if (B <= 1.2e+67) {
		tmp = sqrt(((A + (A + (-0.5 * ((pow(A, 2.0) + (pow(B, 2.0) - pow(A, 2.0))) / C)))) * (2.0 * (F * t_2)))) * (-1.0 / t_2);
	} else {
		tmp = sqrt((F * (A - hypot(B, A)))) * (t_1 / 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)))
	t_1 = Float64(-sqrt(2.0))
	t_2 = fma(B, B, Float64(-4.0 * Float64(A * C)))
	t_3 = fma(A, Float64(C * -4.0), (B ^ 2.0))
	tmp = 0.0
	if (B <= 4.9e-115)
		tmp = Float64(Float64(sqrt(Float64(t_3 * Float64(F * Float64(A * 2.0)))) * t_1) / t_3);
	elseif (B <= 1.02e+23)
		tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(t_0 * Float64(F * Float64(A + Float64(C - hypot(B, Float64(A - C))))))))) / t_0);
	elseif (B <= 1.2e+67)
		tmp = Float64(sqrt(Float64(Float64(A + Float64(A + Float64(-0.5 * Float64(Float64((A ^ 2.0) + Float64((B ^ 2.0) - (A ^ 2.0))) / C)))) * Float64(2.0 * Float64(F * t_2)))) * Float64(-1.0 / t_2));
	else
		tmp = Float64(sqrt(Float64(F * Float64(A - hypot(B, A)))) * Float64(t_1 / 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]}, Block[{t$95$1 = (-N[Sqrt[2.0], $MachinePrecision])}, Block[{t$95$2 = N[(B * B + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(A * N[(C * -4.0), $MachinePrecision] + N[Power[B, 2.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, 4.9e-115], N[(N[(N[Sqrt[N[(t$95$3 * N[(F * N[(A * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$1), $MachinePrecision] / t$95$3), $MachinePrecision], If[LessEqual[B, 1.02e+23], N[((-N[Sqrt[N[(2.0 * N[(t$95$0 * N[(F * N[(A + N[(C - N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[B, 1.2e+67], N[(N[Sqrt[N[(N[(A + N[(A + N[(-0.5 * N[(N[(N[Power[A, 2.0], $MachinePrecision] + N[(N[Power[B, 2.0], $MachinePrecision] - N[Power[A, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(2.0 * N[(F * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-1.0 / t$95$2), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(F * N[(A - N[Sqrt[B ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(t$95$1 / 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)\\
t_1 := -\sqrt{2}\\
t_2 := \mathsf{fma}\left(B, B, -4 \cdot \left(A \cdot C\right)\right)\\
t_3 := \mathsf{fma}\left(A, C \cdot -4, {B}^{2}\right)\\
\mathbf{if}\;B \leq 4.9 \cdot 10^{-115}:\\
\;\;\;\;\frac{\sqrt{t_3 \cdot \left(F \cdot \left(A \cdot 2\right)\right)} \cdot t_1}{t_3}\\

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

\mathbf{elif}\;B \leq 1.2 \cdot 10^{+67}:\\
\;\;\;\;\sqrt{\left(A + \left(A + -0.5 \cdot \frac{{A}^{2} + \left({B}^{2} - {A}^{2}\right)}{C}\right)\right) \cdot \left(2 \cdot \left(F \cdot t_2\right)\right)} \cdot \frac{-1}{t_2}\\

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


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

    1. Initial program 14.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. Simplified20.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 4.89999999999999989e-115 < B < 1.02e23

    1. Initial program 40.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. Simplified46.8%

      \[\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(\left(A + C\right) - \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}} \]
    3. Step-by-step derivation
      1. associate--l+47.2%

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

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

    if 1.02e23 < B < 1.20000000000000001e67

    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{\left(\left(2 \cdot \left({B}^{2} - 4 \cdot \left(A \cdot C\right)\right)\right) \cdot F\right) \cdot \left(\left(A + C\right) - \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right)}}{{B}^{2} - 4 \cdot \left(A \cdot C\right)}} \]
    3. Step-by-step derivation
      1. div-inv21.7%

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

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

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

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

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

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

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

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

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

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

    if 1.20000000000000001e67 < B

    1. Initial program 9.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. Simplified9.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(\left(A + C\right) - \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}} \]
    3. Taylor expanded in C around 0 13.2%

      \[\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-neg13.2%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;B \leq 4.9 \cdot 10^{-115}:\\ \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(A, C \cdot -4, {B}^{2}\right) \cdot \left(F \cdot \left(A \cdot 2\right)\right)} \cdot \left(-\sqrt{2}\right)}{\mathsf{fma}\left(A, C \cdot -4, {B}^{2}\right)}\\ \mathbf{elif}\;B \leq 1.02 \cdot 10^{+23}:\\ \;\;\;\;\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, A - C\right)\right)\right)\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}\\ \mathbf{elif}\;B \leq 1.2 \cdot 10^{+67}:\\ \;\;\;\;\sqrt{\left(A + \left(A + -0.5 \cdot \frac{{A}^{2} + \left({B}^{2} - {A}^{2}\right)}{C}\right)\right) \cdot \left(2 \cdot \left(F \cdot \mathsf{fma}\left(B, B, -4 \cdot \left(A \cdot C\right)\right)\right)\right)} \cdot \frac{-1}{\mathsf{fma}\left(B, B, -4 \cdot \left(A \cdot C\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)} \cdot \frac{-\sqrt{2}}{B}\\ \end{array} \]

Alternative 3: 47.1% accurate, 1.0× 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)\\ t_1 := -\sqrt{2}\\ t_2 := \mathsf{fma}\left(A, C \cdot -4, {B}^{2}\right)\\ \mathbf{if}\;B \leq 4.9 \cdot 10^{-115}:\\ \;\;\;\;\frac{\sqrt{t_2 \cdot \left(F \cdot \left(A \cdot 2\right)\right)} \cdot t_1}{t_2}\\ \mathbf{elif}\;B \leq 5.2 \cdot 10^{+44}:\\ \;\;\;\;\frac{-\sqrt{2 \cdot \left(t_0 \cdot \left(F \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)\right)}}{t_0}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)} \cdot \frac{t_1}{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 (fma B B (* A (* C -4.0))))
        (t_1 (- (sqrt 2.0)))
        (t_2 (fma A (* C -4.0) (pow B 2.0))))
   (if (<= B 4.9e-115)
     (/ (* (sqrt (* t_2 (* F (* A 2.0)))) t_1) t_2)
     (if (<= B 5.2e+44)
       (/ (- (sqrt (* 2.0 (* t_0 (* F (+ A (- C (hypot B (- A C))))))))) t_0)
       (* (sqrt (* F (- A (hypot B A)))) (/ t_1 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 t_1 = -sqrt(2.0);
	double t_2 = fma(A, (C * -4.0), pow(B, 2.0));
	double tmp;
	if (B <= 4.9e-115) {
		tmp = (sqrt((t_2 * (F * (A * 2.0)))) * t_1) / t_2;
	} else if (B <= 5.2e+44) {
		tmp = -sqrt((2.0 * (t_0 * (F * (A + (C - hypot(B, (A - C)))))))) / t_0;
	} else {
		tmp = sqrt((F * (A - hypot(B, A)))) * (t_1 / 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)))
	t_1 = Float64(-sqrt(2.0))
	t_2 = fma(A, Float64(C * -4.0), (B ^ 2.0))
	tmp = 0.0
	if (B <= 4.9e-115)
		tmp = Float64(Float64(sqrt(Float64(t_2 * Float64(F * Float64(A * 2.0)))) * t_1) / t_2);
	elseif (B <= 5.2e+44)
		tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(t_0 * Float64(F * Float64(A + Float64(C - hypot(B, Float64(A - C))))))))) / t_0);
	else
		tmp = Float64(sqrt(Float64(F * Float64(A - hypot(B, A)))) * Float64(t_1 / 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]}, Block[{t$95$1 = (-N[Sqrt[2.0], $MachinePrecision])}, Block[{t$95$2 = N[(A * N[(C * -4.0), $MachinePrecision] + N[Power[B, 2.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, 4.9e-115], N[(N[(N[Sqrt[N[(t$95$2 * N[(F * N[(A * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$1), $MachinePrecision] / t$95$2), $MachinePrecision], If[LessEqual[B, 5.2e+44], N[((-N[Sqrt[N[(2.0 * N[(t$95$0 * N[(F * N[(A + N[(C - N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[(N[Sqrt[N[(F * N[(A - N[Sqrt[B ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(t$95$1 / 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)\\
t_1 := -\sqrt{2}\\
t_2 := \mathsf{fma}\left(A, C \cdot -4, {B}^{2}\right)\\
\mathbf{if}\;B \leq 4.9 \cdot 10^{-115}:\\
\;\;\;\;\frac{\sqrt{t_2 \cdot \left(F \cdot \left(A \cdot 2\right)\right)} \cdot t_1}{t_2}\\

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

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


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

    1. Initial program 14.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. Simplified20.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 4.89999999999999989e-115 < B < 5.1999999999999998e44

    1. Initial program 38.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. Simplified45.7%

      \[\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(\left(A + C\right) - \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}} \]
    3. Step-by-step derivation
      1. associate--l+46.0%

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

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

    if 5.1999999999999998e44 < B

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

      \[\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(\left(A + C\right) - \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}} \]
    3. Taylor expanded in C around 0 14.3%

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;B \leq 4.9 \cdot 10^{-115}:\\ \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(A, C \cdot -4, {B}^{2}\right) \cdot \left(F \cdot \left(A \cdot 2\right)\right)} \cdot \left(-\sqrt{2}\right)}{\mathsf{fma}\left(A, C \cdot -4, {B}^{2}\right)}\\ \mathbf{elif}\;B \leq 5.2 \cdot 10^{+44}:\\ \;\;\;\;\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, A - C\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(B, A\right)\right)} \cdot \frac{-\sqrt{2}}{B}\\ \end{array} \]

Alternative 4: 47.4% accurate, 1.2× speedup?

\[\begin{array}{l} B = |B|\\ [A, C] = \mathsf{sort}([A, C])\\ \\ \begin{array}{l} \mathbf{if}\;{B}^{2} \leq 2 \cdot 10^{-8}:\\ \;\;\;\;-\frac{\sqrt{2 \cdot \left(\left(F \cdot \left({B}^{2} + -4 \cdot \left(A \cdot C\right)\right)\right) \cdot \left(A + A\right)\right)}}{\mathsf{fma}\left(A, C \cdot -4, {B}^{2}\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)} \cdot \frac{-\sqrt{2}}{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 (<= (pow B 2.0) 2e-8)
   (-
    (/
     (sqrt (* 2.0 (* (* F (+ (pow B 2.0) (* -4.0 (* A C)))) (+ A A))))
     (fma A (* C -4.0) (pow B 2.0))))
   (* (sqrt (* F (- A (hypot B A)))) (/ (- (sqrt 2.0)) B))))
B = abs(B);
assert(A < C);
double code(double A, double B, double C, double F) {
	double tmp;
	if (pow(B, 2.0) <= 2e-8) {
		tmp = -(sqrt((2.0 * ((F * (pow(B, 2.0) + (-4.0 * (A * C)))) * (A + A)))) / fma(A, (C * -4.0), pow(B, 2.0)));
	} else {
		tmp = sqrt((F * (A - hypot(B, A)))) * (-sqrt(2.0) / B);
	}
	return tmp;
}
B = abs(B)
A, C = sort([A, C])
function code(A, B, C, F)
	tmp = 0.0
	if ((B ^ 2.0) <= 2e-8)
		tmp = Float64(-Float64(sqrt(Float64(2.0 * Float64(Float64(F * Float64((B ^ 2.0) + Float64(-4.0 * Float64(A * C)))) * Float64(A + A)))) / fma(A, Float64(C * -4.0), (B ^ 2.0))));
	else
		tmp = Float64(sqrt(Float64(F * Float64(A - hypot(B, A)))) * 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_] := If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 2e-8], (-N[(N[Sqrt[N[(2.0 * N[(N[(F * N[(N[Power[B, 2.0], $MachinePrecision] + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(A + A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(A * N[(C * -4.0), $MachinePrecision] + N[Power[B, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), N[(N[Sqrt[N[(F * N[(A - N[Sqrt[B ^ 2 + A ^ 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}
\mathbf{if}\;{B}^{2} \leq 2 \cdot 10^{-8}:\\
\;\;\;\;-\frac{\sqrt{2 \cdot \left(\left(F \cdot \left({B}^{2} + -4 \cdot \left(A \cdot C\right)\right)\right) \cdot \left(A + A\right)\right)}}{\mathsf{fma}\left(A, C \cdot -4, {B}^{2}\right)}\\

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


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

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

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

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

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

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

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

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

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

    if 2e-8 < (pow.f64 B 2)

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

      \[\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(\left(A + C\right) - \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}} \]
    3. Taylor expanded in C around 0 7.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-neg7.1%

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

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

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

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

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

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

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

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

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

Alternative 5: 47.1% accurate, 1.2× 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)\\ t_1 := \mathsf{fma}\left(A, C \cdot -4, {B}^{2}\right)\\ \mathbf{if}\;B \leq 4.9 \cdot 10^{-115}:\\ \;\;\;\;\frac{-1}{\frac{t_1}{\sqrt{2 \cdot \left(t_1 \cdot \left(F \cdot \left(A \cdot 2\right)\right)\right)}}}\\ \mathbf{elif}\;B \leq 8.5 \cdot 10^{+44}:\\ \;\;\;\;\frac{-\sqrt{2 \cdot \left(t_0 \cdot \left(F \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)\right)}}{t_0}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)} \cdot \frac{-\sqrt{2}}{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 (fma B B (* A (* C -4.0)))) (t_1 (fma A (* C -4.0) (pow B 2.0))))
   (if (<= B 4.9e-115)
     (/ -1.0 (/ t_1 (sqrt (* 2.0 (* t_1 (* F (* A 2.0)))))))
     (if (<= B 8.5e+44)
       (/ (- (sqrt (* 2.0 (* t_0 (* F (+ A (- C (hypot B (- A C))))))))) t_0)
       (* (sqrt (* F (- A (hypot B A)))) (/ (- (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 t_1 = fma(A, (C * -4.0), pow(B, 2.0));
	double tmp;
	if (B <= 4.9e-115) {
		tmp = -1.0 / (t_1 / sqrt((2.0 * (t_1 * (F * (A * 2.0))))));
	} else if (B <= 8.5e+44) {
		tmp = -sqrt((2.0 * (t_0 * (F * (A + (C - hypot(B, (A - C)))))))) / t_0;
	} else {
		tmp = sqrt((F * (A - hypot(B, A)))) * (-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)))
	t_1 = fma(A, Float64(C * -4.0), (B ^ 2.0))
	tmp = 0.0
	if (B <= 4.9e-115)
		tmp = Float64(-1.0 / Float64(t_1 / sqrt(Float64(2.0 * Float64(t_1 * Float64(F * Float64(A * 2.0)))))));
	elseif (B <= 8.5e+44)
		tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(t_0 * Float64(F * Float64(A + Float64(C - hypot(B, Float64(A - C))))))))) / t_0);
	else
		tmp = Float64(sqrt(Float64(F * Float64(A - hypot(B, A)))) * 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]}, Block[{t$95$1 = N[(A * N[(C * -4.0), $MachinePrecision] + N[Power[B, 2.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, 4.9e-115], N[(-1.0 / N[(t$95$1 / N[Sqrt[N[(2.0 * N[(t$95$1 * N[(F * N[(A * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, 8.5e+44], N[((-N[Sqrt[N[(2.0 * N[(t$95$0 * N[(F * N[(A + N[(C - N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[(N[Sqrt[N[(F * N[(A - N[Sqrt[B ^ 2 + A ^ 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)\\
t_1 := \mathsf{fma}\left(A, C \cdot -4, {B}^{2}\right)\\
\mathbf{if}\;B \leq 4.9 \cdot 10^{-115}:\\
\;\;\;\;\frac{-1}{\frac{t_1}{\sqrt{2 \cdot \left(t_1 \cdot \left(F \cdot \left(A \cdot 2\right)\right)\right)}}}\\

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

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


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

    1. Initial program 14.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. Simplified20.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 4.89999999999999989e-115 < B < 8.5e44

    1. Initial program 38.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. Simplified45.7%

      \[\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(\left(A + C\right) - \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}} \]
    3. Step-by-step derivation
      1. associate--l+46.0%

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

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

    if 8.5e44 < B

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

      \[\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(\left(A + C\right) - \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}} \]
    3. Taylor expanded in C around 0 14.3%

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;B \leq 4.9 \cdot 10^{-115}:\\ \;\;\;\;\frac{-1}{\frac{\mathsf{fma}\left(A, C \cdot -4, {B}^{2}\right)}{\sqrt{2 \cdot \left(\mathsf{fma}\left(A, C \cdot -4, {B}^{2}\right) \cdot \left(F \cdot \left(A \cdot 2\right)\right)\right)}}}\\ \mathbf{elif}\;B \leq 8.5 \cdot 10^{+44}:\\ \;\;\;\;\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, A - C\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(B, A\right)\right)} \cdot \frac{-\sqrt{2}}{B}\\ \end{array} \]

Alternative 6: 47.3% accurate, 1.5× speedup?

\[\begin{array}{l} B = |B|\\ [A, C] = \mathsf{sort}([A, C])\\ \\ \begin{array}{l} t_0 := -4 \cdot \left(A \cdot C\right)\\ t_1 := \mathsf{fma}\left(B, B, t_0\right)\\ \mathbf{if}\;B \leq 4.9 \cdot 10^{-115}:\\ \;\;\;\;-\frac{\sqrt{2 \cdot \left(\left(F \cdot \left({B}^{2} + t_0\right)\right) \cdot \left(A + A\right)\right)}}{\mathsf{fma}\left(A, C \cdot -4, {B}^{2}\right)}\\ \mathbf{elif}\;B \leq 3.3 \cdot 10^{+44}:\\ \;\;\;\;\frac{-\sqrt{\left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right) \cdot \left(2 \cdot \left(F \cdot t_1\right)\right)}}{t_1}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)} \cdot \frac{-\sqrt{2}}{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 (* -4.0 (* A C))) (t_1 (fma B B t_0)))
   (if (<= B 4.9e-115)
     (-
      (/
       (sqrt (* 2.0 (* (* F (+ (pow B 2.0) t_0)) (+ A A))))
       (fma A (* C -4.0) (pow B 2.0))))
     (if (<= B 3.3e+44)
       (/ (- (sqrt (* (+ A (- C (hypot B (- A C)))) (* 2.0 (* F t_1))))) t_1)
       (* (sqrt (* F (- A (hypot B A)))) (/ (- (sqrt 2.0)) B))))))
B = abs(B);
assert(A < C);
double code(double A, double B, double C, double F) {
	double t_0 = -4.0 * (A * C);
	double t_1 = fma(B, B, t_0);
	double tmp;
	if (B <= 4.9e-115) {
		tmp = -(sqrt((2.0 * ((F * (pow(B, 2.0) + t_0)) * (A + A)))) / fma(A, (C * -4.0), pow(B, 2.0)));
	} else if (B <= 3.3e+44) {
		tmp = -sqrt(((A + (C - hypot(B, (A - C)))) * (2.0 * (F * t_1)))) / t_1;
	} else {
		tmp = sqrt((F * (A - hypot(B, A)))) * (-sqrt(2.0) / B);
	}
	return tmp;
}
B = abs(B)
A, C = sort([A, C])
function code(A, B, C, F)
	t_0 = Float64(-4.0 * Float64(A * C))
	t_1 = fma(B, B, t_0)
	tmp = 0.0
	if (B <= 4.9e-115)
		tmp = Float64(-Float64(sqrt(Float64(2.0 * Float64(Float64(F * Float64((B ^ 2.0) + t_0)) * Float64(A + A)))) / fma(A, Float64(C * -4.0), (B ^ 2.0))));
	elseif (B <= 3.3e+44)
		tmp = Float64(Float64(-sqrt(Float64(Float64(A + Float64(C - hypot(B, Float64(A - C)))) * Float64(2.0 * Float64(F * t_1))))) / t_1);
	else
		tmp = Float64(sqrt(Float64(F * Float64(A - hypot(B, A)))) * 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[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(B * B + t$95$0), $MachinePrecision]}, If[LessEqual[B, 4.9e-115], (-N[(N[Sqrt[N[(2.0 * N[(N[(F * N[(N[Power[B, 2.0], $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision] * N[(A + A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(A * N[(C * -4.0), $MachinePrecision] + N[Power[B, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), If[LessEqual[B, 3.3e+44], N[((-N[Sqrt[N[(N[(A + N[(C - N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(2.0 * N[(F * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], N[(N[Sqrt[N[(F * N[(A - N[Sqrt[B ^ 2 + A ^ 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 := -4 \cdot \left(A \cdot C\right)\\
t_1 := \mathsf{fma}\left(B, B, t_0\right)\\
\mathbf{if}\;B \leq 4.9 \cdot 10^{-115}:\\
\;\;\;\;-\frac{\sqrt{2 \cdot \left(\left(F \cdot \left({B}^{2} + t_0\right)\right) \cdot \left(A + A\right)\right)}}{\mathsf{fma}\left(A, C \cdot -4, {B}^{2}\right)}\\

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

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


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

    1. Initial program 14.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. Simplified20.9%

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

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

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

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

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

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

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

    if 4.89999999999999989e-115 < B < 3.30000000000000013e44

    1. Initial program 38.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. Simplified38.7%

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

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

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

    if 3.30000000000000013e44 < B

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

      \[\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(\left(A + C\right) - \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}} \]
    3. Taylor expanded in C around 0 14.3%

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

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

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

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

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

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

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

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

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

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

Alternative 7: 47.2% 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 \leq 4.9 \cdot 10^{-115}:\\ \;\;\;\;-\frac{\sqrt{2 \cdot \left(\left(F \cdot \left({B}^{2} + -4 \cdot \left(A \cdot C\right)\right)\right) \cdot \left(A + A\right)\right)}}{\mathsf{fma}\left(A, C \cdot -4, {B}^{2}\right)}\\ \mathbf{elif}\;B \leq 7.6 \cdot 10^{+44}:\\ \;\;\;\;\frac{-\sqrt{2 \cdot \left(t_0 \cdot \left(F \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)\right)}}{t_0}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)} \cdot \frac{-\sqrt{2}}{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 (fma B B (* A (* C -4.0)))))
   (if (<= B 4.9e-115)
     (-
      (/
       (sqrt (* 2.0 (* (* F (+ (pow B 2.0) (* -4.0 (* A C)))) (+ A A))))
       (fma A (* C -4.0) (pow B 2.0))))
     (if (<= B 7.6e+44)
       (/ (- (sqrt (* 2.0 (* t_0 (* F (+ A (- C (hypot B (- A C))))))))) t_0)
       (* (sqrt (* F (- A (hypot B A)))) (/ (- (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 (B <= 4.9e-115) {
		tmp = -(sqrt((2.0 * ((F * (pow(B, 2.0) + (-4.0 * (A * C)))) * (A + A)))) / fma(A, (C * -4.0), pow(B, 2.0)));
	} else if (B <= 7.6e+44) {
		tmp = -sqrt((2.0 * (t_0 * (F * (A + (C - hypot(B, (A - C)))))))) / t_0;
	} else {
		tmp = sqrt((F * (A - hypot(B, A)))) * (-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 <= 4.9e-115)
		tmp = Float64(-Float64(sqrt(Float64(2.0 * Float64(Float64(F * Float64((B ^ 2.0) + Float64(-4.0 * Float64(A * C)))) * Float64(A + A)))) / fma(A, Float64(C * -4.0), (B ^ 2.0))));
	elseif (B <= 7.6e+44)
		tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(t_0 * Float64(F * Float64(A + Float64(C - hypot(B, Float64(A - C))))))))) / t_0);
	else
		tmp = Float64(sqrt(Float64(F * Float64(A - hypot(B, A)))) * 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[B, 4.9e-115], (-N[(N[Sqrt[N[(2.0 * N[(N[(F * N[(N[Power[B, 2.0], $MachinePrecision] + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(A + A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(A * N[(C * -4.0), $MachinePrecision] + N[Power[B, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), If[LessEqual[B, 7.6e+44], N[((-N[Sqrt[N[(2.0 * N[(t$95$0 * N[(F * N[(A + N[(C - N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[(N[Sqrt[N[(F * N[(A - N[Sqrt[B ^ 2 + A ^ 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 \leq 4.9 \cdot 10^{-115}:\\
\;\;\;\;-\frac{\sqrt{2 \cdot \left(\left(F \cdot \left({B}^{2} + -4 \cdot \left(A \cdot C\right)\right)\right) \cdot \left(A + A\right)\right)}}{\mathsf{fma}\left(A, C \cdot -4, {B}^{2}\right)}\\

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

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


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

    1. Initial program 14.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. Simplified20.9%

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

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

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

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

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

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

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

    if 4.89999999999999989e-115 < B < 7.6000000000000004e44

    1. Initial program 38.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. Simplified45.7%

      \[\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(\left(A + C\right) - \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}} \]
    3. Step-by-step derivation
      1. associate--l+46.0%

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

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

    if 7.6000000000000004e44 < B

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

      \[\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(\left(A + C\right) - \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}} \]
    3. Taylor expanded in C around 0 14.3%

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;B \leq 4.9 \cdot 10^{-115}:\\ \;\;\;\;-\frac{\sqrt{2 \cdot \left(\left(F \cdot \left({B}^{2} + -4 \cdot \left(A \cdot C\right)\right)\right) \cdot \left(A + A\right)\right)}}{\mathsf{fma}\left(A, C \cdot -4, {B}^{2}\right)}\\ \mathbf{elif}\;B \leq 7.6 \cdot 10^{+44}:\\ \;\;\;\;\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, A - C\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(B, A\right)\right)} \cdot \frac{-\sqrt{2}}{B}\\ \end{array} \]

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

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


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

    1. Initial program 23.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. Simplified23.0%

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

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

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

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

    if 2e-8 < (pow.f64 B 2)

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

      \[\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(\left(A + C\right) - \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}} \]
    3. Taylor expanded in C around 0 7.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-neg7.1%

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

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

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

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

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

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

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

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

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

Alternative 9: 44.0% accurate, 1.5× speedup?

\[\begin{array}{l} B = |B|\\ [A, C] = \mathsf{sort}([A, C])\\ \\ \begin{array}{l} \mathbf{if}\;{B}^{2} \leq 3 \cdot 10^{-217}:\\ \;\;\;\;\frac{-\sqrt{2 \cdot \left(-4 \cdot \left(A \cdot \left(C \cdot \left(F \cdot \left(A + 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(B, A\right)\right)} \cdot \frac{-\sqrt{2}}{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 (<= (pow B 2.0) 3e-217)
   (/
    (- (sqrt (* 2.0 (* -4.0 (* A (* C (* F (+ A A))))))))
    (fma B B (* A (* C -4.0))))
   (* (sqrt (* F (- A (hypot B A)))) (/ (- (sqrt 2.0)) B))))
B = abs(B);
assert(A < C);
double code(double A, double B, double C, double F) {
	double tmp;
	if (pow(B, 2.0) <= 3e-217) {
		tmp = -sqrt((2.0 * (-4.0 * (A * (C * (F * (A + A))))))) / fma(B, B, (A * (C * -4.0)));
	} else {
		tmp = sqrt((F * (A - hypot(B, A)))) * (-sqrt(2.0) / B);
	}
	return tmp;
}
B = abs(B)
A, C = sort([A, C])
function code(A, B, C, F)
	tmp = 0.0
	if ((B ^ 2.0) <= 3e-217)
		tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(-4.0 * Float64(A * Float64(C * Float64(F * Float64(A + A)))))))) / fma(B, B, Float64(A * Float64(C * -4.0))));
	else
		tmp = Float64(sqrt(Float64(F * Float64(A - hypot(B, A)))) * 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_] := If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 3e-217], N[((-N[Sqrt[N[(2.0 * N[(-4.0 * N[(A * N[(C * N[(F * N[(A + A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(B * B + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(F * N[(A - N[Sqrt[B ^ 2 + A ^ 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}
\mathbf{if}\;{B}^{2} \leq 3 \cdot 10^{-217}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(-4 \cdot \left(A \cdot \left(C \cdot \left(F \cdot \left(A + 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(B, A\right)\right)} \cdot \frac{-\sqrt{2}}{B}\\


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

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

      \[\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(\left(A + C\right) - \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}} \]
    3. Taylor expanded in B around 0 22.0%

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

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

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

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

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

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

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

    if 3.00000000000000004e-217 < (pow.f64 B 2)

    1. Initial program 18.4%

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

      \[\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(\left(A + C\right) - \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}} \]
    3. Taylor expanded in C around 0 8.9%

      \[\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-neg8.9%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;{B}^{2} \leq 3 \cdot 10^{-217}:\\ \;\;\;\;\frac{-\sqrt{2 \cdot \left(-4 \cdot \left(A \cdot \left(C \cdot \left(F \cdot \left(A + 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(B, A\right)\right)} \cdot \frac{-\sqrt{2}}{B}\\ \end{array} \]

Alternative 10: 26.1% accurate, 2.8× speedup?

\[\begin{array}{l} B = |B|\\ [A, C] = \mathsf{sort}([A, C])\\ \\ \begin{array}{l} \mathbf{if}\;B \leq 4.6 \cdot 10^{+55}:\\ \;\;\;\;\frac{-\sqrt{2 \cdot \left(-4 \cdot \left(A \cdot \left(C \cdot \left(F \cdot \left(A + A\right)\right)\right)\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;2 \cdot \left(\sqrt{A \cdot F} \cdot \frac{-1}{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
 (if (<= B 4.6e+55)
   (/
    (- (sqrt (* 2.0 (* -4.0 (* A (* C (* F (+ A A))))))))
    (fma B B (* A (* C -4.0))))
   (* 2.0 (* (sqrt (* A F)) (/ -1.0 B)))))
B = abs(B);
assert(A < C);
double code(double A, double B, double C, double F) {
	double tmp;
	if (B <= 4.6e+55) {
		tmp = -sqrt((2.0 * (-4.0 * (A * (C * (F * (A + A))))))) / fma(B, B, (A * (C * -4.0)));
	} else {
		tmp = 2.0 * (sqrt((A * F)) * (-1.0 / B));
	}
	return tmp;
}
B = abs(B)
A, C = sort([A, C])
function code(A, B, C, F)
	tmp = 0.0
	if (B <= 4.6e+55)
		tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(-4.0 * Float64(A * Float64(C * Float64(F * Float64(A + A)))))))) / fma(B, B, Float64(A * Float64(C * -4.0))));
	else
		tmp = Float64(2.0 * Float64(sqrt(Float64(A * F)) * Float64(-1.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_] := If[LessEqual[B, 4.6e+55], N[((-N[Sqrt[N[(2.0 * N[(-4.0 * N[(A * N[(C * N[(F * N[(A + A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(B * B + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(N[Sqrt[N[(A * F), $MachinePrecision]], $MachinePrecision] * N[(-1.0 / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
B = |B|\\
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
\mathbf{if}\;B \leq 4.6 \cdot 10^{+55}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(-4 \cdot \left(A \cdot \left(C \cdot \left(F \cdot \left(A + A\right)\right)\right)\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}\\

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


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

    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. Simplified24.2%

      \[\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(\left(A + C\right) - \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}} \]
    3. Taylor expanded in B around 0 14.7%

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

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

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

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

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

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

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

    if 4.59999999999999975e55 < B

    1. Initial program 10.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. Simplified11.0%

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

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

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

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

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

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

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

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

Alternative 11: 8.8% accurate, 5.8× speedup?

\[\begin{array}{l} B = |B|\\ [A, C] = \mathsf{sort}([A, C])\\ \\ 2 \cdot \left(\sqrt{A \cdot F} \cdot \frac{-1}{B}\right) \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)) (/ -1.0 B))))
B = abs(B);
assert(A < C);
double code(double A, double B, double C, double F) {
	return 2.0 * (sqrt((A * F)) * (-1.0 / 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)) * ((-1.0d0) / 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)) * (-1.0 / B));
}
B = abs(B)
[A, C] = sort([A, C])
def code(A, B, C, F):
	return 2.0 * (math.sqrt((A * F)) * (-1.0 / B))
B = abs(B)
A, C = sort([A, C])
function code(A, B, C, F)
	return Float64(2.0 * Float64(sqrt(Float64(A * F)) * Float64(-1.0 / B)))
end
B = abs(B)
A, C = num2cell(sort([A, C])){:}
function tmp = code(A, B, C, F)
	tmp = 2.0 * (sqrt((A * F)) * (-1.0 / 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] * N[(-1.0 / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
B = |B|\\
[A, C] = \mathsf{sort}([A, C])\\
\\
2 \cdot \left(\sqrt{A \cdot F} \cdot \frac{-1}{B}\right)
\end{array}
Derivation
  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. Simplified21.9%

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

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

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

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

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

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

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

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

Reproduce

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