ABCF->ab-angle b

Percentage Accurate: 19.0% → 49.2%
Time: 25.9s
Alternatives: 12
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 12 alternatives:

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

Initial Program: 19.0% 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: 49.2% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 18.6%

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

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

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

    if 1.9999999999999999e-151 < (pow.f64 B #s(literal 2 binary64)) < 4.99999999999999976e157

    1. Initial program 37.9%

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 8.9%

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

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

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

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

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

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

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \color{blue}{\mathsf{hypot}\left(B, A\right)}\right)} \]
    5. Simplified23.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. neg-sub023.8%

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

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

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

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

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

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

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

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

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

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

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

      \[\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-sub023.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. distribute-neg-frac223.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}} \]
      3. unpow1/223.9%

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

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

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

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

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

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

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

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

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

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

Alternative 2: 46.9% accurate, 1.5× speedup?

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

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


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

    1. Initial program 18.6%

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

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

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

    if 1.9999999999999999e-151 < (pow.f64 B #s(literal 2 binary64))

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

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \color{blue}{\mathsf{hypot}\left(B, A\right)}\right)} \]
    5. Simplified23.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. neg-sub023.1%

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

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

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

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

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

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

        \[\leadsto 0 - \frac{{2}^{0.5} \cdot {\left(F \cdot \left(A - \sqrt{{B}^{2} + \color{blue}{{A}^{2}}}\right)\right)}^{0.5}}{B} \]
      8. pow-prod-down10.9%

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

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

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

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

      \[\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-sub023.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. distribute-neg-frac223.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}} \]
      3. unpow1/223.2%

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

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

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

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

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

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

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

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

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

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

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

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


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

    1. Initial program 18.6%

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

      \[\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 22.2%

      \[\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)} \]

    if 1.9999999999999999e-151 < (pow.f64 B #s(literal 2 binary64))

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

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \color{blue}{\mathsf{hypot}\left(B, A\right)}\right)} \]
    5. Simplified23.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. neg-sub023.1%

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

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

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

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

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

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

        \[\leadsto 0 - \frac{{2}^{0.5} \cdot {\left(F \cdot \left(A - \sqrt{{B}^{2} + \color{blue}{{A}^{2}}}\right)\right)}^{0.5}}{B} \]
      8. pow-prod-down10.9%

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

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

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

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

      \[\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-sub023.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. distribute-neg-frac223.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}} \]
      3. unpow1/223.2%

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

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

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

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

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

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

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

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

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

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

Alternative 4: 43.5% accurate, 2.0× speedup?

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

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


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

    1. Initial program 19.7%

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

      \[\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 14.1%

      \[\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*14.1%

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

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

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

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

    if 9.20000000000000025e-76 < B

    1. Initial program 18.9%

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

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

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

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

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

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

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

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

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

        \[\leadsto 0 - \color{blue}{\frac{\sqrt{2} \cdot \sqrt{F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)}}{B}} \]
      3. pow1/241.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/241.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. hypot-undefine19.2%

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

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

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

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

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

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

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

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

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

        \[\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/241.5%

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

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

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

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

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

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

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

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

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

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

Alternative 5: 37.4% accurate, 2.0× speedup?

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

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


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

    1. Initial program 18.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 F around 0 17.2%

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

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

    if 2.1e-171 < B

    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 C around 0 18.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-neg18.7%

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

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

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

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

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \color{blue}{\mathsf{hypot}\left(B, A\right)}\right)} \]
    5. Simplified36.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-sub036.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/36.8%

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

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

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

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

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

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

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

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

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

        \[\leadsto 0 - \frac{{\left(2 \cdot \left(F \cdot \left(A - \color{blue}{\mathsf{hypot}\left(B, A\right)}\right)\right)\right)}^{0.5}}{B} \]
    7. Applied egg-rr37.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-sub037.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-frac237.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/237.0%

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

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

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

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

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

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

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

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

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

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

Alternative 6: 28.0% accurate, 3.0× speedup?

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

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


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

    1. Initial program 4.0%

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

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

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

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

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

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

      \[\leadsto \color{blue}{-\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)}} \]
    6. 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}} \]
    7. Step-by-step derivation
      1. unpow20.0%

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

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

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

        \[\leadsto \sqrt{A \cdot F} \cdot \frac{-1 \cdot \color{blue}{2}}{B} \]
      5. metadata-eval19.7%

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

      \[\leadsto \color{blue}{\sqrt{A \cdot F} \cdot \frac{-2}{B}} \]
    9. Step-by-step derivation
      1. add-sqr-sqrt19.7%

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\color{blue}{\left|F \cdot A\right|}} \cdot \frac{-2}{B} \]
    12. Simplified20.9%

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

    if -1e114 < A

    1. Initial program 22.1%

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

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

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

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

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

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \color{blue}{\mathsf{hypot}\left(B, A\right)}\right)} \]
    5. Simplified16.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. neg-sub016.8%

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

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

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

        \[\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. hypot-undefine9.8%

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

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

        \[\leadsto 0 - \frac{{2}^{0.5} \cdot {\left(F \cdot \left(A - \sqrt{{B}^{2} + \color{blue}{{A}^{2}}}\right)\right)}^{0.5}}{B} \]
      8. pow-prod-down9.9%

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

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

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

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

      \[\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-sub016.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. distribute-neg-frac216.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}} \]
      3. unpow1/216.9%

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 32.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(A, B\_m\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 A B_m))))) (- B_m)))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
	return sqrt((2.0 * (F * (A - hypot(A, B_m))))) / -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(A, B_m))))) / -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(A, B_m))))) / -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(A, B_m))))) / 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(A, B_m))))) / -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[A ^ 2 + B$95$m ^ 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(A, B\_m\right)\right)\right)}}{-B\_m}
\end{array}
Derivation
  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 9.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-neg9.0%

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

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

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

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

      \[\leadsto -\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \color{blue}{\mathsf{hypot}\left(B, A\right)}\right)} \]
  5. Simplified17.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-sub017.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/17.6%

      \[\leadsto 0 - \color{blue}{\frac{\sqrt{2} \cdot \sqrt{F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)}}{B}} \]
    3. pow1/217.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/217.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. hypot-undefine9.0%

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

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

      \[\leadsto 0 - \frac{{2}^{0.5} \cdot {\left(F \cdot \left(A - \sqrt{{B}^{2} + \color{blue}{{A}^{2}}}\right)\right)}^{0.5}}{B} \]
    8. pow-prod-down9.1%

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

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

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

      \[\leadsto 0 - \frac{{\left(2 \cdot \left(F \cdot \left(A - \color{blue}{\mathsf{hypot}\left(B, A\right)}\right)\right)\right)}^{0.5}}{B} \]
  7. Applied egg-rr17.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-sub017.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-frac217.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/217.6%

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

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

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

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

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

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

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

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

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

Alternative 8: 28.0% accurate, 5.2× speedup?

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

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


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

    1. Initial program 4.1%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{-\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)}} \]
    6. 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}} \]
    7. Step-by-step derivation
      1. unpow20.0%

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

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

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

        \[\leadsto \sqrt{A \cdot F} \cdot \frac{-1 \cdot \color{blue}{2}}{B} \]
      5. metadata-eval20.3%

        \[\leadsto \sqrt{A \cdot F} \cdot \frac{\color{blue}{-2}}{B} \]
    8. Simplified20.3%

      \[\leadsto \color{blue}{\sqrt{A \cdot F} \cdot \frac{-2}{B}} \]
    9. Taylor expanded in A around 0 20.3%

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

        \[\leadsto -2 \cdot \color{blue}{\frac{\sqrt{A \cdot F} \cdot 1}{B}} \]
      2. *-rgt-identity20.3%

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

        \[\leadsto -2 \cdot \frac{\sqrt{\color{blue}{F \cdot A}}}{B} \]
    11. Simplified20.3%

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

    if -7.8e118 < A

    1. Initial program 22.0%

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

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

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

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

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

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \color{blue}{\mathsf{hypot}\left(B, A\right)}\right)} \]
    5. Simplified16.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. neg-sub016.8%

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

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

        \[\leadsto 0 - \frac{\color{blue}{{2}^{0.5}} \cdot \sqrt{F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)}}{B} \]
      4. pow1/216.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. hypot-undefine9.8%

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

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

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

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

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

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

        \[\leadsto 0 - \frac{{\left(2 \cdot \left(F \cdot \left(A - \color{blue}{\mathsf{hypot}\left(B, A\right)}\right)\right)\right)}^{0.5}}{B} \]
    7. Applied egg-rr16.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-sub016.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-frac216.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/216.8%

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

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

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

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

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

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

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

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

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

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

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

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

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


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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{-\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)}} \]
    6. 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}} \]
    7. Step-by-step derivation
      1. unpow20.0%

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

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

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

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

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

      \[\leadsto \color{blue}{\sqrt{A \cdot F} \cdot \frac{-2}{B}} \]
    9. Taylor expanded in A around 0 21.2%

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

        \[\leadsto -2 \cdot \color{blue}{\frac{\sqrt{A \cdot F} \cdot 1}{B}} \]
      2. *-rgt-identity21.3%

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

        \[\leadsto -2 \cdot \frac{\sqrt{\color{blue}{F \cdot A}}}{B} \]
    11. Simplified21.3%

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

    if -8.2000000000000005e129 < A

    1. Initial program 21.9%

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

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

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

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

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

        \[\leadsto -\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \color{blue}{\mathsf{hypot}\left(B, A\right)}\right)} \]
    5. Simplified16.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-sub016.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/16.6%

        \[\leadsto 0 - \color{blue}{\frac{\sqrt{2} \cdot \sqrt{F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)}}{B}} \]
      3. pow1/216.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/216.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. hypot-undefine9.7%

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

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

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

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

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

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

        \[\leadsto 0 - \frac{{\left(2 \cdot \left(F \cdot \left(A - \color{blue}{\mathsf{hypot}\left(B, A\right)}\right)\right)\right)}^{0.5}}{B} \]
    7. Applied egg-rr16.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-sub016.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-frac216.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/216.7%

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 28.1% accurate, 5.6× speedup?

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

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


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

    1. Initial program 4.1%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{-\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)}} \]
    6. 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}} \]
    7. Step-by-step derivation
      1. unpow20.0%

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

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

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

        \[\leadsto \sqrt{A \cdot F} \cdot \frac{-1 \cdot \color{blue}{2}}{B} \]
      5. metadata-eval20.7%

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

      \[\leadsto \color{blue}{\sqrt{A \cdot F} \cdot \frac{-2}{B}} \]
    9. Taylor expanded in A around 0 20.7%

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

        \[\leadsto -2 \cdot \color{blue}{\frac{\sqrt{A \cdot F} \cdot 1}{B}} \]
      2. *-rgt-identity20.8%

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

        \[\leadsto -2 \cdot \frac{\sqrt{\color{blue}{F \cdot A}}}{B} \]
    11. Simplified20.8%

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

    if -3.49999999999999978e127 < A

    1. Initial program 22.0%

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

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

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

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

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

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

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

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

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

        \[\leadsto 0 - \frac{\color{blue}{{2}^{0.5}} \cdot \sqrt{F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)}}{B} \]
      4. pow1/216.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. hypot-undefine9.8%

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

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

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

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

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

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

        \[\leadsto 0 - \frac{{\left(2 \cdot \left(F \cdot \left(A - \color{blue}{\mathsf{hypot}\left(B, A\right)}\right)\right)\right)}^{0.5}}{B} \]
    7. Applied egg-rr16.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-sub016.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-frac216.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/216.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 9.5% accurate, 5.9× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ [A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\ \\ -2 \cdot \frac{\sqrt{A \cdot 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 (* -2.0 (/ (sqrt (* 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) {
	return -2.0 * (sqrt((A * 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 = (-2.0d0) * (sqrt((a * 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 -2.0 * (Math.sqrt((A * 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 -2.0 * (math.sqrt((A * F)) / B_m)
B_m = abs(B)
A, B_m, C, F = sort([A, B_m, C, F])
function code(A, B_m, C, F)
	return Float64(-2.0 * Float64(sqrt(Float64(A * 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 = -2.0 * (sqrt((A * 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[(-2.0 * N[(N[Sqrt[N[(A * F), $MachinePrecision]], $MachinePrecision] / B$95$m), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
-2 \cdot \frac{\sqrt{A \cdot F}}{B\_m}
\end{array}
Derivation
  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 9.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-neg9.0%

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

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

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

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

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

    \[\leadsto \color{blue}{-\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)}} \]
  6. 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}} \]
  7. Step-by-step derivation
    1. unpow20.0%

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

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

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

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

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

    \[\leadsto \color{blue}{\sqrt{A \cdot F} \cdot \frac{-2}{B}} \]
  9. Taylor expanded in A around 0 4.9%

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

      \[\leadsto -2 \cdot \color{blue}{\frac{\sqrt{A \cdot F} \cdot 1}{B}} \]
    2. *-rgt-identity4.9%

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

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

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

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

Alternative 12: 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{\frac{2 \cdot 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(Float64(2.0 * 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[(N[(2.0 * F), $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{2 \cdot F}{B\_m}}
\end{array}
Derivation
  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 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.0%

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{{\left({\left(\sqrt{\frac{F}{B}} \cdot \left(-\left(-\sqrt{2}\right)\right)\right)}^{3}\right)}^{0.3333333333333333}} \]
  8. Step-by-step derivation
    1. *-un-lft-identity2.0%

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

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

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

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

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

      \[\leadsto 1 \cdot \color{blue}{\left(\sqrt{2} \cdot \sqrt{\frac{F}{B}}\right)} \]
    7. pow1/22.0%

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

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

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

    \[\leadsto \color{blue}{1 \cdot {\left(2 \cdot \frac{F}{B}\right)}^{0.5}} \]
  10. Step-by-step derivation
    1. *-lft-identity2.2%

      \[\leadsto \color{blue}{{\left(2 \cdot \frac{F}{B}\right)}^{0.5}} \]
    2. unpow1/22.0%

      \[\leadsto \color{blue}{\sqrt{2 \cdot \frac{F}{B}}} \]
    3. associate-*r/2.0%

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

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

Reproduce

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