jeff quadratic root 1

Percentage Accurate: 72.0% → 89.1%
Time: 17.9s
Alternatives: 6
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{\left(-b\right) - t_0}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) + t_0}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (sqrt (- (* b b) (* (* 4.0 a) c)))))
   (if (>= b 0.0) (/ (- (- b) t_0) (* 2.0 a)) (/ (* 2.0 c) (+ (- b) t_0)))))
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 = (-b - t_0) / (2.0 * a);
	} else {
		tmp = (2.0 * c) / (-b + t_0);
	}
	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 = (-b - t_0) / (2.0d0 * a)
    else
        tmp = (2.0d0 * c) / (-b + t_0)
    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 = (-b - t_0) / (2.0 * a);
	} else {
		tmp = (2.0 * c) / (-b + t_0);
	}
	return tmp;
}
def code(a, b, c):
	t_0 = math.sqrt(((b * b) - ((4.0 * a) * c)))
	tmp = 0
	if b >= 0.0:
		tmp = (-b - t_0) / (2.0 * a)
	else:
		tmp = (2.0 * c) / (-b + t_0)
	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(Float64(-b) - t_0) / Float64(2.0 * a));
	else
		tmp = Float64(Float64(2.0 * c) / Float64(Float64(-b) + t_0));
	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 = (-b - t_0) / (2.0 * a);
	else
		tmp = (2.0 * c) / (-b + t_0);
	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[((-b) - t$95$0), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 * c), $MachinePrecision] / N[((-b) + t$95$0), $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{\left(-b\right) - t_0}{2 \cdot a}\\

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


\end{array}
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 6 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: 72.0% 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{\left(-b\right) - t_0}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) + t_0}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (sqrt (- (* b b) (* (* 4.0 a) c)))))
   (if (>= b 0.0) (/ (- (- b) t_0) (* 2.0 a)) (/ (* 2.0 c) (+ (- b) t_0)))))
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 = (-b - t_0) / (2.0 * a);
	} else {
		tmp = (2.0 * c) / (-b + t_0);
	}
	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 = (-b - t_0) / (2.0d0 * a)
    else
        tmp = (2.0d0 * c) / (-b + t_0)
    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 = (-b - t_0) / (2.0 * a);
	} else {
		tmp = (2.0 * c) / (-b + t_0);
	}
	return tmp;
}
def code(a, b, c):
	t_0 = math.sqrt(((b * b) - ((4.0 * a) * c)))
	tmp = 0
	if b >= 0.0:
		tmp = (-b - t_0) / (2.0 * a)
	else:
		tmp = (2.0 * c) / (-b + t_0)
	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(Float64(-b) - t_0) / Float64(2.0 * a));
	else
		tmp = Float64(Float64(2.0 * c) / Float64(Float64(-b) + t_0));
	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 = (-b - t_0) / (2.0 * a);
	else
		tmp = (2.0 * c) / (-b + t_0);
	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[((-b) - t$95$0), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 * c), $MachinePrecision] / N[((-b) + t$95$0), $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{\left(-b\right) - t_0}{2 \cdot a}\\

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


\end{array}
\end{array}

Alternative 1: 89.1% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := -0.5 \cdot \frac{b + b}{a}\\ t_1 := c \cdot \left(a \cdot 4\right)\\ t_2 := \sqrt{b \cdot b - t_1}\\ t_3 := a \cdot \left(c \cdot -4\right)\\ t_4 := \sqrt{\mathsf{fma}\left(b, b, t_3\right)}\\ \mathbf{if}\;b \leq -1.3 \cdot 10^{+87}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{\mathsf{fma}\left(-2, b, 2 \cdot \left(c \cdot \frac{a}{b}\right)\right)}\\ \end{array}\\ \mathbf{elif}\;b \leq 2.9 \cdot 10^{-298}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{t_1 \cdot \frac{1}{b + t_2}}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{t_2 - b}\\ \end{array}\\ \mathbf{elif}\;b \leq 2.6 \cdot 10^{-163}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \frac{1}{\frac{a}{b + \mathsf{hypot}\left(b, \sqrt{t_3}\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{\mathsf{fma}\left(-2, b, 2 \cdot \frac{a}{\frac{b}{c}}\right)}\\ \end{array}\\ \mathbf{elif}\;b \leq 980:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \frac{b + t_4}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{t_4 - b}\\ \end{array}\\ \mathbf{elif}\;b \geq 0:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (* -0.5 (/ (+ b b) a)))
        (t_1 (* c (* a 4.0)))
        (t_2 (sqrt (- (* b b) t_1)))
        (t_3 (* a (* c -4.0)))
        (t_4 (sqrt (fma b b t_3))))
   (if (<= b -1.3e+87)
     (if (>= b 0.0) t_0 (/ (* c 2.0) (fma -2.0 b (* 2.0 (* c (/ a b))))))
     (if (<= b 2.9e-298)
       (if (>= b 0.0)
         (/ (* t_1 (/ 1.0 (+ b t_2))) (* a 2.0))
         (/ (* c 2.0) (- t_2 b)))
       (if (<= b 2.6e-163)
         (if (>= b 0.0)
           (* -0.5 (/ 1.0 (/ a (+ b (hypot b (sqrt t_3))))))
           (/ (* c 2.0) (fma -2.0 b (* 2.0 (/ a (/ b c))))))
         (if (<= b 980.0)
           (if (>= b 0.0) (* -0.5 (/ (+ b t_4) a)) (/ (* c 2.0) (- t_4 b)))
           (if (>= b 0.0) t_0 (/ (- c) b))))))))
double code(double a, double b, double c) {
	double t_0 = -0.5 * ((b + b) / a);
	double t_1 = c * (a * 4.0);
	double t_2 = sqrt(((b * b) - t_1));
	double t_3 = a * (c * -4.0);
	double t_4 = sqrt(fma(b, b, t_3));
	double tmp_1;
	if (b <= -1.3e+87) {
		double tmp_2;
		if (b >= 0.0) {
			tmp_2 = t_0;
		} else {
			tmp_2 = (c * 2.0) / fma(-2.0, b, (2.0 * (c * (a / b))));
		}
		tmp_1 = tmp_2;
	} else if (b <= 2.9e-298) {
		double tmp_3;
		if (b >= 0.0) {
			tmp_3 = (t_1 * (1.0 / (b + t_2))) / (a * 2.0);
		} else {
			tmp_3 = (c * 2.0) / (t_2 - b);
		}
		tmp_1 = tmp_3;
	} else if (b <= 2.6e-163) {
		double tmp_4;
		if (b >= 0.0) {
			tmp_4 = -0.5 * (1.0 / (a / (b + hypot(b, sqrt(t_3)))));
		} else {
			tmp_4 = (c * 2.0) / fma(-2.0, b, (2.0 * (a / (b / c))));
		}
		tmp_1 = tmp_4;
	} else if (b <= 980.0) {
		double tmp_5;
		if (b >= 0.0) {
			tmp_5 = -0.5 * ((b + t_4) / a);
		} else {
			tmp_5 = (c * 2.0) / (t_4 - b);
		}
		tmp_1 = tmp_5;
	} else if (b >= 0.0) {
		tmp_1 = t_0;
	} else {
		tmp_1 = -c / b;
	}
	return tmp_1;
}
function code(a, b, c)
	t_0 = Float64(-0.5 * Float64(Float64(b + b) / a))
	t_1 = Float64(c * Float64(a * 4.0))
	t_2 = sqrt(Float64(Float64(b * b) - t_1))
	t_3 = Float64(a * Float64(c * -4.0))
	t_4 = sqrt(fma(b, b, t_3))
	tmp_1 = 0.0
	if (b <= -1.3e+87)
		tmp_2 = 0.0
		if (b >= 0.0)
			tmp_2 = t_0;
		else
			tmp_2 = Float64(Float64(c * 2.0) / fma(-2.0, b, Float64(2.0 * Float64(c * Float64(a / b)))));
		end
		tmp_1 = tmp_2;
	elseif (b <= 2.9e-298)
		tmp_3 = 0.0
		if (b >= 0.0)
			tmp_3 = Float64(Float64(t_1 * Float64(1.0 / Float64(b + t_2))) / Float64(a * 2.0));
		else
			tmp_3 = Float64(Float64(c * 2.0) / Float64(t_2 - b));
		end
		tmp_1 = tmp_3;
	elseif (b <= 2.6e-163)
		tmp_4 = 0.0
		if (b >= 0.0)
			tmp_4 = Float64(-0.5 * Float64(1.0 / Float64(a / Float64(b + hypot(b, sqrt(t_3))))));
		else
			tmp_4 = Float64(Float64(c * 2.0) / fma(-2.0, b, Float64(2.0 * Float64(a / Float64(b / c)))));
		end
		tmp_1 = tmp_4;
	elseif (b <= 980.0)
		tmp_5 = 0.0
		if (b >= 0.0)
			tmp_5 = Float64(-0.5 * Float64(Float64(b + t_4) / a));
		else
			tmp_5 = Float64(Float64(c * 2.0) / Float64(t_4 - b));
		end
		tmp_1 = tmp_5;
	elseif (b >= 0.0)
		tmp_1 = t_0;
	else
		tmp_1 = Float64(Float64(-c) / b);
	end
	return tmp_1
end
code[a_, b_, c_] := Block[{t$95$0 = N[(-0.5 * N[(N[(b + b), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(c * N[(a * 4.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(N[(b * b), $MachinePrecision] - t$95$1), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(a * N[(c * -4.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[Sqrt[N[(b * b + t$95$3), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[b, -1.3e+87], If[GreaterEqual[b, 0.0], t$95$0, N[(N[(c * 2.0), $MachinePrecision] / N[(-2.0 * b + N[(2.0 * N[(c * N[(a / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], If[LessEqual[b, 2.9e-298], If[GreaterEqual[b, 0.0], N[(N[(t$95$1 * N[(1.0 / N[(b + t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(c * 2.0), $MachinePrecision] / N[(t$95$2 - b), $MachinePrecision]), $MachinePrecision]], If[LessEqual[b, 2.6e-163], If[GreaterEqual[b, 0.0], N[(-0.5 * N[(1.0 / N[(a / N[(b + N[Sqrt[b ^ 2 + N[Sqrt[t$95$3], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(c * 2.0), $MachinePrecision] / N[(-2.0 * b + N[(2.0 * N[(a / N[(b / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], If[LessEqual[b, 980.0], If[GreaterEqual[b, 0.0], N[(-0.5 * N[(N[(b + t$95$4), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(N[(c * 2.0), $MachinePrecision] / N[(t$95$4 - b), $MachinePrecision]), $MachinePrecision]], If[GreaterEqual[b, 0.0], t$95$0, N[((-c) / b), $MachinePrecision]]]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := -0.5 \cdot \frac{b + b}{a}\\
t_1 := c \cdot \left(a \cdot 4\right)\\
t_2 := \sqrt{b \cdot b - t_1}\\
t_3 := a \cdot \left(c \cdot -4\right)\\
t_4 := \sqrt{\mathsf{fma}\left(b, b, t_3\right)}\\
\mathbf{if}\;b \leq -1.3 \cdot 10^{+87}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;t_0\\

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


\end{array}\\

\mathbf{elif}\;b \leq 2.9 \cdot 10^{-298}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{t_1 \cdot \frac{1}{b + t_2}}{a \cdot 2}\\

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


\end{array}\\

\mathbf{elif}\;b \leq 2.6 \cdot 10^{-163}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;-0.5 \cdot \frac{1}{\frac{a}{b + \mathsf{hypot}\left(b, \sqrt{t_3}\right)}}\\

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


\end{array}\\

\mathbf{elif}\;b \leq 980:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;-0.5 \cdot \frac{b + t_4}{a}\\

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


\end{array}\\

\mathbf{elif}\;b \geq 0:\\
\;\;\;\;t_0\\

\mathbf{else}:\\
\;\;\;\;\frac{-c}{b}\\


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if b < -1.29999999999999999e87

    1. Initial program 57.3%

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

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

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

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

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

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

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

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \color{blue}{\frac{2 \cdot b}{a}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{\mathsf{fma}\left(-2, b, 2 \cdot \frac{a}{\frac{b}{c}}\right)}\\ \end{array} \]
      2. count-294.9%

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

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

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

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

    if -1.29999999999999999e87 < b < 2.90000000000000015e-298

    1. Initial program 95.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.90000000000000015e-298 < b < 2.60000000000000002e-163

    1. Initial program 76.0%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \color{blue}{{\left(\frac{a}{b + \mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -4\right)}\right)}\right)}^{-1}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{\mathsf{fma}\left(-2, b, 2 \cdot \frac{a}{\frac{b}{c}}\right)}\\ \end{array} \]
    8. Step-by-step derivation
      1. unpow-189.8%

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

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

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

    if 2.60000000000000002e-163 < b < 980

    1. Initial program 95.2%

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

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

    if 980 < b

    1. Initial program 70.0%

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

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

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

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

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

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

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

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \color{blue}{\frac{2 \cdot b}{a}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{\mathsf{fma}\left(-2, b, 2 \cdot \frac{a}{\frac{b}{c}}\right)}\\ \end{array} \]
      2. count-295.9%

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \color{blue}{\frac{b + b}{a}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{\mathsf{fma}\left(-2, b, 2 \cdot \frac{a}{\frac{b}{c}}\right)}\\ \end{array} \]
    9. Taylor expanded in c around 0 95.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \frac{b + b}{a}\\ \mathbf{else}:\\ \;\;\;\;-1 \cdot \frac{c}{b}\\ \end{array} \]
  3. Recombined 5 regimes into one program.
  4. Final simplification94.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -1.3 \cdot 10^{+87}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \frac{b + b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{\mathsf{fma}\left(-2, b, 2 \cdot \left(c \cdot \frac{a}{b}\right)\right)}\\ \end{array}\\ \mathbf{elif}\;b \leq 2.9 \cdot 10^{-298}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{\left(c \cdot \left(a \cdot 4\right)\right) \cdot \frac{1}{b + \sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)}}}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}\\ \end{array}\\ \mathbf{elif}\;b \leq 2.6 \cdot 10^{-163}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \frac{1}{\frac{a}{b + \mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -4\right)}\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{\mathsf{fma}\left(-2, b, 2 \cdot \frac{a}{\frac{b}{c}}\right)}\\ \end{array}\\ \mathbf{elif}\;b \leq 980:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \frac{b + \sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -4\right)\right)}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -4\right)\right)} - b}\\ \end{array}\\ \mathbf{elif}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \frac{b + b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \]

Alternative 2: 86.7% accurate, 0.3× speedup?

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

\\
\begin{array}{l}
t_0 := a \cdot \left(c \cdot -4\right)\\
t_1 := -0.5 \cdot \frac{b + b}{a}\\
\mathbf{if}\;b \leq -1.3 \cdot 10^{+87}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;t_1\\

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


\end{array}\\

\mathbf{elif}\;b \leq 9.6 \cdot 10^{-6}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;-0.5 \cdot \frac{e^{\log \left(b + \mathsf{hypot}\left(b, \sqrt{t_0}\right)\right)}}{a}\\

\mathbf{else}:\\
\;\;\;\;\frac{c \cdot 2}{\sqrt{\mathsf{fma}\left(b, b, t_0\right)} - b}\\


\end{array}\\

\mathbf{elif}\;b \geq 0:\\
\;\;\;\;t_1\\

\mathbf{else}:\\
\;\;\;\;\frac{-c}{b}\\


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

    1. Initial program 57.3%

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

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

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

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

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

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

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

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \color{blue}{\frac{2 \cdot b}{a}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{\mathsf{fma}\left(-2, b, 2 \cdot \frac{a}{\frac{b}{c}}\right)}\\ \end{array} \]
      2. count-294.9%

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

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

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

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

    if -1.29999999999999999e87 < b < 9.5999999999999996e-6

    1. Initial program 90.8%

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

      \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \frac{b + \sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -4\right)\right)}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -4\right)\right)} - b}\\ } \end{array}} \]
    3. Step-by-step derivation
      1. add-sqr-sqrt90.8%

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

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

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

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

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

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \frac{\color{blue}{e^{\log \left(\left(-b\right) + \sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -4\right)\right)}\right)}}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -4\right)\right)} - b}\\ \end{array} \]
      7. add-sqr-sqrt56.8%

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

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

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \frac{e^{\log \left(\sqrt{\color{blue}{b \cdot b}} + \sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -4\right)\right)}\right)}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -4\right)\right)} - b}\\ \end{array} \]
      10. sqrt-prod88.7%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \frac{e^{\log \left(\color{blue}{\sqrt{b} \cdot \sqrt{b}} + \sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -4\right)\right)}\right)}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -4\right)\right)} - b}\\ \end{array} \]
      11. add-sqr-sqrt88.7%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \frac{e^{\log \left(\color{blue}{b} + \sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -4\right)\right)}\right)}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -4\right)\right)} - b}\\ \end{array} \]
      12. fma-udef88.7%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \frac{e^{\log \left(b + \sqrt{\color{blue}{b \cdot b + a \cdot \left(c \cdot -4\right)}}\right)}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -4\right)\right)} - b}\\ \end{array} \]
      13. add-sqr-sqrt88.7%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \frac{e^{\log \left(b + \sqrt{b \cdot b + \color{blue}{\sqrt{a \cdot \left(c \cdot -4\right)} \cdot \sqrt{a \cdot \left(c \cdot -4\right)}}}\right)}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -4\right)\right)} - b}\\ \end{array} \]
      14. hypot-def91.4%

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

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

    if 9.5999999999999996e-6 < b

    1. Initial program 70.0%

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

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

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

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

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

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

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

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \color{blue}{\frac{2 \cdot b}{a}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{\mathsf{fma}\left(-2, b, 2 \cdot \frac{a}{\frac{b}{c}}\right)}\\ \end{array} \]
      2. count-295.9%

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \color{blue}{\frac{b + b}{a}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{\mathsf{fma}\left(-2, b, 2 \cdot \frac{a}{\frac{b}{c}}\right)}\\ \end{array} \]
    9. Taylor expanded in c around 0 95.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \frac{b + b}{a}\\ \mathbf{else}:\\ \;\;\;\;-1 \cdot \frac{c}{b}\\ \end{array} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification93.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -1.3 \cdot 10^{+87}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \frac{b + b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{\mathsf{fma}\left(-2, b, 2 \cdot \left(c \cdot \frac{a}{b}\right)\right)}\\ \end{array}\\ \mathbf{elif}\;b \leq 9.6 \cdot 10^{-6}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \frac{e^{\log \left(b + \mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -4\right)}\right)\right)}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -4\right)\right)} - b}\\ \end{array}\\ \mathbf{elif}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \frac{b + b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \]

Alternative 3: 88.7% accurate, 0.5× speedup?

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

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

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


\end{array}\\

\mathbf{elif}\;b \leq 980:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;-0.5 \cdot \frac{b + t_1}{a}\\

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


\end{array}\\

\mathbf{elif}\;b \geq 0:\\
\;\;\;\;t_0\\

\mathbf{else}:\\
\;\;\;\;\frac{-c}{b}\\


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

    1. Initial program 57.3%

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

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

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

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

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

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

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

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \color{blue}{\frac{2 \cdot b}{a}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{\mathsf{fma}\left(-2, b, 2 \cdot \frac{a}{\frac{b}{c}}\right)}\\ \end{array} \]
      2. count-294.9%

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

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

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

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

    if -9.9999999999999996e86 < b < 980

    1. Initial program 90.8%

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

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

    if 980 < b

    1. Initial program 70.0%

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

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

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

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

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

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

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

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \color{blue}{\frac{2 \cdot b}{a}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{\mathsf{fma}\left(-2, b, 2 \cdot \frac{a}{\frac{b}{c}}\right)}\\ \end{array} \]
      2. count-295.9%

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \color{blue}{\frac{b + b}{a}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{\mathsf{fma}\left(-2, b, 2 \cdot \frac{a}{\frac{b}{c}}\right)}\\ \end{array} \]
    9. Taylor expanded in c around 0 95.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \frac{b + b}{a}\\ \mathbf{else}:\\ \;\;\;\;-1 \cdot \frac{c}{b}\\ \end{array} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification93.1%

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

Alternative 4: 88.7% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
t_0 := -0.5 \cdot \frac{b + b}{a}\\
t_1 := \sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)}\\
\mathbf{if}\;b \leq -1.3 \cdot 10^{+87}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;t_0\\

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


\end{array}\\

\mathbf{elif}\;b \leq 980:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{\left(-b\right) - t_1}{a \cdot 2}\\

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


\end{array}\\

\mathbf{elif}\;b \geq 0:\\
\;\;\;\;t_0\\

\mathbf{else}:\\
\;\;\;\;\frac{-c}{b}\\


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

    1. Initial program 57.3%

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

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

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

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

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

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

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

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \color{blue}{\frac{2 \cdot b}{a}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{\mathsf{fma}\left(-2, b, 2 \cdot \frac{a}{\frac{b}{c}}\right)}\\ \end{array} \]
      2. count-294.9%

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

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

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

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

    if -1.29999999999999999e87 < b < 980

    1. Initial program 90.8%

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

    if 980 < b

    1. Initial program 70.0%

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

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

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

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

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

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

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

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \color{blue}{\frac{2 \cdot b}{a}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{\mathsf{fma}\left(-2, b, 2 \cdot \frac{a}{\frac{b}{c}}\right)}\\ \end{array} \]
      2. count-295.9%

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \color{blue}{\frac{b + b}{a}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{\mathsf{fma}\left(-2, b, 2 \cdot \frac{a}{\frac{b}{c}}\right)}\\ \end{array} \]
    9. Taylor expanded in c around 0 95.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \frac{b + b}{a}\\ \mathbf{else}:\\ \;\;\;\;-1 \cdot \frac{c}{b}\\ \end{array} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification93.1%

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

Alternative 5: 67.7% accurate, 1.0× speedup?

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 67.3% accurate, 13.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \frac{b + b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (>= b 0.0) (* -0.5 (/ (+ b b) a)) (/ (- c) b)))
double code(double a, double b, double c) {
	double tmp;
	if (b >= 0.0) {
		tmp = -0.5 * ((b + b) / a);
	} else {
		tmp = -c / b;
	}
	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 = (-0.5d0) * ((b + b) / a)
    else
        tmp = -c / b
    end if
    code = tmp
end function
public static double code(double a, double b, double c) {
	double tmp;
	if (b >= 0.0) {
		tmp = -0.5 * ((b + b) / a);
	} else {
		tmp = -c / b;
	}
	return tmp;
}
def code(a, b, c):
	tmp = 0
	if b >= 0.0:
		tmp = -0.5 * ((b + b) / a)
	else:
		tmp = -c / b
	return tmp
function code(a, b, c)
	tmp = 0.0
	if (b >= 0.0)
		tmp = Float64(-0.5 * Float64(Float64(b + b) / a));
	else
		tmp = Float64(Float64(-c) / b);
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	tmp = 0.0;
	if (b >= 0.0)
		tmp = -0.5 * ((b + b) / a);
	else
		tmp = -c / b;
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := If[GreaterEqual[b, 0.0], N[(-0.5 * N[(N[(b + b), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[((-c) / b), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;-0.5 \cdot \frac{b + b}{a}\\

\mathbf{else}:\\
\;\;\;\;\frac{-c}{b}\\


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

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

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

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

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

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

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

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \color{blue}{\frac{2 \cdot b}{a}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{\mathsf{fma}\left(-2, b, 2 \cdot \frac{a}{\frac{b}{c}}\right)}\\ \end{array} \]
    2. count-266.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \color{blue}{\frac{b + b}{a}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{\mathsf{fma}\left(-2, b, 2 \cdot \frac{a}{\frac{b}{c}}\right)}\\ \end{array} \]
  9. Taylor expanded in c around 0 67.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \frac{b + b}{a}\\ \mathbf{else}:\\ \;\;\;\;-1 \cdot \frac{c}{b}\\ \end{array} \]
  10. Final simplification67.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \frac{b + b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \]

Reproduce

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