jeff quadratic root 1

Percentage Accurate: 72.6% → 90.0%
Time: 19.3s
Alternatives: 8
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 8 alternatives:

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

Initial Program: 72.6% 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: 90.0% accurate, 0.5× speedup?

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

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

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


\end{array}\\

\mathbf{elif}\;b \leq 4.6 \cdot 10^{+57}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;-0.5 \cdot \frac{b + t\_0}{a}\\

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


\end{array}\\

\mathbf{elif}\;b \geq 0:\\
\;\;\;\;\frac{-b}{a}\\

\mathbf{else}:\\
\;\;\;\;\frac{b}{a}\\


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

    1. Initial program 52.7%

      \[\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. Simplified52.7%

      \[\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. Add Preprocessing
    4. Taylor expanded in b around -inf 94.4%

      \[\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{\color{blue}{c \cdot 2}}{-1 \cdot b - b}\\ \end{array} \]
    5. Step-by-step derivation
      1. clear-num94.4%

        \[\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}{-1 \cdot b - b}\\ \end{array} \]
      2. inv-pow94.4%

        \[\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}{-1 \cdot b - b}\\ \end{array} \]
      3. fma-udef94.4%

        \[\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}{-1 \cdot b - b}\\ \end{array} \]
      4. add-sqr-sqrt94.4%

        \[\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}{-1 \cdot b - b}\\ \end{array} \]
      5. hypot-def94.4%

        \[\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}{-1 \cdot b - b}\\ \end{array} \]
    6. Applied egg-rr94.4%

      \[\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}{-1 \cdot b - b}\\ \end{array} \]
    7. Step-by-step derivation
      1. unpow-194.4%

        \[\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}{-1 \cdot b - b}\\ \end{array} \]
    8. Simplified94.4%

      \[\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}{-1 \cdot b - b}\\ \end{array} \]
    9. Taylor expanded in a around 0 94.4%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \frac{1}{\color{blue}{0.5 \cdot \frac{a}{b}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{-1 \cdot b - b}\\ \end{array} \]
    10. Step-by-step derivation
      1. associate-*r/94.4%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \frac{1}{\color{blue}{\frac{0.5 \cdot a}{b}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{-1 \cdot b - b}\\ \end{array} \]
      2. *-rgt-identity94.4%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \frac{1}{\frac{0.5 \cdot a}{\color{blue}{b \cdot 1}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{-1 \cdot b - b}\\ \end{array} \]
      3. times-frac94.4%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \frac{1}{\color{blue}{\frac{0.5}{b} \cdot \frac{a}{1}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{-1 \cdot b - b}\\ \end{array} \]
      4. rem-square-sqrt94.4%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \frac{1}{\frac{0.5}{b} \cdot \frac{\color{blue}{\sqrt{a} \cdot \sqrt{a}}}{1}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{-1 \cdot b - b}\\ \end{array} \]
      5. associate-*r/94.4%

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

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

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \frac{1}{\frac{0.5}{b} \cdot \color{blue}{a}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{-1 \cdot b - b}\\ \end{array} \]
    11. Simplified94.4%

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

    if -1.1e61 < b < 4.5999999999999998e57

    1. Initial program 85.9%

      \[\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. Simplified86.8%

      \[\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. Add Preprocessing

    if 4.5999999999999998e57 < b

    1. Initial program 66.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. Step-by-step derivation
      1. sqr-neg66.2%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{\left(-b\right) - \sqrt{\color{blue}{\left(-b\right) \cdot \left(-b\right)} - \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. sqr-neg66.2%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{\left(-b\right) - \sqrt{\color{blue}{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. associate-*l*66.2%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{\left(-b\right) - \sqrt{b \cdot b - \color{blue}{4 \cdot \left(a \cdot c\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. *-commutative66.2%

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

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

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

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

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

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

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;\color{blue}{\frac{2}{-2 \cdot \frac{a}{b}}}\\ \end{array} \]
    9. Step-by-step derivation
      1. associate-*r/94.8%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;\color{blue}{\frac{2}{\frac{-2 \cdot a}{b}}}\\ \end{array} \]
    10. Simplified94.8%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;\color{blue}{\frac{2}{\frac{-2 \cdot a}{b}}}\\ \end{array} \]
    11. Step-by-step derivation
      1. frac-2neg94.8%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-2}{-\frac{-2 \cdot a}{b}}\\ \end{array} \]
      2. metadata-eval94.8%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-2}{-\frac{-2 \cdot a}{b}}\\ \end{array} \]
      3. div-inv94.8%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{1}{-\frac{-2 \cdot a}{b}}\\ \end{array} \]
      4. add-sqr-sqrt94.8%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{1}{-\frac{-2 \cdot a}{\sqrt{b} \cdot \sqrt{b}}}\\ \end{array} \]
      5. sqrt-unprod94.8%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{1}{-\frac{-2 \cdot a}{\sqrt{b \cdot b}}}\\ \end{array} \]
      6. sqr-neg94.8%

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

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{1}{-\frac{-2 \cdot a}{\sqrt{-b} \cdot \sqrt{-b}}}\\ \end{array} \]
      8. add-sqr-sqrt94.8%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{1}{-\frac{-2 \cdot a}{-b}}\\ \end{array} \]
      9. distribute-frac-neg94.8%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \color{blue}{\frac{1}{\frac{--2 \cdot a}{-b}}}\\ \end{array} \]
      10. frac-2neg94.8%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \color{blue}{\frac{1}{\frac{-2 \cdot a}{b}}}\\ \end{array} \]
      11. clear-num94.8%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;\color{blue}{-2 \cdot \frac{b}{-2 \cdot a}}\\ \end{array} \]
      12. *-un-lft-identity94.8%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;\color{blue}{-2} \cdot \frac{1 \cdot b}{-2 \cdot a}\\ \end{array} \]
      13. times-frac94.8%

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

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;\color{blue}{-2} \cdot \left(-0.5 \cdot \frac{b}{a}\right)\\ \end{array} \]
    12. Applied egg-rr94.8%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \left(-0.5 \cdot \frac{b}{a}\right)\\ \end{array} \]
    13. Step-by-step derivation
      1. associate-*r*94.8%

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

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;1 \cdot \frac{b}{a}\\ \end{array} \]
      3. *-lft-identity94.8%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{a}\\ \end{array} \]
    14. Simplified94.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -1.1 \cdot 10^{+61}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \frac{1}{\frac{0.5}{b} \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{\left(-b\right) - b}\\ \end{array}\\ \mathbf{elif}\;b \leq 4.6 \cdot 10^{+57}:\\ \;\;\;\;\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:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{a}\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 89.6% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}\\ \mathbf{if}\;b \leq -2.8 \cdot 10^{+35}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \frac{1}{\frac{0.5}{b} \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{\left(-b\right) - b}\\ \end{array}\\ \mathbf{elif}\;b \leq 4.6 \cdot 10^{+57}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{\left(-b\right) - t\_0}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{\frac{t\_0 - b}{c}}\\ \end{array}\\ \mathbf{elif}\;b \geq 0:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{a}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (sqrt (- (* b b) (* 4.0 (* a c))))))
   (if (<= b -2.8e+35)
     (if (>= b 0.0) (* -0.5 (/ 1.0 (* (/ 0.5 b) a))) (/ (* c 2.0) (- (- b) b)))
     (if (<= b 4.6e+57)
       (if (>= b 0.0) (/ (- (- b) t_0) (* a 2.0)) (/ 2.0 (/ (- t_0 b) c)))
       (if (>= b 0.0) (/ (- b) a) (/ b a))))))
double code(double a, double b, double c) {
	double t_0 = sqrt(((b * b) - (4.0 * (a * c))));
	double tmp_1;
	if (b <= -2.8e+35) {
		double tmp_2;
		if (b >= 0.0) {
			tmp_2 = -0.5 * (1.0 / ((0.5 / b) * a));
		} else {
			tmp_2 = (c * 2.0) / (-b - b);
		}
		tmp_1 = tmp_2;
	} else if (b <= 4.6e+57) {
		double tmp_3;
		if (b >= 0.0) {
			tmp_3 = (-b - t_0) / (a * 2.0);
		} else {
			tmp_3 = 2.0 / ((t_0 - b) / c);
		}
		tmp_1 = tmp_3;
	} else if (b >= 0.0) {
		tmp_1 = -b / a;
	} else {
		tmp_1 = b / a;
	}
	return tmp_1;
}
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
    real(8) :: tmp_1
    real(8) :: tmp_2
    real(8) :: tmp_3
    t_0 = sqrt(((b * b) - (4.0d0 * (a * c))))
    if (b <= (-2.8d+35)) then
        if (b >= 0.0d0) then
            tmp_2 = (-0.5d0) * (1.0d0 / ((0.5d0 / b) * a))
        else
            tmp_2 = (c * 2.0d0) / (-b - b)
        end if
        tmp_1 = tmp_2
    else if (b <= 4.6d+57) then
        if (b >= 0.0d0) then
            tmp_3 = (-b - t_0) / (a * 2.0d0)
        else
            tmp_3 = 2.0d0 / ((t_0 - b) / c)
        end if
        tmp_1 = tmp_3
    else if (b >= 0.0d0) then
        tmp_1 = -b / a
    else
        tmp_1 = b / a
    end if
    code = tmp_1
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_1;
	if (b <= -2.8e+35) {
		double tmp_2;
		if (b >= 0.0) {
			tmp_2 = -0.5 * (1.0 / ((0.5 / b) * a));
		} else {
			tmp_2 = (c * 2.0) / (-b - b);
		}
		tmp_1 = tmp_2;
	} else if (b <= 4.6e+57) {
		double tmp_3;
		if (b >= 0.0) {
			tmp_3 = (-b - t_0) / (a * 2.0);
		} else {
			tmp_3 = 2.0 / ((t_0 - b) / c);
		}
		tmp_1 = tmp_3;
	} else if (b >= 0.0) {
		tmp_1 = -b / a;
	} else {
		tmp_1 = b / a;
	}
	return tmp_1;
}
def code(a, b, c):
	t_0 = math.sqrt(((b * b) - (4.0 * (a * c))))
	tmp_1 = 0
	if b <= -2.8e+35:
		tmp_2 = 0
		if b >= 0.0:
			tmp_2 = -0.5 * (1.0 / ((0.5 / b) * a))
		else:
			tmp_2 = (c * 2.0) / (-b - b)
		tmp_1 = tmp_2
	elif b <= 4.6e+57:
		tmp_3 = 0
		if b >= 0.0:
			tmp_3 = (-b - t_0) / (a * 2.0)
		else:
			tmp_3 = 2.0 / ((t_0 - b) / c)
		tmp_1 = tmp_3
	elif b >= 0.0:
		tmp_1 = -b / a
	else:
		tmp_1 = b / a
	return tmp_1
function code(a, b, c)
	t_0 = sqrt(Float64(Float64(b * b) - Float64(4.0 * Float64(a * c))))
	tmp_1 = 0.0
	if (b <= -2.8e+35)
		tmp_2 = 0.0
		if (b >= 0.0)
			tmp_2 = Float64(-0.5 * Float64(1.0 / Float64(Float64(0.5 / b) * a)));
		else
			tmp_2 = Float64(Float64(c * 2.0) / Float64(Float64(-b) - b));
		end
		tmp_1 = tmp_2;
	elseif (b <= 4.6e+57)
		tmp_3 = 0.0
		if (b >= 0.0)
			tmp_3 = Float64(Float64(Float64(-b) - t_0) / Float64(a * 2.0));
		else
			tmp_3 = Float64(2.0 / Float64(Float64(t_0 - b) / c));
		end
		tmp_1 = tmp_3;
	elseif (b >= 0.0)
		tmp_1 = Float64(Float64(-b) / a);
	else
		tmp_1 = Float64(b / a);
	end
	return tmp_1
end
function tmp_5 = code(a, b, c)
	t_0 = sqrt(((b * b) - (4.0 * (a * c))));
	tmp_2 = 0.0;
	if (b <= -2.8e+35)
		tmp_3 = 0.0;
		if (b >= 0.0)
			tmp_3 = -0.5 * (1.0 / ((0.5 / b) * a));
		else
			tmp_3 = (c * 2.0) / (-b - b);
		end
		tmp_2 = tmp_3;
	elseif (b <= 4.6e+57)
		tmp_4 = 0.0;
		if (b >= 0.0)
			tmp_4 = (-b - t_0) / (a * 2.0);
		else
			tmp_4 = 2.0 / ((t_0 - b) / c);
		end
		tmp_2 = tmp_4;
	elseif (b >= 0.0)
		tmp_2 = -b / a;
	else
		tmp_2 = b / a;
	end
	tmp_5 = tmp_2;
end
code[a_, b_, c_] := Block[{t$95$0 = N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(4.0 * N[(a * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[b, -2.8e+35], If[GreaterEqual[b, 0.0], N[(-0.5 * N[(1.0 / N[(N[(0.5 / b), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(c * 2.0), $MachinePrecision] / N[((-b) - b), $MachinePrecision]), $MachinePrecision]], If[LessEqual[b, 4.6e+57], If[GreaterEqual[b, 0.0], N[(N[((-b) - t$95$0), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(N[(t$95$0 - b), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision]], If[GreaterEqual[b, 0.0], N[((-b) / a), $MachinePrecision], N[(b / a), $MachinePrecision]]]]]
\begin{array}{l}

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

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


\end{array}\\

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

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


\end{array}\\

\mathbf{elif}\;b \geq 0:\\
\;\;\;\;\frac{-b}{a}\\

\mathbf{else}:\\
\;\;\;\;\frac{b}{a}\\


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

    1. Initial program 55.4%

      \[\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. Simplified55.4%

      \[\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. Add Preprocessing
    4. Taylor expanded in b around -inf 94.7%

      \[\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{\color{blue}{c \cdot 2}}{-1 \cdot b - b}\\ \end{array} \]
    5. Step-by-step derivation
      1. clear-num94.7%

        \[\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}{-1 \cdot b - b}\\ \end{array} \]
      2. inv-pow94.7%

        \[\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}{-1 \cdot b - b}\\ \end{array} \]
      3. fma-udef94.7%

        \[\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}{-1 \cdot b - b}\\ \end{array} \]
      4. add-sqr-sqrt94.7%

        \[\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}{-1 \cdot b - b}\\ \end{array} \]
      5. hypot-def94.7%

        \[\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}{-1 \cdot b - b}\\ \end{array} \]
    6. Applied egg-rr94.7%

      \[\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}{-1 \cdot b - b}\\ \end{array} \]
    7. Step-by-step derivation
      1. unpow-194.7%

        \[\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}{-1 \cdot b - b}\\ \end{array} \]
    8. Simplified94.7%

      \[\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}{-1 \cdot b - b}\\ \end{array} \]
    9. Taylor expanded in a around 0 94.7%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \frac{1}{\color{blue}{0.5 \cdot \frac{a}{b}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{-1 \cdot b - b}\\ \end{array} \]
    10. Step-by-step derivation
      1. associate-*r/94.7%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \frac{1}{\color{blue}{\frac{0.5 \cdot a}{b}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{-1 \cdot b - b}\\ \end{array} \]
      2. *-rgt-identity94.7%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \frac{1}{\frac{0.5 \cdot a}{\color{blue}{b \cdot 1}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{-1 \cdot b - b}\\ \end{array} \]
      3. times-frac94.7%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \frac{1}{\color{blue}{\frac{0.5}{b} \cdot \frac{a}{1}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{-1 \cdot b - b}\\ \end{array} \]
      4. rem-square-sqrt94.7%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \frac{1}{\frac{0.5}{b} \cdot \frac{\color{blue}{\sqrt{a} \cdot \sqrt{a}}}{1}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{-1 \cdot b - b}\\ \end{array} \]
      5. associate-*r/94.7%

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

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

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \frac{1}{\frac{0.5}{b} \cdot \color{blue}{a}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{-1 \cdot b - b}\\ \end{array} \]
    11. Simplified94.7%

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

    if -2.79999999999999999e35 < b < 4.5999999999999998e57

    1. Initial program 85.4%

      \[\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. sqr-neg85.4%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{\left(-b\right) - \sqrt{\color{blue}{\left(-b\right) \cdot \left(-b\right)} - \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. sqr-neg85.4%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{\left(-b\right) - \sqrt{\color{blue}{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. associate-*l*85.5%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{\left(-b\right) - \sqrt{b \cdot b - \color{blue}{4 \cdot \left(a \cdot c\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. *-commutative85.5%

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

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

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

    if 4.5999999999999998e57 < b

    1. Initial program 66.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. Step-by-step derivation
      1. sqr-neg66.2%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{\left(-b\right) - \sqrt{\color{blue}{\left(-b\right) \cdot \left(-b\right)} - \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. sqr-neg66.2%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{\left(-b\right) - \sqrt{\color{blue}{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. associate-*l*66.2%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{\left(-b\right) - \sqrt{b \cdot b - \color{blue}{4 \cdot \left(a \cdot c\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. *-commutative66.2%

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

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

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

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

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

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

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;\color{blue}{\frac{2}{-2 \cdot \frac{a}{b}}}\\ \end{array} \]
    9. Step-by-step derivation
      1. associate-*r/94.8%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;\color{blue}{\frac{2}{\frac{-2 \cdot a}{b}}}\\ \end{array} \]
    10. Simplified94.8%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;\color{blue}{\frac{2}{\frac{-2 \cdot a}{b}}}\\ \end{array} \]
    11. Step-by-step derivation
      1. frac-2neg94.8%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-2}{-\frac{-2 \cdot a}{b}}\\ \end{array} \]
      2. metadata-eval94.8%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-2}{-\frac{-2 \cdot a}{b}}\\ \end{array} \]
      3. div-inv94.8%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{1}{-\frac{-2 \cdot a}{b}}\\ \end{array} \]
      4. add-sqr-sqrt94.8%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{1}{-\frac{-2 \cdot a}{\sqrt{b} \cdot \sqrt{b}}}\\ \end{array} \]
      5. sqrt-unprod94.8%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{1}{-\frac{-2 \cdot a}{\sqrt{b \cdot b}}}\\ \end{array} \]
      6. sqr-neg94.8%

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

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{1}{-\frac{-2 \cdot a}{\sqrt{-b} \cdot \sqrt{-b}}}\\ \end{array} \]
      8. add-sqr-sqrt94.8%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{1}{-\frac{-2 \cdot a}{-b}}\\ \end{array} \]
      9. distribute-frac-neg94.8%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \color{blue}{\frac{1}{\frac{--2 \cdot a}{-b}}}\\ \end{array} \]
      10. frac-2neg94.8%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \color{blue}{\frac{1}{\frac{-2 \cdot a}{b}}}\\ \end{array} \]
      11. clear-num94.8%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;\color{blue}{-2 \cdot \frac{b}{-2 \cdot a}}\\ \end{array} \]
      12. *-un-lft-identity94.8%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;\color{blue}{-2} \cdot \frac{1 \cdot b}{-2 \cdot a}\\ \end{array} \]
      13. times-frac94.8%

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

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;\color{blue}{-2} \cdot \left(-0.5 \cdot \frac{b}{a}\right)\\ \end{array} \]
    12. Applied egg-rr94.8%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \left(-0.5 \cdot \frac{b}{a}\right)\\ \end{array} \]
    13. Step-by-step derivation
      1. associate-*r*94.8%

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

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;1 \cdot \frac{b}{a}\\ \end{array} \]
      3. *-lft-identity94.8%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{a}\\ \end{array} \]
    14. Simplified94.8%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{a}\\ \end{array} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification90.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -2.8 \cdot 10^{+35}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \frac{1}{\frac{0.5}{b} \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{\left(-b\right) - b}\\ \end{array}\\ \mathbf{elif}\;b \leq 4.6 \cdot 10^{+57}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{\frac{\sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)} - b}{c}}\\ \end{array}\\ \mathbf{elif}\;b \geq 0:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{a}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 78.6% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -2.8 \cdot 10^{+35}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \frac{1}{\frac{0.5}{b} \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{\left(-b\right) - b}\\ \end{array}\\ \mathbf{elif}\;b \geq 0:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{\frac{\sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)} - b}{c}}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b -2.8e+35)
   (if (>= b 0.0) (* -0.5 (/ 1.0 (* (/ 0.5 b) a))) (/ (* c 2.0) (- (- b) b)))
   (if (>= b 0.0)
     (/ (- b) a)
     (/ 2.0 (/ (- (sqrt (- (* b b) (* 4.0 (* a c)))) b) c)))))
double code(double a, double b, double c) {
	double tmp_1;
	if (b <= -2.8e+35) {
		double tmp_2;
		if (b >= 0.0) {
			tmp_2 = -0.5 * (1.0 / ((0.5 / b) * a));
		} else {
			tmp_2 = (c * 2.0) / (-b - b);
		}
		tmp_1 = tmp_2;
	} else if (b >= 0.0) {
		tmp_1 = -b / a;
	} else {
		tmp_1 = 2.0 / ((sqrt(((b * b) - (4.0 * (a * c)))) - b) / c);
	}
	return tmp_1;
}
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
    real(8) :: tmp_1
    real(8) :: tmp_2
    if (b <= (-2.8d+35)) then
        if (b >= 0.0d0) then
            tmp_2 = (-0.5d0) * (1.0d0 / ((0.5d0 / b) * a))
        else
            tmp_2 = (c * 2.0d0) / (-b - b)
        end if
        tmp_1 = tmp_2
    else if (b >= 0.0d0) then
        tmp_1 = -b / a
    else
        tmp_1 = 2.0d0 / ((sqrt(((b * b) - (4.0d0 * (a * c)))) - b) / c)
    end if
    code = tmp_1
end function
public static double code(double a, double b, double c) {
	double tmp_1;
	if (b <= -2.8e+35) {
		double tmp_2;
		if (b >= 0.0) {
			tmp_2 = -0.5 * (1.0 / ((0.5 / b) * a));
		} else {
			tmp_2 = (c * 2.0) / (-b - b);
		}
		tmp_1 = tmp_2;
	} else if (b >= 0.0) {
		tmp_1 = -b / a;
	} else {
		tmp_1 = 2.0 / ((Math.sqrt(((b * b) - (4.0 * (a * c)))) - b) / c);
	}
	return tmp_1;
}
def code(a, b, c):
	tmp_1 = 0
	if b <= -2.8e+35:
		tmp_2 = 0
		if b >= 0.0:
			tmp_2 = -0.5 * (1.0 / ((0.5 / b) * a))
		else:
			tmp_2 = (c * 2.0) / (-b - b)
		tmp_1 = tmp_2
	elif b >= 0.0:
		tmp_1 = -b / a
	else:
		tmp_1 = 2.0 / ((math.sqrt(((b * b) - (4.0 * (a * c)))) - b) / c)
	return tmp_1
function code(a, b, c)
	tmp_1 = 0.0
	if (b <= -2.8e+35)
		tmp_2 = 0.0
		if (b >= 0.0)
			tmp_2 = Float64(-0.5 * Float64(1.0 / Float64(Float64(0.5 / b) * a)));
		else
			tmp_2 = Float64(Float64(c * 2.0) / Float64(Float64(-b) - b));
		end
		tmp_1 = tmp_2;
	elseif (b >= 0.0)
		tmp_1 = Float64(Float64(-b) / a);
	else
		tmp_1 = Float64(2.0 / Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(4.0 * Float64(a * c)))) - b) / c));
	end
	return tmp_1
end
function tmp_4 = code(a, b, c)
	tmp_2 = 0.0;
	if (b <= -2.8e+35)
		tmp_3 = 0.0;
		if (b >= 0.0)
			tmp_3 = -0.5 * (1.0 / ((0.5 / b) * a));
		else
			tmp_3 = (c * 2.0) / (-b - b);
		end
		tmp_2 = tmp_3;
	elseif (b >= 0.0)
		tmp_2 = -b / a;
	else
		tmp_2 = 2.0 / ((sqrt(((b * b) - (4.0 * (a * c)))) - b) / c);
	end
	tmp_4 = tmp_2;
end
code[a_, b_, c_] := If[LessEqual[b, -2.8e+35], If[GreaterEqual[b, 0.0], N[(-0.5 * N[(1.0 / N[(N[(0.5 / b), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(c * 2.0), $MachinePrecision] / N[((-b) - b), $MachinePrecision]), $MachinePrecision]], If[GreaterEqual[b, 0.0], N[((-b) / a), $MachinePrecision], N[(2.0 / N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(4.0 * N[(a * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.8 \cdot 10^{+35}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;-0.5 \cdot \frac{1}{\frac{0.5}{b} \cdot a}\\

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


\end{array}\\

\mathbf{elif}\;b \geq 0:\\
\;\;\;\;\frac{-b}{a}\\

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


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

    1. Initial program 55.4%

      \[\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. Simplified55.4%

      \[\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. Add Preprocessing
    4. Taylor expanded in b around -inf 94.7%

      \[\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{\color{blue}{c \cdot 2}}{-1 \cdot b - b}\\ \end{array} \]
    5. Step-by-step derivation
      1. clear-num94.7%

        \[\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}{-1 \cdot b - b}\\ \end{array} \]
      2. inv-pow94.7%

        \[\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}{-1 \cdot b - b}\\ \end{array} \]
      3. fma-udef94.7%

        \[\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}{-1 \cdot b - b}\\ \end{array} \]
      4. add-sqr-sqrt94.7%

        \[\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}{-1 \cdot b - b}\\ \end{array} \]
      5. hypot-def94.7%

        \[\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}{-1 \cdot b - b}\\ \end{array} \]
    6. Applied egg-rr94.7%

      \[\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}{-1 \cdot b - b}\\ \end{array} \]
    7. Step-by-step derivation
      1. unpow-194.7%

        \[\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}{-1 \cdot b - b}\\ \end{array} \]
    8. Simplified94.7%

      \[\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}{-1 \cdot b - b}\\ \end{array} \]
    9. Taylor expanded in a around 0 94.7%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \frac{1}{\color{blue}{0.5 \cdot \frac{a}{b}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{-1 \cdot b - b}\\ \end{array} \]
    10. Step-by-step derivation
      1. associate-*r/94.7%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \frac{1}{\color{blue}{\frac{0.5 \cdot a}{b}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{-1 \cdot b - b}\\ \end{array} \]
      2. *-rgt-identity94.7%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \frac{1}{\frac{0.5 \cdot a}{\color{blue}{b \cdot 1}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{-1 \cdot b - b}\\ \end{array} \]
      3. times-frac94.7%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \frac{1}{\color{blue}{\frac{0.5}{b} \cdot \frac{a}{1}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{-1 \cdot b - b}\\ \end{array} \]
      4. rem-square-sqrt94.7%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \frac{1}{\frac{0.5}{b} \cdot \frac{\color{blue}{\sqrt{a} \cdot \sqrt{a}}}{1}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{-1 \cdot b - b}\\ \end{array} \]
      5. associate-*r/94.7%

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

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

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \frac{1}{\frac{0.5}{b} \cdot \color{blue}{a}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{-1 \cdot b - b}\\ \end{array} \]
    11. Simplified94.7%

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

    if -2.79999999999999999e35 < b

    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. Step-by-step derivation
      1. sqr-neg78.1%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{\left(-b\right) - \sqrt{\color{blue}{\left(-b\right) \cdot \left(-b\right)} - \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. sqr-neg78.1%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{\left(-b\right) - \sqrt{\color{blue}{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. associate-*l*78.1%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{\left(-b\right) - \sqrt{b \cdot b - \color{blue}{4 \cdot \left(a \cdot c\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. *-commutative78.1%

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

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

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

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

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

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

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

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

Alternative 4: 67.9% accurate, 6.7× speedup?

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

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

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


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

    \[\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. Simplified72.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. Add Preprocessing
  4. Taylor expanded in b around -inf 72.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}:\\ \;\;\;\;\frac{\color{blue}{c \cdot 2}}{-1 \cdot b - b}\\ \end{array} \]
  5. Taylor expanded in b around inf 70.1%

    \[\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}{-1 \cdot b - b}\\ \end{array} \]
  6. Final simplification70.1%

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

Alternative 5: 67.6% accurate, 8.6× speedup?

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

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

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


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

    \[\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. Simplified72.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. Add Preprocessing
  4. Taylor expanded in b around -inf 72.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}:\\ \;\;\;\;\frac{\color{blue}{c \cdot 2}}{-1 \cdot b - b}\\ \end{array} \]
  5. Step-by-step derivation
    1. clear-num72.1%

      \[\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}{-1 \cdot b - b}\\ \end{array} \]
    2. inv-pow72.1%

      \[\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}{-1 \cdot b - b}\\ \end{array} \]
    3. fma-udef72.1%

      \[\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}{-1 \cdot b - b}\\ \end{array} \]
    4. add-sqr-sqrt61.3%

      \[\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}{-1 \cdot b - b}\\ \end{array} \]
    5. hypot-def62.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}{-1 \cdot b - b}\\ \end{array} \]
  6. Applied egg-rr62.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}{-1 \cdot b - b}\\ \end{array} \]
  7. Step-by-step derivation
    1. unpow-162.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}{-1 \cdot b - b}\\ \end{array} \]
  8. Simplified62.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}{-1 \cdot b - b}\\ \end{array} \]
  9. Taylor expanded in a around 0 69.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \frac{1}{\color{blue}{0.5 \cdot \frac{a}{b}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{-1 \cdot b - b}\\ \end{array} \]
  10. Step-by-step derivation
    1. associate-*r/69.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \frac{1}{\color{blue}{\frac{0.5 \cdot a}{b}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{-1 \cdot b - b}\\ \end{array} \]
    2. *-rgt-identity69.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \frac{1}{\frac{0.5 \cdot a}{\color{blue}{b \cdot 1}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{-1 \cdot b - b}\\ \end{array} \]
    3. times-frac69.8%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \frac{1}{\color{blue}{\frac{0.5}{b} \cdot \frac{a}{1}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{-1 \cdot b - b}\\ \end{array} \]
    4. rem-square-sqrt49.3%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \frac{1}{\frac{0.5}{b} \cdot \frac{\color{blue}{\sqrt{a} \cdot \sqrt{a}}}{1}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{-1 \cdot b - b}\\ \end{array} \]
    5. associate-*r/49.3%

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

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \frac{1}{\frac{0.5}{b} \cdot \color{blue}{a}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{-1 \cdot b - b}\\ \end{array} \]
  11. Simplified69.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \frac{1}{\color{blue}{\frac{0.5}{b} \cdot a}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{-1 \cdot b - b}\\ \end{array} \]
  12. Final simplification69.8%

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

Alternative 6: 67.6% accurate, 8.6× speedup?

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

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

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


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

    \[\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. Simplified72.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. Add Preprocessing
  4. Taylor expanded in b around -inf 72.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}:\\ \;\;\;\;\frac{\color{blue}{c \cdot 2}}{-1 \cdot b - b}\\ \end{array} \]
  5. Step-by-step derivation
    1. clear-num72.1%

      \[\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}{-1 \cdot b - b}\\ \end{array} \]
    2. inv-pow72.1%

      \[\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}{-1 \cdot b - b}\\ \end{array} \]
    3. fma-udef72.1%

      \[\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}{-1 \cdot b - b}\\ \end{array} \]
    4. add-sqr-sqrt61.3%

      \[\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}{-1 \cdot b - b}\\ \end{array} \]
    5. hypot-def62.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}{-1 \cdot b - b}\\ \end{array} \]
  6. Applied egg-rr62.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}{-1 \cdot b - b}\\ \end{array} \]
  7. Step-by-step derivation
    1. unpow-162.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}{-1 \cdot b - b}\\ \end{array} \]
  8. Simplified62.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}{-1 \cdot b - b}\\ \end{array} \]
  9. Taylor expanded in b around inf 69.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \frac{1}{\frac{a}{\color{blue}{2 \cdot b}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{-1 \cdot b - b}\\ \end{array} \]
  10. Step-by-step derivation
    1. *-commutative69.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \frac{1}{\frac{a}{\color{blue}{b \cdot 2}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{-1 \cdot b - b}\\ \end{array} \]
  11. Simplified69.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \frac{1}{\frac{a}{\color{blue}{b \cdot 2}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{-1 \cdot b - b}\\ \end{array} \]
  12. Final simplification69.9%

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

Alternative 7: 67.3% accurate, 10.1× speedup?

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

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

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


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

    \[\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. sqr-neg71.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{\left(-b\right) - \sqrt{\color{blue}{\left(-b\right) \cdot \left(-b\right)} - \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. sqr-neg71.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{\left(-b\right) - \sqrt{\color{blue}{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. associate-*l*71.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{\left(-b\right) - \sqrt{b \cdot b - \color{blue}{4 \cdot \left(a \cdot c\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. *-commutative71.9%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;\color{blue}{\frac{2}{-2 \cdot \frac{b}{c}}}\\ \end{array} \]
  9. Step-by-step derivation
    1. *-commutative69.2%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;\color{blue}{\frac{2}{\frac{b}{c} \cdot -2}}\\ \end{array} \]
  10. Simplified69.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;\color{blue}{\frac{2}{\frac{b}{c} \cdot -2}}\\ \end{array} \]
  11. Final simplification69.2%

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

Alternative 8: 35.8% accurate, 13.4× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\frac{b}{a}\\


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

    \[\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. sqr-neg71.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{\left(-b\right) - \sqrt{\color{blue}{\left(-b\right) \cdot \left(-b\right)} - \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. sqr-neg71.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{\left(-b\right) - \sqrt{\color{blue}{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. associate-*l*71.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{\left(-b\right) - \sqrt{b \cdot b - \color{blue}{4 \cdot \left(a \cdot c\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. *-commutative71.9%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;\color{blue}{\frac{2}{-2 \cdot \frac{a}{b}}}\\ \end{array} \]
  9. Step-by-step derivation
    1. associate-*r/37.2%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;\color{blue}{\frac{2}{\frac{-2 \cdot a}{b}}}\\ \end{array} \]
  10. Simplified37.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;\color{blue}{\frac{2}{\frac{-2 \cdot a}{b}}}\\ \end{array} \]
  11. Step-by-step derivation
    1. frac-2neg37.2%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-2}{-\frac{-2 \cdot a}{b}}\\ \end{array} \]
    2. metadata-eval37.2%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-2}{-\frac{-2 \cdot a}{b}}\\ \end{array} \]
    3. div-inv37.2%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{1}{-\frac{-2 \cdot a}{b}}\\ \end{array} \]
    4. add-sqr-sqrt35.8%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{1}{-\frac{-2 \cdot a}{\sqrt{b} \cdot \sqrt{b}}}\\ \end{array} \]
    5. sqrt-unprod37.5%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{1}{-\frac{-2 \cdot a}{\sqrt{b \cdot b}}}\\ \end{array} \]
    6. sqr-neg37.5%

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{1}{-\frac{-2 \cdot a}{\sqrt{-b} \cdot \sqrt{-b}}}\\ \end{array} \]
    8. add-sqr-sqrt37.6%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{1}{-\frac{-2 \cdot a}{-b}}\\ \end{array} \]
    9. distribute-frac-neg37.6%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \color{blue}{\frac{1}{\frac{--2 \cdot a}{-b}}}\\ \end{array} \]
    10. frac-2neg37.6%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \color{blue}{\frac{1}{\frac{-2 \cdot a}{b}}}\\ \end{array} \]
    11. clear-num37.6%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;\color{blue}{-2 \cdot \frac{b}{-2 \cdot a}}\\ \end{array} \]
    12. *-un-lft-identity37.6%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;\color{blue}{-2} \cdot \frac{1 \cdot b}{-2 \cdot a}\\ \end{array} \]
    13. times-frac37.6%

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;\color{blue}{-2} \cdot \left(-0.5 \cdot \frac{b}{a}\right)\\ \end{array} \]
  12. Applied egg-rr37.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \left(-0.5 \cdot \frac{b}{a}\right)\\ \end{array} \]
  13. Step-by-step derivation
    1. associate-*r*37.6%

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;1 \cdot \frac{b}{a}\\ \end{array} \]
    3. *-lft-identity37.6%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{a}\\ \end{array} \]
  14. Simplified37.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{a}\\ \end{array} \]
  15. Final simplification37.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{a}\\ \end{array} \]
  16. Add Preprocessing

Reproduce

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