ABCF->ab-angle b

Percentage Accurate: 19.4% → 52.3%
Time: 28.6s
Alternatives: 13
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 13 alternatives:

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

Initial Program: 19.4% 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: 52.3% accurate, 0.3× speedup?

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

\mathbf{elif}\;t_2 \leq 0:\\
\;\;\;\;\sqrt{t_5 \cdot \left(F \cdot \left(2 \cdot \left(A + \left(A + \frac{-0.5 \cdot \left({A}^{2} + \left({B_m}^{2} - {A}^{2}\right)\right)}{C}\right)\right)\right)\right)} \cdot \frac{-1}{t_5}\\

\mathbf{elif}\;t_2 \leq \infty:\\
\;\;\;\;\frac{-\sqrt{t_1 \cdot \left(A + \left(A + C\right)\right)}}{t_0}\\

\mathbf{else}:\\
\;\;\;\;t_4 \cdot \frac{-\sqrt{2}}{B_m}\\


\end{array}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 2: 51.2% accurate, 0.2× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ [A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\ \\ \begin{array}{l} t_0 := \mathsf{fma}\left(B_m, B_m, A \cdot \left(C \cdot -4\right)\right)\\ t_1 := F \cdot t_0\\ t_2 := \mathsf{fma}\left(A, C \cdot -4, {B_m}^{2}\right)\\ t_3 := {B_m}^{2} - C \cdot \left(4 \cdot A\right)\\ t_4 := t_3 \cdot F\\ t_5 := \frac{-\sqrt{\left(2 \cdot t_4\right) \cdot \left(\left(A + C\right) - \sqrt{{B_m}^{2} + {\left(A - C\right)}^{2}}\right)}}{t_3}\\ t_6 := \mathsf{hypot}\left(B_m, A - C\right)\\ \mathbf{if}\;t_5 \leq -\infty:\\ \;\;\;\;\frac{\sqrt{2 \cdot t_2} \cdot \left(-\sqrt{F \cdot \left(A + A\right)}\right)}{t_2}\\ \mathbf{elif}\;t_5 \leq -1 \cdot 10^{-203}:\\ \;\;\;\;\frac{-\sqrt{t_1 \cdot \left(2 \cdot \left(A + \left(C - t_6\right)\right)\right)}}{t_0}\\ \mathbf{elif}\;t_5 \leq 5 \cdot 10^{+229}:\\ \;\;\;\;\frac{-\sqrt{t_1 \cdot \left(2 \cdot \left(A + \left(A + \frac{-0.5 \cdot \left({A}^{2} + \left({B_m}^{2} - {\left(-A\right)}^{2}\right)\right)}{C}\right)\right)\right)}}{t_0}\\ \mathbf{elif}\;t_5 \leq \infty:\\ \;\;\;\;{\left(\sqrt{\frac{-\sqrt{2 \cdot \left(t_4 \cdot \left(\left(A + C\right) - t_6\right)\right)}}{t_3}}\right)}^{2}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{F \cdot \left(A - \mathsf{hypot}\left(B_m, A\right)\right)} \cdot \frac{-\sqrt{2}}{B_m}\\ \end{array} \end{array} \]
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
 :precision binary64
 (let* ((t_0 (fma B_m B_m (* A (* C -4.0))))
        (t_1 (* F t_0))
        (t_2 (fma A (* C -4.0) (pow B_m 2.0)))
        (t_3 (- (pow B_m 2.0) (* C (* 4.0 A))))
        (t_4 (* t_3 F))
        (t_5
         (/
          (-
           (sqrt
            (*
             (* 2.0 t_4)
             (- (+ A C) (sqrt (+ (pow B_m 2.0) (pow (- A C) 2.0)))))))
          t_3))
        (t_6 (hypot B_m (- A C))))
   (if (<= t_5 (- INFINITY))
     (/ (* (sqrt (* 2.0 t_2)) (- (sqrt (* F (+ A A))))) t_2)
     (if (<= t_5 -1e-203)
       (/ (- (sqrt (* t_1 (* 2.0 (+ A (- C t_6)))))) t_0)
       (if (<= t_5 5e+229)
         (/
          (-
           (sqrt
            (*
             t_1
             (*
              2.0
              (+
               A
               (+
                A
                (/
                 (* -0.5 (+ (pow A 2.0) (- (pow B_m 2.0) (pow (- A) 2.0))))
                 C)))))))
          t_0)
         (if (<= t_5 INFINITY)
           (pow (sqrt (/ (- (sqrt (* 2.0 (* t_4 (- (+ A C) t_6))))) t_3)) 2.0)
           (* (sqrt (* F (- A (hypot B_m A)))) (/ (- (sqrt 2.0)) B_m))))))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
	double t_0 = fma(B_m, B_m, (A * (C * -4.0)));
	double t_1 = F * t_0;
	double t_2 = fma(A, (C * -4.0), pow(B_m, 2.0));
	double t_3 = pow(B_m, 2.0) - (C * (4.0 * A));
	double t_4 = t_3 * F;
	double t_5 = -sqrt(((2.0 * t_4) * ((A + C) - sqrt((pow(B_m, 2.0) + pow((A - C), 2.0)))))) / t_3;
	double t_6 = hypot(B_m, (A - C));
	double tmp;
	if (t_5 <= -((double) INFINITY)) {
		tmp = (sqrt((2.0 * t_2)) * -sqrt((F * (A + A)))) / t_2;
	} else if (t_5 <= -1e-203) {
		tmp = -sqrt((t_1 * (2.0 * (A + (C - t_6))))) / t_0;
	} else if (t_5 <= 5e+229) {
		tmp = -sqrt((t_1 * (2.0 * (A + (A + ((-0.5 * (pow(A, 2.0) + (pow(B_m, 2.0) - pow(-A, 2.0)))) / C)))))) / t_0;
	} else if (t_5 <= ((double) INFINITY)) {
		tmp = pow(sqrt((-sqrt((2.0 * (t_4 * ((A + C) - t_6)))) / t_3)), 2.0);
	} else {
		tmp = sqrt((F * (A - hypot(B_m, A)))) * (-sqrt(2.0) / B_m);
	}
	return tmp;
}
B_m = abs(B)
A, B_m, C, F = sort([A, B_m, C, F])
function code(A, B_m, C, F)
	t_0 = fma(B_m, B_m, Float64(A * Float64(C * -4.0)))
	t_1 = Float64(F * t_0)
	t_2 = fma(A, Float64(C * -4.0), (B_m ^ 2.0))
	t_3 = Float64((B_m ^ 2.0) - Float64(C * Float64(4.0 * A)))
	t_4 = Float64(t_3 * F)
	t_5 = Float64(Float64(-sqrt(Float64(Float64(2.0 * t_4) * Float64(Float64(A + C) - sqrt(Float64((B_m ^ 2.0) + (Float64(A - C) ^ 2.0))))))) / t_3)
	t_6 = hypot(B_m, Float64(A - C))
	tmp = 0.0
	if (t_5 <= Float64(-Inf))
		tmp = Float64(Float64(sqrt(Float64(2.0 * t_2)) * Float64(-sqrt(Float64(F * Float64(A + A))))) / t_2);
	elseif (t_5 <= -1e-203)
		tmp = Float64(Float64(-sqrt(Float64(t_1 * Float64(2.0 * Float64(A + Float64(C - t_6)))))) / t_0);
	elseif (t_5 <= 5e+229)
		tmp = Float64(Float64(-sqrt(Float64(t_1 * Float64(2.0 * Float64(A + Float64(A + Float64(Float64(-0.5 * Float64((A ^ 2.0) + Float64((B_m ^ 2.0) - (Float64(-A) ^ 2.0)))) / C))))))) / t_0);
	elseif (t_5 <= Inf)
		tmp = sqrt(Float64(Float64(-sqrt(Float64(2.0 * Float64(t_4 * Float64(Float64(A + C) - t_6))))) / t_3)) ^ 2.0;
	else
		tmp = Float64(sqrt(Float64(F * Float64(A - hypot(B_m, A)))) * Float64(Float64(-sqrt(2.0)) / B_m));
	end
	return tmp
end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(F * t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(A * N[(C * -4.0), $MachinePrecision] + N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[Power[B$95$m, 2.0], $MachinePrecision] - N[(C * N[(4.0 * A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(t$95$3 * F), $MachinePrecision]}, Block[{t$95$5 = N[((-N[Sqrt[N[(N[(2.0 * t$95$4), $MachinePrecision] * N[(N[(A + C), $MachinePrecision] - N[Sqrt[N[(N[Power[B$95$m, 2.0], $MachinePrecision] + N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$3), $MachinePrecision]}, Block[{t$95$6 = N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]}, If[LessEqual[t$95$5, (-Infinity)], N[(N[(N[Sqrt[N[(2.0 * t$95$2), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(F * N[(A + A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$2), $MachinePrecision], If[LessEqual[t$95$5, -1e-203], N[((-N[Sqrt[N[(t$95$1 * N[(2.0 * N[(A + N[(C - t$95$6), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[t$95$5, 5e+229], N[((-N[Sqrt[N[(t$95$1 * N[(2.0 * N[(A + N[(A + N[(N[(-0.5 * N[(N[Power[A, 2.0], $MachinePrecision] + N[(N[Power[B$95$m, 2.0], $MachinePrecision] - N[Power[(-A), 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[t$95$5, Infinity], N[Power[N[Sqrt[N[((-N[Sqrt[N[(2.0 * N[(t$95$4 * N[(N[(A + C), $MachinePrecision] - t$95$6), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$3), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision], N[(N[Sqrt[N[(F * N[(A - N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[((-N[Sqrt[2.0], $MachinePrecision]) / B$95$m), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B_m, B_m, A \cdot \left(C \cdot -4\right)\right)\\
t_1 := F \cdot t_0\\
t_2 := \mathsf{fma}\left(A, C \cdot -4, {B_m}^{2}\right)\\
t_3 := {B_m}^{2} - C \cdot \left(4 \cdot A\right)\\
t_4 := t_3 \cdot F\\
t_5 := \frac{-\sqrt{\left(2 \cdot t_4\right) \cdot \left(\left(A + C\right) - \sqrt{{B_m}^{2} + {\left(A - C\right)}^{2}}\right)}}{t_3}\\
t_6 := \mathsf{hypot}\left(B_m, A - C\right)\\
\mathbf{if}\;t_5 \leq -\infty:\\
\;\;\;\;\frac{\sqrt{2 \cdot t_2} \cdot \left(-\sqrt{F \cdot \left(A + A\right)}\right)}{t_2}\\

\mathbf{elif}\;t_5 \leq -1 \cdot 10^{-203}:\\
\;\;\;\;\frac{-\sqrt{t_1 \cdot \left(2 \cdot \left(A + \left(C - t_6\right)\right)\right)}}{t_0}\\

\mathbf{elif}\;t_5 \leq 5 \cdot 10^{+229}:\\
\;\;\;\;\frac{-\sqrt{t_1 \cdot \left(2 \cdot \left(A + \left(A + \frac{-0.5 \cdot \left({A}^{2} + \left({B_m}^{2} - {\left(-A\right)}^{2}\right)\right)}{C}\right)\right)\right)}}{t_0}\\

\mathbf{elif}\;t_5 \leq \infty:\\
\;\;\;\;{\left(\sqrt{\frac{-\sqrt{2 \cdot \left(t_4 \cdot \left(\left(A + C\right) - t_6\right)\right)}}{t_3}}\right)}^{2}\\

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


\end{array}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 3: 51.1% accurate, 0.2× speedup?

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

\mathbf{elif}\;t_4 \leq -1 \cdot 10^{-203}:\\
\;\;\;\;\frac{-\sqrt{\left(F \cdot t_0\right) \cdot \left(2 \cdot \left(A + \left(C - \mathsf{hypot}\left(B_m, A - C\right)\right)\right)\right)}}{t_0}\\

\mathbf{elif}\;t_4 \leq 0:\\
\;\;\;\;\sqrt{t_0 \cdot \left(F \cdot \left(2 \cdot \left(A + \left(A + \frac{-0.5 \cdot \left({A}^{2} + \left({B_m}^{2} - {A}^{2}\right)\right)}{C}\right)\right)\right)\right)} \cdot \frac{-1}{t_0}\\

\mathbf{elif}\;t_4 \leq \infty:\\
\;\;\;\;\frac{-\sqrt{t_3 \cdot \left(A + \left(A + C\right)\right)}}{t_2}\\

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


\end{array}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

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

\mathbf{elif}\;{B_m}^{2} \leq 10^{+27}:\\
\;\;\;\;\frac{-\sqrt{t_0 \cdot \left(F \cdot \left(2 \cdot \left(\left(A + C\right) - \mathsf{hypot}\left(B_m, A - C\right)\right)\right)\right)}}{t_0}\\

\mathbf{elif}\;{B_m}^{2} \leq 10^{+52}:\\
\;\;\;\;\frac{\sqrt{2}}{B_m} \cdot \left(-\sqrt{F \cdot \frac{{B_m}^{2} \cdot -0.5}{C}}\right)\\

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


\end{array}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

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

\mathbf{elif}\;{B_m}^{2} \leq 10^{+27}:\\
\;\;\;\;\frac{-\sqrt{\left(F \cdot t_1\right) \cdot \left(2 \cdot \left(A + \left(C - \mathsf{hypot}\left(B_m, A - C\right)\right)\right)\right)}}{t_1}\\

\mathbf{elif}\;{B_m}^{2} \leq 10^{+52}:\\
\;\;\;\;\frac{\sqrt{2}}{B_m} \cdot \left(-\sqrt{F \cdot \frac{{B_m}^{2} \cdot -0.5}{C}}\right)\\

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


\end{array}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

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

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


\end{array}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 7: 42.5% accurate, 1.5× speedup?

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

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


\end{array}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 8: 45.4% accurate, 1.5× speedup?

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

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


\end{array}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Alternative 9: 34.8% accurate, 2.0× speedup?

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

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


\end{array}
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

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

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

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

Alternative 13: 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])\\ \\ 0.25 \cdot \left(\sqrt{\frac{F}{A}} \cdot \sqrt{-16}\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
 (* 0.25 (* (sqrt (/ F A)) (sqrt -16.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 0.25 * (sqrt((F / A)) * sqrt(-16.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 = 0.25d0 * (sqrt((f / a)) * sqrt((-16.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 0.25 * (Math.sqrt((F / A)) * Math.sqrt(-16.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 0.25 * (math.sqrt((F / A)) * math.sqrt(-16.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(0.25 * Float64(sqrt(Float64(F / A)) * sqrt(-16.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 = 0.25 * (sqrt((F / A)) * sqrt(-16.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[(0.25 * N[(N[Sqrt[N[(F / A), $MachinePrecision]], $MachinePrecision] * N[Sqrt[-16.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
0.25 \cdot \left(\sqrt{\frac{F}{A}} \cdot \sqrt{-16}\right)
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Reproduce

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