jeff quadratic root 1

Percentage Accurate: 71.8% → 90.1%
Time: 21.6s
Alternatives: 8
Speedup: 1.0×

Specification

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

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

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


\end{array}
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 8 alternatives:

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

Initial Program: 71.8% accurate, 1.0× speedup?

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

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

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


\end{array}
\end{array}

Alternative 1: 90.1% accurate, 0.5× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;t_0\\


\end{array}\\

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

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


\end{array}\\

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

\mathbf{else}:\\
\;\;\;\;t_0\\


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

    1. Initial program 54.1%

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

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

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

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

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

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

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

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

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

    if -3.69999999999999995e77 < b < 9.9999999999999993e111

    1. Initial program 91.8%

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

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

    if 9.9999999999999993e111 < b

    1. Initial program 58.1%

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

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

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

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

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

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

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

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

Alternative 2: 85.7% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{-c}{b}\\ t_1 := \frac{b}{a} \cdot 2\\ \mathbf{if}\;b \leq -2.5 \cdot 10^{-66}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot t_1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array}\\ \mathbf{elif}\;b \leq -2 \cdot 10^{-311}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \frac{c \cdot -2}{b}\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot c}{\sqrt{c \cdot \left(a \cdot -4\right)} - b}\\ \end{array}\\ \mathbf{elif}\;b \leq 9 \cdot 10^{+112}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \frac{b + \sqrt{a \cdot \left(c \cdot -4\right) + b \cdot b}}{a}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array}\\ \mathbf{elif}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \left(-2 \cdot \frac{c}{b} + t_1\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (/ (- c) b)) (t_1 (* (/ b a) 2.0)))
   (if (<= b -2.5e-66)
     (if (>= b 0.0) (* -0.5 t_1) t_0)
     (if (<= b -2e-311)
       (if (>= b 0.0)
         (* -0.5 (/ (* c -2.0) b))
         (/ (* 2.0 c) (- (sqrt (* c (* a -4.0))) b)))
       (if (<= b 9e+112)
         (if (>= b 0.0)
           (* -0.5 (/ (+ b (sqrt (+ (* a (* c -4.0)) (* b b)))) a))
           t_0)
         (if (>= b 0.0) (* -0.5 (+ (* -2.0 (/ c b)) t_1)) t_0))))))
double code(double a, double b, double c) {
	double t_0 = -c / b;
	double t_1 = (b / a) * 2.0;
	double tmp_1;
	if (b <= -2.5e-66) {
		double tmp_2;
		if (b >= 0.0) {
			tmp_2 = -0.5 * t_1;
		} else {
			tmp_2 = t_0;
		}
		tmp_1 = tmp_2;
	} else if (b <= -2e-311) {
		double tmp_3;
		if (b >= 0.0) {
			tmp_3 = -0.5 * ((c * -2.0) / b);
		} else {
			tmp_3 = (2.0 * c) / (sqrt((c * (a * -4.0))) - b);
		}
		tmp_1 = tmp_3;
	} else if (b <= 9e+112) {
		double tmp_4;
		if (b >= 0.0) {
			tmp_4 = -0.5 * ((b + sqrt(((a * (c * -4.0)) + (b * b)))) / a);
		} else {
			tmp_4 = t_0;
		}
		tmp_1 = tmp_4;
	} else if (b >= 0.0) {
		tmp_1 = -0.5 * ((-2.0 * (c / b)) + t_1);
	} else {
		tmp_1 = t_0;
	}
	return tmp_1;
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    real(8) :: tmp_1
    real(8) :: tmp_2
    real(8) :: tmp_3
    real(8) :: tmp_4
    t_0 = -c / b
    t_1 = (b / a) * 2.0d0
    if (b <= (-2.5d-66)) then
        if (b >= 0.0d0) then
            tmp_2 = (-0.5d0) * t_1
        else
            tmp_2 = t_0
        end if
        tmp_1 = tmp_2
    else if (b <= (-2d-311)) then
        if (b >= 0.0d0) then
            tmp_3 = (-0.5d0) * ((c * (-2.0d0)) / b)
        else
            tmp_3 = (2.0d0 * c) / (sqrt((c * (a * (-4.0d0)))) - b)
        end if
        tmp_1 = tmp_3
    else if (b <= 9d+112) then
        if (b >= 0.0d0) then
            tmp_4 = (-0.5d0) * ((b + sqrt(((a * (c * (-4.0d0))) + (b * b)))) / a)
        else
            tmp_4 = t_0
        end if
        tmp_1 = tmp_4
    else if (b >= 0.0d0) then
        tmp_1 = (-0.5d0) * (((-2.0d0) * (c / b)) + t_1)
    else
        tmp_1 = t_0
    end if
    code = tmp_1
end function
public static double code(double a, double b, double c) {
	double t_0 = -c / b;
	double t_1 = (b / a) * 2.0;
	double tmp_1;
	if (b <= -2.5e-66) {
		double tmp_2;
		if (b >= 0.0) {
			tmp_2 = -0.5 * t_1;
		} else {
			tmp_2 = t_0;
		}
		tmp_1 = tmp_2;
	} else if (b <= -2e-311) {
		double tmp_3;
		if (b >= 0.0) {
			tmp_3 = -0.5 * ((c * -2.0) / b);
		} else {
			tmp_3 = (2.0 * c) / (Math.sqrt((c * (a * -4.0))) - b);
		}
		tmp_1 = tmp_3;
	} else if (b <= 9e+112) {
		double tmp_4;
		if (b >= 0.0) {
			tmp_4 = -0.5 * ((b + Math.sqrt(((a * (c * -4.0)) + (b * b)))) / a);
		} else {
			tmp_4 = t_0;
		}
		tmp_1 = tmp_4;
	} else if (b >= 0.0) {
		tmp_1 = -0.5 * ((-2.0 * (c / b)) + t_1);
	} else {
		tmp_1 = t_0;
	}
	return tmp_1;
}
def code(a, b, c):
	t_0 = -c / b
	t_1 = (b / a) * 2.0
	tmp_1 = 0
	if b <= -2.5e-66:
		tmp_2 = 0
		if b >= 0.0:
			tmp_2 = -0.5 * t_1
		else:
			tmp_2 = t_0
		tmp_1 = tmp_2
	elif b <= -2e-311:
		tmp_3 = 0
		if b >= 0.0:
			tmp_3 = -0.5 * ((c * -2.0) / b)
		else:
			tmp_3 = (2.0 * c) / (math.sqrt((c * (a * -4.0))) - b)
		tmp_1 = tmp_3
	elif b <= 9e+112:
		tmp_4 = 0
		if b >= 0.0:
			tmp_4 = -0.5 * ((b + math.sqrt(((a * (c * -4.0)) + (b * b)))) / a)
		else:
			tmp_4 = t_0
		tmp_1 = tmp_4
	elif b >= 0.0:
		tmp_1 = -0.5 * ((-2.0 * (c / b)) + t_1)
	else:
		tmp_1 = t_0
	return tmp_1
function code(a, b, c)
	t_0 = Float64(Float64(-c) / b)
	t_1 = Float64(Float64(b / a) * 2.0)
	tmp_1 = 0.0
	if (b <= -2.5e-66)
		tmp_2 = 0.0
		if (b >= 0.0)
			tmp_2 = Float64(-0.5 * t_1);
		else
			tmp_2 = t_0;
		end
		tmp_1 = tmp_2;
	elseif (b <= -2e-311)
		tmp_3 = 0.0
		if (b >= 0.0)
			tmp_3 = Float64(-0.5 * Float64(Float64(c * -2.0) / b));
		else
			tmp_3 = Float64(Float64(2.0 * c) / Float64(sqrt(Float64(c * Float64(a * -4.0))) - b));
		end
		tmp_1 = tmp_3;
	elseif (b <= 9e+112)
		tmp_4 = 0.0
		if (b >= 0.0)
			tmp_4 = Float64(-0.5 * Float64(Float64(b + sqrt(Float64(Float64(a * Float64(c * -4.0)) + Float64(b * b)))) / a));
		else
			tmp_4 = t_0;
		end
		tmp_1 = tmp_4;
	elseif (b >= 0.0)
		tmp_1 = Float64(-0.5 * Float64(Float64(-2.0 * Float64(c / b)) + t_1));
	else
		tmp_1 = t_0;
	end
	return tmp_1
end
function tmp_6 = code(a, b, c)
	t_0 = -c / b;
	t_1 = (b / a) * 2.0;
	tmp_2 = 0.0;
	if (b <= -2.5e-66)
		tmp_3 = 0.0;
		if (b >= 0.0)
			tmp_3 = -0.5 * t_1;
		else
			tmp_3 = t_0;
		end
		tmp_2 = tmp_3;
	elseif (b <= -2e-311)
		tmp_4 = 0.0;
		if (b >= 0.0)
			tmp_4 = -0.5 * ((c * -2.0) / b);
		else
			tmp_4 = (2.0 * c) / (sqrt((c * (a * -4.0))) - b);
		end
		tmp_2 = tmp_4;
	elseif (b <= 9e+112)
		tmp_5 = 0.0;
		if (b >= 0.0)
			tmp_5 = -0.5 * ((b + sqrt(((a * (c * -4.0)) + (b * b)))) / a);
		else
			tmp_5 = t_0;
		end
		tmp_2 = tmp_5;
	elseif (b >= 0.0)
		tmp_2 = -0.5 * ((-2.0 * (c / b)) + t_1);
	else
		tmp_2 = t_0;
	end
	tmp_6 = tmp_2;
end
code[a_, b_, c_] := Block[{t$95$0 = N[((-c) / b), $MachinePrecision]}, Block[{t$95$1 = N[(N[(b / a), $MachinePrecision] * 2.0), $MachinePrecision]}, If[LessEqual[b, -2.5e-66], If[GreaterEqual[b, 0.0], N[(-0.5 * t$95$1), $MachinePrecision], t$95$0], If[LessEqual[b, -2e-311], If[GreaterEqual[b, 0.0], N[(-0.5 * N[(N[(c * -2.0), $MachinePrecision] / b), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 * c), $MachinePrecision] / N[(N[Sqrt[N[(c * N[(a * -4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision]], If[LessEqual[b, 9e+112], If[GreaterEqual[b, 0.0], N[(-0.5 * N[(N[(b + N[Sqrt[N[(N[(a * N[(c * -4.0), $MachinePrecision]), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], t$95$0], If[GreaterEqual[b, 0.0], N[(-0.5 * N[(N[(-2.0 * N[(c / b), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{-c}{b}\\
t_1 := \frac{b}{a} \cdot 2\\
\mathbf{if}\;b \leq -2.5 \cdot 10^{-66}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;-0.5 \cdot t_1\\

\mathbf{else}:\\
\;\;\;\;t_0\\


\end{array}\\

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

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


\end{array}\\

\mathbf{elif}\;b \leq 9 \cdot 10^{+112}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;-0.5 \cdot \frac{b + \sqrt{a \cdot \left(c \cdot -4\right) + b \cdot b}}{a}\\

\mathbf{else}:\\
\;\;\;\;t_0\\


\end{array}\\

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

\mathbf{else}:\\
\;\;\;\;t_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if b < -2.49999999999999981e-66

    1. Initial program 66.9%

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

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

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

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

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

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

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

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

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

    if -2.49999999999999981e-66 < b < -1.9999999999999e-311

    1. Initial program 90.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.9999999999999e-311 < b < 8.9999999999999998e112

    1. Initial program 90.5%

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

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

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

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

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

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

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

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

    if 8.9999999999999998e112 < b

    1. Initial program 58.1%

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

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

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

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

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

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

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

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

Alternative 3: 90.1% accurate, 1.0× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;t_0\\


\end{array}\\

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

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


\end{array}\\

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

\mathbf{else}:\\
\;\;\;\;t_0\\


\end{array}\\

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

\mathbf{else}:\\
\;\;\;\;t_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if b < -3.09999999999999999e77

    1. Initial program 54.1%

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

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

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

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

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

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

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

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

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

    if -3.09999999999999999e77 < b < -1.9999999999999e-311

    1. Initial program 93.5%

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.9999999999999e-311 < b < 3.70000000000000004e112

    1. Initial program 90.5%

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

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

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

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

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

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

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

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

    if 3.70000000000000004e112 < b

    1. Initial program 58.1%

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

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

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

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

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

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

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

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

Alternative 4: 90.0% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{-c}{b}\\ t_1 := \sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)}\\ t_2 := \frac{b}{a} \cdot 2\\ \mathbf{if}\;b \leq -2.5 \cdot 10^{+77}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot t_2\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array}\\ \mathbf{elif}\;b \leq 9 \cdot 10^{+112}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{\left(-b\right) - t_1}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot c}{t_1 - b}\\ \end{array}\\ \mathbf{elif}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \left(-2 \cdot \frac{c}{b} + t_2\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (/ (- c) b))
        (t_1 (sqrt (- (* b b) (* c (* a 4.0)))))
        (t_2 (* (/ b a) 2.0)))
   (if (<= b -2.5e+77)
     (if (>= b 0.0) (* -0.5 t_2) t_0)
     (if (<= b 9e+112)
       (if (>= b 0.0) (/ (- (- b) t_1) (* a 2.0)) (/ (* 2.0 c) (- t_1 b)))
       (if (>= b 0.0) (* -0.5 (+ (* -2.0 (/ c b)) t_2)) t_0)))))
double code(double a, double b, double c) {
	double t_0 = -c / b;
	double t_1 = sqrt(((b * b) - (c * (a * 4.0))));
	double t_2 = (b / a) * 2.0;
	double tmp_1;
	if (b <= -2.5e+77) {
		double tmp_2;
		if (b >= 0.0) {
			tmp_2 = -0.5 * t_2;
		} else {
			tmp_2 = t_0;
		}
		tmp_1 = tmp_2;
	} else if (b <= 9e+112) {
		double tmp_3;
		if (b >= 0.0) {
			tmp_3 = (-b - t_1) / (a * 2.0);
		} else {
			tmp_3 = (2.0 * c) / (t_1 - b);
		}
		tmp_1 = tmp_3;
	} else if (b >= 0.0) {
		tmp_1 = -0.5 * ((-2.0 * (c / b)) + t_2);
	} else {
		tmp_1 = t_0;
	}
	return tmp_1;
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    real(8) :: tmp_1
    real(8) :: tmp_2
    real(8) :: tmp_3
    t_0 = -c / b
    t_1 = sqrt(((b * b) - (c * (a * 4.0d0))))
    t_2 = (b / a) * 2.0d0
    if (b <= (-2.5d+77)) then
        if (b >= 0.0d0) then
            tmp_2 = (-0.5d0) * t_2
        else
            tmp_2 = t_0
        end if
        tmp_1 = tmp_2
    else if (b <= 9d+112) then
        if (b >= 0.0d0) then
            tmp_3 = (-b - t_1) / (a * 2.0d0)
        else
            tmp_3 = (2.0d0 * c) / (t_1 - b)
        end if
        tmp_1 = tmp_3
    else if (b >= 0.0d0) then
        tmp_1 = (-0.5d0) * (((-2.0d0) * (c / b)) + t_2)
    else
        tmp_1 = t_0
    end if
    code = tmp_1
end function
public static double code(double a, double b, double c) {
	double t_0 = -c / b;
	double t_1 = Math.sqrt(((b * b) - (c * (a * 4.0))));
	double t_2 = (b / a) * 2.0;
	double tmp_1;
	if (b <= -2.5e+77) {
		double tmp_2;
		if (b >= 0.0) {
			tmp_2 = -0.5 * t_2;
		} else {
			tmp_2 = t_0;
		}
		tmp_1 = tmp_2;
	} else if (b <= 9e+112) {
		double tmp_3;
		if (b >= 0.0) {
			tmp_3 = (-b - t_1) / (a * 2.0);
		} else {
			tmp_3 = (2.0 * c) / (t_1 - b);
		}
		tmp_1 = tmp_3;
	} else if (b >= 0.0) {
		tmp_1 = -0.5 * ((-2.0 * (c / b)) + t_2);
	} else {
		tmp_1 = t_0;
	}
	return tmp_1;
}
def code(a, b, c):
	t_0 = -c / b
	t_1 = math.sqrt(((b * b) - (c * (a * 4.0))))
	t_2 = (b / a) * 2.0
	tmp_1 = 0
	if b <= -2.5e+77:
		tmp_2 = 0
		if b >= 0.0:
			tmp_2 = -0.5 * t_2
		else:
			tmp_2 = t_0
		tmp_1 = tmp_2
	elif b <= 9e+112:
		tmp_3 = 0
		if b >= 0.0:
			tmp_3 = (-b - t_1) / (a * 2.0)
		else:
			tmp_3 = (2.0 * c) / (t_1 - b)
		tmp_1 = tmp_3
	elif b >= 0.0:
		tmp_1 = -0.5 * ((-2.0 * (c / b)) + t_2)
	else:
		tmp_1 = t_0
	return tmp_1
function code(a, b, c)
	t_0 = Float64(Float64(-c) / b)
	t_1 = sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 4.0))))
	t_2 = Float64(Float64(b / a) * 2.0)
	tmp_1 = 0.0
	if (b <= -2.5e+77)
		tmp_2 = 0.0
		if (b >= 0.0)
			tmp_2 = Float64(-0.5 * t_2);
		else
			tmp_2 = t_0;
		end
		tmp_1 = tmp_2;
	elseif (b <= 9e+112)
		tmp_3 = 0.0
		if (b >= 0.0)
			tmp_3 = Float64(Float64(Float64(-b) - t_1) / Float64(a * 2.0));
		else
			tmp_3 = Float64(Float64(2.0 * c) / Float64(t_1 - b));
		end
		tmp_1 = tmp_3;
	elseif (b >= 0.0)
		tmp_1 = Float64(-0.5 * Float64(Float64(-2.0 * Float64(c / b)) + t_2));
	else
		tmp_1 = t_0;
	end
	return tmp_1
end
function tmp_5 = code(a, b, c)
	t_0 = -c / b;
	t_1 = sqrt(((b * b) - (c * (a * 4.0))));
	t_2 = (b / a) * 2.0;
	tmp_2 = 0.0;
	if (b <= -2.5e+77)
		tmp_3 = 0.0;
		if (b >= 0.0)
			tmp_3 = -0.5 * t_2;
		else
			tmp_3 = t_0;
		end
		tmp_2 = tmp_3;
	elseif (b <= 9e+112)
		tmp_4 = 0.0;
		if (b >= 0.0)
			tmp_4 = (-b - t_1) / (a * 2.0);
		else
			tmp_4 = (2.0 * c) / (t_1 - b);
		end
		tmp_2 = tmp_4;
	elseif (b >= 0.0)
		tmp_2 = -0.5 * ((-2.0 * (c / b)) + t_2);
	else
		tmp_2 = t_0;
	end
	tmp_5 = tmp_2;
end
code[a_, b_, c_] := Block[{t$95$0 = N[((-c) / b), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(c * N[(a * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(b / a), $MachinePrecision] * 2.0), $MachinePrecision]}, If[LessEqual[b, -2.5e+77], If[GreaterEqual[b, 0.0], N[(-0.5 * t$95$2), $MachinePrecision], t$95$0], If[LessEqual[b, 9e+112], If[GreaterEqual[b, 0.0], N[(N[((-b) - t$95$1), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 * c), $MachinePrecision] / N[(t$95$1 - b), $MachinePrecision]), $MachinePrecision]], If[GreaterEqual[b, 0.0], N[(-0.5 * N[(N[(-2.0 * N[(c / b), $MachinePrecision]), $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]]
\begin{array}{l}

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

\mathbf{else}:\\
\;\;\;\;t_0\\


\end{array}\\

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

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


\end{array}\\

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

\mathbf{else}:\\
\;\;\;\;t_0\\


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

    1. Initial program 54.1%

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

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

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

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

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

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

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

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

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

    if -2.50000000000000002e77 < b < 8.9999999999999998e112

    1. Initial program 91.8%

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

    if 8.9999999999999998e112 < b

    1. Initial program 58.1%

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

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

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

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

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

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

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

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

Alternative 5: 81.4% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{-c}{b}\\ t_1 := \frac{b}{a} \cdot 2\\ t_2 := \sqrt{c \cdot \left(a \cdot -4\right)}\\ \mathbf{if}\;b \leq -2.15 \cdot 10^{-66}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot t_1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array}\\ \mathbf{elif}\;b \leq -2 \cdot 10^{-311}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \frac{c \cdot -2}{b}\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot c}{t_2 - b}\\ \end{array}\\ \mathbf{elif}\;b \leq 7.6 \cdot 10^{-100}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \frac{b + t_2}{a}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array}\\ \mathbf{elif}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \left(-2 \cdot \frac{c}{b} + t_1\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (/ (- c) b)) (t_1 (* (/ b a) 2.0)) (t_2 (sqrt (* c (* a -4.0)))))
   (if (<= b -2.15e-66)
     (if (>= b 0.0) (* -0.5 t_1) t_0)
     (if (<= b -2e-311)
       (if (>= b 0.0) (* -0.5 (/ (* c -2.0) b)) (/ (* 2.0 c) (- t_2 b)))
       (if (<= b 7.6e-100)
         (if (>= b 0.0) (* -0.5 (/ (+ b t_2) a)) t_0)
         (if (>= b 0.0) (* -0.5 (+ (* -2.0 (/ c b)) t_1)) t_0))))))
double code(double a, double b, double c) {
	double t_0 = -c / b;
	double t_1 = (b / a) * 2.0;
	double t_2 = sqrt((c * (a * -4.0)));
	double tmp_1;
	if (b <= -2.15e-66) {
		double tmp_2;
		if (b >= 0.0) {
			tmp_2 = -0.5 * t_1;
		} else {
			tmp_2 = t_0;
		}
		tmp_1 = tmp_2;
	} else if (b <= -2e-311) {
		double tmp_3;
		if (b >= 0.0) {
			tmp_3 = -0.5 * ((c * -2.0) / b);
		} else {
			tmp_3 = (2.0 * c) / (t_2 - b);
		}
		tmp_1 = tmp_3;
	} else if (b <= 7.6e-100) {
		double tmp_4;
		if (b >= 0.0) {
			tmp_4 = -0.5 * ((b + t_2) / a);
		} else {
			tmp_4 = t_0;
		}
		tmp_1 = tmp_4;
	} else if (b >= 0.0) {
		tmp_1 = -0.5 * ((-2.0 * (c / b)) + t_1);
	} else {
		tmp_1 = t_0;
	}
	return tmp_1;
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    real(8) :: tmp_1
    real(8) :: tmp_2
    real(8) :: tmp_3
    real(8) :: tmp_4
    t_0 = -c / b
    t_1 = (b / a) * 2.0d0
    t_2 = sqrt((c * (a * (-4.0d0))))
    if (b <= (-2.15d-66)) then
        if (b >= 0.0d0) then
            tmp_2 = (-0.5d0) * t_1
        else
            tmp_2 = t_0
        end if
        tmp_1 = tmp_2
    else if (b <= (-2d-311)) then
        if (b >= 0.0d0) then
            tmp_3 = (-0.5d0) * ((c * (-2.0d0)) / b)
        else
            tmp_3 = (2.0d0 * c) / (t_2 - b)
        end if
        tmp_1 = tmp_3
    else if (b <= 7.6d-100) then
        if (b >= 0.0d0) then
            tmp_4 = (-0.5d0) * ((b + t_2) / a)
        else
            tmp_4 = t_0
        end if
        tmp_1 = tmp_4
    else if (b >= 0.0d0) then
        tmp_1 = (-0.5d0) * (((-2.0d0) * (c / b)) + t_1)
    else
        tmp_1 = t_0
    end if
    code = tmp_1
end function
public static double code(double a, double b, double c) {
	double t_0 = -c / b;
	double t_1 = (b / a) * 2.0;
	double t_2 = Math.sqrt((c * (a * -4.0)));
	double tmp_1;
	if (b <= -2.15e-66) {
		double tmp_2;
		if (b >= 0.0) {
			tmp_2 = -0.5 * t_1;
		} else {
			tmp_2 = t_0;
		}
		tmp_1 = tmp_2;
	} else if (b <= -2e-311) {
		double tmp_3;
		if (b >= 0.0) {
			tmp_3 = -0.5 * ((c * -2.0) / b);
		} else {
			tmp_3 = (2.0 * c) / (t_2 - b);
		}
		tmp_1 = tmp_3;
	} else if (b <= 7.6e-100) {
		double tmp_4;
		if (b >= 0.0) {
			tmp_4 = -0.5 * ((b + t_2) / a);
		} else {
			tmp_4 = t_0;
		}
		tmp_1 = tmp_4;
	} else if (b >= 0.0) {
		tmp_1 = -0.5 * ((-2.0 * (c / b)) + t_1);
	} else {
		tmp_1 = t_0;
	}
	return tmp_1;
}
def code(a, b, c):
	t_0 = -c / b
	t_1 = (b / a) * 2.0
	t_2 = math.sqrt((c * (a * -4.0)))
	tmp_1 = 0
	if b <= -2.15e-66:
		tmp_2 = 0
		if b >= 0.0:
			tmp_2 = -0.5 * t_1
		else:
			tmp_2 = t_0
		tmp_1 = tmp_2
	elif b <= -2e-311:
		tmp_3 = 0
		if b >= 0.0:
			tmp_3 = -0.5 * ((c * -2.0) / b)
		else:
			tmp_3 = (2.0 * c) / (t_2 - b)
		tmp_1 = tmp_3
	elif b <= 7.6e-100:
		tmp_4 = 0
		if b >= 0.0:
			tmp_4 = -0.5 * ((b + t_2) / a)
		else:
			tmp_4 = t_0
		tmp_1 = tmp_4
	elif b >= 0.0:
		tmp_1 = -0.5 * ((-2.0 * (c / b)) + t_1)
	else:
		tmp_1 = t_0
	return tmp_1
function code(a, b, c)
	t_0 = Float64(Float64(-c) / b)
	t_1 = Float64(Float64(b / a) * 2.0)
	t_2 = sqrt(Float64(c * Float64(a * -4.0)))
	tmp_1 = 0.0
	if (b <= -2.15e-66)
		tmp_2 = 0.0
		if (b >= 0.0)
			tmp_2 = Float64(-0.5 * t_1);
		else
			tmp_2 = t_0;
		end
		tmp_1 = tmp_2;
	elseif (b <= -2e-311)
		tmp_3 = 0.0
		if (b >= 0.0)
			tmp_3 = Float64(-0.5 * Float64(Float64(c * -2.0) / b));
		else
			tmp_3 = Float64(Float64(2.0 * c) / Float64(t_2 - b));
		end
		tmp_1 = tmp_3;
	elseif (b <= 7.6e-100)
		tmp_4 = 0.0
		if (b >= 0.0)
			tmp_4 = Float64(-0.5 * Float64(Float64(b + t_2) / a));
		else
			tmp_4 = t_0;
		end
		tmp_1 = tmp_4;
	elseif (b >= 0.0)
		tmp_1 = Float64(-0.5 * Float64(Float64(-2.0 * Float64(c / b)) + t_1));
	else
		tmp_1 = t_0;
	end
	return tmp_1
end
function tmp_6 = code(a, b, c)
	t_0 = -c / b;
	t_1 = (b / a) * 2.0;
	t_2 = sqrt((c * (a * -4.0)));
	tmp_2 = 0.0;
	if (b <= -2.15e-66)
		tmp_3 = 0.0;
		if (b >= 0.0)
			tmp_3 = -0.5 * t_1;
		else
			tmp_3 = t_0;
		end
		tmp_2 = tmp_3;
	elseif (b <= -2e-311)
		tmp_4 = 0.0;
		if (b >= 0.0)
			tmp_4 = -0.5 * ((c * -2.0) / b);
		else
			tmp_4 = (2.0 * c) / (t_2 - b);
		end
		tmp_2 = tmp_4;
	elseif (b <= 7.6e-100)
		tmp_5 = 0.0;
		if (b >= 0.0)
			tmp_5 = -0.5 * ((b + t_2) / a);
		else
			tmp_5 = t_0;
		end
		tmp_2 = tmp_5;
	elseif (b >= 0.0)
		tmp_2 = -0.5 * ((-2.0 * (c / b)) + t_1);
	else
		tmp_2 = t_0;
	end
	tmp_6 = tmp_2;
end
code[a_, b_, c_] := Block[{t$95$0 = N[((-c) / b), $MachinePrecision]}, Block[{t$95$1 = N[(N[(b / a), $MachinePrecision] * 2.0), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(c * N[(a * -4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[b, -2.15e-66], If[GreaterEqual[b, 0.0], N[(-0.5 * t$95$1), $MachinePrecision], t$95$0], If[LessEqual[b, -2e-311], If[GreaterEqual[b, 0.0], N[(-0.5 * N[(N[(c * -2.0), $MachinePrecision] / b), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 * c), $MachinePrecision] / N[(t$95$2 - b), $MachinePrecision]), $MachinePrecision]], If[LessEqual[b, 7.6e-100], If[GreaterEqual[b, 0.0], N[(-0.5 * N[(N[(b + t$95$2), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], t$95$0], If[GreaterEqual[b, 0.0], N[(-0.5 * N[(N[(-2.0 * N[(c / b), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]]]
\begin{array}{l}

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

\mathbf{else}:\\
\;\;\;\;t_0\\


\end{array}\\

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

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


\end{array}\\

\mathbf{elif}\;b \leq 7.6 \cdot 10^{-100}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;-0.5 \cdot \frac{b + t_2}{a}\\

\mathbf{else}:\\
\;\;\;\;t_0\\


\end{array}\\

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

\mathbf{else}:\\
\;\;\;\;t_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if b < -2.15000000000000007e-66

    1. Initial program 66.9%

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

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

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

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

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

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

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

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

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

    if -2.15000000000000007e-66 < b < -1.9999999999999e-311

    1. Initial program 90.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.9999999999999e-311 < b < 7.59999999999999995e-100

    1. Initial program 88.3%

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

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

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

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

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

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

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

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

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

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

    if 7.59999999999999995e-100 < b

    1. Initial program 73.2%

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

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

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

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

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

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

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

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

Alternative 6: 74.7% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{-c}{b}\\ t_1 := \frac{b}{a} \cdot 2\\ \mathbf{if}\;b \leq -2.3 \cdot 10^{-69}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot t_1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array}\\ \mathbf{elif}\;b \leq 10^{-296}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \frac{c \cdot -2}{b}\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot c}{\sqrt{c \cdot \left(a \cdot -4\right)} - b}\\ \end{array}\\ \mathbf{elif}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \left(-2 \cdot \frac{c}{b} + t_1\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (/ (- c) b)) (t_1 (* (/ b a) 2.0)))
   (if (<= b -2.3e-69)
     (if (>= b 0.0) (* -0.5 t_1) t_0)
     (if (<= b 1e-296)
       (if (>= b 0.0)
         (* -0.5 (/ (* c -2.0) b))
         (/ (* 2.0 c) (- (sqrt (* c (* a -4.0))) b)))
       (if (>= b 0.0) (* -0.5 (+ (* -2.0 (/ c b)) t_1)) t_0)))))
double code(double a, double b, double c) {
	double t_0 = -c / b;
	double t_1 = (b / a) * 2.0;
	double tmp_1;
	if (b <= -2.3e-69) {
		double tmp_2;
		if (b >= 0.0) {
			tmp_2 = -0.5 * t_1;
		} else {
			tmp_2 = t_0;
		}
		tmp_1 = tmp_2;
	} else if (b <= 1e-296) {
		double tmp_3;
		if (b >= 0.0) {
			tmp_3 = -0.5 * ((c * -2.0) / b);
		} else {
			tmp_3 = (2.0 * c) / (sqrt((c * (a * -4.0))) - b);
		}
		tmp_1 = tmp_3;
	} else if (b >= 0.0) {
		tmp_1 = -0.5 * ((-2.0 * (c / b)) + t_1);
	} else {
		tmp_1 = t_0;
	}
	return tmp_1;
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    real(8) :: tmp_1
    real(8) :: tmp_2
    real(8) :: tmp_3
    t_0 = -c / b
    t_1 = (b / a) * 2.0d0
    if (b <= (-2.3d-69)) then
        if (b >= 0.0d0) then
            tmp_2 = (-0.5d0) * t_1
        else
            tmp_2 = t_0
        end if
        tmp_1 = tmp_2
    else if (b <= 1d-296) then
        if (b >= 0.0d0) then
            tmp_3 = (-0.5d0) * ((c * (-2.0d0)) / b)
        else
            tmp_3 = (2.0d0 * c) / (sqrt((c * (a * (-4.0d0)))) - b)
        end if
        tmp_1 = tmp_3
    else if (b >= 0.0d0) then
        tmp_1 = (-0.5d0) * (((-2.0d0) * (c / b)) + t_1)
    else
        tmp_1 = t_0
    end if
    code = tmp_1
end function
public static double code(double a, double b, double c) {
	double t_0 = -c / b;
	double t_1 = (b / a) * 2.0;
	double tmp_1;
	if (b <= -2.3e-69) {
		double tmp_2;
		if (b >= 0.0) {
			tmp_2 = -0.5 * t_1;
		} else {
			tmp_2 = t_0;
		}
		tmp_1 = tmp_2;
	} else if (b <= 1e-296) {
		double tmp_3;
		if (b >= 0.0) {
			tmp_3 = -0.5 * ((c * -2.0) / b);
		} else {
			tmp_3 = (2.0 * c) / (Math.sqrt((c * (a * -4.0))) - b);
		}
		tmp_1 = tmp_3;
	} else if (b >= 0.0) {
		tmp_1 = -0.5 * ((-2.0 * (c / b)) + t_1);
	} else {
		tmp_1 = t_0;
	}
	return tmp_1;
}
def code(a, b, c):
	t_0 = -c / b
	t_1 = (b / a) * 2.0
	tmp_1 = 0
	if b <= -2.3e-69:
		tmp_2 = 0
		if b >= 0.0:
			tmp_2 = -0.5 * t_1
		else:
			tmp_2 = t_0
		tmp_1 = tmp_2
	elif b <= 1e-296:
		tmp_3 = 0
		if b >= 0.0:
			tmp_3 = -0.5 * ((c * -2.0) / b)
		else:
			tmp_3 = (2.0 * c) / (math.sqrt((c * (a * -4.0))) - b)
		tmp_1 = tmp_3
	elif b >= 0.0:
		tmp_1 = -0.5 * ((-2.0 * (c / b)) + t_1)
	else:
		tmp_1 = t_0
	return tmp_1
function code(a, b, c)
	t_0 = Float64(Float64(-c) / b)
	t_1 = Float64(Float64(b / a) * 2.0)
	tmp_1 = 0.0
	if (b <= -2.3e-69)
		tmp_2 = 0.0
		if (b >= 0.0)
			tmp_2 = Float64(-0.5 * t_1);
		else
			tmp_2 = t_0;
		end
		tmp_1 = tmp_2;
	elseif (b <= 1e-296)
		tmp_3 = 0.0
		if (b >= 0.0)
			tmp_3 = Float64(-0.5 * Float64(Float64(c * -2.0) / b));
		else
			tmp_3 = Float64(Float64(2.0 * c) / Float64(sqrt(Float64(c * Float64(a * -4.0))) - b));
		end
		tmp_1 = tmp_3;
	elseif (b >= 0.0)
		tmp_1 = Float64(-0.5 * Float64(Float64(-2.0 * Float64(c / b)) + t_1));
	else
		tmp_1 = t_0;
	end
	return tmp_1
end
function tmp_5 = code(a, b, c)
	t_0 = -c / b;
	t_1 = (b / a) * 2.0;
	tmp_2 = 0.0;
	if (b <= -2.3e-69)
		tmp_3 = 0.0;
		if (b >= 0.0)
			tmp_3 = -0.5 * t_1;
		else
			tmp_3 = t_0;
		end
		tmp_2 = tmp_3;
	elseif (b <= 1e-296)
		tmp_4 = 0.0;
		if (b >= 0.0)
			tmp_4 = -0.5 * ((c * -2.0) / b);
		else
			tmp_4 = (2.0 * c) / (sqrt((c * (a * -4.0))) - b);
		end
		tmp_2 = tmp_4;
	elseif (b >= 0.0)
		tmp_2 = -0.5 * ((-2.0 * (c / b)) + t_1);
	else
		tmp_2 = t_0;
	end
	tmp_5 = tmp_2;
end
code[a_, b_, c_] := Block[{t$95$0 = N[((-c) / b), $MachinePrecision]}, Block[{t$95$1 = N[(N[(b / a), $MachinePrecision] * 2.0), $MachinePrecision]}, If[LessEqual[b, -2.3e-69], If[GreaterEqual[b, 0.0], N[(-0.5 * t$95$1), $MachinePrecision], t$95$0], If[LessEqual[b, 1e-296], If[GreaterEqual[b, 0.0], N[(-0.5 * N[(N[(c * -2.0), $MachinePrecision] / b), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 * c), $MachinePrecision] / N[(N[Sqrt[N[(c * N[(a * -4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision]], If[GreaterEqual[b, 0.0], N[(-0.5 * N[(N[(-2.0 * N[(c / b), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{-c}{b}\\
t_1 := \frac{b}{a} \cdot 2\\
\mathbf{if}\;b \leq -2.3 \cdot 10^{-69}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;-0.5 \cdot t_1\\

\mathbf{else}:\\
\;\;\;\;t_0\\


\end{array}\\

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

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


\end{array}\\

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

\mathbf{else}:\\
\;\;\;\;t_0\\


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

    1. Initial program 66.9%

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

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

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

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

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

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

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

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

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

    if -2.3000000000000001e-69 < b < 1e-296

    1. Initial program 90.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1e-296 < b

    1. Initial program 75.9%

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

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

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

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

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

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

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

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

Alternative 7: 68.4% accurate, 7.8× speedup?

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

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

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


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

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

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

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

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

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

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

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

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

Alternative 8: 68.2% accurate, 13.0× speedup?

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

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

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


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

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

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

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

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

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

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

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

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

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

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

Reproduce

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