ABCF->ab-angle b

Percentage Accurate: 18.5% → 45.6%
Time: 33.7s
Alternatives: 9
Speedup: 3.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 9 alternatives:

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

Initial Program: 18.5% accurate, 1.0× speedup?

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

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

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

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

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

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

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


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

    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 F around 0 23.3%

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

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

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

    if 1.01999999999999994e-285 < B < 4.60000000000000006e-150

    1. Initial program 29.1%

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

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

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

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

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

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

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

    if 4.60000000000000006e-150 < B < 1.7500000000000001e151

    1. Initial program 36.3%

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.7500000000000001e151 < B < 1.79999999999999986e238

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

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

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

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

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

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

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

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

    if 1.79999999999999986e238 < B

    1. Initial program 0.0%

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

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

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

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

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

Alternative 2: 45.0% accurate, 1.5× speedup?

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

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

\mathbf{elif}\;B\_m \leq 4 \cdot 10^{-50}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;B\_m \leq 1.8 \cdot 10^{-29}:\\
\;\;\;\;\frac{\sqrt{\left(2 \cdot \left(F \cdot \left({B\_m}^{2} - t\_2\right)\right)\right) \cdot \left(2 \cdot A\right)}}{t\_2 - {B\_m}^{2}}\\

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 6 regimes
  2. if B < 5.59999999999999982e-285 or 4.3999999999999999e-150 < B < 4.00000000000000003e-50

    1. Initial program 21.6%

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

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

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

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

    if 5.59999999999999982e-285 < B < 4.3999999999999999e-150

    1. Initial program 29.1%

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

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

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

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

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

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

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

    if 4.00000000000000003e-50 < B < 1.79999999999999987e-29

    1. Initial program 34.6%

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

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

    if 1.79999999999999987e-29 < B < 1.8500000000000001e148

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

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

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

      \[\leadsto -\sqrt{2} \cdot \sqrt{F \cdot \color{blue}{\frac{A - \sqrt{{A}^{2} + {B}^{2}}}{{B}^{2}}}} \]
    6. Step-by-step derivation
      1. unpow253.5%

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

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

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

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

    if 1.8500000000000001e148 < B < 7e241

    1. Initial program 5.5%

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

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

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

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

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

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

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

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

    if 7e241 < B

    1. Initial program 0.0%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;B \leq 5.6 \cdot 10^{-285}:\\ \;\;\;\;\sqrt{F \cdot \frac{-0.5}{C}} \cdot \left(-\sqrt{2}\right)\\ \mathbf{elif}\;B \leq 4.4 \cdot 10^{-150}:\\ \;\;\;\;\frac{\sqrt{-8 \cdot \left(\left(C \cdot A\right) \cdot \left(F \cdot \left(A + A\right)\right)\right)}}{-\mathsf{fma}\left(C, A \cdot -4, {B}^{2}\right)}\\ \mathbf{elif}\;B \leq 4 \cdot 10^{-50}:\\ \;\;\;\;\sqrt{F \cdot \frac{-0.5}{C}} \cdot \left(-\sqrt{2}\right)\\ \mathbf{elif}\;B \leq 1.8 \cdot 10^{-29}:\\ \;\;\;\;\frac{\sqrt{\left(2 \cdot \left(F \cdot \left({B}^{2} - C \cdot \left(A \cdot 4\right)\right)\right)\right) \cdot \left(2 \cdot A\right)}}{C \cdot \left(A \cdot 4\right) - {B}^{2}}\\ \mathbf{elif}\;B \leq 1.85 \cdot 10^{+148}:\\ \;\;\;\;\sqrt{F \cdot \frac{A - \mathsf{hypot}\left(A, B\right)}{{B}^{2}}} \cdot \left(-\sqrt{2}\right)\\ \mathbf{elif}\;B \leq 7 \cdot 10^{+241}:\\ \;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{F \cdot \frac{\left(\frac{A}{B} + \frac{C}{B}\right) + -1}{B}} \cdot \left(-\sqrt{2}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 44.1% accurate, 1.8× 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 := -\sqrt{2}\\ t_1 := \sqrt{F \cdot \frac{-0.5}{C}} \cdot t\_0\\ t_2 := C \cdot \left(A \cdot 4\right)\\ \mathbf{if}\;B\_m \leq 1.02 \cdot 10^{-282}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;B\_m \leq 3.3 \cdot 10^{-150}:\\ \;\;\;\;\frac{\sqrt{-8 \cdot \left(\left(C \cdot A\right) \cdot \left(F \cdot \left(A + A\right)\right)\right)}}{-\mathsf{fma}\left(C, A \cdot -4, {B\_m}^{2}\right)}\\ \mathbf{elif}\;B\_m \leq 1.5 \cdot 10^{-50}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;B\_m \leq 7.1 \cdot 10^{-38}:\\ \;\;\;\;\frac{\sqrt{\left(2 \cdot \left(F \cdot \left({B\_m}^{2} - t\_2\right)\right)\right) \cdot \left(2 \cdot A\right)}}{t\_2 - {B\_m}^{2}}\\ \mathbf{elif}\;B\_m \leq 8.5 \cdot 10^{+236}:\\ \;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(-\sqrt{F \cdot \left(A - \mathsf{hypot}\left(B\_m, A\right)\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{F \cdot \frac{\left(\frac{A}{B\_m} + \frac{C}{B\_m}\right) + -1}{B\_m}} \cdot t\_0\\ \end{array} \end{array} \]
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
 :precision binary64
 (let* ((t_0 (- (sqrt 2.0)))
        (t_1 (* (sqrt (* F (/ -0.5 C))) t_0))
        (t_2 (* C (* A 4.0))))
   (if (<= B_m 1.02e-282)
     t_1
     (if (<= B_m 3.3e-150)
       (/
        (sqrt (* -8.0 (* (* C A) (* F (+ A A)))))
        (- (fma C (* A -4.0) (pow B_m 2.0))))
       (if (<= B_m 1.5e-50)
         t_1
         (if (<= B_m 7.1e-38)
           (/
            (sqrt (* (* 2.0 (* F (- (pow B_m 2.0) t_2))) (* 2.0 A)))
            (- t_2 (pow B_m 2.0)))
           (if (<= B_m 8.5e+236)
             (* (/ (sqrt 2.0) B_m) (- (sqrt (* F (- A (hypot B_m A))))))
             (*
              (sqrt (* F (/ (+ (+ (/ A B_m) (/ C B_m)) -1.0) B_m)))
              t_0))))))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
	double t_0 = -sqrt(2.0);
	double t_1 = sqrt((F * (-0.5 / C))) * t_0;
	double t_2 = C * (A * 4.0);
	double tmp;
	if (B_m <= 1.02e-282) {
		tmp = t_1;
	} else if (B_m <= 3.3e-150) {
		tmp = sqrt((-8.0 * ((C * A) * (F * (A + A))))) / -fma(C, (A * -4.0), pow(B_m, 2.0));
	} else if (B_m <= 1.5e-50) {
		tmp = t_1;
	} else if (B_m <= 7.1e-38) {
		tmp = sqrt(((2.0 * (F * (pow(B_m, 2.0) - t_2))) * (2.0 * A))) / (t_2 - pow(B_m, 2.0));
	} else if (B_m <= 8.5e+236) {
		tmp = (sqrt(2.0) / B_m) * -sqrt((F * (A - hypot(B_m, A))));
	} else {
		tmp = sqrt((F * ((((A / B_m) + (C / B_m)) + -1.0) / B_m))) * t_0;
	}
	return tmp;
}
B_m = abs(B)
A, B_m, C, F = sort([A, B_m, C, F])
function code(A, B_m, C, F)
	t_0 = Float64(-sqrt(2.0))
	t_1 = Float64(sqrt(Float64(F * Float64(-0.5 / C))) * t_0)
	t_2 = Float64(C * Float64(A * 4.0))
	tmp = 0.0
	if (B_m <= 1.02e-282)
		tmp = t_1;
	elseif (B_m <= 3.3e-150)
		tmp = Float64(sqrt(Float64(-8.0 * Float64(Float64(C * A) * Float64(F * Float64(A + A))))) / Float64(-fma(C, Float64(A * -4.0), (B_m ^ 2.0))));
	elseif (B_m <= 1.5e-50)
		tmp = t_1;
	elseif (B_m <= 7.1e-38)
		tmp = Float64(sqrt(Float64(Float64(2.0 * Float64(F * Float64((B_m ^ 2.0) - t_2))) * Float64(2.0 * A))) / Float64(t_2 - (B_m ^ 2.0)));
	elseif (B_m <= 8.5e+236)
		tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(-sqrt(Float64(F * Float64(A - hypot(B_m, A))))));
	else
		tmp = Float64(sqrt(Float64(F * Float64(Float64(Float64(Float64(A / B_m) + Float64(C / B_m)) + -1.0) / B_m))) * t_0);
	end
	return tmp
end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = (-N[Sqrt[2.0], $MachinePrecision])}, Block[{t$95$1 = N[(N[Sqrt[N[(F * N[(-0.5 / C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(C * N[(A * 4.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B$95$m, 1.02e-282], t$95$1, If[LessEqual[B$95$m, 3.3e-150], N[(N[Sqrt[N[(-8.0 * N[(N[(C * A), $MachinePrecision] * N[(F * N[(A + A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-N[(C * N[(A * -4.0), $MachinePrecision] + N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision])), $MachinePrecision], If[LessEqual[B$95$m, 1.5e-50], t$95$1, If[LessEqual[B$95$m, 7.1e-38], N[(N[Sqrt[N[(N[(2.0 * N[(F * N[(N[Power[B$95$m, 2.0], $MachinePrecision] - t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(2.0 * A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(t$95$2 - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B$95$m, 8.5e+236], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * (-N[Sqrt[N[(F * N[(A - N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(N[Sqrt[N[(F * N[(N[(N[(N[(A / B$95$m), $MachinePrecision] + N[(C / B$95$m), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision] / B$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$0), $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 := -\sqrt{2}\\
t_1 := \sqrt{F \cdot \frac{-0.5}{C}} \cdot t\_0\\
t_2 := C \cdot \left(A \cdot 4\right)\\
\mathbf{if}\;B\_m \leq 1.02 \cdot 10^{-282}:\\
\;\;\;\;t\_1\\

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

\mathbf{elif}\;B\_m \leq 1.5 \cdot 10^{-50}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;B\_m \leq 7.1 \cdot 10^{-38}:\\
\;\;\;\;\frac{\sqrt{\left(2 \cdot \left(F \cdot \left({B\_m}^{2} - t\_2\right)\right)\right) \cdot \left(2 \cdot A\right)}}{t\_2 - {B\_m}^{2}}\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if B < 1.02e-282 or 3.3000000000000002e-150 < B < 1.49999999999999995e-50

    1. Initial program 21.6%

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

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

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

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

    if 1.02e-282 < B < 3.3000000000000002e-150

    1. Initial program 29.1%

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

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

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

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

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

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

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

    if 1.49999999999999995e-50 < B < 7.1000000000000002e-38

    1. Initial program 2.0%

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

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

    if 7.1000000000000002e-38 < B < 8.5000000000000008e236

    1. Initial program 33.6%

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

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

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

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

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

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

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

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

    if 8.5000000000000008e236 < B

    1. Initial program 0.0%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;B \leq 1.02 \cdot 10^{-282}:\\ \;\;\;\;\sqrt{F \cdot \frac{-0.5}{C}} \cdot \left(-\sqrt{2}\right)\\ \mathbf{elif}\;B \leq 3.3 \cdot 10^{-150}:\\ \;\;\;\;\frac{\sqrt{-8 \cdot \left(\left(C \cdot A\right) \cdot \left(F \cdot \left(A + A\right)\right)\right)}}{-\mathsf{fma}\left(C, A \cdot -4, {B}^{2}\right)}\\ \mathbf{elif}\;B \leq 1.5 \cdot 10^{-50}:\\ \;\;\;\;\sqrt{F \cdot \frac{-0.5}{C}} \cdot \left(-\sqrt{2}\right)\\ \mathbf{elif}\;B \leq 7.1 \cdot 10^{-38}:\\ \;\;\;\;\frac{\sqrt{\left(2 \cdot \left(F \cdot \left({B}^{2} - C \cdot \left(A \cdot 4\right)\right)\right)\right) \cdot \left(2 \cdot A\right)}}{C \cdot \left(A \cdot 4\right) - {B}^{2}}\\ \mathbf{elif}\;B \leq 8.5 \cdot 10^{+236}:\\ \;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{F \cdot \frac{\left(\frac{A}{B} + \frac{C}{B}\right) + -1}{B}} \cdot \left(-\sqrt{2}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 44.0% accurate, 1.9× speedup?

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

\mathbf{elif}\;B\_m \leq 3.8 \cdot 10^{-150}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;B\_m \leq 1.75 \cdot 10^{-44}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;B\_m \leq 4.3 \cdot 10^{-38}:\\
\;\;\;\;t\_0\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if B < 1.26e-285 or 3.7999999999999998e-150 < B < 1.7499999999999999e-44

    1. Initial program 21.6%

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

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

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

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

    if 1.26e-285 < B < 3.7999999999999998e-150 or 1.7499999999999999e-44 < B < 4.3000000000000002e-38

    1. Initial program 27.4%

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

      \[\leadsto \color{blue}{\frac{\sqrt{F \cdot \left(\left(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 33.8%

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

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

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

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

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

    if 4.3000000000000002e-38 < B < 8.0000000000000006e243

    1. Initial program 33.6%

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

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

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

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

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

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

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

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

    if 8.0000000000000006e243 < B

    1. Initial program 0.0%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;B \leq 1.26 \cdot 10^{-285}:\\ \;\;\;\;\sqrt{F \cdot \frac{-0.5}{C}} \cdot \left(-\sqrt{2}\right)\\ \mathbf{elif}\;B \leq 3.8 \cdot 10^{-150}:\\ \;\;\;\;\frac{\sqrt{-8 \cdot \left(\left(C \cdot A\right) \cdot \left(F \cdot \left(A + A\right)\right)\right)}}{-\mathsf{fma}\left(C, A \cdot -4, {B}^{2}\right)}\\ \mathbf{elif}\;B \leq 1.75 \cdot 10^{-44}:\\ \;\;\;\;\sqrt{F \cdot \frac{-0.5}{C}} \cdot \left(-\sqrt{2}\right)\\ \mathbf{elif}\;B \leq 4.3 \cdot 10^{-38}:\\ \;\;\;\;\frac{\sqrt{-8 \cdot \left(\left(C \cdot A\right) \cdot \left(F \cdot \left(A + A\right)\right)\right)}}{-\mathsf{fma}\left(C, A \cdot -4, {B}^{2}\right)}\\ \mathbf{elif}\;B \leq 8 \cdot 10^{+243}:\\ \;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{F \cdot \frac{\left(\frac{A}{B} + \frac{C}{B}\right) + -1}{B}} \cdot \left(-\sqrt{2}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 42.2% accurate, 1.9× speedup?

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

\mathbf{elif}\;B\_m \leq 5.2 \cdot 10^{-79}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;B\_m \leq 1.7 \cdot 10^{-50}:\\
\;\;\;\;t\_2\\

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

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if B < 5.6999999999999998e-98 or 5.19999999999999987e-79 < B < 1.70000000000000007e-50

    1. Initial program 23.2%

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

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

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

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

    if 5.6999999999999998e-98 < B < 5.19999999999999987e-79 or 4.49999999999999993e241 < B

    1. Initial program 0.7%

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

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

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

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

    if 1.70000000000000007e-50 < B < 4.49999999999999993e241

    1. Initial program 32.6%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;B \leq 5.7 \cdot 10^{-98}:\\ \;\;\;\;\sqrt{F \cdot \frac{-0.5}{C}} \cdot \left(-\sqrt{2}\right)\\ \mathbf{elif}\;B \leq 5.2 \cdot 10^{-79}:\\ \;\;\;\;\sqrt{F \cdot \frac{\left(\frac{A}{B} + \frac{C}{B}\right) + -1}{B}} \cdot \left(-\sqrt{2}\right)\\ \mathbf{elif}\;B \leq 1.7 \cdot 10^{-50}:\\ \;\;\;\;\sqrt{F \cdot \frac{-0.5}{C}} \cdot \left(-\sqrt{2}\right)\\ \mathbf{elif}\;B \leq 4.5 \cdot 10^{+241}:\\ \;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{F \cdot \frac{\left(\frac{A}{B} + \frac{C}{B}\right) + -1}{B}} \cdot \left(-\sqrt{2}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 38.4% accurate, 2.7× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ [A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\ \\ \begin{array}{l} t_0 := -\sqrt{2}\\ \mathbf{if}\;B\_m \leq 3 \cdot 10^{-97} \lor \neg \left(B\_m \leq 2.8 \cdot 10^{-78}\right) \land B\_m \leq 1.25 \cdot 10^{-48}:\\ \;\;\;\;\sqrt{F \cdot \frac{-0.5}{C}} \cdot t\_0\\ \mathbf{else}:\\ \;\;\;\;\sqrt{F \cdot \frac{\left(\frac{A}{B\_m} + \frac{C}{B\_m}\right) + -1}{B\_m}} \cdot t\_0\\ \end{array} \end{array} \]
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
 :precision binary64
 (let* ((t_0 (- (sqrt 2.0))))
   (if (or (<= B_m 3e-97) (and (not (<= B_m 2.8e-78)) (<= B_m 1.25e-48)))
     (* (sqrt (* F (/ -0.5 C))) t_0)
     (* (sqrt (* F (/ (+ (+ (/ A B_m) (/ C B_m)) -1.0) B_m))) t_0))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
	double t_0 = -sqrt(2.0);
	double tmp;
	if ((B_m <= 3e-97) || (!(B_m <= 2.8e-78) && (B_m <= 1.25e-48))) {
		tmp = sqrt((F * (-0.5 / C))) * t_0;
	} else {
		tmp = sqrt((F * ((((A / B_m) + (C / B_m)) + -1.0) / B_m))) * t_0;
	}
	return tmp;
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
    real(8), intent (in) :: a
    real(8), intent (in) :: b_m
    real(8), intent (in) :: c
    real(8), intent (in) :: f
    real(8) :: t_0
    real(8) :: tmp
    t_0 = -sqrt(2.0d0)
    if ((b_m <= 3d-97) .or. (.not. (b_m <= 2.8d-78)) .and. (b_m <= 1.25d-48)) then
        tmp = sqrt((f * ((-0.5d0) / c))) * t_0
    else
        tmp = sqrt((f * ((((a / b_m) + (c / b_m)) + (-1.0d0)) / b_m))) * t_0
    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 t_0 = -Math.sqrt(2.0);
	double tmp;
	if ((B_m <= 3e-97) || (!(B_m <= 2.8e-78) && (B_m <= 1.25e-48))) {
		tmp = Math.sqrt((F * (-0.5 / C))) * t_0;
	} else {
		tmp = Math.sqrt((F * ((((A / B_m) + (C / B_m)) + -1.0) / B_m))) * t_0;
	}
	return tmp;
}
B_m = math.fabs(B)
[A, B_m, C, F] = sort([A, B_m, C, F])
def code(A, B_m, C, F):
	t_0 = -math.sqrt(2.0)
	tmp = 0
	if (B_m <= 3e-97) or (not (B_m <= 2.8e-78) and (B_m <= 1.25e-48)):
		tmp = math.sqrt((F * (-0.5 / C))) * t_0
	else:
		tmp = math.sqrt((F * ((((A / B_m) + (C / B_m)) + -1.0) / B_m))) * t_0
	return tmp
B_m = abs(B)
A, B_m, C, F = sort([A, B_m, C, F])
function code(A, B_m, C, F)
	t_0 = Float64(-sqrt(2.0))
	tmp = 0.0
	if ((B_m <= 3e-97) || (!(B_m <= 2.8e-78) && (B_m <= 1.25e-48)))
		tmp = Float64(sqrt(Float64(F * Float64(-0.5 / C))) * t_0);
	else
		tmp = Float64(sqrt(Float64(F * Float64(Float64(Float64(Float64(A / B_m) + Float64(C / B_m)) + -1.0) / B_m))) * t_0);
	end
	return tmp
end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
	t_0 = -sqrt(2.0);
	tmp = 0.0;
	if ((B_m <= 3e-97) || (~((B_m <= 2.8e-78)) && (B_m <= 1.25e-48)))
		tmp = sqrt((F * (-0.5 / C))) * t_0;
	else
		tmp = sqrt((F * ((((A / B_m) + (C / B_m)) + -1.0) / B_m))) * t_0;
	end
	tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = (-N[Sqrt[2.0], $MachinePrecision])}, If[Or[LessEqual[B$95$m, 3e-97], And[N[Not[LessEqual[B$95$m, 2.8e-78]], $MachinePrecision], LessEqual[B$95$m, 1.25e-48]]], N[(N[Sqrt[N[(F * N[(-0.5 / C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision], N[(N[Sqrt[N[(F * N[(N[(N[(N[(A / B$95$m), $MachinePrecision] + N[(C / B$95$m), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision] / B$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$0), $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 := -\sqrt{2}\\
\mathbf{if}\;B\_m \leq 3 \cdot 10^{-97} \lor \neg \left(B\_m \leq 2.8 \cdot 10^{-78}\right) \land B\_m \leq 1.25 \cdot 10^{-48}:\\
\;\;\;\;\sqrt{F \cdot \frac{-0.5}{C}} \cdot t\_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if B < 3.00000000000000024e-97 or 2.80000000000000024e-78 < B < 1.25e-48

    1. Initial program 23.2%

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

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

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

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

    if 3.00000000000000024e-97 < B < 2.80000000000000024e-78 or 1.25e-48 < B

    1. Initial program 26.5%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;B \leq 3 \cdot 10^{-97} \lor \neg \left(B \leq 2.8 \cdot 10^{-78}\right) \land B \leq 1.25 \cdot 10^{-48}:\\ \;\;\;\;\sqrt{F \cdot \frac{-0.5}{C}} \cdot \left(-\sqrt{2}\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{F \cdot \frac{\left(\frac{A}{B} + \frac{C}{B}\right) + -1}{B}} \cdot \left(-\sqrt{2}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 38.4% accurate, 2.8× 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 := -\sqrt{2}\\ \mathbf{if}\;B\_m \leq 3.1 \cdot 10^{-97} \lor \neg \left(B\_m \leq 1.25 \cdot 10^{-77}\right) \land B\_m \leq 1.05 \cdot 10^{-49}:\\ \;\;\;\;\sqrt{F \cdot \frac{-0.5}{C}} \cdot t\_0\\ \mathbf{else}:\\ \;\;\;\;\sqrt{F \cdot \frac{-1}{B\_m}} \cdot t\_0\\ \end{array} \end{array} \]
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
 :precision binary64
 (let* ((t_0 (- (sqrt 2.0))))
   (if (or (<= B_m 3.1e-97) (and (not (<= B_m 1.25e-77)) (<= B_m 1.05e-49)))
     (* (sqrt (* F (/ -0.5 C))) t_0)
     (* (sqrt (* F (/ -1.0 B_m))) t_0))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
	double t_0 = -sqrt(2.0);
	double tmp;
	if ((B_m <= 3.1e-97) || (!(B_m <= 1.25e-77) && (B_m <= 1.05e-49))) {
		tmp = sqrt((F * (-0.5 / C))) * t_0;
	} else {
		tmp = sqrt((F * (-1.0 / B_m))) * t_0;
	}
	return tmp;
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
    real(8), intent (in) :: a
    real(8), intent (in) :: b_m
    real(8), intent (in) :: c
    real(8), intent (in) :: f
    real(8) :: t_0
    real(8) :: tmp
    t_0 = -sqrt(2.0d0)
    if ((b_m <= 3.1d-97) .or. (.not. (b_m <= 1.25d-77)) .and. (b_m <= 1.05d-49)) then
        tmp = sqrt((f * ((-0.5d0) / c))) * t_0
    else
        tmp = sqrt((f * ((-1.0d0) / b_m))) * t_0
    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 t_0 = -Math.sqrt(2.0);
	double tmp;
	if ((B_m <= 3.1e-97) || (!(B_m <= 1.25e-77) && (B_m <= 1.05e-49))) {
		tmp = Math.sqrt((F * (-0.5 / C))) * t_0;
	} else {
		tmp = Math.sqrt((F * (-1.0 / B_m))) * t_0;
	}
	return tmp;
}
B_m = math.fabs(B)
[A, B_m, C, F] = sort([A, B_m, C, F])
def code(A, B_m, C, F):
	t_0 = -math.sqrt(2.0)
	tmp = 0
	if (B_m <= 3.1e-97) or (not (B_m <= 1.25e-77) and (B_m <= 1.05e-49)):
		tmp = math.sqrt((F * (-0.5 / C))) * t_0
	else:
		tmp = math.sqrt((F * (-1.0 / B_m))) * t_0
	return tmp
B_m = abs(B)
A, B_m, C, F = sort([A, B_m, C, F])
function code(A, B_m, C, F)
	t_0 = Float64(-sqrt(2.0))
	tmp = 0.0
	if ((B_m <= 3.1e-97) || (!(B_m <= 1.25e-77) && (B_m <= 1.05e-49)))
		tmp = Float64(sqrt(Float64(F * Float64(-0.5 / C))) * t_0);
	else
		tmp = Float64(sqrt(Float64(F * Float64(-1.0 / B_m))) * t_0);
	end
	return tmp
end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
	t_0 = -sqrt(2.0);
	tmp = 0.0;
	if ((B_m <= 3.1e-97) || (~((B_m <= 1.25e-77)) && (B_m <= 1.05e-49)))
		tmp = sqrt((F * (-0.5 / C))) * t_0;
	else
		tmp = sqrt((F * (-1.0 / B_m))) * t_0;
	end
	tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = (-N[Sqrt[2.0], $MachinePrecision])}, If[Or[LessEqual[B$95$m, 3.1e-97], And[N[Not[LessEqual[B$95$m, 1.25e-77]], $MachinePrecision], LessEqual[B$95$m, 1.05e-49]]], N[(N[Sqrt[N[(F * N[(-0.5 / C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision], N[(N[Sqrt[N[(F * N[(-1.0 / B$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$0), $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 := -\sqrt{2}\\
\mathbf{if}\;B\_m \leq 3.1 \cdot 10^{-97} \lor \neg \left(B\_m \leq 1.25 \cdot 10^{-77}\right) \land B\_m \leq 1.05 \cdot 10^{-49}:\\
\;\;\;\;\sqrt{F \cdot \frac{-0.5}{C}} \cdot t\_0\\

\mathbf{else}:\\
\;\;\;\;\sqrt{F \cdot \frac{-1}{B\_m}} \cdot t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if B < 3.10000000000000002e-97 or 1.24999999999999991e-77 < B < 1.0499999999999999e-49

    1. Initial program 22.8%

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

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

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

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

    if 3.10000000000000002e-97 < B < 1.24999999999999991e-77 or 1.0499999999999999e-49 < B

    1. Initial program 27.1%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;B \leq 3.1 \cdot 10^{-97} \lor \neg \left(B \leq 1.25 \cdot 10^{-77}\right) \land B \leq 1.05 \cdot 10^{-49}:\\ \;\;\;\;\sqrt{F \cdot \frac{-0.5}{C}} \cdot \left(-\sqrt{2}\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{F \cdot \frac{-1}{B}} \cdot \left(-\sqrt{2}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 26.4% accurate, 3.0× speedup?

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

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

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

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

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

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

Alternative 9: 0.0% accurate, 3.1× speedup?

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

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

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

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

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

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

      \[\leadsto \color{blue}{-\sqrt{\frac{F}{C}} \cdot \sqrt{-1}} \]
  9. Simplified0.0%

    \[\leadsto \color{blue}{-\sqrt{\frac{F}{C}} \cdot \sqrt{-1}} \]
  10. Final simplification0.0%

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

Reproduce

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