ABCF->ab-angle a

Percentage Accurate: 19.0% → 46.5%
Time: 29.5s
Alternatives: 8
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 8 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: 46.5% accurate, 0.3× speedup?

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

\mathbf{elif}\;t_5 \leq 2 \cdot 10^{-130}:\\
\;\;\;\;\frac{-\sqrt{\left(t_1 \cdot \left(2 \cdot F\right)\right) \cdot \left(-0.5 \cdot \left(B \cdot \left(B \cdot \frac{1}{C}\right)\right) + 2 \cdot A\right)}}{t_1}\\

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

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


\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.0000000000000002e-210

    1. Initial program 43.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. Simplified43.1%

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

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

    if -5.0000000000000002e-210 < (/.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))) < 2.0000000000000002e-130

    1. Initial program 6.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. Simplified12.1%

      \[\leadsto \color{blue}{\frac{-\sqrt{\left(\mathsf{fma}\left(B, B, C \cdot \left(A \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, C \cdot \left(A \cdot -4\right)\right)}} \]
    3. Taylor expanded in C around -inf 44.0%

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

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

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

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

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

    if 2.0000000000000002e-130 < (/.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 30.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. Simplified30.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{-\color{blue}{\sqrt{C + \left(\mathsf{hypot}\left(B, A - C\right) + A\right)} \cdot \sqrt{2 \cdot \left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot F\right)}}}{{B}^{2} - 4 \cdot \left(A \cdot C\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. Simplified1.5%

      \[\leadsto \color{blue}{\frac{-\sqrt{\left(\mathsf{fma}\left(B, B, C \cdot \left(A \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, C \cdot \left(A \cdot -4\right)\right)}} \]
    3. Taylor expanded in B around inf 0.5%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\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{{B}^{2} + {\left(A - C\right)}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \leq -5 \cdot 10^{-210}:\\ \;\;\;\;\frac{\sqrt{2 \cdot \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \cdot \left(-\sqrt{F \cdot \left(\left(A + C\right) + \mathsf{hypot}\left(B, A - C\right)\right)}\right)}{{B}^{2} - 4 \cdot \left(A \cdot C\right)}\\ \mathbf{elif}\;\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{{B}^{2} + {\left(A - C\right)}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \leq 2 \cdot 10^{-130}:\\ \;\;\;\;\frac{-\sqrt{\left(\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right) \cdot \left(2 \cdot F\right)\right) \cdot \left(-0.5 \cdot \left(B \cdot \left(B \cdot \frac{1}{C}\right)\right) + 2 \cdot A\right)}}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}\\ \mathbf{elif}\;\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{{B}^{2} + {\left(A - C\right)}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \leq \infty:\\ \;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)\right)} \cdot \left(-\sqrt{C + \left(A + \mathsf{hypot}\left(B, A - C\right)\right)}\right)}{{B}^{2} - 4 \cdot \left(A \cdot C\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{F \cdot \left(B + C\right)} \cdot \frac{-\sqrt{2}}{B}\\ \end{array} \]

Alternative 2: 38.8% accurate, 0.9× speedup?

\[\begin{array}{l} B = |B|\\ \\ \begin{array}{l} t_0 := \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)\\ \mathbf{if}\;{B}^{2} \leq 2 \cdot 10^{-208}:\\ \;\;\;\;\frac{-\sqrt{t_0 \cdot \left(F \cdot \left(2 \cdot \mathsf{fma}\left(-0.5, \frac{{B}^{2}}{C}, 2 \cdot A\right)\right)\right)}}{t_0}\\ \mathbf{elif}\;{B}^{2} \leq 10^{+292}:\\ \;\;\;\;\frac{\sqrt{2 \cdot t_0} \cdot \left(-\sqrt{F \cdot \left(\left(A + C\right) + \mathsf{hypot}\left(B, A - C\right)\right)}\right)}{{B}^{2} - 4 \cdot \left(A \cdot C\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{F \cdot \left(B + C\right)} \cdot \frac{-\sqrt{2}}{B}\\ \end{array} \end{array} \]
NOTE: B should be positive before calling this function
(FPCore (A B C F)
 :precision binary64
 (let* ((t_0 (fma B B (* A (* C -4.0)))))
   (if (<= (pow B 2.0) 2e-208)
     (/
      (- (sqrt (* t_0 (* F (* 2.0 (fma -0.5 (/ (pow B 2.0) C) (* 2.0 A)))))))
      t_0)
     (if (<= (pow B 2.0) 1e+292)
       (/
        (* (sqrt (* 2.0 t_0)) (- (sqrt (* F (+ (+ A C) (hypot B (- A C)))))))
        (- (pow B 2.0) (* 4.0 (* A C))))
       (* (sqrt (* F (+ B C))) (/ (- (sqrt 2.0)) B))))))
B = abs(B);
double code(double A, double B, double C, double F) {
	double t_0 = fma(B, B, (A * (C * -4.0)));
	double tmp;
	if (pow(B, 2.0) <= 2e-208) {
		tmp = -sqrt((t_0 * (F * (2.0 * fma(-0.5, (pow(B, 2.0) / C), (2.0 * A)))))) / t_0;
	} else if (pow(B, 2.0) <= 1e+292) {
		tmp = (sqrt((2.0 * t_0)) * -sqrt((F * ((A + C) + hypot(B, (A - C)))))) / (pow(B, 2.0) - (4.0 * (A * C)));
	} else {
		tmp = sqrt((F * (B + C))) * (-sqrt(2.0) / B);
	}
	return tmp;
}
B = abs(B)
function code(A, B, C, F)
	t_0 = fma(B, B, Float64(A * Float64(C * -4.0)))
	tmp = 0.0
	if ((B ^ 2.0) <= 2e-208)
		tmp = Float64(Float64(-sqrt(Float64(t_0 * Float64(F * Float64(2.0 * fma(-0.5, Float64((B ^ 2.0) / C), Float64(2.0 * A))))))) / t_0);
	elseif ((B ^ 2.0) <= 1e+292)
		tmp = Float64(Float64(sqrt(Float64(2.0 * t_0)) * Float64(-sqrt(Float64(F * Float64(Float64(A + C) + hypot(B, Float64(A - C))))))) / Float64((B ^ 2.0) - Float64(4.0 * Float64(A * C))));
	else
		tmp = Float64(sqrt(Float64(F * Float64(B + C))) * Float64(Float64(-sqrt(2.0)) / B));
	end
	return tmp
end
NOTE: B should be positive before calling this function
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(B * B + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 2e-208], N[((-N[Sqrt[N[(t$95$0 * N[(F * N[(2.0 * N[(-0.5 * N[(N[Power[B, 2.0], $MachinePrecision] / C), $MachinePrecision] + N[(2.0 * A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 1e+292], N[(N[(N[Sqrt[N[(2.0 * t$95$0), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(F * N[(N[(A + C), $MachinePrecision] + N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / N[(N[Power[B, 2.0], $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(F * N[(B + C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[((-N[Sqrt[2.0], $MachinePrecision]) / B), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)\\
\mathbf{if}\;{B}^{2} \leq 2 \cdot 10^{-208}:\\
\;\;\;\;\frac{-\sqrt{t_0 \cdot \left(F \cdot \left(2 \cdot \mathsf{fma}\left(-0.5, \frac{{B}^{2}}{C}, 2 \cdot A\right)\right)\right)}}{t_0}\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (pow.f64 B 2) < 2.0000000000000002e-208

    1. Initial program 19.4%

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

      \[\leadsto \color{blue}{\frac{-\sqrt{\left(\mathsf{fma}\left(B, B, C \cdot \left(A \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, C \cdot \left(A \cdot -4\right)\right)}} \]
    3. Taylor expanded in C around -inf 30.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.0000000000000002e-208 < (pow.f64 B 2) < 1e292

    1. Initial program 26.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. Simplified26.8%

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

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

    if 1e292 < (pow.f64 B 2)

    1. Initial program 1.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. Simplified1.2%

      \[\leadsto \color{blue}{\frac{-\sqrt{\left(\mathsf{fma}\left(B, B, C \cdot \left(A \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, C \cdot \left(A \cdot -4\right)\right)}} \]
    3. Taylor expanded in B around inf 0.0%

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

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

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

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

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

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

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

Alternative 3: 39.7% accurate, 1.5× speedup?

\[\begin{array}{l} B = |B|\\ \\ \begin{array}{l} t_0 := -\sqrt{2}\\ t_1 := \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)\\ \mathbf{if}\;F \leq 3.3 \cdot 10^{-307}:\\ \;\;\;\;\frac{-\sqrt{\left(2 \cdot t_1\right) \cdot \left(F \cdot \left(C + \left(A + \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)}}{t_1}\\ \mathbf{elif}\;F \leq 44000000000:\\ \;\;\;\;\sqrt{F \cdot \left(B + C\right)} \cdot \frac{t_0}{B}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{F}{B}} \cdot t_0\\ \end{array} \end{array} \]
NOTE: B should be positive before calling this function
(FPCore (A B C F)
 :precision binary64
 (let* ((t_0 (- (sqrt 2.0))) (t_1 (fma B B (* A (* C -4.0)))))
   (if (<= F 3.3e-307)
     (/ (- (sqrt (* (* 2.0 t_1) (* F (+ C (+ A (hypot B (- A C)))))))) t_1)
     (if (<= F 44000000000.0)
       (* (sqrt (* F (+ B C))) (/ t_0 B))
       (* (sqrt (/ F B)) t_0)))))
B = abs(B);
double code(double A, double B, double C, double F) {
	double t_0 = -sqrt(2.0);
	double t_1 = fma(B, B, (A * (C * -4.0)));
	double tmp;
	if (F <= 3.3e-307) {
		tmp = -sqrt(((2.0 * t_1) * (F * (C + (A + hypot(B, (A - C))))))) / t_1;
	} else if (F <= 44000000000.0) {
		tmp = sqrt((F * (B + C))) * (t_0 / B);
	} else {
		tmp = sqrt((F / B)) * t_0;
	}
	return tmp;
}
B = abs(B)
function code(A, B, C, F)
	t_0 = Float64(-sqrt(2.0))
	t_1 = fma(B, B, Float64(A * Float64(C * -4.0)))
	tmp = 0.0
	if (F <= 3.3e-307)
		tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * t_1) * Float64(F * Float64(C + Float64(A + hypot(B, Float64(A - C)))))))) / t_1);
	elseif (F <= 44000000000.0)
		tmp = Float64(sqrt(Float64(F * Float64(B + C))) * Float64(t_0 / B));
	else
		tmp = Float64(sqrt(Float64(F / B)) * t_0);
	end
	return tmp
end
NOTE: B should be positive before calling this function
code[A_, B_, C_, F_] := Block[{t$95$0 = (-N[Sqrt[2.0], $MachinePrecision])}, Block[{t$95$1 = N[(B * B + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, 3.3e-307], N[((-N[Sqrt[N[(N[(2.0 * t$95$1), $MachinePrecision] * N[(F * N[(C + N[(A + N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], If[LessEqual[F, 44000000000.0], N[(N[Sqrt[N[(F * N[(B + C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(t$95$0 / B), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision]]]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := -\sqrt{2}\\
t_1 := \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)\\
\mathbf{if}\;F \leq 3.3 \cdot 10^{-307}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot t_1\right) \cdot \left(F \cdot \left(C + \left(A + \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)}}{t_1}\\

\mathbf{elif}\;F \leq 44000000000:\\
\;\;\;\;\sqrt{F \cdot \left(B + C\right)} \cdot \frac{t_0}{B}\\

\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{F}{B}} \cdot t_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if F < 3.3e-307

    1. Initial program 17.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. Simplified17.8%

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

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

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

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

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

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

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

    if 3.3e-307 < F < 4.4e10

    1. Initial program 15.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. Simplified20.0%

      \[\leadsto \color{blue}{\frac{-\sqrt{\left(\mathsf{fma}\left(B, B, C \cdot \left(A \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, C \cdot \left(A \cdot -4\right)\right)}} \]
    3. Taylor expanded in B around inf 4.4%

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

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

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

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

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

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

    if 4.4e10 < F

    1. Initial program 16.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. Simplified16.9%

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

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

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

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

Alternative 4: 33.8% accurate, 1.9× speedup?

\[\begin{array}{l} B = |B|\\ \\ \begin{array}{l} t_0 := \mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)\\ \mathbf{if}\;B \leq 1.55 \cdot 10^{-48}:\\ \;\;\;\;\frac{-\sqrt{\left(t_0 \cdot \left(2 \cdot F\right)\right) \cdot \left(-0.5 \cdot \left(B \cdot \left(B \cdot \frac{1}{C}\right)\right) + 2 \cdot A\right)}}{t_0}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{F \cdot \left(B + C\right)} \cdot \frac{-\sqrt{2}}{B}\\ \end{array} \end{array} \]
NOTE: B should be positive before calling this function
(FPCore (A B C F)
 :precision binary64
 (let* ((t_0 (fma B B (* C (* A -4.0)))))
   (if (<= B 1.55e-48)
     (/
      (-
       (sqrt
        (* (* t_0 (* 2.0 F)) (+ (* -0.5 (* B (* B (/ 1.0 C)))) (* 2.0 A)))))
      t_0)
     (* (sqrt (* F (+ B C))) (/ (- (sqrt 2.0)) B)))))
B = abs(B);
double code(double A, double B, double C, double F) {
	double t_0 = fma(B, B, (C * (A * -4.0)));
	double tmp;
	if (B <= 1.55e-48) {
		tmp = -sqrt(((t_0 * (2.0 * F)) * ((-0.5 * (B * (B * (1.0 / C)))) + (2.0 * A)))) / t_0;
	} else {
		tmp = sqrt((F * (B + C))) * (-sqrt(2.0) / B);
	}
	return tmp;
}
B = abs(B)
function code(A, B, C, F)
	t_0 = fma(B, B, Float64(C * Float64(A * -4.0)))
	tmp = 0.0
	if (B <= 1.55e-48)
		tmp = Float64(Float64(-sqrt(Float64(Float64(t_0 * Float64(2.0 * F)) * Float64(Float64(-0.5 * Float64(B * Float64(B * Float64(1.0 / C)))) + Float64(2.0 * A))))) / t_0);
	else
		tmp = Float64(sqrt(Float64(F * Float64(B + C))) * Float64(Float64(-sqrt(2.0)) / B));
	end
	return tmp
end
NOTE: B should be positive before calling this function
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(B * B + N[(C * N[(A * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, 1.55e-48], N[((-N[Sqrt[N[(N[(t$95$0 * N[(2.0 * F), $MachinePrecision]), $MachinePrecision] * N[(N[(-0.5 * N[(B * N[(B * N[(1.0 / C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(2.0 * A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[(N[Sqrt[N[(F * N[(B + C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[((-N[Sqrt[2.0], $MachinePrecision]) / B), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)\\
\mathbf{if}\;B \leq 1.55 \cdot 10^{-48}:\\
\;\;\;\;\frac{-\sqrt{\left(t_0 \cdot \left(2 \cdot F\right)\right) \cdot \left(-0.5 \cdot \left(B \cdot \left(B \cdot \frac{1}{C}\right)\right) + 2 \cdot A\right)}}{t_0}\\

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


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

    1. Initial program 18.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. Simplified22.7%

      \[\leadsto \color{blue}{\frac{-\sqrt{\left(\mathsf{fma}\left(B, B, C \cdot \left(A \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, C \cdot \left(A \cdot -4\right)\right)}} \]
    3. Taylor expanded in C around -inf 18.8%

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

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

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

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

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

    if 1.55000000000000008e-48 < B

    1. Initial program 10.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. Simplified18.2%

      \[\leadsto \color{blue}{\frac{-\sqrt{\left(\mathsf{fma}\left(B, B, C \cdot \left(A \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, C \cdot \left(A \cdot -4\right)\right)}} \]
    3. Taylor expanded in B around inf 11.9%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;B \leq 1.55 \cdot 10^{-48}:\\ \;\;\;\;\frac{-\sqrt{\left(\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right) \cdot \left(2 \cdot F\right)\right) \cdot \left(-0.5 \cdot \left(B \cdot \left(B \cdot \frac{1}{C}\right)\right) + 2 \cdot A\right)}}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{F \cdot \left(B + C\right)} \cdot \frac{-\sqrt{2}}{B}\\ \end{array} \]

Alternative 5: 37.4% accurate, 1.9× speedup?

\[\begin{array}{l} B = |B|\\ \\ \begin{array}{l} t_0 := \mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)\\ t_1 := -\sqrt{2}\\ \mathbf{if}\;F \leq -5 \cdot 10^{-310}:\\ \;\;\;\;\frac{-\sqrt{\left(t_0 \cdot \left(2 \cdot F\right)\right) \cdot \left(2 \cdot A\right)}}{t_0}\\ \mathbf{elif}\;F \leq 340000000:\\ \;\;\;\;\sqrt{F \cdot \left(B + C\right)} \cdot \frac{t_1}{B}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{F}{B}} \cdot t_1\\ \end{array} \end{array} \]
NOTE: B should be positive before calling this function
(FPCore (A B C F)
 :precision binary64
 (let* ((t_0 (fma B B (* C (* A -4.0)))) (t_1 (- (sqrt 2.0))))
   (if (<= F -5e-310)
     (/ (- (sqrt (* (* t_0 (* 2.0 F)) (* 2.0 A)))) t_0)
     (if (<= F 340000000.0)
       (* (sqrt (* F (+ B C))) (/ t_1 B))
       (* (sqrt (/ F B)) t_1)))))
B = abs(B);
double code(double A, double B, double C, double F) {
	double t_0 = fma(B, B, (C * (A * -4.0)));
	double t_1 = -sqrt(2.0);
	double tmp;
	if (F <= -5e-310) {
		tmp = -sqrt(((t_0 * (2.0 * F)) * (2.0 * A))) / t_0;
	} else if (F <= 340000000.0) {
		tmp = sqrt((F * (B + C))) * (t_1 / B);
	} else {
		tmp = sqrt((F / B)) * t_1;
	}
	return tmp;
}
B = abs(B)
function code(A, B, C, F)
	t_0 = fma(B, B, Float64(C * Float64(A * -4.0)))
	t_1 = Float64(-sqrt(2.0))
	tmp = 0.0
	if (F <= -5e-310)
		tmp = Float64(Float64(-sqrt(Float64(Float64(t_0 * Float64(2.0 * F)) * Float64(2.0 * A)))) / t_0);
	elseif (F <= 340000000.0)
		tmp = Float64(sqrt(Float64(F * Float64(B + C))) * Float64(t_1 / B));
	else
		tmp = Float64(sqrt(Float64(F / B)) * t_1);
	end
	return tmp
end
NOTE: B should be positive before calling this function
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(B * B + N[(C * N[(A * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = (-N[Sqrt[2.0], $MachinePrecision])}, If[LessEqual[F, -5e-310], N[((-N[Sqrt[N[(N[(t$95$0 * N[(2.0 * F), $MachinePrecision]), $MachinePrecision] * N[(2.0 * A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[F, 340000000.0], N[(N[Sqrt[N[(F * N[(B + C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(t$95$1 / B), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision] * t$95$1), $MachinePrecision]]]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)\\
t_1 := -\sqrt{2}\\
\mathbf{if}\;F \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{-\sqrt{\left(t_0 \cdot \left(2 \cdot F\right)\right) \cdot \left(2 \cdot A\right)}}{t_0}\\

\mathbf{elif}\;F \leq 340000000:\\
\;\;\;\;\sqrt{F \cdot \left(B + C\right)} \cdot \frac{t_1}{B}\\

\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{F}{B}} \cdot t_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if F < -4.999999999999985e-310

    1. Initial program 18.9%

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

      \[\leadsto \color{blue}{\frac{-\sqrt{\left(\mathsf{fma}\left(B, B, C \cdot \left(A \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, C \cdot \left(A \cdot -4\right)\right)}} \]
    3. Taylor expanded in A around inf 22.8%

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

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

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

    if -4.999999999999985e-310 < F < 3.4e8

    1. Initial program 15.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. Simplified20.6%

      \[\leadsto \color{blue}{\frac{-\sqrt{\left(\mathsf{fma}\left(B, B, C \cdot \left(A \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, C \cdot \left(A \cdot -4\right)\right)}} \]
    3. Taylor expanded in B around inf 4.5%

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

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

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

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

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

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

    if 3.4e8 < F

    1. Initial program 16.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. Simplified16.9%

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

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

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

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

Alternative 6: 34.3% accurate, 3.0× speedup?

\[\begin{array}{l} B = |B|\\ \\ \begin{array}{l} t_0 := -\sqrt{2}\\ \mathbf{if}\;F \leq 4.6 \cdot 10^{-29}:\\ \;\;\;\;\sqrt{F \cdot \left(B + A\right)} \cdot \frac{t_0}{B}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{F}{B}} \cdot t_0\\ \end{array} \end{array} \]
NOTE: B should be positive before calling this function
(FPCore (A B C F)
 :precision binary64
 (let* ((t_0 (- (sqrt 2.0))))
   (if (<= F 4.6e-29)
     (* (sqrt (* F (+ B A))) (/ t_0 B))
     (* (sqrt (/ F B)) t_0))))
B = abs(B);
double code(double A, double B, double C, double F) {
	double t_0 = -sqrt(2.0);
	double tmp;
	if (F <= 4.6e-29) {
		tmp = sqrt((F * (B + A))) * (t_0 / B);
	} else {
		tmp = sqrt((F / B)) * t_0;
	}
	return tmp;
}
NOTE: B should be positive before calling this function
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
    real(8) :: tmp
    t_0 = -sqrt(2.0d0)
    if (f <= 4.6d-29) then
        tmp = sqrt((f * (b + a))) * (t_0 / b)
    else
        tmp = sqrt((f / b)) * t_0
    end if
    code = tmp
end function
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
	double t_0 = -Math.sqrt(2.0);
	double tmp;
	if (F <= 4.6e-29) {
		tmp = Math.sqrt((F * (B + A))) * (t_0 / B);
	} else {
		tmp = Math.sqrt((F / B)) * t_0;
	}
	return tmp;
}
B = abs(B)
def code(A, B, C, F):
	t_0 = -math.sqrt(2.0)
	tmp = 0
	if F <= 4.6e-29:
		tmp = math.sqrt((F * (B + A))) * (t_0 / B)
	else:
		tmp = math.sqrt((F / B)) * t_0
	return tmp
B = abs(B)
function code(A, B, C, F)
	t_0 = Float64(-sqrt(2.0))
	tmp = 0.0
	if (F <= 4.6e-29)
		tmp = Float64(sqrt(Float64(F * Float64(B + A))) * Float64(t_0 / B));
	else
		tmp = Float64(sqrt(Float64(F / B)) * t_0);
	end
	return tmp
end
B = abs(B)
function tmp_2 = code(A, B, C, F)
	t_0 = -sqrt(2.0);
	tmp = 0.0;
	if (F <= 4.6e-29)
		tmp = sqrt((F * (B + A))) * (t_0 / B);
	else
		tmp = sqrt((F / B)) * t_0;
	end
	tmp_2 = tmp;
end
NOTE: B should be positive before calling this function
code[A_, B_, C_, F_] := Block[{t$95$0 = (-N[Sqrt[2.0], $MachinePrecision])}, If[LessEqual[F, 4.6e-29], N[(N[Sqrt[N[(F * N[(B + A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(t$95$0 / B), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := -\sqrt{2}\\
\mathbf{if}\;F \leq 4.6 \cdot 10^{-29}:\\
\;\;\;\;\sqrt{F \cdot \left(B + A\right)} \cdot \frac{t_0}{B}\\

\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{F}{B}} \cdot t_0\\


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

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

      \[\leadsto \color{blue}{\frac{-\sqrt{\left(\mathsf{fma}\left(B, B, C \cdot \left(A \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, C \cdot \left(A \cdot -4\right)\right)}} \]
    3. Taylor expanded in B around inf 4.9%

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

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

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

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

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

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

    if 4.59999999999999982e-29 < F

    1. Initial program 16.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. Simplified17.1%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq 4.6 \cdot 10^{-29}:\\ \;\;\;\;\sqrt{F \cdot \left(B + A\right)} \cdot \frac{-\sqrt{2}}{B}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{F}{B}} \cdot \left(-\sqrt{2}\right)\\ \end{array} \]

Alternative 7: 34.4% accurate, 3.0× speedup?

\[\begin{array}{l} B = |B|\\ \\ \begin{array}{l} t_0 := -\sqrt{2}\\ \mathbf{if}\;F \leq 320000000:\\ \;\;\;\;\sqrt{F \cdot \left(B + C\right)} \cdot \frac{t_0}{B}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{F}{B}} \cdot t_0\\ \end{array} \end{array} \]
NOTE: B should be positive before calling this function
(FPCore (A B C F)
 :precision binary64
 (let* ((t_0 (- (sqrt 2.0))))
   (if (<= F 320000000.0)
     (* (sqrt (* F (+ B C))) (/ t_0 B))
     (* (sqrt (/ F B)) t_0))))
B = abs(B);
double code(double A, double B, double C, double F) {
	double t_0 = -sqrt(2.0);
	double tmp;
	if (F <= 320000000.0) {
		tmp = sqrt((F * (B + C))) * (t_0 / B);
	} else {
		tmp = sqrt((F / B)) * t_0;
	}
	return tmp;
}
NOTE: B should be positive before calling this function
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
    real(8) :: tmp
    t_0 = -sqrt(2.0d0)
    if (f <= 320000000.0d0) then
        tmp = sqrt((f * (b + c))) * (t_0 / b)
    else
        tmp = sqrt((f / b)) * t_0
    end if
    code = tmp
end function
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
	double t_0 = -Math.sqrt(2.0);
	double tmp;
	if (F <= 320000000.0) {
		tmp = Math.sqrt((F * (B + C))) * (t_0 / B);
	} else {
		tmp = Math.sqrt((F / B)) * t_0;
	}
	return tmp;
}
B = abs(B)
def code(A, B, C, F):
	t_0 = -math.sqrt(2.0)
	tmp = 0
	if F <= 320000000.0:
		tmp = math.sqrt((F * (B + C))) * (t_0 / B)
	else:
		tmp = math.sqrt((F / B)) * t_0
	return tmp
B = abs(B)
function code(A, B, C, F)
	t_0 = Float64(-sqrt(2.0))
	tmp = 0.0
	if (F <= 320000000.0)
		tmp = Float64(sqrt(Float64(F * Float64(B + C))) * Float64(t_0 / B));
	else
		tmp = Float64(sqrt(Float64(F / B)) * t_0);
	end
	return tmp
end
B = abs(B)
function tmp_2 = code(A, B, C, F)
	t_0 = -sqrt(2.0);
	tmp = 0.0;
	if (F <= 320000000.0)
		tmp = sqrt((F * (B + C))) * (t_0 / B);
	else
		tmp = sqrt((F / B)) * t_0;
	end
	tmp_2 = tmp;
end
NOTE: B should be positive before calling this function
code[A_, B_, C_, F_] := Block[{t$95$0 = (-N[Sqrt[2.0], $MachinePrecision])}, If[LessEqual[F, 320000000.0], N[(N[Sqrt[N[(F * N[(B + C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(t$95$0 / B), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision]]]
\begin{array}{l}
B = |B|\\
\\
\begin{array}{l}
t_0 := -\sqrt{2}\\
\mathbf{if}\;F \leq 320000000:\\
\;\;\;\;\sqrt{F \cdot \left(B + C\right)} \cdot \frac{t_0}{B}\\

\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{F}{B}} \cdot t_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if F < 3.2e8

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

      \[\leadsto \color{blue}{\frac{-\sqrt{\left(\mathsf{fma}\left(B, B, C \cdot \left(A \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, C \cdot \left(A \cdot -4\right)\right)}} \]
    3. Taylor expanded in B around inf 5.2%

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

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

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

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

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

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

    if 3.2e8 < F

    1. Initial program 16.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. Simplified16.9%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq 320000000:\\ \;\;\;\;\sqrt{F \cdot \left(B + C\right)} \cdot \frac{-\sqrt{2}}{B}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{F}{B}} \cdot \left(-\sqrt{2}\right)\\ \end{array} \]

Alternative 8: 27.4% accurate, 3.1× speedup?

\[\begin{array}{l} B = |B|\\ \\ \sqrt{\frac{F}{B}} \cdot \left(-\sqrt{2}\right) \end{array} \]
NOTE: B should be positive before calling this function
(FPCore (A B C F) :precision binary64 (* (sqrt (/ F B)) (- (sqrt 2.0))))
B = abs(B);
double code(double A, double B, double C, double F) {
	return sqrt((F / B)) * -sqrt(2.0);
}
NOTE: B should be positive before calling this function
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
    code = sqrt((f / b)) * -sqrt(2.0d0)
end function
B = Math.abs(B);
public static double code(double A, double B, double C, double F) {
	return Math.sqrt((F / B)) * -Math.sqrt(2.0);
}
B = abs(B)
def code(A, B, C, F):
	return math.sqrt((F / B)) * -math.sqrt(2.0)
B = abs(B)
function code(A, B, C, F)
	return Float64(sqrt(Float64(F / B)) * Float64(-sqrt(2.0)))
end
B = abs(B)
function tmp = code(A, B, C, F)
	tmp = sqrt((F / B)) * -sqrt(2.0);
end
NOTE: B should be positive before calling this function
code[A_, B_, C_, F_] := N[(N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision]
\begin{array}{l}
B = |B|\\
\\
\sqrt{\frac{F}{B}} \cdot \left(-\sqrt{2}\right)
\end{array}
Derivation
  1. Initial program 15.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. Simplified16.5%

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

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

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

    \[\leadsto \sqrt{\frac{F}{B}} \cdot \left(-\sqrt{2}\right) \]

Reproduce

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