ABCF->ab-angle b

Percentage Accurate: 19.6% → 51.4%
Time: 22.5s
Alternatives: 13
Speedup: 5.6×

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 13 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: 19.6% accurate, 1.0× speedup?

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

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

Alternative 1: 51.4% accurate, 0.3× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ [A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\ \\ \begin{array}{l} t_0 := A \cdot \left(C \cdot -4\right)\\ t_1 := \mathsf{fma}\left(B\_m, B\_m, t\_0\right)\\ t_2 := -t\_1\\ t_3 := \left(4 \cdot A\right) \cdot C\\ t_4 := \frac{\sqrt{\left(2 \cdot \left(\left({B\_m}^{2} - t\_3\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{B\_m}^{2} + {\left(A - C\right)}^{2}}\right)}}{t\_3 - {B\_m}^{2}}\\ t_5 := A + \left(A + -0.5 \cdot \frac{{B\_m}^{2}}{C}\right)\\ t_6 := F \cdot t\_1\\ \mathbf{if}\;t\_4 \leq -\infty:\\ \;\;\;\;\frac{\mathsf{hypot}\left(B\_m, \sqrt{t\_0}\right) \cdot \sqrt{\left(2 \cdot F\right) \cdot t\_5}}{t\_2}\\ \mathbf{elif}\;t\_4 \leq -5 \cdot 10^{-216}:\\ \;\;\;\;\sqrt{\left(2 \cdot \left(\left(A + C\right) - \mathsf{hypot}\left(A - C, B\_m\right)\right)\right) \cdot t\_6} \cdot \frac{-1}{t\_1}\\ \mathbf{elif}\;t\_4 \leq \infty:\\ \;\;\;\;\frac{\sqrt{\left(2 \cdot t\_5\right) \cdot t\_6}}{t\_2}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{\left(2 \cdot F\right) \cdot \left(C - \mathsf{hypot}\left(C, B\_m\right)\right)}}{-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 (* A (* C -4.0)))
        (t_1 (fma B_m B_m t_0))
        (t_2 (- t_1))
        (t_3 (* (* 4.0 A) C))
        (t_4
         (/
          (sqrt
           (*
            (* 2.0 (* (- (pow B_m 2.0) t_3) F))
            (- (+ A C) (sqrt (+ (pow B_m 2.0) (pow (- A C) 2.0))))))
          (- t_3 (pow B_m 2.0))))
        (t_5 (+ A (+ A (* -0.5 (/ (pow B_m 2.0) C)))))
        (t_6 (* F t_1)))
   (if (<= t_4 (- INFINITY))
     (/ (* (hypot B_m (sqrt t_0)) (sqrt (* (* 2.0 F) t_5))) t_2)
     (if (<= t_4 -5e-216)
       (* (sqrt (* (* 2.0 (- (+ A C) (hypot (- A C) B_m))) t_6)) (/ -1.0 t_1))
       (if (<= t_4 INFINITY)
         (/ (sqrt (* (* 2.0 t_5) t_6)) t_2)
         (/ (sqrt (* (* 2.0 F) (- C (hypot C B_m)))) (- 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 = A * (C * -4.0);
	double t_1 = fma(B_m, B_m, t_0);
	double t_2 = -t_1;
	double t_3 = (4.0 * A) * C;
	double t_4 = sqrt(((2.0 * ((pow(B_m, 2.0) - t_3) * F)) * ((A + C) - sqrt((pow(B_m, 2.0) + pow((A - C), 2.0)))))) / (t_3 - pow(B_m, 2.0));
	double t_5 = A + (A + (-0.5 * (pow(B_m, 2.0) / C)));
	double t_6 = F * t_1;
	double tmp;
	if (t_4 <= -((double) INFINITY)) {
		tmp = (hypot(B_m, sqrt(t_0)) * sqrt(((2.0 * F) * t_5))) / t_2;
	} else if (t_4 <= -5e-216) {
		tmp = sqrt(((2.0 * ((A + C) - hypot((A - C), B_m))) * t_6)) * (-1.0 / t_1);
	} else if (t_4 <= ((double) INFINITY)) {
		tmp = sqrt(((2.0 * t_5) * t_6)) / t_2;
	} else {
		tmp = sqrt(((2.0 * F) * (C - hypot(C, B_m)))) / -B_m;
	}
	return tmp;
}
B_m = abs(B)
A, B_m, C, F = sort([A, B_m, C, F])
function code(A, B_m, C, F)
	t_0 = Float64(A * Float64(C * -4.0))
	t_1 = fma(B_m, B_m, t_0)
	t_2 = Float64(-t_1)
	t_3 = Float64(Float64(4.0 * A) * C)
	t_4 = Float64(sqrt(Float64(Float64(2.0 * Float64(Float64((B_m ^ 2.0) - t_3) * F)) * Float64(Float64(A + C) - sqrt(Float64((B_m ^ 2.0) + (Float64(A - C) ^ 2.0)))))) / Float64(t_3 - (B_m ^ 2.0)))
	t_5 = Float64(A + Float64(A + Float64(-0.5 * Float64((B_m ^ 2.0) / C))))
	t_6 = Float64(F * t_1)
	tmp = 0.0
	if (t_4 <= Float64(-Inf))
		tmp = Float64(Float64(hypot(B_m, sqrt(t_0)) * sqrt(Float64(Float64(2.0 * F) * t_5))) / t_2);
	elseif (t_4 <= -5e-216)
		tmp = Float64(sqrt(Float64(Float64(2.0 * Float64(Float64(A + C) - hypot(Float64(A - C), B_m))) * t_6)) * Float64(-1.0 / t_1));
	elseif (t_4 <= Inf)
		tmp = Float64(sqrt(Float64(Float64(2.0 * t_5) * t_6)) / t_2);
	else
		tmp = Float64(sqrt(Float64(Float64(2.0 * F) * Float64(C - hypot(C, B_m)))) / 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[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(B$95$m * B$95$m + t$95$0), $MachinePrecision]}, Block[{t$95$2 = (-t$95$1)}, Block[{t$95$3 = N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]}, Block[{t$95$4 = N[(N[Sqrt[N[(N[(2.0 * N[(N[(N[Power[B$95$m, 2.0], $MachinePrecision] - t$95$3), $MachinePrecision] * F), $MachinePrecision]), $MachinePrecision] * N[(N[(A + C), $MachinePrecision] - N[Sqrt[N[(N[Power[B$95$m, 2.0], $MachinePrecision] + N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(t$95$3 - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[(A + N[(A + N[(-0.5 * N[(N[Power[B$95$m, 2.0], $MachinePrecision] / C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$6 = N[(F * t$95$1), $MachinePrecision]}, If[LessEqual[t$95$4, (-Infinity)], N[(N[(N[Sqrt[B$95$m ^ 2 + N[Sqrt[t$95$0], $MachinePrecision] ^ 2], $MachinePrecision] * N[Sqrt[N[(N[(2.0 * F), $MachinePrecision] * t$95$5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / t$95$2), $MachinePrecision], If[LessEqual[t$95$4, -5e-216], N[(N[Sqrt[N[(N[(2.0 * N[(N[(A + C), $MachinePrecision] - N[Sqrt[N[(A - C), $MachinePrecision] ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$6), $MachinePrecision]], $MachinePrecision] * N[(-1.0 / t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, Infinity], N[(N[Sqrt[N[(N[(2.0 * t$95$5), $MachinePrecision] * t$95$6), $MachinePrecision]], $MachinePrecision] / t$95$2), $MachinePrecision], N[(N[Sqrt[N[(N[(2.0 * F), $MachinePrecision] * N[(C - N[Sqrt[C ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-B$95$m)), $MachinePrecision]]]]]]]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := A \cdot \left(C \cdot -4\right)\\
t_1 := \mathsf{fma}\left(B\_m, B\_m, t\_0\right)\\
t_2 := -t\_1\\
t_3 := \left(4 \cdot A\right) \cdot C\\
t_4 := \frac{\sqrt{\left(2 \cdot \left(\left({B\_m}^{2} - t\_3\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{B\_m}^{2} + {\left(A - C\right)}^{2}}\right)}}{t\_3 - {B\_m}^{2}}\\
t_5 := A + \left(A + -0.5 \cdot \frac{{B\_m}^{2}}{C}\right)\\
t_6 := F \cdot t\_1\\
\mathbf{if}\;t\_4 \leq -\infty:\\
\;\;\;\;\frac{\mathsf{hypot}\left(B\_m, \sqrt{t\_0}\right) \cdot \sqrt{\left(2 \cdot F\right) \cdot t\_5}}{t\_2}\\

\mathbf{elif}\;t\_4 \leq -5 \cdot 10^{-216}:\\
\;\;\;\;\sqrt{\left(2 \cdot \left(\left(A + C\right) - \mathsf{hypot}\left(A - C, B\_m\right)\right)\right) \cdot t\_6} \cdot \frac{-1}{t\_1}\\

\mathbf{elif}\;t\_4 \leq \infty:\\
\;\;\;\;\frac{\sqrt{\left(2 \cdot t\_5\right) \cdot t\_6}}{t\_2}\\

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


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

    1. Initial program 3.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. Simplified15.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 99.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. Simplified99.4%

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

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

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

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

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

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

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

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

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

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

    1. Initial program 0.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 52.1% accurate, 0.4× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ [A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\ \\ \begin{array}{l} t_0 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\ t_1 := \left(4 \cdot A\right) \cdot C\\ t_2 := \frac{\sqrt{\left(2 \cdot \left(\left({B\_m}^{2} - t\_1\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{B\_m}^{2} + {\left(A - C\right)}^{2}}\right)}}{t\_1 - {B\_m}^{2}}\\ t_3 := \mathsf{fma}\left(C, A \cdot -4, {B\_m}^{2}\right)\\ \mathbf{if}\;t\_2 \leq -5 \cdot 10^{-216}:\\ \;\;\;\;\frac{\sqrt{F \cdot \left(A + \left(C - \mathsf{hypot}\left(B\_m, A - C\right)\right)\right)} \cdot \sqrt{2 \cdot t\_3}}{-t\_3}\\ \mathbf{elif}\;t\_2 \leq \infty:\\ \;\;\;\;\frac{\sqrt{\left(2 \cdot \left(A + \left(A + -0.5 \cdot \frac{{B\_m}^{2}}{C}\right)\right)\right) \cdot \left(F \cdot t\_0\right)}}{-t\_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{\left(2 \cdot F\right) \cdot \left(C - \mathsf{hypot}\left(C, B\_m\right)\right)}}{-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 (* C -4.0))))
        (t_1 (* (* 4.0 A) C))
        (t_2
         (/
          (sqrt
           (*
            (* 2.0 (* (- (pow B_m 2.0) t_1) F))
            (- (+ A C) (sqrt (+ (pow B_m 2.0) (pow (- A C) 2.0))))))
          (- t_1 (pow B_m 2.0))))
        (t_3 (fma C (* A -4.0) (pow B_m 2.0))))
   (if (<= t_2 -5e-216)
     (/
      (* (sqrt (* F (+ A (- C (hypot B_m (- A C)))))) (sqrt (* 2.0 t_3)))
      (- t_3))
     (if (<= t_2 INFINITY)
       (/
        (sqrt (* (* 2.0 (+ A (+ A (* -0.5 (/ (pow B_m 2.0) C))))) (* F t_0)))
        (- t_0))
       (/ (sqrt (* (* 2.0 F) (- C (hypot C B_m)))) (- 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 * (C * -4.0)));
	double t_1 = (4.0 * A) * C;
	double t_2 = sqrt(((2.0 * ((pow(B_m, 2.0) - t_1) * F)) * ((A + C) - sqrt((pow(B_m, 2.0) + pow((A - C), 2.0)))))) / (t_1 - pow(B_m, 2.0));
	double t_3 = fma(C, (A * -4.0), pow(B_m, 2.0));
	double tmp;
	if (t_2 <= -5e-216) {
		tmp = (sqrt((F * (A + (C - hypot(B_m, (A - C)))))) * sqrt((2.0 * t_3))) / -t_3;
	} else if (t_2 <= ((double) INFINITY)) {
		tmp = sqrt(((2.0 * (A + (A + (-0.5 * (pow(B_m, 2.0) / C))))) * (F * t_0))) / -t_0;
	} else {
		tmp = sqrt(((2.0 * F) * (C - hypot(C, B_m)))) / -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(C * -4.0)))
	t_1 = Float64(Float64(4.0 * A) * C)
	t_2 = Float64(sqrt(Float64(Float64(2.0 * Float64(Float64((B_m ^ 2.0) - t_1) * F)) * Float64(Float64(A + C) - sqrt(Float64((B_m ^ 2.0) + (Float64(A - C) ^ 2.0)))))) / Float64(t_1 - (B_m ^ 2.0)))
	t_3 = fma(C, Float64(A * -4.0), (B_m ^ 2.0))
	tmp = 0.0
	if (t_2 <= -5e-216)
		tmp = Float64(Float64(sqrt(Float64(F * Float64(A + Float64(C - hypot(B_m, Float64(A - C)))))) * sqrt(Float64(2.0 * t_3))) / Float64(-t_3));
	elseif (t_2 <= Inf)
		tmp = Float64(sqrt(Float64(Float64(2.0 * Float64(A + Float64(A + Float64(-0.5 * Float64((B_m ^ 2.0) / C))))) * Float64(F * t_0))) / Float64(-t_0));
	else
		tmp = Float64(sqrt(Float64(Float64(2.0 * F) * Float64(C - hypot(C, B_m)))) / 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[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[N[(N[(2.0 * N[(N[(N[Power[B$95$m, 2.0], $MachinePrecision] - t$95$1), $MachinePrecision] * F), $MachinePrecision]), $MachinePrecision] * N[(N[(A + C), $MachinePrecision] - N[Sqrt[N[(N[Power[B$95$m, 2.0], $MachinePrecision] + N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(t$95$1 - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(C * N[(A * -4.0), $MachinePrecision] + N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e-216], N[(N[(N[Sqrt[N[(F * N[(A + N[(C - N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(2.0 * t$95$3), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / (-t$95$3)), $MachinePrecision], If[LessEqual[t$95$2, Infinity], N[(N[Sqrt[N[(N[(2.0 * N[(A + N[(A + N[(-0.5 * N[(N[Power[B$95$m, 2.0], $MachinePrecision] / C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-t$95$0)), $MachinePrecision], N[(N[Sqrt[N[(N[(2.0 * F), $MachinePrecision] * N[(C - N[Sqrt[C ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-B$95$m)), $MachinePrecision]]]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\
t_1 := \left(4 \cdot A\right) \cdot C\\
t_2 := \frac{\sqrt{\left(2 \cdot \left(\left({B\_m}^{2} - t\_1\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{B\_m}^{2} + {\left(A - C\right)}^{2}}\right)}}{t\_1 - {B\_m}^{2}}\\
t_3 := \mathsf{fma}\left(C, A \cdot -4, {B\_m}^{2}\right)\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{-216}:\\
\;\;\;\;\frac{\sqrt{F \cdot \left(A + \left(C - \mathsf{hypot}\left(B\_m, A - C\right)\right)\right)} \cdot \sqrt{2 \cdot t\_3}}{-t\_3}\\

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

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


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

    1. Initial program 37.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. Simplified35.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 0.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 41.7% accurate, 1.4× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ [A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\ \\ \begin{array}{l} t_0 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\ \mathbf{if}\;F \leq -2.5 \cdot 10^{+145}:\\ \;\;\;\;\frac{-1}{\frac{B\_m}{\sqrt{{B\_m}^{2} \cdot \frac{F}{-C}}}}\\ \mathbf{elif}\;F \leq -1 \cdot 10^{-310}:\\ \;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(-\sqrt{F \cdot \left(A - \mathsf{hypot}\left(B\_m, A\right)\right)}\right)\\ \mathbf{elif}\;F \leq 8.5 \cdot 10^{+156}:\\ \;\;\;\;\sqrt{\left(2 \cdot \left(\left(A + C\right) - \mathsf{hypot}\left(A - C, B\_m\right)\right)\right) \cdot \left(F \cdot t\_0\right)} \cdot \frac{-1}{t\_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{\left(C - \mathsf{hypot}\left(C, B\_m\right)\right) \cdot \left(F \cdot -2\right)}}{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 (* C -4.0)))))
   (if (<= F -2.5e+145)
     (/ -1.0 (/ B_m (sqrt (* (pow B_m 2.0) (/ F (- C))))))
     (if (<= F -1e-310)
       (* (/ (sqrt 2.0) B_m) (- (sqrt (* F (- A (hypot B_m A))))))
       (if (<= F 8.5e+156)
         (*
          (sqrt (* (* 2.0 (- (+ A C) (hypot (- A C) B_m))) (* F t_0)))
          (/ -1.0 t_0))
         (/ (sqrt (* (- C (hypot C B_m)) (* 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 t_0 = fma(B_m, B_m, (A * (C * -4.0)));
	double tmp;
	if (F <= -2.5e+145) {
		tmp = -1.0 / (B_m / sqrt((pow(B_m, 2.0) * (F / -C))));
	} else if (F <= -1e-310) {
		tmp = (sqrt(2.0) / B_m) * -sqrt((F * (A - hypot(B_m, A))));
	} else if (F <= 8.5e+156) {
		tmp = sqrt(((2.0 * ((A + C) - hypot((A - C), B_m))) * (F * t_0))) * (-1.0 / t_0);
	} else {
		tmp = sqrt(((C - hypot(C, B_m)) * (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)
	t_0 = fma(B_m, B_m, Float64(A * Float64(C * -4.0)))
	tmp = 0.0
	if (F <= -2.5e+145)
		tmp = Float64(-1.0 / Float64(B_m / sqrt(Float64((B_m ^ 2.0) * Float64(F / Float64(-C))))));
	elseif (F <= -1e-310)
		tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(-sqrt(Float64(F * Float64(A - hypot(B_m, A))))));
	elseif (F <= 8.5e+156)
		tmp = Float64(sqrt(Float64(Float64(2.0 * Float64(Float64(A + C) - hypot(Float64(A - C), B_m))) * Float64(F * t_0))) * Float64(-1.0 / t_0));
	else
		tmp = Float64(sqrt(Float64(Float64(C - hypot(C, B_m)) * Float64(F * -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[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -2.5e+145], N[(-1.0 / N[(B$95$m / N[Sqrt[N[(N[Power[B$95$m, 2.0], $MachinePrecision] * N[(F / (-C)), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, -1e-310], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * (-N[Sqrt[N[(F * N[(A - N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[F, 8.5e+156], N[(N[Sqrt[N[(N[(2.0 * N[(N[(A + C), $MachinePrecision] - N[Sqrt[N[(A - C), $MachinePrecision] ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-1.0 / t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(N[(C - N[Sqrt[C ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision] * N[(F * -2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / B$95$m), $MachinePrecision]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\
\mathbf{if}\;F \leq -2.5 \cdot 10^{+145}:\\
\;\;\;\;\frac{-1}{\frac{B\_m}{\sqrt{{B\_m}^{2} \cdot \frac{F}{-C}}}}\\

\mathbf{elif}\;F \leq -1 \cdot 10^{-310}:\\
\;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(-\sqrt{F \cdot \left(A - \mathsf{hypot}\left(B\_m, A\right)\right)}\right)\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if F < -2.49999999999999983e145

    1. Initial program 10.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\sqrt{\color{blue}{-1 \cdot \frac{{B}^{2} \cdot F}{C}}}}{-B} \]
    11. Step-by-step derivation
      1. clear-num6.7%

        \[\leadsto \color{blue}{\frac{1}{\frac{-B}{\sqrt{-1 \cdot \frac{{B}^{2} \cdot F}{C}}}}} \]
      2. inv-pow6.7%

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

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

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

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

        \[\leadsto \color{blue}{\frac{1}{\frac{-B}{\sqrt{-{B}^{2} \cdot \frac{F}{C}}}}} \]
      2. distribute-rgt-neg-in6.5%

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

        \[\leadsto \frac{1}{\frac{-B}{\sqrt{{B}^{2} \cdot \color{blue}{\frac{F}{-C}}}}} \]
    14. Simplified6.5%

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

    if -2.49999999999999983e145 < F < -9.999999999999969e-311

    1. Initial program 15.1%

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

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

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

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

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

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

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

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

    if -9.999999999999969e-311 < F < 8.49999999999999948e156

    1. Initial program 35.7%

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

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

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

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

    if 8.49999999999999948e156 < F

    1. Initial program 19.1%

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Add Preprocessing
    3. Taylor expanded in 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 -\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(C - \sqrt{\color{blue}{{C}^{2} + {B}^{2}}}\right)} \]
      3. unpow211.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 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 -1.35 \cdot 10^{+145}:\\ \;\;\;\;\frac{-1}{\frac{B\_m}{\sqrt{{B\_m}^{2} \cdot \frac{F}{-C}}}}\\ \mathbf{elif}\;F \leq -1 \cdot 10^{-310}:\\ \;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(-\sqrt{F \cdot \left(A - \mathsf{hypot}\left(B\_m, A\right)\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{\left(C - \mathsf{hypot}\left(C, B\_m\right)\right) \cdot \left(F \cdot -2\right)}}{B\_m}\\ \end{array} \end{array} \]
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
 :precision binary64
 (if (<= F -1.35e+145)
   (/ -1.0 (/ B_m (sqrt (* (pow B_m 2.0) (/ F (- C))))))
   (if (<= F -1e-310)
     (* (/ (sqrt 2.0) B_m) (- (sqrt (* F (- A (hypot B_m A))))))
     (/ (sqrt (* (- C (hypot C B_m)) (* 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 <= -1.35e+145) {
		tmp = -1.0 / (B_m / sqrt((pow(B_m, 2.0) * (F / -C))));
	} else if (F <= -1e-310) {
		tmp = (sqrt(2.0) / B_m) * -sqrt((F * (A - hypot(B_m, A))));
	} else {
		tmp = sqrt(((C - hypot(C, B_m)) * (F * -2.0))) / B_m;
	}
	return tmp;
}
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
	double tmp;
	if (F <= -1.35e+145) {
		tmp = -1.0 / (B_m / Math.sqrt((Math.pow(B_m, 2.0) * (F / -C))));
	} else if (F <= -1e-310) {
		tmp = (Math.sqrt(2.0) / B_m) * -Math.sqrt((F * (A - Math.hypot(B_m, A))));
	} else {
		tmp = Math.sqrt(((C - Math.hypot(C, B_m)) * (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 <= -1.35e+145:
		tmp = -1.0 / (B_m / math.sqrt((math.pow(B_m, 2.0) * (F / -C))))
	elif F <= -1e-310:
		tmp = (math.sqrt(2.0) / B_m) * -math.sqrt((F * (A - math.hypot(B_m, A))))
	else:
		tmp = math.sqrt(((C - math.hypot(C, B_m)) * (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 <= -1.35e+145)
		tmp = Float64(-1.0 / Float64(B_m / sqrt(Float64((B_m ^ 2.0) * Float64(F / Float64(-C))))));
	elseif (F <= -1e-310)
		tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(-sqrt(Float64(F * Float64(A - hypot(B_m, A))))));
	else
		tmp = Float64(sqrt(Float64(Float64(C - hypot(C, B_m)) * 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 <= -1.35e+145)
		tmp = -1.0 / (B_m / sqrt(((B_m ^ 2.0) * (F / -C))));
	elseif (F <= -1e-310)
		tmp = (sqrt(2.0) / B_m) * -sqrt((F * (A - hypot(B_m, A))));
	else
		tmp = sqrt(((C - hypot(C, B_m)) * (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, -1.35e+145], N[(-1.0 / N[(B$95$m / N[Sqrt[N[(N[Power[B$95$m, 2.0], $MachinePrecision] * N[(F / (-C)), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[F, -1e-310], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * (-N[Sqrt[N[(F * N[(A - N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(N[Sqrt[N[(N[(C - N[Sqrt[C ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision] * N[(F * -2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / B$95$m), $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.35 \cdot 10^{+145}:\\
\;\;\;\;\frac{-1}{\frac{B\_m}{\sqrt{{B\_m}^{2} \cdot \frac{F}{-C}}}}\\

\mathbf{elif}\;F \leq -1 \cdot 10^{-310}:\\
\;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(-\sqrt{F \cdot \left(A - \mathsf{hypot}\left(B\_m, A\right)\right)}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if F < -1.35000000000000011e145

    1. Initial program 10.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\sqrt{\color{blue}{-1 \cdot \frac{{B}^{2} \cdot F}{C}}}}{-B} \]
    11. Step-by-step derivation
      1. clear-num6.7%

        \[\leadsto \color{blue}{\frac{1}{\frac{-B}{\sqrt{-1 \cdot \frac{{B}^{2} \cdot F}{C}}}}} \]
      2. inv-pow6.7%

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

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

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

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

        \[\leadsto \color{blue}{\frac{1}{\frac{-B}{\sqrt{-{B}^{2} \cdot \frac{F}{C}}}}} \]
      2. distribute-rgt-neg-in6.5%

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

        \[\leadsto \frac{1}{\frac{-B}{\sqrt{{B}^{2} \cdot \color{blue}{\frac{F}{-C}}}}} \]
    14. Simplified6.5%

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

    if -1.35000000000000011e145 < F < -9.999999999999969e-311

    1. Initial program 15.1%

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

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

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

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

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

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

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

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

    if -9.999999999999969e-311 < F

    1. Initial program 31.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 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 -\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(C - \sqrt{\color{blue}{{C}^{2} + {B}^{2}}}\right)} \]
      3. unpow211.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 34.4% 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.3 \cdot 10^{+145}:\\ \;\;\;\;\frac{\sqrt{{B\_m}^{2} \cdot \frac{F}{-C}}}{-B\_m}\\ \mathbf{elif}\;F \leq -3.8 \cdot 10^{-307}:\\ \;\;\;\;\frac{\sqrt{-2 \cdot \left(B\_m \cdot F\right)}}{-B\_m}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{\left(C - \mathsf{hypot}\left(C, B\_m\right)\right) \cdot \left(F \cdot -2\right)}}{B\_m}\\ \end{array} \end{array} \]
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
 :precision binary64
 (if (<= F -1.3e+145)
   (/ (sqrt (* (pow B_m 2.0) (/ F (- C)))) (- B_m))
   (if (<= F -3.8e-307)
     (/ (sqrt (* -2.0 (* B_m F))) (- B_m))
     (/ (sqrt (* (- C (hypot C B_m)) (* 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 <= -1.3e+145) {
		tmp = sqrt((pow(B_m, 2.0) * (F / -C))) / -B_m;
	} else if (F <= -3.8e-307) {
		tmp = sqrt((-2.0 * (B_m * F))) / -B_m;
	} else {
		tmp = sqrt(((C - hypot(C, B_m)) * (F * -2.0))) / B_m;
	}
	return tmp;
}
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
	double tmp;
	if (F <= -1.3e+145) {
		tmp = Math.sqrt((Math.pow(B_m, 2.0) * (F / -C))) / -B_m;
	} else if (F <= -3.8e-307) {
		tmp = Math.sqrt((-2.0 * (B_m * F))) / -B_m;
	} else {
		tmp = Math.sqrt(((C - Math.hypot(C, B_m)) * (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 <= -1.3e+145:
		tmp = math.sqrt((math.pow(B_m, 2.0) * (F / -C))) / -B_m
	elif F <= -3.8e-307:
		tmp = math.sqrt((-2.0 * (B_m * F))) / -B_m
	else:
		tmp = math.sqrt(((C - math.hypot(C, B_m)) * (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 <= -1.3e+145)
		tmp = Float64(sqrt(Float64((B_m ^ 2.0) * Float64(F / Float64(-C)))) / Float64(-B_m));
	elseif (F <= -3.8e-307)
		tmp = Float64(sqrt(Float64(-2.0 * Float64(B_m * F))) / Float64(-B_m));
	else
		tmp = Float64(sqrt(Float64(Float64(C - hypot(C, B_m)) * 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 <= -1.3e+145)
		tmp = sqrt(((B_m ^ 2.0) * (F / -C))) / -B_m;
	elseif (F <= -3.8e-307)
		tmp = sqrt((-2.0 * (B_m * F))) / -B_m;
	else
		tmp = sqrt(((C - hypot(C, B_m)) * (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, -1.3e+145], N[(N[Sqrt[N[(N[Power[B$95$m, 2.0], $MachinePrecision] * N[(F / (-C)), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-B$95$m)), $MachinePrecision], If[LessEqual[F, -3.8e-307], N[(N[Sqrt[N[(-2.0 * N[(B$95$m * F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-B$95$m)), $MachinePrecision], N[(N[Sqrt[N[(N[(C - N[Sqrt[C ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision] * N[(F * -2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / B$95$m), $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.3 \cdot 10^{+145}:\\
\;\;\;\;\frac{\sqrt{{B\_m}^{2} \cdot \frac{F}{-C}}}{-B\_m}\\

\mathbf{elif}\;F \leq -3.8 \cdot 10^{-307}:\\
\;\;\;\;\frac{\sqrt{-2 \cdot \left(B\_m \cdot F\right)}}{-B\_m}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if F < -1.30000000000000001e145

    1. Initial program 10.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\sqrt{\color{blue}{-1 \cdot \frac{{B}^{2} \cdot F}{C}}}}{-B} \]
    11. Step-by-step derivation
      1. mul-1-neg6.7%

        \[\leadsto \frac{\sqrt{\color{blue}{-\frac{{B}^{2} \cdot F}{C}}}}{-B} \]
      2. associate-/l*6.5%

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

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

        \[\leadsto \frac{\sqrt{{B}^{2} \cdot \color{blue}{\frac{F}{-C}}}}{-B} \]
    12. Simplified6.5%

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

    if -1.30000000000000001e145 < F < -3.79999999999999985e-307

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.79999999999999985e-307 < F

    1. Initial program 30.6%

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Add Preprocessing
    3. Taylor expanded in A around 0 11.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-neg11.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 34.1% accurate, 2.9× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ [A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\ \\ \begin{array}{l} \mathbf{if}\;F \leq -5.1 \cdot 10^{+144}:\\ \;\;\;\;\frac{-1}{\frac{B\_m}{\sqrt{{B\_m}^{2} \cdot \frac{F}{-C}}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{\left(2 \cdot F\right) \cdot \left(C - \mathsf{hypot}\left(C, B\_m\right)\right)}}{-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 -5.1e+144)
   (/ -1.0 (/ B_m (sqrt (* (pow B_m 2.0) (/ F (- C))))))
   (/ (sqrt (* (* 2.0 F) (- C (hypot C B_m)))) (- 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 <= -5.1e+144) {
		tmp = -1.0 / (B_m / sqrt((pow(B_m, 2.0) * (F / -C))));
	} else {
		tmp = sqrt(((2.0 * F) * (C - hypot(C, B_m)))) / -B_m;
	}
	return tmp;
}
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
	double tmp;
	if (F <= -5.1e+144) {
		tmp = -1.0 / (B_m / Math.sqrt((Math.pow(B_m, 2.0) * (F / -C))));
	} else {
		tmp = Math.sqrt(((2.0 * F) * (C - Math.hypot(C, B_m)))) / -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 <= -5.1e+144:
		tmp = -1.0 / (B_m / math.sqrt((math.pow(B_m, 2.0) * (F / -C))))
	else:
		tmp = math.sqrt(((2.0 * F) * (C - math.hypot(C, B_m)))) / -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 <= -5.1e+144)
		tmp = Float64(-1.0 / Float64(B_m / sqrt(Float64((B_m ^ 2.0) * Float64(F / Float64(-C))))));
	else
		tmp = Float64(sqrt(Float64(Float64(2.0 * F) * Float64(C - hypot(C, B_m)))) / Float64(-B_m));
	end
	return tmp
end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
	tmp = 0.0;
	if (F <= -5.1e+144)
		tmp = -1.0 / (B_m / sqrt(((B_m ^ 2.0) * (F / -C))));
	else
		tmp = sqrt(((2.0 * F) * (C - hypot(C, B_m)))) / -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, -5.1e+144], N[(-1.0 / N[(B$95$m / N[Sqrt[N[(N[Power[B$95$m, 2.0], $MachinePrecision] * N[(F / (-C)), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(N[(2.0 * F), $MachinePrecision] * N[(C - N[Sqrt[C ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-B$95$m)), $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.1 \cdot 10^{+144}:\\
\;\;\;\;\frac{-1}{\frac{B\_m}{\sqrt{{B\_m}^{2} \cdot \frac{F}{-C}}}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if F < -5.0999999999999999e144

    1. Initial program 10.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\sqrt{\color{blue}{-1 \cdot \frac{{B}^{2} \cdot F}{C}}}}{-B} \]
    11. Step-by-step derivation
      1. clear-num6.7%

        \[\leadsto \color{blue}{\frac{1}{\frac{-B}{\sqrt{-1 \cdot \frac{{B}^{2} \cdot F}{C}}}}} \]
      2. inv-pow6.7%

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

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

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

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

        \[\leadsto \color{blue}{\frac{1}{\frac{-B}{\sqrt{-{B}^{2} \cdot \frac{F}{C}}}}} \]
      2. distribute-rgt-neg-in6.5%

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

        \[\leadsto \frac{1}{\frac{-B}{\sqrt{{B}^{2} \cdot \color{blue}{\frac{F}{-C}}}}} \]
    14. Simplified6.5%

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

    if -5.0999999999999999e144 < F

    1. Initial program 19.9%

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Add Preprocessing
    3. Taylor expanded in A around 0 9.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-neg9.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 34.1% accurate, 2.9× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if F < -4.39999999999999976e144

    1. Initial program 10.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\sqrt{\color{blue}{-1 \cdot \frac{{B}^{2} \cdot F}{C}}}}{-B} \]
    11. Step-by-step derivation
      1. mul-1-neg6.7%

        \[\leadsto \frac{\sqrt{\color{blue}{-\frac{{B}^{2} \cdot F}{C}}}}{-B} \]
      2. associate-/l*6.5%

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

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

        \[\leadsto \frac{\sqrt{{B}^{2} \cdot \color{blue}{\frac{F}{-C}}}}{-B} \]
    12. Simplified6.5%

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

    if -4.39999999999999976e144 < F

    1. Initial program 19.9%

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Add Preprocessing
    3. Taylor expanded in A around 0 9.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-neg9.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 33.4% 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 -3.8 \cdot 10^{-307}:\\ \;\;\;\;\frac{\sqrt{-2 \cdot \left(B\_m \cdot F\right)}}{-B\_m}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{\left(C - \mathsf{hypot}\left(C, B\_m\right)\right) \cdot \left(F \cdot -2\right)}}{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.8e-307)
   (/ (sqrt (* -2.0 (* B_m F))) (- B_m))
   (/ (sqrt (* (- C (hypot C B_m)) (* 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.8e-307) {
		tmp = sqrt((-2.0 * (B_m * F))) / -B_m;
	} else {
		tmp = sqrt(((C - hypot(C, B_m)) * (F * -2.0))) / B_m;
	}
	return tmp;
}
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
	double tmp;
	if (F <= -3.8e-307) {
		tmp = Math.sqrt((-2.0 * (B_m * F))) / -B_m;
	} else {
		tmp = Math.sqrt(((C - Math.hypot(C, B_m)) * (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.8e-307:
		tmp = math.sqrt((-2.0 * (B_m * F))) / -B_m
	else:
		tmp = math.sqrt(((C - math.hypot(C, B_m)) * (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.8e-307)
		tmp = Float64(sqrt(Float64(-2.0 * Float64(B_m * F))) / Float64(-B_m));
	else
		tmp = Float64(sqrt(Float64(Float64(C - hypot(C, B_m)) * 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.8e-307)
		tmp = sqrt((-2.0 * (B_m * F))) / -B_m;
	else
		tmp = sqrt(((C - hypot(C, B_m)) * (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.8e-307], N[(N[Sqrt[N[(-2.0 * N[(B$95$m * F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-B$95$m)), $MachinePrecision], N[(N[Sqrt[N[(N[(C - N[Sqrt[C ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision] * N[(F * -2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / B$95$m), $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.8 \cdot 10^{-307}:\\
\;\;\;\;\frac{\sqrt{-2 \cdot \left(B\_m \cdot F\right)}}{-B\_m}\\

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


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

    1. Initial program 13.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.79999999999999985e-307 < F

    1. Initial program 30.6%

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Add Preprocessing
    3. Taylor expanded in A around 0 11.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-neg11.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 33.6% accurate, 3.0× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ [A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\ \\ \begin{array}{l} \mathbf{if}\;F \leq -1 \cdot 10^{-310}:\\ \;\;\;\;\frac{\sqrt{-2 \cdot \left(B\_m \cdot F\right)}}{-B\_m}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{\frac{{B\_m}^{2} \cdot F}{-C}}}{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 -1e-310)
   (/ (sqrt (* -2.0 (* B_m F))) (- B_m))
   (/ (sqrt (/ (* (pow B_m 2.0) F) (- C))) 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 <= -1e-310) {
		tmp = sqrt((-2.0 * (B_m * F))) / -B_m;
	} else {
		tmp = sqrt(((pow(B_m, 2.0) * F) / -C)) / 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 <= (-1d-310)) then
        tmp = sqrt(((-2.0d0) * (b_m * f))) / -b_m
    else
        tmp = sqrt((((b_m ** 2.0d0) * f) / -c)) / 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 <= -1e-310) {
		tmp = Math.sqrt((-2.0 * (B_m * F))) / -B_m;
	} else {
		tmp = Math.sqrt(((Math.pow(B_m, 2.0) * F) / -C)) / 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 <= -1e-310:
		tmp = math.sqrt((-2.0 * (B_m * F))) / -B_m
	else:
		tmp = math.sqrt(((math.pow(B_m, 2.0) * F) / -C)) / 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 <= -1e-310)
		tmp = Float64(sqrt(Float64(-2.0 * Float64(B_m * F))) / Float64(-B_m));
	else
		tmp = Float64(sqrt(Float64(Float64((B_m ^ 2.0) * F) / Float64(-C))) / 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 <= -1e-310)
		tmp = sqrt((-2.0 * (B_m * F))) / -B_m;
	else
		tmp = sqrt((((B_m ^ 2.0) * F) / -C)) / 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, -1e-310], N[(N[Sqrt[N[(-2.0 * N[(B$95$m * F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-B$95$m)), $MachinePrecision], N[(N[Sqrt[N[(N[(N[Power[B$95$m, 2.0], $MachinePrecision] * F), $MachinePrecision] / (-C)), $MachinePrecision]], $MachinePrecision] / B$95$m), $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 \cdot 10^{-310}:\\
\;\;\;\;\frac{\sqrt{-2 \cdot \left(B\_m \cdot F\right)}}{-B\_m}\\

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


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

    1. Initial program 13.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -9.999999999999969e-311 < F

    1. Initial program 31.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 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 -\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(C - \sqrt{\color{blue}{{C}^{2} + {B}^{2}}}\right)} \]
      3. unpow211.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\sqrt{-1 \cdot \frac{{B}^{2} \cdot F}{C}}}{\color{blue}{0 + B}} \]
    12. Step-by-step derivation
      1. +-lft-identity30.2%

        \[\leadsto \frac{\sqrt{-1 \cdot \frac{{B}^{2} \cdot F}{C}}}{\color{blue}{B}} \]
    13. Simplified30.2%

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

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

Alternative 10: 28.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.8 \cdot 10^{-307}:\\ \;\;\;\;\frac{\sqrt{-2 \cdot \left(B\_m \cdot F\right)}}{-B\_m}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{F \cdot \left(C \cdot \frac{-4}{{B\_m}^{-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 -3.8e-307)
   (/ (sqrt (* -2.0 (* B_m F))) (- B_m))
   (sqrt (* F (* C (/ -4.0 (pow B_m -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 <= -3.8e-307) {
		tmp = sqrt((-2.0 * (B_m * F))) / -B_m;
	} else {
		tmp = sqrt((F * (C * (-4.0 / pow(B_m, -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 (f <= (-3.8d-307)) then
        tmp = sqrt(((-2.0d0) * (b_m * f))) / -b_m
    else
        tmp = sqrt((f * (c * ((-4.0d0) / (b_m ** (-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 (F <= -3.8e-307) {
		tmp = Math.sqrt((-2.0 * (B_m * F))) / -B_m;
	} else {
		tmp = Math.sqrt((F * (C * (-4.0 / Math.pow(B_m, -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 <= -3.8e-307:
		tmp = math.sqrt((-2.0 * (B_m * F))) / -B_m
	else:
		tmp = math.sqrt((F * (C * (-4.0 / math.pow(B_m, -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 <= -3.8e-307)
		tmp = Float64(sqrt(Float64(-2.0 * Float64(B_m * F))) / Float64(-B_m));
	else
		tmp = sqrt(Float64(F * Float64(C * Float64(-4.0 / (B_m ^ -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 <= -3.8e-307)
		tmp = sqrt((-2.0 * (B_m * F))) / -B_m;
	else
		tmp = sqrt((F * (C * (-4.0 / (B_m ^ -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, -3.8e-307], N[(N[Sqrt[N[(-2.0 * N[(B$95$m * F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-B$95$m)), $MachinePrecision], N[Sqrt[N[(F * N[(C * N[(-4.0 / N[Power[B$95$m, -2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;F \leq -3.8 \cdot 10^{-307}:\\
\;\;\;\;\frac{\sqrt{-2 \cdot \left(B\_m \cdot F\right)}}{-B\_m}\\

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


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

    1. Initial program 13.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.79999999999999985e-307 < F

    1. Initial program 30.6%

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Add Preprocessing
    3. Taylor expanded in A around 0 11.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-neg11.7%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{-1 \cdot \color{blue}{2}}{B} \cdot \sqrt{C \cdot F} \]
      5. metadata-eval4.0%

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

        \[\leadsto \frac{-2}{B} \cdot \sqrt{\color{blue}{F \cdot C}} \]
    8. Simplified4.0%

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

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

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

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

Alternative 11: 28.1% accurate, 5.6× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ [A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\ \\ \begin{array}{l} \mathbf{if}\;F \leq 1.2 \cdot 10^{-102}:\\ \;\;\;\;\frac{\sqrt{-2 \cdot \left(B\_m \cdot F\right)}}{-B\_m}\\ \mathbf{else}:\\ \;\;\;\;\frac{-2}{B\_m} \cdot {\left(C \cdot F\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.2e-102)
   (/ (sqrt (* -2.0 (* B_m F))) (- B_m))
   (* (/ -2.0 B_m) (pow (* C F) -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.2e-102) {
		tmp = sqrt((-2.0 * (B_m * F))) / -B_m;
	} else {
		tmp = (-2.0 / B_m) * pow((C * F), -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 <= 1.2d-102) then
        tmp = sqrt(((-2.0d0) * (b_m * f))) / -b_m
    else
        tmp = ((-2.0d0) / b_m) * ((c * f) ** (-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 <= 1.2e-102) {
		tmp = Math.sqrt((-2.0 * (B_m * F))) / -B_m;
	} else {
		tmp = (-2.0 / B_m) * Math.pow((C * F), -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.2e-102:
		tmp = math.sqrt((-2.0 * (B_m * F))) / -B_m
	else:
		tmp = (-2.0 / B_m) * math.pow((C * F), -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.2e-102)
		tmp = Float64(sqrt(Float64(-2.0 * Float64(B_m * F))) / Float64(-B_m));
	else
		tmp = Float64(Float64(-2.0 / B_m) * (Float64(C * F) ^ -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.2e-102)
		tmp = sqrt((-2.0 * (B_m * F))) / -B_m;
	else
		tmp = (-2.0 / B_m) * ((C * F) ^ -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.2e-102], N[(N[Sqrt[N[(-2.0 * N[(B$95$m * F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-B$95$m)), $MachinePrecision], N[(N[(-2.0 / B$95$m), $MachinePrecision] * N[Power[N[(C * F), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;F \leq 1.2 \cdot 10^{-102}:\\
\;\;\;\;\frac{\sqrt{-2 \cdot \left(B\_m \cdot F\right)}}{-B\_m}\\

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


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

    1. Initial program 15.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.2e-102 < F

    1. Initial program 26.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 4.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-neg4.5%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{-1 \cdot \color{blue}{2}}{B} \cdot \sqrt{C \cdot F} \]
      5. metadata-eval0.4%

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

        \[\leadsto \frac{-2}{B} \cdot \sqrt{\color{blue}{F \cdot C}} \]
    8. Simplified0.4%

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

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

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

Alternative 12: 3.8% accurate, 5.9× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ [A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\ \\ \frac{-2}{B\_m} \cdot {\left(C \cdot F\right)}^{-0.5} \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 (* (/ -2.0 B_m) (pow (* C F) -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) {
	return (-2.0 / B_m) * pow((C * F), -0.5);
}
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 = ((-2.0d0) / b_m) * ((c * f) ** (-0.5d0))
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 (-2.0 / B_m) * Math.pow((C * F), -0.5);
}
B_m = math.fabs(B)
[A, B_m, C, F] = sort([A, B_m, C, F])
def code(A, B_m, C, F):
	return (-2.0 / B_m) * math.pow((C * F), -0.5)
B_m = abs(B)
A, B_m, C, F = sort([A, B_m, C, F])
function code(A, B_m, C, F)
	return Float64(Float64(-2.0 / B_m) * (Float64(C * F) ^ -0.5))
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 = (-2.0 / B_m) * ((C * F) ^ -0.5);
end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := N[(N[(-2.0 / B$95$m), $MachinePrecision] * N[Power[N[(C * F), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\frac{-2}{B\_m} \cdot {\left(C \cdot F\right)}^{-0.5}
\end{array}
Derivation
  1. Initial program 17.7%

    \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
  2. Add Preprocessing
  3. Taylor expanded in A around 0 8.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-neg8.1%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{-1 \cdot \color{blue}{2}}{B} \cdot \sqrt{C \cdot F} \]
    5. metadata-eval3.9%

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

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

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

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

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

Alternative 13: 1.2% accurate, 5.9× speedup?

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

    \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
  2. Add Preprocessing
  3. Taylor expanded in A around 0 8.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-neg8.1%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{-1 \cdot \color{blue}{2}}{B} \cdot \sqrt{C \cdot F} \]
    5. metadata-eval3.9%

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

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

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

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

Reproduce

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