ABCF->ab-angle a

Percentage Accurate: 19.0% → 49.0%
Time: 29.5s
Alternatives: 15
Speedup: 3.1×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 15 alternatives:

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

Initial Program: 19.0% accurate, 1.0× speedup?

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

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

Alternative 1: 49.0% accurate, 0.2× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ \begin{array}{l} t_0 := {\left(\left(A + C\right) + \mathsf{hypot}\left(A - C, B\_m\right)\right)}^{0.25}\\ 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 := 2 \cdot \left(t\_2 \cdot F\right)\\ t_4 := \frac{-\sqrt{t\_3 \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B\_m}^{2}}\right)}}{t\_2}\\ \mathbf{if}\;t\_4 \leq -5 \cdot 10^{-207}:\\ \;\;\;\;\frac{-{\left(t\_0 \cdot \left({\left(t\_1 \cdot 2\right)}^{0.25} \cdot {F}^{0.25}\right)\right)}^{2}}{t\_1}\\ \mathbf{elif}\;t\_4 \leq 10^{-35}:\\ \;\;\;\;\frac{-\sqrt{t\_3 \cdot \left(-0.5 \cdot \frac{{B\_m}^{2}}{C} + 2 \cdot A\right)}}{t\_2}\\ \mathbf{elif}\;t\_4 \leq \infty:\\ \;\;\;\;\frac{-{\left(t\_0 \cdot e^{0.25 \cdot \left(\log \left(-2 \cdot \left(-4 \cdot \left(A \cdot C\right) + {B\_m}^{2}\right)\right) + -1 \cdot \log \left(\frac{-1}{F}\right)\right)}\right)}^{2}}{t\_1}\\ \mathbf{else}:\\ \;\;\;\;-\sqrt{\frac{F}{B\_m}} \cdot \sqrt{2}\\ \end{array} \end{array} \]
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
 :precision binary64
 (let* ((t_0 (pow (+ (+ A C) (hypot (- A C) B_m)) 0.25))
        (t_1 (fma B_m B_m (* A (* C -4.0))))
        (t_2 (- (pow B_m 2.0) (* (* 4.0 A) C)))
        (t_3 (* 2.0 (* t_2 F)))
        (t_4
         (/
          (-
           (sqrt
            (* t_3 (+ (+ A C) (sqrt (+ (pow (- A C) 2.0) (pow B_m 2.0)))))))
          t_2)))
   (if (<= t_4 -5e-207)
     (/ (- (pow (* t_0 (* (pow (* t_1 2.0) 0.25) (pow F 0.25))) 2.0)) t_1)
     (if (<= t_4 1e-35)
       (/ (- (sqrt (* t_3 (+ (* -0.5 (/ (pow B_m 2.0) C)) (* 2.0 A))))) t_2)
       (if (<= t_4 INFINITY)
         (/
          (-
           (pow
            (*
             t_0
             (exp
              (*
               0.25
               (+
                (log (* -2.0 (+ (* -4.0 (* A C)) (pow B_m 2.0))))
                (* -1.0 (log (/ -1.0 F)))))))
            2.0))
          t_1)
         (- (* (sqrt (/ F B_m)) (sqrt 2.0))))))))
B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
	double t_0 = pow(((A + C) + hypot((A - C), B_m)), 0.25);
	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 = 2.0 * (t_2 * F);
	double t_4 = -sqrt((t_3 * ((A + C) + sqrt((pow((A - C), 2.0) + pow(B_m, 2.0)))))) / t_2;
	double tmp;
	if (t_4 <= -5e-207) {
		tmp = -pow((t_0 * (pow((t_1 * 2.0), 0.25) * pow(F, 0.25))), 2.0) / t_1;
	} else if (t_4 <= 1e-35) {
		tmp = -sqrt((t_3 * ((-0.5 * (pow(B_m, 2.0) / C)) + (2.0 * A)))) / t_2;
	} else if (t_4 <= ((double) INFINITY)) {
		tmp = -pow((t_0 * exp((0.25 * (log((-2.0 * ((-4.0 * (A * C)) + pow(B_m, 2.0)))) + (-1.0 * log((-1.0 / F))))))), 2.0) / t_1;
	} else {
		tmp = -(sqrt((F / B_m)) * sqrt(2.0));
	}
	return tmp;
}
B_m = abs(B)
function code(A, B_m, C, F)
	t_0 = Float64(Float64(A + C) + hypot(Float64(A - C), B_m)) ^ 0.25
	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(2.0 * Float64(t_2 * F))
	t_4 = Float64(Float64(-sqrt(Float64(t_3 * Float64(Float64(A + C) + sqrt(Float64((Float64(A - C) ^ 2.0) + (B_m ^ 2.0))))))) / t_2)
	tmp = 0.0
	if (t_4 <= -5e-207)
		tmp = Float64(Float64(-(Float64(t_0 * Float64((Float64(t_1 * 2.0) ^ 0.25) * (F ^ 0.25))) ^ 2.0)) / t_1);
	elseif (t_4 <= 1e-35)
		tmp = Float64(Float64(-sqrt(Float64(t_3 * Float64(Float64(-0.5 * Float64((B_m ^ 2.0) / C)) + Float64(2.0 * A))))) / t_2);
	elseif (t_4 <= Inf)
		tmp = Float64(Float64(-(Float64(t_0 * exp(Float64(0.25 * Float64(log(Float64(-2.0 * Float64(Float64(-4.0 * Float64(A * C)) + (B_m ^ 2.0)))) + Float64(-1.0 * log(Float64(-1.0 / F))))))) ^ 2.0)) / t_1);
	else
		tmp = Float64(-Float64(sqrt(Float64(F / B_m)) * sqrt(2.0)));
	end
	return tmp
end
B_m = N[Abs[B], $MachinePrecision]
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[Power[N[(N[(A + C), $MachinePrecision] + N[Sqrt[N[(A - C), $MachinePrecision] ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision], 0.25], $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[(2.0 * N[(t$95$2 * F), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[((-N[Sqrt[N[(t$95$3 * N[(N[(A + C), $MachinePrecision] + N[Sqrt[N[(N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$2), $MachinePrecision]}, If[LessEqual[t$95$4, -5e-207], N[((-N[Power[N[(t$95$0 * N[(N[Power[N[(t$95$1 * 2.0), $MachinePrecision], 0.25], $MachinePrecision] * N[Power[F, 0.25], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]) / t$95$1), $MachinePrecision], If[LessEqual[t$95$4, 1e-35], N[((-N[Sqrt[N[(t$95$3 * N[(N[(-0.5 * N[(N[Power[B$95$m, 2.0], $MachinePrecision] / C), $MachinePrecision]), $MachinePrecision] + N[(2.0 * A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$2), $MachinePrecision], If[LessEqual[t$95$4, Infinity], N[((-N[Power[N[(t$95$0 * N[Exp[N[(0.25 * N[(N[Log[N[(-2.0 * N[(N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision] + N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[(-1.0 * N[Log[N[(-1.0 / F), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]) / t$95$1), $MachinePrecision], (-N[(N[Sqrt[N[(F / B$95$m), $MachinePrecision]], $MachinePrecision] * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision])]]]]]]]]
\begin{array}{l}
B_m = \left|B\right|

\\
\begin{array}{l}
t_0 := {\left(\left(A + C\right) + \mathsf{hypot}\left(A - C, B\_m\right)\right)}^{0.25}\\
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 := 2 \cdot \left(t\_2 \cdot F\right)\\
t_4 := \frac{-\sqrt{t\_3 \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B\_m}^{2}}\right)}}{t\_2}\\
\mathbf{if}\;t\_4 \leq -5 \cdot 10^{-207}:\\
\;\;\;\;\frac{-{\left(t\_0 \cdot \left({\left(t\_1 \cdot 2\right)}^{0.25} \cdot {F}^{0.25}\right)\right)}^{2}}{t\_1}\\

\mathbf{elif}\;t\_4 \leq 10^{-35}:\\
\;\;\;\;\frac{-\sqrt{t\_3 \cdot \left(-0.5 \cdot \frac{{B\_m}^{2}}{C} + 2 \cdot A\right)}}{t\_2}\\

\mathbf{elif}\;t\_4 \leq \infty:\\
\;\;\;\;\frac{-{\left(t\_0 \cdot e^{0.25 \cdot \left(\log \left(-2 \cdot \left(-4 \cdot \left(A \cdot C\right) + {B\_m}^{2}\right)\right) + -1 \cdot \log \left(\frac{-1}{F}\right)\right)}\right)}^{2}}{t\_1}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 2 (*.f64 (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)) F)) (+.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))))) (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C))) < -5.00000000000000014e-207

    1. Initial program 49.1%

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

      \[\leadsto \color{blue}{\frac{-\sqrt{\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot 2\right)\right) \cdot \left(A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. add-sqr-sqrt58.4%

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

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

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

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

        \[\leadsto \frac{-{\left({\color{blue}{\left(\left(A + C\right) + \mathsf{hypot}\left(A - C, B\right)\right)}}^{0.25} \cdot {\left(\mathsf{fma}\left(B, B, \left(A \cdot C\right) \cdot -4\right) \cdot \left(2 \cdot F\right)\right)}^{0.25}\right)}^{2}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
      3. associate-*r*67.6%

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

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

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

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

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

    if -5.00000000000000014e-207 < (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 2 (*.f64 (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)) F)) (+.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))))) (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C))) < 1.00000000000000001e-35

    1. Initial program 8.9%

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

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

    if 1.00000000000000001e-35 < (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 2 (*.f64 (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)) F)) (+.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))))) (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C))) < +inf.0

    1. Initial program 42.9%

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

      \[\leadsto \color{blue}{\frac{-\sqrt{\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot 2\right)\right) \cdot \left(A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. add-sqr-sqrt58.7%

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

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

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

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

        \[\leadsto \frac{-{\left({\color{blue}{\left(\left(A + C\right) + \mathsf{hypot}\left(A - C, B\right)\right)}}^{0.25} \cdot {\left(\mathsf{fma}\left(B, B, \left(A \cdot C\right) \cdot -4\right) \cdot \left(2 \cdot F\right)\right)}^{0.25}\right)}^{2}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
      3. associate-*r*83.2%

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

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

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

    if +inf.0 < (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 2 (*.f64 (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)) F)) (+.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))))) (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)))

    1. Initial program 0.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 46.1% accurate, 0.3× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ \begin{array}{l} t_0 := {B\_m}^{2} - \left(4 \cdot A\right) \cdot C\\ t_1 := 2 \cdot \left(t\_0 \cdot F\right)\\ t_2 := \frac{-\sqrt{t\_1 \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B\_m}^{2}}\right)}}{t\_0}\\ t_3 := \frac{-\sqrt{A + \left(C + \mathsf{hypot}\left(A - C, B\_m\right)\right)} \cdot \sqrt{\left(2 \cdot \left({B\_m}^{2} - 4 \cdot \left(A \cdot C\right)\right)\right) \cdot F}}{t\_0}\\ \mathbf{if}\;t\_2 \leq -5 \cdot 10^{-207}:\\ \;\;\;\;t\_3\\ \mathbf{elif}\;t\_2 \leq 10^{-35}:\\ \;\;\;\;\frac{-\sqrt{t\_1 \cdot \left(-0.5 \cdot \frac{{B\_m}^{2}}{C} + 2 \cdot A\right)}}{t\_0}\\ \mathbf{elif}\;t\_2 \leq \infty:\\ \;\;\;\;t\_3\\ \mathbf{else}:\\ \;\;\;\;-\sqrt{\frac{F}{B\_m}} \cdot \sqrt{2}\\ \end{array} \end{array} \]
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
 :precision binary64
 (let* ((t_0 (- (pow B_m 2.0) (* (* 4.0 A) C)))
        (t_1 (* 2.0 (* t_0 F)))
        (t_2
         (/
          (-
           (sqrt
            (* t_1 (+ (+ A C) (sqrt (+ (pow (- A C) 2.0) (pow B_m 2.0)))))))
          t_0))
        (t_3
         (/
          (-
           (*
            (sqrt (+ A (+ C (hypot (- A C) B_m))))
            (sqrt (* (* 2.0 (- (pow B_m 2.0) (* 4.0 (* A C)))) F))))
          t_0)))
   (if (<= t_2 -5e-207)
     t_3
     (if (<= t_2 1e-35)
       (/ (- (sqrt (* t_1 (+ (* -0.5 (/ (pow B_m 2.0) C)) (* 2.0 A))))) t_0)
       (if (<= t_2 INFINITY) t_3 (- (* (sqrt (/ F B_m)) (sqrt 2.0))))))))
B_m = fabs(B);
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 = 2.0 * (t_0 * F);
	double t_2 = -sqrt((t_1 * ((A + C) + sqrt((pow((A - C), 2.0) + pow(B_m, 2.0)))))) / t_0;
	double t_3 = -(sqrt((A + (C + hypot((A - C), B_m)))) * sqrt(((2.0 * (pow(B_m, 2.0) - (4.0 * (A * C)))) * F))) / t_0;
	double tmp;
	if (t_2 <= -5e-207) {
		tmp = t_3;
	} else if (t_2 <= 1e-35) {
		tmp = -sqrt((t_1 * ((-0.5 * (pow(B_m, 2.0) / C)) + (2.0 * A)))) / t_0;
	} else if (t_2 <= ((double) INFINITY)) {
		tmp = t_3;
	} else {
		tmp = -(sqrt((F / B_m)) * sqrt(2.0));
	}
	return tmp;
}
B_m = Math.abs(B);
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 t_1 = 2.0 * (t_0 * F);
	double t_2 = -Math.sqrt((t_1 * ((A + C) + Math.sqrt((Math.pow((A - C), 2.0) + Math.pow(B_m, 2.0)))))) / t_0;
	double t_3 = -(Math.sqrt((A + (C + Math.hypot((A - C), B_m)))) * Math.sqrt(((2.0 * (Math.pow(B_m, 2.0) - (4.0 * (A * C)))) * F))) / t_0;
	double tmp;
	if (t_2 <= -5e-207) {
		tmp = t_3;
	} else if (t_2 <= 1e-35) {
		tmp = -Math.sqrt((t_1 * ((-0.5 * (Math.pow(B_m, 2.0) / C)) + (2.0 * A)))) / t_0;
	} else if (t_2 <= Double.POSITIVE_INFINITY) {
		tmp = t_3;
	} else {
		tmp = -(Math.sqrt((F / B_m)) * Math.sqrt(2.0));
	}
	return tmp;
}
B_m = math.fabs(B)
def code(A, B_m, C, F):
	t_0 = math.pow(B_m, 2.0) - ((4.0 * A) * C)
	t_1 = 2.0 * (t_0 * F)
	t_2 = -math.sqrt((t_1 * ((A + C) + math.sqrt((math.pow((A - C), 2.0) + math.pow(B_m, 2.0)))))) / t_0
	t_3 = -(math.sqrt((A + (C + math.hypot((A - C), B_m)))) * math.sqrt(((2.0 * (math.pow(B_m, 2.0) - (4.0 * (A * C)))) * F))) / t_0
	tmp = 0
	if t_2 <= -5e-207:
		tmp = t_3
	elif t_2 <= 1e-35:
		tmp = -math.sqrt((t_1 * ((-0.5 * (math.pow(B_m, 2.0) / C)) + (2.0 * A)))) / t_0
	elif t_2 <= math.inf:
		tmp = t_3
	else:
		tmp = -(math.sqrt((F / B_m)) * math.sqrt(2.0))
	return tmp
B_m = abs(B)
function code(A, B_m, C, F)
	t_0 = Float64((B_m ^ 2.0) - Float64(Float64(4.0 * A) * C))
	t_1 = Float64(2.0 * Float64(t_0 * F))
	t_2 = Float64(Float64(-sqrt(Float64(t_1 * Float64(Float64(A + C) + sqrt(Float64((Float64(A - C) ^ 2.0) + (B_m ^ 2.0))))))) / t_0)
	t_3 = Float64(Float64(-Float64(sqrt(Float64(A + Float64(C + hypot(Float64(A - C), B_m)))) * sqrt(Float64(Float64(2.0 * Float64((B_m ^ 2.0) - Float64(4.0 * Float64(A * C)))) * F)))) / t_0)
	tmp = 0.0
	if (t_2 <= -5e-207)
		tmp = t_3;
	elseif (t_2 <= 1e-35)
		tmp = Float64(Float64(-sqrt(Float64(t_1 * Float64(Float64(-0.5 * Float64((B_m ^ 2.0) / C)) + Float64(2.0 * A))))) / t_0);
	elseif (t_2 <= Inf)
		tmp = t_3;
	else
		tmp = Float64(-Float64(sqrt(Float64(F / B_m)) * sqrt(2.0)));
	end
	return tmp
end
B_m = abs(B);
function tmp_2 = code(A, B_m, C, F)
	t_0 = (B_m ^ 2.0) - ((4.0 * A) * C);
	t_1 = 2.0 * (t_0 * F);
	t_2 = -sqrt((t_1 * ((A + C) + sqrt((((A - C) ^ 2.0) + (B_m ^ 2.0)))))) / t_0;
	t_3 = -(sqrt((A + (C + hypot((A - C), B_m)))) * sqrt(((2.0 * ((B_m ^ 2.0) - (4.0 * (A * C)))) * F))) / t_0;
	tmp = 0.0;
	if (t_2 <= -5e-207)
		tmp = t_3;
	elseif (t_2 <= 1e-35)
		tmp = -sqrt((t_1 * ((-0.5 * ((B_m ^ 2.0) / C)) + (2.0 * A)))) / t_0;
	elseif (t_2 <= Inf)
		tmp = t_3;
	else
		tmp = -(sqrt((F / B_m)) * sqrt(2.0));
	end
	tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision]
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[(2.0 * N[(t$95$0 * F), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[((-N[Sqrt[N[(t$95$1 * N[(N[(A + C), $MachinePrecision] + N[Sqrt[N[(N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision]}, Block[{t$95$3 = N[((-N[(N[Sqrt[N[(A + N[(C + N[Sqrt[N[(A - C), $MachinePrecision] ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(N[(2.0 * N[(N[Power[B$95$m, 2.0], $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * F), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]) / t$95$0), $MachinePrecision]}, If[LessEqual[t$95$2, -5e-207], t$95$3, If[LessEqual[t$95$2, 1e-35], N[((-N[Sqrt[N[(t$95$1 * N[(N[(-0.5 * N[(N[Power[B$95$m, 2.0], $MachinePrecision] / C), $MachinePrecision]), $MachinePrecision] + N[(2.0 * A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[t$95$2, Infinity], t$95$3, (-N[(N[Sqrt[N[(F / B$95$m), $MachinePrecision]], $MachinePrecision] * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision])]]]]]]]
\begin{array}{l}
B_m = \left|B\right|

\\
\begin{array}{l}
t_0 := {B\_m}^{2} - \left(4 \cdot A\right) \cdot C\\
t_1 := 2 \cdot \left(t\_0 \cdot F\right)\\
t_2 := \frac{-\sqrt{t\_1 \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B\_m}^{2}}\right)}}{t\_0}\\
t_3 := \frac{-\sqrt{A + \left(C + \mathsf{hypot}\left(A - C, B\_m\right)\right)} \cdot \sqrt{\left(2 \cdot \left({B\_m}^{2} - 4 \cdot \left(A \cdot C\right)\right)\right) \cdot F}}{t\_0}\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{-207}:\\
\;\;\;\;t\_3\\

\mathbf{elif}\;t\_2 \leq 10^{-35}:\\
\;\;\;\;\frac{-\sqrt{t\_1 \cdot \left(-0.5 \cdot \frac{{B\_m}^{2}}{C} + 2 \cdot A\right)}}{t\_0}\\

\mathbf{elif}\;t\_2 \leq \infty:\\
\;\;\;\;t\_3\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 2 (*.f64 (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)) F)) (+.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))))) (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C))) < -5.00000000000000014e-207 or 1.00000000000000001e-35 < (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 2 (*.f64 (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)) F)) (+.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))))) (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C))) < +inf.0

    1. Initial program 47.8%

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutative47.8%

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

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

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

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

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

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

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

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

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

    if -5.00000000000000014e-207 < (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 2 (*.f64 (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)) F)) (+.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))))) (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C))) < 1.00000000000000001e-35

    1. Initial program 8.9%

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

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

    if +inf.0 < (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 2 (*.f64 (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)) F)) (+.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))))) (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)))

    1. Initial program 0.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 48.9% accurate, 0.3× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ \begin{array}{l} t_0 := \mathsf{hypot}\left(A - C, B\_m\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 := 2 \cdot \left(t\_2 \cdot F\right)\\ t_4 := \frac{-\sqrt{t\_3 \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B\_m}^{2}}\right)}}{t\_2}\\ \mathbf{if}\;t\_4 \leq -5 \cdot 10^{-207}:\\ \;\;\;\;\frac{-{\left({\left(\left(A + C\right) + t\_0\right)}^{0.25} \cdot \left({\left(t\_1 \cdot 2\right)}^{0.25} \cdot {F}^{0.25}\right)\right)}^{2}}{t\_1}\\ \mathbf{elif}\;t\_4 \leq 10^{-35}:\\ \;\;\;\;\frac{-\sqrt{t\_3 \cdot \left(-0.5 \cdot \frac{{B\_m}^{2}}{C} + 2 \cdot A\right)}}{t\_2}\\ \mathbf{elif}\;t\_4 \leq \infty:\\ \;\;\;\;\frac{-\sqrt{A + \left(C + t\_0\right)} \cdot \sqrt{\left(2 \cdot \left({B\_m}^{2} - 4 \cdot \left(A \cdot C\right)\right)\right) \cdot F}}{t\_2}\\ \mathbf{else}:\\ \;\;\;\;-\sqrt{\frac{F}{B\_m}} \cdot \sqrt{2}\\ \end{array} \end{array} \]
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
 :precision binary64
 (let* ((t_0 (hypot (- A C) B_m))
        (t_1 (fma B_m B_m (* A (* C -4.0))))
        (t_2 (- (pow B_m 2.0) (* (* 4.0 A) C)))
        (t_3 (* 2.0 (* t_2 F)))
        (t_4
         (/
          (-
           (sqrt
            (* t_3 (+ (+ A C) (sqrt (+ (pow (- A C) 2.0) (pow B_m 2.0)))))))
          t_2)))
   (if (<= t_4 -5e-207)
     (/
      (-
       (pow
        (* (pow (+ (+ A C) t_0) 0.25) (* (pow (* t_1 2.0) 0.25) (pow F 0.25)))
        2.0))
      t_1)
     (if (<= t_4 1e-35)
       (/ (- (sqrt (* t_3 (+ (* -0.5 (/ (pow B_m 2.0) C)) (* 2.0 A))))) t_2)
       (if (<= t_4 INFINITY)
         (/
          (-
           (*
            (sqrt (+ A (+ C t_0)))
            (sqrt (* (* 2.0 (- (pow B_m 2.0) (* 4.0 (* A C)))) F))))
          t_2)
         (- (* (sqrt (/ F B_m)) (sqrt 2.0))))))))
B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
	double t_0 = hypot((A - C), B_m);
	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 = 2.0 * (t_2 * F);
	double t_4 = -sqrt((t_3 * ((A + C) + sqrt((pow((A - C), 2.0) + pow(B_m, 2.0)))))) / t_2;
	double tmp;
	if (t_4 <= -5e-207) {
		tmp = -pow((pow(((A + C) + t_0), 0.25) * (pow((t_1 * 2.0), 0.25) * pow(F, 0.25))), 2.0) / t_1;
	} else if (t_4 <= 1e-35) {
		tmp = -sqrt((t_3 * ((-0.5 * (pow(B_m, 2.0) / C)) + (2.0 * A)))) / t_2;
	} else if (t_4 <= ((double) INFINITY)) {
		tmp = -(sqrt((A + (C + t_0))) * sqrt(((2.0 * (pow(B_m, 2.0) - (4.0 * (A * C)))) * F))) / t_2;
	} else {
		tmp = -(sqrt((F / B_m)) * sqrt(2.0));
	}
	return tmp;
}
B_m = abs(B)
function code(A, B_m, C, F)
	t_0 = hypot(Float64(A - C), B_m)
	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(2.0 * Float64(t_2 * F))
	t_4 = Float64(Float64(-sqrt(Float64(t_3 * Float64(Float64(A + C) + sqrt(Float64((Float64(A - C) ^ 2.0) + (B_m ^ 2.0))))))) / t_2)
	tmp = 0.0
	if (t_4 <= -5e-207)
		tmp = Float64(Float64(-(Float64((Float64(Float64(A + C) + t_0) ^ 0.25) * Float64((Float64(t_1 * 2.0) ^ 0.25) * (F ^ 0.25))) ^ 2.0)) / t_1);
	elseif (t_4 <= 1e-35)
		tmp = Float64(Float64(-sqrt(Float64(t_3 * Float64(Float64(-0.5 * Float64((B_m ^ 2.0) / C)) + Float64(2.0 * A))))) / t_2);
	elseif (t_4 <= Inf)
		tmp = Float64(Float64(-Float64(sqrt(Float64(A + Float64(C + t_0))) * sqrt(Float64(Float64(2.0 * Float64((B_m ^ 2.0) - Float64(4.0 * Float64(A * C)))) * F)))) / t_2);
	else
		tmp = Float64(-Float64(sqrt(Float64(F / B_m)) * sqrt(2.0)));
	end
	return tmp
end
B_m = N[Abs[B], $MachinePrecision]
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[Sqrt[N[(A - C), $MachinePrecision] ^ 2 + B$95$m ^ 2], $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[(2.0 * N[(t$95$2 * F), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[((-N[Sqrt[N[(t$95$3 * N[(N[(A + C), $MachinePrecision] + N[Sqrt[N[(N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$2), $MachinePrecision]}, If[LessEqual[t$95$4, -5e-207], N[((-N[Power[N[(N[Power[N[(N[(A + C), $MachinePrecision] + t$95$0), $MachinePrecision], 0.25], $MachinePrecision] * N[(N[Power[N[(t$95$1 * 2.0), $MachinePrecision], 0.25], $MachinePrecision] * N[Power[F, 0.25], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]) / t$95$1), $MachinePrecision], If[LessEqual[t$95$4, 1e-35], N[((-N[Sqrt[N[(t$95$3 * N[(N[(-0.5 * N[(N[Power[B$95$m, 2.0], $MachinePrecision] / C), $MachinePrecision]), $MachinePrecision] + N[(2.0 * A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$2), $MachinePrecision], If[LessEqual[t$95$4, Infinity], N[((-N[(N[Sqrt[N[(A + N[(C + t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(N[(2.0 * N[(N[Power[B$95$m, 2.0], $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * F), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]) / t$95$2), $MachinePrecision], (-N[(N[Sqrt[N[(F / B$95$m), $MachinePrecision]], $MachinePrecision] * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision])]]]]]]]]
\begin{array}{l}
B_m = \left|B\right|

\\
\begin{array}{l}
t_0 := \mathsf{hypot}\left(A - C, B\_m\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 := 2 \cdot \left(t\_2 \cdot F\right)\\
t_4 := \frac{-\sqrt{t\_3 \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B\_m}^{2}}\right)}}{t\_2}\\
\mathbf{if}\;t\_4 \leq -5 \cdot 10^{-207}:\\
\;\;\;\;\frac{-{\left({\left(\left(A + C\right) + t\_0\right)}^{0.25} \cdot \left({\left(t\_1 \cdot 2\right)}^{0.25} \cdot {F}^{0.25}\right)\right)}^{2}}{t\_1}\\

\mathbf{elif}\;t\_4 \leq 10^{-35}:\\
\;\;\;\;\frac{-\sqrt{t\_3 \cdot \left(-0.5 \cdot \frac{{B\_m}^{2}}{C} + 2 \cdot A\right)}}{t\_2}\\

\mathbf{elif}\;t\_4 \leq \infty:\\
\;\;\;\;\frac{-\sqrt{A + \left(C + t\_0\right)} \cdot \sqrt{\left(2 \cdot \left({B\_m}^{2} - 4 \cdot \left(A \cdot C\right)\right)\right) \cdot F}}{t\_2}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 2 (*.f64 (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)) F)) (+.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))))) (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C))) < -5.00000000000000014e-207

    1. Initial program 49.1%

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

      \[\leadsto \color{blue}{\frac{-\sqrt{\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot 2\right)\right) \cdot \left(A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. add-sqr-sqrt58.4%

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

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

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

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

        \[\leadsto \frac{-{\left({\color{blue}{\left(\left(A + C\right) + \mathsf{hypot}\left(A - C, B\right)\right)}}^{0.25} \cdot {\left(\mathsf{fma}\left(B, B, \left(A \cdot C\right) \cdot -4\right) \cdot \left(2 \cdot F\right)\right)}^{0.25}\right)}^{2}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
      3. associate-*r*67.6%

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

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

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

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

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

    if -5.00000000000000014e-207 < (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 2 (*.f64 (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)) F)) (+.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))))) (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C))) < 1.00000000000000001e-35

    1. Initial program 8.9%

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

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

    if 1.00000000000000001e-35 < (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 2 (*.f64 (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)) F)) (+.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))))) (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C))) < +inf.0

    1. Initial program 42.9%

      \[\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutative42.9%

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

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

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

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

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

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

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

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

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

    if +inf.0 < (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 2 (*.f64 (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)) F)) (+.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))))) (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)))

    1. Initial program 0.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 36.4% accurate, 1.2× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ \begin{array}{l} t_0 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\ t_1 := t\_0 \cdot \left(F \cdot 2\right)\\ \mathbf{if}\;B\_m \leq 5.1 \cdot 10^{-280}:\\ \;\;\;\;\frac{-{\left({\left(2 \cdot A\right)}^{0.25} \cdot {\left(t\_0 \cdot \left(2 \cdot F\right)\right)}^{0.25}\right)}^{2}}{t\_0}\\ \mathbf{elif}\;B\_m \leq 6.8 \cdot 10^{-199}:\\ \;\;\;\;\frac{-\sqrt{t\_1 \cdot \left(2 \cdot C\right)}}{t\_0}\\ \mathbf{elif}\;B\_m \leq 7.4 \cdot 10^{+28}:\\ \;\;\;\;\frac{-\sqrt{t\_1 \cdot \left(A + \left(C + \mathsf{hypot}\left(B\_m, A - C\right)\right)\right)}}{t\_0}\\ \mathbf{elif}\;B\_m \leq 3 \cdot 10^{+272}:\\ \;\;\;\;-1 \cdot \left(\frac{\sqrt{2}}{B\_m} \cdot \sqrt{F \cdot \left(B\_m + \left(C + 0.5 \cdot \frac{{C}^{2}}{B\_m}\right)\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;-\sqrt{\frac{F}{B\_m}} \cdot \sqrt{2}\\ \end{array} \end{array} \]
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
 :precision binary64
 (let* ((t_0 (fma B_m B_m (* A (* C -4.0)))) (t_1 (* t_0 (* F 2.0))))
   (if (<= B_m 5.1e-280)
     (/
      (- (pow (* (pow (* 2.0 A) 0.25) (pow (* t_0 (* 2.0 F)) 0.25)) 2.0))
      t_0)
     (if (<= B_m 6.8e-199)
       (/ (- (sqrt (* t_1 (* 2.0 C)))) t_0)
       (if (<= B_m 7.4e+28)
         (/ (- (sqrt (* t_1 (+ A (+ C (hypot B_m (- A C))))))) t_0)
         (if (<= B_m 3e+272)
           (*
            -1.0
            (*
             (/ (sqrt 2.0) B_m)
             (sqrt (* F (+ B_m (+ C (* 0.5 (/ (pow C 2.0) B_m))))))))
           (- (* (sqrt (/ F B_m)) (sqrt 2.0)))))))))
B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
	double t_0 = fma(B_m, B_m, (A * (C * -4.0)));
	double t_1 = t_0 * (F * 2.0);
	double tmp;
	if (B_m <= 5.1e-280) {
		tmp = -pow((pow((2.0 * A), 0.25) * pow((t_0 * (2.0 * F)), 0.25)), 2.0) / t_0;
	} else if (B_m <= 6.8e-199) {
		tmp = -sqrt((t_1 * (2.0 * C))) / t_0;
	} else if (B_m <= 7.4e+28) {
		tmp = -sqrt((t_1 * (A + (C + hypot(B_m, (A - C)))))) / t_0;
	} else if (B_m <= 3e+272) {
		tmp = -1.0 * ((sqrt(2.0) / B_m) * sqrt((F * (B_m + (C + (0.5 * (pow(C, 2.0) / B_m)))))));
	} else {
		tmp = -(sqrt((F / B_m)) * sqrt(2.0));
	}
	return tmp;
}
B_m = abs(B)
function code(A, B_m, C, F)
	t_0 = fma(B_m, B_m, Float64(A * Float64(C * -4.0)))
	t_1 = Float64(t_0 * Float64(F * 2.0))
	tmp = 0.0
	if (B_m <= 5.1e-280)
		tmp = Float64(Float64(-(Float64((Float64(2.0 * A) ^ 0.25) * (Float64(t_0 * Float64(2.0 * F)) ^ 0.25)) ^ 2.0)) / t_0);
	elseif (B_m <= 6.8e-199)
		tmp = Float64(Float64(-sqrt(Float64(t_1 * Float64(2.0 * C)))) / t_0);
	elseif (B_m <= 7.4e+28)
		tmp = Float64(Float64(-sqrt(Float64(t_1 * Float64(A + Float64(C + hypot(B_m, Float64(A - C))))))) / t_0);
	elseif (B_m <= 3e+272)
		tmp = Float64(-1.0 * Float64(Float64(sqrt(2.0) / B_m) * sqrt(Float64(F * Float64(B_m + Float64(C + Float64(0.5 * Float64((C ^ 2.0) / B_m))))))));
	else
		tmp = Float64(-Float64(sqrt(Float64(F / B_m)) * sqrt(2.0)));
	end
	return tmp
end
B_m = N[Abs[B], $MachinePrecision]
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 * N[(F * 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B$95$m, 5.1e-280], N[((-N[Power[N[(N[Power[N[(2.0 * A), $MachinePrecision], 0.25], $MachinePrecision] * N[Power[N[(t$95$0 * N[(2.0 * F), $MachinePrecision]), $MachinePrecision], 0.25], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[B$95$m, 6.8e-199], N[((-N[Sqrt[N[(t$95$1 * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[B$95$m, 7.4e+28], N[((-N[Sqrt[N[(t$95$1 * N[(A + N[(C + N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[B$95$m, 3e+272], N[(-1.0 * N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * N[Sqrt[N[(F * N[(B$95$m + N[(C + N[(0.5 * N[(N[Power[C, 2.0], $MachinePrecision] / B$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], (-N[(N[Sqrt[N[(F / B$95$m), $MachinePrecision]], $MachinePrecision] * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision])]]]]]]
\begin{array}{l}
B_m = \left|B\right|

\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\
t_1 := t\_0 \cdot \left(F \cdot 2\right)\\
\mathbf{if}\;B\_m \leq 5.1 \cdot 10^{-280}:\\
\;\;\;\;\frac{-{\left({\left(2 \cdot A\right)}^{0.25} \cdot {\left(t\_0 \cdot \left(2 \cdot F\right)\right)}^{0.25}\right)}^{2}}{t\_0}\\

\mathbf{elif}\;B\_m \leq 6.8 \cdot 10^{-199}:\\
\;\;\;\;\frac{-\sqrt{t\_1 \cdot \left(2 \cdot C\right)}}{t\_0}\\

\mathbf{elif}\;B\_m \leq 7.4 \cdot 10^{+28}:\\
\;\;\;\;\frac{-\sqrt{t\_1 \cdot \left(A + \left(C + \mathsf{hypot}\left(B\_m, A - C\right)\right)\right)}}{t\_0}\\

\mathbf{elif}\;B\_m \leq 3 \cdot 10^{+272}:\\
\;\;\;\;-1 \cdot \left(\frac{\sqrt{2}}{B\_m} \cdot \sqrt{F \cdot \left(B\_m + \left(C + 0.5 \cdot \frac{{C}^{2}}{B\_m}\right)\right)}\right)\\

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


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

    1. Initial program 21.9%

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

      \[\leadsto \color{blue}{\frac{-\sqrt{\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot 2\right)\right) \cdot \left(A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. add-sqr-sqrt27.7%

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

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

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

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

        \[\leadsto \frac{-{\left({\color{blue}{\left(\left(A + C\right) + \mathsf{hypot}\left(A - C, B\right)\right)}}^{0.25} \cdot {\left(\mathsf{fma}\left(B, B, \left(A \cdot C\right) \cdot -4\right) \cdot \left(2 \cdot F\right)\right)}^{0.25}\right)}^{2}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \]
      3. associate-*r*33.8%

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

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

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

    if 5.0999999999999996e-280 < B < 6.80000000000000011e-199

    1. Initial program 23.1%

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

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

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

    if 6.80000000000000011e-199 < B < 7.3999999999999998e28

    1. Initial program 33.7%

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

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

    if 7.3999999999999998e28 < B < 3.0000000000000002e272

    1. Initial program 17.9%

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

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

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

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

    if 3.0000000000000002e272 < B

    1. Initial program 0.0%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto -\color{blue}{\sqrt{\frac{F}{B}} \cdot \sqrt{2}} \]
  3. Recombined 5 regimes into one program.
  4. Add Preprocessing

Alternative 5: 36.7% accurate, 1.4× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ \begin{array}{l} t_0 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\ t_1 := t\_0 \cdot \left(F \cdot 2\right)\\ t_2 := \frac{-\sqrt{t\_1 \cdot \left(A + \left(C + \mathsf{hypot}\left(B\_m, A - C\right)\right)\right)}}{t\_0}\\ \mathbf{if}\;B\_m \leq 4.5 \cdot 10^{-264}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;B\_m \leq 5.8 \cdot 10^{-198}:\\ \;\;\;\;\frac{-\sqrt{t\_1 \cdot \left(2 \cdot C\right)}}{t\_0}\\ \mathbf{elif}\;B\_m \leq 7.3 \cdot 10^{+28}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;B\_m \leq 2.5 \cdot 10^{+271}:\\ \;\;\;\;-1 \cdot \left(\frac{\sqrt{2}}{B\_m} \cdot \sqrt{F \cdot \left(B\_m + \left(C + 0.5 \cdot \frac{{C}^{2}}{B\_m}\right)\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;-\sqrt{\frac{F}{B\_m}} \cdot \sqrt{2}\\ \end{array} \end{array} \]
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
 :precision binary64
 (let* ((t_0 (fma B_m B_m (* A (* C -4.0))))
        (t_1 (* t_0 (* F 2.0)))
        (t_2 (/ (- (sqrt (* t_1 (+ A (+ C (hypot B_m (- A C))))))) t_0)))
   (if (<= B_m 4.5e-264)
     t_2
     (if (<= B_m 5.8e-198)
       (/ (- (sqrt (* t_1 (* 2.0 C)))) t_0)
       (if (<= B_m 7.3e+28)
         t_2
         (if (<= B_m 2.5e+271)
           (*
            -1.0
            (*
             (/ (sqrt 2.0) B_m)
             (sqrt (* F (+ B_m (+ C (* 0.5 (/ (pow C 2.0) B_m))))))))
           (- (* (sqrt (/ F B_m)) (sqrt 2.0)))))))))
B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
	double t_0 = fma(B_m, B_m, (A * (C * -4.0)));
	double t_1 = t_0 * (F * 2.0);
	double t_2 = -sqrt((t_1 * (A + (C + hypot(B_m, (A - C)))))) / t_0;
	double tmp;
	if (B_m <= 4.5e-264) {
		tmp = t_2;
	} else if (B_m <= 5.8e-198) {
		tmp = -sqrt((t_1 * (2.0 * C))) / t_0;
	} else if (B_m <= 7.3e+28) {
		tmp = t_2;
	} else if (B_m <= 2.5e+271) {
		tmp = -1.0 * ((sqrt(2.0) / B_m) * sqrt((F * (B_m + (C + (0.5 * (pow(C, 2.0) / B_m)))))));
	} else {
		tmp = -(sqrt((F / B_m)) * sqrt(2.0));
	}
	return tmp;
}
B_m = abs(B)
function code(A, B_m, C, F)
	t_0 = fma(B_m, B_m, Float64(A * Float64(C * -4.0)))
	t_1 = Float64(t_0 * Float64(F * 2.0))
	t_2 = Float64(Float64(-sqrt(Float64(t_1 * Float64(A + Float64(C + hypot(B_m, Float64(A - C))))))) / t_0)
	tmp = 0.0
	if (B_m <= 4.5e-264)
		tmp = t_2;
	elseif (B_m <= 5.8e-198)
		tmp = Float64(Float64(-sqrt(Float64(t_1 * Float64(2.0 * C)))) / t_0);
	elseif (B_m <= 7.3e+28)
		tmp = t_2;
	elseif (B_m <= 2.5e+271)
		tmp = Float64(-1.0 * Float64(Float64(sqrt(2.0) / B_m) * sqrt(Float64(F * Float64(B_m + Float64(C + Float64(0.5 * Float64((C ^ 2.0) / B_m))))))));
	else
		tmp = Float64(-Float64(sqrt(Float64(F / B_m)) * sqrt(2.0)));
	end
	return tmp
end
B_m = N[Abs[B], $MachinePrecision]
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 * N[(F * 2.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[((-N[Sqrt[N[(t$95$1 * N[(A + N[(C + N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision]}, If[LessEqual[B$95$m, 4.5e-264], t$95$2, If[LessEqual[B$95$m, 5.8e-198], N[((-N[Sqrt[N[(t$95$1 * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[B$95$m, 7.3e+28], t$95$2, If[LessEqual[B$95$m, 2.5e+271], N[(-1.0 * N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * N[Sqrt[N[(F * N[(B$95$m + N[(C + N[(0.5 * N[(N[Power[C, 2.0], $MachinePrecision] / B$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], (-N[(N[Sqrt[N[(F / B$95$m), $MachinePrecision]], $MachinePrecision] * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision])]]]]]]]
\begin{array}{l}
B_m = \left|B\right|

\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\
t_1 := t\_0 \cdot \left(F \cdot 2\right)\\
t_2 := \frac{-\sqrt{t\_1 \cdot \left(A + \left(C + \mathsf{hypot}\left(B\_m, A - C\right)\right)\right)}}{t\_0}\\
\mathbf{if}\;B\_m \leq 4.5 \cdot 10^{-264}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;B\_m \leq 5.8 \cdot 10^{-198}:\\
\;\;\;\;\frac{-\sqrt{t\_1 \cdot \left(2 \cdot C\right)}}{t\_0}\\

\mathbf{elif}\;B\_m \leq 7.3 \cdot 10^{+28}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;B\_m \leq 2.5 \cdot 10^{+271}:\\
\;\;\;\;-1 \cdot \left(\frac{\sqrt{2}}{B\_m} \cdot \sqrt{F \cdot \left(B\_m + \left(C + 0.5 \cdot \frac{{C}^{2}}{B\_m}\right)\right)}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if B < 4.5000000000000001e-264 or 5.80000000000000001e-198 < B < 7.2999999999999998e28

    1. Initial program 25.7%

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

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

    if 4.5000000000000001e-264 < B < 5.80000000000000001e-198

    1. Initial program 22.4%

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

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

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

    if 7.2999999999999998e28 < B < 2.5000000000000002e271

    1. Initial program 17.9%

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

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

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

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

    if 2.5000000000000002e271 < B

    1. Initial program 0.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 34.3% accurate, 1.4× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ \begin{array}{l} t_0 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\ t_1 := t\_0 \cdot \left(F \cdot 2\right)\\ \mathbf{if}\;B\_m \leq 2.32 \cdot 10^{-212}:\\ \;\;\;\;\frac{-\sqrt{t\_1 \cdot \left(A + A\right)}}{t\_0}\\ \mathbf{elif}\;B\_m \leq 2.9 \cdot 10^{-198}:\\ \;\;\;\;\frac{-\sqrt{t\_1 \cdot \left(2 \cdot C\right)}}{t\_0}\\ \mathbf{elif}\;B\_m \leq 7.7 \cdot 10^{-112}:\\ \;\;\;\;\frac{-{\left({\left(\left(A + A\right) \cdot \left(\mathsf{fma}\left(B\_m, B\_m, \left(A \cdot C\right) \cdot -4\right) \cdot \left(2 \cdot F\right)\right)\right)}^{0.25}\right)}^{2}}{t\_0}\\ \mathbf{elif}\;B\_m \leq 3.6 \cdot 10^{+132}:\\ \;\;\;\;-\frac{B\_m \cdot \left(\sqrt{2 \cdot F} \cdot \sqrt{A + \mathsf{hypot}\left(A, B\_m\right)}\right)}{t\_0}\\ \mathbf{elif}\;B\_m \leq 7.2 \cdot 10^{+270}:\\ \;\;\;\;-1 \cdot \left(\frac{\sqrt{2}}{B\_m} \cdot \sqrt{F \cdot \left(B\_m + \left(C + 0.5 \cdot \frac{{C}^{2}}{B\_m}\right)\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;-\sqrt{\frac{F}{B\_m}} \cdot \sqrt{2}\\ \end{array} \end{array} \]
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
 :precision binary64
 (let* ((t_0 (fma B_m B_m (* A (* C -4.0)))) (t_1 (* t_0 (* F 2.0))))
   (if (<= B_m 2.32e-212)
     (/ (- (sqrt (* t_1 (+ A A)))) t_0)
     (if (<= B_m 2.9e-198)
       (/ (- (sqrt (* t_1 (* 2.0 C)))) t_0)
       (if (<= B_m 7.7e-112)
         (/
          (-
           (pow
            (pow (* (+ A A) (* (fma B_m B_m (* (* A C) -4.0)) (* 2.0 F))) 0.25)
            2.0))
          t_0)
         (if (<= B_m 3.6e+132)
           (- (/ (* B_m (* (sqrt (* 2.0 F)) (sqrt (+ A (hypot A B_m))))) t_0))
           (if (<= B_m 7.2e+270)
             (*
              -1.0
              (*
               (/ (sqrt 2.0) B_m)
               (sqrt (* F (+ B_m (+ C (* 0.5 (/ (pow C 2.0) B_m))))))))
             (- (* (sqrt (/ F B_m)) (sqrt 2.0))))))))))
B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
	double t_0 = fma(B_m, B_m, (A * (C * -4.0)));
	double t_1 = t_0 * (F * 2.0);
	double tmp;
	if (B_m <= 2.32e-212) {
		tmp = -sqrt((t_1 * (A + A))) / t_0;
	} else if (B_m <= 2.9e-198) {
		tmp = -sqrt((t_1 * (2.0 * C))) / t_0;
	} else if (B_m <= 7.7e-112) {
		tmp = -pow(pow(((A + A) * (fma(B_m, B_m, ((A * C) * -4.0)) * (2.0 * F))), 0.25), 2.0) / t_0;
	} else if (B_m <= 3.6e+132) {
		tmp = -((B_m * (sqrt((2.0 * F)) * sqrt((A + hypot(A, B_m))))) / t_0);
	} else if (B_m <= 7.2e+270) {
		tmp = -1.0 * ((sqrt(2.0) / B_m) * sqrt((F * (B_m + (C + (0.5 * (pow(C, 2.0) / B_m)))))));
	} else {
		tmp = -(sqrt((F / B_m)) * sqrt(2.0));
	}
	return tmp;
}
B_m = abs(B)
function code(A, B_m, C, F)
	t_0 = fma(B_m, B_m, Float64(A * Float64(C * -4.0)))
	t_1 = Float64(t_0 * Float64(F * 2.0))
	tmp = 0.0
	if (B_m <= 2.32e-212)
		tmp = Float64(Float64(-sqrt(Float64(t_1 * Float64(A + A)))) / t_0);
	elseif (B_m <= 2.9e-198)
		tmp = Float64(Float64(-sqrt(Float64(t_1 * Float64(2.0 * C)))) / t_0);
	elseif (B_m <= 7.7e-112)
		tmp = Float64(Float64(-((Float64(Float64(A + A) * Float64(fma(B_m, B_m, Float64(Float64(A * C) * -4.0)) * Float64(2.0 * F))) ^ 0.25) ^ 2.0)) / t_0);
	elseif (B_m <= 3.6e+132)
		tmp = Float64(-Float64(Float64(B_m * Float64(sqrt(Float64(2.0 * F)) * sqrt(Float64(A + hypot(A, B_m))))) / t_0));
	elseif (B_m <= 7.2e+270)
		tmp = Float64(-1.0 * Float64(Float64(sqrt(2.0) / B_m) * sqrt(Float64(F * Float64(B_m + Float64(C + Float64(0.5 * Float64((C ^ 2.0) / B_m))))))));
	else
		tmp = Float64(-Float64(sqrt(Float64(F / B_m)) * sqrt(2.0)));
	end
	return tmp
end
B_m = N[Abs[B], $MachinePrecision]
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 * N[(F * 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B$95$m, 2.32e-212], N[((-N[Sqrt[N[(t$95$1 * N[(A + A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[B$95$m, 2.9e-198], N[((-N[Sqrt[N[(t$95$1 * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[B$95$m, 7.7e-112], N[((-N[Power[N[Power[N[(N[(A + A), $MachinePrecision] * N[(N[(B$95$m * B$95$m + N[(N[(A * C), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision] * N[(2.0 * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.25], $MachinePrecision], 2.0], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[B$95$m, 3.6e+132], (-N[(N[(B$95$m * N[(N[Sqrt[N[(2.0 * F), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(A + N[Sqrt[A ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]), If[LessEqual[B$95$m, 7.2e+270], N[(-1.0 * N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * N[Sqrt[N[(F * N[(B$95$m + N[(C + N[(0.5 * N[(N[Power[C, 2.0], $MachinePrecision] / B$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], (-N[(N[Sqrt[N[(F / B$95$m), $MachinePrecision]], $MachinePrecision] * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision])]]]]]]]
\begin{array}{l}
B_m = \left|B\right|

\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\
t_1 := t\_0 \cdot \left(F \cdot 2\right)\\
\mathbf{if}\;B\_m \leq 2.32 \cdot 10^{-212}:\\
\;\;\;\;\frac{-\sqrt{t\_1 \cdot \left(A + A\right)}}{t\_0}\\

\mathbf{elif}\;B\_m \leq 2.9 \cdot 10^{-198}:\\
\;\;\;\;\frac{-\sqrt{t\_1 \cdot \left(2 \cdot C\right)}}{t\_0}\\

\mathbf{elif}\;B\_m \leq 7.7 \cdot 10^{-112}:\\
\;\;\;\;\frac{-{\left({\left(\left(A + A\right) \cdot \left(\mathsf{fma}\left(B\_m, B\_m, \left(A \cdot C\right) \cdot -4\right) \cdot \left(2 \cdot F\right)\right)\right)}^{0.25}\right)}^{2}}{t\_0}\\

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

\mathbf{elif}\;B\_m \leq 7.2 \cdot 10^{+270}:\\
\;\;\;\;-1 \cdot \left(\frac{\sqrt{2}}{B\_m} \cdot \sqrt{F \cdot \left(B\_m + \left(C + 0.5 \cdot \frac{{C}^{2}}{B\_m}\right)\right)}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 6 regimes
  2. if B < 2.3199999999999999e-212

    1. Initial program 21.6%

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

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

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

    if 2.3199999999999999e-212 < B < 2.90000000000000001e-198

    1. Initial program 35.2%

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

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

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

    if 2.90000000000000001e-198 < B < 7.69999999999999959e-112

    1. Initial program 16.2%

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

      \[\leadsto \color{blue}{\frac{-\sqrt{\left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot 2\right)\right) \cdot \left(A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. add-sqr-sqrt28.0%

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

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

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

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

    if 7.69999999999999959e-112 < B < 3.60000000000000016e132

    1. Initial program 35.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.60000000000000016e132 < B < 7.2000000000000003e270

    1. Initial program 15.1%

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

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

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

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

    if 7.2000000000000003e270 < B

    1. Initial program 0.0%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto -\color{blue}{\sqrt{\frac{F}{B}} \cdot \sqrt{2}} \]
  3. Recombined 6 regimes into one program.
  4. Add Preprocessing

Alternative 7: 34.3% accurate, 1.4× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ \begin{array}{l} t_0 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\ t_1 := t\_0 \cdot \left(F \cdot 2\right)\\ t_2 := \frac{-\sqrt{t\_1 \cdot \left(A + A\right)}}{t\_0}\\ \mathbf{if}\;B\_m \leq 1.7 \cdot 10^{-212}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;B\_m \leq 1.6 \cdot 10^{-198}:\\ \;\;\;\;\frac{-\sqrt{t\_1 \cdot \left(2 \cdot C\right)}}{t\_0}\\ \mathbf{elif}\;B\_m \leq 3.05 \cdot 10^{-111}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;B\_m \leq 3.6 \cdot 10^{+132}:\\ \;\;\;\;-\frac{B\_m \cdot \left(\sqrt{2 \cdot F} \cdot \sqrt{A + \mathsf{hypot}\left(A, B\_m\right)}\right)}{t\_0}\\ \mathbf{elif}\;B\_m \leq 3 \cdot 10^{+271}:\\ \;\;\;\;-1 \cdot \left(\frac{\sqrt{2}}{B\_m} \cdot \sqrt{F \cdot \left(B\_m + \left(C + 0.5 \cdot \frac{{C}^{2}}{B\_m}\right)\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;-\sqrt{\frac{F}{B\_m}} \cdot \sqrt{2}\\ \end{array} \end{array} \]
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
 :precision binary64
 (let* ((t_0 (fma B_m B_m (* A (* C -4.0))))
        (t_1 (* t_0 (* F 2.0)))
        (t_2 (/ (- (sqrt (* t_1 (+ A A)))) t_0)))
   (if (<= B_m 1.7e-212)
     t_2
     (if (<= B_m 1.6e-198)
       (/ (- (sqrt (* t_1 (* 2.0 C)))) t_0)
       (if (<= B_m 3.05e-111)
         t_2
         (if (<= B_m 3.6e+132)
           (- (/ (* B_m (* (sqrt (* 2.0 F)) (sqrt (+ A (hypot A B_m))))) t_0))
           (if (<= B_m 3e+271)
             (*
              -1.0
              (*
               (/ (sqrt 2.0) B_m)
               (sqrt (* F (+ B_m (+ C (* 0.5 (/ (pow C 2.0) B_m))))))))
             (- (* (sqrt (/ F B_m)) (sqrt 2.0))))))))))
B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
	double t_0 = fma(B_m, B_m, (A * (C * -4.0)));
	double t_1 = t_0 * (F * 2.0);
	double t_2 = -sqrt((t_1 * (A + A))) / t_0;
	double tmp;
	if (B_m <= 1.7e-212) {
		tmp = t_2;
	} else if (B_m <= 1.6e-198) {
		tmp = -sqrt((t_1 * (2.0 * C))) / t_0;
	} else if (B_m <= 3.05e-111) {
		tmp = t_2;
	} else if (B_m <= 3.6e+132) {
		tmp = -((B_m * (sqrt((2.0 * F)) * sqrt((A + hypot(A, B_m))))) / t_0);
	} else if (B_m <= 3e+271) {
		tmp = -1.0 * ((sqrt(2.0) / B_m) * sqrt((F * (B_m + (C + (0.5 * (pow(C, 2.0) / B_m)))))));
	} else {
		tmp = -(sqrt((F / B_m)) * sqrt(2.0));
	}
	return tmp;
}
B_m = abs(B)
function code(A, B_m, C, F)
	t_0 = fma(B_m, B_m, Float64(A * Float64(C * -4.0)))
	t_1 = Float64(t_0 * Float64(F * 2.0))
	t_2 = Float64(Float64(-sqrt(Float64(t_1 * Float64(A + A)))) / t_0)
	tmp = 0.0
	if (B_m <= 1.7e-212)
		tmp = t_2;
	elseif (B_m <= 1.6e-198)
		tmp = Float64(Float64(-sqrt(Float64(t_1 * Float64(2.0 * C)))) / t_0);
	elseif (B_m <= 3.05e-111)
		tmp = t_2;
	elseif (B_m <= 3.6e+132)
		tmp = Float64(-Float64(Float64(B_m * Float64(sqrt(Float64(2.0 * F)) * sqrt(Float64(A + hypot(A, B_m))))) / t_0));
	elseif (B_m <= 3e+271)
		tmp = Float64(-1.0 * Float64(Float64(sqrt(2.0) / B_m) * sqrt(Float64(F * Float64(B_m + Float64(C + Float64(0.5 * Float64((C ^ 2.0) / B_m))))))));
	else
		tmp = Float64(-Float64(sqrt(Float64(F / B_m)) * sqrt(2.0)));
	end
	return tmp
end
B_m = N[Abs[B], $MachinePrecision]
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 * N[(F * 2.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[((-N[Sqrt[N[(t$95$1 * N[(A + A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision]}, If[LessEqual[B$95$m, 1.7e-212], t$95$2, If[LessEqual[B$95$m, 1.6e-198], N[((-N[Sqrt[N[(t$95$1 * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[B$95$m, 3.05e-111], t$95$2, If[LessEqual[B$95$m, 3.6e+132], (-N[(N[(B$95$m * N[(N[Sqrt[N[(2.0 * F), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(A + N[Sqrt[A ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]), If[LessEqual[B$95$m, 3e+271], N[(-1.0 * N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * N[Sqrt[N[(F * N[(B$95$m + N[(C + N[(0.5 * N[(N[Power[C, 2.0], $MachinePrecision] / B$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], (-N[(N[Sqrt[N[(F / B$95$m), $MachinePrecision]], $MachinePrecision] * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision])]]]]]]]]
\begin{array}{l}
B_m = \left|B\right|

\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\
t_1 := t\_0 \cdot \left(F \cdot 2\right)\\
t_2 := \frac{-\sqrt{t\_1 \cdot \left(A + A\right)}}{t\_0}\\
\mathbf{if}\;B\_m \leq 1.7 \cdot 10^{-212}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;B\_m \leq 1.6 \cdot 10^{-198}:\\
\;\;\;\;\frac{-\sqrt{t\_1 \cdot \left(2 \cdot C\right)}}{t\_0}\\

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

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

\mathbf{elif}\;B\_m \leq 3 \cdot 10^{+271}:\\
\;\;\;\;-1 \cdot \left(\frac{\sqrt{2}}{B\_m} \cdot \sqrt{F \cdot \left(B\_m + \left(C + 0.5 \cdot \frac{{C}^{2}}{B\_m}\right)\right)}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if B < 1.69999999999999999e-212 or 1.59999999999999997e-198 < B < 3.0500000000000001e-111

    1. Initial program 20.8%

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

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

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

    if 1.69999999999999999e-212 < B < 1.59999999999999997e-198

    1. Initial program 35.2%

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

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

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

    if 3.0500000000000001e-111 < B < 3.60000000000000016e132

    1. Initial program 35.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.60000000000000016e132 < B < 3e271

    1. Initial program 15.1%

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

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

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

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

    if 3e271 < B

    1. Initial program 0.0%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto -\color{blue}{\sqrt{\frac{F}{B}} \cdot \sqrt{2}} \]
  3. Recombined 5 regimes into one program.
  4. Add Preprocessing

Alternative 8: 31.9% accurate, 1.9× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ \begin{array}{l} t_0 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\ t_1 := t\_0 \cdot \left(F \cdot 2\right)\\ t_2 := \frac{-\sqrt{t\_1 \cdot \left(A + A\right)}}{t\_0}\\ \mathbf{if}\;B\_m \leq 2 \cdot 10^{-212}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;B\_m \leq 1.65 \cdot 10^{-198}:\\ \;\;\;\;\frac{-\sqrt{t\_1 \cdot \left(2 \cdot C\right)}}{t\_0}\\ \mathbf{elif}\;B\_m \leq 6.5 \cdot 10^{-57}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;B\_m \leq 2.8 \cdot 10^{+271}:\\ \;\;\;\;-1 \cdot \left(\frac{\sqrt{2}}{B\_m} \cdot \sqrt{F \cdot \left(B\_m + \left(C + 0.5 \cdot \frac{{C}^{2}}{B\_m}\right)\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;-\sqrt{\frac{F}{B\_m}} \cdot \sqrt{2}\\ \end{array} \end{array} \]
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
 :precision binary64
 (let* ((t_0 (fma B_m B_m (* A (* C -4.0))))
        (t_1 (* t_0 (* F 2.0)))
        (t_2 (/ (- (sqrt (* t_1 (+ A A)))) t_0)))
   (if (<= B_m 2e-212)
     t_2
     (if (<= B_m 1.65e-198)
       (/ (- (sqrt (* t_1 (* 2.0 C)))) t_0)
       (if (<= B_m 6.5e-57)
         t_2
         (if (<= B_m 2.8e+271)
           (*
            -1.0
            (*
             (/ (sqrt 2.0) B_m)
             (sqrt (* F (+ B_m (+ C (* 0.5 (/ (pow C 2.0) B_m))))))))
           (- (* (sqrt (/ F B_m)) (sqrt 2.0)))))))))
B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
	double t_0 = fma(B_m, B_m, (A * (C * -4.0)));
	double t_1 = t_0 * (F * 2.0);
	double t_2 = -sqrt((t_1 * (A + A))) / t_0;
	double tmp;
	if (B_m <= 2e-212) {
		tmp = t_2;
	} else if (B_m <= 1.65e-198) {
		tmp = -sqrt((t_1 * (2.0 * C))) / t_0;
	} else if (B_m <= 6.5e-57) {
		tmp = t_2;
	} else if (B_m <= 2.8e+271) {
		tmp = -1.0 * ((sqrt(2.0) / B_m) * sqrt((F * (B_m + (C + (0.5 * (pow(C, 2.0) / B_m)))))));
	} else {
		tmp = -(sqrt((F / B_m)) * sqrt(2.0));
	}
	return tmp;
}
B_m = abs(B)
function code(A, B_m, C, F)
	t_0 = fma(B_m, B_m, Float64(A * Float64(C * -4.0)))
	t_1 = Float64(t_0 * Float64(F * 2.0))
	t_2 = Float64(Float64(-sqrt(Float64(t_1 * Float64(A + A)))) / t_0)
	tmp = 0.0
	if (B_m <= 2e-212)
		tmp = t_2;
	elseif (B_m <= 1.65e-198)
		tmp = Float64(Float64(-sqrt(Float64(t_1 * Float64(2.0 * C)))) / t_0);
	elseif (B_m <= 6.5e-57)
		tmp = t_2;
	elseif (B_m <= 2.8e+271)
		tmp = Float64(-1.0 * Float64(Float64(sqrt(2.0) / B_m) * sqrt(Float64(F * Float64(B_m + Float64(C + Float64(0.5 * Float64((C ^ 2.0) / B_m))))))));
	else
		tmp = Float64(-Float64(sqrt(Float64(F / B_m)) * sqrt(2.0)));
	end
	return tmp
end
B_m = N[Abs[B], $MachinePrecision]
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 * N[(F * 2.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[((-N[Sqrt[N[(t$95$1 * N[(A + A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision]}, If[LessEqual[B$95$m, 2e-212], t$95$2, If[LessEqual[B$95$m, 1.65e-198], N[((-N[Sqrt[N[(t$95$1 * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[B$95$m, 6.5e-57], t$95$2, If[LessEqual[B$95$m, 2.8e+271], N[(-1.0 * N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * N[Sqrt[N[(F * N[(B$95$m + N[(C + N[(0.5 * N[(N[Power[C, 2.0], $MachinePrecision] / B$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], (-N[(N[Sqrt[N[(F / B$95$m), $MachinePrecision]], $MachinePrecision] * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision])]]]]]]]
\begin{array}{l}
B_m = \left|B\right|

\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\
t_1 := t\_0 \cdot \left(F \cdot 2\right)\\
t_2 := \frac{-\sqrt{t\_1 \cdot \left(A + A\right)}}{t\_0}\\
\mathbf{if}\;B\_m \leq 2 \cdot 10^{-212}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;B\_m \leq 1.65 \cdot 10^{-198}:\\
\;\;\;\;\frac{-\sqrt{t\_1 \cdot \left(2 \cdot C\right)}}{t\_0}\\

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

\mathbf{elif}\;B\_m \leq 2.8 \cdot 10^{+271}:\\
\;\;\;\;-1 \cdot \left(\frac{\sqrt{2}}{B\_m} \cdot \sqrt{F \cdot \left(B\_m + \left(C + 0.5 \cdot \frac{{C}^{2}}{B\_m}\right)\right)}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if B < 1.99999999999999991e-212 or 1.65e-198 < B < 6.49999999999999992e-57

    1. Initial program 23.2%

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

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

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

    if 1.99999999999999991e-212 < B < 1.65e-198

    1. Initial program 35.2%

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

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

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

    if 6.49999999999999992e-57 < B < 2.7999999999999999e271

    1. Initial program 26.3%

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

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

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

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

    if 2.7999999999999999e271 < B

    1. Initial program 0.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 32.4% accurate, 1.9× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ \begin{array}{l} t_0 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\ \mathbf{if}\;B\_m \leq 1.05 \cdot 10^{-57}:\\ \;\;\;\;\frac{-\sqrt{\left(t\_0 \cdot \left(F \cdot 2\right)\right) \cdot \left(2 \cdot C\right)}}{t\_0}\\ \mathbf{elif}\;B\_m \leq 1.9 \cdot 10^{+269}:\\ \;\;\;\;-1 \cdot \left(\frac{\sqrt{2}}{B\_m} \cdot \sqrt{F \cdot \left(B\_m + \left(C + 0.5 \cdot \frac{{C}^{2}}{B\_m}\right)\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;-\sqrt{\frac{F}{B\_m}} \cdot \sqrt{2}\\ \end{array} \end{array} \]
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
 :precision binary64
 (let* ((t_0 (fma B_m B_m (* A (* C -4.0)))))
   (if (<= B_m 1.05e-57)
     (/ (- (sqrt (* (* t_0 (* F 2.0)) (* 2.0 C)))) t_0)
     (if (<= B_m 1.9e+269)
       (*
        -1.0
        (*
         (/ (sqrt 2.0) B_m)
         (sqrt (* F (+ B_m (+ C (* 0.5 (/ (pow C 2.0) B_m))))))))
       (- (* (sqrt (/ F B_m)) (sqrt 2.0)))))))
B_m = fabs(B);
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 (B_m <= 1.05e-57) {
		tmp = -sqrt(((t_0 * (F * 2.0)) * (2.0 * C))) / t_0;
	} else if (B_m <= 1.9e+269) {
		tmp = -1.0 * ((sqrt(2.0) / B_m) * sqrt((F * (B_m + (C + (0.5 * (pow(C, 2.0) / B_m)))))));
	} else {
		tmp = -(sqrt((F / B_m)) * sqrt(2.0));
	}
	return tmp;
}
B_m = abs(B)
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 <= 1.05e-57)
		tmp = Float64(Float64(-sqrt(Float64(Float64(t_0 * Float64(F * 2.0)) * Float64(2.0 * C)))) / t_0);
	elseif (B_m <= 1.9e+269)
		tmp = Float64(-1.0 * Float64(Float64(sqrt(2.0) / B_m) * sqrt(Float64(F * Float64(B_m + Float64(C + Float64(0.5 * Float64((C ^ 2.0) / B_m))))))));
	else
		tmp = Float64(-Float64(sqrt(Float64(F / B_m)) * sqrt(2.0)));
	end
	return tmp
end
B_m = N[Abs[B], $MachinePrecision]
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[B$95$m, 1.05e-57], N[((-N[Sqrt[N[(N[(t$95$0 * N[(F * 2.0), $MachinePrecision]), $MachinePrecision] * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[B$95$m, 1.9e+269], N[(-1.0 * N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * N[Sqrt[N[(F * N[(B$95$m + N[(C + N[(0.5 * N[(N[Power[C, 2.0], $MachinePrecision] / B$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], (-N[(N[Sqrt[N[(F / B$95$m), $MachinePrecision]], $MachinePrecision] * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision])]]]
\begin{array}{l}
B_m = \left|B\right|

\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\
\mathbf{if}\;B\_m \leq 1.05 \cdot 10^{-57}:\\
\;\;\;\;\frac{-\sqrt{\left(t\_0 \cdot \left(F \cdot 2\right)\right) \cdot \left(2 \cdot C\right)}}{t\_0}\\

\mathbf{elif}\;B\_m \leq 1.9 \cdot 10^{+269}:\\
\;\;\;\;-1 \cdot \left(\frac{\sqrt{2}}{B\_m} \cdot \sqrt{F \cdot \left(B\_m + \left(C + 0.5 \cdot \frac{{C}^{2}}{B\_m}\right)\right)}\right)\\

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


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

    1. Initial program 23.5%

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

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

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

    if 1.05e-57 < B < 1.89999999999999991e269

    1. Initial program 26.3%

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

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

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

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

    if 1.89999999999999991e269 < B

    1. Initial program 0.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 33.1% accurate, 2.0× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ \begin{array}{l} \mathbf{if}\;F \leq 1.45 \cdot 10^{-56}:\\ \;\;\;\;-1 \cdot \left(\frac{\sqrt{2}}{B\_m} \cdot \sqrt{F \cdot \left(A + \left(B\_m + 0.5 \cdot \frac{{A}^{2}}{B\_m}\right)\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;-\sqrt{\frac{F}{B\_m}} \cdot \sqrt{2}\\ \end{array} \end{array} \]
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
 :precision binary64
 (if (<= F 1.45e-56)
   (*
    -1.0
    (*
     (/ (sqrt 2.0) B_m)
     (sqrt (* F (+ A (+ B_m (* 0.5 (/ (pow A 2.0) B_m))))))))
   (- (* (sqrt (/ F B_m)) (sqrt 2.0)))))
B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
	double tmp;
	if (F <= 1.45e-56) {
		tmp = -1.0 * ((sqrt(2.0) / B_m) * sqrt((F * (A + (B_m + (0.5 * (pow(A, 2.0) / B_m)))))));
	} else {
		tmp = -(sqrt((F / B_m)) * sqrt(2.0));
	}
	return tmp;
}
B_m = abs(B)
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 <= 1.45d-56) then
        tmp = (-1.0d0) * ((sqrt(2.0d0) / b_m) * sqrt((f * (a + (b_m + (0.5d0 * ((a ** 2.0d0) / b_m)))))))
    else
        tmp = -(sqrt((f / b_m)) * sqrt(2.0d0))
    end if
    code = tmp
end function
B_m = Math.abs(B);
public static double code(double A, double B_m, double C, double F) {
	double tmp;
	if (F <= 1.45e-56) {
		tmp = -1.0 * ((Math.sqrt(2.0) / B_m) * Math.sqrt((F * (A + (B_m + (0.5 * (Math.pow(A, 2.0) / B_m)))))));
	} else {
		tmp = -(Math.sqrt((F / B_m)) * Math.sqrt(2.0));
	}
	return tmp;
}
B_m = math.fabs(B)
def code(A, B_m, C, F):
	tmp = 0
	if F <= 1.45e-56:
		tmp = -1.0 * ((math.sqrt(2.0) / B_m) * math.sqrt((F * (A + (B_m + (0.5 * (math.pow(A, 2.0) / B_m)))))))
	else:
		tmp = -(math.sqrt((F / B_m)) * math.sqrt(2.0))
	return tmp
B_m = abs(B)
function code(A, B_m, C, F)
	tmp = 0.0
	if (F <= 1.45e-56)
		tmp = Float64(-1.0 * Float64(Float64(sqrt(2.0) / B_m) * sqrt(Float64(F * Float64(A + Float64(B_m + Float64(0.5 * Float64((A ^ 2.0) / B_m))))))));
	else
		tmp = Float64(-Float64(sqrt(Float64(F / B_m)) * sqrt(2.0)));
	end
	return tmp
end
B_m = abs(B);
function tmp_2 = code(A, B_m, C, F)
	tmp = 0.0;
	if (F <= 1.45e-56)
		tmp = -1.0 * ((sqrt(2.0) / B_m) * sqrt((F * (A + (B_m + (0.5 * ((A ^ 2.0) / B_m)))))));
	else
		tmp = -(sqrt((F / B_m)) * sqrt(2.0));
	end
	tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision]
code[A_, B$95$m_, C_, F_] := If[LessEqual[F, 1.45e-56], N[(-1.0 * N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * N[Sqrt[N[(F * N[(A + N[(B$95$m + N[(0.5 * N[(N[Power[A, 2.0], $MachinePrecision] / B$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], (-N[(N[Sqrt[N[(F / B$95$m), $MachinePrecision]], $MachinePrecision] * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision])]
\begin{array}{l}
B_m = \left|B\right|

\\
\begin{array}{l}
\mathbf{if}\;F \leq 1.45 \cdot 10^{-56}:\\
\;\;\;\;-1 \cdot \left(\frac{\sqrt{2}}{B\_m} \cdot \sqrt{F \cdot \left(A + \left(B\_m + 0.5 \cdot \frac{{A}^{2}}{B\_m}\right)\right)}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if F < 1.44999999999999996e-56

    1. Initial program 25.6%

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

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

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

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

    if 1.44999999999999996e-56 < F

    1. Initial program 21.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 32.7% accurate, 2.0× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ \begin{array}{l} \mathbf{if}\;F \leq 3.8 \cdot 10^{-75}:\\ \;\;\;\;-1 \cdot \left(\frac{\sqrt{2}}{B\_m} \cdot \sqrt{F \cdot \left(B\_m + \left(C + 0.5 \cdot \frac{{C}^{2}}{B\_m}\right)\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;-\sqrt{\frac{F}{B\_m}} \cdot \sqrt{2}\\ \end{array} \end{array} \]
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
 :precision binary64
 (if (<= F 3.8e-75)
   (*
    -1.0
    (*
     (/ (sqrt 2.0) B_m)
     (sqrt (* F (+ B_m (+ C (* 0.5 (/ (pow C 2.0) B_m))))))))
   (- (* (sqrt (/ F B_m)) (sqrt 2.0)))))
B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
	double tmp;
	if (F <= 3.8e-75) {
		tmp = -1.0 * ((sqrt(2.0) / B_m) * sqrt((F * (B_m + (C + (0.5 * (pow(C, 2.0) / B_m)))))));
	} else {
		tmp = -(sqrt((F / B_m)) * sqrt(2.0));
	}
	return tmp;
}
B_m = abs(B)
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 <= 3.8d-75) then
        tmp = (-1.0d0) * ((sqrt(2.0d0) / b_m) * sqrt((f * (b_m + (c + (0.5d0 * ((c ** 2.0d0) / b_m)))))))
    else
        tmp = -(sqrt((f / b_m)) * sqrt(2.0d0))
    end if
    code = tmp
end function
B_m = Math.abs(B);
public static double code(double A, double B_m, double C, double F) {
	double tmp;
	if (F <= 3.8e-75) {
		tmp = -1.0 * ((Math.sqrt(2.0) / B_m) * Math.sqrt((F * (B_m + (C + (0.5 * (Math.pow(C, 2.0) / B_m)))))));
	} else {
		tmp = -(Math.sqrt((F / B_m)) * Math.sqrt(2.0));
	}
	return tmp;
}
B_m = math.fabs(B)
def code(A, B_m, C, F):
	tmp = 0
	if F <= 3.8e-75:
		tmp = -1.0 * ((math.sqrt(2.0) / B_m) * math.sqrt((F * (B_m + (C + (0.5 * (math.pow(C, 2.0) / B_m)))))))
	else:
		tmp = -(math.sqrt((F / B_m)) * math.sqrt(2.0))
	return tmp
B_m = abs(B)
function code(A, B_m, C, F)
	tmp = 0.0
	if (F <= 3.8e-75)
		tmp = Float64(-1.0 * Float64(Float64(sqrt(2.0) / B_m) * sqrt(Float64(F * Float64(B_m + Float64(C + Float64(0.5 * Float64((C ^ 2.0) / B_m))))))));
	else
		tmp = Float64(-Float64(sqrt(Float64(F / B_m)) * sqrt(2.0)));
	end
	return tmp
end
B_m = abs(B);
function tmp_2 = code(A, B_m, C, F)
	tmp = 0.0;
	if (F <= 3.8e-75)
		tmp = -1.0 * ((sqrt(2.0) / B_m) * sqrt((F * (B_m + (C + (0.5 * ((C ^ 2.0) / B_m)))))));
	else
		tmp = -(sqrt((F / B_m)) * sqrt(2.0));
	end
	tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision]
code[A_, B$95$m_, C_, F_] := If[LessEqual[F, 3.8e-75], N[(-1.0 * N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * N[Sqrt[N[(F * N[(B$95$m + N[(C + N[(0.5 * N[(N[Power[C, 2.0], $MachinePrecision] / B$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], (-N[(N[Sqrt[N[(F / B$95$m), $MachinePrecision]], $MachinePrecision] * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision])]
\begin{array}{l}
B_m = \left|B\right|

\\
\begin{array}{l}
\mathbf{if}\;F \leq 3.8 \cdot 10^{-75}:\\
\;\;\;\;-1 \cdot \left(\frac{\sqrt{2}}{B\_m} \cdot \sqrt{F \cdot \left(B\_m + \left(C + 0.5 \cdot \frac{{C}^{2}}{B\_m}\right)\right)}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if F < 3.79999999999999994e-75

    1. Initial program 27.1%

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

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

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

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

    if 3.79999999999999994e-75 < F

    1. Initial program 20.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 12: 28.3% accurate, 2.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;B\_m \leq 3.45 \cdot 10^{+146}:\\
\;\;\;\;-\frac{B\_m \cdot {\left(2 \cdot \left(F \cdot \left(A + \mathsf{hypot}\left(A, B\_m\right)\right)\right)\right)}^{0.5}}{{B\_m}^{2}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if B < 3.44999999999999978e146

    1. Initial program 25.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.44999999999999978e146 < B

    1. Initial program 3.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 13: 27.0% accurate, 2.9× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ \begin{array}{l} \mathbf{if}\;B\_m \leq 4.4 \cdot 10^{+145}:\\ \;\;\;\;-\frac{B\_m \cdot {\left(2 \cdot \left(F \cdot B\_m\right)\right)}^{0.5}}{\mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;-\sqrt{\frac{F}{B\_m}} \cdot \sqrt{2}\\ \end{array} \end{array} \]
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
 :precision binary64
 (if (<= B_m 4.4e+145)
   (- (/ (* B_m (pow (* 2.0 (* F B_m)) 0.5)) (fma B_m B_m (* A (* C -4.0)))))
   (- (* (sqrt (/ F B_m)) (sqrt 2.0)))))
B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
	double tmp;
	if (B_m <= 4.4e+145) {
		tmp = -((B_m * pow((2.0 * (F * B_m)), 0.5)) / fma(B_m, B_m, (A * (C * -4.0))));
	} else {
		tmp = -(sqrt((F / B_m)) * sqrt(2.0));
	}
	return tmp;
}
B_m = abs(B)
function code(A, B_m, C, F)
	tmp = 0.0
	if (B_m <= 4.4e+145)
		tmp = Float64(-Float64(Float64(B_m * (Float64(2.0 * Float64(F * B_m)) ^ 0.5)) / fma(B_m, B_m, Float64(A * Float64(C * -4.0)))));
	else
		tmp = Float64(-Float64(sqrt(Float64(F / B_m)) * sqrt(2.0)));
	end
	return tmp
end
B_m = N[Abs[B], $MachinePrecision]
code[A_, B$95$m_, C_, F_] := If[LessEqual[B$95$m, 4.4e+145], (-N[(N[(B$95$m * N[Power[N[(2.0 * N[(F * B$95$m), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision] / N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), (-N[(N[Sqrt[N[(F / B$95$m), $MachinePrecision]], $MachinePrecision] * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision])]
\begin{array}{l}
B_m = \left|B\right|

\\
\begin{array}{l}
\mathbf{if}\;B\_m \leq 4.4 \cdot 10^{+145}:\\
\;\;\;\;-\frac{B\_m \cdot {\left(2 \cdot \left(F \cdot B\_m\right)\right)}^{0.5}}{\mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if B < 4.40000000000000017e145

    1. Initial program 25.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 4.40000000000000017e145 < B

    1. Initial program 3.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 14: 27.1% accurate, 3.1× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ -\sqrt{\frac{F}{B\_m}} \cdot \sqrt{2} \end{array} \]
B_m = (fabs.f64 B)
(FPCore (A B_m C F) :precision binary64 (- (* (sqrt (/ F B_m)) (sqrt 2.0))))
B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
	return -(sqrt((F / B_m)) * sqrt(2.0));
}
B_m = abs(B)
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 / b_m)) * sqrt(2.0d0))
end function
B_m = Math.abs(B);
public static double code(double A, double B_m, double C, double F) {
	return -(Math.sqrt((F / B_m)) * Math.sqrt(2.0));
}
B_m = math.fabs(B)
def code(A, B_m, C, F):
	return -(math.sqrt((F / B_m)) * math.sqrt(2.0))
B_m = abs(B)
function code(A, B_m, C, F)
	return Float64(-Float64(sqrt(Float64(F / B_m)) * sqrt(2.0)))
end
B_m = abs(B);
function tmp = code(A, B_m, C, F)
	tmp = -(sqrt((F / B_m)) * sqrt(2.0));
end
B_m = N[Abs[B], $MachinePrecision]
code[A_, B$95$m_, C_, F_] := (-N[(N[Sqrt[N[(F / B$95$m), $MachinePrecision]], $MachinePrecision] * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision])
\begin{array}{l}
B_m = \left|B\right|

\\
-\sqrt{\frac{F}{B\_m}} \cdot \sqrt{2}
\end{array}
Derivation
  1. Initial program 23.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 15: 3.8% accurate, 634.0× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ 0 \end{array} \]
B_m = (fabs.f64 B)
(FPCore (A B_m C F) :precision binary64 0.0)
B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
	return 0.0;
}
B_m = abs(B)
real(8) function code(a, b_m, c, f)
    real(8), intent (in) :: a
    real(8), intent (in) :: b_m
    real(8), intent (in) :: c
    real(8), intent (in) :: f
    code = 0.0d0
end function
B_m = Math.abs(B);
public static double code(double A, double B_m, double C, double F) {
	return 0.0;
}
B_m = math.fabs(B)
def code(A, B_m, C, F):
	return 0.0
B_m = abs(B)
function code(A, B_m, C, F)
	return 0.0
end
B_m = abs(B);
function tmp = code(A, B_m, C, F)
	tmp = 0.0;
end
B_m = N[Abs[B], $MachinePrecision]
code[A_, B$95$m_, C_, F_] := 0.0
\begin{array}{l}
B_m = \left|B\right|

\\
0
\end{array}
Derivation
  1. Initial program 23.2%

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

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

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

    \[\leadsto \color{blue}{0} \]
  6. Add Preprocessing

Reproduce

?
herbie shell --seed 2024034 -o generate:simplify
(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))))