ABCF->ab-angle b

Percentage Accurate: 18.6% → 45.6%
Time: 29.6s
Alternatives: 12
Speedup: 3.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 12 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.6% 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: 45.6% accurate, 0.9× speedup?

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

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

\mathbf{elif}\;B_m \leq 2.2 \cdot 10^{-42}:\\
\;\;\;\;\sqrt{-0.5 \cdot \frac{{B_m}^{2}}{\frac{C}{F}}} \cdot \frac{-\sqrt{2}}{B_m}\\

\mathbf{elif}\;B_m \leq 3.5 \cdot 10^{+37}:\\
\;\;\;\;\frac{-\sqrt{\left(F \cdot t_1\right) \cdot \left(2 \cdot t_0\right)}}{t_1}\\

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


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

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

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

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

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

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

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

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

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

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

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

    if 1.64999999999999997e-223 < B < 9.50000000000000051e-83

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

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

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

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

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

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

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

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

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

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

    if 9.50000000000000051e-83 < B < 2.20000000000000005e-42

    1. Initial program 22.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. Simplified41.0%

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.20000000000000005e-42 < B < 3.5e37

    1. Initial program 36.8%

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

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

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

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

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

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

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

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

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

    if 3.5e37 < B

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;B \leq 1.65 \cdot 10^{-223}:\\ \;\;\;\;\frac{-{\left(e^{0.25 \cdot \left(\log \left(-8 \cdot \left(C \cdot F\right)\right) + -2 \cdot \log \left(\frac{-1}{A}\right)\right)} \cdot \sqrt{\sqrt{2}}\right)}^{2}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}\\ \mathbf{elif}\;B \leq 9.5 \cdot 10^{-83}:\\ \;\;\;\;\frac{-{\left(\sqrt{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(2 \cdot \left(A \cdot 2\right)\right)\right)}}\right)}^{2}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}\\ \mathbf{elif}\;B \leq 2.2 \cdot 10^{-42}:\\ \;\;\;\;\sqrt{-0.5 \cdot \frac{{B}^{2}}{\frac{C}{F}}} \cdot \frac{-\sqrt{2}}{B}\\ \mathbf{elif}\;B \leq 3.5 \cdot 10^{+37}:\\ \;\;\;\;\frac{-\sqrt{\left(F \cdot \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)\right) \cdot \left(2 \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 45.0% accurate, 1.0× speedup?

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

\mathbf{elif}\;{B_m}^{2} \leq 5 \cdot 10^{-73}:\\
\;\;\;\;\sqrt{-0.5 \cdot \frac{{B_m}^{2}}{\frac{C}{F}}} \cdot \frac{-\sqrt{2}}{B_m}\\

\mathbf{elif}\;{B_m}^{2} \leq 5 \cdot 10^{-42}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (pow.f64 B 2) < 4.0000000000000001e-179 or 4.9999999999999998e-73 < (pow.f64 B 2) < 5.00000000000000003e-42

    1. Initial program 23.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. Simplified24.3%

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

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

    if 4.0000000000000001e-179 < (pow.f64 B 2) < 4.9999999999999998e-73

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.00000000000000003e-42 < (pow.f64 B 2)

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 46.7% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 22.8%

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

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

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

    if 5e-186 < (pow.f64 B 2) < 9.99999999999999927e74

    1. Initial program 39.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. Simplified47.3%

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

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

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

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

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

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

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

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

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

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

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

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

    if 9.99999999999999927e74 < (pow.f64 B 2)

    1. Initial program 11.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. Simplified8.5%

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 46.9% accurate, 1.2× speedup?

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

\mathbf{elif}\;B_m \leq 1.45 \cdot 10^{-41}:\\
\;\;\;\;\sqrt{-0.5 \cdot \frac{{B_m}^{2}}{\frac{C}{F}}} \cdot \frac{-\sqrt{2}}{B_m}\\

\mathbf{elif}\;B_m \leq 7.4 \cdot 10^{+37}:\\
\;\;\;\;\frac{-\sqrt{\left(F \cdot t_0\right) \cdot \left(2 \cdot t_1\right)}}{t_0}\\

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


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

    1. Initial program 20.9%

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

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

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

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

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

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

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

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

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

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

    if 1.22000000000000001e-82 < B < 1.44999999999999989e-41

    1. Initial program 22.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. Simplified41.0%

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.44999999999999989e-41 < B < 7.3999999999999999e37

    1. Initial program 36.8%

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

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

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

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

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

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

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

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

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

    if 7.3999999999999999e37 < B

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 39.7% accurate, 1.2× speedup?

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

\mathbf{elif}\;{B_m}^{2} \leq 5 \cdot 10^{-42}:\\
\;\;\;\;\sqrt{-0.5 \cdot \frac{{B_m}^{2}}{\frac{C}{F}}} \cdot \frac{-\sqrt{2}}{B_m}\\

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


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

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

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

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

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

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

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

    if 4.99999999999999973e-202 < (pow.f64 B 2) < 5.00000000000000003e-42

    1. Initial program 32.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. Simplified36.7%

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.00000000000000003e-42 < (pow.f64 B 2)

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 42.5% accurate, 1.2× speedup?

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

\mathbf{elif}\;{B_m}^{2} \leq 5 \cdot 10^{-42}:\\
\;\;\;\;\sqrt{-0.5 \cdot \frac{{B_m}^{2}}{\frac{C}{F}}} \cdot \frac{-\sqrt{2}}{B_m}\\

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


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

    1. Initial program 23.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.0000000000000005e-193 < (pow.f64 B 2) < 5.00000000000000003e-42

    1. Initial program 33.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.00000000000000003e-42 < (pow.f64 B 2)

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 34.1% accurate, 2.0× speedup?

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

\mathbf{else}:\\
\;\;\;\;\sqrt{-0.5 \cdot \frac{{B_m}^{2}}{\frac{C}{F}}} \cdot \frac{-\sqrt{2}}{B_m}\\


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

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

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

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

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

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

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

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

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

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

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

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

    if 3.70000000000000006e115 < C

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 34.4% accurate, 2.0× speedup?

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

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


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

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

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

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

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

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

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

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

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

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

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

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

    if 5.80000000000000009e115 < C

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 31.8% accurate, 2.0× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ [A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\ \\ \frac{\sqrt{2}}{B_m} \cdot \left(-\sqrt{F \cdot \left(A - \mathsf{hypot}\left(B_m, A\right)\right)}\right) \end{array} \]
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
 :precision binary64
 (* (/ (sqrt 2.0) B_m) (- (sqrt (* F (- A (hypot B_m A)))))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
	return (sqrt(2.0) / B_m) * -sqrt((F * (A - hypot(B_m, A))));
}
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
	return (Math.sqrt(2.0) / B_m) * -Math.sqrt((F * (A - Math.hypot(B_m, A))));
}
B_m = math.fabs(B)
[A, B_m, C, F] = sort([A, B_m, C, F])
def code(A, B_m, C, F):
	return (math.sqrt(2.0) / B_m) * -math.sqrt((F * (A - math.hypot(B_m, A))))
B_m = abs(B)
A, B_m, C, F = sort([A, B_m, C, F])
function code(A, B_m, C, F)
	return Float64(Float64(sqrt(2.0) / B_m) * Float64(-sqrt(Float64(F * Float64(A - hypot(B_m, A))))))
end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp = code(A, B_m, C, F)
	tmp = (sqrt(2.0) / B_m) * -sqrt((F * (A - hypot(B_m, A))));
end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * (-N[Sqrt[N[(F * N[(A - N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\frac{\sqrt{2}}{B_m} \cdot \left(-\sqrt{F \cdot \left(A - \mathsf{hypot}\left(B_m, A\right)\right)}\right)
\end{array}
Derivation
  1. Initial program 20.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. Simplified19.7%

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)}\right) \]
  8. Add Preprocessing

Alternative 10: 26.5% accurate, 3.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 0.6% accurate, 3.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{B \cdot F}\right) \]
  9. Add Preprocessing

Alternative 12: 0.0% accurate, 3.1× speedup?

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

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

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

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

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

    \[\leadsto \color{blue}{0.25 \cdot \left(\sqrt{\frac{F}{C}} \cdot \sqrt{-16}\right)} \]
  8. Final simplification0.0%

    \[\leadsto 0.25 \cdot \left(\sqrt{\frac{F}{C}} \cdot \sqrt{-16}\right) \]
  9. Add Preprocessing

Reproduce

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