ABCF->ab-angle a

Percentage Accurate: 19.2% → 61.1%
Time: 43.3s
Alternatives: 19
Speedup: 6.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 19 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.2% 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: 61.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 := -\sqrt{F}\\ t_1 := {B_m}^{2} - \left(4 \cdot A\right) \cdot C\\ t_2 := \sqrt{C + \left(A + \mathsf{hypot}\left(B_m, A - C\right)\right)}\\ t_3 := \frac{-\sqrt{\left(2 \cdot \left(t_1 \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{B_m}^{2} + {\left(A - C\right)}^{2}}\right)}}{t_1}\\ t_4 := \mathsf{fma}\left(A, C \cdot -4, {B_m}^{2}\right)\\ \mathbf{if}\;t_3 \leq -1 \cdot 10^{-195}:\\ \;\;\;\;\frac{t_2 \cdot \left(\sqrt{2 \cdot t_4} \cdot t_0\right)}{\mathsf{fma}\left(B_m, B_m, A \cdot \left(C \cdot -4\right)\right)}\\ \mathbf{elif}\;t_3 \leq 10^{-143}:\\ \;\;\;\;\frac{-\sqrt{t_4 \cdot \left(\left(2 \cdot F\right) \cdot \mathsf{fma}\left(-0.5, \frac{{B_m}^{2}}{A}, 2 \cdot C\right)\right)}}{t_1}\\ \mathbf{elif}\;t_3 \leq \infty:\\ \;\;\;\;-t_2 \cdot \frac{\sqrt{t_4 \cdot \left(2 \cdot F\right)}}{t_4}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{2}}{B_m} \cdot \left(\sqrt{B_m + C} \cdot t_0\right)\\ \end{array} \end{array} \]
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
 :precision binary64
 (let* ((t_0 (- (sqrt F)))
        (t_1 (- (pow B_m 2.0) (* (* 4.0 A) C)))
        (t_2 (sqrt (+ C (+ A (hypot B_m (- A C))))))
        (t_3
         (/
          (-
           (sqrt
            (*
             (* 2.0 (* t_1 F))
             (+ (+ A C) (sqrt (+ (pow B_m 2.0) (pow (- A C) 2.0)))))))
          t_1))
        (t_4 (fma A (* C -4.0) (pow B_m 2.0))))
   (if (<= t_3 -1e-195)
     (/ (* t_2 (* (sqrt (* 2.0 t_4)) t_0)) (fma B_m B_m (* A (* C -4.0))))
     (if (<= t_3 1e-143)
       (/
        (-
         (sqrt (* t_4 (* (* 2.0 F) (fma -0.5 (/ (pow B_m 2.0) A) (* 2.0 C))))))
        t_1)
       (if (<= t_3 INFINITY)
         (- (* t_2 (/ (sqrt (* t_4 (* 2.0 F))) t_4)))
         (* (/ (sqrt 2.0) B_m) (* (sqrt (+ B_m C)) 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(F);
	double t_1 = pow(B_m, 2.0) - ((4.0 * A) * C);
	double t_2 = sqrt((C + (A + hypot(B_m, (A - C)))));
	double t_3 = -sqrt(((2.0 * (t_1 * F)) * ((A + C) + sqrt((pow(B_m, 2.0) + pow((A - C), 2.0)))))) / t_1;
	double t_4 = fma(A, (C * -4.0), pow(B_m, 2.0));
	double tmp;
	if (t_3 <= -1e-195) {
		tmp = (t_2 * (sqrt((2.0 * t_4)) * t_0)) / fma(B_m, B_m, (A * (C * -4.0)));
	} else if (t_3 <= 1e-143) {
		tmp = -sqrt((t_4 * ((2.0 * F) * fma(-0.5, (pow(B_m, 2.0) / A), (2.0 * C))))) / t_1;
	} else if (t_3 <= ((double) INFINITY)) {
		tmp = -(t_2 * (sqrt((t_4 * (2.0 * F))) / t_4));
	} else {
		tmp = (sqrt(2.0) / B_m) * (sqrt((B_m + C)) * 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(F))
	t_1 = Float64((B_m ^ 2.0) - Float64(Float64(4.0 * A) * C))
	t_2 = sqrt(Float64(C + Float64(A + hypot(B_m, Float64(A - C)))))
	t_3 = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_1 * F)) * Float64(Float64(A + C) + sqrt(Float64((B_m ^ 2.0) + (Float64(A - C) ^ 2.0))))))) / t_1)
	t_4 = fma(A, Float64(C * -4.0), (B_m ^ 2.0))
	tmp = 0.0
	if (t_3 <= -1e-195)
		tmp = Float64(Float64(t_2 * Float64(sqrt(Float64(2.0 * t_4)) * t_0)) / fma(B_m, B_m, Float64(A * Float64(C * -4.0))));
	elseif (t_3 <= 1e-143)
		tmp = Float64(Float64(-sqrt(Float64(t_4 * Float64(Float64(2.0 * F) * fma(-0.5, Float64((B_m ^ 2.0) / A), Float64(2.0 * C)))))) / t_1);
	elseif (t_3 <= Inf)
		tmp = Float64(-Float64(t_2 * Float64(sqrt(Float64(t_4 * Float64(2.0 * F))) / t_4)));
	else
		tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(sqrt(Float64(B_m + C)) * 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[F], $MachinePrecision])}, Block[{t$95$1 = N[(N[Power[B$95$m, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(C + N[(A + N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$1 * F), $MachinePrecision]), $MachinePrecision] * N[(N[(A + C), $MachinePrecision] + N[Sqrt[N[(N[Power[B$95$m, 2.0], $MachinePrecision] + N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision]}, Block[{t$95$4 = N[(A * N[(C * -4.0), $MachinePrecision] + N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, -1e-195], N[(N[(t$95$2 * N[(N[Sqrt[N[(2.0 * t$95$4), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision] / N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 1e-143], N[((-N[Sqrt[N[(t$95$4 * N[(N[(2.0 * F), $MachinePrecision] * N[(-0.5 * N[(N[Power[B$95$m, 2.0], $MachinePrecision] / A), $MachinePrecision] + N[(2.0 * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], If[LessEqual[t$95$3, Infinity], (-N[(t$95$2 * N[(N[Sqrt[N[(t$95$4 * N[(2.0 * F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$4), $MachinePrecision]), $MachinePrecision]), N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * N[(N[Sqrt[N[(B$95$m + C), $MachinePrecision]], $MachinePrecision] * t$95$0), $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 := -\sqrt{F}\\
t_1 := {B_m}^{2} - \left(4 \cdot A\right) \cdot C\\
t_2 := \sqrt{C + \left(A + \mathsf{hypot}\left(B_m, A - C\right)\right)}\\
t_3 := \frac{-\sqrt{\left(2 \cdot \left(t_1 \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{B_m}^{2} + {\left(A - C\right)}^{2}}\right)}}{t_1}\\
t_4 := \mathsf{fma}\left(A, C \cdot -4, {B_m}^{2}\right)\\
\mathbf{if}\;t_3 \leq -1 \cdot 10^{-195}:\\
\;\;\;\;\frac{t_2 \cdot \left(\sqrt{2 \cdot t_4} \cdot t_0\right)}{\mathsf{fma}\left(B_m, B_m, A \cdot \left(C \cdot -4\right)\right)}\\

\mathbf{elif}\;t_3 \leq 10^{-143}:\\
\;\;\;\;\frac{-\sqrt{t_4 \cdot \left(\left(2 \cdot F\right) \cdot \mathsf{fma}\left(-0.5, \frac{{B_m}^{2}}{A}, 2 \cdot C\right)\right)}}{t_1}\\

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

\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B_m} \cdot \left(\sqrt{B_m + C} \cdot t_0\right)\\


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

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

\mathbf{elif}\;t_4 \leq -1 \cdot 10^{-195}:\\
\;\;\;\;-\frac{\sqrt{\left(F \cdot t_2\right) \cdot \left(2 \cdot t_1\right)}}{t_2}\\

\mathbf{elif}\;t_4 \leq 10^{-143}:\\
\;\;\;\;\frac{-\sqrt{t_0 \cdot \left(\left(2 \cdot F\right) \cdot \mathsf{fma}\left(-0.5, \frac{{B_m}^{2}}{A}, 2 \cdot C\right)\right)}}{t_3}\\

\mathbf{elif}\;t_4 \leq \infty:\\
\;\;\;\;-\sqrt{t_1} \cdot \frac{\sqrt{t_0 \cdot \left(2 \cdot F\right)}}{t_0}\\

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


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

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

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

\mathbf{elif}\;t_3 \leq 10^{-143}:\\
\;\;\;\;\frac{-\sqrt{t_0 \cdot \left(\left(2 \cdot F\right) \cdot \mathsf{fma}\left(-0.5, \frac{{B_m}^{2}}{A}, 2 \cdot C\right)\right)}}{t_2}\\

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

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


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

Alternative 4: 54.2% accurate, 0.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 := {B_m}^{2} - \left(4 \cdot A\right) \cdot C\\ t_1 := \mathsf{fma}\left(B_m, B_m, A \cdot \left(C \cdot -4\right)\right)\\ t_2 := \frac{-\sqrt{\left(2 \cdot \left(t_0 \cdot F\right)\right) \cdot \left(2 \cdot C + -0.5 \cdot \left(B_m \cdot \left(B_m \cdot \frac{1}{A}\right)\right)\right)}}{t_0}\\ t_3 := C + \left(A + \mathsf{hypot}\left(B_m, A - C\right)\right)\\ t_4 := -\sqrt{F}\\ \mathbf{if}\;{B_m}^{2} \leq 2 \cdot 10^{-17}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;{B_m}^{2} \leq 1.55 \cdot 10^{+60}:\\ \;\;\;\;-\frac{\sqrt{\left(F \cdot t_1\right) \cdot \left(2 \cdot t_3\right)}}{t_1}\\ \mathbf{elif}\;{B_m}^{2} \leq 5 \cdot 10^{+92}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;{B_m}^{2} \leq 10^{+239}:\\ \;\;\;\;\frac{\sqrt{t_3} \cdot \left(B_m \cdot \left(\sqrt{2} \cdot t_4\right)\right)}{t_1}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{2}}{B_m} \cdot \left(\sqrt{B_m + C} \cdot t_4\right)\\ \end{array} \end{array} \]
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
 :precision binary64
 (let* ((t_0 (- (pow B_m 2.0) (* (* 4.0 A) C)))
        (t_1 (fma B_m B_m (* A (* C -4.0))))
        (t_2
         (/
          (-
           (sqrt
            (*
             (* 2.0 (* t_0 F))
             (+ (* 2.0 C) (* -0.5 (* B_m (* B_m (/ 1.0 A))))))))
          t_0))
        (t_3 (+ C (+ A (hypot B_m (- A C)))))
        (t_4 (- (sqrt F))))
   (if (<= (pow B_m 2.0) 2e-17)
     t_2
     (if (<= (pow B_m 2.0) 1.55e+60)
       (- (/ (sqrt (* (* F t_1) (* 2.0 t_3))) t_1))
       (if (<= (pow B_m 2.0) 5e+92)
         t_2
         (if (<= (pow B_m 2.0) 1e+239)
           (/ (* (sqrt t_3) (* B_m (* (sqrt 2.0) t_4))) t_1)
           (* (/ (sqrt 2.0) B_m) (* (sqrt (+ B_m C)) t_4))))))))
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) - ((4.0 * A) * C);
	double t_1 = fma(B_m, B_m, (A * (C * -4.0)));
	double t_2 = -sqrt(((2.0 * (t_0 * F)) * ((2.0 * C) + (-0.5 * (B_m * (B_m * (1.0 / A))))))) / t_0;
	double t_3 = C + (A + hypot(B_m, (A - C)));
	double t_4 = -sqrt(F);
	double tmp;
	if (pow(B_m, 2.0) <= 2e-17) {
		tmp = t_2;
	} else if (pow(B_m, 2.0) <= 1.55e+60) {
		tmp = -(sqrt(((F * t_1) * (2.0 * t_3))) / t_1);
	} else if (pow(B_m, 2.0) <= 5e+92) {
		tmp = t_2;
	} else if (pow(B_m, 2.0) <= 1e+239) {
		tmp = (sqrt(t_3) * (B_m * (sqrt(2.0) * t_4))) / t_1;
	} else {
		tmp = (sqrt(2.0) / B_m) * (sqrt((B_m + C)) * t_4);
	}
	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(Float64(4.0 * A) * C))
	t_1 = fma(B_m, B_m, Float64(A * Float64(C * -4.0)))
	t_2 = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_0 * F)) * Float64(Float64(2.0 * C) + Float64(-0.5 * Float64(B_m * Float64(B_m * Float64(1.0 / A)))))))) / t_0)
	t_3 = Float64(C + Float64(A + hypot(B_m, Float64(A - C))))
	t_4 = Float64(-sqrt(F))
	tmp = 0.0
	if ((B_m ^ 2.0) <= 2e-17)
		tmp = t_2;
	elseif ((B_m ^ 2.0) <= 1.55e+60)
		tmp = Float64(-Float64(sqrt(Float64(Float64(F * t_1) * Float64(2.0 * t_3))) / t_1));
	elseif ((B_m ^ 2.0) <= 5e+92)
		tmp = t_2;
	elseif ((B_m ^ 2.0) <= 1e+239)
		tmp = Float64(Float64(sqrt(t_3) * Float64(B_m * Float64(sqrt(2.0) * t_4))) / t_1);
	else
		tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(sqrt(Float64(B_m + C)) * t_4));
	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[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$0 * F), $MachinePrecision]), $MachinePrecision] * N[(N[(2.0 * C), $MachinePrecision] + N[(-0.5 * N[(B$95$m * N[(B$95$m * N[(1.0 / A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision]}, Block[{t$95$3 = N[(C + N[(A + N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = (-N[Sqrt[F], $MachinePrecision])}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e-17], t$95$2, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 1.55e+60], (-N[(N[Sqrt[N[(N[(F * t$95$1), $MachinePrecision] * N[(2.0 * t$95$3), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$1), $MachinePrecision]), If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 5e+92], t$95$2, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 1e+239], N[(N[(N[Sqrt[t$95$3], $MachinePrecision] * N[(B$95$m * N[(N[Sqrt[2.0], $MachinePrecision] * t$95$4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * N[(N[Sqrt[N[(B$95$m + C), $MachinePrecision]], $MachinePrecision] * t$95$4), $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} - \left(4 \cdot A\right) \cdot C\\
t_1 := \mathsf{fma}\left(B_m, B_m, A \cdot \left(C \cdot -4\right)\right)\\
t_2 := \frac{-\sqrt{\left(2 \cdot \left(t_0 \cdot F\right)\right) \cdot \left(2 \cdot C + -0.5 \cdot \left(B_m \cdot \left(B_m \cdot \frac{1}{A}\right)\right)\right)}}{t_0}\\
t_3 := C + \left(A + \mathsf{hypot}\left(B_m, A - C\right)\right)\\
t_4 := -\sqrt{F}\\
\mathbf{if}\;{B_m}^{2} \leq 2 \cdot 10^{-17}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;{B_m}^{2} \leq 1.55 \cdot 10^{+60}:\\
\;\;\;\;-\frac{\sqrt{\left(F \cdot t_1\right) \cdot \left(2 \cdot t_3\right)}}{t_1}\\

\mathbf{elif}\;{B_m}^{2} \leq 5 \cdot 10^{+92}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;{B_m}^{2} \leq 10^{+239}:\\
\;\;\;\;\frac{\sqrt{t_3} \cdot \left(B_m \cdot \left(\sqrt{2} \cdot t_4\right)\right)}{t_1}\\

\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B_m} \cdot \left(\sqrt{B_m + C} \cdot t_4\right)\\


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

Alternative 5: 54.0% accurate, 0.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 := {B_m}^{2} - \left(4 \cdot A\right) \cdot C\\ t_1 := \frac{-\sqrt{\left(2 \cdot \left(t_0 \cdot F\right)\right) \cdot \left(2 \cdot C + -0.5 \cdot \left(B_m \cdot \left(B_m \cdot \frac{1}{A}\right)\right)\right)}}{t_0}\\ t_2 := C + \left(A + \mathsf{hypot}\left(B_m, A - C\right)\right)\\ t_3 := -\sqrt{F}\\ t_4 := \mathsf{fma}\left(B_m, B_m, A \cdot \left(C \cdot -4\right)\right)\\ \mathbf{if}\;{B_m}^{2} \leq 2 \cdot 10^{-17}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;{B_m}^{2} \leq 2 \cdot 10^{+60}:\\ \;\;\;\;\frac{-\sqrt{F \cdot \left(\mathsf{fma}\left(A, C \cdot -4, {B_m}^{2}\right) \cdot \left(2 \cdot t_2\right)\right)}}{t_4}\\ \mathbf{elif}\;{B_m}^{2} \leq 5 \cdot 10^{+92}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;{B_m}^{2} \leq 10^{+239}:\\ \;\;\;\;\frac{\sqrt{t_2} \cdot \left(B_m \cdot \left(\sqrt{2} \cdot t_3\right)\right)}{t_4}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{2}}{B_m} \cdot \left(\sqrt{B_m + C} \cdot t_3\right)\\ \end{array} \end{array} \]
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
 :precision binary64
 (let* ((t_0 (- (pow B_m 2.0) (* (* 4.0 A) C)))
        (t_1
         (/
          (-
           (sqrt
            (*
             (* 2.0 (* t_0 F))
             (+ (* 2.0 C) (* -0.5 (* B_m (* B_m (/ 1.0 A))))))))
          t_0))
        (t_2 (+ C (+ A (hypot B_m (- A C)))))
        (t_3 (- (sqrt F)))
        (t_4 (fma B_m B_m (* A (* C -4.0)))))
   (if (<= (pow B_m 2.0) 2e-17)
     t_1
     (if (<= (pow B_m 2.0) 2e+60)
       (/
        (- (sqrt (* F (* (fma A (* C -4.0) (pow B_m 2.0)) (* 2.0 t_2)))))
        t_4)
       (if (<= (pow B_m 2.0) 5e+92)
         t_1
         (if (<= (pow B_m 2.0) 1e+239)
           (/ (* (sqrt t_2) (* B_m (* (sqrt 2.0) t_3))) t_4)
           (* (/ (sqrt 2.0) B_m) (* (sqrt (+ B_m C)) t_3))))))))
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) - ((4.0 * A) * C);
	double t_1 = -sqrt(((2.0 * (t_0 * F)) * ((2.0 * C) + (-0.5 * (B_m * (B_m * (1.0 / A))))))) / t_0;
	double t_2 = C + (A + hypot(B_m, (A - C)));
	double t_3 = -sqrt(F);
	double t_4 = fma(B_m, B_m, (A * (C * -4.0)));
	double tmp;
	if (pow(B_m, 2.0) <= 2e-17) {
		tmp = t_1;
	} else if (pow(B_m, 2.0) <= 2e+60) {
		tmp = -sqrt((F * (fma(A, (C * -4.0), pow(B_m, 2.0)) * (2.0 * t_2)))) / t_4;
	} else if (pow(B_m, 2.0) <= 5e+92) {
		tmp = t_1;
	} else if (pow(B_m, 2.0) <= 1e+239) {
		tmp = (sqrt(t_2) * (B_m * (sqrt(2.0) * t_3))) / t_4;
	} else {
		tmp = (sqrt(2.0) / B_m) * (sqrt((B_m + C)) * t_3);
	}
	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(Float64(4.0 * A) * C))
	t_1 = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_0 * F)) * Float64(Float64(2.0 * C) + Float64(-0.5 * Float64(B_m * Float64(B_m * Float64(1.0 / A)))))))) / t_0)
	t_2 = Float64(C + Float64(A + hypot(B_m, Float64(A - C))))
	t_3 = Float64(-sqrt(F))
	t_4 = fma(B_m, B_m, Float64(A * Float64(C * -4.0)))
	tmp = 0.0
	if ((B_m ^ 2.0) <= 2e-17)
		tmp = t_1;
	elseif ((B_m ^ 2.0) <= 2e+60)
		tmp = Float64(Float64(-sqrt(Float64(F * Float64(fma(A, Float64(C * -4.0), (B_m ^ 2.0)) * Float64(2.0 * t_2))))) / t_4);
	elseif ((B_m ^ 2.0) <= 5e+92)
		tmp = t_1;
	elseif ((B_m ^ 2.0) <= 1e+239)
		tmp = Float64(Float64(sqrt(t_2) * Float64(B_m * Float64(sqrt(2.0) * t_3))) / t_4);
	else
		tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(sqrt(Float64(B_m + C)) * t_3));
	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[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$0 * F), $MachinePrecision]), $MachinePrecision] * N[(N[(2.0 * C), $MachinePrecision] + N[(-0.5 * N[(B$95$m * N[(B$95$m * N[(1.0 / A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(C + N[(A + N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = (-N[Sqrt[F], $MachinePrecision])}, Block[{t$95$4 = N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e-17], t$95$1, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e+60], N[((-N[Sqrt[N[(F * N[(N[(A * N[(C * -4.0), $MachinePrecision] + N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision] * N[(2.0 * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$4), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 5e+92], t$95$1, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 1e+239], N[(N[(N[Sqrt[t$95$2], $MachinePrecision] * N[(B$95$m * N[(N[Sqrt[2.0], $MachinePrecision] * t$95$3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$4), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * N[(N[Sqrt[N[(B$95$m + C), $MachinePrecision]], $MachinePrecision] * t$95$3), $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} - \left(4 \cdot A\right) \cdot C\\
t_1 := \frac{-\sqrt{\left(2 \cdot \left(t_0 \cdot F\right)\right) \cdot \left(2 \cdot C + -0.5 \cdot \left(B_m \cdot \left(B_m \cdot \frac{1}{A}\right)\right)\right)}}{t_0}\\
t_2 := C + \left(A + \mathsf{hypot}\left(B_m, A - C\right)\right)\\
t_3 := -\sqrt{F}\\
t_4 := \mathsf{fma}\left(B_m, B_m, A \cdot \left(C \cdot -4\right)\right)\\
\mathbf{if}\;{B_m}^{2} \leq 2 \cdot 10^{-17}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;{B_m}^{2} \leq 2 \cdot 10^{+60}:\\
\;\;\;\;\frac{-\sqrt{F \cdot \left(\mathsf{fma}\left(A, C \cdot -4, {B_m}^{2}\right) \cdot \left(2 \cdot t_2\right)\right)}}{t_4}\\

\mathbf{elif}\;{B_m}^{2} \leq 5 \cdot 10^{+92}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;{B_m}^{2} \leq 10^{+239}:\\
\;\;\;\;\frac{\sqrt{t_2} \cdot \left(B_m \cdot \left(\sqrt{2} \cdot t_3\right)\right)}{t_4}\\

\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B_m} \cdot \left(\sqrt{B_m + C} \cdot t_3\right)\\


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

Alternative 6: 55.8% accurate, 0.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{C + \left(A + \mathsf{hypot}\left(B_m, A - C\right)\right)}\\ t_1 := -\sqrt{F}\\ t_2 := {B_m}^{2} - \left(4 \cdot A\right) \cdot C\\ t_3 := \frac{-\sqrt{\left(2 \cdot \left(t_2 \cdot F\right)\right) \cdot \left(2 \cdot C + -0.5 \cdot \left(B_m \cdot \left(B_m \cdot \frac{1}{A}\right)\right)\right)}}{t_2}\\ t_4 := \mathsf{fma}\left(B_m, B_m, A \cdot \left(C \cdot -4\right)\right)\\ \mathbf{if}\;{B_m}^{2} \leq 2 \cdot 10^{-124}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;{B_m}^{2} \leq 2 \cdot 10^{+63}:\\ \;\;\;\;\frac{t_0 \cdot \left(-\sqrt{F \cdot \left(2 \cdot \mathsf{fma}\left(A, C \cdot -4, {B_m}^{2}\right)\right)}\right)}{t_4}\\ \mathbf{elif}\;{B_m}^{2} \leq 5 \cdot 10^{+92}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;{B_m}^{2} \leq 10^{+239}:\\ \;\;\;\;\frac{t_0 \cdot \left(B_m \cdot \left(\sqrt{2} \cdot t_1\right)\right)}{t_4}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{2}}{B_m} \cdot \left(\sqrt{B_m + C} \cdot t_1\right)\\ \end{array} \end{array} \]
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
 :precision binary64
 (let* ((t_0 (sqrt (+ C (+ A (hypot B_m (- A C))))))
        (t_1 (- (sqrt F)))
        (t_2 (- (pow B_m 2.0) (* (* 4.0 A) C)))
        (t_3
         (/
          (-
           (sqrt
            (*
             (* 2.0 (* t_2 F))
             (+ (* 2.0 C) (* -0.5 (* B_m (* B_m (/ 1.0 A))))))))
          t_2))
        (t_4 (fma B_m B_m (* A (* C -4.0)))))
   (if (<= (pow B_m 2.0) 2e-124)
     t_3
     (if (<= (pow B_m 2.0) 2e+63)
       (/
        (* t_0 (- (sqrt (* F (* 2.0 (fma A (* C -4.0) (pow B_m 2.0)))))))
        t_4)
       (if (<= (pow B_m 2.0) 5e+92)
         t_3
         (if (<= (pow B_m 2.0) 1e+239)
           (/ (* t_0 (* B_m (* (sqrt 2.0) t_1))) t_4)
           (* (/ (sqrt 2.0) B_m) (* (sqrt (+ B_m C)) 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((C + (A + hypot(B_m, (A - C)))));
	double t_1 = -sqrt(F);
	double t_2 = pow(B_m, 2.0) - ((4.0 * A) * C);
	double t_3 = -sqrt(((2.0 * (t_2 * F)) * ((2.0 * C) + (-0.5 * (B_m * (B_m * (1.0 / A))))))) / t_2;
	double t_4 = fma(B_m, B_m, (A * (C * -4.0)));
	double tmp;
	if (pow(B_m, 2.0) <= 2e-124) {
		tmp = t_3;
	} else if (pow(B_m, 2.0) <= 2e+63) {
		tmp = (t_0 * -sqrt((F * (2.0 * fma(A, (C * -4.0), pow(B_m, 2.0)))))) / t_4;
	} else if (pow(B_m, 2.0) <= 5e+92) {
		tmp = t_3;
	} else if (pow(B_m, 2.0) <= 1e+239) {
		tmp = (t_0 * (B_m * (sqrt(2.0) * t_1))) / t_4;
	} else {
		tmp = (sqrt(2.0) / B_m) * (sqrt((B_m + C)) * 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 = sqrt(Float64(C + Float64(A + hypot(B_m, Float64(A - C)))))
	t_1 = Float64(-sqrt(F))
	t_2 = Float64((B_m ^ 2.0) - Float64(Float64(4.0 * A) * C))
	t_3 = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_2 * F)) * Float64(Float64(2.0 * C) + Float64(-0.5 * Float64(B_m * Float64(B_m * Float64(1.0 / A)))))))) / t_2)
	t_4 = fma(B_m, B_m, Float64(A * Float64(C * -4.0)))
	tmp = 0.0
	if ((B_m ^ 2.0) <= 2e-124)
		tmp = t_3;
	elseif ((B_m ^ 2.0) <= 2e+63)
		tmp = Float64(Float64(t_0 * Float64(-sqrt(Float64(F * Float64(2.0 * fma(A, Float64(C * -4.0), (B_m ^ 2.0))))))) / t_4);
	elseif ((B_m ^ 2.0) <= 5e+92)
		tmp = t_3;
	elseif ((B_m ^ 2.0) <= 1e+239)
		tmp = Float64(Float64(t_0 * Float64(B_m * Float64(sqrt(2.0) * t_1))) / t_4);
	else
		tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(sqrt(Float64(B_m + C)) * 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[Sqrt[N[(C + N[(A + N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = (-N[Sqrt[F], $MachinePrecision])}, Block[{t$95$2 = N[(N[Power[B$95$m, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$2 * F), $MachinePrecision]), $MachinePrecision] * N[(N[(2.0 * C), $MachinePrecision] + N[(-0.5 * N[(B$95$m * N[(B$95$m * N[(1.0 / A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$2), $MachinePrecision]}, Block[{t$95$4 = N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e-124], t$95$3, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e+63], N[(N[(t$95$0 * (-N[Sqrt[N[(F * N[(2.0 * N[(A * N[(C * -4.0), $MachinePrecision] + N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$4), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 5e+92], t$95$3, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 1e+239], N[(N[(t$95$0 * N[(B$95$m * N[(N[Sqrt[2.0], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$4), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * N[(N[Sqrt[N[(B$95$m + C), $MachinePrecision]], $MachinePrecision] * t$95$1), $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 := \sqrt{C + \left(A + \mathsf{hypot}\left(B_m, A - C\right)\right)}\\
t_1 := -\sqrt{F}\\
t_2 := {B_m}^{2} - \left(4 \cdot A\right) \cdot C\\
t_3 := \frac{-\sqrt{\left(2 \cdot \left(t_2 \cdot F\right)\right) \cdot \left(2 \cdot C + -0.5 \cdot \left(B_m \cdot \left(B_m \cdot \frac{1}{A}\right)\right)\right)}}{t_2}\\
t_4 := \mathsf{fma}\left(B_m, B_m, A \cdot \left(C \cdot -4\right)\right)\\
\mathbf{if}\;{B_m}^{2} \leq 2 \cdot 10^{-124}:\\
\;\;\;\;t_3\\

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

\mathbf{elif}\;{B_m}^{2} \leq 5 \cdot 10^{+92}:\\
\;\;\;\;t_3\\

\mathbf{elif}\;{B_m}^{2} \leq 10^{+239}:\\
\;\;\;\;\frac{t_0 \cdot \left(B_m \cdot \left(\sqrt{2} \cdot t_1\right)\right)}{t_4}\\

\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B_m} \cdot \left(\sqrt{B_m + C} \cdot t_1\right)\\


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

Alternative 7: 55.8% accurate, 0.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 := C + \left(A + \mathsf{hypot}\left(B_m, A - C\right)\right)\\ t_1 := -\sqrt{F}\\ t_2 := {B_m}^{2} - \left(4 \cdot A\right) \cdot C\\ t_3 := \frac{-\sqrt{\left(2 \cdot \left(t_2 \cdot F\right)\right) \cdot \left(2 \cdot C + -0.5 \cdot \left(B_m \cdot \left(B_m \cdot \frac{1}{A}\right)\right)\right)}}{t_2}\\ t_4 := \mathsf{fma}\left(B_m, B_m, A \cdot \left(C \cdot -4\right)\right)\\ \mathbf{if}\;{B_m}^{2} \leq 2 \cdot 10^{-124}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;{B_m}^{2} \leq 2 \cdot 10^{+63}:\\ \;\;\;\;\frac{\sqrt{F \cdot \mathsf{fma}\left(A, C \cdot -4, {B_m}^{2}\right)} \cdot \left(-\sqrt{2 \cdot t_0}\right)}{t_4}\\ \mathbf{elif}\;{B_m}^{2} \leq 5 \cdot 10^{+92}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;{B_m}^{2} \leq 10^{+239}:\\ \;\;\;\;\frac{\sqrt{t_0} \cdot \left(B_m \cdot \left(\sqrt{2} \cdot t_1\right)\right)}{t_4}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{2}}{B_m} \cdot \left(\sqrt{B_m + C} \cdot t_1\right)\\ \end{array} \end{array} \]
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
 :precision binary64
 (let* ((t_0 (+ C (+ A (hypot B_m (- A C)))))
        (t_1 (- (sqrt F)))
        (t_2 (- (pow B_m 2.0) (* (* 4.0 A) C)))
        (t_3
         (/
          (-
           (sqrt
            (*
             (* 2.0 (* t_2 F))
             (+ (* 2.0 C) (* -0.5 (* B_m (* B_m (/ 1.0 A))))))))
          t_2))
        (t_4 (fma B_m B_m (* A (* C -4.0)))))
   (if (<= (pow B_m 2.0) 2e-124)
     t_3
     (if (<= (pow B_m 2.0) 2e+63)
       (/
        (*
         (sqrt (* F (fma A (* C -4.0) (pow B_m 2.0))))
         (- (sqrt (* 2.0 t_0))))
        t_4)
       (if (<= (pow B_m 2.0) 5e+92)
         t_3
         (if (<= (pow B_m 2.0) 1e+239)
           (/ (* (sqrt t_0) (* B_m (* (sqrt 2.0) t_1))) t_4)
           (* (/ (sqrt 2.0) B_m) (* (sqrt (+ B_m C)) 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 = C + (A + hypot(B_m, (A - C)));
	double t_1 = -sqrt(F);
	double t_2 = pow(B_m, 2.0) - ((4.0 * A) * C);
	double t_3 = -sqrt(((2.0 * (t_2 * F)) * ((2.0 * C) + (-0.5 * (B_m * (B_m * (1.0 / A))))))) / t_2;
	double t_4 = fma(B_m, B_m, (A * (C * -4.0)));
	double tmp;
	if (pow(B_m, 2.0) <= 2e-124) {
		tmp = t_3;
	} else if (pow(B_m, 2.0) <= 2e+63) {
		tmp = (sqrt((F * fma(A, (C * -4.0), pow(B_m, 2.0)))) * -sqrt((2.0 * t_0))) / t_4;
	} else if (pow(B_m, 2.0) <= 5e+92) {
		tmp = t_3;
	} else if (pow(B_m, 2.0) <= 1e+239) {
		tmp = (sqrt(t_0) * (B_m * (sqrt(2.0) * t_1))) / t_4;
	} else {
		tmp = (sqrt(2.0) / B_m) * (sqrt((B_m + C)) * 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(C + Float64(A + hypot(B_m, Float64(A - C))))
	t_1 = Float64(-sqrt(F))
	t_2 = Float64((B_m ^ 2.0) - Float64(Float64(4.0 * A) * C))
	t_3 = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_2 * F)) * Float64(Float64(2.0 * C) + Float64(-0.5 * Float64(B_m * Float64(B_m * Float64(1.0 / A)))))))) / t_2)
	t_4 = fma(B_m, B_m, Float64(A * Float64(C * -4.0)))
	tmp = 0.0
	if ((B_m ^ 2.0) <= 2e-124)
		tmp = t_3;
	elseif ((B_m ^ 2.0) <= 2e+63)
		tmp = Float64(Float64(sqrt(Float64(F * fma(A, Float64(C * -4.0), (B_m ^ 2.0)))) * Float64(-sqrt(Float64(2.0 * t_0)))) / t_4);
	elseif ((B_m ^ 2.0) <= 5e+92)
		tmp = t_3;
	elseif ((B_m ^ 2.0) <= 1e+239)
		tmp = Float64(Float64(sqrt(t_0) * Float64(B_m * Float64(sqrt(2.0) * t_1))) / t_4);
	else
		tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(sqrt(Float64(B_m + C)) * 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[(C + N[(A + N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = (-N[Sqrt[F], $MachinePrecision])}, Block[{t$95$2 = N[(N[Power[B$95$m, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$2 * F), $MachinePrecision]), $MachinePrecision] * N[(N[(2.0 * C), $MachinePrecision] + N[(-0.5 * N[(B$95$m * N[(B$95$m * N[(1.0 / A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$2), $MachinePrecision]}, Block[{t$95$4 = N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e-124], t$95$3, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e+63], N[(N[(N[Sqrt[N[(F * N[(A * N[(C * -4.0), $MachinePrecision] + N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(2.0 * t$95$0), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$4), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 5e+92], t$95$3, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 1e+239], N[(N[(N[Sqrt[t$95$0], $MachinePrecision] * N[(B$95$m * N[(N[Sqrt[2.0], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$4), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * N[(N[Sqrt[N[(B$95$m + C), $MachinePrecision]], $MachinePrecision] * t$95$1), $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 := C + \left(A + \mathsf{hypot}\left(B_m, A - C\right)\right)\\
t_1 := -\sqrt{F}\\
t_2 := {B_m}^{2} - \left(4 \cdot A\right) \cdot C\\
t_3 := \frac{-\sqrt{\left(2 \cdot \left(t_2 \cdot F\right)\right) \cdot \left(2 \cdot C + -0.5 \cdot \left(B_m \cdot \left(B_m \cdot \frac{1}{A}\right)\right)\right)}}{t_2}\\
t_4 := \mathsf{fma}\left(B_m, B_m, A \cdot \left(C \cdot -4\right)\right)\\
\mathbf{if}\;{B_m}^{2} \leq 2 \cdot 10^{-124}:\\
\;\;\;\;t_3\\

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

\mathbf{elif}\;{B_m}^{2} \leq 5 \cdot 10^{+92}:\\
\;\;\;\;t_3\\

\mathbf{elif}\;{B_m}^{2} \leq 10^{+239}:\\
\;\;\;\;\frac{\sqrt{t_0} \cdot \left(B_m \cdot \left(\sqrt{2} \cdot t_1\right)\right)}{t_4}\\

\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B_m} \cdot \left(\sqrt{B_m + C} \cdot t_1\right)\\


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

Alternative 8: 54.4% accurate, 0.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 := C + \left(A + \mathsf{hypot}\left(B_m, A - C\right)\right)\\ t_1 := -\sqrt{F}\\ t_2 := {B_m}^{2} - \left(4 \cdot A\right) \cdot C\\ t_3 := \frac{-\sqrt{\left(2 \cdot \left(t_2 \cdot F\right)\right) \cdot \left(2 \cdot C + -0.5 \cdot \left(B_m \cdot \left(B_m \cdot \frac{1}{A}\right)\right)\right)}}{t_2}\\ t_4 := \mathsf{fma}\left(B_m, B_m, A \cdot \left(C \cdot -4\right)\right)\\ \mathbf{if}\;{B_m}^{2} \leq 2 \cdot 10^{-124}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;{B_m}^{2} \leq 2 \cdot 10^{+60}:\\ \;\;\;\;\frac{\sqrt{F \cdot \left(2 \cdot t_0\right)} \cdot \left(-\sqrt{\mathsf{fma}\left(A, C \cdot -4, {B_m}^{2}\right)}\right)}{t_4}\\ \mathbf{elif}\;{B_m}^{2} \leq 5 \cdot 10^{+92}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;{B_m}^{2} \leq 10^{+239}:\\ \;\;\;\;\frac{\sqrt{t_0} \cdot \left(B_m \cdot \left(\sqrt{2} \cdot t_1\right)\right)}{t_4}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{2}}{B_m} \cdot \left(\sqrt{B_m + C} \cdot t_1\right)\\ \end{array} \end{array} \]
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
 :precision binary64
 (let* ((t_0 (+ C (+ A (hypot B_m (- A C)))))
        (t_1 (- (sqrt F)))
        (t_2 (- (pow B_m 2.0) (* (* 4.0 A) C)))
        (t_3
         (/
          (-
           (sqrt
            (*
             (* 2.0 (* t_2 F))
             (+ (* 2.0 C) (* -0.5 (* B_m (* B_m (/ 1.0 A))))))))
          t_2))
        (t_4 (fma B_m B_m (* A (* C -4.0)))))
   (if (<= (pow B_m 2.0) 2e-124)
     t_3
     (if (<= (pow B_m 2.0) 2e+60)
       (/
        (*
         (sqrt (* F (* 2.0 t_0)))
         (- (sqrt (fma A (* C -4.0) (pow B_m 2.0)))))
        t_4)
       (if (<= (pow B_m 2.0) 5e+92)
         t_3
         (if (<= (pow B_m 2.0) 1e+239)
           (/ (* (sqrt t_0) (* B_m (* (sqrt 2.0) t_1))) t_4)
           (* (/ (sqrt 2.0) B_m) (* (sqrt (+ B_m C)) 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 = C + (A + hypot(B_m, (A - C)));
	double t_1 = -sqrt(F);
	double t_2 = pow(B_m, 2.0) - ((4.0 * A) * C);
	double t_3 = -sqrt(((2.0 * (t_2 * F)) * ((2.0 * C) + (-0.5 * (B_m * (B_m * (1.0 / A))))))) / t_2;
	double t_4 = fma(B_m, B_m, (A * (C * -4.0)));
	double tmp;
	if (pow(B_m, 2.0) <= 2e-124) {
		tmp = t_3;
	} else if (pow(B_m, 2.0) <= 2e+60) {
		tmp = (sqrt((F * (2.0 * t_0))) * -sqrt(fma(A, (C * -4.0), pow(B_m, 2.0)))) / t_4;
	} else if (pow(B_m, 2.0) <= 5e+92) {
		tmp = t_3;
	} else if (pow(B_m, 2.0) <= 1e+239) {
		tmp = (sqrt(t_0) * (B_m * (sqrt(2.0) * t_1))) / t_4;
	} else {
		tmp = (sqrt(2.0) / B_m) * (sqrt((B_m + C)) * 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(C + Float64(A + hypot(B_m, Float64(A - C))))
	t_1 = Float64(-sqrt(F))
	t_2 = Float64((B_m ^ 2.0) - Float64(Float64(4.0 * A) * C))
	t_3 = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_2 * F)) * Float64(Float64(2.0 * C) + Float64(-0.5 * Float64(B_m * Float64(B_m * Float64(1.0 / A)))))))) / t_2)
	t_4 = fma(B_m, B_m, Float64(A * Float64(C * -4.0)))
	tmp = 0.0
	if ((B_m ^ 2.0) <= 2e-124)
		tmp = t_3;
	elseif ((B_m ^ 2.0) <= 2e+60)
		tmp = Float64(Float64(sqrt(Float64(F * Float64(2.0 * t_0))) * Float64(-sqrt(fma(A, Float64(C * -4.0), (B_m ^ 2.0))))) / t_4);
	elseif ((B_m ^ 2.0) <= 5e+92)
		tmp = t_3;
	elseif ((B_m ^ 2.0) <= 1e+239)
		tmp = Float64(Float64(sqrt(t_0) * Float64(B_m * Float64(sqrt(2.0) * t_1))) / t_4);
	else
		tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(sqrt(Float64(B_m + C)) * 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[(C + N[(A + N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = (-N[Sqrt[F], $MachinePrecision])}, Block[{t$95$2 = N[(N[Power[B$95$m, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$2 * F), $MachinePrecision]), $MachinePrecision] * N[(N[(2.0 * C), $MachinePrecision] + N[(-0.5 * N[(B$95$m * N[(B$95$m * N[(1.0 / A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$2), $MachinePrecision]}, Block[{t$95$4 = N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e-124], t$95$3, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e+60], N[(N[(N[Sqrt[N[(F * N[(2.0 * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(A * N[(C * -4.0), $MachinePrecision] + N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$4), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 5e+92], t$95$3, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 1e+239], N[(N[(N[Sqrt[t$95$0], $MachinePrecision] * N[(B$95$m * N[(N[Sqrt[2.0], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$4), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * N[(N[Sqrt[N[(B$95$m + C), $MachinePrecision]], $MachinePrecision] * t$95$1), $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 := C + \left(A + \mathsf{hypot}\left(B_m, A - C\right)\right)\\
t_1 := -\sqrt{F}\\
t_2 := {B_m}^{2} - \left(4 \cdot A\right) \cdot C\\
t_3 := \frac{-\sqrt{\left(2 \cdot \left(t_2 \cdot F\right)\right) \cdot \left(2 \cdot C + -0.5 \cdot \left(B_m \cdot \left(B_m \cdot \frac{1}{A}\right)\right)\right)}}{t_2}\\
t_4 := \mathsf{fma}\left(B_m, B_m, A \cdot \left(C \cdot -4\right)\right)\\
\mathbf{if}\;{B_m}^{2} \leq 2 \cdot 10^{-124}:\\
\;\;\;\;t_3\\

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

\mathbf{elif}\;{B_m}^{2} \leq 5 \cdot 10^{+92}:\\
\;\;\;\;t_3\\

\mathbf{elif}\;{B_m}^{2} \leq 10^{+239}:\\
\;\;\;\;\frac{\sqrt{t_0} \cdot \left(B_m \cdot \left(\sqrt{2} \cdot t_1\right)\right)}{t_4}\\

\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B_m} \cdot \left(\sqrt{B_m + C} \cdot t_1\right)\\


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

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

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

\mathbf{elif}\;{B_m}^{2} \leq 5 \cdot 10^{+92}:\\
\;\;\;\;t_2\\

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


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

Alternative 10: 51.7% accurate, 1.4× speedup?

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

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


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

Alternative 11: 51.8% 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^{+94}:\\ \;\;\;\;\frac{-\sqrt{\left(F \cdot t_0\right) \cdot \left(2 \cdot \left(C + C\right)\right)}}{t_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{2}}{B_m} \cdot \left(\sqrt{B_m + C} \cdot \left(-\sqrt{F}\right)\right)\\ \end{array} \end{array} \]
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
 :precision binary64
 (let* ((t_0 (fma B_m B_m (* A (* C -4.0)))))
   (if (<= (pow B_m 2.0) 1e+94)
     (/ (- (sqrt (* (* F t_0) (* 2.0 (+ C C))))) t_0)
     (* (/ (sqrt 2.0) B_m) (* (sqrt (+ B_m C)) (- (sqrt 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) {
	double t_0 = fma(B_m, B_m, (A * (C * -4.0)));
	double tmp;
	if (pow(B_m, 2.0) <= 1e+94) {
		tmp = -sqrt(((F * t_0) * (2.0 * (C + C)))) / t_0;
	} else {
		tmp = (sqrt(2.0) / B_m) * (sqrt((B_m + C)) * -sqrt(F));
	}
	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+94)
		tmp = Float64(Float64(-sqrt(Float64(Float64(F * t_0) * Float64(2.0 * Float64(C + C))))) / t_0);
	else
		tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(sqrt(Float64(B_m + C)) * Float64(-sqrt(F))));
	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+94], N[((-N[Sqrt[N[(N[(F * t$95$0), $MachinePrecision] * N[(2.0 * N[(C + C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * N[(N[Sqrt[N[(B$95$m + C), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[F], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B_m, B_m, A \cdot \left(C \cdot -4\right)\right)\\
\mathbf{if}\;{B_m}^{2} \leq 10^{+94}:\\
\;\;\;\;\frac{-\sqrt{\left(F \cdot t_0\right) \cdot \left(2 \cdot \left(C + C\right)\right)}}{t_0}\\

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


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

Alternative 12: 47.9% accurate, 2.0× speedup?

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

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


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

Alternative 13: 37.2% accurate, 2.0× speedup?

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

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


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

Alternative 14: 35.2% accurate, 2.0× speedup?

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

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


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

Alternative 15: 35.3% accurate, 2.1× speedup?

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

Alternative 16: 35.3% accurate, 2.1× speedup?

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

Alternative 17: 34.6% accurate, 5.5× speedup?

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

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


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

Alternative 18: 27.1% accurate, 6.0× speedup?

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

Alternative 19: 5.2% accurate, 634.0× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ [A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\ \\ -1 \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 -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 -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 = -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 -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 -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 -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 = -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_] := -1.0
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
-1
\end{array}
Derivation
    &prev;&pcontext;&pcontext2;&ctx;
  1. Add Preprocessing

Reproduce

?
herbie shell --seed 2024006 
(FPCore (A B C F)
  :name "ABCF->ab-angle a"
  :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))))