ABCF->ab-angle b

Percentage Accurate: 18.9% → 48.5%
Time: 35.8s
Alternatives: 15
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 15 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 18.9% accurate, 1.0× speedup?

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

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

Alternative 1: 48.5% accurate, 1.2× speedup?

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

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


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

    1. Initial program 25.4%

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

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

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

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

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

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

    1. Initial program 15.4%

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

      \[\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-neg13.9%

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

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

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

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

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

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

        \[\leadsto -\color{blue}{e^{\log \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)}\right)}} \]
      2. associate-*l/24.9%

        \[\leadsto -e^{\log \color{blue}{\left(\frac{\sqrt{2} \cdot \sqrt{F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)}}{B}\right)}} \]
      3. pow1/224.9%

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

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

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

      \[\leadsto -\color{blue}{e^{\log \left(\frac{{\left(2 \cdot \left(F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)\right)\right)}^{0.5}}{B}\right)}} \]
    8. Step-by-step derivation
      1. rem-exp-log28.2%

        \[\leadsto -\color{blue}{\frac{{\left(2 \cdot \left(F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)\right)\right)}^{0.5}}{B}} \]
      2. add-sqr-sqrt26.7%

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

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

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

        \[\leadsto -\frac{{\left(2 \cdot \left(F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)\right)\right)}^{0.5}}{\color{blue}{\sqrt{-B} \cdot \sqrt{-B}}} \]
      6. add-sqr-sqrt25.8%

        \[\leadsto -\frac{{\left(2 \cdot \left(F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)\right)\right)}^{0.5}}{\color{blue}{-B}} \]
      7. clear-num25.8%

        \[\leadsto -\color{blue}{\frac{1}{\frac{-B}{{\left(2 \cdot \left(F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)\right)\right)}^{0.5}}}} \]
      8. add-sqr-sqrt24.5%

        \[\leadsto -\frac{1}{\frac{\color{blue}{\sqrt{-B} \cdot \sqrt{-B}}}{{\left(2 \cdot \left(F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)\right)\right)}^{0.5}}} \]
      9. sqrt-unprod25.0%

        \[\leadsto -\frac{1}{\frac{\color{blue}{\sqrt{\left(-B\right) \cdot \left(-B\right)}}}{{\left(2 \cdot \left(F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)\right)\right)}^{0.5}}} \]
      10. sqr-neg25.0%

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

        \[\leadsto -\frac{1}{\frac{\color{blue}{\sqrt{B} \cdot \sqrt{B}}}{{\left(2 \cdot \left(F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)\right)\right)}^{0.5}}} \]
      12. add-sqr-sqrt28.2%

        \[\leadsto -\frac{1}{\frac{\color{blue}{B}}{{\left(2 \cdot \left(F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)\right)\right)}^{0.5}}} \]
      13. pow1/228.2%

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

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

        \[\leadsto -\frac{1}{\frac{B}{\sqrt{\color{blue}{\left(\left(A - \mathsf{hypot}\left(B, A\right)\right) \cdot F\right)} \cdot 2}}} \]
      16. associate-*l*28.2%

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

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

      \[\leadsto -\frac{1}{\color{blue}{\frac{B}{\sqrt{2}} \cdot \sqrt{\frac{1}{F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}}}} \]
    11. Step-by-step derivation
      1. associate-/r*13.9%

        \[\leadsto -\frac{1}{\frac{B}{\sqrt{2}} \cdot \sqrt{\color{blue}{\frac{\frac{1}{F}}{A - \sqrt{{A}^{2} + {B}^{2}}}}}} \]
      2. +-commutative13.9%

        \[\leadsto -\frac{1}{\frac{B}{\sqrt{2}} \cdot \sqrt{\frac{\frac{1}{F}}{A - \sqrt{\color{blue}{{B}^{2} + {A}^{2}}}}}} \]
      3. unpow213.9%

        \[\leadsto -\frac{1}{\frac{B}{\sqrt{2}} \cdot \sqrt{\frac{\frac{1}{F}}{A - \sqrt{\color{blue}{B \cdot B} + {A}^{2}}}}} \]
      4. unpow213.9%

        \[\leadsto -\frac{1}{\frac{B}{\sqrt{2}} \cdot \sqrt{\frac{\frac{1}{F}}{A - \sqrt{B \cdot B + \color{blue}{A \cdot A}}}}} \]
      5. hypot-undefine27.8%

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

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

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

Alternative 2: 48.5% accurate, 1.2× speedup?

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

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


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

    1. Initial program 25.4%

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

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

      \[\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-neg25.9%

        \[\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. Simplified25.9%

      \[\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 2e17 < (pow.f64 B #s(literal 2 binary64))

    1. Initial program 15.4%

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

      \[\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-neg13.9%

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

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

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

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

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

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

        \[\leadsto -\color{blue}{e^{\log \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)}\right)}} \]
      2. associate-*l/24.9%

        \[\leadsto -e^{\log \color{blue}{\left(\frac{\sqrt{2} \cdot \sqrt{F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)}}{B}\right)}} \]
      3. pow1/224.9%

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

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

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

      \[\leadsto -\color{blue}{e^{\log \left(\frac{{\left(2 \cdot \left(F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)\right)\right)}^{0.5}}{B}\right)}} \]
    8. Step-by-step derivation
      1. rem-exp-log28.2%

        \[\leadsto -\color{blue}{\frac{{\left(2 \cdot \left(F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)\right)\right)}^{0.5}}{B}} \]
      2. add-sqr-sqrt26.7%

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

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

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

        \[\leadsto -\frac{{\left(2 \cdot \left(F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)\right)\right)}^{0.5}}{\color{blue}{\sqrt{-B} \cdot \sqrt{-B}}} \]
      6. add-sqr-sqrt25.8%

        \[\leadsto -\frac{{\left(2 \cdot \left(F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)\right)\right)}^{0.5}}{\color{blue}{-B}} \]
      7. clear-num25.8%

        \[\leadsto -\color{blue}{\frac{1}{\frac{-B}{{\left(2 \cdot \left(F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)\right)\right)}^{0.5}}}} \]
      8. add-sqr-sqrt24.5%

        \[\leadsto -\frac{1}{\frac{\color{blue}{\sqrt{-B} \cdot \sqrt{-B}}}{{\left(2 \cdot \left(F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)\right)\right)}^{0.5}}} \]
      9. sqrt-unprod25.0%

        \[\leadsto -\frac{1}{\frac{\color{blue}{\sqrt{\left(-B\right) \cdot \left(-B\right)}}}{{\left(2 \cdot \left(F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)\right)\right)}^{0.5}}} \]
      10. sqr-neg25.0%

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

        \[\leadsto -\frac{1}{\frac{\color{blue}{\sqrt{B} \cdot \sqrt{B}}}{{\left(2 \cdot \left(F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)\right)\right)}^{0.5}}} \]
      12. add-sqr-sqrt28.2%

        \[\leadsto -\frac{1}{\frac{\color{blue}{B}}{{\left(2 \cdot \left(F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)\right)\right)}^{0.5}}} \]
      13. pow1/228.2%

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

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

        \[\leadsto -\frac{1}{\frac{B}{\sqrt{\color{blue}{\left(\left(A - \mathsf{hypot}\left(B, A\right)\right) \cdot F\right)} \cdot 2}}} \]
      16. associate-*l*28.2%

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

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

      \[\leadsto -\frac{1}{\color{blue}{\frac{B}{\sqrt{2}} \cdot \sqrt{\frac{1}{F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}}}} \]
    11. Step-by-step derivation
      1. associate-/r*13.9%

        \[\leadsto -\frac{1}{\frac{B}{\sqrt{2}} \cdot \sqrt{\color{blue}{\frac{\frac{1}{F}}{A - \sqrt{{A}^{2} + {B}^{2}}}}}} \]
      2. +-commutative13.9%

        \[\leadsto -\frac{1}{\frac{B}{\sqrt{2}} \cdot \sqrt{\frac{\frac{1}{F}}{A - \sqrt{\color{blue}{{B}^{2} + {A}^{2}}}}}} \]
      3. unpow213.9%

        \[\leadsto -\frac{1}{\frac{B}{\sqrt{2}} \cdot \sqrt{\frac{\frac{1}{F}}{A - \sqrt{\color{blue}{B \cdot B} + {A}^{2}}}}} \]
      4. unpow213.9%

        \[\leadsto -\frac{1}{\frac{B}{\sqrt{2}} \cdot \sqrt{\frac{\frac{1}{F}}{A - \sqrt{B \cdot B + \color{blue}{A \cdot A}}}}} \]
      5. hypot-undefine27.8%

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

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

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

Alternative 3: 34.8% accurate, 1.2× speedup?

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

\mathbf{elif}\;{B\_m}^{2} \leq 10^{-126}:\\
\;\;\;\;\sqrt{-0.5 \cdot \frac{{B\_m}^{2} \cdot F}{C}} \cdot \frac{\sqrt{2}}{-B\_m}\\

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


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

    1. Initial program 27.1%

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

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

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

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

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

    if 5.0000000000000003e-291 < (pow.f64 B #s(literal 2 binary64)) < 9.9999999999999995e-127

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

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

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

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

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

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

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

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

    if 9.9999999999999995e-127 < (pow.f64 B #s(literal 2 binary64))

    1. Initial program 19.4%

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

      \[\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-neg15.0%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto -\color{blue}{e^{\log \left(\frac{{\left(2 \cdot \left(F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)\right)\right)}^{0.5}}{B}\right)}} \]
    8. Step-by-step derivation
      1. rem-exp-log26.2%

        \[\leadsto -\color{blue}{\frac{{\left(2 \cdot \left(F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)\right)\right)}^{0.5}}{B}} \]
      2. add-sqr-sqrt24.7%

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

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

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

        \[\leadsto -\frac{{\left(2 \cdot \left(F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)\right)\right)}^{0.5}}{\color{blue}{\sqrt{-B} \cdot \sqrt{-B}}} \]
      6. add-sqr-sqrt23.5%

        \[\leadsto -\frac{{\left(2 \cdot \left(F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)\right)\right)}^{0.5}}{\color{blue}{-B}} \]
      7. clear-num23.5%

        \[\leadsto -\color{blue}{\frac{1}{\frac{-B}{{\left(2 \cdot \left(F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)\right)\right)}^{0.5}}}} \]
      8. add-sqr-sqrt22.1%

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

        \[\leadsto -\frac{1}{\frac{\color{blue}{\sqrt{\left(-B\right) \cdot \left(-B\right)}}}{{\left(2 \cdot \left(F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)\right)\right)}^{0.5}}} \]
      10. sqr-neg26.6%

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

        \[\leadsto -\frac{1}{\frac{\color{blue}{\sqrt{B} \cdot \sqrt{B}}}{{\left(2 \cdot \left(F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)\right)\right)}^{0.5}}} \]
      12. add-sqr-sqrt26.1%

        \[\leadsto -\frac{1}{\frac{\color{blue}{B}}{{\left(2 \cdot \left(F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)\right)\right)}^{0.5}}} \]
      13. pow1/226.1%

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

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

        \[\leadsto -\frac{1}{\frac{B}{\sqrt{\color{blue}{\left(\left(A - \mathsf{hypot}\left(B, A\right)\right) \cdot F\right)} \cdot 2}}} \]
      16. associate-*l*26.1%

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

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

      \[\leadsto -\frac{1}{\color{blue}{\frac{B}{\sqrt{2}} \cdot \sqrt{\frac{1}{F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}}}} \]
    11. Step-by-step derivation
      1. associate-/r*14.9%

        \[\leadsto -\frac{1}{\frac{B}{\sqrt{2}} \cdot \sqrt{\color{blue}{\frac{\frac{1}{F}}{A - \sqrt{{A}^{2} + {B}^{2}}}}}} \]
      2. +-commutative14.9%

        \[\leadsto -\frac{1}{\frac{B}{\sqrt{2}} \cdot \sqrt{\frac{\frac{1}{F}}{A - \sqrt{\color{blue}{{B}^{2} + {A}^{2}}}}}} \]
      3. unpow214.9%

        \[\leadsto -\frac{1}{\frac{B}{\sqrt{2}} \cdot \sqrt{\frac{\frac{1}{F}}{A - \sqrt{\color{blue}{B \cdot B} + {A}^{2}}}}} \]
      4. unpow214.9%

        \[\leadsto -\frac{1}{\frac{B}{\sqrt{2}} \cdot \sqrt{\frac{\frac{1}{F}}{A - \sqrt{B \cdot B + \color{blue}{A \cdot A}}}}} \]
      5. hypot-undefine25.6%

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

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

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

Alternative 4: 48.5% accurate, 1.5× speedup?

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

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


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

    1. Initial program 24.6%

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

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

    if 9.99999999999999939e-12 < (pow.f64 B #s(literal 2 binary64))

    1. Initial program 16.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 C around 0 14.6%

      \[\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-neg14.6%

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

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

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

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

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

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

        \[\leadsto -\color{blue}{e^{\log \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)}\right)}} \]
      2. associate-*l/24.8%

        \[\leadsto -e^{\log \color{blue}{\left(\frac{\sqrt{2} \cdot \sqrt{F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)}}{B}\right)}} \]
      3. pow1/224.8%

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

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

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

      \[\leadsto -\color{blue}{e^{\log \left(\frac{{\left(2 \cdot \left(F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)\right)\right)}^{0.5}}{B}\right)}} \]
    8. Step-by-step derivation
      1. rem-exp-log28.0%

        \[\leadsto -\color{blue}{\frac{{\left(2 \cdot \left(F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)\right)\right)}^{0.5}}{B}} \]
      2. add-sqr-sqrt26.5%

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

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

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

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

        \[\leadsto -\frac{{\left(2 \cdot \left(F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)\right)\right)}^{0.5}}{\color{blue}{-B}} \]
      7. clear-num25.0%

        \[\leadsto -\color{blue}{\frac{1}{\frac{-B}{{\left(2 \cdot \left(F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)\right)\right)}^{0.5}}}} \]
      8. add-sqr-sqrt23.7%

        \[\leadsto -\frac{1}{\frac{\color{blue}{\sqrt{-B} \cdot \sqrt{-B}}}{{\left(2 \cdot \left(F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)\right)\right)}^{0.5}}} \]
      9. sqrt-unprod25.8%

        \[\leadsto -\frac{1}{\frac{\color{blue}{\sqrt{\left(-B\right) \cdot \left(-B\right)}}}{{\left(2 \cdot \left(F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)\right)\right)}^{0.5}}} \]
      10. sqr-neg25.8%

        \[\leadsto -\frac{1}{\frac{\sqrt{\color{blue}{B \cdot B}}}{{\left(2 \cdot \left(F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)\right)\right)}^{0.5}}} \]
      11. sqrt-unprod26.5%

        \[\leadsto -\frac{1}{\frac{\color{blue}{\sqrt{B} \cdot \sqrt{B}}}{{\left(2 \cdot \left(F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)\right)\right)}^{0.5}}} \]
      12. add-sqr-sqrt28.0%

        \[\leadsto -\frac{1}{\frac{\color{blue}{B}}{{\left(2 \cdot \left(F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)\right)\right)}^{0.5}}} \]
      13. pow1/228.0%

        \[\leadsto -\frac{1}{\frac{B}{\color{blue}{\sqrt{2 \cdot \left(F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)\right)}}}} \]
      14. *-commutative28.0%

        \[\leadsto -\frac{1}{\frac{B}{\sqrt{\color{blue}{\left(F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)\right) \cdot 2}}}} \]
      15. *-commutative28.0%

        \[\leadsto -\frac{1}{\frac{B}{\sqrt{\color{blue}{\left(\left(A - \mathsf{hypot}\left(B, A\right)\right) \cdot F\right)} \cdot 2}}} \]
      16. associate-*l*28.0%

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

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

      \[\leadsto -\frac{1}{\color{blue}{\frac{B}{\sqrt{2}} \cdot \sqrt{\frac{1}{F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}}}} \]
    11. Step-by-step derivation
      1. associate-/r*14.6%

        \[\leadsto -\frac{1}{\frac{B}{\sqrt{2}} \cdot \sqrt{\color{blue}{\frac{\frac{1}{F}}{A - \sqrt{{A}^{2} + {B}^{2}}}}}} \]
      2. +-commutative14.6%

        \[\leadsto -\frac{1}{\frac{B}{\sqrt{2}} \cdot \sqrt{\frac{\frac{1}{F}}{A - \sqrt{\color{blue}{{B}^{2} + {A}^{2}}}}}} \]
      3. unpow214.6%

        \[\leadsto -\frac{1}{\frac{B}{\sqrt{2}} \cdot \sqrt{\frac{\frac{1}{F}}{A - \sqrt{\color{blue}{B \cdot B} + {A}^{2}}}}} \]
      4. unpow214.6%

        \[\leadsto -\frac{1}{\frac{B}{\sqrt{2}} \cdot \sqrt{\frac{\frac{1}{F}}{A - \sqrt{B \cdot B + \color{blue}{A \cdot A}}}}} \]
      5. hypot-undefine27.6%

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

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

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

Alternative 5: 47.4% accurate, 1.5× speedup?

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

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


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

    1. Initial program 23.0%

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

      \[\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. Taylor expanded in C around inf 23.4%

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

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

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

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

    if 1e-26 < (pow.f64 B #s(literal 2 binary64))

    1. Initial program 18.5%

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

      \[\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-neg15.0%

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

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

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

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

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

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

        \[\leadsto -\color{blue}{e^{\log \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)}\right)}} \]
      2. associate-*l/24.8%

        \[\leadsto -e^{\log \color{blue}{\left(\frac{\sqrt{2} \cdot \sqrt{F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)}}{B}\right)}} \]
      3. pow1/224.8%

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

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

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

      \[\leadsto -\color{blue}{e^{\log \left(\frac{{\left(2 \cdot \left(F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)\right)\right)}^{0.5}}{B}\right)}} \]
    8. Step-by-step derivation
      1. rem-exp-log27.9%

        \[\leadsto -\color{blue}{\frac{{\left(2 \cdot \left(F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)\right)\right)}^{0.5}}{B}} \]
      2. add-sqr-sqrt26.5%

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

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

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

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

        \[\leadsto -\frac{{\left(2 \cdot \left(F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)\right)\right)}^{0.5}}{\color{blue}{-B}} \]
      7. clear-num24.4%

        \[\leadsto -\color{blue}{\frac{1}{\frac{-B}{{\left(2 \cdot \left(F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)\right)\right)}^{0.5}}}} \]
      8. add-sqr-sqrt23.0%

        \[\leadsto -\frac{1}{\frac{\color{blue}{\sqrt{-B} \cdot \sqrt{-B}}}{{\left(2 \cdot \left(F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)\right)\right)}^{0.5}}} \]
      9. sqrt-unprod25.8%

        \[\leadsto -\frac{1}{\frac{\color{blue}{\sqrt{\left(-B\right) \cdot \left(-B\right)}}}{{\left(2 \cdot \left(F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)\right)\right)}^{0.5}}} \]
      10. sqr-neg25.8%

        \[\leadsto -\frac{1}{\frac{\sqrt{\color{blue}{B \cdot B}}}{{\left(2 \cdot \left(F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)\right)\right)}^{0.5}}} \]
      11. sqrt-unprod26.5%

        \[\leadsto -\frac{1}{\frac{\color{blue}{\sqrt{B} \cdot \sqrt{B}}}{{\left(2 \cdot \left(F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)\right)\right)}^{0.5}}} \]
      12. add-sqr-sqrt27.9%

        \[\leadsto -\frac{1}{\frac{\color{blue}{B}}{{\left(2 \cdot \left(F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)\right)\right)}^{0.5}}} \]
      13. pow1/227.9%

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

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

        \[\leadsto -\frac{1}{\frac{B}{\sqrt{\color{blue}{\left(\left(A - \mathsf{hypot}\left(B, A\right)\right) \cdot F\right)} \cdot 2}}} \]
      16. associate-*l*27.9%

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

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

      \[\leadsto -\frac{1}{\color{blue}{\frac{B}{\sqrt{2}} \cdot \sqrt{\frac{1}{F \cdot \left(A - \sqrt{{A}^{2} + {B}^{2}}\right)}}}} \]
    11. Step-by-step derivation
      1. associate-/r*15.0%

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

        \[\leadsto -\frac{1}{\frac{B}{\sqrt{2}} \cdot \sqrt{\frac{\frac{1}{F}}{A - \sqrt{\color{blue}{{B}^{2} + {A}^{2}}}}}} \]
      3. unpow215.0%

        \[\leadsto -\frac{1}{\frac{B}{\sqrt{2}} \cdot \sqrt{\frac{\frac{1}{F}}{A - \sqrt{\color{blue}{B \cdot B} + {A}^{2}}}}} \]
      4. unpow215.0%

        \[\leadsto -\frac{1}{\frac{B}{\sqrt{2}} \cdot \sqrt{\frac{\frac{1}{F}}{A - \sqrt{B \cdot B + \color{blue}{A \cdot A}}}}} \]
      5. hypot-undefine27.5%

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

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

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

Alternative 6: 34.4% accurate, 2.0× speedup?

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

\mathbf{elif}\;B\_m \leq 1.05 \cdot 10^{-61}:\\
\;\;\;\;\sqrt{-0.5 \cdot \frac{{B\_m}^{2} \cdot F}{C}} \cdot \frac{\sqrt{2}}{-B\_m}\\

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


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

    1. Initial program 21.1%

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

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

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

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

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

    if 6.1999999999999997e-146 < B < 1.05e-61

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

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

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

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

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

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

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

    if 1.05e-61 < B

    1. Initial program 21.5%

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

      \[\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-neg29.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 34.2% accurate, 2.0× speedup?

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

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


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

    1. Initial program 24.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 C around 0 12.3%

      \[\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-neg12.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 8.60000000000000029e82 < C

    1. Initial program 0.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 2.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-neg2.1%

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

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

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

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

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

      \[\leadsto -\frac{\sqrt{2}}{B} \cdot \sqrt{\color{blue}{-0.5 \cdot \frac{{B}^{2} \cdot F}{C}}} \]
    7. Step-by-step derivation
      1. associate-/l*15.7%

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

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

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

Alternative 8: 31.6% accurate, 3.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if A < -2.54999999999999981e211

    1. Initial program 1.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 C around 0 0.9%

      \[\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-neg0.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\sqrt{\color{blue}{4 \cdot \left(A \cdot F\right)}}}{-B} \]
    11. Step-by-step derivation
      1. associate-*r*6.4%

        \[\leadsto \frac{\sqrt{\color{blue}{\left(4 \cdot A\right) \cdot F}}}{-B} \]
    12. Simplified6.4%

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

    if -2.54999999999999981e211 < A

    1. Initial program 22.3%

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

      \[\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-neg11.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if A < -2.5999999999999998e211

    1. Initial program 1.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 C around 0 0.9%

      \[\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-neg0.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\sqrt{\color{blue}{4 \cdot \left(A \cdot F\right)}}}{-B} \]
    11. Step-by-step derivation
      1. associate-*r*6.4%

        \[\leadsto \frac{\sqrt{\color{blue}{\left(4 \cdot A\right) \cdot F}}}{-B} \]
    12. Simplified6.4%

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

    if -2.5999999999999998e211 < A

    1. Initial program 22.3%

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

      \[\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-neg11.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\sqrt{\color{blue}{-2 \cdot \left(B \cdot F\right)}}}{-B} \]
    11. Step-by-step derivation
      1. associate-*r*18.1%

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if A < -2.1499999999999998e212

    1. Initial program 1.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 C around 0 0.9%

      \[\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-neg0.9%

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

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

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

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

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

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

        \[\leadsto -\color{blue}{e^{\log \left(\frac{\sqrt{2}}{B}\right)}} \cdot \sqrt{F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)} \]
    7. Applied egg-rr8.8%

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

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

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

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

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

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

        \[\leadsto \sqrt{F \cdot A} \cdot \frac{-1 \cdot \color{blue}{2}}{B} \]
      6. metadata-eval6.4%

        \[\leadsto \sqrt{F \cdot A} \cdot \frac{\color{blue}{-2}}{B} \]
    10. Simplified6.4%

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

    if -2.1499999999999998e212 < A

    1. Initial program 22.3%

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

      \[\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-neg11.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\sqrt{\color{blue}{-2 \cdot \left(B \cdot F\right)}}}{-B} \]
    11. Step-by-step derivation
      1. associate-*r*18.1%

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

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

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

Alternative 12: 9.0% accurate, 5.9× speedup?

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

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

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

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

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

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

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

      \[\leadsto -\color{blue}{e^{\log \left(\frac{\sqrt{2}}{B}\right)}} \cdot \sqrt{F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)} \]
  7. Applied egg-rr16.0%

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

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

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

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

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

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

      \[\leadsto \sqrt{F \cdot A} \cdot \frac{-1 \cdot \color{blue}{2}}{B} \]
    6. metadata-eval2.9%

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

    \[\leadsto \color{blue}{\sqrt{F \cdot A} \cdot \frac{-2}{B}} \]
  11. Final simplification2.9%

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

Alternative 13: 2.4% accurate, 6.0× speedup?

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

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

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

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

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

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

    \[\leadsto \color{blue}{-\sqrt{\frac{F}{B}} \cdot \left(-1 \cdot \sqrt{2}\right)} \]
  6. Taylor expanded in F around 0 2.1%

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

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

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

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

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

      \[\leadsto \color{blue}{\sqrt{2 \cdot \frac{F}{B}}} \]
  10. Simplified2.1%

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

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

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

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

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

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

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

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

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

    \[\leadsto \sqrt{\color{blue}{\frac{-F \cdot 2}{B}}} \]
  13. Step-by-step derivation
    1. distribute-rgt-neg-in1.7%

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

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

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

Alternative 14: 1.7% accurate, 6.0× speedup?

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

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

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

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

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

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

    \[\leadsto \color{blue}{-\sqrt{\frac{F}{B}} \cdot \left(-1 \cdot \sqrt{2}\right)} \]
  6. Taylor expanded in F around 0 2.1%

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

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

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

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

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

      \[\leadsto \color{blue}{\sqrt{2 \cdot \frac{F}{B}}} \]
  10. Simplified2.1%

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

      \[\leadsto \sqrt{2 \cdot \color{blue}{\frac{1}{\frac{B}{F}}}} \]
    2. un-div-inv2.2%

      \[\leadsto \sqrt{\color{blue}{\frac{2}{\frac{B}{F}}}} \]
  12. Applied egg-rr2.2%

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

Alternative 15: 1.6% accurate, 6.0× speedup?

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

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

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

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

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

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

    \[\leadsto \color{blue}{-\sqrt{\frac{F}{B}} \cdot \left(-1 \cdot \sqrt{2}\right)} \]
  6. Taylor expanded in F around 0 2.1%

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

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

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

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

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

      \[\leadsto \color{blue}{\sqrt{2 \cdot \frac{F}{B}}} \]
  10. Simplified2.1%

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

Reproduce

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