ABCF->ab-angle a

Percentage Accurate: 18.7% → 48.6%
Time: 25.0s
Alternatives: 16
Speedup: 4.9×

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 16 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: 48.6% accurate, 0.3× speedup?

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

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

\mathbf{elif}\;t_2 \leq \infty:\\
\;\;\;\;\frac{-{\left(e^{0.25 \cdot \left(-2 \cdot \log \left(\frac{1}{C}\right) + \log \left(-16 \cdot \left(A \cdot F\right)\right)\right)}\right)}^{2}}{t_0}\\

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


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

    1. Initial program 47.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. Taylor expanded in A around 0 42.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(C + \sqrt{{B}^{2} + {C}^{2}}\right)}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    3. Step-by-step derivation
      1. unpow242.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(C + \sqrt{\color{blue}{B \cdot B} + {C}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      2. unpow242.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(C + \sqrt{B \cdot B + \color{blue}{C \cdot C}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      3. hypot-def46.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(C + \color{blue}{\mathsf{hypot}\left(B, C\right)}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    4. Simplified46.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(C + \mathsf{hypot}\left(B, C\right)\right)}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    5. Step-by-step derivation
      1. sqrt-prod57.1%

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

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

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

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

    if -1.9999999999999998e-198 < (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 2 (*.f64 (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)) F)) (+.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))))) (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C))) < 1.99999999999999996e123

    1. Initial program 21.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. Taylor expanded in A around -inf 22.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 + -0.5 \cdot \frac{{B}^{2}}{A}\right)}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    3. Step-by-step derivation
      1. fma-def22.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}{\mathsf{fma}\left(2, C, -0.5 \cdot \frac{{B}^{2}}{A}\right)}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      2. unpow222.5%

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

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

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

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

        \[\leadsto \frac{-\color{blue}{{\left(\sqrt{\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)}}\right)}^{2}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    3. Applied egg-rr11.4%

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

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

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

    1. Initial program 0.0%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \leq -2 \cdot 10^{-198}:\\ \;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot \left(B \cdot B - 4 \cdot \left(A \cdot C\right)\right)\right)} \cdot \left(-\sqrt{C + \mathsf{hypot}\left(B, C\right)}\right)}{{B}^{2} - \left(4 \cdot A\right) \cdot C}\\ \mathbf{elif}\;\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \leq 2 \cdot 10^{+123}:\\ \;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \mathsf{fma}\left(2, C, -0.5 \cdot \frac{B \cdot B}{A}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C}\\ \mathbf{elif}\;\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \leq \infty:\\ \;\;\;\;\frac{-{\left(e^{0.25 \cdot \left(-2 \cdot \log \left(\frac{1}{C}\right) + \log \left(-16 \cdot \left(A \cdot F\right)\right)\right)}\right)}^{2}}{{B}^{2} - \left(4 \cdot A\right) \cdot C}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(\sqrt{F} \cdot \left(-\sqrt{A + \mathsf{hypot}\left(B, A\right)}\right)\right)\\ \end{array} \]

Alternative 2: 44.6% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 15.3%

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Taylor expanded in A around -inf 18.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} \]
    3. Step-by-step derivation
      1. div-inv18.7%

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

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

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

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

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

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

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

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

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

    if 1.00000000000000003e-161 < (pow.f64 B 2) < 4.00000000000000027e265

    1. Initial program 41.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. Taylor expanded in A around 0 38.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(C + \sqrt{{B}^{2} + {C}^{2}}\right)}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    3. Step-by-step derivation
      1. unpow238.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(C + \sqrt{\color{blue}{B \cdot B} + {C}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      2. unpow238.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(C + \sqrt{B \cdot B + \color{blue}{C \cdot C}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      3. hypot-def42.0%

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

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

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

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

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

    if 4.00000000000000027e265 < (pow.f64 B 2)

    1. Initial program 0.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. Taylor expanded in C around 0 6.0%

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 40.4% accurate, 1.5× speedup?

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

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

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


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

    1. Initial program 25.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. Step-by-step derivation
      1. distribute-frac-neg25.6%

        \[\leadsto \color{blue}{-\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. neg-sub025.6%

        \[\leadsto \color{blue}{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}} \]
    3. Applied egg-rr25.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -6.50000000000000022e26 < B < 4.8e-14

    1. Initial program 18.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. Taylor expanded in A around -inf 19.2%

      \[\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} \]
    3. Step-by-step derivation
      1. sqrt-prod22.1%

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

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

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

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

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

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

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

    if 4.8e-14 < B

    1. Initial program 22.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. Taylor expanded in C around 0 30.7%

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 38.2% accurate, 1.9× speedup?

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

\mathbf{elif}\;B \leq 0.000265:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot \left(B \cdot B + \left(A \cdot C\right) \cdot -4\right)\right)} \cdot \left(-\sqrt{2 \cdot C}\right)}{{B}^{2} - \left(4 \cdot A\right) \cdot C}\\

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


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

    1. Initial program 25.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. Step-by-step derivation
      1. distribute-frac-neg25.6%

        \[\leadsto \color{blue}{-\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. neg-sub025.6%

        \[\leadsto \color{blue}{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}} \]
    3. Applied egg-rr25.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -9.0000000000000006e25 < B < 2.6499999999999999e-4

    1. Initial program 18.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. Taylor expanded in A around -inf 19.2%

      \[\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} \]
    3. Step-by-step derivation
      1. sqrt-prod22.1%

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

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

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

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

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

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

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

    if 2.6499999999999999e-4 < B

    1. Initial program 22.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. Taylor expanded in A around 0 31.8%

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

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

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

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

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

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

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

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

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

Alternative 5: 38.1% accurate, 1.9× speedup?

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

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

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


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

    1. Initial program 25.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. Taylor expanded in A around 0 21.7%

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

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

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

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

      \[\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(C + \mathsf{hypot}\left(B, C\right)\right)}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    5. Step-by-step derivation
      1. distribute-frac-neg21.7%

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

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

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

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

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

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

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

    if -1.60000000000000014e26 < B < 2.29999999999999999e-21

    1. Initial program 18.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. Taylor expanded in A around -inf 19.2%

      \[\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} \]
    3. Step-by-step derivation
      1. sqrt-prod22.1%

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

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

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

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

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

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

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

    if 2.29999999999999999e-21 < B

    1. Initial program 22.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. Taylor expanded in A around 0 31.8%

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

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

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

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

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

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

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

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

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

Alternative 6: 36.9% accurate, 2.0× speedup?

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

\mathbf{elif}\;B \leq 8 \cdot 10^{+17}:\\
\;\;\;\;\sqrt{\left(2 \cdot \left(F \cdot t_1\right)\right) \cdot \left(2 \cdot C\right)} \cdot \frac{-1}{t_1}\\

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


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

    1. Initial program 26.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. Taylor expanded in A around 0 23.3%

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

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

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

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

      \[\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(C + \mathsf{hypot}\left(B, C\right)\right)}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    5. Step-by-step derivation
      1. distribute-frac-neg24.7%

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

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

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

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

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

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

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

    if -3.5000000000000003e-64 < B < 8e17

    1. Initial program 17.7%

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

      \[\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} \]
    3. Step-by-step derivation
      1. div-inv19.2%

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

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

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

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

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

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

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

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

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

    if 8e17 < B

    1. Initial program 21.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. Taylor expanded in C around 0 31.2%

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

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

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

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

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

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

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

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

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

Alternative 7: 36.6% accurate, 2.7× speedup?

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

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

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


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

    1. Initial program 26.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. Taylor expanded in A around 0 23.3%

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

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

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

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

      \[\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(C + \mathsf{hypot}\left(B, C\right)\right)}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    5. Step-by-step derivation
      1. distribute-frac-neg24.7%

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

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

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

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

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

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

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

    if -1.28e-64 < B < 1e18

    1. Initial program 17.7%

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

      \[\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} \]
    3. Step-by-step derivation
      1. div-inv19.2%

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

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

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

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

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

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

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

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

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

    if 1e18 < B

    1. Initial program 21.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. Taylor expanded in C around 0 31.2%

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

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

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

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

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

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

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

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

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

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

Alternative 8: 34.2% accurate, 3.0× speedup?

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

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


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

    1. Initial program 21.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. Taylor expanded in A around -inf 13.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(2 \cdot C\right)}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    3. Step-by-step derivation
      1. div-inv13.6%

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

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

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

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

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

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

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

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

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

    if 1.08e18 < B

    1. Initial program 21.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. Taylor expanded in C around 0 31.2%

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

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

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

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

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

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

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

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

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

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

Alternative 9: 34.4% accurate, 3.0× speedup?

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

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


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

    1. Initial program 21.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. Taylor expanded in A around -inf 13.7%

      \[\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} \]
    3. Step-by-step derivation
      1. div-inv13.7%

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

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

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

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

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

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

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

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

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

    if 8.5e11 < B

    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. Taylor expanded in C around 0 30.7%

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

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

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

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

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

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

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

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

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

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

Alternative 10: 34.6% accurate, 3.0× speedup?

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

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


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

    1. Initial program 21.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. Taylor expanded in A around -inf 13.7%

      \[\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} \]
    3. Step-by-step derivation
      1. div-inv13.7%

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

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

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

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

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

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

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

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

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

    if 2.7e9 < B

    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. Taylor expanded in A around 0 20.7%

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

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

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

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

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

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

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

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

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

Alternative 11: 27.1% accurate, 4.8× speedup?

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

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


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

    1. Initial program 21.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. Taylor expanded in A around -inf 13.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(2 \cdot C\right)}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    3. Step-by-step derivation
      1. distribute-frac-neg13.6%

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

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

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

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

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

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

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

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

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

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

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

    if 1.5e18 < B

    1. Initial program 21.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. Taylor expanded in B around inf 21.2%

      \[\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}{B}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    3. Step-by-step derivation
      1. distribute-frac-neg21.2%

        \[\leadsto \color{blue}{-\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) + B\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C}} \]
      2. associate-*l*21.2%

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

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

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

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

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

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

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

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

Alternative 12: 26.9% accurate, 4.8× speedup?

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

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


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

    1. Initial program 21.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. Taylor expanded in A around -inf 13.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(2 \cdot C\right)}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    3. Step-by-step derivation
      1. div-inv13.6%

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

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

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

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

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

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

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

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

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

    if 1.9e18 < B

    1. Initial program 21.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. Taylor expanded in B around inf 21.2%

      \[\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}{B}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    3. Step-by-step derivation
      1. distribute-frac-neg21.2%

        \[\leadsto \color{blue}{-\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) + B\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C}} \]
      2. associate-*l*21.2%

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

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

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

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

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

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

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

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

Alternative 13: 27.1% accurate, 4.9× speedup?

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

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


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

    1. Initial program 21.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. Taylor expanded in A around -inf 13.7%

      \[\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} \]
    3. Step-by-step derivation
      1. distribute-frac-neg13.7%

        \[\leadsto \color{blue}{-\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)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C}} \]
      2. *-commutative13.7%

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

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

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

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

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

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

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

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

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

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

    if 3.9e14 < B

    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. Taylor expanded in B around inf 20.9%

      \[\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}{B}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    3. Step-by-step derivation
      1. distribute-frac-neg20.9%

        \[\leadsto \color{blue}{-\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) + B\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C}} \]
      2. associate-*l*20.9%

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

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

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

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

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

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

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

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

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

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

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

Alternative 14: 10.5% accurate, 5.1× speedup?

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

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


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

    1. Initial program 21.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. Taylor expanded in A around -inf 9.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(2 \cdot C\right)}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    3. Taylor expanded in B around -inf 3.9%

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

    if -1.40000000000000005e-248 < B

    1. Initial program 20.5%

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

      \[\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}{B}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    3. Step-by-step derivation
      1. distribute-frac-neg13.3%

        \[\leadsto \color{blue}{-\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) + B\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C}} \]
      2. associate-*l*13.3%

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

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

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

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

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

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

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

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

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

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

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

Alternative 15: 9.1% accurate, 5.7× speedup?

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

\mathbf{else}:\\
\;\;\;\;-2 \cdot t_0\\


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

    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. Taylor expanded in A around -inf 10.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} \]
    3. Taylor expanded in B around -inf 3.5%

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

    if -7.40000000000000053e-296 < B

    1. Initial program 21.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. Taylor expanded in A around -inf 11.2%

      \[\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} \]
    3. Taylor expanded in B around inf 3.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;B \leq -7.4 \cdot 10^{-296}:\\ \;\;\;\;2 \cdot \left(\sqrt{C \cdot F} \cdot \frac{1}{B}\right)\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \left(\sqrt{C \cdot F} \cdot \frac{1}{B}\right)\\ \end{array} \]

Alternative 16: 5.4% accurate, 5.8× speedup?

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

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

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

Reproduce

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