jeff quadratic root 2

Percentage Accurate: 71.9% → 87.7%
Time: 34.2s
Alternatives: 9
Speedup: 1.0×

Specification

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

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

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


\end{array}
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 9 alternatives:

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

Initial Program: 71.9% accurate, 1.0× speedup?

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

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

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


\end{array}
\end{array}

Alternative 1: 87.7% accurate, 0.5× speedup?

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

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

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


\end{array}\\

\mathbf{elif}\;b \leq 3.6 \cdot 10^{+39}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{\mathsf{fma}\left(b, b, t\_0\right)}}\\

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


\end{array}\\

\mathbf{elif}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot c}{b \cdot -2}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if b < -6.3000000000000002e-9

    1. Initial program 59.5%

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

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

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

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

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

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

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

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

    if -6.3000000000000002e-9 < b < 3.59999999999999984e39

    1. Initial program 83.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      if 3.59999999999999984e39 < b

      1. Initial program 65.4%

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

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

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

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

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

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

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

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

    Alternative 2: 90.1% accurate, 0.9× speedup?

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

      1. Initial program 43.2%

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

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

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

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

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

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

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

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{b}{a}\\ \mathbf{else}:\\ \;\;\;\;-1 \cdot \frac{b}{a}\\ \end{array} \]
      9. Step-by-step derivation
        1. mul-1-neg98.3%

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

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

      if -7.9999999999999998e120 < b < -3.999999999999988e-310

      1. Initial program 86.8%

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

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

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

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

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

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

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

      if -3.999999999999988e-310 < b < 3.99999999999999976e39

      1. Initial program 82.6%

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

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

      if 3.99999999999999976e39 < b

      1. Initial program 65.4%

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

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

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

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

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

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

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

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

    Alternative 3: 90.1% accurate, 0.9× speedup?

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

      1. Initial program 43.2%

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

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

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

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

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

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

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

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{b}{a}\\ \mathbf{else}:\\ \;\;\;\;-1 \cdot \frac{b}{a}\\ \end{array} \]
      9. Step-by-step derivation
        1. mul-1-neg98.3%

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

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

      if -1.00000000000000004e121 < b < 7.99999999999999982e38

      1. Initial program 84.8%

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

      if 7.99999999999999982e38 < b

      1. Initial program 65.4%

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

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

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

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

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

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

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

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

    Alternative 4: 79.3% accurate, 1.0× speedup?

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

      1. Initial program 43.2%

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

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

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

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

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

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

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

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{b}{a}\\ \mathbf{else}:\\ \;\;\;\;-1 \cdot \frac{b}{a}\\ \end{array} \]
      9. Step-by-step derivation
        1. mul-1-neg98.3%

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

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

      if -6e120 < b

      1. Initial program 78.4%

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

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

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

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

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

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

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

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

    Alternative 5: 66.8% accurate, 6.0× speedup?

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

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

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

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

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

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

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

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

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

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

    Alternative 6: 68.0% accurate, 6.7× speedup?

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

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

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

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

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

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

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

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

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

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

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

    Alternative 7: 67.9% accurate, 6.7× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 8: 67.9% accurate, 10.1× speedup?

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

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

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

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

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

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

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

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

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

    Alternative 9: 36.3% 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(b / a);
    	else
    		tmp = Float64(b / Float64(-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.0%

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

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

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

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

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

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

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{b}{a}\\ \mathbf{else}:\\ \;\;\;\;-1 \cdot \frac{b}{a}\\ \end{array} \]
    9. Step-by-step derivation
      1. mul-1-neg36.5%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{b}{a}\\ \mathbf{else}:\\ \;\;\;\;-\frac{b}{a}\\ \end{array} \]
    10. Simplified36.5%

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

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

    Reproduce

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