quad2m (problem 3.2.1, negative)

Percentage Accurate: 52.0% → 85.4%
Time: 13.9s
Alternatives: 9
Speedup: 15.9×

Specification

?
\[\begin{array}{l} \\ \frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a} \end{array} \]
(FPCore (a b_2 c)
 :precision binary64
 (/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))
double code(double a, double b_2, double c) {
	return (-b_2 - sqrt(((b_2 * b_2) - (a * c)))) / a;
}
real(8) function code(a, b_2, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b_2
    real(8), intent (in) :: c
    code = (-b_2 - sqrt(((b_2 * b_2) - (a * c)))) / a
end function
public static double code(double a, double b_2, double c) {
	return (-b_2 - Math.sqrt(((b_2 * b_2) - (a * c)))) / a;
}
def code(a, b_2, c):
	return (-b_2 - math.sqrt(((b_2 * b_2) - (a * c)))) / a
function code(a, b_2, c)
	return Float64(Float64(Float64(-b_2) - sqrt(Float64(Float64(b_2 * b_2) - Float64(a * c)))) / a)
end
function tmp = code(a, b_2, c)
	tmp = (-b_2 - sqrt(((b_2 * b_2) - (a * c)))) / a;
end
code[a_, b$95$2_, c_] := N[(N[((-b$95$2) - N[Sqrt[N[(N[(b$95$2 * b$95$2), $MachinePrecision] - N[(a * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]
\begin{array}{l}

\\
\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 9 alternatives:

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

Initial Program: 52.0% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a} \end{array} \]
(FPCore (a b_2 c)
 :precision binary64
 (/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))
double code(double a, double b_2, double c) {
	return (-b_2 - sqrt(((b_2 * b_2) - (a * c)))) / a;
}
real(8) function code(a, b_2, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b_2
    real(8), intent (in) :: c
    code = (-b_2 - sqrt(((b_2 * b_2) - (a * c)))) / a
end function
public static double code(double a, double b_2, double c) {
	return (-b_2 - Math.sqrt(((b_2 * b_2) - (a * c)))) / a;
}
def code(a, b_2, c):
	return (-b_2 - math.sqrt(((b_2 * b_2) - (a * c)))) / a
function code(a, b_2, c)
	return Float64(Float64(Float64(-b_2) - sqrt(Float64(Float64(b_2 * b_2) - Float64(a * c)))) / a)
end
function tmp = code(a, b_2, c)
	tmp = (-b_2 - sqrt(((b_2 * b_2) - (a * c)))) / a;
end
code[a_, b$95$2_, c_] := N[(N[((-b$95$2) - N[Sqrt[N[(N[(b$95$2 * b$95$2), $MachinePrecision] - N[(a * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]
\begin{array}{l}

\\
\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}
\end{array}

Alternative 1: 85.4% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b_2 \leq -3.2 \cdot 10^{-105}:\\ \;\;\;\;\frac{-0.5 \cdot c}{b_2}\\ \mathbf{elif}\;b_2 \leq 5 \cdot 10^{+102}:\\ \;\;\;\;\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - c \cdot a}}{a}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a} + 0.5 \cdot \frac{c}{b_2}\\ \end{array} \end{array} \]
(FPCore (a b_2 c)
 :precision binary64
 (if (<= b_2 -3.2e-105)
   (/ (* -0.5 c) b_2)
   (if (<= b_2 5e+102)
     (/ (- (- b_2) (sqrt (- (* b_2 b_2) (* c a)))) a)
     (+ (* -2.0 (/ b_2 a)) (* 0.5 (/ c b_2))))))
double code(double a, double b_2, double c) {
	double tmp;
	if (b_2 <= -3.2e-105) {
		tmp = (-0.5 * c) / b_2;
	} else if (b_2 <= 5e+102) {
		tmp = (-b_2 - sqrt(((b_2 * b_2) - (c * a)))) / a;
	} else {
		tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2));
	}
	return tmp;
}
real(8) function code(a, b_2, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b_2
    real(8), intent (in) :: c
    real(8) :: tmp
    if (b_2 <= (-3.2d-105)) then
        tmp = ((-0.5d0) * c) / b_2
    else if (b_2 <= 5d+102) then
        tmp = (-b_2 - sqrt(((b_2 * b_2) - (c * a)))) / a
    else
        tmp = ((-2.0d0) * (b_2 / a)) + (0.5d0 * (c / b_2))
    end if
    code = tmp
end function
public static double code(double a, double b_2, double c) {
	double tmp;
	if (b_2 <= -3.2e-105) {
		tmp = (-0.5 * c) / b_2;
	} else if (b_2 <= 5e+102) {
		tmp = (-b_2 - Math.sqrt(((b_2 * b_2) - (c * a)))) / a;
	} else {
		tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2));
	}
	return tmp;
}
def code(a, b_2, c):
	tmp = 0
	if b_2 <= -3.2e-105:
		tmp = (-0.5 * c) / b_2
	elif b_2 <= 5e+102:
		tmp = (-b_2 - math.sqrt(((b_2 * b_2) - (c * a)))) / a
	else:
		tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2))
	return tmp
function code(a, b_2, c)
	tmp = 0.0
	if (b_2 <= -3.2e-105)
		tmp = Float64(Float64(-0.5 * c) / b_2);
	elseif (b_2 <= 5e+102)
		tmp = Float64(Float64(Float64(-b_2) - sqrt(Float64(Float64(b_2 * b_2) - Float64(c * a)))) / a);
	else
		tmp = Float64(Float64(-2.0 * Float64(b_2 / a)) + Float64(0.5 * Float64(c / b_2)));
	end
	return tmp
end
function tmp_2 = code(a, b_2, c)
	tmp = 0.0;
	if (b_2 <= -3.2e-105)
		tmp = (-0.5 * c) / b_2;
	elseif (b_2 <= 5e+102)
		tmp = (-b_2 - sqrt(((b_2 * b_2) - (c * a)))) / a;
	else
		tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2));
	end
	tmp_2 = tmp;
end
code[a_, b$95$2_, c_] := If[LessEqual[b$95$2, -3.2e-105], N[(N[(-0.5 * c), $MachinePrecision] / b$95$2), $MachinePrecision], If[LessEqual[b$95$2, 5e+102], N[(N[((-b$95$2) - N[Sqrt[N[(N[(b$95$2 * b$95$2), $MachinePrecision] - N[(c * a), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(N[(-2.0 * N[(b$95$2 / a), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(c / b$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b_2 \leq -3.2 \cdot 10^{-105}:\\
\;\;\;\;\frac{-0.5 \cdot c}{b_2}\\

\mathbf{elif}\;b_2 \leq 5 \cdot 10^{+102}:\\
\;\;\;\;\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - c \cdot a}}{a}\\

\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{b_2}{a} + 0.5 \cdot \frac{c}{b_2}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if b_2 < -3.19999999999999981e-105

    1. Initial program 17.2%

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a} \]
    2. Step-by-step derivation
      1. frac-2neg17.2%

        \[\leadsto \color{blue}{\frac{-\left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right)}{-a}} \]
      2. div-inv17.1%

        \[\leadsto \color{blue}{\left(-\left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right)\right) \cdot \frac{1}{-a}} \]
    3. Applied egg-rr25.4%

      \[\leadsto \color{blue}{\left(b_2 + \mathsf{hypot}\left(b_2, \sqrt{c \cdot \left(-a\right)}\right)\right) \cdot \frac{1}{-a}} \]
    4. Taylor expanded in b_2 around -inf 0.0%

      \[\leadsto \color{blue}{0.5 \cdot \frac{c \cdot {\left(\sqrt{-1}\right)}^{2}}{b_2}} \]
    5. Step-by-step derivation
      1. associate-*r/0.0%

        \[\leadsto \color{blue}{\frac{0.5 \cdot \left(c \cdot {\left(\sqrt{-1}\right)}^{2}\right)}{b_2}} \]
      2. *-commutative0.0%

        \[\leadsto \frac{0.5 \cdot \color{blue}{\left({\left(\sqrt{-1}\right)}^{2} \cdot c\right)}}{b_2} \]
      3. unpow20.0%

        \[\leadsto \frac{0.5 \cdot \left(\color{blue}{\left(\sqrt{-1} \cdot \sqrt{-1}\right)} \cdot c\right)}{b_2} \]
      4. rem-square-sqrt83.4%

        \[\leadsto \frac{0.5 \cdot \left(\color{blue}{-1} \cdot c\right)}{b_2} \]
      5. associate-*r*83.4%

        \[\leadsto \frac{\color{blue}{\left(0.5 \cdot -1\right) \cdot c}}{b_2} \]
      6. metadata-eval83.4%

        \[\leadsto \frac{\color{blue}{-0.5} \cdot c}{b_2} \]
    6. Simplified83.4%

      \[\leadsto \color{blue}{\frac{-0.5 \cdot c}{b_2}} \]

    if -3.19999999999999981e-105 < b_2 < 5e102

    1. Initial program 82.3%

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a} \]

    if 5e102 < b_2

    1. Initial program 52.5%

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a} \]
    2. Taylor expanded in b_2 around inf 98.3%

      \[\leadsto \color{blue}{-2 \cdot \frac{b_2}{a} + 0.5 \cdot \frac{c}{b_2}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification86.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \leq -3.2 \cdot 10^{-105}:\\ \;\;\;\;\frac{-0.5 \cdot c}{b_2}\\ \mathbf{elif}\;b_2 \leq 5 \cdot 10^{+102}:\\ \;\;\;\;\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - c \cdot a}}{a}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a} + 0.5 \cdot \frac{c}{b_2}\\ \end{array} \]

Alternative 2: 80.6% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b_2 \leq -1.6 \cdot 10^{-107}:\\ \;\;\;\;\frac{-0.5 \cdot c}{b_2}\\ \mathbf{elif}\;b_2 \leq 2.9 \cdot 10^{-72}:\\ \;\;\;\;\frac{\left(-b_2\right) - \sqrt{a \cdot \left(-c\right)}}{a}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a} + 0.5 \cdot \frac{c}{b_2}\\ \end{array} \end{array} \]
(FPCore (a b_2 c)
 :precision binary64
 (if (<= b_2 -1.6e-107)
   (/ (* -0.5 c) b_2)
   (if (<= b_2 2.9e-72)
     (/ (- (- b_2) (sqrt (* a (- c)))) a)
     (+ (* -2.0 (/ b_2 a)) (* 0.5 (/ c b_2))))))
double code(double a, double b_2, double c) {
	double tmp;
	if (b_2 <= -1.6e-107) {
		tmp = (-0.5 * c) / b_2;
	} else if (b_2 <= 2.9e-72) {
		tmp = (-b_2 - sqrt((a * -c))) / a;
	} else {
		tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2));
	}
	return tmp;
}
real(8) function code(a, b_2, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b_2
    real(8), intent (in) :: c
    real(8) :: tmp
    if (b_2 <= (-1.6d-107)) then
        tmp = ((-0.5d0) * c) / b_2
    else if (b_2 <= 2.9d-72) then
        tmp = (-b_2 - sqrt((a * -c))) / a
    else
        tmp = ((-2.0d0) * (b_2 / a)) + (0.5d0 * (c / b_2))
    end if
    code = tmp
end function
public static double code(double a, double b_2, double c) {
	double tmp;
	if (b_2 <= -1.6e-107) {
		tmp = (-0.5 * c) / b_2;
	} else if (b_2 <= 2.9e-72) {
		tmp = (-b_2 - Math.sqrt((a * -c))) / a;
	} else {
		tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2));
	}
	return tmp;
}
def code(a, b_2, c):
	tmp = 0
	if b_2 <= -1.6e-107:
		tmp = (-0.5 * c) / b_2
	elif b_2 <= 2.9e-72:
		tmp = (-b_2 - math.sqrt((a * -c))) / a
	else:
		tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2))
	return tmp
function code(a, b_2, c)
	tmp = 0.0
	if (b_2 <= -1.6e-107)
		tmp = Float64(Float64(-0.5 * c) / b_2);
	elseif (b_2 <= 2.9e-72)
		tmp = Float64(Float64(Float64(-b_2) - sqrt(Float64(a * Float64(-c)))) / a);
	else
		tmp = Float64(Float64(-2.0 * Float64(b_2 / a)) + Float64(0.5 * Float64(c / b_2)));
	end
	return tmp
end
function tmp_2 = code(a, b_2, c)
	tmp = 0.0;
	if (b_2 <= -1.6e-107)
		tmp = (-0.5 * c) / b_2;
	elseif (b_2 <= 2.9e-72)
		tmp = (-b_2 - sqrt((a * -c))) / a;
	else
		tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2));
	end
	tmp_2 = tmp;
end
code[a_, b$95$2_, c_] := If[LessEqual[b$95$2, -1.6e-107], N[(N[(-0.5 * c), $MachinePrecision] / b$95$2), $MachinePrecision], If[LessEqual[b$95$2, 2.9e-72], N[(N[((-b$95$2) - N[Sqrt[N[(a * (-c)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(N[(-2.0 * N[(b$95$2 / a), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(c / b$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b_2 \leq -1.6 \cdot 10^{-107}:\\
\;\;\;\;\frac{-0.5 \cdot c}{b_2}\\

\mathbf{elif}\;b_2 \leq 2.9 \cdot 10^{-72}:\\
\;\;\;\;\frac{\left(-b_2\right) - \sqrt{a \cdot \left(-c\right)}}{a}\\

\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{b_2}{a} + 0.5 \cdot \frac{c}{b_2}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if b_2 < -1.60000000000000006e-107

    1. Initial program 17.2%

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a} \]
    2. Step-by-step derivation
      1. frac-2neg17.2%

        \[\leadsto \color{blue}{\frac{-\left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right)}{-a}} \]
      2. div-inv17.1%

        \[\leadsto \color{blue}{\left(-\left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right)\right) \cdot \frac{1}{-a}} \]
    3. Applied egg-rr25.4%

      \[\leadsto \color{blue}{\left(b_2 + \mathsf{hypot}\left(b_2, \sqrt{c \cdot \left(-a\right)}\right)\right) \cdot \frac{1}{-a}} \]
    4. Taylor expanded in b_2 around -inf 0.0%

      \[\leadsto \color{blue}{0.5 \cdot \frac{c \cdot {\left(\sqrt{-1}\right)}^{2}}{b_2}} \]
    5. Step-by-step derivation
      1. associate-*r/0.0%

        \[\leadsto \color{blue}{\frac{0.5 \cdot \left(c \cdot {\left(\sqrt{-1}\right)}^{2}\right)}{b_2}} \]
      2. *-commutative0.0%

        \[\leadsto \frac{0.5 \cdot \color{blue}{\left({\left(\sqrt{-1}\right)}^{2} \cdot c\right)}}{b_2} \]
      3. unpow20.0%

        \[\leadsto \frac{0.5 \cdot \left(\color{blue}{\left(\sqrt{-1} \cdot \sqrt{-1}\right)} \cdot c\right)}{b_2} \]
      4. rem-square-sqrt83.4%

        \[\leadsto \frac{0.5 \cdot \left(\color{blue}{-1} \cdot c\right)}{b_2} \]
      5. associate-*r*83.4%

        \[\leadsto \frac{\color{blue}{\left(0.5 \cdot -1\right) \cdot c}}{b_2} \]
      6. metadata-eval83.4%

        \[\leadsto \frac{\color{blue}{-0.5} \cdot c}{b_2} \]
    6. Simplified83.4%

      \[\leadsto \color{blue}{\frac{-0.5 \cdot c}{b_2}} \]

    if -1.60000000000000006e-107 < b_2 < 2.89999999999999998e-72

    1. Initial program 78.7%

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a} \]
    2. Taylor expanded in b_2 around 0 76.6%

      \[\leadsto \frac{\left(-b_2\right) - \sqrt{\color{blue}{-1 \cdot \left(a \cdot c\right)}}}{a} \]
    3. Step-by-step derivation
      1. associate-*r*76.6%

        \[\leadsto \frac{\left(-b_2\right) - \sqrt{\color{blue}{\left(-1 \cdot a\right) \cdot c}}}{a} \]
      2. neg-mul-176.6%

        \[\leadsto \frac{\left(-b_2\right) - \sqrt{\color{blue}{\left(-a\right)} \cdot c}}{a} \]
      3. *-commutative76.6%

        \[\leadsto \frac{\left(-b_2\right) - \sqrt{\color{blue}{c \cdot \left(-a\right)}}}{a} \]
    4. Simplified76.6%

      \[\leadsto \frac{\left(-b_2\right) - \sqrt{\color{blue}{c \cdot \left(-a\right)}}}{a} \]

    if 2.89999999999999998e-72 < b_2

    1. Initial program 67.2%

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a} \]
    2. Taylor expanded in b_2 around inf 86.5%

      \[\leadsto \color{blue}{-2 \cdot \frac{b_2}{a} + 0.5 \cdot \frac{c}{b_2}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification82.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \leq -1.6 \cdot 10^{-107}:\\ \;\;\;\;\frac{-0.5 \cdot c}{b_2}\\ \mathbf{elif}\;b_2 \leq 2.9 \cdot 10^{-72}:\\ \;\;\;\;\frac{\left(-b_2\right) - \sqrt{a \cdot \left(-c\right)}}{a}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a} + 0.5 \cdot \frac{c}{b_2}\\ \end{array} \]

Alternative 3: 80.4% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b_2 \leq -1.15 \cdot 10^{-105}:\\ \;\;\;\;\frac{-0.5 \cdot c}{b_2}\\ \mathbf{elif}\;b_2 \leq 2.6 \cdot 10^{-74}:\\ \;\;\;\;\frac{-\sqrt{a \cdot \left(-c\right)}}{a}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a} + 0.5 \cdot \frac{c}{b_2}\\ \end{array} \end{array} \]
(FPCore (a b_2 c)
 :precision binary64
 (if (<= b_2 -1.15e-105)
   (/ (* -0.5 c) b_2)
   (if (<= b_2 2.6e-74)
     (/ (- (sqrt (* a (- c)))) a)
     (+ (* -2.0 (/ b_2 a)) (* 0.5 (/ c b_2))))))
double code(double a, double b_2, double c) {
	double tmp;
	if (b_2 <= -1.15e-105) {
		tmp = (-0.5 * c) / b_2;
	} else if (b_2 <= 2.6e-74) {
		tmp = -sqrt((a * -c)) / a;
	} else {
		tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2));
	}
	return tmp;
}
real(8) function code(a, b_2, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b_2
    real(8), intent (in) :: c
    real(8) :: tmp
    if (b_2 <= (-1.15d-105)) then
        tmp = ((-0.5d0) * c) / b_2
    else if (b_2 <= 2.6d-74) then
        tmp = -sqrt((a * -c)) / a
    else
        tmp = ((-2.0d0) * (b_2 / a)) + (0.5d0 * (c / b_2))
    end if
    code = tmp
end function
public static double code(double a, double b_2, double c) {
	double tmp;
	if (b_2 <= -1.15e-105) {
		tmp = (-0.5 * c) / b_2;
	} else if (b_2 <= 2.6e-74) {
		tmp = -Math.sqrt((a * -c)) / a;
	} else {
		tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2));
	}
	return tmp;
}
def code(a, b_2, c):
	tmp = 0
	if b_2 <= -1.15e-105:
		tmp = (-0.5 * c) / b_2
	elif b_2 <= 2.6e-74:
		tmp = -math.sqrt((a * -c)) / a
	else:
		tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2))
	return tmp
function code(a, b_2, c)
	tmp = 0.0
	if (b_2 <= -1.15e-105)
		tmp = Float64(Float64(-0.5 * c) / b_2);
	elseif (b_2 <= 2.6e-74)
		tmp = Float64(Float64(-sqrt(Float64(a * Float64(-c)))) / a);
	else
		tmp = Float64(Float64(-2.0 * Float64(b_2 / a)) + Float64(0.5 * Float64(c / b_2)));
	end
	return tmp
end
function tmp_2 = code(a, b_2, c)
	tmp = 0.0;
	if (b_2 <= -1.15e-105)
		tmp = (-0.5 * c) / b_2;
	elseif (b_2 <= 2.6e-74)
		tmp = -sqrt((a * -c)) / a;
	else
		tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2));
	end
	tmp_2 = tmp;
end
code[a_, b$95$2_, c_] := If[LessEqual[b$95$2, -1.15e-105], N[(N[(-0.5 * c), $MachinePrecision] / b$95$2), $MachinePrecision], If[LessEqual[b$95$2, 2.6e-74], N[((-N[Sqrt[N[(a * (-c)), $MachinePrecision]], $MachinePrecision]) / a), $MachinePrecision], N[(N[(-2.0 * N[(b$95$2 / a), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(c / b$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b_2 \leq -1.15 \cdot 10^{-105}:\\
\;\;\;\;\frac{-0.5 \cdot c}{b_2}\\

\mathbf{elif}\;b_2 \leq 2.6 \cdot 10^{-74}:\\
\;\;\;\;\frac{-\sqrt{a \cdot \left(-c\right)}}{a}\\

\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{b_2}{a} + 0.5 \cdot \frac{c}{b_2}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if b_2 < -1.15e-105

    1. Initial program 17.2%

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a} \]
    2. Step-by-step derivation
      1. frac-2neg17.2%

        \[\leadsto \color{blue}{\frac{-\left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right)}{-a}} \]
      2. div-inv17.1%

        \[\leadsto \color{blue}{\left(-\left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right)\right) \cdot \frac{1}{-a}} \]
    3. Applied egg-rr25.4%

      \[\leadsto \color{blue}{\left(b_2 + \mathsf{hypot}\left(b_2, \sqrt{c \cdot \left(-a\right)}\right)\right) \cdot \frac{1}{-a}} \]
    4. Taylor expanded in b_2 around -inf 0.0%

      \[\leadsto \color{blue}{0.5 \cdot \frac{c \cdot {\left(\sqrt{-1}\right)}^{2}}{b_2}} \]
    5. Step-by-step derivation
      1. associate-*r/0.0%

        \[\leadsto \color{blue}{\frac{0.5 \cdot \left(c \cdot {\left(\sqrt{-1}\right)}^{2}\right)}{b_2}} \]
      2. *-commutative0.0%

        \[\leadsto \frac{0.5 \cdot \color{blue}{\left({\left(\sqrt{-1}\right)}^{2} \cdot c\right)}}{b_2} \]
      3. unpow20.0%

        \[\leadsto \frac{0.5 \cdot \left(\color{blue}{\left(\sqrt{-1} \cdot \sqrt{-1}\right)} \cdot c\right)}{b_2} \]
      4. rem-square-sqrt83.4%

        \[\leadsto \frac{0.5 \cdot \left(\color{blue}{-1} \cdot c\right)}{b_2} \]
      5. associate-*r*83.4%

        \[\leadsto \frac{\color{blue}{\left(0.5 \cdot -1\right) \cdot c}}{b_2} \]
      6. metadata-eval83.4%

        \[\leadsto \frac{\color{blue}{-0.5} \cdot c}{b_2} \]
    6. Simplified83.4%

      \[\leadsto \color{blue}{\frac{-0.5 \cdot c}{b_2}} \]

    if -1.15e-105 < b_2 < 2.6000000000000001e-74

    1. Initial program 78.7%

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a} \]
    2. Step-by-step derivation
      1. prod-diff78.4%

        \[\leadsto \frac{\left(-b_2\right) - \sqrt{\color{blue}{\mathsf{fma}\left(b_2, b_2, -c \cdot a\right) + \mathsf{fma}\left(-c, a, c \cdot a\right)}}}{a} \]
      2. *-commutative78.4%

        \[\leadsto \frac{\left(-b_2\right) - \sqrt{\mathsf{fma}\left(b_2, b_2, -\color{blue}{a \cdot c}\right) + \mathsf{fma}\left(-c, a, c \cdot a\right)}}{a} \]
      3. fma-neg78.4%

        \[\leadsto \frac{\left(-b_2\right) - \sqrt{\color{blue}{\left(b_2 \cdot b_2 - a \cdot c\right)} + \mathsf{fma}\left(-c, a, c \cdot a\right)}}{a} \]
      4. prod-diff78.4%

        \[\leadsto \frac{\left(-b_2\right) - \sqrt{\color{blue}{\left(\mathsf{fma}\left(b_2, b_2, -c \cdot a\right) + \mathsf{fma}\left(-c, a, c \cdot a\right)\right)} + \mathsf{fma}\left(-c, a, c \cdot a\right)}}{a} \]
      5. *-commutative78.4%

        \[\leadsto \frac{\left(-b_2\right) - \sqrt{\left(\mathsf{fma}\left(b_2, b_2, -\color{blue}{a \cdot c}\right) + \mathsf{fma}\left(-c, a, c \cdot a\right)\right) + \mathsf{fma}\left(-c, a, c \cdot a\right)}}{a} \]
      6. fma-neg78.4%

        \[\leadsto \frac{\left(-b_2\right) - \sqrt{\left(\color{blue}{\left(b_2 \cdot b_2 - a \cdot c\right)} + \mathsf{fma}\left(-c, a, c \cdot a\right)\right) + \mathsf{fma}\left(-c, a, c \cdot a\right)}}{a} \]
      7. associate-+l+78.3%

        \[\leadsto \frac{\left(-b_2\right) - \sqrt{\color{blue}{\left(b_2 \cdot b_2 - a \cdot c\right) + \left(\mathsf{fma}\left(-c, a, c \cdot a\right) + \mathsf{fma}\left(-c, a, c \cdot a\right)\right)}}}{a} \]
      8. *-commutative78.3%

        \[\leadsto \frac{\left(-b_2\right) - \sqrt{\left(b_2 \cdot b_2 - a \cdot c\right) + \left(\mathsf{fma}\left(-c, a, \color{blue}{a \cdot c}\right) + \mathsf{fma}\left(-c, a, c \cdot a\right)\right)}}{a} \]
      9. fma-udef78.4%

        \[\leadsto \frac{\left(-b_2\right) - \sqrt{\left(b_2 \cdot b_2 - a \cdot c\right) + \left(\color{blue}{\left(\left(-c\right) \cdot a + a \cdot c\right)} + \mathsf{fma}\left(-c, a, c \cdot a\right)\right)}}{a} \]
      10. distribute-lft-neg-in78.4%

        \[\leadsto \frac{\left(-b_2\right) - \sqrt{\left(b_2 \cdot b_2 - a \cdot c\right) + \left(\left(\color{blue}{\left(-c \cdot a\right)} + a \cdot c\right) + \mathsf{fma}\left(-c, a, c \cdot a\right)\right)}}{a} \]
      11. *-commutative78.4%

        \[\leadsto \frac{\left(-b_2\right) - \sqrt{\left(b_2 \cdot b_2 - a \cdot c\right) + \left(\left(\left(-\color{blue}{a \cdot c}\right) + a \cdot c\right) + \mathsf{fma}\left(-c, a, c \cdot a\right)\right)}}{a} \]
      12. distribute-rgt-neg-in78.4%

        \[\leadsto \frac{\left(-b_2\right) - \sqrt{\left(b_2 \cdot b_2 - a \cdot c\right) + \left(\left(\color{blue}{a \cdot \left(-c\right)} + a \cdot c\right) + \mathsf{fma}\left(-c, a, c \cdot a\right)\right)}}{a} \]
      13. fma-def78.3%

        \[\leadsto \frac{\left(-b_2\right) - \sqrt{\left(b_2 \cdot b_2 - a \cdot c\right) + \left(\color{blue}{\mathsf{fma}\left(a, -c, a \cdot c\right)} + \mathsf{fma}\left(-c, a, c \cdot a\right)\right)}}{a} \]
      14. *-commutative78.3%

        \[\leadsto \frac{\left(-b_2\right) - \sqrt{\left(b_2 \cdot b_2 - a \cdot c\right) + \left(\mathsf{fma}\left(a, -c, a \cdot c\right) + \mathsf{fma}\left(-c, a, \color{blue}{a \cdot c}\right)\right)}}{a} \]
      15. fma-udef78.4%

        \[\leadsto \frac{\left(-b_2\right) - \sqrt{\left(b_2 \cdot b_2 - a \cdot c\right) + \left(\mathsf{fma}\left(a, -c, a \cdot c\right) + \color{blue}{\left(\left(-c\right) \cdot a + a \cdot c\right)}\right)}}{a} \]
      16. distribute-lft-neg-in78.4%

        \[\leadsto \frac{\left(-b_2\right) - \sqrt{\left(b_2 \cdot b_2 - a \cdot c\right) + \left(\mathsf{fma}\left(a, -c, a \cdot c\right) + \left(\color{blue}{\left(-c \cdot a\right)} + a \cdot c\right)\right)}}{a} \]
      17. *-commutative78.4%

        \[\leadsto \frac{\left(-b_2\right) - \sqrt{\left(b_2 \cdot b_2 - a \cdot c\right) + \left(\mathsf{fma}\left(a, -c, a \cdot c\right) + \left(\left(-\color{blue}{a \cdot c}\right) + a \cdot c\right)\right)}}{a} \]
      18. distribute-rgt-neg-in78.4%

        \[\leadsto \frac{\left(-b_2\right) - \sqrt{\left(b_2 \cdot b_2 - a \cdot c\right) + \left(\mathsf{fma}\left(a, -c, a \cdot c\right) + \left(\color{blue}{a \cdot \left(-c\right)} + a \cdot c\right)\right)}}{a} \]
      19. fma-def78.3%

        \[\leadsto \frac{\left(-b_2\right) - \sqrt{\left(b_2 \cdot b_2 - a \cdot c\right) + \left(\mathsf{fma}\left(a, -c, a \cdot c\right) + \color{blue}{\mathsf{fma}\left(a, -c, a \cdot c\right)}\right)}}{a} \]
    3. Applied egg-rr78.3%

      \[\leadsto \frac{\left(-b_2\right) - \sqrt{\color{blue}{\left(b_2 \cdot b_2 - a \cdot c\right) + \left(\mathsf{fma}\left(a, -c, a \cdot c\right) + \mathsf{fma}\left(a, -c, a \cdot c\right)\right)}}}{a} \]
    4. Step-by-step derivation
      1. count-278.3%

        \[\leadsto \frac{\left(-b_2\right) - \sqrt{\left(b_2 \cdot b_2 - a \cdot c\right) + \color{blue}{2 \cdot \mathsf{fma}\left(a, -c, a \cdot c\right)}}}{a} \]
    5. Simplified78.3%

      \[\leadsto \frac{\left(-b_2\right) - \sqrt{\color{blue}{\left(b_2 \cdot b_2 - a \cdot c\right) + 2 \cdot \mathsf{fma}\left(a, -c, a \cdot c\right)}}}{a} \]
    6. Taylor expanded in b_2 around 0 75.6%

      \[\leadsto \frac{\color{blue}{-1 \cdot \sqrt{2 \cdot \left(-1 \cdot \left(a \cdot c\right) + a \cdot c\right) - a \cdot c}}}{a} \]
    7. Step-by-step derivation
      1. mul-1-neg75.6%

        \[\leadsto \frac{\color{blue}{-\sqrt{2 \cdot \left(-1 \cdot \left(a \cdot c\right) + a \cdot c\right) - a \cdot c}}}{a} \]
    8. Simplified76.0%

      \[\leadsto \frac{\color{blue}{-\sqrt{a \cdot \left(-c\right)}}}{a} \]

    if 2.6000000000000001e-74 < b_2

    1. Initial program 67.2%

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a} \]
    2. Taylor expanded in b_2 around inf 86.5%

      \[\leadsto \color{blue}{-2 \cdot \frac{b_2}{a} + 0.5 \cdot \frac{c}{b_2}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification82.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \leq -1.15 \cdot 10^{-105}:\\ \;\;\;\;\frac{-0.5 \cdot c}{b_2}\\ \mathbf{elif}\;b_2 \leq 2.6 \cdot 10^{-74}:\\ \;\;\;\;\frac{-\sqrt{a \cdot \left(-c\right)}}{a}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a} + 0.5 \cdot \frac{c}{b_2}\\ \end{array} \]

Alternative 4: 68.3% accurate, 8.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b_2 \leq -5 \cdot 10^{-310}:\\ \;\;\;\;\frac{-0.5 \cdot c}{b_2}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a} + 0.5 \cdot \frac{c}{b_2}\\ \end{array} \end{array} \]
(FPCore (a b_2 c)
 :precision binary64
 (if (<= b_2 -5e-310)
   (/ (* -0.5 c) b_2)
   (+ (* -2.0 (/ b_2 a)) (* 0.5 (/ c b_2)))))
double code(double a, double b_2, double c) {
	double tmp;
	if (b_2 <= -5e-310) {
		tmp = (-0.5 * c) / b_2;
	} else {
		tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2));
	}
	return tmp;
}
real(8) function code(a, b_2, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b_2
    real(8), intent (in) :: c
    real(8) :: tmp
    if (b_2 <= (-5d-310)) then
        tmp = ((-0.5d0) * c) / b_2
    else
        tmp = ((-2.0d0) * (b_2 / a)) + (0.5d0 * (c / b_2))
    end if
    code = tmp
end function
public static double code(double a, double b_2, double c) {
	double tmp;
	if (b_2 <= -5e-310) {
		tmp = (-0.5 * c) / b_2;
	} else {
		tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2));
	}
	return tmp;
}
def code(a, b_2, c):
	tmp = 0
	if b_2 <= -5e-310:
		tmp = (-0.5 * c) / b_2
	else:
		tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2))
	return tmp
function code(a, b_2, c)
	tmp = 0.0
	if (b_2 <= -5e-310)
		tmp = Float64(Float64(-0.5 * c) / b_2);
	else
		tmp = Float64(Float64(-2.0 * Float64(b_2 / a)) + Float64(0.5 * Float64(c / b_2)));
	end
	return tmp
end
function tmp_2 = code(a, b_2, c)
	tmp = 0.0;
	if (b_2 <= -5e-310)
		tmp = (-0.5 * c) / b_2;
	else
		tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2));
	end
	tmp_2 = tmp;
end
code[a_, b$95$2_, c_] := If[LessEqual[b$95$2, -5e-310], N[(N[(-0.5 * c), $MachinePrecision] / b$95$2), $MachinePrecision], N[(N[(-2.0 * N[(b$95$2 / a), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(c / b$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b_2 \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{-0.5 \cdot c}{b_2}\\

\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{b_2}{a} + 0.5 \cdot \frac{c}{b_2}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b_2 < -4.999999999999985e-310

    1. Initial program 28.1%

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a} \]
    2. Step-by-step derivation
      1. frac-2neg28.1%

        \[\leadsto \color{blue}{\frac{-\left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right)}{-a}} \]
      2. div-inv28.1%

        \[\leadsto \color{blue}{\left(-\left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right)\right) \cdot \frac{1}{-a}} \]
    3. Applied egg-rr34.5%

      \[\leadsto \color{blue}{\left(b_2 + \mathsf{hypot}\left(b_2, \sqrt{c \cdot \left(-a\right)}\right)\right) \cdot \frac{1}{-a}} \]
    4. Taylor expanded in b_2 around -inf 0.0%

      \[\leadsto \color{blue}{0.5 \cdot \frac{c \cdot {\left(\sqrt{-1}\right)}^{2}}{b_2}} \]
    5. Step-by-step derivation
      1. associate-*r/0.0%

        \[\leadsto \color{blue}{\frac{0.5 \cdot \left(c \cdot {\left(\sqrt{-1}\right)}^{2}\right)}{b_2}} \]
      2. *-commutative0.0%

        \[\leadsto \frac{0.5 \cdot \color{blue}{\left({\left(\sqrt{-1}\right)}^{2} \cdot c\right)}}{b_2} \]
      3. unpow20.0%

        \[\leadsto \frac{0.5 \cdot \left(\color{blue}{\left(\sqrt{-1} \cdot \sqrt{-1}\right)} \cdot c\right)}{b_2} \]
      4. rem-square-sqrt68.1%

        \[\leadsto \frac{0.5 \cdot \left(\color{blue}{-1} \cdot c\right)}{b_2} \]
      5. associate-*r*68.1%

        \[\leadsto \frac{\color{blue}{\left(0.5 \cdot -1\right) \cdot c}}{b_2} \]
      6. metadata-eval68.1%

        \[\leadsto \frac{\color{blue}{-0.5} \cdot c}{b_2} \]
    6. Simplified68.1%

      \[\leadsto \color{blue}{\frac{-0.5 \cdot c}{b_2}} \]

    if -4.999999999999985e-310 < b_2

    1. Initial program 72.7%

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a} \]
    2. Taylor expanded in b_2 around inf 67.8%

      \[\leadsto \color{blue}{-2 \cdot \frac{b_2}{a} + 0.5 \cdot \frac{c}{b_2}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification67.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \leq -5 \cdot 10^{-310}:\\ \;\;\;\;\frac{-0.5 \cdot c}{b_2}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a} + 0.5 \cdot \frac{c}{b_2}\\ \end{array} \]

Alternative 5: 48.3% accurate, 15.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b_2 \leq -2.8 \cdot 10^{-306}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b_2}\\ \mathbf{else}:\\ \;\;\;\;\frac{-b_2}{a}\\ \end{array} \end{array} \]
(FPCore (a b_2 c)
 :precision binary64
 (if (<= b_2 -2.8e-306) (* -0.5 (/ c b_2)) (/ (- b_2) a)))
double code(double a, double b_2, double c) {
	double tmp;
	if (b_2 <= -2.8e-306) {
		tmp = -0.5 * (c / b_2);
	} else {
		tmp = -b_2 / a;
	}
	return tmp;
}
real(8) function code(a, b_2, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b_2
    real(8), intent (in) :: c
    real(8) :: tmp
    if (b_2 <= (-2.8d-306)) then
        tmp = (-0.5d0) * (c / b_2)
    else
        tmp = -b_2 / a
    end if
    code = tmp
end function
public static double code(double a, double b_2, double c) {
	double tmp;
	if (b_2 <= -2.8e-306) {
		tmp = -0.5 * (c / b_2);
	} else {
		tmp = -b_2 / a;
	}
	return tmp;
}
def code(a, b_2, c):
	tmp = 0
	if b_2 <= -2.8e-306:
		tmp = -0.5 * (c / b_2)
	else:
		tmp = -b_2 / a
	return tmp
function code(a, b_2, c)
	tmp = 0.0
	if (b_2 <= -2.8e-306)
		tmp = Float64(-0.5 * Float64(c / b_2));
	else
		tmp = Float64(Float64(-b_2) / a);
	end
	return tmp
end
function tmp_2 = code(a, b_2, c)
	tmp = 0.0;
	if (b_2 <= -2.8e-306)
		tmp = -0.5 * (c / b_2);
	else
		tmp = -b_2 / a;
	end
	tmp_2 = tmp;
end
code[a_, b$95$2_, c_] := If[LessEqual[b$95$2, -2.8e-306], N[(-0.5 * N[(c / b$95$2), $MachinePrecision]), $MachinePrecision], N[((-b$95$2) / a), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b_2 \leq -2.8 \cdot 10^{-306}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b_2}\\

\mathbf{else}:\\
\;\;\;\;\frac{-b_2}{a}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b_2 < -2.8000000000000001e-306

    1. Initial program 28.3%

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a} \]
    2. Taylor expanded in b_2 around -inf 68.6%

      \[\leadsto \color{blue}{-0.5 \cdot \frac{c}{b_2}} \]

    if -2.8000000000000001e-306 < b_2

    1. Initial program 72.2%

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a} \]
    2. Taylor expanded in b_2 around 0 40.6%

      \[\leadsto \frac{\left(-b_2\right) - \sqrt{\color{blue}{-1 \cdot \left(a \cdot c\right)}}}{a} \]
    3. Step-by-step derivation
      1. associate-*r*40.6%

        \[\leadsto \frac{\left(-b_2\right) - \sqrt{\color{blue}{\left(-1 \cdot a\right) \cdot c}}}{a} \]
      2. neg-mul-140.6%

        \[\leadsto \frac{\left(-b_2\right) - \sqrt{\color{blue}{\left(-a\right)} \cdot c}}{a} \]
      3. *-commutative40.6%

        \[\leadsto \frac{\left(-b_2\right) - \sqrt{\color{blue}{c \cdot \left(-a\right)}}}{a} \]
    4. Simplified40.6%

      \[\leadsto \frac{\left(-b_2\right) - \sqrt{\color{blue}{c \cdot \left(-a\right)}}}{a} \]
    5. Taylor expanded in b_2 around inf 28.5%

      \[\leadsto \color{blue}{-1 \cdot \frac{b_2}{a}} \]
    6. Step-by-step derivation
      1. associate-*r/28.5%

        \[\leadsto \color{blue}{\frac{-1 \cdot b_2}{a}} \]
      2. mul-1-neg28.5%

        \[\leadsto \frac{\color{blue}{-b_2}}{a} \]
    7. Simplified28.5%

      \[\leadsto \color{blue}{\frac{-b_2}{a}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification48.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \leq -2.8 \cdot 10^{-306}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b_2}\\ \mathbf{else}:\\ \;\;\;\;\frac{-b_2}{a}\\ \end{array} \]

Alternative 6: 48.3% accurate, 15.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b_2 \leq -2.8 \cdot 10^{-306}:\\ \;\;\;\;\frac{-0.5 \cdot c}{b_2}\\ \mathbf{else}:\\ \;\;\;\;\frac{-b_2}{a}\\ \end{array} \end{array} \]
(FPCore (a b_2 c)
 :precision binary64
 (if (<= b_2 -2.8e-306) (/ (* -0.5 c) b_2) (/ (- b_2) a)))
double code(double a, double b_2, double c) {
	double tmp;
	if (b_2 <= -2.8e-306) {
		tmp = (-0.5 * c) / b_2;
	} else {
		tmp = -b_2 / a;
	}
	return tmp;
}
real(8) function code(a, b_2, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b_2
    real(8), intent (in) :: c
    real(8) :: tmp
    if (b_2 <= (-2.8d-306)) then
        tmp = ((-0.5d0) * c) / b_2
    else
        tmp = -b_2 / a
    end if
    code = tmp
end function
public static double code(double a, double b_2, double c) {
	double tmp;
	if (b_2 <= -2.8e-306) {
		tmp = (-0.5 * c) / b_2;
	} else {
		tmp = -b_2 / a;
	}
	return tmp;
}
def code(a, b_2, c):
	tmp = 0
	if b_2 <= -2.8e-306:
		tmp = (-0.5 * c) / b_2
	else:
		tmp = -b_2 / a
	return tmp
function code(a, b_2, c)
	tmp = 0.0
	if (b_2 <= -2.8e-306)
		tmp = Float64(Float64(-0.5 * c) / b_2);
	else
		tmp = Float64(Float64(-b_2) / a);
	end
	return tmp
end
function tmp_2 = code(a, b_2, c)
	tmp = 0.0;
	if (b_2 <= -2.8e-306)
		tmp = (-0.5 * c) / b_2;
	else
		tmp = -b_2 / a;
	end
	tmp_2 = tmp;
end
code[a_, b$95$2_, c_] := If[LessEqual[b$95$2, -2.8e-306], N[(N[(-0.5 * c), $MachinePrecision] / b$95$2), $MachinePrecision], N[((-b$95$2) / a), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b_2 \leq -2.8 \cdot 10^{-306}:\\
\;\;\;\;\frac{-0.5 \cdot c}{b_2}\\

\mathbf{else}:\\
\;\;\;\;\frac{-b_2}{a}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b_2 < -2.8000000000000001e-306

    1. Initial program 28.3%

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a} \]
    2. Step-by-step derivation
      1. frac-2neg28.3%

        \[\leadsto \color{blue}{\frac{-\left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right)}{-a}} \]
      2. div-inv28.3%

        \[\leadsto \color{blue}{\left(-\left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right)\right) \cdot \frac{1}{-a}} \]
    3. Applied egg-rr34.8%

      \[\leadsto \color{blue}{\left(b_2 + \mathsf{hypot}\left(b_2, \sqrt{c \cdot \left(-a\right)}\right)\right) \cdot \frac{1}{-a}} \]
    4. Taylor expanded in b_2 around -inf 0.0%

      \[\leadsto \color{blue}{0.5 \cdot \frac{c \cdot {\left(\sqrt{-1}\right)}^{2}}{b_2}} \]
    5. Step-by-step derivation
      1. associate-*r/0.0%

        \[\leadsto \color{blue}{\frac{0.5 \cdot \left(c \cdot {\left(\sqrt{-1}\right)}^{2}\right)}{b_2}} \]
      2. *-commutative0.0%

        \[\leadsto \frac{0.5 \cdot \color{blue}{\left({\left(\sqrt{-1}\right)}^{2} \cdot c\right)}}{b_2} \]
      3. unpow20.0%

        \[\leadsto \frac{0.5 \cdot \left(\color{blue}{\left(\sqrt{-1} \cdot \sqrt{-1}\right)} \cdot c\right)}{b_2} \]
      4. rem-square-sqrt68.6%

        \[\leadsto \frac{0.5 \cdot \left(\color{blue}{-1} \cdot c\right)}{b_2} \]
      5. associate-*r*68.6%

        \[\leadsto \frac{\color{blue}{\left(0.5 \cdot -1\right) \cdot c}}{b_2} \]
      6. metadata-eval68.6%

        \[\leadsto \frac{\color{blue}{-0.5} \cdot c}{b_2} \]
    6. Simplified68.6%

      \[\leadsto \color{blue}{\frac{-0.5 \cdot c}{b_2}} \]

    if -2.8000000000000001e-306 < b_2

    1. Initial program 72.2%

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a} \]
    2. Taylor expanded in b_2 around 0 40.6%

      \[\leadsto \frac{\left(-b_2\right) - \sqrt{\color{blue}{-1 \cdot \left(a \cdot c\right)}}}{a} \]
    3. Step-by-step derivation
      1. associate-*r*40.6%

        \[\leadsto \frac{\left(-b_2\right) - \sqrt{\color{blue}{\left(-1 \cdot a\right) \cdot c}}}{a} \]
      2. neg-mul-140.6%

        \[\leadsto \frac{\left(-b_2\right) - \sqrt{\color{blue}{\left(-a\right)} \cdot c}}{a} \]
      3. *-commutative40.6%

        \[\leadsto \frac{\left(-b_2\right) - \sqrt{\color{blue}{c \cdot \left(-a\right)}}}{a} \]
    4. Simplified40.6%

      \[\leadsto \frac{\left(-b_2\right) - \sqrt{\color{blue}{c \cdot \left(-a\right)}}}{a} \]
    5. Taylor expanded in b_2 around inf 28.5%

      \[\leadsto \color{blue}{-1 \cdot \frac{b_2}{a}} \]
    6. Step-by-step derivation
      1. associate-*r/28.5%

        \[\leadsto \color{blue}{\frac{-1 \cdot b_2}{a}} \]
      2. mul-1-neg28.5%

        \[\leadsto \frac{\color{blue}{-b_2}}{a} \]
    7. Simplified28.5%

      \[\leadsto \color{blue}{\frac{-b_2}{a}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification48.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \leq -2.8 \cdot 10^{-306}:\\ \;\;\;\;\frac{-0.5 \cdot c}{b_2}\\ \mathbf{else}:\\ \;\;\;\;\frac{-b_2}{a}\\ \end{array} \]

Alternative 7: 68.2% accurate, 15.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b_2 \leq -2.8 \cdot 10^{-306}:\\ \;\;\;\;\frac{-0.5 \cdot c}{b_2}\\ \mathbf{else}:\\ \;\;\;\;\frac{b_2 \cdot -2}{a}\\ \end{array} \end{array} \]
(FPCore (a b_2 c)
 :precision binary64
 (if (<= b_2 -2.8e-306) (/ (* -0.5 c) b_2) (/ (* b_2 -2.0) a)))
double code(double a, double b_2, double c) {
	double tmp;
	if (b_2 <= -2.8e-306) {
		tmp = (-0.5 * c) / b_2;
	} else {
		tmp = (b_2 * -2.0) / a;
	}
	return tmp;
}
real(8) function code(a, b_2, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b_2
    real(8), intent (in) :: c
    real(8) :: tmp
    if (b_2 <= (-2.8d-306)) then
        tmp = ((-0.5d0) * c) / b_2
    else
        tmp = (b_2 * (-2.0d0)) / a
    end if
    code = tmp
end function
public static double code(double a, double b_2, double c) {
	double tmp;
	if (b_2 <= -2.8e-306) {
		tmp = (-0.5 * c) / b_2;
	} else {
		tmp = (b_2 * -2.0) / a;
	}
	return tmp;
}
def code(a, b_2, c):
	tmp = 0
	if b_2 <= -2.8e-306:
		tmp = (-0.5 * c) / b_2
	else:
		tmp = (b_2 * -2.0) / a
	return tmp
function code(a, b_2, c)
	tmp = 0.0
	if (b_2 <= -2.8e-306)
		tmp = Float64(Float64(-0.5 * c) / b_2);
	else
		tmp = Float64(Float64(b_2 * -2.0) / a);
	end
	return tmp
end
function tmp_2 = code(a, b_2, c)
	tmp = 0.0;
	if (b_2 <= -2.8e-306)
		tmp = (-0.5 * c) / b_2;
	else
		tmp = (b_2 * -2.0) / a;
	end
	tmp_2 = tmp;
end
code[a_, b$95$2_, c_] := If[LessEqual[b$95$2, -2.8e-306], N[(N[(-0.5 * c), $MachinePrecision] / b$95$2), $MachinePrecision], N[(N[(b$95$2 * -2.0), $MachinePrecision] / a), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b_2 \leq -2.8 \cdot 10^{-306}:\\
\;\;\;\;\frac{-0.5 \cdot c}{b_2}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b_2 < -2.8000000000000001e-306

    1. Initial program 28.3%

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a} \]
    2. Step-by-step derivation
      1. frac-2neg28.3%

        \[\leadsto \color{blue}{\frac{-\left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right)}{-a}} \]
      2. div-inv28.3%

        \[\leadsto \color{blue}{\left(-\left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right)\right) \cdot \frac{1}{-a}} \]
    3. Applied egg-rr34.8%

      \[\leadsto \color{blue}{\left(b_2 + \mathsf{hypot}\left(b_2, \sqrt{c \cdot \left(-a\right)}\right)\right) \cdot \frac{1}{-a}} \]
    4. Taylor expanded in b_2 around -inf 0.0%

      \[\leadsto \color{blue}{0.5 \cdot \frac{c \cdot {\left(\sqrt{-1}\right)}^{2}}{b_2}} \]
    5. Step-by-step derivation
      1. associate-*r/0.0%

        \[\leadsto \color{blue}{\frac{0.5 \cdot \left(c \cdot {\left(\sqrt{-1}\right)}^{2}\right)}{b_2}} \]
      2. *-commutative0.0%

        \[\leadsto \frac{0.5 \cdot \color{blue}{\left({\left(\sqrt{-1}\right)}^{2} \cdot c\right)}}{b_2} \]
      3. unpow20.0%

        \[\leadsto \frac{0.5 \cdot \left(\color{blue}{\left(\sqrt{-1} \cdot \sqrt{-1}\right)} \cdot c\right)}{b_2} \]
      4. rem-square-sqrt68.6%

        \[\leadsto \frac{0.5 \cdot \left(\color{blue}{-1} \cdot c\right)}{b_2} \]
      5. associate-*r*68.6%

        \[\leadsto \frac{\color{blue}{\left(0.5 \cdot -1\right) \cdot c}}{b_2} \]
      6. metadata-eval68.6%

        \[\leadsto \frac{\color{blue}{-0.5} \cdot c}{b_2} \]
    6. Simplified68.6%

      \[\leadsto \color{blue}{\frac{-0.5 \cdot c}{b_2}} \]

    if -2.8000000000000001e-306 < b_2

    1. Initial program 72.2%

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a} \]
    2. Taylor expanded in b_2 around inf 66.8%

      \[\leadsto \frac{\color{blue}{-2 \cdot b_2}}{a} \]
    3. Step-by-step derivation
      1. *-commutative66.8%

        \[\leadsto \frac{\color{blue}{b_2 \cdot -2}}{a} \]
    4. Simplified66.8%

      \[\leadsto \frac{\color{blue}{b_2 \cdot -2}}{a} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification67.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \leq -2.8 \cdot 10^{-306}:\\ \;\;\;\;\frac{-0.5 \cdot c}{b_2}\\ \mathbf{else}:\\ \;\;\;\;\frac{b_2 \cdot -2}{a}\\ \end{array} \]

Alternative 8: 24.3% accurate, 18.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b_2 \leq -2.8 \cdot 10^{-306}:\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;\frac{-b_2}{a}\\ \end{array} \end{array} \]
(FPCore (a b_2 c)
 :precision binary64
 (if (<= b_2 -2.8e-306) 0.0 (/ (- b_2) a)))
double code(double a, double b_2, double c) {
	double tmp;
	if (b_2 <= -2.8e-306) {
		tmp = 0.0;
	} else {
		tmp = -b_2 / a;
	}
	return tmp;
}
real(8) function code(a, b_2, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b_2
    real(8), intent (in) :: c
    real(8) :: tmp
    if (b_2 <= (-2.8d-306)) then
        tmp = 0.0d0
    else
        tmp = -b_2 / a
    end if
    code = tmp
end function
public static double code(double a, double b_2, double c) {
	double tmp;
	if (b_2 <= -2.8e-306) {
		tmp = 0.0;
	} else {
		tmp = -b_2 / a;
	}
	return tmp;
}
def code(a, b_2, c):
	tmp = 0
	if b_2 <= -2.8e-306:
		tmp = 0.0
	else:
		tmp = -b_2 / a
	return tmp
function code(a, b_2, c)
	tmp = 0.0
	if (b_2 <= -2.8e-306)
		tmp = 0.0;
	else
		tmp = Float64(Float64(-b_2) / a);
	end
	return tmp
end
function tmp_2 = code(a, b_2, c)
	tmp = 0.0;
	if (b_2 <= -2.8e-306)
		tmp = 0.0;
	else
		tmp = -b_2 / a;
	end
	tmp_2 = tmp;
end
code[a_, b$95$2_, c_] := If[LessEqual[b$95$2, -2.8e-306], 0.0, N[((-b$95$2) / a), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b_2 \leq -2.8 \cdot 10^{-306}:\\
\;\;\;\;0\\

\mathbf{else}:\\
\;\;\;\;\frac{-b_2}{a}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b_2 < -2.8000000000000001e-306

    1. Initial program 28.3%

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a} \]
    2. Step-by-step derivation
      1. frac-2neg28.3%

        \[\leadsto \color{blue}{\frac{-\left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right)}{-a}} \]
      2. div-inv28.3%

        \[\leadsto \color{blue}{\left(-\left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right)\right) \cdot \frac{1}{-a}} \]
    3. Applied egg-rr34.8%

      \[\leadsto \color{blue}{\left(b_2 + \mathsf{hypot}\left(b_2, \sqrt{c \cdot \left(-a\right)}\right)\right) \cdot \frac{1}{-a}} \]
    4. Taylor expanded in b_2 around inf 2.5%

      \[\leadsto \color{blue}{\left(2 \cdot b_2\right)} \cdot \frac{1}{-a} \]
    5. Step-by-step derivation
      1. count-22.5%

        \[\leadsto \color{blue}{\left(b_2 + b_2\right)} \cdot \frac{1}{-a} \]
    6. Simplified2.5%

      \[\leadsto \color{blue}{\left(b_2 + b_2\right)} \cdot \frac{1}{-a} \]
    7. Step-by-step derivation
      1. *-commutative2.5%

        \[\leadsto \color{blue}{\frac{1}{-a} \cdot \left(b_2 + b_2\right)} \]
      2. flip-+0.0%

        \[\leadsto \frac{1}{-a} \cdot \color{blue}{\frac{b_2 \cdot b_2 - b_2 \cdot b_2}{b_2 - b_2}} \]
      3. frac-times0.0%

        \[\leadsto \color{blue}{\frac{1 \cdot \left(b_2 \cdot b_2 - b_2 \cdot b_2\right)}{\left(-a\right) \cdot \left(b_2 - b_2\right)}} \]
      4. *-un-lft-identity0.0%

        \[\leadsto \frac{\color{blue}{b_2 \cdot b_2 - b_2 \cdot b_2}}{\left(-a\right) \cdot \left(b_2 - b_2\right)} \]
      5. add-sqr-sqrt0.0%

        \[\leadsto \frac{b_2 \cdot b_2 - b_2 \cdot b_2}{\color{blue}{\left(\sqrt{-a} \cdot \sqrt{-a}\right)} \cdot \left(b_2 - b_2\right)} \]
      6. sqrt-unprod0.0%

        \[\leadsto \frac{b_2 \cdot b_2 - b_2 \cdot b_2}{\color{blue}{\sqrt{\left(-a\right) \cdot \left(-a\right)}} \cdot \left(b_2 - b_2\right)} \]
      7. sqr-neg0.0%

        \[\leadsto \frac{b_2 \cdot b_2 - b_2 \cdot b_2}{\sqrt{\color{blue}{a \cdot a}} \cdot \left(b_2 - b_2\right)} \]
      8. sqrt-unprod0.0%

        \[\leadsto \frac{b_2 \cdot b_2 - b_2 \cdot b_2}{\color{blue}{\left(\sqrt{a} \cdot \sqrt{a}\right)} \cdot \left(b_2 - b_2\right)} \]
      9. add-sqr-sqrt0.0%

        \[\leadsto \frac{b_2 \cdot b_2 - b_2 \cdot b_2}{\color{blue}{a} \cdot \left(b_2 - b_2\right)} \]
      10. add-cube-cbrt5.1%

        \[\leadsto \frac{b_2 \cdot b_2 - b_2 \cdot b_2}{a \cdot \left(\color{blue}{\left(\sqrt[3]{b_2} \cdot \sqrt[3]{b_2}\right) \cdot \sqrt[3]{b_2}} - b_2\right)} \]
      11. fma-neg6.3%

        \[\leadsto \frac{b_2 \cdot b_2 - b_2 \cdot b_2}{a \cdot \color{blue}{\mathsf{fma}\left(\sqrt[3]{b_2} \cdot \sqrt[3]{b_2}, \sqrt[3]{b_2}, -b_2\right)}} \]
      12. add-sqr-sqrt6.3%

        \[\leadsto \frac{b_2 \cdot b_2 - b_2 \cdot b_2}{a \cdot \mathsf{fma}\left(\sqrt[3]{b_2} \cdot \sqrt[3]{b_2}, \sqrt[3]{b_2}, \color{blue}{\sqrt{-b_2} \cdot \sqrt{-b_2}}\right)} \]
      13. sqrt-unprod6.3%

        \[\leadsto \frac{b_2 \cdot b_2 - b_2 \cdot b_2}{a \cdot \mathsf{fma}\left(\sqrt[3]{b_2} \cdot \sqrt[3]{b_2}, \sqrt[3]{b_2}, \color{blue}{\sqrt{\left(-b_2\right) \cdot \left(-b_2\right)}}\right)} \]
      14. sqr-neg6.3%

        \[\leadsto \frac{b_2 \cdot b_2 - b_2 \cdot b_2}{a \cdot \mathsf{fma}\left(\sqrt[3]{b_2} \cdot \sqrt[3]{b_2}, \sqrt[3]{b_2}, \sqrt{\color{blue}{b_2 \cdot b_2}}\right)} \]
      15. sqrt-unprod0.0%

        \[\leadsto \frac{b_2 \cdot b_2 - b_2 \cdot b_2}{a \cdot \mathsf{fma}\left(\sqrt[3]{b_2} \cdot \sqrt[3]{b_2}, \sqrt[3]{b_2}, \color{blue}{\sqrt{b_2} \cdot \sqrt{b_2}}\right)} \]
      16. add-sqr-sqrt6.3%

        \[\leadsto \frac{b_2 \cdot b_2 - b_2 \cdot b_2}{a \cdot \mathsf{fma}\left(\sqrt[3]{b_2} \cdot \sqrt[3]{b_2}, \sqrt[3]{b_2}, \color{blue}{b_2}\right)} \]
      17. fma-def6.3%

        \[\leadsto \frac{b_2 \cdot b_2 - b_2 \cdot b_2}{a \cdot \color{blue}{\left(\left(\sqrt[3]{b_2} \cdot \sqrt[3]{b_2}\right) \cdot \sqrt[3]{b_2} + b_2\right)}} \]
      18. add-cube-cbrt6.3%

        \[\leadsto \frac{b_2 \cdot b_2 - b_2 \cdot b_2}{a \cdot \left(\color{blue}{b_2} + b_2\right)} \]
    8. Applied egg-rr6.3%

      \[\leadsto \color{blue}{\frac{b_2 \cdot b_2 - b_2 \cdot b_2}{a \cdot \left(b_2 + b_2\right)}} \]
    9. Step-by-step derivation
      1. div-sub5.2%

        \[\leadsto \color{blue}{\frac{b_2 \cdot b_2}{a \cdot \left(b_2 + b_2\right)} - \frac{b_2 \cdot b_2}{a \cdot \left(b_2 + b_2\right)}} \]
      2. +-inverses20.9%

        \[\leadsto \color{blue}{0} \]
    10. Simplified20.9%

      \[\leadsto \color{blue}{0} \]

    if -2.8000000000000001e-306 < b_2

    1. Initial program 72.2%

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a} \]
    2. Taylor expanded in b_2 around 0 40.6%

      \[\leadsto \frac{\left(-b_2\right) - \sqrt{\color{blue}{-1 \cdot \left(a \cdot c\right)}}}{a} \]
    3. Step-by-step derivation
      1. associate-*r*40.6%

        \[\leadsto \frac{\left(-b_2\right) - \sqrt{\color{blue}{\left(-1 \cdot a\right) \cdot c}}}{a} \]
      2. neg-mul-140.6%

        \[\leadsto \frac{\left(-b_2\right) - \sqrt{\color{blue}{\left(-a\right)} \cdot c}}{a} \]
      3. *-commutative40.6%

        \[\leadsto \frac{\left(-b_2\right) - \sqrt{\color{blue}{c \cdot \left(-a\right)}}}{a} \]
    4. Simplified40.6%

      \[\leadsto \frac{\left(-b_2\right) - \sqrt{\color{blue}{c \cdot \left(-a\right)}}}{a} \]
    5. Taylor expanded in b_2 around inf 28.5%

      \[\leadsto \color{blue}{-1 \cdot \frac{b_2}{a}} \]
    6. Step-by-step derivation
      1. associate-*r/28.5%

        \[\leadsto \color{blue}{\frac{-1 \cdot b_2}{a}} \]
      2. mul-1-neg28.5%

        \[\leadsto \frac{\color{blue}{-b_2}}{a} \]
    7. Simplified28.5%

      \[\leadsto \color{blue}{\frac{-b_2}{a}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification24.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \leq -2.8 \cdot 10^{-306}:\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;\frac{-b_2}{a}\\ \end{array} \]

Alternative 9: 11.7% accurate, 112.0× speedup?

\[\begin{array}{l} \\ 0 \end{array} \]
(FPCore (a b_2 c) :precision binary64 0.0)
double code(double a, double b_2, double c) {
	return 0.0;
}
real(8) function code(a, b_2, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b_2
    real(8), intent (in) :: c
    code = 0.0d0
end function
public static double code(double a, double b_2, double c) {
	return 0.0;
}
def code(a, b_2, c):
	return 0.0
function code(a, b_2, c)
	return 0.0
end
function tmp = code(a, b_2, c)
	tmp = 0.0;
end
code[a_, b$95$2_, c_] := 0.0
\begin{array}{l}

\\
0
\end{array}
Derivation
  1. Initial program 50.6%

    \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a} \]
  2. Step-by-step derivation
    1. frac-2neg50.6%

      \[\leadsto \color{blue}{\frac{-\left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right)}{-a}} \]
    2. div-inv50.5%

      \[\leadsto \color{blue}{\left(-\left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right)\right) \cdot \frac{1}{-a}} \]
  3. Applied egg-rr48.6%

    \[\leadsto \color{blue}{\left(b_2 + \mathsf{hypot}\left(b_2, \sqrt{c \cdot \left(-a\right)}\right)\right) \cdot \frac{1}{-a}} \]
  4. Taylor expanded in b_2 around inf 35.0%

    \[\leadsto \color{blue}{\left(2 \cdot b_2\right)} \cdot \frac{1}{-a} \]
  5. Step-by-step derivation
    1. count-235.0%

      \[\leadsto \color{blue}{\left(b_2 + b_2\right)} \cdot \frac{1}{-a} \]
  6. Simplified35.0%

    \[\leadsto \color{blue}{\left(b_2 + b_2\right)} \cdot \frac{1}{-a} \]
  7. Step-by-step derivation
    1. *-commutative35.0%

      \[\leadsto \color{blue}{\frac{1}{-a} \cdot \left(b_2 + b_2\right)} \]
    2. flip-+0.0%

      \[\leadsto \frac{1}{-a} \cdot \color{blue}{\frac{b_2 \cdot b_2 - b_2 \cdot b_2}{b_2 - b_2}} \]
    3. frac-times0.0%

      \[\leadsto \color{blue}{\frac{1 \cdot \left(b_2 \cdot b_2 - b_2 \cdot b_2\right)}{\left(-a\right) \cdot \left(b_2 - b_2\right)}} \]
    4. *-un-lft-identity0.0%

      \[\leadsto \frac{\color{blue}{b_2 \cdot b_2 - b_2 \cdot b_2}}{\left(-a\right) \cdot \left(b_2 - b_2\right)} \]
    5. add-sqr-sqrt0.0%

      \[\leadsto \frac{b_2 \cdot b_2 - b_2 \cdot b_2}{\color{blue}{\left(\sqrt{-a} \cdot \sqrt{-a}\right)} \cdot \left(b_2 - b_2\right)} \]
    6. sqrt-unprod0.0%

      \[\leadsto \frac{b_2 \cdot b_2 - b_2 \cdot b_2}{\color{blue}{\sqrt{\left(-a\right) \cdot \left(-a\right)}} \cdot \left(b_2 - b_2\right)} \]
    7. sqr-neg0.0%

      \[\leadsto \frac{b_2 \cdot b_2 - b_2 \cdot b_2}{\sqrt{\color{blue}{a \cdot a}} \cdot \left(b_2 - b_2\right)} \]
    8. sqrt-unprod0.0%

      \[\leadsto \frac{b_2 \cdot b_2 - b_2 \cdot b_2}{\color{blue}{\left(\sqrt{a} \cdot \sqrt{a}\right)} \cdot \left(b_2 - b_2\right)} \]
    9. add-sqr-sqrt0.0%

      \[\leadsto \frac{b_2 \cdot b_2 - b_2 \cdot b_2}{\color{blue}{a} \cdot \left(b_2 - b_2\right)} \]
    10. add-cube-cbrt3.2%

      \[\leadsto \frac{b_2 \cdot b_2 - b_2 \cdot b_2}{a \cdot \left(\color{blue}{\left(\sqrt[3]{b_2} \cdot \sqrt[3]{b_2}\right) \cdot \sqrt[3]{b_2}} - b_2\right)} \]
    11. fma-neg3.9%

      \[\leadsto \frac{b_2 \cdot b_2 - b_2 \cdot b_2}{a \cdot \color{blue}{\mathsf{fma}\left(\sqrt[3]{b_2} \cdot \sqrt[3]{b_2}, \sqrt[3]{b_2}, -b_2\right)}} \]
    12. add-sqr-sqrt3.1%

      \[\leadsto \frac{b_2 \cdot b_2 - b_2 \cdot b_2}{a \cdot \mathsf{fma}\left(\sqrt[3]{b_2} \cdot \sqrt[3]{b_2}, \sqrt[3]{b_2}, \color{blue}{\sqrt{-b_2} \cdot \sqrt{-b_2}}\right)} \]
    13. sqrt-unprod3.9%

      \[\leadsto \frac{b_2 \cdot b_2 - b_2 \cdot b_2}{a \cdot \mathsf{fma}\left(\sqrt[3]{b_2} \cdot \sqrt[3]{b_2}, \sqrt[3]{b_2}, \color{blue}{\sqrt{\left(-b_2\right) \cdot \left(-b_2\right)}}\right)} \]
    14. sqr-neg3.9%

      \[\leadsto \frac{b_2 \cdot b_2 - b_2 \cdot b_2}{a \cdot \mathsf{fma}\left(\sqrt[3]{b_2} \cdot \sqrt[3]{b_2}, \sqrt[3]{b_2}, \sqrt{\color{blue}{b_2 \cdot b_2}}\right)} \]
    15. sqrt-unprod0.8%

      \[\leadsto \frac{b_2 \cdot b_2 - b_2 \cdot b_2}{a \cdot \mathsf{fma}\left(\sqrt[3]{b_2} \cdot \sqrt[3]{b_2}, \sqrt[3]{b_2}, \color{blue}{\sqrt{b_2} \cdot \sqrt{b_2}}\right)} \]
    16. add-sqr-sqrt3.9%

      \[\leadsto \frac{b_2 \cdot b_2 - b_2 \cdot b_2}{a \cdot \mathsf{fma}\left(\sqrt[3]{b_2} \cdot \sqrt[3]{b_2}, \sqrt[3]{b_2}, \color{blue}{b_2}\right)} \]
    17. fma-def3.9%

      \[\leadsto \frac{b_2 \cdot b_2 - b_2 \cdot b_2}{a \cdot \color{blue}{\left(\left(\sqrt[3]{b_2} \cdot \sqrt[3]{b_2}\right) \cdot \sqrt[3]{b_2} + b_2\right)}} \]
    18. add-cube-cbrt3.9%

      \[\leadsto \frac{b_2 \cdot b_2 - b_2 \cdot b_2}{a \cdot \left(\color{blue}{b_2} + b_2\right)} \]
  8. Applied egg-rr3.9%

    \[\leadsto \color{blue}{\frac{b_2 \cdot b_2 - b_2 \cdot b_2}{a \cdot \left(b_2 + b_2\right)}} \]
  9. Step-by-step derivation
    1. div-sub3.3%

      \[\leadsto \color{blue}{\frac{b_2 \cdot b_2}{a \cdot \left(b_2 + b_2\right)} - \frac{b_2 \cdot b_2}{a \cdot \left(b_2 + b_2\right)}} \]
    2. +-inverses11.5%

      \[\leadsto \color{blue}{0} \]
  10. Simplified11.5%

    \[\leadsto \color{blue}{0} \]
  11. Final simplification11.5%

    \[\leadsto 0 \]

Reproduce

?
herbie shell --seed 2023278 
(FPCore (a b_2 c)
  :name "quad2m (problem 3.2.1, negative)"
  :precision binary64
  (/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))