jeff quadratic root 2

Percentage Accurate: 71.3% → 89.9%
Time: 23.2s
Alternatives: 7
Speedup: 1.0×

Specification

?
\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\\ \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - t\_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + t\_0}{2 \cdot a}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (sqrt (- (* b b) (* (* 4.0 a) c)))))
   (if (>= b 0.0) (/ (* 2.0 c) (- (- b) t_0)) (/ (+ (- b) t_0) (* 2.0 a)))))
double code(double a, double b, double c) {
	double t_0 = sqrt(((b * b) - ((4.0 * a) * c)));
	double tmp;
	if (b >= 0.0) {
		tmp = (2.0 * c) / (-b - t_0);
	} else {
		tmp = (-b + t_0) / (2.0 * a);
	}
	return tmp;
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8) :: t_0
    real(8) :: tmp
    t_0 = sqrt(((b * b) - ((4.0d0 * a) * c)))
    if (b >= 0.0d0) then
        tmp = (2.0d0 * c) / (-b - t_0)
    else
        tmp = (-b + t_0) / (2.0d0 * a)
    end if
    code = tmp
end function
public static double code(double a, double b, double c) {
	double t_0 = Math.sqrt(((b * b) - ((4.0 * a) * c)));
	double tmp;
	if (b >= 0.0) {
		tmp = (2.0 * c) / (-b - t_0);
	} else {
		tmp = (-b + t_0) / (2.0 * a);
	}
	return tmp;
}
def code(a, b, c):
	t_0 = math.sqrt(((b * b) - ((4.0 * a) * c)))
	tmp = 0
	if b >= 0.0:
		tmp = (2.0 * c) / (-b - t_0)
	else:
		tmp = (-b + t_0) / (2.0 * a)
	return tmp
function code(a, b, c)
	t_0 = sqrt(Float64(Float64(b * b) - Float64(Float64(4.0 * a) * c)))
	tmp = 0.0
	if (b >= 0.0)
		tmp = Float64(Float64(2.0 * c) / Float64(Float64(-b) - t_0));
	else
		tmp = Float64(Float64(Float64(-b) + t_0) / Float64(2.0 * a));
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	t_0 = sqrt(((b * b) - ((4.0 * a) * c)));
	tmp = 0.0;
	if (b >= 0.0)
		tmp = (2.0 * c) / (-b - t_0);
	else
		tmp = (-b + t_0) / (2.0 * a);
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := Block[{t$95$0 = N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(4.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[GreaterEqual[b, 0.0], N[(N[(2.0 * c), $MachinePrecision] / N[((-b) - t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[((-b) + t$95$0), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\\
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) - t\_0}\\

\mathbf{else}:\\
\;\;\;\;\frac{\left(-b\right) + t\_0}{2 \cdot a}\\


\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 7 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: 71.3% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\\ \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - t\_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + t\_0}{2 \cdot a}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (sqrt (- (* b b) (* (* 4.0 a) c)))))
   (if (>= b 0.0) (/ (* 2.0 c) (- (- b) t_0)) (/ (+ (- b) t_0) (* 2.0 a)))))
double code(double a, double b, double c) {
	double t_0 = sqrt(((b * b) - ((4.0 * a) * c)));
	double tmp;
	if (b >= 0.0) {
		tmp = (2.0 * c) / (-b - t_0);
	} else {
		tmp = (-b + t_0) / (2.0 * a);
	}
	return tmp;
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8) :: t_0
    real(8) :: tmp
    t_0 = sqrt(((b * b) - ((4.0d0 * a) * c)))
    if (b >= 0.0d0) then
        tmp = (2.0d0 * c) / (-b - t_0)
    else
        tmp = (-b + t_0) / (2.0d0 * a)
    end if
    code = tmp
end function
public static double code(double a, double b, double c) {
	double t_0 = Math.sqrt(((b * b) - ((4.0 * a) * c)));
	double tmp;
	if (b >= 0.0) {
		tmp = (2.0 * c) / (-b - t_0);
	} else {
		tmp = (-b + t_0) / (2.0 * a);
	}
	return tmp;
}
def code(a, b, c):
	t_0 = math.sqrt(((b * b) - ((4.0 * a) * c)))
	tmp = 0
	if b >= 0.0:
		tmp = (2.0 * c) / (-b - t_0)
	else:
		tmp = (-b + t_0) / (2.0 * a)
	return tmp
function code(a, b, c)
	t_0 = sqrt(Float64(Float64(b * b) - Float64(Float64(4.0 * a) * c)))
	tmp = 0.0
	if (b >= 0.0)
		tmp = Float64(Float64(2.0 * c) / Float64(Float64(-b) - t_0));
	else
		tmp = Float64(Float64(Float64(-b) + t_0) / Float64(2.0 * a));
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	t_0 = sqrt(((b * b) - ((4.0 * a) * c)));
	tmp = 0.0;
	if (b >= 0.0)
		tmp = (2.0 * c) / (-b - t_0);
	else
		tmp = (-b + t_0) / (2.0 * a);
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := Block[{t$95$0 = N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(4.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[GreaterEqual[b, 0.0], N[(N[(2.0 * c), $MachinePrecision] / N[((-b) - t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[((-b) + t$95$0), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\\
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) - t\_0}\\

\mathbf{else}:\\
\;\;\;\;\frac{\left(-b\right) + t\_0}{2 \cdot a}\\


\end{array}
\end{array}

Alternative 1: 89.9% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}\\ t_1 := a \cdot \frac{c}{b}\\ \mathbf{if}\;b \leq -5.8 \cdot 10^{+97}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot \left(-c\right)}{b + \left(b + -2 \cdot t\_1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) - \mathsf{fma}\left(-2, t\_1, b\right)}{2 \cdot a}\\ \end{array}\\ \mathbf{elif}\;b \leq 3.4 \cdot 10^{+79}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;c \cdot \frac{-2}{b + t\_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{b - t\_0}{-2 \cdot a}\\ \end{array}\\ \mathbf{elif}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - b}\\ \mathbf{else}:\\ \;\;\;\;\frac{b - b}{2 \cdot a}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (sqrt (fma c (* a -4.0) (* b b)))) (t_1 (* a (/ c b))))
   (if (<= b -5.8e+97)
     (if (>= b 0.0)
       (/ (* 2.0 (- c)) (+ b (+ b (* -2.0 t_1))))
       (/ (- (- b) (fma -2.0 t_1 b)) (* 2.0 a)))
     (if (<= b 3.4e+79)
       (if (>= b 0.0) (* c (/ -2.0 (+ b t_0))) (/ (- b t_0) (* -2.0 a)))
       (if (>= b 0.0) (/ (* 2.0 c) (- (- b) b)) (/ (- b b) (* 2.0 a)))))))
double code(double a, double b, double c) {
	double t_0 = sqrt(fma(c, (a * -4.0), (b * b)));
	double t_1 = a * (c / b);
	double tmp_1;
	if (b <= -5.8e+97) {
		double tmp_2;
		if (b >= 0.0) {
			tmp_2 = (2.0 * -c) / (b + (b + (-2.0 * t_1)));
		} else {
			tmp_2 = (-b - fma(-2.0, t_1, b)) / (2.0 * a);
		}
		tmp_1 = tmp_2;
	} else if (b <= 3.4e+79) {
		double tmp_3;
		if (b >= 0.0) {
			tmp_3 = c * (-2.0 / (b + t_0));
		} else {
			tmp_3 = (b - t_0) / (-2.0 * a);
		}
		tmp_1 = tmp_3;
	} else if (b >= 0.0) {
		tmp_1 = (2.0 * c) / (-b - b);
	} else {
		tmp_1 = (b - b) / (2.0 * a);
	}
	return tmp_1;
}
function code(a, b, c)
	t_0 = sqrt(fma(c, Float64(a * -4.0), Float64(b * b)))
	t_1 = Float64(a * Float64(c / b))
	tmp_1 = 0.0
	if (b <= -5.8e+97)
		tmp_2 = 0.0
		if (b >= 0.0)
			tmp_2 = Float64(Float64(2.0 * Float64(-c)) / Float64(b + Float64(b + Float64(-2.0 * t_1))));
		else
			tmp_2 = Float64(Float64(Float64(-b) - fma(-2.0, t_1, b)) / Float64(2.0 * a));
		end
		tmp_1 = tmp_2;
	elseif (b <= 3.4e+79)
		tmp_3 = 0.0
		if (b >= 0.0)
			tmp_3 = Float64(c * Float64(-2.0 / Float64(b + t_0)));
		else
			tmp_3 = Float64(Float64(b - t_0) / Float64(-2.0 * a));
		end
		tmp_1 = tmp_3;
	elseif (b >= 0.0)
		tmp_1 = Float64(Float64(2.0 * c) / Float64(Float64(-b) - b));
	else
		tmp_1 = Float64(Float64(b - b) / Float64(2.0 * a));
	end
	return tmp_1
end
code[a_, b_, c_] := Block[{t$95$0 = N[Sqrt[N[(c * N[(a * -4.0), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(a * N[(c / b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -5.8e+97], If[GreaterEqual[b, 0.0], N[(N[(2.0 * (-c)), $MachinePrecision] / N[(b + N[(b + N[(-2.0 * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[((-b) - N[(-2.0 * t$95$1 + b), $MachinePrecision]), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]], If[LessEqual[b, 3.4e+79], If[GreaterEqual[b, 0.0], N[(c * N[(-2.0 / N[(b + t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(b - t$95$0), $MachinePrecision] / N[(-2.0 * a), $MachinePrecision]), $MachinePrecision]], If[GreaterEqual[b, 0.0], N[(N[(2.0 * c), $MachinePrecision] / N[((-b) - b), $MachinePrecision]), $MachinePrecision], N[(N[(b - b), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}\\
t_1 := a \cdot \frac{c}{b}\\
\mathbf{if}\;b \leq -5.8 \cdot 10^{+97}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot \left(-c\right)}{b + \left(b + -2 \cdot t\_1\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{\left(-b\right) - \mathsf{fma}\left(-2, t\_1, b\right)}{2 \cdot a}\\


\end{array}\\

\mathbf{elif}\;b \leq 3.4 \cdot 10^{+79}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;c \cdot \frac{-2}{b + t\_0}\\

\mathbf{else}:\\
\;\;\;\;\frac{b - t\_0}{-2 \cdot a}\\


\end{array}\\

\mathbf{elif}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) - b}\\

\mathbf{else}:\\
\;\;\;\;\frac{b - b}{2 \cdot a}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if b < -5.79999999999999974e97

    1. Initial program 54.9%

      \[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
    2. Add Preprocessing
    3. Taylor expanded in a around 0 54.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \color{blue}{\left(b + -2 \cdot \frac{a \cdot c}{b}\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
    4. Step-by-step derivation
      1. associate-/l*54.9%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \color{blue}{\left(a \cdot \frac{c}{b}\right)}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
    5. Simplified54.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \color{blue}{\left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
    6. Taylor expanded in a around 0 2.1%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)}{2 \cdot a}\\ \end{array} \]
    7. Step-by-step derivation
      1. neg-sub02.1%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(0 - b\right) + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)}{2 \cdot a}\\ \end{array} \]
      2. associate-+l-2.1%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b - \left(b + -2 \cdot \frac{a \cdot c}{b}\right)\right)}{2 \cdot a}\\ \end{array} \]
      3. sub-neg2.1%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(-\left(b + -2 \cdot \frac{a \cdot c}{b}\right)\right)\right)}{2 \cdot a}\\ \end{array} \]
      4. distribute-neg-in2.1%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(\left(-b\right) + \left(--2 \cdot \frac{a \cdot c}{b}\right)\right)\right)}{2 \cdot a}\\ \end{array} \]
      5. add-sqr-sqrt12.5%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(\sqrt{-b} \cdot \sqrt{-b} + \left(--2 \cdot \frac{a \cdot c}{b}\right)\right)\right)}{2 \cdot a}\\ \end{array} \]
      6. sqrt-unprod0.9%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(\sqrt{\left(-b\right) \cdot \left(-b\right)} + \left(--2 \cdot \frac{a \cdot c}{b}\right)\right)\right)}{2 \cdot a}\\ \end{array} \]
      7. sqr-neg0.9%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(\sqrt{b \cdot b} + \left(--2 \cdot \frac{a \cdot c}{b}\right)\right)\right)}{2 \cdot a}\\ \end{array} \]
      8. sqrt-prod0.0%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(\sqrt{b} \cdot \sqrt{b} + \left(--2 \cdot \frac{a \cdot c}{b}\right)\right)\right)}{2 \cdot a}\\ \end{array} \]
      9. add-sqr-sqrt86.4%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(b + \left(--2 \cdot \frac{a \cdot c}{b}\right)\right)\right)}{2 \cdot a}\\ \end{array} \]
      10. sub-neg86.4%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(b - -2 \cdot \frac{a \cdot c}{b}\right)\right)}{2 \cdot a}\\ \end{array} \]
      11. associate-*r/94.0%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(b - -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)\right)}{2 \cdot a}\\ \end{array} \]
      12. *-commutative94.0%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(b - \left(a \cdot \frac{c}{b}\right) \cdot -2\right)\right)}{2 \cdot a}\\ \end{array} \]
      13. cancel-sign-sub-inv94.0%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(b + \left(-a \cdot \frac{c}{b}\right) \cdot -2\right)\right)}{2 \cdot a}\\ \end{array} \]
      14. associate-*r/86.4%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(b + \left(-\frac{a \cdot c}{b}\right) \cdot -2\right)\right)}{2 \cdot a}\\ \end{array} \]
      15. add-sqr-sqrt0.0%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(b + \left(-\frac{a \cdot c}{\sqrt{b} \cdot \sqrt{b}}\right) \cdot -2\right)\right)}{2 \cdot a}\\ \end{array} \]
      16. sqrt-prod86.5%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(b + \left(-\frac{a \cdot c}{\sqrt{b \cdot b}}\right) \cdot -2\right)\right)}{2 \cdot a}\\ \end{array} \]
      17. sqr-neg86.5%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(b + \left(-\frac{a \cdot c}{\sqrt{\left(-b\right) \cdot \left(-b\right)}}\right) \cdot -2\right)\right)}{2 \cdot a}\\ \end{array} \]
      18. sqrt-unprod86.8%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(b + \left(-\frac{a \cdot c}{\sqrt{-b} \cdot \sqrt{-b}}\right) \cdot -2\right)\right)}{2 \cdot a}\\ \end{array} \]
      19. add-sqr-sqrt86.8%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(b + \left(-\frac{a \cdot c}{-b}\right) \cdot -2\right)\right)}{2 \cdot a}\\ \end{array} \]
      20. distribute-frac-neg86.8%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(b + \frac{-a \cdot c}{-b} \cdot -2\right)\right)}{2 \cdot a}\\ \end{array} \]
      21. frac-2neg86.8%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(b + \frac{a \cdot c}{b} \cdot -2\right)\right)}{2 \cdot a}\\ \end{array} \]
      22. associate-*r/95.3%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(b + \left(a \cdot \frac{c}{b}\right) \cdot -2\right)\right)}{2 \cdot a}\\ \end{array} \]
    8. Applied egg-rr95.3%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \mathsf{fma}\left(-2, \frac{a}{\frac{b}{c}}, b\right)\right)}{2 \cdot a}\\ \end{array} \]
    9. Step-by-step derivation
      1. associate--r+95.3%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(0 - b\right) - \mathsf{fma}\left(-2, \frac{a}{\frac{b}{c}}, b\right)}{2 \cdot a}\\ \end{array} \]
      2. neg-sub095.3%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) - \mathsf{fma}\left(-2, \frac{a}{\frac{b}{c}}, b\right)}{2 \cdot a}\\ \end{array} \]
      3. associate-/r/95.3%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) - \mathsf{fma}\left(-2, \frac{a}{b} \cdot c, b\right)}{2 \cdot a}\\ \end{array} \]
      4. associate-*l/86.8%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) - \mathsf{fma}\left(-2, \frac{a \cdot c}{b}, b\right)}{2 \cdot a}\\ \end{array} \]
      5. associate-/l*95.3%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) - \mathsf{fma}\left(-2, a \cdot \frac{c}{b}, b\right)}{2 \cdot a}\\ \end{array} \]
    10. Simplified95.3%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) - \mathsf{fma}\left(-2, a \cdot \frac{c}{b}, b\right)}{2 \cdot a}\\ \end{array} \]

    if -5.79999999999999974e97 < b < 3.40000000000000032e79

    1. Initial program 84.3%

      \[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
    2. Simplified84.9%

      \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;b \geq 0:\\ \;\;\;\;c \cdot \frac{-2}{b + \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{b - \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}}{a \cdot -2}\\ } \end{array}} \]
    3. Add Preprocessing

    if 3.40000000000000032e79 < b

    1. Initial program 61.6%

      \[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
    2. Add Preprocessing
    3. Taylor expanded in b around inf 98.4%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \color{blue}{b}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
    4. Taylor expanded in b around inf 98.4%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - b}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + b}{2 \cdot a}\\ \end{array} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification90.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -5.8 \cdot 10^{+97}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot \left(-c\right)}{b + \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) - \mathsf{fma}\left(-2, a \cdot \frac{c}{b}, b\right)}{2 \cdot a}\\ \end{array}\\ \mathbf{elif}\;b \leq 3.4 \cdot 10^{+79}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;c \cdot \frac{-2}{b + \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{b - \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}}{-2 \cdot a}\\ \end{array}\\ \mathbf{elif}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - b}\\ \mathbf{else}:\\ \;\;\;\;\frac{b - b}{2 \cdot a}\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 90.0% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)}\\ t_1 := a \cdot \frac{c}{b}\\ \mathbf{if}\;b \leq -3 \cdot 10^{+98}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot \left(-c\right)}{b + \left(b + -2 \cdot t\_1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) - \mathsf{fma}\left(-2, t\_1, b\right)}{2 \cdot a}\\ \end{array}\\ \mathbf{elif}\;b \leq 5.2 \cdot 10^{+81}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - t\_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{t\_0 - b}{2 \cdot a}\\ \end{array}\\ \mathbf{elif}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - b}\\ \mathbf{else}:\\ \;\;\;\;\frac{b - b}{2 \cdot a}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (sqrt (- (* b b) (* c (* a 4.0))))) (t_1 (* a (/ c b))))
   (if (<= b -3e+98)
     (if (>= b 0.0)
       (/ (* 2.0 (- c)) (+ b (+ b (* -2.0 t_1))))
       (/ (- (- b) (fma -2.0 t_1 b)) (* 2.0 a)))
     (if (<= b 5.2e+81)
       (if (>= b 0.0) (/ (* 2.0 c) (- (- b) t_0)) (/ (- t_0 b) (* 2.0 a)))
       (if (>= b 0.0) (/ (* 2.0 c) (- (- b) b)) (/ (- b b) (* 2.0 a)))))))
double code(double a, double b, double c) {
	double t_0 = sqrt(((b * b) - (c * (a * 4.0))));
	double t_1 = a * (c / b);
	double tmp_1;
	if (b <= -3e+98) {
		double tmp_2;
		if (b >= 0.0) {
			tmp_2 = (2.0 * -c) / (b + (b + (-2.0 * t_1)));
		} else {
			tmp_2 = (-b - fma(-2.0, t_1, b)) / (2.0 * a);
		}
		tmp_1 = tmp_2;
	} else if (b <= 5.2e+81) {
		double tmp_3;
		if (b >= 0.0) {
			tmp_3 = (2.0 * c) / (-b - t_0);
		} else {
			tmp_3 = (t_0 - b) / (2.0 * a);
		}
		tmp_1 = tmp_3;
	} else if (b >= 0.0) {
		tmp_1 = (2.0 * c) / (-b - b);
	} else {
		tmp_1 = (b - b) / (2.0 * a);
	}
	return tmp_1;
}
function code(a, b, c)
	t_0 = sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 4.0))))
	t_1 = Float64(a * Float64(c / b))
	tmp_1 = 0.0
	if (b <= -3e+98)
		tmp_2 = 0.0
		if (b >= 0.0)
			tmp_2 = Float64(Float64(2.0 * Float64(-c)) / Float64(b + Float64(b + Float64(-2.0 * t_1))));
		else
			tmp_2 = Float64(Float64(Float64(-b) - fma(-2.0, t_1, b)) / Float64(2.0 * a));
		end
		tmp_1 = tmp_2;
	elseif (b <= 5.2e+81)
		tmp_3 = 0.0
		if (b >= 0.0)
			tmp_3 = Float64(Float64(2.0 * c) / Float64(Float64(-b) - t_0));
		else
			tmp_3 = Float64(Float64(t_0 - b) / Float64(2.0 * a));
		end
		tmp_1 = tmp_3;
	elseif (b >= 0.0)
		tmp_1 = Float64(Float64(2.0 * c) / Float64(Float64(-b) - b));
	else
		tmp_1 = Float64(Float64(b - b) / Float64(2.0 * a));
	end
	return tmp_1
end
code[a_, b_, c_] := Block[{t$95$0 = N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(c * N[(a * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(a * N[(c / b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -3e+98], If[GreaterEqual[b, 0.0], N[(N[(2.0 * (-c)), $MachinePrecision] / N[(b + N[(b + N[(-2.0 * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[((-b) - N[(-2.0 * t$95$1 + b), $MachinePrecision]), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]], If[LessEqual[b, 5.2e+81], If[GreaterEqual[b, 0.0], N[(N[(2.0 * c), $MachinePrecision] / N[((-b) - t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 - b), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]], If[GreaterEqual[b, 0.0], N[(N[(2.0 * c), $MachinePrecision] / N[((-b) - b), $MachinePrecision]), $MachinePrecision], N[(N[(b - b), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)}\\
t_1 := a \cdot \frac{c}{b}\\
\mathbf{if}\;b \leq -3 \cdot 10^{+98}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot \left(-c\right)}{b + \left(b + -2 \cdot t\_1\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{\left(-b\right) - \mathsf{fma}\left(-2, t\_1, b\right)}{2 \cdot a}\\


\end{array}\\

\mathbf{elif}\;b \leq 5.2 \cdot 10^{+81}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) - t\_0}\\

\mathbf{else}:\\
\;\;\;\;\frac{t\_0 - b}{2 \cdot a}\\


\end{array}\\

\mathbf{elif}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) - b}\\

\mathbf{else}:\\
\;\;\;\;\frac{b - b}{2 \cdot a}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if b < -3.0000000000000001e98

    1. Initial program 54.9%

      \[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
    2. Add Preprocessing
    3. Taylor expanded in a around 0 54.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \color{blue}{\left(b + -2 \cdot \frac{a \cdot c}{b}\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
    4. Step-by-step derivation
      1. associate-/l*54.9%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \color{blue}{\left(a \cdot \frac{c}{b}\right)}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
    5. Simplified54.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \color{blue}{\left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
    6. Taylor expanded in a around 0 2.1%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)}{2 \cdot a}\\ \end{array} \]
    7. Step-by-step derivation
      1. neg-sub02.1%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(0 - b\right) + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)}{2 \cdot a}\\ \end{array} \]
      2. associate-+l-2.1%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b - \left(b + -2 \cdot \frac{a \cdot c}{b}\right)\right)}{2 \cdot a}\\ \end{array} \]
      3. sub-neg2.1%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(-\left(b + -2 \cdot \frac{a \cdot c}{b}\right)\right)\right)}{2 \cdot a}\\ \end{array} \]
      4. distribute-neg-in2.1%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(\left(-b\right) + \left(--2 \cdot \frac{a \cdot c}{b}\right)\right)\right)}{2 \cdot a}\\ \end{array} \]
      5. add-sqr-sqrt12.5%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(\sqrt{-b} \cdot \sqrt{-b} + \left(--2 \cdot \frac{a \cdot c}{b}\right)\right)\right)}{2 \cdot a}\\ \end{array} \]
      6. sqrt-unprod0.9%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(\sqrt{\left(-b\right) \cdot \left(-b\right)} + \left(--2 \cdot \frac{a \cdot c}{b}\right)\right)\right)}{2 \cdot a}\\ \end{array} \]
      7. sqr-neg0.9%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(\sqrt{b \cdot b} + \left(--2 \cdot \frac{a \cdot c}{b}\right)\right)\right)}{2 \cdot a}\\ \end{array} \]
      8. sqrt-prod0.0%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(\sqrt{b} \cdot \sqrt{b} + \left(--2 \cdot \frac{a \cdot c}{b}\right)\right)\right)}{2 \cdot a}\\ \end{array} \]
      9. add-sqr-sqrt86.4%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(b + \left(--2 \cdot \frac{a \cdot c}{b}\right)\right)\right)}{2 \cdot a}\\ \end{array} \]
      10. sub-neg86.4%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(b - -2 \cdot \frac{a \cdot c}{b}\right)\right)}{2 \cdot a}\\ \end{array} \]
      11. associate-*r/94.0%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(b - -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)\right)}{2 \cdot a}\\ \end{array} \]
      12. *-commutative94.0%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(b - \left(a \cdot \frac{c}{b}\right) \cdot -2\right)\right)}{2 \cdot a}\\ \end{array} \]
      13. cancel-sign-sub-inv94.0%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(b + \left(-a \cdot \frac{c}{b}\right) \cdot -2\right)\right)}{2 \cdot a}\\ \end{array} \]
      14. associate-*r/86.4%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(b + \left(-\frac{a \cdot c}{b}\right) \cdot -2\right)\right)}{2 \cdot a}\\ \end{array} \]
      15. add-sqr-sqrt0.0%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(b + \left(-\frac{a \cdot c}{\sqrt{b} \cdot \sqrt{b}}\right) \cdot -2\right)\right)}{2 \cdot a}\\ \end{array} \]
      16. sqrt-prod86.5%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(b + \left(-\frac{a \cdot c}{\sqrt{b \cdot b}}\right) \cdot -2\right)\right)}{2 \cdot a}\\ \end{array} \]
      17. sqr-neg86.5%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(b + \left(-\frac{a \cdot c}{\sqrt{\left(-b\right) \cdot \left(-b\right)}}\right) \cdot -2\right)\right)}{2 \cdot a}\\ \end{array} \]
      18. sqrt-unprod86.8%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(b + \left(-\frac{a \cdot c}{\sqrt{-b} \cdot \sqrt{-b}}\right) \cdot -2\right)\right)}{2 \cdot a}\\ \end{array} \]
      19. add-sqr-sqrt86.8%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(b + \left(-\frac{a \cdot c}{-b}\right) \cdot -2\right)\right)}{2 \cdot a}\\ \end{array} \]
      20. distribute-frac-neg86.8%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(b + \frac{-a \cdot c}{-b} \cdot -2\right)\right)}{2 \cdot a}\\ \end{array} \]
      21. frac-2neg86.8%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(b + \frac{a \cdot c}{b} \cdot -2\right)\right)}{2 \cdot a}\\ \end{array} \]
      22. associate-*r/95.3%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(b + \left(a \cdot \frac{c}{b}\right) \cdot -2\right)\right)}{2 \cdot a}\\ \end{array} \]
    8. Applied egg-rr95.3%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \mathsf{fma}\left(-2, \frac{a}{\frac{b}{c}}, b\right)\right)}{2 \cdot a}\\ \end{array} \]
    9. Step-by-step derivation
      1. associate--r+95.3%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(0 - b\right) - \mathsf{fma}\left(-2, \frac{a}{\frac{b}{c}}, b\right)}{2 \cdot a}\\ \end{array} \]
      2. neg-sub095.3%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) - \mathsf{fma}\left(-2, \frac{a}{\frac{b}{c}}, b\right)}{2 \cdot a}\\ \end{array} \]
      3. associate-/r/95.3%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) - \mathsf{fma}\left(-2, \frac{a}{b} \cdot c, b\right)}{2 \cdot a}\\ \end{array} \]
      4. associate-*l/86.8%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) - \mathsf{fma}\left(-2, \frac{a \cdot c}{b}, b\right)}{2 \cdot a}\\ \end{array} \]
      5. associate-/l*95.3%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) - \mathsf{fma}\left(-2, a \cdot \frac{c}{b}, b\right)}{2 \cdot a}\\ \end{array} \]
    10. Simplified95.3%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) - \mathsf{fma}\left(-2, a \cdot \frac{c}{b}, b\right)}{2 \cdot a}\\ \end{array} \]

    if -3.0000000000000001e98 < b < 5.19999999999999984e81

    1. Initial program 84.3%

      \[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
    2. Add Preprocessing

    if 5.19999999999999984e81 < b

    1. Initial program 61.6%

      \[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
    2. Add Preprocessing
    3. Taylor expanded in b around inf 98.4%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \color{blue}{b}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
    4. Taylor expanded in b around inf 98.4%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - b}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + b}{2 \cdot a}\\ \end{array} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification90.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -3 \cdot 10^{+98}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot \left(-c\right)}{b + \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) - \mathsf{fma}\left(-2, a \cdot \frac{c}{b}, b\right)}{2 \cdot a}\\ \end{array}\\ \mathbf{elif}\;b \leq 5.2 \cdot 10^{+81}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{2 \cdot a}\\ \end{array}\\ \mathbf{elif}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - b}\\ \mathbf{else}:\\ \;\;\;\;\frac{b - b}{2 \cdot a}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 78.9% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := a \cdot \frac{c}{b}\\ t_1 := \mathsf{fma}\left(-2, t\_0, b\right)\\ t_2 := \frac{2 \cdot \left(-c\right)}{b + \left(b + -2 \cdot t\_0\right)}\\ \mathbf{if}\;b \leq -1.2 \cdot 10^{+98}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;t\_2\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) - t\_1}{2 \cdot a}\\ \end{array}\\ \mathbf{elif}\;b \leq 10^{-283}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\left(2 \cdot c\right) \cdot \frac{1}{b - t\_1}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{2 \cdot a}\\ \end{array}\\ \mathbf{elif}\;b \geq 0:\\ \;\;\;\;t\_2\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(b + -2 \cdot \frac{c \cdot a}{b}\right) - b}{2 \cdot a}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (* a (/ c b)))
        (t_1 (fma -2.0 t_0 b))
        (t_2 (/ (* 2.0 (- c)) (+ b (+ b (* -2.0 t_0))))))
   (if (<= b -1.2e+98)
     (if (>= b 0.0) t_2 (/ (- (- b) t_1) (* 2.0 a)))
     (if (<= b 1e-283)
       (if (>= b 0.0)
         (* (* 2.0 c) (/ 1.0 (- b t_1)))
         (/ (- (sqrt (- (* b b) (* c (* a 4.0)))) b) (* 2.0 a)))
       (if (>= b 0.0) t_2 (/ (- (+ b (* -2.0 (/ (* c a) b))) b) (* 2.0 a)))))))
double code(double a, double b, double c) {
	double t_0 = a * (c / b);
	double t_1 = fma(-2.0, t_0, b);
	double t_2 = (2.0 * -c) / (b + (b + (-2.0 * t_0)));
	double tmp_1;
	if (b <= -1.2e+98) {
		double tmp_2;
		if (b >= 0.0) {
			tmp_2 = t_2;
		} else {
			tmp_2 = (-b - t_1) / (2.0 * a);
		}
		tmp_1 = tmp_2;
	} else if (b <= 1e-283) {
		double tmp_3;
		if (b >= 0.0) {
			tmp_3 = (2.0 * c) * (1.0 / (b - t_1));
		} else {
			tmp_3 = (sqrt(((b * b) - (c * (a * 4.0)))) - b) / (2.0 * a);
		}
		tmp_1 = tmp_3;
	} else if (b >= 0.0) {
		tmp_1 = t_2;
	} else {
		tmp_1 = ((b + (-2.0 * ((c * a) / b))) - b) / (2.0 * a);
	}
	return tmp_1;
}
function code(a, b, c)
	t_0 = Float64(a * Float64(c / b))
	t_1 = fma(-2.0, t_0, b)
	t_2 = Float64(Float64(2.0 * Float64(-c)) / Float64(b + Float64(b + Float64(-2.0 * t_0))))
	tmp_1 = 0.0
	if (b <= -1.2e+98)
		tmp_2 = 0.0
		if (b >= 0.0)
			tmp_2 = t_2;
		else
			tmp_2 = Float64(Float64(Float64(-b) - t_1) / Float64(2.0 * a));
		end
		tmp_1 = tmp_2;
	elseif (b <= 1e-283)
		tmp_3 = 0.0
		if (b >= 0.0)
			tmp_3 = Float64(Float64(2.0 * c) * Float64(1.0 / Float64(b - t_1)));
		else
			tmp_3 = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 4.0)))) - b) / Float64(2.0 * a));
		end
		tmp_1 = tmp_3;
	elseif (b >= 0.0)
		tmp_1 = t_2;
	else
		tmp_1 = Float64(Float64(Float64(b + Float64(-2.0 * Float64(Float64(c * a) / b))) - b) / Float64(2.0 * a));
	end
	return tmp_1
end
code[a_, b_, c_] := Block[{t$95$0 = N[(a * N[(c / b), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(-2.0 * t$95$0 + b), $MachinePrecision]}, Block[{t$95$2 = N[(N[(2.0 * (-c)), $MachinePrecision] / N[(b + N[(b + N[(-2.0 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -1.2e+98], If[GreaterEqual[b, 0.0], t$95$2, N[(N[((-b) - t$95$1), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]], If[LessEqual[b, 1e-283], If[GreaterEqual[b, 0.0], N[(N[(2.0 * c), $MachinePrecision] * N[(1.0 / N[(b - t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(c * N[(a * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]], If[GreaterEqual[b, 0.0], t$95$2, N[(N[(N[(b + N[(-2.0 * N[(N[(c * a), $MachinePrecision] / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := a \cdot \frac{c}{b}\\
t_1 := \mathsf{fma}\left(-2, t\_0, b\right)\\
t_2 := \frac{2 \cdot \left(-c\right)}{b + \left(b + -2 \cdot t\_0\right)}\\
\mathbf{if}\;b \leq -1.2 \cdot 10^{+98}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;t\_2\\

\mathbf{else}:\\
\;\;\;\;\frac{\left(-b\right) - t\_1}{2 \cdot a}\\


\end{array}\\

\mathbf{elif}\;b \leq 10^{-283}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\left(2 \cdot c\right) \cdot \frac{1}{b - t\_1}\\

\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{2 \cdot a}\\


\end{array}\\

\mathbf{elif}\;b \geq 0:\\
\;\;\;\;t\_2\\

\mathbf{else}:\\
\;\;\;\;\frac{\left(b + -2 \cdot \frac{c \cdot a}{b}\right) - b}{2 \cdot a}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if b < -1.1999999999999999e98

    1. Initial program 54.9%

      \[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
    2. Add Preprocessing
    3. Taylor expanded in a around 0 54.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \color{blue}{\left(b + -2 \cdot \frac{a \cdot c}{b}\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
    4. Step-by-step derivation
      1. associate-/l*54.9%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \color{blue}{\left(a \cdot \frac{c}{b}\right)}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
    5. Simplified54.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \color{blue}{\left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
    6. Taylor expanded in a around 0 2.1%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)}{2 \cdot a}\\ \end{array} \]
    7. Step-by-step derivation
      1. neg-sub02.1%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(0 - b\right) + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)}{2 \cdot a}\\ \end{array} \]
      2. associate-+l-2.1%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b - \left(b + -2 \cdot \frac{a \cdot c}{b}\right)\right)}{2 \cdot a}\\ \end{array} \]
      3. sub-neg2.1%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(-\left(b + -2 \cdot \frac{a \cdot c}{b}\right)\right)\right)}{2 \cdot a}\\ \end{array} \]
      4. distribute-neg-in2.1%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(\left(-b\right) + \left(--2 \cdot \frac{a \cdot c}{b}\right)\right)\right)}{2 \cdot a}\\ \end{array} \]
      5. add-sqr-sqrt12.5%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(\sqrt{-b} \cdot \sqrt{-b} + \left(--2 \cdot \frac{a \cdot c}{b}\right)\right)\right)}{2 \cdot a}\\ \end{array} \]
      6. sqrt-unprod0.9%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(\sqrt{\left(-b\right) \cdot \left(-b\right)} + \left(--2 \cdot \frac{a \cdot c}{b}\right)\right)\right)}{2 \cdot a}\\ \end{array} \]
      7. sqr-neg0.9%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(\sqrt{b \cdot b} + \left(--2 \cdot \frac{a \cdot c}{b}\right)\right)\right)}{2 \cdot a}\\ \end{array} \]
      8. sqrt-prod0.0%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(\sqrt{b} \cdot \sqrt{b} + \left(--2 \cdot \frac{a \cdot c}{b}\right)\right)\right)}{2 \cdot a}\\ \end{array} \]
      9. add-sqr-sqrt86.4%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(b + \left(--2 \cdot \frac{a \cdot c}{b}\right)\right)\right)}{2 \cdot a}\\ \end{array} \]
      10. sub-neg86.4%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(b - -2 \cdot \frac{a \cdot c}{b}\right)\right)}{2 \cdot a}\\ \end{array} \]
      11. associate-*r/94.0%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(b - -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)\right)}{2 \cdot a}\\ \end{array} \]
      12. *-commutative94.0%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(b - \left(a \cdot \frac{c}{b}\right) \cdot -2\right)\right)}{2 \cdot a}\\ \end{array} \]
      13. cancel-sign-sub-inv94.0%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(b + \left(-a \cdot \frac{c}{b}\right) \cdot -2\right)\right)}{2 \cdot a}\\ \end{array} \]
      14. associate-*r/86.4%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(b + \left(-\frac{a \cdot c}{b}\right) \cdot -2\right)\right)}{2 \cdot a}\\ \end{array} \]
      15. add-sqr-sqrt0.0%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(b + \left(-\frac{a \cdot c}{\sqrt{b} \cdot \sqrt{b}}\right) \cdot -2\right)\right)}{2 \cdot a}\\ \end{array} \]
      16. sqrt-prod86.5%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(b + \left(-\frac{a \cdot c}{\sqrt{b \cdot b}}\right) \cdot -2\right)\right)}{2 \cdot a}\\ \end{array} \]
      17. sqr-neg86.5%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(b + \left(-\frac{a \cdot c}{\sqrt{\left(-b\right) \cdot \left(-b\right)}}\right) \cdot -2\right)\right)}{2 \cdot a}\\ \end{array} \]
      18. sqrt-unprod86.8%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(b + \left(-\frac{a \cdot c}{\sqrt{-b} \cdot \sqrt{-b}}\right) \cdot -2\right)\right)}{2 \cdot a}\\ \end{array} \]
      19. add-sqr-sqrt86.8%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(b + \left(-\frac{a \cdot c}{-b}\right) \cdot -2\right)\right)}{2 \cdot a}\\ \end{array} \]
      20. distribute-frac-neg86.8%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(b + \frac{-a \cdot c}{-b} \cdot -2\right)\right)}{2 \cdot a}\\ \end{array} \]
      21. frac-2neg86.8%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(b + \frac{a \cdot c}{b} \cdot -2\right)\right)}{2 \cdot a}\\ \end{array} \]
      22. associate-*r/95.3%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(b + \left(a \cdot \frac{c}{b}\right) \cdot -2\right)\right)}{2 \cdot a}\\ \end{array} \]
    8. Applied egg-rr95.3%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \mathsf{fma}\left(-2, \frac{a}{\frac{b}{c}}, b\right)\right)}{2 \cdot a}\\ \end{array} \]
    9. Step-by-step derivation
      1. associate--r+95.3%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(0 - b\right) - \mathsf{fma}\left(-2, \frac{a}{\frac{b}{c}}, b\right)}{2 \cdot a}\\ \end{array} \]
      2. neg-sub095.3%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) - \mathsf{fma}\left(-2, \frac{a}{\frac{b}{c}}, b\right)}{2 \cdot a}\\ \end{array} \]
      3. associate-/r/95.3%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) - \mathsf{fma}\left(-2, \frac{a}{b} \cdot c, b\right)}{2 \cdot a}\\ \end{array} \]
      4. associate-*l/86.8%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) - \mathsf{fma}\left(-2, \frac{a \cdot c}{b}, b\right)}{2 \cdot a}\\ \end{array} \]
      5. associate-/l*95.3%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) - \mathsf{fma}\left(-2, a \cdot \frac{c}{b}, b\right)}{2 \cdot a}\\ \end{array} \]
    10. Simplified95.3%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) - \mathsf{fma}\left(-2, a \cdot \frac{c}{b}, b\right)}{2 \cdot a}\\ \end{array} \]

    if -1.1999999999999999e98 < b < 9.99999999999999947e-284

    1. Initial program 86.5%

      \[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
    2. Add Preprocessing
    3. Taylor expanded in a around 0 85.2%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \color{blue}{\left(b + -2 \cdot \frac{a \cdot c}{b}\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
    4. Step-by-step derivation
      1. associate-/l*85.2%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \color{blue}{\left(a \cdot \frac{c}{b}\right)}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
    5. Simplified85.2%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \color{blue}{\left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
    6. Step-by-step derivation
      1. div-inv85.2%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\color{blue}{\left(2 \cdot c\right) \cdot \frac{1}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
      2. *-commutative85.2%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\color{blue}{\left(c \cdot 2\right)} \cdot \frac{1}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
      3. add-sqr-sqrt85.0%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\left(c \cdot 2\right) \cdot \frac{1}{\color{blue}{\sqrt{-b} \cdot \sqrt{-b}} - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
      4. sqrt-unprod85.2%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\left(c \cdot 2\right) \cdot \frac{1}{\color{blue}{\sqrt{\left(-b\right) \cdot \left(-b\right)}} - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
      5. sqr-neg85.2%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\left(c \cdot 2\right) \cdot \frac{1}{\sqrt{\color{blue}{b \cdot b}} - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
      6. sqrt-prod85.2%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\left(c \cdot 2\right) \cdot \frac{1}{\color{blue}{\sqrt{b} \cdot \sqrt{b}} - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
      7. add-sqr-sqrt85.2%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\left(c \cdot 2\right) \cdot \frac{1}{\color{blue}{b} - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
      8. +-commutative85.2%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\left(c \cdot 2\right) \cdot \frac{1}{b - \color{blue}{\left(-2 \cdot \left(a \cdot \frac{c}{b}\right) + b\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
      9. fma-define85.2%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\left(c \cdot 2\right) \cdot \frac{1}{b - \color{blue}{\mathsf{fma}\left(-2, a \cdot \frac{c}{b}, b\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
    7. Applied egg-rr85.2%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\color{blue}{\left(c \cdot 2\right) \cdot \frac{1}{b - \mathsf{fma}\left(-2, a \cdot \frac{c}{b}, b\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]

    if 9.99999999999999947e-284 < b

    1. Initial program 72.7%

      \[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
    2. Add Preprocessing
    3. Taylor expanded in a around 0 66.5%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \color{blue}{\left(b + -2 \cdot \frac{a \cdot c}{b}\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
    4. Step-by-step derivation
      1. associate-/l*70.3%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \color{blue}{\left(a \cdot \frac{c}{b}\right)}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
    5. Simplified70.3%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \color{blue}{\left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
    6. Taylor expanded in a around 0 70.3%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)}{2 \cdot a}\\ \end{array} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification80.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -1.2 \cdot 10^{+98}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot \left(-c\right)}{b + \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) - \mathsf{fma}\left(-2, a \cdot \frac{c}{b}, b\right)}{2 \cdot a}\\ \end{array}\\ \mathbf{elif}\;b \leq 10^{-283}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\left(2 \cdot c\right) \cdot \frac{1}{b - \mathsf{fma}\left(-2, a \cdot \frac{c}{b}, b\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{2 \cdot a}\\ \end{array}\\ \mathbf{elif}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot \left(-c\right)}{b + \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(b + -2 \cdot \frac{c \cdot a}{b}\right) - b}{2 \cdot a}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 78.7% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := a \cdot \frac{c}{b}\\ \mathbf{if}\;b \leq -4 \cdot 10^{+98}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot \left(-c\right)}{b + \left(b + -2 \cdot t\_0\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) - \mathsf{fma}\left(-2, t\_0, b\right)}{2 \cdot a}\\ \end{array}\\ \mathbf{elif}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - b}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{2 \cdot a}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (* a (/ c b))))
   (if (<= b -4e+98)
     (if (>= b 0.0)
       (/ (* 2.0 (- c)) (+ b (+ b (* -2.0 t_0))))
       (/ (- (- b) (fma -2.0 t_0 b)) (* 2.0 a)))
     (if (>= b 0.0)
       (/ (* 2.0 c) (- (- b) b))
       (/ (- (sqrt (- (* b b) (* c (* a 4.0)))) b) (* 2.0 a))))))
double code(double a, double b, double c) {
	double t_0 = a * (c / b);
	double tmp_1;
	if (b <= -4e+98) {
		double tmp_2;
		if (b >= 0.0) {
			tmp_2 = (2.0 * -c) / (b + (b + (-2.0 * t_0)));
		} else {
			tmp_2 = (-b - fma(-2.0, t_0, b)) / (2.0 * a);
		}
		tmp_1 = tmp_2;
	} else if (b >= 0.0) {
		tmp_1 = (2.0 * c) / (-b - b);
	} else {
		tmp_1 = (sqrt(((b * b) - (c * (a * 4.0)))) - b) / (2.0 * a);
	}
	return tmp_1;
}
function code(a, b, c)
	t_0 = Float64(a * Float64(c / b))
	tmp_1 = 0.0
	if (b <= -4e+98)
		tmp_2 = 0.0
		if (b >= 0.0)
			tmp_2 = Float64(Float64(2.0 * Float64(-c)) / Float64(b + Float64(b + Float64(-2.0 * t_0))));
		else
			tmp_2 = Float64(Float64(Float64(-b) - fma(-2.0, t_0, b)) / Float64(2.0 * a));
		end
		tmp_1 = tmp_2;
	elseif (b >= 0.0)
		tmp_1 = Float64(Float64(2.0 * c) / Float64(Float64(-b) - b));
	else
		tmp_1 = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 4.0)))) - b) / Float64(2.0 * a));
	end
	return tmp_1
end
code[a_, b_, c_] := Block[{t$95$0 = N[(a * N[(c / b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -4e+98], If[GreaterEqual[b, 0.0], N[(N[(2.0 * (-c)), $MachinePrecision] / N[(b + N[(b + N[(-2.0 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[((-b) - N[(-2.0 * t$95$0 + b), $MachinePrecision]), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]], If[GreaterEqual[b, 0.0], N[(N[(2.0 * c), $MachinePrecision] / N[((-b) - b), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(c * N[(a * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := a \cdot \frac{c}{b}\\
\mathbf{if}\;b \leq -4 \cdot 10^{+98}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot \left(-c\right)}{b + \left(b + -2 \cdot t\_0\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{\left(-b\right) - \mathsf{fma}\left(-2, t\_0, b\right)}{2 \cdot a}\\


\end{array}\\

\mathbf{elif}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) - b}\\

\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{2 \cdot a}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < -3.99999999999999999e98

    1. Initial program 54.9%

      \[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
    2. Add Preprocessing
    3. Taylor expanded in a around 0 54.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \color{blue}{\left(b + -2 \cdot \frac{a \cdot c}{b}\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
    4. Step-by-step derivation
      1. associate-/l*54.9%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \color{blue}{\left(a \cdot \frac{c}{b}\right)}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
    5. Simplified54.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \color{blue}{\left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
    6. Taylor expanded in a around 0 2.1%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)}{2 \cdot a}\\ \end{array} \]
    7. Step-by-step derivation
      1. neg-sub02.1%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(0 - b\right) + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)}{2 \cdot a}\\ \end{array} \]
      2. associate-+l-2.1%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b - \left(b + -2 \cdot \frac{a \cdot c}{b}\right)\right)}{2 \cdot a}\\ \end{array} \]
      3. sub-neg2.1%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(-\left(b + -2 \cdot \frac{a \cdot c}{b}\right)\right)\right)}{2 \cdot a}\\ \end{array} \]
      4. distribute-neg-in2.1%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(\left(-b\right) + \left(--2 \cdot \frac{a \cdot c}{b}\right)\right)\right)}{2 \cdot a}\\ \end{array} \]
      5. add-sqr-sqrt12.5%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(\sqrt{-b} \cdot \sqrt{-b} + \left(--2 \cdot \frac{a \cdot c}{b}\right)\right)\right)}{2 \cdot a}\\ \end{array} \]
      6. sqrt-unprod0.9%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(\sqrt{\left(-b\right) \cdot \left(-b\right)} + \left(--2 \cdot \frac{a \cdot c}{b}\right)\right)\right)}{2 \cdot a}\\ \end{array} \]
      7. sqr-neg0.9%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(\sqrt{b \cdot b} + \left(--2 \cdot \frac{a \cdot c}{b}\right)\right)\right)}{2 \cdot a}\\ \end{array} \]
      8. sqrt-prod0.0%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(\sqrt{b} \cdot \sqrt{b} + \left(--2 \cdot \frac{a \cdot c}{b}\right)\right)\right)}{2 \cdot a}\\ \end{array} \]
      9. add-sqr-sqrt86.4%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(b + \left(--2 \cdot \frac{a \cdot c}{b}\right)\right)\right)}{2 \cdot a}\\ \end{array} \]
      10. sub-neg86.4%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(b - -2 \cdot \frac{a \cdot c}{b}\right)\right)}{2 \cdot a}\\ \end{array} \]
      11. associate-*r/94.0%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(b - -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)\right)}{2 \cdot a}\\ \end{array} \]
      12. *-commutative94.0%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(b - \left(a \cdot \frac{c}{b}\right) \cdot -2\right)\right)}{2 \cdot a}\\ \end{array} \]
      13. cancel-sign-sub-inv94.0%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(b + \left(-a \cdot \frac{c}{b}\right) \cdot -2\right)\right)}{2 \cdot a}\\ \end{array} \]
      14. associate-*r/86.4%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(b + \left(-\frac{a \cdot c}{b}\right) \cdot -2\right)\right)}{2 \cdot a}\\ \end{array} \]
      15. add-sqr-sqrt0.0%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(b + \left(-\frac{a \cdot c}{\sqrt{b} \cdot \sqrt{b}}\right) \cdot -2\right)\right)}{2 \cdot a}\\ \end{array} \]
      16. sqrt-prod86.5%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(b + \left(-\frac{a \cdot c}{\sqrt{b \cdot b}}\right) \cdot -2\right)\right)}{2 \cdot a}\\ \end{array} \]
      17. sqr-neg86.5%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(b + \left(-\frac{a \cdot c}{\sqrt{\left(-b\right) \cdot \left(-b\right)}}\right) \cdot -2\right)\right)}{2 \cdot a}\\ \end{array} \]
      18. sqrt-unprod86.8%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(b + \left(-\frac{a \cdot c}{\sqrt{-b} \cdot \sqrt{-b}}\right) \cdot -2\right)\right)}{2 \cdot a}\\ \end{array} \]
      19. add-sqr-sqrt86.8%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(b + \left(-\frac{a \cdot c}{-b}\right) \cdot -2\right)\right)}{2 \cdot a}\\ \end{array} \]
      20. distribute-frac-neg86.8%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(b + \frac{-a \cdot c}{-b} \cdot -2\right)\right)}{2 \cdot a}\\ \end{array} \]
      21. frac-2neg86.8%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(b + \frac{a \cdot c}{b} \cdot -2\right)\right)}{2 \cdot a}\\ \end{array} \]
      22. associate-*r/95.3%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(b + \left(a \cdot \frac{c}{b}\right) \cdot -2\right)\right)}{2 \cdot a}\\ \end{array} \]
    8. Applied egg-rr95.3%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \mathsf{fma}\left(-2, \frac{a}{\frac{b}{c}}, b\right)\right)}{2 \cdot a}\\ \end{array} \]
    9. Step-by-step derivation
      1. associate--r+95.3%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(0 - b\right) - \mathsf{fma}\left(-2, \frac{a}{\frac{b}{c}}, b\right)}{2 \cdot a}\\ \end{array} \]
      2. neg-sub095.3%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) - \mathsf{fma}\left(-2, \frac{a}{\frac{b}{c}}, b\right)}{2 \cdot a}\\ \end{array} \]
      3. associate-/r/95.3%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) - \mathsf{fma}\left(-2, \frac{a}{b} \cdot c, b\right)}{2 \cdot a}\\ \end{array} \]
      4. associate-*l/86.8%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) - \mathsf{fma}\left(-2, \frac{a \cdot c}{b}, b\right)}{2 \cdot a}\\ \end{array} \]
      5. associate-/l*95.3%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) - \mathsf{fma}\left(-2, a \cdot \frac{c}{b}, b\right)}{2 \cdot a}\\ \end{array} \]
    10. Simplified95.3%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) - \mathsf{fma}\left(-2, a \cdot \frac{c}{b}, b\right)}{2 \cdot a}\\ \end{array} \]

    if -3.99999999999999999e98 < b

    1. Initial program 77.8%

      \[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
    2. Add Preprocessing
    3. Taylor expanded in b around inf 75.1%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \color{blue}{b}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification79.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -4 \cdot 10^{+98}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot \left(-c\right)}{b + \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) - \mathsf{fma}\left(-2, a \cdot \frac{c}{b}, b\right)}{2 \cdot a}\\ \end{array}\\ \mathbf{elif}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - b}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{2 \cdot a}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 67.4% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := a \cdot \frac{c}{b}\\ \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot \left(-c\right)}{b + \left(b + -2 \cdot t\_0\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) - \mathsf{fma}\left(-2, t\_0, b\right)}{2 \cdot a}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (* a (/ c b))))
   (if (>= b 0.0)
     (/ (* 2.0 (- c)) (+ b (+ b (* -2.0 t_0))))
     (/ (- (- b) (fma -2.0 t_0 b)) (* 2.0 a)))))
double code(double a, double b, double c) {
	double t_0 = a * (c / b);
	double tmp;
	if (b >= 0.0) {
		tmp = (2.0 * -c) / (b + (b + (-2.0 * t_0)));
	} else {
		tmp = (-b - fma(-2.0, t_0, b)) / (2.0 * a);
	}
	return tmp;
}
function code(a, b, c)
	t_0 = Float64(a * Float64(c / b))
	tmp = 0.0
	if (b >= 0.0)
		tmp = Float64(Float64(2.0 * Float64(-c)) / Float64(b + Float64(b + Float64(-2.0 * t_0))));
	else
		tmp = Float64(Float64(Float64(-b) - fma(-2.0, t_0, b)) / Float64(2.0 * a));
	end
	return tmp
end
code[a_, b_, c_] := Block[{t$95$0 = N[(a * N[(c / b), $MachinePrecision]), $MachinePrecision]}, If[GreaterEqual[b, 0.0], N[(N[(2.0 * (-c)), $MachinePrecision] / N[(b + N[(b + N[(-2.0 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[((-b) - N[(-2.0 * t$95$0 + b), $MachinePrecision]), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := a \cdot \frac{c}{b}\\
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot \left(-c\right)}{b + \left(b + -2 \cdot t\_0\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{\left(-b\right) - \mathsf{fma}\left(-2, t\_0, b\right)}{2 \cdot a}\\


\end{array}
\end{array}
Derivation
  1. Initial program 72.5%

    \[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
  2. Add Preprocessing
  3. Taylor expanded in a around 0 69.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \color{blue}{\left(b + -2 \cdot \frac{a \cdot c}{b}\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
  4. Step-by-step derivation
    1. associate-/l*70.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \color{blue}{\left(a \cdot \frac{c}{b}\right)}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
  5. Simplified70.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \color{blue}{\left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
  6. Taylor expanded in a around 0 35.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)}{2 \cdot a}\\ \end{array} \]
  7. Step-by-step derivation
    1. neg-sub035.3%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(0 - b\right) + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)}{2 \cdot a}\\ \end{array} \]
    2. associate-+l-35.3%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b - \left(b + -2 \cdot \frac{a \cdot c}{b}\right)\right)}{2 \cdot a}\\ \end{array} \]
    3. sub-neg35.3%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(-\left(b + -2 \cdot \frac{a \cdot c}{b}\right)\right)\right)}{2 \cdot a}\\ \end{array} \]
    4. distribute-neg-in35.3%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(\left(-b\right) + \left(--2 \cdot \frac{a \cdot c}{b}\right)\right)\right)}{2 \cdot a}\\ \end{array} \]
    5. add-sqr-sqrt37.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(\sqrt{-b} \cdot \sqrt{-b} + \left(--2 \cdot \frac{a \cdot c}{b}\right)\right)\right)}{2 \cdot a}\\ \end{array} \]
    6. sqrt-unprod35.1%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(\sqrt{\left(-b\right) \cdot \left(-b\right)} + \left(--2 \cdot \frac{a \cdot c}{b}\right)\right)\right)}{2 \cdot a}\\ \end{array} \]
    7. sqr-neg35.1%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(\sqrt{b \cdot b} + \left(--2 \cdot \frac{a \cdot c}{b}\right)\right)\right)}{2 \cdot a}\\ \end{array} \]
    8. sqrt-prod34.3%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(\sqrt{b} \cdot \sqrt{b} + \left(--2 \cdot \frac{a \cdot c}{b}\right)\right)\right)}{2 \cdot a}\\ \end{array} \]
    9. add-sqr-sqrt65.4%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(b + \left(--2 \cdot \frac{a \cdot c}{b}\right)\right)\right)}{2 \cdot a}\\ \end{array} \]
    10. sub-neg65.4%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(b - -2 \cdot \frac{a \cdot c}{b}\right)\right)}{2 \cdot a}\\ \end{array} \]
    11. associate-*r/67.0%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(b - -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)\right)}{2 \cdot a}\\ \end{array} \]
    12. *-commutative67.0%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(b - \left(a \cdot \frac{c}{b}\right) \cdot -2\right)\right)}{2 \cdot a}\\ \end{array} \]
    13. cancel-sign-sub-inv67.0%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(b + \left(-a \cdot \frac{c}{b}\right) \cdot -2\right)\right)}{2 \cdot a}\\ \end{array} \]
    14. associate-*r/65.4%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(b + \left(-\frac{a \cdot c}{b}\right) \cdot -2\right)\right)}{2 \cdot a}\\ \end{array} \]
    15. add-sqr-sqrt34.3%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(b + \left(-\frac{a \cdot c}{\sqrt{b} \cdot \sqrt{b}}\right) \cdot -2\right)\right)}{2 \cdot a}\\ \end{array} \]
    16. sqrt-prod66.0%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(b + \left(-\frac{a \cdot c}{\sqrt{b \cdot b}}\right) \cdot -2\right)\right)}{2 \cdot a}\\ \end{array} \]
    17. sqr-neg66.0%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(b + \left(-\frac{a \cdot c}{\sqrt{\left(-b\right) \cdot \left(-b\right)}}\right) \cdot -2\right)\right)}{2 \cdot a}\\ \end{array} \]
    18. sqrt-unprod66.2%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(b + \left(-\frac{a \cdot c}{\sqrt{-b} \cdot \sqrt{-b}}\right) \cdot -2\right)\right)}{2 \cdot a}\\ \end{array} \]
    19. add-sqr-sqrt66.2%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(b + \left(-\frac{a \cdot c}{-b}\right) \cdot -2\right)\right)}{2 \cdot a}\\ \end{array} \]
    20. distribute-frac-neg66.2%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(b + \frac{-a \cdot c}{-b} \cdot -2\right)\right)}{2 \cdot a}\\ \end{array} \]
    21. frac-2neg66.2%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(b + \frac{a \cdot c}{b} \cdot -2\right)\right)}{2 \cdot a}\\ \end{array} \]
    22. associate-*r/68.1%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \left(b + \left(a \cdot \frac{c}{b}\right) \cdot -2\right)\right)}{2 \cdot a}\\ \end{array} \]
  8. Applied egg-rr68.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0 - \left(b + \mathsf{fma}\left(-2, \frac{a}{\frac{b}{c}}, b\right)\right)}{2 \cdot a}\\ \end{array} \]
  9. Step-by-step derivation
    1. associate--r+68.1%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(0 - b\right) - \mathsf{fma}\left(-2, \frac{a}{\frac{b}{c}}, b\right)}{2 \cdot a}\\ \end{array} \]
    2. neg-sub068.1%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) - \mathsf{fma}\left(-2, \frac{a}{\frac{b}{c}}, b\right)}{2 \cdot a}\\ \end{array} \]
    3. associate-/r/68.1%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) - \mathsf{fma}\left(-2, \frac{a}{b} \cdot c, b\right)}{2 \cdot a}\\ \end{array} \]
    4. associate-*l/66.2%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) - \mathsf{fma}\left(-2, \frac{a \cdot c}{b}, b\right)}{2 \cdot a}\\ \end{array} \]
    5. associate-/l*68.1%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) - \mathsf{fma}\left(-2, a \cdot \frac{c}{b}, b\right)}{2 \cdot a}\\ \end{array} \]
  10. Simplified68.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) - \mathsf{fma}\left(-2, a \cdot \frac{c}{b}, b\right)}{2 \cdot a}\\ \end{array} \]
  11. Final simplification68.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot \left(-c\right)}{b + \left(b + -2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) - \mathsf{fma}\left(-2, a \cdot \frac{c}{b}, b\right)}{2 \cdot a}\\ \end{array} \]
  12. Add Preprocessing

Alternative 6: 67.1% accurate, 9.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(-b\right) - b\\ \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{t\_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{t\_0}{2 \cdot a}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (- (- b) b)))
   (if (>= b 0.0) (/ (* 2.0 c) t_0) (/ t_0 (* 2.0 a)))))
double code(double a, double b, double c) {
	double t_0 = -b - b;
	double tmp;
	if (b >= 0.0) {
		tmp = (2.0 * c) / t_0;
	} else {
		tmp = t_0 / (2.0 * a);
	}
	return tmp;
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8) :: t_0
    real(8) :: tmp
    t_0 = -b - b
    if (b >= 0.0d0) then
        tmp = (2.0d0 * c) / t_0
    else
        tmp = t_0 / (2.0d0 * a)
    end if
    code = tmp
end function
public static double code(double a, double b, double c) {
	double t_0 = -b - b;
	double tmp;
	if (b >= 0.0) {
		tmp = (2.0 * c) / t_0;
	} else {
		tmp = t_0 / (2.0 * a);
	}
	return tmp;
}
def code(a, b, c):
	t_0 = -b - b
	tmp = 0
	if b >= 0.0:
		tmp = (2.0 * c) / t_0
	else:
		tmp = t_0 / (2.0 * a)
	return tmp
function code(a, b, c)
	t_0 = Float64(Float64(-b) - b)
	tmp = 0.0
	if (b >= 0.0)
		tmp = Float64(Float64(2.0 * c) / t_0);
	else
		tmp = Float64(t_0 / Float64(2.0 * a));
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	t_0 = -b - b;
	tmp = 0.0;
	if (b >= 0.0)
		tmp = (2.0 * c) / t_0;
	else
		tmp = t_0 / (2.0 * a);
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := Block[{t$95$0 = N[((-b) - b), $MachinePrecision]}, If[GreaterEqual[b, 0.0], N[(N[(2.0 * c), $MachinePrecision] / t$95$0), $MachinePrecision], N[(t$95$0 / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left(-b\right) - b\\
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot c}{t\_0}\\

\mathbf{else}:\\
\;\;\;\;\frac{t\_0}{2 \cdot a}\\


\end{array}
\end{array}
Derivation
  1. Initial program 72.5%

    \[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
  2. Add Preprocessing
  3. Taylor expanded in b around inf 70.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \color{blue}{b}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
  4. Taylor expanded in b around -inf 67.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - b}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + -1 \cdot b}{2 \cdot a}\\ \end{array} \]
  5. Step-by-step derivation
    1. mul-1-neg67.4%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - b}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \left(-b\right)}{2 \cdot a}\\ \end{array} \]
  6. Simplified67.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - b}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \left(-b\right)}{2 \cdot a}\\ \end{array} \]
  7. Final simplification67.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - b}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) - b}{2 \cdot a}\\ \end{array} \]
  8. Add Preprocessing

Alternative 7: 34.6% accurate, 9.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - b}\\ \mathbf{else}:\\ \;\;\;\;\frac{b - b}{2 \cdot a}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (>= b 0.0) (/ (* 2.0 c) (- (- b) b)) (/ (- b b) (* 2.0 a))))
double code(double a, double b, double c) {
	double tmp;
	if (b >= 0.0) {
		tmp = (2.0 * c) / (-b - b);
	} else {
		tmp = (b - b) / (2.0 * a);
	}
	return tmp;
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8) :: tmp
    if (b >= 0.0d0) then
        tmp = (2.0d0 * c) / (-b - b)
    else
        tmp = (b - b) / (2.0d0 * a)
    end if
    code = tmp
end function
public static double code(double a, double b, double c) {
	double tmp;
	if (b >= 0.0) {
		tmp = (2.0 * c) / (-b - b);
	} else {
		tmp = (b - b) / (2.0 * a);
	}
	return tmp;
}
def code(a, b, c):
	tmp = 0
	if b >= 0.0:
		tmp = (2.0 * c) / (-b - b)
	else:
		tmp = (b - b) / (2.0 * a)
	return tmp
function code(a, b, c)
	tmp = 0.0
	if (b >= 0.0)
		tmp = Float64(Float64(2.0 * c) / Float64(Float64(-b) - b));
	else
		tmp = Float64(Float64(b - b) / Float64(2.0 * a));
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	tmp = 0.0;
	if (b >= 0.0)
		tmp = (2.0 * c) / (-b - b);
	else
		tmp = (b - b) / (2.0 * a);
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := If[GreaterEqual[b, 0.0], N[(N[(2.0 * c), $MachinePrecision] / N[((-b) - b), $MachinePrecision]), $MachinePrecision], N[(N[(b - b), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) - b}\\

\mathbf{else}:\\
\;\;\;\;\frac{b - b}{2 \cdot a}\\


\end{array}
\end{array}
Derivation
  1. Initial program 72.5%

    \[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
  2. Add Preprocessing
  3. Taylor expanded in b around inf 70.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \color{blue}{b}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
  4. Taylor expanded in b around inf 35.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - b}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + b}{2 \cdot a}\\ \end{array} \]
  5. Final simplification35.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - b}\\ \mathbf{else}:\\ \;\;\;\;\frac{b - b}{2 \cdot a}\\ \end{array} \]
  6. Add Preprocessing

Reproduce

?
herbie shell --seed 2024111 
(FPCore (a b c)
  :name "jeff quadratic root 2"
  :precision binary64
  (if (>= b 0.0) (/ (* 2.0 c) (- (- b) (sqrt (- (* b b) (* (* 4.0 a) c))))) (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a))))