ABCF->ab-angle a

Percentage Accurate: 18.8% → 52.6%
Time: 33.5s
Alternatives: 12
Speedup: 3.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 12 alternatives:

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

Initial Program: 18.8% accurate, 1.0× speedup?

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

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

Alternative 1: 52.6% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;{B_m}^{2} \leq 5 \cdot 10^{+131}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(\mathsf{fma}\left(B_m, B_m, C \cdot \left(A \cdot -4\right)\right) \cdot F\right)} \cdot \left(-\sqrt{A + \left(C + \mathsf{hypot}\left(B_m, A - C\right)\right)}\right)}{\mathsf{fma}\left(B_m, B_m, A \cdot \left(C \cdot -4\right)\right)}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (pow.f64 B 2) < 4.99999999999999995e131

    1. Initial program 23.6%

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

        \[\leadsto \frac{\color{blue}{0 - \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. div-sub23.6%

        \[\leadsto \color{blue}{\frac{0}{{B}^{2} - \left(4 \cdot A\right) \cdot C} - \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}} \]
      3. associate-*l*23.6%

        \[\leadsto \frac{0}{{B}^{2} - \color{blue}{4 \cdot \left(A \cdot C\right)}} - \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} \]
    4. Applied egg-rr30.1%

      \[\leadsto \color{blue}{\frac{0}{{B}^{2} - 4 \cdot \left(A \cdot C\right)} - \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 + \mathsf{hypot}\left(A - C, B\right)\right)\right)}}{{B}^{2} - 4 \cdot \left(A \cdot C\right)}} \]
    5. Step-by-step derivation
      1. div030.1%

        \[\leadsto \color{blue}{0} - \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 + \mathsf{hypot}\left(A - C, B\right)\right)\right)}}{{B}^{2} - 4 \cdot \left(A \cdot C\right)} \]
      2. neg-sub030.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 + \mathsf{hypot}\left(A - C, B\right)\right)\right)}}{{B}^{2} - 4 \cdot \left(A \cdot C\right)}} \]
      3. distribute-neg-frac30.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 + \mathsf{hypot}\left(A - C, B\right)\right)\right)}}{{B}^{2} - 4 \cdot \left(A \cdot C\right)}} \]
    6. Simplified30.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(A + \left(C + \mathsf{hypot}\left(A - C, B\right)\right)\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}} \]
    7. Step-by-step derivation
      1. pow1/230.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 4.99999999999999995e131 < (pow.f64 B 2)

    1. Initial program 6.8%

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

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

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

        \[\leadsto -\color{blue}{\sqrt{F \cdot \left(C + \sqrt{{B}^{2} + {C}^{2}}\right)} \cdot \frac{\sqrt{2}}{B}} \]
      3. distribute-rgt-neg-in10.6%

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

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

        \[\leadsto \sqrt{F \cdot \left(C + \sqrt{B \cdot B + \color{blue}{C \cdot C}}\right)} \cdot \left(-\frac{\sqrt{2}}{B}\right) \]
      6. hypot-def23.7%

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

      \[\leadsto \color{blue}{\sqrt{F \cdot \left(C + \mathsf{hypot}\left(B, C\right)\right)} \cdot \left(-\frac{\sqrt{2}}{B}\right)} \]
    6. Step-by-step derivation
      1. pow1/223.7%

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

        \[\leadsto {\color{blue}{\left(\left(C + \mathsf{hypot}\left(B, C\right)\right) \cdot F\right)}}^{0.5} \cdot \left(-\frac{\sqrt{2}}{B}\right) \]
      3. unpow-prod-down40.1%

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

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

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

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

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

Alternative 2: 43.7% accurate, 1.2× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;{B_m}^{2} \leq 10^{-98}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(2 \cdot \left(F \cdot \left({B_m}^{2} + -4 \cdot \left(C \cdot A\right)\right)\right)\right)} \cdot \left(-\sqrt{C}\right)}{{B_m}^{2} - C \cdot \left(A \cdot 4\right)}\\

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


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

    1. Initial program 14.0%

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

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

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

        \[\leadsto \frac{-{\color{blue}{\left(\left(\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot 2\right) \cdot C\right)}}^{0.5}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      3. unpow-prod-down29.1%

        \[\leadsto \frac{-\color{blue}{{\left(\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot 2\right)}^{0.5} \cdot {C}^{0.5}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      4. *-commutative29.1%

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

        \[\leadsto \frac{-{\left(\left(2 \cdot \left(F \cdot \left({B}^{2} - \color{blue}{4 \cdot \left(A \cdot C\right)}\right)\right)\right) \cdot 2\right)}^{0.5} \cdot {C}^{0.5}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      6. *-commutative29.2%

        \[\leadsto \frac{-{\left(\left(2 \cdot \left(F \cdot \left({B}^{2} - 4 \cdot \color{blue}{\left(C \cdot A\right)}\right)\right)\right) \cdot 2\right)}^{0.5} \cdot {C}^{0.5}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      7. pow1/229.2%

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

      \[\leadsto \frac{-\color{blue}{{\left(\left(2 \cdot \left(F \cdot \left({B}^{2} - 4 \cdot \left(C \cdot A\right)\right)\right)\right) \cdot 2\right)}^{0.5} \cdot \sqrt{C}}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
    6. Step-by-step derivation
      1. unpow1/229.2%

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

        \[\leadsto \frac{-\sqrt{\color{blue}{2 \cdot \left(\left(F \cdot \left({B}^{2} - 4 \cdot \left(C \cdot A\right)\right)\right) \cdot 2\right)}} \cdot \sqrt{C}}{{B}^{2} - \left(4 \cdot A\right) \cdot C} \]
      3. cancel-sign-sub-inv29.2%

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

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

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

    if 9.99999999999999939e-99 < (pow.f64 B 2)

    1. Initial program 17.5%

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

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

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

        \[\leadsto -\color{blue}{\sqrt{F \cdot \left(C + \sqrt{{B}^{2} + {C}^{2}}\right)} \cdot \frac{\sqrt{2}}{B}} \]
      3. distribute-rgt-neg-in15.9%

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

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

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

        \[\leadsto \sqrt{F \cdot \left(C + \color{blue}{\mathsf{hypot}\left(B, C\right)}\right)} \cdot \left(-\frac{\sqrt{2}}{B}\right) \]
    5. Simplified25.6%

      \[\leadsto \color{blue}{\sqrt{F \cdot \left(C + \mathsf{hypot}\left(B, C\right)\right)} \cdot \left(-\frac{\sqrt{2}}{B}\right)} \]
    6. Step-by-step derivation
      1. pow1/225.6%

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

        \[\leadsto {\color{blue}{\left(\left(C + \mathsf{hypot}\left(B, C\right)\right) \cdot F\right)}}^{0.5} \cdot \left(-\frac{\sqrt{2}}{B}\right) \]
      3. unpow-prod-down37.6%

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

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

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

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

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

Alternative 3: 43.8% accurate, 1.2× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ \begin{array}{l} t_0 := {B_m}^{2} + -4 \cdot \left(C \cdot A\right)\\ \mathbf{if}\;{B_m}^{2} \leq 10^{-98}:\\ \;\;\;\;\frac{1}{\frac{t_0}{-\sqrt{\left(t_0 \cdot \left(2 \cdot F\right)\right) \cdot \left(2 \cdot C\right)}}}\\ \mathbf{else}:\\ \;\;\;\;\left(\sqrt{C + \mathsf{hypot}\left(B_m, C\right)} \cdot \sqrt{F}\right) \cdot \frac{-\sqrt{2}}{B_m}\\ \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 (* C A)))))
   (if (<= (pow B_m 2.0) 1e-98)
     (/ 1.0 (/ t_0 (- (sqrt (* (* t_0 (* 2.0 F)) (* 2.0 C))))))
     (* (* (sqrt (+ C (hypot B_m C))) (sqrt F)) (/ (- (sqrt 2.0)) B_m)))))
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 * (C * A));
	double tmp;
	if (pow(B_m, 2.0) <= 1e-98) {
		tmp = 1.0 / (t_0 / -sqrt(((t_0 * (2.0 * F)) * (2.0 * C))));
	} else {
		tmp = (sqrt((C + hypot(B_m, C))) * sqrt(F)) * (-sqrt(2.0) / B_m);
	}
	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 * (C * A));
	double tmp;
	if (Math.pow(B_m, 2.0) <= 1e-98) {
		tmp = 1.0 / (t_0 / -Math.sqrt(((t_0 * (2.0 * F)) * (2.0 * C))));
	} else {
		tmp = (Math.sqrt((C + Math.hypot(B_m, C))) * Math.sqrt(F)) * (-Math.sqrt(2.0) / B_m);
	}
	return tmp;
}
B_m = math.fabs(B)
def code(A, B_m, C, F):
	t_0 = math.pow(B_m, 2.0) + (-4.0 * (C * A))
	tmp = 0
	if math.pow(B_m, 2.0) <= 1e-98:
		tmp = 1.0 / (t_0 / -math.sqrt(((t_0 * (2.0 * F)) * (2.0 * C))))
	else:
		tmp = (math.sqrt((C + math.hypot(B_m, C))) * math.sqrt(F)) * (-math.sqrt(2.0) / B_m)
	return tmp
B_m = abs(B)
function code(A, B_m, C, F)
	t_0 = Float64((B_m ^ 2.0) + Float64(-4.0 * Float64(C * A)))
	tmp = 0.0
	if ((B_m ^ 2.0) <= 1e-98)
		tmp = Float64(1.0 / Float64(t_0 / Float64(-sqrt(Float64(Float64(t_0 * Float64(2.0 * F)) * Float64(2.0 * C))))));
	else
		tmp = Float64(Float64(sqrt(Float64(C + hypot(B_m, C))) * sqrt(F)) * Float64(Float64(-sqrt(2.0)) / B_m));
	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 * (C * A));
	tmp = 0.0;
	if ((B_m ^ 2.0) <= 1e-98)
		tmp = 1.0 / (t_0 / -sqrt(((t_0 * (2.0 * F)) * (2.0 * C))));
	else
		tmp = (sqrt((C + hypot(B_m, C))) * sqrt(F)) * (-sqrt(2.0) / B_m);
	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[(-4.0 * N[(C * A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 1e-98], N[(1.0 / N[(t$95$0 / (-N[Sqrt[N[(N[(t$95$0 * N[(2.0 * F), $MachinePrecision]), $MachinePrecision] * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(C + N[Sqrt[B$95$m ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[F], $MachinePrecision]), $MachinePrecision] * N[((-N[Sqrt[2.0], $MachinePrecision]) / B$95$m), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
B_m = \left|B\right|

\\
\begin{array}{l}
t_0 := {B_m}^{2} + -4 \cdot \left(C \cdot A\right)\\
\mathbf{if}\;{B_m}^{2} \leq 10^{-98}:\\
\;\;\;\;\frac{1}{\frac{t_0}{-\sqrt{\left(t_0 \cdot \left(2 \cdot F\right)\right) \cdot \left(2 \cdot C\right)}}}\\

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


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

    1. Initial program 14.0%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{1}{\frac{{B}^{2} - 4 \cdot \left(C \cdot A\right)}{-\sqrt{2 \cdot \left(\left(F \cdot \left({B}^{2} - 4 \cdot \left(C \cdot A\right)\right)\right) \cdot \left(C \cdot 2\right)\right)}}}} \]
      2. cancel-sign-sub-inv28.3%

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

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

        \[\leadsto \frac{1}{\frac{{B}^{2} + -4 \cdot \left(C \cdot A\right)}{-\sqrt{\color{blue}{\left(2 \cdot \left(F \cdot \left({B}^{2} - 4 \cdot \left(C \cdot A\right)\right)\right)\right) \cdot \left(C \cdot 2\right)}}}} \]
      5. associate-*r*28.4%

        \[\leadsto \frac{1}{\frac{{B}^{2} + -4 \cdot \left(C \cdot A\right)}{-\sqrt{\color{blue}{\left(\left(2 \cdot F\right) \cdot \left({B}^{2} - 4 \cdot \left(C \cdot A\right)\right)\right)} \cdot \left(C \cdot 2\right)}}} \]
      6. cancel-sign-sub-inv28.4%

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

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

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

    if 9.99999999999999939e-99 < (pow.f64 B 2)

    1. Initial program 17.5%

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

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

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

        \[\leadsto -\color{blue}{\sqrt{F \cdot \left(C + \sqrt{{B}^{2} + {C}^{2}}\right)} \cdot \frac{\sqrt{2}}{B}} \]
      3. distribute-rgt-neg-in15.9%

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

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

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

        \[\leadsto \sqrt{F \cdot \left(C + \color{blue}{\mathsf{hypot}\left(B, C\right)}\right)} \cdot \left(-\frac{\sqrt{2}}{B}\right) \]
    5. Simplified25.6%

      \[\leadsto \color{blue}{\sqrt{F \cdot \left(C + \mathsf{hypot}\left(B, C\right)\right)} \cdot \left(-\frac{\sqrt{2}}{B}\right)} \]
    6. Step-by-step derivation
      1. pow1/225.6%

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

        \[\leadsto {\color{blue}{\left(\left(C + \mathsf{hypot}\left(B, C\right)\right) \cdot F\right)}}^{0.5} \cdot \left(-\frac{\sqrt{2}}{B}\right) \]
      3. unpow-prod-down37.6%

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

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

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

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

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

Alternative 4: 40.4% accurate, 1.9× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ \begin{array}{l} t_0 := {B_m}^{2} + -4 \cdot \left(C \cdot A\right)\\ \mathbf{if}\;B_m \leq 7.5 \cdot 10^{-49}:\\ \;\;\;\;\frac{1}{\frac{t_0}{-\sqrt{\left(t_0 \cdot \left(2 \cdot F\right)\right) \cdot \left(2 \cdot C\right)}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{2}}{B_m} \cdot \left(\sqrt{B_m + C} \cdot \left(-\sqrt{F}\right)\right)\\ \end{array} \end{array} \]
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
 :precision binary64
 (let* ((t_0 (+ (pow B_m 2.0) (* -4.0 (* C A)))))
   (if (<= B_m 7.5e-49)
     (/ 1.0 (/ t_0 (- (sqrt (* (* t_0 (* 2.0 F)) (* 2.0 C))))))
     (* (/ (sqrt 2.0) B_m) (* (sqrt (+ B_m C)) (- (sqrt F)))))))
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 * (C * A));
	double tmp;
	if (B_m <= 7.5e-49) {
		tmp = 1.0 / (t_0 / -sqrt(((t_0 * (2.0 * F)) * (2.0 * C))));
	} else {
		tmp = (sqrt(2.0) / B_m) * (sqrt((B_m + C)) * -sqrt(F));
	}
	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) :: t_0
    real(8) :: tmp
    t_0 = (b_m ** 2.0d0) + ((-4.0d0) * (c * a))
    if (b_m <= 7.5d-49) then
        tmp = 1.0d0 / (t_0 / -sqrt(((t_0 * (2.0d0 * f)) * (2.0d0 * c))))
    else
        tmp = (sqrt(2.0d0) / b_m) * (sqrt((b_m + c)) * -sqrt(f))
    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 t_0 = Math.pow(B_m, 2.0) + (-4.0 * (C * A));
	double tmp;
	if (B_m <= 7.5e-49) {
		tmp = 1.0 / (t_0 / -Math.sqrt(((t_0 * (2.0 * F)) * (2.0 * C))));
	} else {
		tmp = (Math.sqrt(2.0) / B_m) * (Math.sqrt((B_m + C)) * -Math.sqrt(F));
	}
	return tmp;
}
B_m = math.fabs(B)
def code(A, B_m, C, F):
	t_0 = math.pow(B_m, 2.0) + (-4.0 * (C * A))
	tmp = 0
	if B_m <= 7.5e-49:
		tmp = 1.0 / (t_0 / -math.sqrt(((t_0 * (2.0 * F)) * (2.0 * C))))
	else:
		tmp = (math.sqrt(2.0) / B_m) * (math.sqrt((B_m + C)) * -math.sqrt(F))
	return tmp
B_m = abs(B)
function code(A, B_m, C, F)
	t_0 = Float64((B_m ^ 2.0) + Float64(-4.0 * Float64(C * A)))
	tmp = 0.0
	if (B_m <= 7.5e-49)
		tmp = Float64(1.0 / Float64(t_0 / Float64(-sqrt(Float64(Float64(t_0 * Float64(2.0 * F)) * Float64(2.0 * C))))));
	else
		tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(sqrt(Float64(B_m + C)) * Float64(-sqrt(F))));
	end
	return tmp
end
B_m = abs(B);
function tmp_2 = code(A, B_m, C, F)
	t_0 = (B_m ^ 2.0) + (-4.0 * (C * A));
	tmp = 0.0;
	if (B_m <= 7.5e-49)
		tmp = 1.0 / (t_0 / -sqrt(((t_0 * (2.0 * F)) * (2.0 * C))));
	else
		tmp = (sqrt(2.0) / B_m) * (sqrt((B_m + C)) * -sqrt(F));
	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[(-4.0 * N[(C * A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B$95$m, 7.5e-49], N[(1.0 / N[(t$95$0 / (-N[Sqrt[N[(N[(t$95$0 * N[(2.0 * F), $MachinePrecision]), $MachinePrecision] * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * N[(N[Sqrt[N[(B$95$m + C), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[F], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
B_m = \left|B\right|

\\
\begin{array}{l}
t_0 := {B_m}^{2} + -4 \cdot \left(C \cdot A\right)\\
\mathbf{if}\;B_m \leq 7.5 \cdot 10^{-49}:\\
\;\;\;\;\frac{1}{\frac{t_0}{-\sqrt{\left(t_0 \cdot \left(2 \cdot F\right)\right) \cdot \left(2 \cdot C\right)}}}\\

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


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

    1. Initial program 12.1%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{1}{\frac{{B}^{2} - 4 \cdot \left(C \cdot A\right)}{-\sqrt{2 \cdot \left(\left(F \cdot \left({B}^{2} - 4 \cdot \left(C \cdot A\right)\right)\right) \cdot \left(C \cdot 2\right)\right)}}}} \]
      2. cancel-sign-sub-inv18.8%

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

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

        \[\leadsto \frac{1}{\frac{{B}^{2} + -4 \cdot \left(C \cdot A\right)}{-\sqrt{\color{blue}{\left(2 \cdot \left(F \cdot \left({B}^{2} - 4 \cdot \left(C \cdot A\right)\right)\right)\right) \cdot \left(C \cdot 2\right)}}}} \]
      5. associate-*r*18.8%

        \[\leadsto \frac{1}{\frac{{B}^{2} + -4 \cdot \left(C \cdot A\right)}{-\sqrt{\color{blue}{\left(\left(2 \cdot F\right) \cdot \left({B}^{2} - 4 \cdot \left(C \cdot A\right)\right)\right)} \cdot \left(C \cdot 2\right)}}} \]
      6. cancel-sign-sub-inv18.8%

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

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

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

    if 7.4999999999999998e-49 < B

    1. Initial program 24.1%

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

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

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

        \[\leadsto -\color{blue}{\sqrt{F \cdot \left(C + \sqrt{{B}^{2} + {C}^{2}}\right)} \cdot \frac{\sqrt{2}}{B}} \]
      3. distribute-rgt-neg-in28.2%

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

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

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

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

      \[\leadsto \color{blue}{\sqrt{F \cdot \left(C + \mathsf{hypot}\left(B, C\right)\right)} \cdot \left(-\frac{\sqrt{2}}{B}\right)} \]
    6. Step-by-step derivation
      1. pow1/245.0%

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

        \[\leadsto {\color{blue}{\left(\left(C + \mathsf{hypot}\left(B, C\right)\right) \cdot F\right)}}^{0.5} \cdot \left(-\frac{\sqrt{2}}{B}\right) \]
      3. unpow-prod-down66.9%

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

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

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

      \[\leadsto \color{blue}{\left(\sqrt{C + \mathsf{hypot}\left(B, C\right)} \cdot \sqrt{F}\right)} \cdot \left(-\frac{\sqrt{2}}{B}\right) \]
    8. Taylor expanded in C around 0 60.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;B \leq 7.5 \cdot 10^{-49}:\\ \;\;\;\;\frac{1}{\frac{{B}^{2} + -4 \cdot \left(C \cdot A\right)}{-\sqrt{\left(\left({B}^{2} + -4 \cdot \left(C \cdot A\right)\right) \cdot \left(2 \cdot F\right)\right) \cdot \left(2 \cdot C\right)}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(\sqrt{B + C} \cdot \left(-\sqrt{F}\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 40.5% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
t_0 := {B_m}^{2} - C \cdot \left(A \cdot 4\right)\\
\mathbf{if}\;B_m \leq 1.9 \cdot 10^{-49}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(F \cdot t_0\right)\right) \cdot \left(2 \cdot C\right)}}{t_0}\\

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


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

    1. Initial program 12.1%

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

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

    if 1.8999999999999999e-49 < B

    1. Initial program 24.1%

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

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

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

        \[\leadsto -\color{blue}{\sqrt{F \cdot \left(C + \sqrt{{B}^{2} + {C}^{2}}\right)} \cdot \frac{\sqrt{2}}{B}} \]
      3. distribute-rgt-neg-in28.2%

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

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

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

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

      \[\leadsto \color{blue}{\sqrt{F \cdot \left(C + \mathsf{hypot}\left(B, C\right)\right)} \cdot \left(-\frac{\sqrt{2}}{B}\right)} \]
    6. Step-by-step derivation
      1. pow1/245.0%

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

        \[\leadsto {\color{blue}{\left(\left(C + \mathsf{hypot}\left(B, C\right)\right) \cdot F\right)}}^{0.5} \cdot \left(-\frac{\sqrt{2}}{B}\right) \]
      3. unpow-prod-down66.9%

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

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

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

      \[\leadsto \color{blue}{\left(\sqrt{C + \mathsf{hypot}\left(B, C\right)} \cdot \sqrt{F}\right)} \cdot \left(-\frac{\sqrt{2}}{B}\right) \]
    8. Taylor expanded in C around 0 60.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;B \leq 1.9 \cdot 10^{-49}:\\ \;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(F \cdot \left({B}^{2} - C \cdot \left(A \cdot 4\right)\right)\right)\right) \cdot \left(2 \cdot C\right)}}{{B}^{2} - C \cdot \left(A \cdot 4\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(\sqrt{B + C} \cdot \left(-\sqrt{F}\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 40.5% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;B_m \leq 4.8 \cdot 10^{-49}:\\
\;\;\;\;\frac{-\sqrt{4 \cdot \left(C \cdot \left(F \cdot \left({B_m}^{2} - 4 \cdot \left(C \cdot A\right)\right)\right)\right)}}{{B_m}^{2} - C \cdot \left(A \cdot 4\right)}\\

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


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

    1. Initial program 12.1%

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

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

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

    if 4.79999999999999985e-49 < B

    1. Initial program 24.1%

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

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

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

        \[\leadsto -\color{blue}{\sqrt{F \cdot \left(C + \sqrt{{B}^{2} + {C}^{2}}\right)} \cdot \frac{\sqrt{2}}{B}} \]
      3. distribute-rgt-neg-in28.2%

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

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

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

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

      \[\leadsto \color{blue}{\sqrt{F \cdot \left(C + \mathsf{hypot}\left(B, C\right)\right)} \cdot \left(-\frac{\sqrt{2}}{B}\right)} \]
    6. Step-by-step derivation
      1. pow1/245.0%

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

        \[\leadsto {\color{blue}{\left(\left(C + \mathsf{hypot}\left(B, C\right)\right) \cdot F\right)}}^{0.5} \cdot \left(-\frac{\sqrt{2}}{B}\right) \]
      3. unpow-prod-down66.9%

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

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

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

      \[\leadsto \color{blue}{\left(\sqrt{C + \mathsf{hypot}\left(B, C\right)} \cdot \sqrt{F}\right)} \cdot \left(-\frac{\sqrt{2}}{B}\right) \]
    8. Taylor expanded in C around 0 60.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;B \leq 4.8 \cdot 10^{-49}:\\ \;\;\;\;\frac{-\sqrt{4 \cdot \left(C \cdot \left(F \cdot \left({B}^{2} - 4 \cdot \left(C \cdot A\right)\right)\right)\right)}}{{B}^{2} - C \cdot \left(A \cdot 4\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(\sqrt{B + C} \cdot \left(-\sqrt{F}\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 39.8% accurate, 2.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;B_m \leq 1.05 \cdot 10^{-49}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot C\right) \cdot \left(2 \cdot \left(-4 \cdot \left(A \cdot \left(C \cdot F\right)\right)\right)\right)}}{{B_m}^{2} - C \cdot \left(A \cdot 4\right)}\\

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


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

    1. Initial program 12.1%

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

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

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

    if 1.0499999999999999e-49 < B

    1. Initial program 24.1%

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

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

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

        \[\leadsto -\color{blue}{\sqrt{F \cdot \left(C + \sqrt{{B}^{2} + {C}^{2}}\right)} \cdot \frac{\sqrt{2}}{B}} \]
      3. distribute-rgt-neg-in28.2%

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

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

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

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

      \[\leadsto \color{blue}{\sqrt{F \cdot \left(C + \mathsf{hypot}\left(B, C\right)\right)} \cdot \left(-\frac{\sqrt{2}}{B}\right)} \]
    6. Step-by-step derivation
      1. pow1/245.0%

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

        \[\leadsto {\color{blue}{\left(\left(C + \mathsf{hypot}\left(B, C\right)\right) \cdot F\right)}}^{0.5} \cdot \left(-\frac{\sqrt{2}}{B}\right) \]
      3. unpow-prod-down66.9%

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

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

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

      \[\leadsto \color{blue}{\left(\sqrt{C + \mathsf{hypot}\left(B, C\right)} \cdot \sqrt{F}\right)} \cdot \left(-\frac{\sqrt{2}}{B}\right) \]
    8. Taylor expanded in C around 0 60.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;B \leq 1.05 \cdot 10^{-49}:\\ \;\;\;\;\frac{-\sqrt{\left(2 \cdot C\right) \cdot \left(2 \cdot \left(-4 \cdot \left(A \cdot \left(C \cdot F\right)\right)\right)\right)}}{{B}^{2} - C \cdot \left(A \cdot 4\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(\sqrt{B + C} \cdot \left(-\sqrt{F}\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 39.7% accurate, 2.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;B_m \leq 7.8 \cdot 10^{-50}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot C\right) \cdot \left(2 \cdot \left(-4 \cdot \left(A \cdot \left(C \cdot F\right)\right)\right)\right)}}{{B_m}^{2} - C \cdot \left(A \cdot 4\right)}\\

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


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

    1. Initial program 12.1%

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

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

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

    if 7.80000000000000042e-50 < B

    1. Initial program 24.1%

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

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

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

        \[\leadsto -\color{blue}{\sqrt{F \cdot \left(C + \sqrt{{B}^{2} + {C}^{2}}\right)} \cdot \frac{\sqrt{2}}{B}} \]
      3. distribute-rgt-neg-in28.2%

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

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

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

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

      \[\leadsto \color{blue}{\sqrt{F \cdot \left(C + \mathsf{hypot}\left(B, C\right)\right)} \cdot \left(-\frac{\sqrt{2}}{B}\right)} \]
    6. Step-by-step derivation
      1. pow1/245.0%

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

        \[\leadsto {\color{blue}{\left(\left(C + \mathsf{hypot}\left(B, C\right)\right) \cdot F\right)}}^{0.5} \cdot \left(-\frac{\sqrt{2}}{B}\right) \]
      3. unpow-prod-down66.9%

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

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

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

      \[\leadsto \color{blue}{\left(\sqrt{C + \mathsf{hypot}\left(B, C\right)} \cdot \sqrt{F}\right)} \cdot \left(-\frac{\sqrt{2}}{B}\right) \]
    8. Taylor expanded in C around 0 60.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;B \leq 7.8 \cdot 10^{-50}:\\ \;\;\;\;\frac{-\sqrt{\left(2 \cdot C\right) \cdot \left(2 \cdot \left(-4 \cdot \left(A \cdot \left(C \cdot F\right)\right)\right)\right)}}{{B}^{2} - C \cdot \left(A \cdot 4\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{-\sqrt{2}}{B} \cdot \left(\sqrt{F} \cdot \sqrt{B}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 38.2% accurate, 2.9× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ \begin{array}{l} \mathbf{if}\;F \leq -3.2 \cdot 10^{-283}:\\ \;\;\;\;\sqrt{\frac{-F}{C}}\\ \mathbf{elif}\;F \leq 2.6 \cdot 10^{-69}:\\ \;\;\;\;\frac{\sqrt{2}}{B_m} \cdot \left(-\sqrt{B_m \cdot F}\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{F}{B_m}} \cdot \left(-\sqrt{2}\right)\\ \end{array} \end{array} \]
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
 :precision binary64
 (if (<= F -3.2e-283)
   (sqrt (/ (- F) C))
   (if (<= F 2.6e-69)
     (* (/ (sqrt 2.0) B_m) (- (sqrt (* B_m F))))
     (* (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.2e-283) {
		tmp = sqrt((-F / C));
	} else if (F <= 2.6e-69) {
		tmp = (sqrt(2.0) / B_m) * -sqrt((B_m * F));
	} 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.2d-283)) then
        tmp = sqrt((-f / c))
    else if (f <= 2.6d-69) then
        tmp = (sqrt(2.0d0) / b_m) * -sqrt((b_m * f))
    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.2e-283) {
		tmp = Math.sqrt((-F / C));
	} else if (F <= 2.6e-69) {
		tmp = (Math.sqrt(2.0) / B_m) * -Math.sqrt((B_m * F));
	} 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.2e-283:
		tmp = math.sqrt((-F / C))
	elif F <= 2.6e-69:
		tmp = (math.sqrt(2.0) / B_m) * -math.sqrt((B_m * F))
	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.2e-283)
		tmp = sqrt(Float64(Float64(-F) / C));
	elseif (F <= 2.6e-69)
		tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(-sqrt(Float64(B_m * F))));
	else
		tmp = Float64(sqrt(Float64(F / B_m)) * Float64(-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.2e-283)
		tmp = sqrt((-F / C));
	elseif (F <= 2.6e-69)
		tmp = (sqrt(2.0) / B_m) * -sqrt((B_m * F));
	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.2e-283], N[Sqrt[N[((-F) / C), $MachinePrecision]], $MachinePrecision], If[LessEqual[F, 2.6e-69], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * (-N[Sqrt[N[(B$95$m * F), $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.2 \cdot 10^{-283}:\\
\;\;\;\;\sqrt{\frac{-F}{C}}\\

\mathbf{elif}\;F \leq 2.6 \cdot 10^{-69}:\\
\;\;\;\;\frac{\sqrt{2}}{B_m} \cdot \left(-\sqrt{B_m \cdot F}\right)\\

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


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

    1. Initial program 13.1%

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

        \[\leadsto \color{blue}{\sqrt{\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}} \cdot \sqrt{\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. sqrt-unprod9.8%

        \[\leadsto \color{blue}{\sqrt{\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} \cdot \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}}} \]
      3. frac-times8.5%

        \[\leadsto \sqrt{\color{blue}{\frac{\left(-\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)}\right) \cdot \left(-\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)}\right)}{\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot \left({B}^{2} - \left(4 \cdot A\right) \cdot C\right)}}} \]
    4. Applied egg-rr19.0%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \sqrt{\color{blue}{-1 \cdot \frac{F}{C}}} \]
    8. Step-by-step derivation
      1. mul-1-neg55.7%

        \[\leadsto \sqrt{\color{blue}{-\frac{F}{C}}} \]
    9. Simplified55.7%

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

    if -3.20000000000000012e-283 < F < 2.6000000000000002e-69

    1. Initial program 19.8%

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

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

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

        \[\leadsto -\color{blue}{\sqrt{F \cdot \left(C + \sqrt{{B}^{2} + {C}^{2}}\right)} \cdot \frac{\sqrt{2}}{B}} \]
      3. distribute-rgt-neg-in15.4%

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

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

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

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

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

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

    if 2.6000000000000002e-69 < F

    1. Initial program 14.5%

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

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

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

        \[\leadsto -\color{blue}{\sqrt{F \cdot \left(C + \sqrt{{B}^{2} + {C}^{2}}\right)} \cdot \frac{\sqrt{2}}{B}} \]
      3. distribute-rgt-neg-in11.1%

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

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

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

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

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

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

        \[\leadsto \color{blue}{-\sqrt{\frac{F}{B}} \cdot \sqrt{2}} \]
    8. Simplified23.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -3.2 \cdot 10^{-283}:\\ \;\;\;\;\sqrt{\frac{-F}{C}}\\ \mathbf{elif}\;F \leq 2.6 \cdot 10^{-69}:\\ \;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{B \cdot F}\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{F}{B}} \cdot \left(-\sqrt{2}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 31.8% accurate, 3.0× speedup?

\[\begin{array}{l} B_m = \left|B\right| \\ \begin{array}{l} \mathbf{if}\;F \leq -2 \cdot 10^{-310}:\\ \;\;\;\;\sqrt{\frac{-F}{C}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{F}{B_m}} \cdot \left(-\sqrt{2}\right)\\ \end{array} \end{array} \]
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
 :precision binary64
 (if (<= F -2e-310) (sqrt (/ (- F) C)) (* (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 <= -2e-310) {
		tmp = sqrt((-F / C));
	} 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 <= (-2d-310)) then
        tmp = sqrt((-f / c))
    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 <= -2e-310) {
		tmp = Math.sqrt((-F / C));
	} 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 <= -2e-310:
		tmp = math.sqrt((-F / C))
	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 <= -2e-310)
		tmp = sqrt(Float64(Float64(-F) / C));
	else
		tmp = Float64(sqrt(Float64(F / B_m)) * Float64(-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 <= -2e-310)
		tmp = sqrt((-F / C));
	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, -2e-310], N[Sqrt[N[((-F) / C), $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 -2 \cdot 10^{-310}:\\
\;\;\;\;\sqrt{\frac{-F}{C}}\\

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


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

    1. Initial program 15.6%

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

        \[\leadsto \color{blue}{\sqrt{\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}} \cdot \sqrt{\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. sqrt-unprod12.2%

        \[\leadsto \color{blue}{\sqrt{\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} \cdot \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}}} \]
      3. frac-times11.0%

        \[\leadsto \sqrt{\color{blue}{\frac{\left(-\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)}\right) \cdot \left(-\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)}\right)}{\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot \left({B}^{2} - \left(4 \cdot A\right) \cdot C\right)}}} \]
    4. Applied egg-rr20.8%

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

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

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

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

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

        \[\leadsto \sqrt{\frac{2 \cdot \left(F \cdot \color{blue}{\mathsf{fma}\left(B, B, -4 \cdot \left(A \cdot C\right)\right)}\right)}{\frac{{\left({B}^{2} - 4 \cdot \left(A \cdot C\right)\right)}^{2}}{A + \left(C + \mathsf{hypot}\left(A - C, B\right)\right)}}} \]
      6. distribute-lft-neg-in21.3%

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

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

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

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

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

      \[\leadsto \sqrt{\color{blue}{-1 \cdot \frac{F}{C}}} \]
    8. Step-by-step derivation
      1. mul-1-neg52.3%

        \[\leadsto \sqrt{\color{blue}{-\frac{F}{C}}} \]
    9. Simplified52.3%

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

    if -1.999999999999994e-310 < F

    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. Add Preprocessing
    3. Taylor expanded in A around 0 12.8%

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

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

        \[\leadsto -\color{blue}{\sqrt{F \cdot \left(C + \sqrt{{B}^{2} + {C}^{2}}\right)} \cdot \frac{\sqrt{2}}{B}} \]
      3. distribute-rgt-neg-in12.8%

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

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

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

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

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

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

        \[\leadsto \color{blue}{-\sqrt{\frac{F}{B}} \cdot \sqrt{2}} \]
    8. Simplified21.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;F \leq -2 \cdot 10^{-310}:\\ \;\;\;\;\sqrt{\frac{-F}{C}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{F}{B}} \cdot \left(-\sqrt{2}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 14.4% accurate, 5.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;C \leq 6 \cdot 10^{+74}:\\
\;\;\;\;\sqrt{\frac{-F}{C}}\\

\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{-F}{A}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if C < 6e74

    1. Initial program 17.1%

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

        \[\leadsto \color{blue}{\sqrt{\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}} \cdot \sqrt{\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. sqrt-unprod1.3%

        \[\leadsto \color{blue}{\sqrt{\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} \cdot \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}}} \]
      3. frac-times0.9%

        \[\leadsto \sqrt{\color{blue}{\frac{\left(-\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)}\right) \cdot \left(-\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)}\right)}{\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot \left({B}^{2} - \left(4 \cdot A\right) \cdot C\right)}}} \]
    4. Applied egg-rr2.2%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \sqrt{\color{blue}{-1 \cdot \frac{F}{C}}} \]
    8. Step-by-step derivation
      1. mul-1-neg13.8%

        \[\leadsto \sqrt{\color{blue}{-\frac{F}{C}}} \]
    9. Simplified13.8%

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

    if 6e74 < C

    1. Initial program 12.5%

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

        \[\leadsto \color{blue}{\sqrt{\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}} \cdot \sqrt{\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. sqrt-unprod6.0%

        \[\leadsto \color{blue}{\sqrt{\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} \cdot \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}}} \]
      3. frac-times5.7%

        \[\leadsto \sqrt{\color{blue}{\frac{\left(-\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)}\right) \cdot \left(-\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)}\right)}{\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot \left({B}^{2} - \left(4 \cdot A\right) \cdot C\right)}}} \]
    4. Applied egg-rr9.5%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \sqrt{\color{blue}{-1 \cdot \frac{F}{A}}} \]
    8. Step-by-step derivation
      1. mul-1-neg19.8%

        \[\leadsto \sqrt{\color{blue}{-\frac{F}{A}}} \]
    9. Simplified19.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;C \leq 6 \cdot 10^{+74}:\\ \;\;\;\;\sqrt{\frac{-F}{C}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{-F}{A}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 11.3% accurate, 6.1× speedup?

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

\\
\sqrt{\frac{-F}{A}}
\end{array}
Derivation
  1. Initial program 16.1%

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

      \[\leadsto \color{blue}{\sqrt{\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}} \cdot \sqrt{\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. sqrt-unprod2.3%

      \[\leadsto \color{blue}{\sqrt{\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} \cdot \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}}} \]
    3. frac-times1.9%

      \[\leadsto \sqrt{\color{blue}{\frac{\left(-\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)}\right) \cdot \left(-\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)}\right)}{\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot \left({B}^{2} - \left(4 \cdot A\right) \cdot C\right)}}} \]
  4. Applied egg-rr3.7%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \sqrt{\color{blue}{-1 \cdot \frac{F}{A}}} \]
  8. Step-by-step derivation
    1. mul-1-neg8.7%

      \[\leadsto \sqrt{\color{blue}{-\frac{F}{A}}} \]
  9. Simplified8.7%

    \[\leadsto \sqrt{\color{blue}{-\frac{F}{A}}} \]
  10. Final simplification8.7%

    \[\leadsto \sqrt{\frac{-F}{A}} \]
  11. Add Preprocessing

Reproduce

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