ABCF->ab-angle a

Percentage Accurate: 18.7% → 61.0%
Time: 59.1s
Alternatives: 21
Speedup: 6.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 21 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.7% 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: 61.0% accurate, 0.2× speedup?

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

\mathbf{elif}\;t\_4 \leq -5 \cdot 10^{-179}:\\
\;\;\;\;\frac{\sqrt{\left(F \cdot t\_0\right) \cdot \left(2 \cdot t\_1\right)}}{t\_2}\\

\mathbf{elif}\;t\_4 \leq \infty:\\
\;\;\;\;\frac{\sqrt{t\_0 \cdot \left(2 \cdot F\right)} \cdot \sqrt{\mathsf{fma}\left(C, 2, -0.5 \cdot \frac{{B\_m}^{2}}{A}\right)}}{t\_2}\\

\mathbf{else}:\\
\;\;\;\;\left(\sqrt{C + \mathsf{hypot}\left(B\_m, C\right)} \cdot \sqrt{F}\right) \cdot \frac{-1}{B\_m \cdot {2}^{-0.5}}\\


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

    1. Initial program 3.3%

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

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

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

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

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

    1. Initial program 96.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. Simplified96.9%

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

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

    1. Initial program 19.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 0.0%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto -\frac{\sqrt{2}}{B} \cdot \color{blue}{\left(\sqrt{C + \mathsf{hypot}\left(B, C\right)} \cdot \sqrt{F}\right)} \]
    8. Step-by-step derivation
      1. clear-num29.5%

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

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

      \[\leadsto -\color{blue}{{\left(\frac{B}{\sqrt{2}}\right)}^{-1}} \cdot \left(\sqrt{C + \mathsf{hypot}\left(B, C\right)} \cdot \sqrt{F}\right) \]
    10. Step-by-step derivation
      1. unpow-129.5%

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

      \[\leadsto -\color{blue}{\frac{1}{\frac{B}{\sqrt{2}}}} \cdot \left(\sqrt{C + \mathsf{hypot}\left(B, C\right)} \cdot \sqrt{F}\right) \]
    12. Step-by-step derivation
      1. div-inv29.5%

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

        \[\leadsto -\frac{1}{B \cdot \frac{1}{\color{blue}{{2}^{0.5}}}} \cdot \left(\sqrt{C + \mathsf{hypot}\left(B, C\right)} \cdot \sqrt{F}\right) \]
      3. pow-flip29.6%

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

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

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

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

Alternative 2: 57.7% accurate, 0.9× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\left(\sqrt{C + \mathsf{hypot}\left(B\_m, C\right)} \cdot \sqrt{F}\right) \cdot \frac{-1}{B\_m \cdot {2}^{-0.5}}\\


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

    1. Initial program 19.7%

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

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

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

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

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

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

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

    if 0.0 < (pow.f64 B #s(literal 2 binary64)) < 2.0000000000000001e69

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.0000000000000001e69 < (pow.f64 B #s(literal 2 binary64))

    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. Add Preprocessing
    3. Taylor expanded in A around 0 8.9%

      \[\leadsto \color{blue}{-1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(C + \sqrt{{B}^{2} + {C}^{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(C + \sqrt{{B}^{2} + {C}^{2}}\right)}} \]
      2. unpow28.9%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -\color{blue}{\frac{1}{\frac{B}{\sqrt{2}}}} \cdot \left(\sqrt{C + \mathsf{hypot}\left(B, C\right)} \cdot \sqrt{F}\right) \]
      2. inv-pow38.7%

        \[\leadsto -\color{blue}{{\left(\frac{B}{\sqrt{2}}\right)}^{-1}} \cdot \left(\sqrt{C + \mathsf{hypot}\left(B, C\right)} \cdot \sqrt{F}\right) \]
    9. Applied egg-rr38.7%

      \[\leadsto -\color{blue}{{\left(\frac{B}{\sqrt{2}}\right)}^{-1}} \cdot \left(\sqrt{C + \mathsf{hypot}\left(B, C\right)} \cdot \sqrt{F}\right) \]
    10. Step-by-step derivation
      1. unpow-138.7%

        \[\leadsto -\color{blue}{\frac{1}{\frac{B}{\sqrt{2}}}} \cdot \left(\sqrt{C + \mathsf{hypot}\left(B, C\right)} \cdot \sqrt{F}\right) \]
    11. Simplified38.7%

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

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

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

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

        \[\leadsto -\frac{1}{B \cdot {2}^{\color{blue}{-0.5}}} \cdot \left(\sqrt{C + \mathsf{hypot}\left(B, C\right)} \cdot \sqrt{F}\right) \]
    13. Applied egg-rr38.8%

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

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

Alternative 3: 57.7% accurate, 0.9× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\left(\sqrt{C + \mathsf{hypot}\left(B\_m, C\right)} \cdot \sqrt{F}\right) \cdot \frac{-1}{B\_m \cdot {2}^{-0.5}}\\


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

    1. Initial program 19.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 0.0 < (pow.f64 B #s(literal 2 binary64)) < 2.0000000000000001e69

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.0000000000000001e69 < (pow.f64 B #s(literal 2 binary64))

    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. Add Preprocessing
    3. Taylor expanded in A around 0 8.9%

      \[\leadsto \color{blue}{-1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(C + \sqrt{{B}^{2} + {C}^{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(C + \sqrt{{B}^{2} + {C}^{2}}\right)}} \]
      2. unpow28.9%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -\color{blue}{\frac{1}{\frac{B}{\sqrt{2}}}} \cdot \left(\sqrt{C + \mathsf{hypot}\left(B, C\right)} \cdot \sqrt{F}\right) \]
      2. inv-pow38.7%

        \[\leadsto -\color{blue}{{\left(\frac{B}{\sqrt{2}}\right)}^{-1}} \cdot \left(\sqrt{C + \mathsf{hypot}\left(B, C\right)} \cdot \sqrt{F}\right) \]
    9. Applied egg-rr38.7%

      \[\leadsto -\color{blue}{{\left(\frac{B}{\sqrt{2}}\right)}^{-1}} \cdot \left(\sqrt{C + \mathsf{hypot}\left(B, C\right)} \cdot \sqrt{F}\right) \]
    10. Step-by-step derivation
      1. unpow-138.7%

        \[\leadsto -\color{blue}{\frac{1}{\frac{B}{\sqrt{2}}}} \cdot \left(\sqrt{C + \mathsf{hypot}\left(B, C\right)} \cdot \sqrt{F}\right) \]
    11. Simplified38.7%

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

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

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

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

        \[\leadsto -\frac{1}{B \cdot {2}^{\color{blue}{-0.5}}} \cdot \left(\sqrt{C + \mathsf{hypot}\left(B, C\right)} \cdot \sqrt{F}\right) \]
    13. Applied egg-rr38.8%

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

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

Alternative 4: 43.6% accurate, 0.9× speedup?

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

\mathbf{elif}\;{B\_m}^{2} \leq 1:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;{B\_m}^{2} \leq 2 \cdot 10^{+69}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;{B\_m}^{2} \leq 5 \cdot 10^{+151}:\\
\;\;\;\;t\_1\\

\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(\sqrt{F} \cdot \left(-\sqrt{B\_m + C}\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (pow.f64 B #s(literal 2 binary64)) < 1.9999999999999999e-234 or 1 < (pow.f64 B #s(literal 2 binary64)) < 2.0000000000000001e69

    1. Initial program 22.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. Simplified31.5%

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

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

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

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

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

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

    if 1.9999999999999999e-234 < (pow.f64 B #s(literal 2 binary64)) < 1 or 2.0000000000000001e69 < (pow.f64 B #s(literal 2 binary64)) < 5.0000000000000002e151

    1. Initial program 32.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.0000000000000002e151 < (pow.f64 B #s(literal 2 binary64))

    1. Initial program 8.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 43.6% accurate, 0.9× speedup?

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

\mathbf{elif}\;{B\_m}^{2} \leq 1:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;{B\_m}^{2} \leq 2 \cdot 10^{+69}:\\
\;\;\;\;\frac{\sqrt{-16 \cdot \left(A \cdot t\_0\right)}}{t\_1}\\

\mathbf{elif}\;{B\_m}^{2} \leq 5 \cdot 10^{+151}:\\
\;\;\;\;t\_2\\

\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(\sqrt{F} \cdot \left(-\sqrt{B\_m + C}\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (pow.f64 B #s(literal 2 binary64)) < 1.9999999999999999e-234

    1. Initial program 20.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. Simplified30.2%

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

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

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

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

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

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

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

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

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

    if 1.9999999999999999e-234 < (pow.f64 B #s(literal 2 binary64)) < 1 or 2.0000000000000001e69 < (pow.f64 B #s(literal 2 binary64)) < 5.0000000000000002e151

    1. Initial program 32.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 41.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. Simplified43.0%

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

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

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

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

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

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

    if 5.0000000000000002e151 < (pow.f64 B #s(literal 2 binary64))

    1. Initial program 8.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 55.1% accurate, 1.2× speedup?

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

\mathbf{elif}\;B\_m \leq 6.5 \cdot 10^{-194}:\\
\;\;\;\;\sqrt{F \cdot \frac{\mathsf{fma}\left(2, C, t\_1\right)}{\mathsf{fma}\left(B\_m, B\_m, -4 \cdot \left(A \cdot C\right)\right)}} \cdot \left(-\sqrt{2}\right)\\

\mathbf{elif}\;B\_m \leq 5.5 \cdot 10^{-85}:\\
\;\;\;\;\frac{\sqrt{\left(2 \cdot \left(\left({B\_m}^{2} - t\_0\right) \cdot F\right)\right) \cdot \left(2 \cdot C\right)}}{t\_0 - {B\_m}^{2}}\\

\mathbf{else}:\\
\;\;\;\;\left(\sqrt{C + \mathsf{hypot}\left(B\_m, C\right)} \cdot \sqrt{F}\right) \cdot \frac{-1}{B\_m \cdot {2}^{-0.5}}\\


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

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

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

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

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

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

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

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

    if 1.95e-222 < B < 6.50000000000000019e-194

    1. Initial program 17.6%

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{F \cdot \frac{\mathsf{fma}\left(2, C, -0.5 \cdot \frac{{B}^{2}}{A}\right)}{\color{blue}{\mathsf{fma}\left(B, B, -4 \cdot \left(A \cdot C\right)\right)}}} \cdot \left(-\sqrt{2}\right) \]
      8. distribute-lft-neg-in16.9%

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

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

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

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

    if 6.50000000000000019e-194 < B < 5.4999999999999997e-85

    1. Initial program 15.8%

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

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

    if 5.4999999999999997e-85 < B

    1. Initial program 23.6%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto -\frac{\sqrt{2}}{B} \cdot \color{blue}{\left(\sqrt{C + \mathsf{hypot}\left(B, C\right)} \cdot \sqrt{F}\right)} \]
    8. Step-by-step derivation
      1. clear-num66.5%

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

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

      \[\leadsto -\color{blue}{{\left(\frac{B}{\sqrt{2}}\right)}^{-1}} \cdot \left(\sqrt{C + \mathsf{hypot}\left(B, C\right)} \cdot \sqrt{F}\right) \]
    10. Step-by-step derivation
      1. unpow-166.5%

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

      \[\leadsto -\color{blue}{\frac{1}{\frac{B}{\sqrt{2}}}} \cdot \left(\sqrt{C + \mathsf{hypot}\left(B, C\right)} \cdot \sqrt{F}\right) \]
    12. Step-by-step derivation
      1. div-inv66.5%

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

        \[\leadsto -\frac{1}{B \cdot \frac{1}{\color{blue}{{2}^{0.5}}}} \cdot \left(\sqrt{C + \mathsf{hypot}\left(B, C\right)} \cdot \sqrt{F}\right) \]
      3. pow-flip66.7%

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

        \[\leadsto -\frac{1}{B \cdot {2}^{\color{blue}{-0.5}}} \cdot \left(\sqrt{C + \mathsf{hypot}\left(B, C\right)} \cdot \sqrt{F}\right) \]
    13. Applied egg-rr66.7%

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

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

Alternative 7: 55.5% accurate, 1.2× speedup?

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

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

\mathbf{elif}\;B\_m \leq 6.6 \cdot 10^{+36}:\\
\;\;\;\;\frac{\sqrt{t\_3 \cdot \left(-0.5 \cdot \frac{{B\_m}^{2}}{A} + 2 \cdot C\right)}}{t\_1}\\

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

\mathbf{else}:\\
\;\;\;\;\left(\sqrt{t\_2} \cdot \sqrt{F}\right) \cdot \frac{-1}{B\_m \cdot {2}^{-0.5}}\\


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

    1. Initial program 17.2%

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

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

    if 4.90000000000000015e-85 < B < 1.74999999999999992e-7

    1. Initial program 55.5%

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

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

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

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

    if 1.74999999999999992e-7 < B < 6.5999999999999997e36

    1. Initial program 33.9%

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

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

    if 6.5999999999999997e36 < B < 1.60000000000000005e84

    1. Initial program 50.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. Simplified66.7%

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

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

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

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

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

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

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

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

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

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

    if 1.60000000000000005e84 < B

    1. Initial program 8.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto -\color{blue}{{\left(\frac{B}{\sqrt{2}}\right)}^{-1}} \cdot \left(\sqrt{C + \mathsf{hypot}\left(B, C\right)} \cdot \sqrt{F}\right) \]
    10. Step-by-step derivation
      1. unpow-176.2%

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

      \[\leadsto -\color{blue}{\frac{1}{\frac{B}{\sqrt{2}}}} \cdot \left(\sqrt{C + \mathsf{hypot}\left(B, C\right)} \cdot \sqrt{F}\right) \]
    12. Step-by-step derivation
      1. div-inv76.1%

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

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

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

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

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

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

Alternative 8: 43.0% accurate, 1.2× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(\sqrt{F} \cdot \left(-\sqrt{B\_m + C}\right)\right)\\


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

    1. Initial program 20.4%

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

      \[\leadsto \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) + \color{blue}{C \cdot \left(1 + -1 \cdot \frac{A}{C}\right)}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    4. Step-by-step derivation
      1. associate-*r/14.8%

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

        \[\leadsto \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) + C \cdot \left(1 + \frac{\color{blue}{-A}}{C}\right)\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    5. Simplified14.8%

      \[\leadsto \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) + \color{blue}{C \cdot \left(1 + \frac{-A}{C}\right)}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    6. Taylor expanded in B around 0 13.8%

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

    if 1.9999999999999999e-234 < (pow.f64 B #s(literal 2 binary64)) < 5.0000000000000002e151

    1. Initial program 33.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.0000000000000002e151 < (pow.f64 B #s(literal 2 binary64))

    1. Initial program 8.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 42.5% accurate, 1.2× speedup?

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

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

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


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

    1. Initial program 20.4%

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

      \[\leadsto \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) + \color{blue}{C \cdot \left(1 + -1 \cdot \frac{A}{C}\right)}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    4. Step-by-step derivation
      1. associate-*r/14.8%

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

        \[\leadsto \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) + C \cdot \left(1 + \frac{\color{blue}{-A}}{C}\right)\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    5. Simplified14.8%

      \[\leadsto \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) + \color{blue}{C \cdot \left(1 + \frac{-A}{C}\right)}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    6. Taylor expanded in B around 0 13.8%

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

    if 1.9999999999999999e-234 < (pow.f64 B #s(literal 2 binary64)) < 5.0000000000000002e151

    1. Initial program 33.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.0000000000000002e151 < (pow.f64 B #s(literal 2 binary64))

    1. Initial program 8.1%

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

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

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

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

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

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

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

Alternative 10: 55.7% accurate, 1.5× speedup?

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

\mathbf{else}:\\
\;\;\;\;\left(\sqrt{C + \mathsf{hypot}\left(B\_m, C\right)} \cdot \sqrt{F}\right) \cdot \frac{-1}{B\_m \cdot {2}^{-0.5}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if B < 9.00000000000000008e-85

    1. Initial program 17.2%

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

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

    if 9.00000000000000008e-85 < B

    1. Initial program 23.6%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto -\frac{\sqrt{2}}{B} \cdot \color{blue}{\left(\sqrt{C + \mathsf{hypot}\left(B, C\right)} \cdot \sqrt{F}\right)} \]
    8. Step-by-step derivation
      1. clear-num66.5%

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

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

      \[\leadsto -\color{blue}{{\left(\frac{B}{\sqrt{2}}\right)}^{-1}} \cdot \left(\sqrt{C + \mathsf{hypot}\left(B, C\right)} \cdot \sqrt{F}\right) \]
    10. Step-by-step derivation
      1. unpow-166.5%

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

      \[\leadsto -\color{blue}{\frac{1}{\frac{B}{\sqrt{2}}}} \cdot \left(\sqrt{C + \mathsf{hypot}\left(B, C\right)} \cdot \sqrt{F}\right) \]
    12. Step-by-step derivation
      1. div-inv66.5%

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

        \[\leadsto -\frac{1}{B \cdot \frac{1}{\color{blue}{{2}^{0.5}}}} \cdot \left(\sqrt{C + \mathsf{hypot}\left(B, C\right)} \cdot \sqrt{F}\right) \]
      3. pow-flip66.7%

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

        \[\leadsto -\frac{1}{B \cdot {2}^{\color{blue}{-0.5}}} \cdot \left(\sqrt{C + \mathsf{hypot}\left(B, C\right)} \cdot \sqrt{F}\right) \]
    13. Applied egg-rr66.7%

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

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

Alternative 11: 55.7% accurate, 1.5× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if B < 9.00000000000000008e-85

    1. Initial program 17.2%

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

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

    if 9.00000000000000008e-85 < B

    1. Initial program 23.6%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto -\frac{\sqrt{2}}{B} \cdot \color{blue}{\left(\sqrt{C + \mathsf{hypot}\left(B, C\right)} \cdot \sqrt{F}\right)} \]
    8. Step-by-step derivation
      1. clear-num66.5%

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

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

      \[\leadsto -\color{blue}{{\left(\frac{B}{\sqrt{2}}\right)}^{-1}} \cdot \left(\sqrt{C + \mathsf{hypot}\left(B, C\right)} \cdot \sqrt{F}\right) \]
    10. Step-by-step derivation
      1. unpow-166.5%

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

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

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

Alternative 12: 55.7% accurate, 1.5× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if B < 9.00000000000000008e-85

    1. Initial program 17.2%

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

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

    if 9.00000000000000008e-85 < B

    1. Initial program 23.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 13: 50.6% accurate, 1.9× speedup?

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

\mathbf{elif}\;B\_m \leq 6.6:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;B\_m \leq 8.5 \cdot 10^{+34}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;B\_m \leq 1.9 \cdot 10^{+76}:\\
\;\;\;\;t\_2\\

\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(\sqrt{F} \cdot \left(-\sqrt{B\_m + C}\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if B < 9.00000000000000008e-85 or 6.5999999999999996 < B < 8.5000000000000003e34

    1. Initial program 17.9%

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

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

    if 9.00000000000000008e-85 < B < 6.5999999999999996 or 8.5000000000000003e34 < B < 1.90000000000000012e76

    1. Initial program 49.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.90000000000000012e76 < B

    1. Initial program 10.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;B \leq 9 \cdot 10^{-85}:\\ \;\;\;\;\frac{\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(2 \cdot C\right)}}{\left(4 \cdot A\right) \cdot C - {B}^{2}}\\ \mathbf{elif}\;B \leq 6.6:\\ \;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot \left(C + \mathsf{hypot}\left(B, C\right)\right)\right)}}{-B}\\ \mathbf{elif}\;B \leq 8.5 \cdot 10^{+34}:\\ \;\;\;\;\frac{\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(2 \cdot C\right)}}{\left(4 \cdot A\right) \cdot C - {B}^{2}}\\ \mathbf{elif}\;B \leq 1.9 \cdot 10^{+76}:\\ \;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot \left(C + \mathsf{hypot}\left(B, C\right)\right)\right)}}{-B}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(\sqrt{F} \cdot \left(-\sqrt{B + C}\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 14: 43.2% accurate, 2.7× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if F < -3.8499999999999998e-286

    1. Initial program 31.4%

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

      \[\leadsto \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) + \color{blue}{C \cdot \left(1 + -1 \cdot \frac{A}{C}\right)}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    4. Step-by-step derivation
      1. associate-*r/22.6%

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

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

      \[\leadsto \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) + \color{blue}{C \cdot \left(1 + \frac{-A}{C}\right)}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    6. Taylor expanded in B around 0 19.7%

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

    if -3.8499999999999998e-286 < F < 3.15e-21

    1. Initial program 15.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.15e-21 < F

    1. Initial program 18.8%

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

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

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

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

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

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

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

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

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

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

Alternative 15: 38.2% accurate, 2.9× speedup?

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

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


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

    1. Initial program 19.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 4.5999999999999996e-22 < F

    1. Initial program 18.8%

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

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

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

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

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

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

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

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

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

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

Alternative 16: 35.1% accurate, 2.9× speedup?

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

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


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

    1. Initial program 19.4%

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

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

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

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

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

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

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

      \[\leadsto -\frac{\sqrt{2}}{B} \cdot \sqrt{\color{blue}{B \cdot F + C \cdot F}} \]
    7. Step-by-step derivation
      1. distribute-rgt-out17.3%

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

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

    if 1.6999999999999999e-20 < F

    1. Initial program 18.8%

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

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

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

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

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

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

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

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

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

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

Alternative 17: 34.9% accurate, 3.0× speedup?

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

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


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

    1. Initial program 19.4%

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

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

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

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

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

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

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

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

    if 1.1500000000000001e-24 < F

    1. Initial program 18.8%

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq 1.15 \cdot 10^{-24}:\\ \;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{B \cdot F}\right)\\ \mathbf{else}:\\ \;\;\;\;-\sqrt{2 \cdot \frac{F}{B}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 18: 28.3% accurate, 3.0× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if C < 2.2000000000000002e162

    1. Initial program 20.7%

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

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

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

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

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

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

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

        \[\leadsto -{\color{blue}{\left(\sqrt{\frac{F}{B} \cdot 2} \cdot \sqrt{\frac{F}{B} \cdot 2}\right)}}^{0.5} \]
      2. unpow1/216.2%

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

        \[\leadsto -{\left({\left(\frac{F}{B} \cdot 2\right)}^{0.5} \cdot \color{blue}{{\left(\frac{F}{B} \cdot 2\right)}^{0.5}}\right)}^{0.5} \]
      4. pow-prod-down16.4%

        \[\leadsto -{\color{blue}{\left({\left(\left(\frac{F}{B} \cdot 2\right) \cdot \left(\frac{F}{B} \cdot 2\right)\right)}^{0.5}\right)}}^{0.5} \]
      5. pow216.4%

        \[\leadsto -{\left({\color{blue}{\left({\left(\frac{F}{B} \cdot 2\right)}^{2}\right)}}^{0.5}\right)}^{0.5} \]
      6. *-commutative16.4%

        \[\leadsto -{\left({\left({\color{blue}{\left(2 \cdot \frac{F}{B}\right)}}^{2}\right)}^{0.5}\right)}^{0.5} \]
      7. associate-*r/16.4%

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

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

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

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

        \[\leadsto -{\color{blue}{\left(\left|\frac{2 \cdot F}{B}\right|\right)}}^{0.5} \]
      4. associate-*r/29.6%

        \[\leadsto -{\left(\left|\color{blue}{2 \cdot \frac{F}{B}}\right|\right)}^{0.5} \]
    11. Simplified29.6%

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

    if 2.2000000000000002e162 < C

    1. Initial program 1.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -\frac{\color{blue}{\sqrt{2} \cdot \sqrt{2}}}{B} \cdot \sqrt{C \cdot F} \]
      2. rem-square-sqrt11.7%

        \[\leadsto -\frac{\color{blue}{2}}{B} \cdot \sqrt{C \cdot F} \]
    10. Simplified11.7%

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

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

Alternative 19: 28.2% accurate, 5.6× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if C < 3.00000000000000001e164

    1. Initial program 20.7%

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

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

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

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

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

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

      \[\leadsto -\color{blue}{{\left(\frac{F}{B} \cdot 2\right)}^{0.5}} \]
    8. Step-by-step derivation
      1. *-un-lft-identity16.4%

        \[\leadsto -\color{blue}{1 \cdot {\left(\frac{F}{B} \cdot 2\right)}^{0.5}} \]
      2. unpow1/216.2%

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

        \[\leadsto -1 \cdot \sqrt{\color{blue}{2 \cdot \frac{F}{B}}} \]
      4. associate-*r/16.2%

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

      \[\leadsto -\color{blue}{1 \cdot \sqrt{\frac{2 \cdot F}{B}}} \]
    10. Step-by-step derivation
      1. *-lft-identity16.2%

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

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

    if 3.00000000000000001e164 < C

    1. Initial program 1.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -\frac{\color{blue}{\sqrt{2} \cdot \sqrt{2}}}{B} \cdot \sqrt{C \cdot F} \]
      2. rem-square-sqrt11.7%

        \[\leadsto -\frac{\color{blue}{2}}{B} \cdot \sqrt{C \cdot F} \]
    10. Simplified11.7%

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

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

Alternative 20: 27.2% accurate, 6.0× speedup?

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

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

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

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

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

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

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

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

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

    \[\leadsto -\color{blue}{\sqrt{\frac{F}{B} \cdot 2}} \]
  10. Final simplification15.0%

    \[\leadsto -\sqrt{2 \cdot \frac{F}{B}} \]
  11. Add Preprocessing

Alternative 21: 27.2% accurate, 6.0× speedup?

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

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

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

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

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

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

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

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

      \[\leadsto -\color{blue}{1 \cdot {\left(\frac{F}{B} \cdot 2\right)}^{0.5}} \]
    2. unpow1/215.0%

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

      \[\leadsto -1 \cdot \sqrt{\color{blue}{2 \cdot \frac{F}{B}}} \]
    4. associate-*r/15.0%

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

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

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

    \[\leadsto -\color{blue}{\sqrt{\frac{2 \cdot F}{B}}} \]
  12. Final simplification15.0%

    \[\leadsto -\sqrt{\frac{2 \cdot F}{B}} \]
  13. Add Preprocessing

Reproduce

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