ABCF->ab-angle a

Percentage Accurate: 18.9% → 57.0%
Time: 23.3s
Alternatives: 15
Speedup: 6.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 15 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.9% 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: 57.0% accurate, 1.2× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ [A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\ \\ \begin{array}{l} t_0 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(-4 \cdot C\right)\right)\\ \mathbf{if}\;B\_m \leq 1.85 \cdot 10^{-262}:\\ \;\;\;\;0.25 \cdot \left(\sqrt{\frac{F \cdot -4}{A}} \cdot {\left(\sqrt{2}\right)}^{2}\right)\\ \mathbf{elif}\;B\_m \leq 3.3 \cdot 10^{-97}:\\ \;\;\;\;\frac{\sqrt{\left(F \cdot t\_0\right) \cdot \left(C \cdot 4\right)}}{-t\_0}\\ \mathbf{elif}\;B\_m \leq 3.2 \cdot 10^{+38}:\\ \;\;\;\;\sqrt{F \cdot \frac{\left(A + C\right) + \mathsf{hypot}\left(B\_m, A - C\right)}{\mathsf{fma}\left(-4, A \cdot C, {B\_m}^{2}\right)}} \cdot \left(-\sqrt{2}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\sqrt{C + \mathsf{hypot}\left(C, B\_m\right)} \cdot \sqrt{F}\right) \cdot \frac{e^{\log 2 \cdot 0.5}}{-B\_m}\\ \end{array} \end{array} \]
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
 :precision binary64
 (let* ((t_0 (fma B_m B_m (* A (* -4.0 C)))))
   (if (<= B_m 1.85e-262)
     (* 0.25 (* (sqrt (/ (* F -4.0) A)) (pow (sqrt 2.0) 2.0)))
     (if (<= B_m 3.3e-97)
       (/ (sqrt (* (* F t_0) (* C 4.0))) (- t_0))
       (if (<= B_m 3.2e+38)
         (*
          (sqrt
           (*
            F
            (/
             (+ (+ A C) (hypot B_m (- A C)))
             (fma -4.0 (* A C) (pow B_m 2.0)))))
          (- (sqrt 2.0)))
         (*
          (* (sqrt (+ C (hypot C B_m))) (sqrt F))
          (/ (exp (* (log 2.0) 0.5)) (- B_m))))))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
	double t_0 = fma(B_m, B_m, (A * (-4.0 * C)));
	double tmp;
	if (B_m <= 1.85e-262) {
		tmp = 0.25 * (sqrt(((F * -4.0) / A)) * pow(sqrt(2.0), 2.0));
	} else if (B_m <= 3.3e-97) {
		tmp = sqrt(((F * t_0) * (C * 4.0))) / -t_0;
	} else if (B_m <= 3.2e+38) {
		tmp = sqrt((F * (((A + C) + hypot(B_m, (A - C))) / fma(-4.0, (A * C), pow(B_m, 2.0))))) * -sqrt(2.0);
	} else {
		tmp = (sqrt((C + hypot(C, B_m))) * sqrt(F)) * (exp((log(2.0) * 0.5)) / -B_m);
	}
	return tmp;
}
B_m = abs(B)
A, B_m, C, F = sort([A, B_m, C, F])
function code(A, B_m, C, F)
	t_0 = fma(B_m, B_m, Float64(A * Float64(-4.0 * C)))
	tmp = 0.0
	if (B_m <= 1.85e-262)
		tmp = Float64(0.25 * Float64(sqrt(Float64(Float64(F * -4.0) / A)) * (sqrt(2.0) ^ 2.0)));
	elseif (B_m <= 3.3e-97)
		tmp = Float64(sqrt(Float64(Float64(F * t_0) * Float64(C * 4.0))) / Float64(-t_0));
	elseif (B_m <= 3.2e+38)
		tmp = Float64(sqrt(Float64(F * Float64(Float64(Float64(A + C) + hypot(B_m, Float64(A - C))) / fma(-4.0, Float64(A * C), (B_m ^ 2.0))))) * Float64(-sqrt(2.0)));
	else
		tmp = Float64(Float64(sqrt(Float64(C + hypot(C, B_m))) * sqrt(F)) * Float64(exp(Float64(log(2.0) * 0.5)) / Float64(-B_m)));
	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[(-4.0 * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B$95$m, 1.85e-262], N[(0.25 * N[(N[Sqrt[N[(N[(F * -4.0), $MachinePrecision] / A), $MachinePrecision]], $MachinePrecision] * N[Power[N[Sqrt[2.0], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B$95$m, 3.3e-97], N[(N[Sqrt[N[(N[(F * t$95$0), $MachinePrecision] * N[(C * 4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-t$95$0)), $MachinePrecision], If[LessEqual[B$95$m, 3.2e+38], N[(N[Sqrt[N[(F * N[(N[(N[(A + C), $MachinePrecision] + N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] / N[(-4.0 * N[(A * C), $MachinePrecision] + N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision], N[(N[(N[Sqrt[N[(C + N[Sqrt[C ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[F], $MachinePrecision]), $MachinePrecision] * N[(N[Exp[N[(N[Log[2.0], $MachinePrecision] * 0.5), $MachinePrecision]], $MachinePrecision] / (-B$95$m)), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(-4 \cdot C\right)\right)\\
\mathbf{if}\;B\_m \leq 1.85 \cdot 10^{-262}:\\
\;\;\;\;0.25 \cdot \left(\sqrt{\frac{F \cdot -4}{A}} \cdot {\left(\sqrt{2}\right)}^{2}\right)\\

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

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

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


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

    1. Initial program 17.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. Simplified23.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-cube-cbrt23.2%

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

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

      \[\leadsto \frac{\sqrt{\left(\mathsf{fma}\left(B, B, A \cdot \color{blue}{{\left(\sqrt[3]{C \cdot -4}\right)}^{3}}\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)} \]
    6. Taylor expanded in C around inf 13.6%

      \[\leadsto \color{blue}{0.25 \cdot \left(\sqrt{\frac{F \cdot {\left(\sqrt[3]{-4}\right)}^{3}}{A}} \cdot {\left(\sqrt{2}\right)}^{2}\right)} \]
    7. Step-by-step derivation
      1. rem-cube-cbrt13.7%

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

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

    if 1.85e-262 < B < 3.3000000000000001e-97

    1. Initial program 23.5%

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Simplified28.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. Taylor expanded in A around -inf 23.1%

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

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

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

    if 3.3000000000000001e-97 < B < 3.19999999999999985e38

    1. Initial program 16.5%

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

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

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

    if 3.19999999999999985e38 < B

    1. Initial program 14.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;B \leq 1.85 \cdot 10^{-262}:\\ \;\;\;\;0.25 \cdot \left(\sqrt{\frac{F \cdot -4}{A}} \cdot {\left(\sqrt{2}\right)}^{2}\right)\\ \mathbf{elif}\;B \leq 3.3 \cdot 10^{-97}:\\ \;\;\;\;\frac{\sqrt{\left(F \cdot \mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)\right) \cdot \left(C \cdot 4\right)}}{-\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}\\ \mathbf{elif}\;B \leq 3.2 \cdot 10^{+38}:\\ \;\;\;\;\sqrt{F \cdot \frac{\left(A + C\right) + \mathsf{hypot}\left(B, A - C\right)}{\mathsf{fma}\left(-4, A \cdot C, {B}^{2}\right)}} \cdot \left(-\sqrt{2}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\sqrt{C + \mathsf{hypot}\left(C, B\right)} \cdot \sqrt{F}\right) \cdot \frac{e^{\log 2 \cdot 0.5}}{-B}\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 57.0% accurate, 1.2× speedup?

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

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

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


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

    1. Initial program 17.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. Simplified23.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-cube-cbrt23.2%

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

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

      \[\leadsto \frac{\sqrt{\left(\mathsf{fma}\left(B, B, A \cdot \color{blue}{{\left(\sqrt[3]{C \cdot -4}\right)}^{3}}\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)} \]
    6. Taylor expanded in C around inf 13.6%

      \[\leadsto \color{blue}{0.25 \cdot \left(\sqrt{\frac{F \cdot {\left(\sqrt[3]{-4}\right)}^{3}}{A}} \cdot {\left(\sqrt{2}\right)}^{2}\right)} \]
    7. Step-by-step derivation
      1. rem-cube-cbrt13.7%

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

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

    if 1.3500000000000001e-262 < B < 8.1999999999999997e-26

    1. Initial program 24.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. Simplified29.0%

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

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

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

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

    if 8.1999999999999997e-26 < B

    1. Initial program 12.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 57.0% accurate, 1.5× speedup?

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

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

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


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

    1. Initial program 17.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. Simplified23.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-cube-cbrt23.2%

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

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

      \[\leadsto \frac{\sqrt{\left(\mathsf{fma}\left(B, B, A \cdot \color{blue}{{\left(\sqrt[3]{C \cdot -4}\right)}^{3}}\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)} \]
    6. Taylor expanded in C around inf 13.6%

      \[\leadsto \color{blue}{0.25 \cdot \left(\sqrt{\frac{F \cdot {\left(\sqrt[3]{-4}\right)}^{3}}{A}} \cdot {\left(\sqrt{2}\right)}^{2}\right)} \]
    7. Step-by-step derivation
      1. rem-cube-cbrt13.7%

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

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

    if 1.85e-262 < B < 2.00000000000000008e-25

    1. Initial program 24.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. Simplified29.0%

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

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

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

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

    if 2.00000000000000008e-25 < B

    1. Initial program 12.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 51.0% accurate, 1.9× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ [A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\ \\ \begin{array}{l} t_0 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(-4 \cdot C\right)\right)\\ \mathbf{if}\;B\_m \leq 1.85 \cdot 10^{-262}:\\ \;\;\;\;0.25 \cdot \left(\sqrt{\frac{F \cdot -4}{A}} \cdot {\left(\sqrt{2}\right)}^{2}\right)\\ \mathbf{elif}\;B\_m \leq 8 \cdot 10^{-24}:\\ \;\;\;\;\frac{\sqrt{\left(F \cdot t\_0\right) \cdot \left(C \cdot 4\right)}}{-t\_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{F}}{\sqrt{B\_m}} \cdot \left(-\sqrt{2}\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 (* -4.0 C)))))
   (if (<= B_m 1.85e-262)
     (* 0.25 (* (sqrt (/ (* F -4.0) A)) (pow (sqrt 2.0) 2.0)))
     (if (<= B_m 8e-24)
       (/ (sqrt (* (* F t_0) (* C 4.0))) (- t_0))
       (* (/ (sqrt F) (sqrt B_m)) (- (sqrt 2.0)))))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
	double t_0 = fma(B_m, B_m, (A * (-4.0 * C)));
	double tmp;
	if (B_m <= 1.85e-262) {
		tmp = 0.25 * (sqrt(((F * -4.0) / A)) * pow(sqrt(2.0), 2.0));
	} else if (B_m <= 8e-24) {
		tmp = sqrt(((F * t_0) * (C * 4.0))) / -t_0;
	} else {
		tmp = (sqrt(F) / sqrt(B_m)) * -sqrt(2.0);
	}
	return tmp;
}
B_m = abs(B)
A, B_m, C, F = sort([A, B_m, C, F])
function code(A, B_m, C, F)
	t_0 = fma(B_m, B_m, Float64(A * Float64(-4.0 * C)))
	tmp = 0.0
	if (B_m <= 1.85e-262)
		tmp = Float64(0.25 * Float64(sqrt(Float64(Float64(F * -4.0) / A)) * (sqrt(2.0) ^ 2.0)));
	elseif (B_m <= 8e-24)
		tmp = Float64(sqrt(Float64(Float64(F * t_0) * Float64(C * 4.0))) / Float64(-t_0));
	else
		tmp = Float64(Float64(sqrt(F) / sqrt(B_m)) * Float64(-sqrt(2.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[(B$95$m * B$95$m + N[(A * N[(-4.0 * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B$95$m, 1.85e-262], N[(0.25 * N[(N[Sqrt[N[(N[(F * -4.0), $MachinePrecision] / A), $MachinePrecision]], $MachinePrecision] * N[Power[N[Sqrt[2.0], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B$95$m, 8e-24], N[(N[Sqrt[N[(N[(F * t$95$0), $MachinePrecision] * N[(C * 4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-t$95$0)), $MachinePrecision], N[(N[(N[Sqrt[F], $MachinePrecision] / N[Sqrt[B$95$m], $MachinePrecision]), $MachinePrecision] * (-N[Sqrt[2.0], $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(-4 \cdot C\right)\right)\\
\mathbf{if}\;B\_m \leq 1.85 \cdot 10^{-262}:\\
\;\;\;\;0.25 \cdot \left(\sqrt{\frac{F \cdot -4}{A}} \cdot {\left(\sqrt{2}\right)}^{2}\right)\\

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

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


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

    1. Initial program 17.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. Simplified23.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-cube-cbrt23.2%

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

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

      \[\leadsto \frac{\sqrt{\left(\mathsf{fma}\left(B, B, A \cdot \color{blue}{{\left(\sqrt[3]{C \cdot -4}\right)}^{3}}\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)} \]
    6. Taylor expanded in C around inf 13.6%

      \[\leadsto \color{blue}{0.25 \cdot \left(\sqrt{\frac{F \cdot {\left(\sqrt[3]{-4}\right)}^{3}}{A}} \cdot {\left(\sqrt{2}\right)}^{2}\right)} \]
    7. Step-by-step derivation
      1. rem-cube-cbrt13.7%

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

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

    if 1.85e-262 < B < 7.99999999999999939e-24

    1. Initial program 24.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. Simplified29.0%

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

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

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

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

    if 7.99999999999999939e-24 < B

    1. Initial program 12.4%

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

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

        \[\leadsto \color{blue}{-\sqrt{\frac{F}{B}} \cdot \sqrt{2}} \]
      2. *-commutative40.6%

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

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

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

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

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

Alternative 5: 46.0% 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}\;B\_m \leq 1.8 \cdot 10^{-97}:\\ \;\;\;\;0.25 \cdot \left(\sqrt{\frac{F \cdot -4}{A}} \cdot {\left(\sqrt{2}\right)}^{2}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{F}}{\sqrt{B\_m}} \cdot \left(-\sqrt{2}\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 (<= B_m 1.8e-97)
   (* 0.25 (* (sqrt (/ (* F -4.0) A)) (pow (sqrt 2.0) 2.0)))
   (* (/ (sqrt F) (sqrt B_m)) (- (sqrt 2.0)))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
	double tmp;
	if (B_m <= 1.8e-97) {
		tmp = 0.25 * (sqrt(((F * -4.0) / A)) * pow(sqrt(2.0), 2.0));
	} else {
		tmp = (sqrt(F) / sqrt(B_m)) * -sqrt(2.0);
	}
	return tmp;
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
    real(8), intent (in) :: a
    real(8), intent (in) :: b_m
    real(8), intent (in) :: c
    real(8), intent (in) :: f
    real(8) :: tmp
    if (b_m <= 1.8d-97) then
        tmp = 0.25d0 * (sqrt(((f * (-4.0d0)) / a)) * (sqrt(2.0d0) ** 2.0d0))
    else
        tmp = (sqrt(f) / sqrt(b_m)) * -sqrt(2.0d0)
    end if
    code = tmp
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
	double tmp;
	if (B_m <= 1.8e-97) {
		tmp = 0.25 * (Math.sqrt(((F * -4.0) / A)) * Math.pow(Math.sqrt(2.0), 2.0));
	} else {
		tmp = (Math.sqrt(F) / Math.sqrt(B_m)) * -Math.sqrt(2.0);
	}
	return tmp;
}
B_m = math.fabs(B)
[A, B_m, C, F] = sort([A, B_m, C, F])
def code(A, B_m, C, F):
	tmp = 0
	if B_m <= 1.8e-97:
		tmp = 0.25 * (math.sqrt(((F * -4.0) / A)) * math.pow(math.sqrt(2.0), 2.0))
	else:
		tmp = (math.sqrt(F) / math.sqrt(B_m)) * -math.sqrt(2.0)
	return tmp
B_m = abs(B)
A, B_m, C, F = sort([A, B_m, C, F])
function code(A, B_m, C, F)
	tmp = 0.0
	if (B_m <= 1.8e-97)
		tmp = Float64(0.25 * Float64(sqrt(Float64(Float64(F * -4.0) / A)) * (sqrt(2.0) ^ 2.0)));
	else
		tmp = Float64(Float64(sqrt(F) / sqrt(B_m)) * Float64(-sqrt(2.0)));
	end
	return tmp
end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
	tmp = 0.0;
	if (B_m <= 1.8e-97)
		tmp = 0.25 * (sqrt(((F * -4.0) / A)) * (sqrt(2.0) ^ 2.0));
	else
		tmp = (sqrt(F) / sqrt(B_m)) * -sqrt(2.0);
	end
	tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := If[LessEqual[B$95$m, 1.8e-97], N[(0.25 * N[(N[Sqrt[N[(N[(F * -4.0), $MachinePrecision] / A), $MachinePrecision]], $MachinePrecision] * N[Power[N[Sqrt[2.0], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[F], $MachinePrecision] / N[Sqrt[B$95$m], $MachinePrecision]), $MachinePrecision] * (-N[Sqrt[2.0], $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 \leq 1.8 \cdot 10^{-97}:\\
\;\;\;\;0.25 \cdot \left(\sqrt{\frac{F \cdot -4}{A}} \cdot {\left(\sqrt{2}\right)}^{2}\right)\\

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


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

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

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

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

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

      \[\leadsto \frac{\sqrt{\left(\mathsf{fma}\left(B, B, A \cdot \color{blue}{{\left(\sqrt[3]{C \cdot -4}\right)}^{3}}\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)} \]
    6. Taylor expanded in C around inf 13.6%

      \[\leadsto \color{blue}{0.25 \cdot \left(\sqrt{\frac{F \cdot {\left(\sqrt[3]{-4}\right)}^{3}}{A}} \cdot {\left(\sqrt{2}\right)}^{2}\right)} \]
    7. Step-by-step derivation
      1. rem-cube-cbrt13.7%

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

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

    if 1.79999999999999999e-97 < B

    1. Initial program 14.6%

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

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

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

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

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

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if F < 5.79999999999999972e66

    1. Initial program 22.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.79999999999999972e66 < F

    1. Initial program 10.6%

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

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

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

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

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

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

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

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

Alternative 7: 38.7% accurate, 2.9× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if F < 2.10000000000000017e56

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.10000000000000017e56 < F

    1. Initial program 10.3%

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 38.7% accurate, 2.9× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if F < 1.89999999999999998e56

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{-\frac{{\left(\left(\left(C + \mathsf{hypot}\left(C, B\right)\right) \cdot F\right) \cdot 2\right)}^{0.5}}{B}} \]
      2. distribute-neg-frac226.8%

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

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

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

    if 1.89999999999999998e56 < F

    1. Initial program 10.3%

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 35.0% accurate, 2.9× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if F < 2.10000000000000017e56

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.10000000000000017e56 < F

    1. Initial program 10.3%

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 35.2% accurate, 3.0× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ [A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\ \\ \begin{array}{l} \mathbf{if}\;F \leq 3.4 \cdot 10^{-15}:\\ \;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(-\sqrt{B\_m \cdot F}\right)\\ \mathbf{else}:\\ \;\;\;\;-\sqrt{\frac{F \cdot 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 (<= F 3.4e-15)
   (* (/ (sqrt 2.0) B_m) (- (sqrt (* B_m F))))
   (- (sqrt (/ (* F 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 (F <= 3.4e-15) {
		tmp = (sqrt(2.0) / B_m) * -sqrt((B_m * F));
	} else {
		tmp = -sqrt(((F * 2.0) / B_m));
	}
	return tmp;
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
    real(8), intent (in) :: a
    real(8), intent (in) :: b_m
    real(8), intent (in) :: c
    real(8), intent (in) :: f
    real(8) :: tmp
    if (f <= 3.4d-15) then
        tmp = (sqrt(2.0d0) / b_m) * -sqrt((b_m * f))
    else
        tmp = -sqrt(((f * 2.0d0) / b_m))
    end if
    code = tmp
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
	double tmp;
	if (F <= 3.4e-15) {
		tmp = (Math.sqrt(2.0) / B_m) * -Math.sqrt((B_m * F));
	} else {
		tmp = -Math.sqrt(((F * 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 F <= 3.4e-15:
		tmp = (math.sqrt(2.0) / B_m) * -math.sqrt((B_m * F))
	else:
		tmp = -math.sqrt(((F * 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 (F <= 3.4e-15)
		tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(-sqrt(Float64(B_m * F))));
	else
		tmp = Float64(-sqrt(Float64(Float64(F * 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 (F <= 3.4e-15)
		tmp = (sqrt(2.0) / B_m) * -sqrt((B_m * F));
	else
		tmp = -sqrt(((F * 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[F, 3.4e-15], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * (-N[Sqrt[N[(B$95$m * F), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], (-N[Sqrt[N[(N[(F * 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}\;F \leq 3.4 \cdot 10^{-15}:\\
\;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(-\sqrt{B\_m \cdot F}\right)\\

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


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

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

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

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

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

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

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

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

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

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

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

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

    if 3.4e-15 < F

    1. Initial program 12.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 29.0% accurate, 3.0× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ [A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\ \\ \begin{array}{l} \mathbf{if}\;C \leq 9 \cdot 10^{+163}:\\ \;\;\;\;-\sqrt{2 \cdot \left|\frac{F}{B\_m}\right|}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{F \cdot C} \cdot \frac{-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 9e+163)
   (- (sqrt (* 2.0 (fabs (/ F B_m)))))
   (* (sqrt (* F C)) (/ -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 <= 9e+163) {
		tmp = -sqrt((2.0 * fabs((F / B_m))));
	} else {
		tmp = sqrt((F * C)) * (-2.0 / B_m);
	}
	return tmp;
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
    real(8), intent (in) :: a
    real(8), intent (in) :: b_m
    real(8), intent (in) :: c
    real(8), intent (in) :: f
    real(8) :: tmp
    if (c <= 9d+163) then
        tmp = -sqrt((2.0d0 * abs((f / b_m))))
    else
        tmp = sqrt((f * c)) * ((-2.0d0) / b_m)
    end if
    code = tmp
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
	double tmp;
	if (C <= 9e+163) {
		tmp = -Math.sqrt((2.0 * Math.abs((F / B_m))));
	} else {
		tmp = Math.sqrt((F * C)) * (-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 <= 9e+163:
		tmp = -math.sqrt((2.0 * math.fabs((F / B_m))))
	else:
		tmp = math.sqrt((F * C)) * (-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 <= 9e+163)
		tmp = Float64(-sqrt(Float64(2.0 * abs(Float64(F / B_m)))));
	else
		tmp = Float64(sqrt(Float64(F * C)) * Float64(-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 <= 9e+163)
		tmp = -sqrt((2.0 * abs((F / B_m))));
	else
		tmp = sqrt((F * C)) * (-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, 9e+163], (-N[Sqrt[N[(2.0 * N[Abs[N[(F / B$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), N[(N[Sqrt[N[(F * C), $MachinePrecision]], $MachinePrecision] * N[(-2.0 / 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 9 \cdot 10^{+163}:\\
\;\;\;\;-\sqrt{2 \cdot \left|\frac{F}{B\_m}\right|}\\

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


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

    1. Initial program 19.0%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto -\color{blue}{\sqrt{\frac{F}{B} \cdot 2}} \]
    10. Step-by-step derivation
      1. add-sqr-sqrt14.8%

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

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

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

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

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

        \[\leadsto -\sqrt{\color{blue}{\left|\frac{F}{B}\right|} \cdot 2} \]
    13. Simplified32.0%

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

    if 8.99999999999999976e163 < C

    1. Initial program 1.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{F \cdot C} \cdot \left(-\frac{\color{blue}{2}}{B}\right) \]
      7. distribute-neg-frac14.7%

        \[\leadsto \sqrt{F \cdot C} \cdot \color{blue}{\frac{-2}{B}} \]
      8. metadata-eval14.7%

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

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

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

Alternative 12: 29.0% accurate, 5.7× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ [A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\ \\ \begin{array}{l} \mathbf{if}\;C \leq 5.8 \cdot 10^{+164}:\\ \;\;\;\;-\sqrt{\frac{F \cdot 2}{B\_m}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{F \cdot C} \cdot \frac{-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 5.8e+164)
   (- (sqrt (/ (* F 2.0) B_m)))
   (* (sqrt (* F C)) (/ -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 <= 5.8e+164) {
		tmp = -sqrt(((F * 2.0) / B_m));
	} else {
		tmp = sqrt((F * C)) * (-2.0 / B_m);
	}
	return tmp;
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
    real(8), intent (in) :: a
    real(8), intent (in) :: b_m
    real(8), intent (in) :: c
    real(8), intent (in) :: f
    real(8) :: tmp
    if (c <= 5.8d+164) then
        tmp = -sqrt(((f * 2.0d0) / b_m))
    else
        tmp = sqrt((f * c)) * ((-2.0d0) / b_m)
    end if
    code = tmp
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
	double tmp;
	if (C <= 5.8e+164) {
		tmp = -Math.sqrt(((F * 2.0) / B_m));
	} else {
		tmp = Math.sqrt((F * C)) * (-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 <= 5.8e+164:
		tmp = -math.sqrt(((F * 2.0) / B_m))
	else:
		tmp = math.sqrt((F * C)) * (-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 <= 5.8e+164)
		tmp = Float64(-sqrt(Float64(Float64(F * 2.0) / B_m)));
	else
		tmp = Float64(sqrt(Float64(F * C)) * Float64(-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 <= 5.8e+164)
		tmp = -sqrt(((F * 2.0) / B_m));
	else
		tmp = sqrt((F * C)) * (-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, 5.8e+164], (-N[Sqrt[N[(N[(F * 2.0), $MachinePrecision] / B$95$m), $MachinePrecision]], $MachinePrecision]), N[(N[Sqrt[N[(F * C), $MachinePrecision]], $MachinePrecision] * N[(-2.0 / 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 5.8 \cdot 10^{+164}:\\
\;\;\;\;-\sqrt{\frac{F \cdot 2}{B\_m}}\\

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


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

    1. Initial program 19.0%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -\sqrt{\color{blue}{\frac{F \cdot 2}{B}}} \]
    11. Applied egg-rr14.8%

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

    if 5.7999999999999997e164 < C

    1. Initial program 1.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{F \cdot C} \cdot \left(-\frac{\color{blue}{2}}{B}\right) \]
      7. distribute-neg-frac14.7%

        \[\leadsto \sqrt{F \cdot C} \cdot \color{blue}{\frac{-2}{B}} \]
      8. metadata-eval14.7%

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

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

Alternative 13: 28.0% accurate, 6.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 14: 28.0% accurate, 6.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 15: 2.4% accurate, 6.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto -\sqrt{\color{blue}{2 \cdot \frac{F}{B}}} \]
    2. add-sqr-sqrt0.6%

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

      \[\leadsto \color{blue}{\sqrt{\left(-\sqrt{2 \cdot \frac{F}{B}}\right) \cdot \left(-\sqrt{2 \cdot \frac{F}{B}}\right)}} \]
    4. sqr-neg1.7%

      \[\leadsto \sqrt{\color{blue}{\sqrt{2 \cdot \frac{F}{B}} \cdot \sqrt{2 \cdot \frac{F}{B}}}} \]
    5. add-sqr-sqrt1.7%

      \[\leadsto \sqrt{\color{blue}{2 \cdot \frac{F}{B}}} \]
    6. *-un-lft-identity1.7%

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

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

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

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

    \[\leadsto \color{blue}{\sqrt{\frac{F}{B} \cdot 2}} \]
  14. Final simplification1.7%

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

Reproduce

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