jeff quadratic root 2

Percentage Accurate: 71.6% → 90.3%
Time: 16.1s
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.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{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: 90.3% accurate, 1.0× speedup?

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

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

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


\end{array}\\

\mathbf{elif}\;b \leq 5.5 \cdot 10^{+96}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;t_1\\

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


\end{array}\\

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

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


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

    1. Initial program 37.9%

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

        \[\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{\left(-b\right) + {\left(b \cdot b - \left(4 \cdot a\right) \cdot c\right)}^{0.5}}{2 \cdot a}\\ \end{array} \]
      2. *-commutative37.9%

        \[\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{\left(-b\right) + {\left(b \cdot b - c \cdot \left(4 \cdot a\right)\right)}^{0.5}}{2 \cdot a}\\ \end{array} \]
      3. *-commutative37.9%

        \[\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{\left(-b\right) + {\left(b \cdot b - c \cdot \left(a \cdot 4\right)\right)}^{0.5}}{2 \cdot a}\\ \end{array} \]
    3. Applied egg-rr37.9%

      \[\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{\left(-b\right) + {\left(b \cdot b - c \cdot \left(a \cdot 4\right)\right)}^{0.5}}{2 \cdot a}\\ \end{array} \]
    4. Taylor expanded in b around -inf 88.7%

      \[\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 \frac{c \cdot a}{b} + -2 \cdot b}{2 \cdot a}\\ \end{array} \]
    5. Step-by-step derivation
      1. fma-def88.7%

        \[\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{\mathsf{fma}\left(2, \frac{c \cdot a}{b}, -2 \cdot b\right)}{2 \cdot a}\\ \end{array} \]
      2. associate-*l/96.9%

        \[\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{\mathsf{fma}\left(2, \frac{c}{b} \cdot a, -2 \cdot b\right)}{2 \cdot a}\\ \end{array} \]
      3. *-commutative96.9%

        \[\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{\mathsf{fma}\left(2, a \cdot \frac{c}{b}, -2 \cdot b\right)}{2 \cdot a}\\ \end{array} \]
      4. *-commutative96.9%

        \[\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{\mathsf{fma}\left(2, a \cdot \frac{c}{b}, b \cdot -2\right)}{2 \cdot a}\\ \end{array} \]
    6. Simplified96.9%

      \[\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{\mathsf{fma}\left(2, a \cdot \frac{c}{b}, b \cdot -2\right)}{2 \cdot a}\\ \end{array} \]

    if -2.8000000000000003e157 < b < 5.5000000000000002e96

    1. Initial program 85.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. pow1/285.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{\left(-b\right) + {\left(b \cdot b - \left(4 \cdot a\right) \cdot c\right)}^{0.5}}{2 \cdot a}\\ \end{array} \]
      2. *-commutative85.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{\left(-b\right) + {\left(b \cdot b - c \cdot \left(4 \cdot a\right)\right)}^{0.5}}{2 \cdot a}\\ \end{array} \]
      3. *-commutative85.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{\left(-b\right) + {\left(b \cdot b - c \cdot \left(a \cdot 4\right)\right)}^{0.5}}{2 \cdot a}\\ \end{array} \]
    3. Applied egg-rr85.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{\left(-b\right) + {\left(b \cdot b - c \cdot \left(a \cdot 4\right)\right)}^{0.5}}{2 \cdot a}\\ \end{array} \]

    if 5.5000000000000002e96 < b

    1. Initial program 56.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. Simplified56.5%

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

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

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

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

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

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

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

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

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

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

Alternative 2: 90.3% accurate, 1.0× speedup?

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

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

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


\end{array}\\

\mathbf{elif}\;b \leq 4.4 \cdot 10^{+97}:\\
\;\;\;\;\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:\\
\;\;\;\;-2 \cdot \frac{c \cdot 0.5}{b}\\

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


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

    1. Initial program 37.9%

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

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

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

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

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

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

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

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

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

    if -2.8000000000000003e157 < b < 4.4000000000000002e97

    1. Initial program 85.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} \]

    if 4.4000000000000002e97 < b

    1. Initial program 56.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. Simplified56.5%

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

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

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

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

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

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

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

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

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

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

Alternative 3: 90.3% accurate, 1.0× speedup?

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

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

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


\end{array}\\

\mathbf{elif}\;b \leq 10^{+94}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;t_1\\

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


\end{array}\\

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

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


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

    1. Initial program 37.9%

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

        \[\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{\left(-b\right) + {\left(b \cdot b - \left(4 \cdot a\right) \cdot c\right)}^{0.5}}{2 \cdot a}\\ \end{array} \]
      2. *-commutative37.9%

        \[\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{\left(-b\right) + {\left(b \cdot b - c \cdot \left(4 \cdot a\right)\right)}^{0.5}}{2 \cdot a}\\ \end{array} \]
      3. *-commutative37.9%

        \[\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{\left(-b\right) + {\left(b \cdot b - c \cdot \left(a \cdot 4\right)\right)}^{0.5}}{2 \cdot a}\\ \end{array} \]
    3. Applied egg-rr37.9%

      \[\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{\left(-b\right) + {\left(b \cdot b - c \cdot \left(a \cdot 4\right)\right)}^{0.5}}{2 \cdot a}\\ \end{array} \]
    4. Taylor expanded in b around -inf 88.7%

      \[\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 \frac{c \cdot a}{b} + -2 \cdot b}{2 \cdot a}\\ \end{array} \]
    5. Step-by-step derivation
      1. fma-def88.7%

        \[\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{\mathsf{fma}\left(2, \frac{c \cdot a}{b}, -2 \cdot b\right)}{2 \cdot a}\\ \end{array} \]
      2. associate-*l/96.9%

        \[\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{\mathsf{fma}\left(2, \frac{c}{b} \cdot a, -2 \cdot b\right)}{2 \cdot a}\\ \end{array} \]
      3. *-commutative96.9%

        \[\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{\mathsf{fma}\left(2, a \cdot \frac{c}{b}, -2 \cdot b\right)}{2 \cdot a}\\ \end{array} \]
      4. *-commutative96.9%

        \[\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{\mathsf{fma}\left(2, a \cdot \frac{c}{b}, b \cdot -2\right)}{2 \cdot a}\\ \end{array} \]
    6. Simplified96.9%

      \[\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{\mathsf{fma}\left(2, a \cdot \frac{c}{b}, b \cdot -2\right)}{2 \cdot a}\\ \end{array} \]

    if -2.8000000000000003e157 < b < 1e94

    1. Initial program 85.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} \]

    if 1e94 < b

    1. Initial program 56.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. Simplified56.5%

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

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

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

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

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

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

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

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

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

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

Alternative 4: 79.7% accurate, 1.0× speedup?

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

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

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


\end{array}\\

\mathbf{elif}\;b \leq -4 \cdot 10^{-310}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\left(-\frac{c}{b}\right) - \frac{c \cdot c}{\frac{{b}^{3}}{a}}\\

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


\end{array}\\

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

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


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

    1. Initial program 37.9%

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

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

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

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

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

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

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

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

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

    if -2.8000000000000003e157 < b < -3.999999999999988e-310

    1. Initial program 89.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. Taylor expanded in c around 0 89.0%

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

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

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

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

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

    if -3.999999999999988e-310 < b

    1. Initial program 68.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. Simplified68.2%

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

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

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

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

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

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

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

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

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

Alternative 5: 85.3% accurate, 1.0× speedup?

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

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

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


\end{array}\\

\mathbf{elif}\;b \leq 9.2 \cdot 10^{-103}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;c \cdot \frac{2}{b - t_0}\\

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


\end{array}\\

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

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


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

    1. Initial program 37.9%

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

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

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

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

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

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

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

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

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

    if -2.8000000000000003e157 < b < 9.2000000000000003e-103

    1. Initial program 86.1%

      \[\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. expm1-log1p-u83.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 9.2000000000000003e-103 < b

    1. Initial program 66.1%

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

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

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

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

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

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

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

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

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

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

Alternative 6: 68.9% accurate, 6.9× speedup?

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

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

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


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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 69.2% accurate, 6.9× speedup?

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

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

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


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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 36.1% accurate, 13.0× speedup?

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

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

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


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

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

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

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

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

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

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

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

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

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \left(-0.5 \cdot \frac{b}{a}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(b + 1 \cdot b\right) \cdot -0.5}{a}\\ \end{array} \]
    4. *-un-lft-identity37.9%

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

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

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

Alternative 9: 68.8% accurate, 13.0× speedup?

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

Reproduce

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