Quadratic roots, full range

Percentage Accurate: 50.7% → 85.5%
Time: 11.2s
Alternatives: 9
Speedup: 19.1×

Specification

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

\\
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot 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: 50.7% accurate, 1.0× speedup?

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

\\
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}
\end{array}

Alternative 1: 85.5% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq -5 \cdot 10^{+138}:\\
\;\;\;\;\frac{-b}{a}\\

\mathbf{elif}\;b \leq 6.2 \cdot 10^{-31}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - \left(a \cdot 4\right) \cdot c} - b}{a \cdot 2}\\

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


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

    1. Initial program 44.2%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
    2. Step-by-step derivation
      1. neg-sub044.2%

        \[\leadsto \frac{\color{blue}{\left(0 - b\right)} + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
      2. associate-+l-44.2%

        \[\leadsto \frac{\color{blue}{0 - \left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}{2 \cdot a} \]
      3. sub0-neg44.2%

        \[\leadsto \frac{\color{blue}{-\left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}{2 \cdot a} \]
      4. neg-mul-144.2%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}{2 \cdot a} \]
      5. associate-*l/44.2%

        \[\leadsto \color{blue}{\frac{-1}{2 \cdot a} \cdot \left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)} \]
      6. *-commutative44.2%

        \[\leadsto \color{blue}{\left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right) \cdot \frac{-1}{2 \cdot a}} \]
      7. associate-/r*44.2%

        \[\leadsto \left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right) \cdot \color{blue}{\frac{\frac{-1}{2}}{a}} \]
      8. /-rgt-identity44.2%

        \[\leadsto \color{blue}{\frac{b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{1}} \cdot \frac{\frac{-1}{2}}{a} \]
      9. metadata-eval44.2%

        \[\leadsto \frac{b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\color{blue}{--1}} \cdot \frac{\frac{-1}{2}}{a} \]
    3. Simplified44.5%

      \[\leadsto \color{blue}{\left(b - \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)}\right) \cdot \frac{-0.5}{a}} \]
    4. Taylor expanded in b around -inf 98.1%

      \[\leadsto \color{blue}{-1 \cdot \frac{b}{a}} \]
    5. Step-by-step derivation
      1. associate-*r/98.1%

        \[\leadsto \color{blue}{\frac{-1 \cdot b}{a}} \]
      2. neg-mul-198.1%

        \[\leadsto \frac{\color{blue}{-b}}{a} \]
    6. Simplified98.1%

      \[\leadsto \color{blue}{\frac{-b}{a}} \]

    if -5.00000000000000016e138 < b < 6.19999999999999999e-31

    1. Initial program 81.5%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]

    if 6.19999999999999999e-31 < b

    1. Initial program 11.5%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
    2. Step-by-step derivation
      1. neg-sub011.5%

        \[\leadsto \frac{\color{blue}{\left(0 - b\right)} + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
      2. associate-+l-11.5%

        \[\leadsto \frac{\color{blue}{0 - \left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}{2 \cdot a} \]
      3. sub0-neg11.5%

        \[\leadsto \frac{\color{blue}{-\left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}{2 \cdot a} \]
      4. neg-mul-111.5%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}{2 \cdot a} \]
      5. associate-*l/11.5%

        \[\leadsto \color{blue}{\frac{-1}{2 \cdot a} \cdot \left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)} \]
      6. *-commutative11.5%

        \[\leadsto \color{blue}{\left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right) \cdot \frac{-1}{2 \cdot a}} \]
      7. associate-/r*11.5%

        \[\leadsto \left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right) \cdot \color{blue}{\frac{\frac{-1}{2}}{a}} \]
      8. /-rgt-identity11.5%

        \[\leadsto \color{blue}{\frac{b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{1}} \cdot \frac{\frac{-1}{2}}{a} \]
      9. metadata-eval11.5%

        \[\leadsto \frac{b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\color{blue}{--1}} \cdot \frac{\frac{-1}{2}}{a} \]
    3. Simplified11.5%

      \[\leadsto \color{blue}{\left(b - \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)}\right) \cdot \frac{-0.5}{a}} \]
    4. Taylor expanded in b around inf 74.8%

      \[\leadsto \color{blue}{-1 \cdot \frac{{c}^{2} \cdot a}{{b}^{3}} + -1 \cdot \frac{c}{b}} \]
    5. Step-by-step derivation
      1. +-commutative74.8%

        \[\leadsto \color{blue}{-1 \cdot \frac{c}{b} + -1 \cdot \frac{{c}^{2} \cdot a}{{b}^{3}}} \]
      2. mul-1-neg74.8%

        \[\leadsto -1 \cdot \frac{c}{b} + \color{blue}{\left(-\frac{{c}^{2} \cdot a}{{b}^{3}}\right)} \]
      3. unsub-neg74.8%

        \[\leadsto \color{blue}{-1 \cdot \frac{c}{b} - \frac{{c}^{2} \cdot a}{{b}^{3}}} \]
      4. associate-*r/74.8%

        \[\leadsto \color{blue}{\frac{-1 \cdot c}{b}} - \frac{{c}^{2} \cdot a}{{b}^{3}} \]
      5. neg-mul-174.8%

        \[\leadsto \frac{\color{blue}{-c}}{b} - \frac{{c}^{2} \cdot a}{{b}^{3}} \]
      6. associate-/l*78.6%

        \[\leadsto \frac{-c}{b} - \color{blue}{\frac{{c}^{2}}{\frac{{b}^{3}}{a}}} \]
      7. unpow278.6%

        \[\leadsto \frac{-c}{b} - \frac{\color{blue}{c \cdot c}}{\frac{{b}^{3}}{a}} \]
      8. associate-/l*95.6%

        \[\leadsto \frac{-c}{b} - \color{blue}{\frac{c}{\frac{\frac{{b}^{3}}{a}}{c}}} \]
    6. Simplified95.6%

      \[\leadsto \color{blue}{\frac{-c}{b} - \frac{c}{\frac{\frac{{b}^{3}}{a}}{c}}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification89.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -5 \cdot 10^{+138}:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{elif}\;b \leq 6.2 \cdot 10^{-31}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - \left(a \cdot 4\right) \cdot c} - b}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b} - \frac{c}{\frac{\frac{{b}^{3}}{a}}{c}}\\ \end{array} \]

Alternative 2: 85.5% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -2.55 \cdot 10^{+135}:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{elif}\;b \leq 9.6 \cdot 10^{-30}:\\ \;\;\;\;\left(\sqrt{b \cdot b + a \cdot \left(c \cdot -4\right)} - b\right) \cdot \frac{0.5}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b} - \frac{c}{\frac{\frac{{b}^{3}}{a}}{c}}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b -2.55e+135)
   (/ (- b) a)
   (if (<= b 9.6e-30)
     (* (- (sqrt (+ (* b b) (* a (* c -4.0)))) b) (/ 0.5 a))
     (- (/ (- c) b) (/ c (/ (/ (pow b 3.0) a) c))))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= -2.55e+135) {
		tmp = -b / a;
	} else if (b <= 9.6e-30) {
		tmp = (sqrt(((b * b) + (a * (c * -4.0)))) - b) * (0.5 / a);
	} else {
		tmp = (-c / b) - (c / ((pow(b, 3.0) / a) / c));
	}
	return tmp;
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8) :: tmp
    if (b <= (-2.55d+135)) then
        tmp = -b / a
    else if (b <= 9.6d-30) then
        tmp = (sqrt(((b * b) + (a * (c * (-4.0d0))))) - b) * (0.5d0 / a)
    else
        tmp = (-c / b) - (c / (((b ** 3.0d0) / a) / c))
    end if
    code = tmp
end function
public static double code(double a, double b, double c) {
	double tmp;
	if (b <= -2.55e+135) {
		tmp = -b / a;
	} else if (b <= 9.6e-30) {
		tmp = (Math.sqrt(((b * b) + (a * (c * -4.0)))) - b) * (0.5 / a);
	} else {
		tmp = (-c / b) - (c / ((Math.pow(b, 3.0) / a) / c));
	}
	return tmp;
}
def code(a, b, c):
	tmp = 0
	if b <= -2.55e+135:
		tmp = -b / a
	elif b <= 9.6e-30:
		tmp = (math.sqrt(((b * b) + (a * (c * -4.0)))) - b) * (0.5 / a)
	else:
		tmp = (-c / b) - (c / ((math.pow(b, 3.0) / a) / c))
	return tmp
function code(a, b, c)
	tmp = 0.0
	if (b <= -2.55e+135)
		tmp = Float64(Float64(-b) / a);
	elseif (b <= 9.6e-30)
		tmp = Float64(Float64(sqrt(Float64(Float64(b * b) + Float64(a * Float64(c * -4.0)))) - b) * Float64(0.5 / a));
	else
		tmp = Float64(Float64(Float64(-c) / b) - Float64(c / Float64(Float64((b ^ 3.0) / a) / c)));
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	tmp = 0.0;
	if (b <= -2.55e+135)
		tmp = -b / a;
	elseif (b <= 9.6e-30)
		tmp = (sqrt(((b * b) + (a * (c * -4.0)))) - b) * (0.5 / a);
	else
		tmp = (-c / b) - (c / (((b ^ 3.0) / a) / c));
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := If[LessEqual[b, -2.55e+135], N[((-b) / a), $MachinePrecision], If[LessEqual[b, 9.6e-30], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] + N[(a * N[(c * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] * N[(0.5 / a), $MachinePrecision]), $MachinePrecision], N[(N[((-c) / b), $MachinePrecision] - N[(c / N[(N[(N[Power[b, 3.0], $MachinePrecision] / a), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.55 \cdot 10^{+135}:\\
\;\;\;\;\frac{-b}{a}\\

\mathbf{elif}\;b \leq 9.6 \cdot 10^{-30}:\\
\;\;\;\;\left(\sqrt{b \cdot b + a \cdot \left(c \cdot -4\right)} - b\right) \cdot \frac{0.5}{a}\\

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


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

    1. Initial program 44.2%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
    2. Step-by-step derivation
      1. neg-sub044.2%

        \[\leadsto \frac{\color{blue}{\left(0 - b\right)} + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
      2. associate-+l-44.2%

        \[\leadsto \frac{\color{blue}{0 - \left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}{2 \cdot a} \]
      3. sub0-neg44.2%

        \[\leadsto \frac{\color{blue}{-\left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}{2 \cdot a} \]
      4. neg-mul-144.2%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}{2 \cdot a} \]
      5. associate-*l/44.2%

        \[\leadsto \color{blue}{\frac{-1}{2 \cdot a} \cdot \left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)} \]
      6. *-commutative44.2%

        \[\leadsto \color{blue}{\left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right) \cdot \frac{-1}{2 \cdot a}} \]
      7. associate-/r*44.2%

        \[\leadsto \left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right) \cdot \color{blue}{\frac{\frac{-1}{2}}{a}} \]
      8. /-rgt-identity44.2%

        \[\leadsto \color{blue}{\frac{b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{1}} \cdot \frac{\frac{-1}{2}}{a} \]
      9. metadata-eval44.2%

        \[\leadsto \frac{b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\color{blue}{--1}} \cdot \frac{\frac{-1}{2}}{a} \]
    3. Simplified44.5%

      \[\leadsto \color{blue}{\left(b - \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)}\right) \cdot \frac{-0.5}{a}} \]
    4. Taylor expanded in b around -inf 98.1%

      \[\leadsto \color{blue}{-1 \cdot \frac{b}{a}} \]
    5. Step-by-step derivation
      1. associate-*r/98.1%

        \[\leadsto \color{blue}{\frac{-1 \cdot b}{a}} \]
      2. neg-mul-198.1%

        \[\leadsto \frac{\color{blue}{-b}}{a} \]
    6. Simplified98.1%

      \[\leadsto \color{blue}{\frac{-b}{a}} \]

    if -2.54999999999999991e135 < b < 9.5999999999999994e-30

    1. Initial program 81.5%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
    2. Step-by-step derivation
      1. /-rgt-identity81.5%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\color{blue}{\frac{2 \cdot a}{1}}} \]
      2. metadata-eval81.5%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\frac{2 \cdot a}{\color{blue}{--1}}} \]
      3. associate-/l*81.5%

        \[\leadsto \color{blue}{\frac{\left(\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right) \cdot \left(--1\right)}{2 \cdot a}} \]
      4. associate-*r/81.4%

        \[\leadsto \color{blue}{\left(\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right) \cdot \frac{--1}{2 \cdot a}} \]
      5. +-commutative81.4%

        \[\leadsto \color{blue}{\left(\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} + \left(-b\right)\right)} \cdot \frac{--1}{2 \cdot a} \]
      6. unsub-neg81.4%

        \[\leadsto \color{blue}{\left(\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} - b\right)} \cdot \frac{--1}{2 \cdot a} \]
      7. fma-neg81.4%

        \[\leadsto \left(\sqrt{\color{blue}{\mathsf{fma}\left(b, b, -\left(4 \cdot a\right) \cdot c\right)}} - b\right) \cdot \frac{--1}{2 \cdot a} \]
      8. associate-*l*81.4%

        \[\leadsto \left(\sqrt{\mathsf{fma}\left(b, b, -\color{blue}{4 \cdot \left(a \cdot c\right)}\right)} - b\right) \cdot \frac{--1}{2 \cdot a} \]
      9. *-commutative81.4%

        \[\leadsto \left(\sqrt{\mathsf{fma}\left(b, b, -\color{blue}{\left(a \cdot c\right) \cdot 4}\right)} - b\right) \cdot \frac{--1}{2 \cdot a} \]
      10. distribute-rgt-neg-in81.4%

        \[\leadsto \left(\sqrt{\mathsf{fma}\left(b, b, \color{blue}{\left(a \cdot c\right) \cdot \left(-4\right)}\right)} - b\right) \cdot \frac{--1}{2 \cdot a} \]
      11. metadata-eval81.4%

        \[\leadsto \left(\sqrt{\mathsf{fma}\left(b, b, \left(a \cdot c\right) \cdot \color{blue}{-4}\right)} - b\right) \cdot \frac{--1}{2 \cdot a} \]
      12. associate-/r*81.4%

        \[\leadsto \left(\sqrt{\mathsf{fma}\left(b, b, \left(a \cdot c\right) \cdot -4\right)} - b\right) \cdot \color{blue}{\frac{\frac{--1}{2}}{a}} \]
      13. metadata-eval81.4%

        \[\leadsto \left(\sqrt{\mathsf{fma}\left(b, b, \left(a \cdot c\right) \cdot -4\right)} - b\right) \cdot \frac{\frac{\color{blue}{1}}{2}}{a} \]
      14. metadata-eval81.4%

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

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

        \[\leadsto \left(\sqrt{\color{blue}{b \cdot b + \left(a \cdot c\right) \cdot -4}} - b\right) \cdot \frac{0.5}{a} \]
      2. associate-*l*81.4%

        \[\leadsto \left(\sqrt{b \cdot b + \color{blue}{a \cdot \left(c \cdot -4\right)}} - b\right) \cdot \frac{0.5}{a} \]
    5. Applied egg-rr81.4%

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

    if 9.5999999999999994e-30 < b

    1. Initial program 11.5%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
    2. Step-by-step derivation
      1. neg-sub011.5%

        \[\leadsto \frac{\color{blue}{\left(0 - b\right)} + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
      2. associate-+l-11.5%

        \[\leadsto \frac{\color{blue}{0 - \left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}{2 \cdot a} \]
      3. sub0-neg11.5%

        \[\leadsto \frac{\color{blue}{-\left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}{2 \cdot a} \]
      4. neg-mul-111.5%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}{2 \cdot a} \]
      5. associate-*l/11.5%

        \[\leadsto \color{blue}{\frac{-1}{2 \cdot a} \cdot \left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)} \]
      6. *-commutative11.5%

        \[\leadsto \color{blue}{\left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right) \cdot \frac{-1}{2 \cdot a}} \]
      7. associate-/r*11.5%

        \[\leadsto \left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right) \cdot \color{blue}{\frac{\frac{-1}{2}}{a}} \]
      8. /-rgt-identity11.5%

        \[\leadsto \color{blue}{\frac{b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{1}} \cdot \frac{\frac{-1}{2}}{a} \]
      9. metadata-eval11.5%

        \[\leadsto \frac{b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\color{blue}{--1}} \cdot \frac{\frac{-1}{2}}{a} \]
    3. Simplified11.5%

      \[\leadsto \color{blue}{\left(b - \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)}\right) \cdot \frac{-0.5}{a}} \]
    4. Taylor expanded in b around inf 74.8%

      \[\leadsto \color{blue}{-1 \cdot \frac{{c}^{2} \cdot a}{{b}^{3}} + -1 \cdot \frac{c}{b}} \]
    5. Step-by-step derivation
      1. +-commutative74.8%

        \[\leadsto \color{blue}{-1 \cdot \frac{c}{b} + -1 \cdot \frac{{c}^{2} \cdot a}{{b}^{3}}} \]
      2. mul-1-neg74.8%

        \[\leadsto -1 \cdot \frac{c}{b} + \color{blue}{\left(-\frac{{c}^{2} \cdot a}{{b}^{3}}\right)} \]
      3. unsub-neg74.8%

        \[\leadsto \color{blue}{-1 \cdot \frac{c}{b} - \frac{{c}^{2} \cdot a}{{b}^{3}}} \]
      4. associate-*r/74.8%

        \[\leadsto \color{blue}{\frac{-1 \cdot c}{b}} - \frac{{c}^{2} \cdot a}{{b}^{3}} \]
      5. neg-mul-174.8%

        \[\leadsto \frac{\color{blue}{-c}}{b} - \frac{{c}^{2} \cdot a}{{b}^{3}} \]
      6. associate-/l*78.6%

        \[\leadsto \frac{-c}{b} - \color{blue}{\frac{{c}^{2}}{\frac{{b}^{3}}{a}}} \]
      7. unpow278.6%

        \[\leadsto \frac{-c}{b} - \frac{\color{blue}{c \cdot c}}{\frac{{b}^{3}}{a}} \]
      8. associate-/l*95.6%

        \[\leadsto \frac{-c}{b} - \color{blue}{\frac{c}{\frac{\frac{{b}^{3}}{a}}{c}}} \]
    6. Simplified95.6%

      \[\leadsto \color{blue}{\frac{-c}{b} - \frac{c}{\frac{\frac{{b}^{3}}{a}}{c}}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification88.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -2.55 \cdot 10^{+135}:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{elif}\;b \leq 9.6 \cdot 10^{-30}:\\ \;\;\;\;\left(\sqrt{b \cdot b + a \cdot \left(c \cdot -4\right)} - b\right) \cdot \frac{0.5}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b} - \frac{c}{\frac{\frac{{b}^{3}}{a}}{c}}\\ \end{array} \]

Alternative 3: 80.4% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -5.1 \cdot 10^{-30}:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \mathbf{elif}\;b \leq 1.7 \cdot 10^{-44}:\\ \;\;\;\;\frac{\sqrt{c \cdot \left(a \cdot -4\right)} - b}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b} - \frac{c}{\frac{\frac{{b}^{3}}{a}}{c}}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b -5.1e-30)
   (- (/ c b) (/ b a))
   (if (<= b 1.7e-44)
     (/ (- (sqrt (* c (* a -4.0))) b) (* a 2.0))
     (- (/ (- c) b) (/ c (/ (/ (pow b 3.0) a) c))))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= -5.1e-30) {
		tmp = (c / b) - (b / a);
	} else if (b <= 1.7e-44) {
		tmp = (sqrt((c * (a * -4.0))) - b) / (a * 2.0);
	} else {
		tmp = (-c / b) - (c / ((pow(b, 3.0) / a) / c));
	}
	return tmp;
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8) :: tmp
    if (b <= (-5.1d-30)) then
        tmp = (c / b) - (b / a)
    else if (b <= 1.7d-44) then
        tmp = (sqrt((c * (a * (-4.0d0)))) - b) / (a * 2.0d0)
    else
        tmp = (-c / b) - (c / (((b ** 3.0d0) / a) / c))
    end if
    code = tmp
end function
public static double code(double a, double b, double c) {
	double tmp;
	if (b <= -5.1e-30) {
		tmp = (c / b) - (b / a);
	} else if (b <= 1.7e-44) {
		tmp = (Math.sqrt((c * (a * -4.0))) - b) / (a * 2.0);
	} else {
		tmp = (-c / b) - (c / ((Math.pow(b, 3.0) / a) / c));
	}
	return tmp;
}
def code(a, b, c):
	tmp = 0
	if b <= -5.1e-30:
		tmp = (c / b) - (b / a)
	elif b <= 1.7e-44:
		tmp = (math.sqrt((c * (a * -4.0))) - b) / (a * 2.0)
	else:
		tmp = (-c / b) - (c / ((math.pow(b, 3.0) / a) / c))
	return tmp
function code(a, b, c)
	tmp = 0.0
	if (b <= -5.1e-30)
		tmp = Float64(Float64(c / b) - Float64(b / a));
	elseif (b <= 1.7e-44)
		tmp = Float64(Float64(sqrt(Float64(c * Float64(a * -4.0))) - b) / Float64(a * 2.0));
	else
		tmp = Float64(Float64(Float64(-c) / b) - Float64(c / Float64(Float64((b ^ 3.0) / a) / c)));
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	tmp = 0.0;
	if (b <= -5.1e-30)
		tmp = (c / b) - (b / a);
	elseif (b <= 1.7e-44)
		tmp = (sqrt((c * (a * -4.0))) - b) / (a * 2.0);
	else
		tmp = (-c / b) - (c / (((b ^ 3.0) / a) / c));
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := If[LessEqual[b, -5.1e-30], N[(N[(c / b), $MachinePrecision] - N[(b / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.7e-44], N[(N[(N[Sqrt[N[(c * N[(a * -4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[((-c) / b), $MachinePrecision] - N[(c / N[(N[(N[Power[b, 3.0], $MachinePrecision] / a), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq -5.1 \cdot 10^{-30}:\\
\;\;\;\;\frac{c}{b} - \frac{b}{a}\\

\mathbf{elif}\;b \leq 1.7 \cdot 10^{-44}:\\
\;\;\;\;\frac{\sqrt{c \cdot \left(a \cdot -4\right)} - b}{a \cdot 2}\\

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


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

    1. Initial program 68.4%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
    2. Step-by-step derivation
      1. neg-sub068.4%

        \[\leadsto \frac{\color{blue}{\left(0 - b\right)} + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
      2. associate-+l-68.4%

        \[\leadsto \frac{\color{blue}{0 - \left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}{2 \cdot a} \]
      3. sub0-neg68.4%

        \[\leadsto \frac{\color{blue}{-\left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}{2 \cdot a} \]
      4. neg-mul-168.4%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}{2 \cdot a} \]
      5. associate-*l/68.2%

        \[\leadsto \color{blue}{\frac{-1}{2 \cdot a} \cdot \left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)} \]
      6. *-commutative68.2%

        \[\leadsto \color{blue}{\left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right) \cdot \frac{-1}{2 \cdot a}} \]
      7. associate-/r*68.2%

        \[\leadsto \left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right) \cdot \color{blue}{\frac{\frac{-1}{2}}{a}} \]
      8. /-rgt-identity68.2%

        \[\leadsto \color{blue}{\frac{b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{1}} \cdot \frac{\frac{-1}{2}}{a} \]
      9. metadata-eval68.2%

        \[\leadsto \frac{b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\color{blue}{--1}} \cdot \frac{\frac{-1}{2}}{a} \]
    3. Simplified68.4%

      \[\leadsto \color{blue}{\left(b - \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)}\right) \cdot \frac{-0.5}{a}} \]
    4. Taylor expanded in b around -inf 91.9%

      \[\leadsto \color{blue}{\frac{c}{b} + -1 \cdot \frac{b}{a}} \]
    5. Step-by-step derivation
      1. mul-1-neg91.9%

        \[\leadsto \frac{c}{b} + \color{blue}{\left(-\frac{b}{a}\right)} \]
      2. unsub-neg91.9%

        \[\leadsto \color{blue}{\frac{c}{b} - \frac{b}{a}} \]
    6. Simplified91.9%

      \[\leadsto \color{blue}{\frac{c}{b} - \frac{b}{a}} \]

    if -5.09999999999999972e-30 < b < 1.70000000000000008e-44

    1. Initial program 75.1%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
    2. Step-by-step derivation
      1. pow1/275.1%

        \[\leadsto \frac{\left(-b\right) + \color{blue}{{\left(b \cdot b - \left(4 \cdot a\right) \cdot c\right)}^{0.5}}}{2 \cdot a} \]
      2. pow-to-exp70.3%

        \[\leadsto \frac{\left(-b\right) + \color{blue}{e^{\log \left(b \cdot b - \left(4 \cdot a\right) \cdot c\right) \cdot 0.5}}}{2 \cdot a} \]
      3. *-commutative70.3%

        \[\leadsto \frac{\left(-b\right) + e^{\log \left(b \cdot b - \color{blue}{c \cdot \left(4 \cdot a\right)}\right) \cdot 0.5}}{2 \cdot a} \]
      4. *-commutative70.3%

        \[\leadsto \frac{\left(-b\right) + e^{\log \left(b \cdot b - c \cdot \color{blue}{\left(a \cdot 4\right)}\right) \cdot 0.5}}{2 \cdot a} \]
    3. Applied egg-rr70.3%

      \[\leadsto \frac{\left(-b\right) + \color{blue}{e^{\log \left(b \cdot b - c \cdot \left(a \cdot 4\right)\right) \cdot 0.5}}}{2 \cdot a} \]
    4. Taylor expanded in b around 0 64.0%

      \[\leadsto \frac{\left(-b\right) + e^{\color{blue}{\log \left(-4 \cdot \left(c \cdot a\right)\right)} \cdot 0.5}}{2 \cdot a} \]
    5. Step-by-step derivation
      1. *-commutative64.0%

        \[\leadsto \frac{\left(-b\right) + e^{\log \left(-\color{blue}{\left(c \cdot a\right) \cdot 4}\right) \cdot 0.5}}{2 \cdot a} \]
      2. distribute-rgt-neg-in64.0%

        \[\leadsto \frac{\left(-b\right) + e^{\log \color{blue}{\left(\left(c \cdot a\right) \cdot \left(-4\right)\right)} \cdot 0.5}}{2 \cdot a} \]
      3. metadata-eval64.0%

        \[\leadsto \frac{\left(-b\right) + e^{\log \left(\left(c \cdot a\right) \cdot \color{blue}{-4}\right) \cdot 0.5}}{2 \cdot a} \]
      4. associate-*r*64.0%

        \[\leadsto \frac{\left(-b\right) + e^{\log \color{blue}{\left(c \cdot \left(a \cdot -4\right)\right)} \cdot 0.5}}{2 \cdot a} \]
    6. Simplified64.0%

      \[\leadsto \frac{\left(-b\right) + e^{\color{blue}{\log \left(c \cdot \left(a \cdot -4\right)\right)} \cdot 0.5}}{2 \cdot a} \]
    7. Step-by-step derivation
      1. expm1-log1p-u48.1%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\left(-b\right) + e^{\log \left(c \cdot \left(a \cdot -4\right)\right) \cdot 0.5}}{2 \cdot a}\right)\right)} \]
      2. expm1-udef21.4%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{\left(-b\right) + e^{\log \left(c \cdot \left(a \cdot -4\right)\right) \cdot 0.5}}{2 \cdot a}\right)} - 1} \]
      3. exp-to-pow21.5%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{\left(-b\right) + \color{blue}{{\left(c \cdot \left(a \cdot -4\right)\right)}^{0.5}}}{2 \cdot a}\right)} - 1 \]
      4. *-commutative21.5%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{\left(-b\right) + {\left(c \cdot \left(a \cdot -4\right)\right)}^{0.5}}{\color{blue}{a \cdot 2}}\right)} - 1 \]
    8. Applied egg-rr21.5%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{\left(-b\right) + {\left(c \cdot \left(a \cdot -4\right)\right)}^{0.5}}{a \cdot 2}\right)} - 1} \]
    9. Step-by-step derivation
      1. expm1-def50.3%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\left(-b\right) + {\left(c \cdot \left(a \cdot -4\right)\right)}^{0.5}}{a \cdot 2}\right)\right)} \]
      2. expm1-log1p68.2%

        \[\leadsto \color{blue}{\frac{\left(-b\right) + {\left(c \cdot \left(a \cdot -4\right)\right)}^{0.5}}{a \cdot 2}} \]
      3. +-commutative68.2%

        \[\leadsto \frac{\color{blue}{{\left(c \cdot \left(a \cdot -4\right)\right)}^{0.5} + \left(-b\right)}}{a \cdot 2} \]
      4. unsub-neg68.2%

        \[\leadsto \frac{\color{blue}{{\left(c \cdot \left(a \cdot -4\right)\right)}^{0.5} - b}}{a \cdot 2} \]
      5. unpow1/268.2%

        \[\leadsto \frac{\color{blue}{\sqrt{c \cdot \left(a \cdot -4\right)}} - b}{a \cdot 2} \]
    10. Simplified68.2%

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

    if 1.70000000000000008e-44 < b

    1. Initial program 13.3%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
    2. Step-by-step derivation
      1. neg-sub013.3%

        \[\leadsto \frac{\color{blue}{\left(0 - b\right)} + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
      2. associate-+l-13.3%

        \[\leadsto \frac{\color{blue}{0 - \left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}{2 \cdot a} \]
      3. sub0-neg13.3%

        \[\leadsto \frac{\color{blue}{-\left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}{2 \cdot a} \]
      4. neg-mul-113.3%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}{2 \cdot a} \]
      5. associate-*l/13.3%

        \[\leadsto \color{blue}{\frac{-1}{2 \cdot a} \cdot \left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)} \]
      6. *-commutative13.3%

        \[\leadsto \color{blue}{\left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right) \cdot \frac{-1}{2 \cdot a}} \]
      7. associate-/r*13.3%

        \[\leadsto \left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right) \cdot \color{blue}{\frac{\frac{-1}{2}}{a}} \]
      8. /-rgt-identity13.3%

        \[\leadsto \color{blue}{\frac{b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{1}} \cdot \frac{\frac{-1}{2}}{a} \]
      9. metadata-eval13.3%

        \[\leadsto \frac{b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\color{blue}{--1}} \cdot \frac{\frac{-1}{2}}{a} \]
    3. Simplified13.3%

      \[\leadsto \color{blue}{\left(b - \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)}\right) \cdot \frac{-0.5}{a}} \]
    4. Taylor expanded in b around inf 74.0%

      \[\leadsto \color{blue}{-1 \cdot \frac{{c}^{2} \cdot a}{{b}^{3}} + -1 \cdot \frac{c}{b}} \]
    5. Step-by-step derivation
      1. +-commutative74.0%

        \[\leadsto \color{blue}{-1 \cdot \frac{c}{b} + -1 \cdot \frac{{c}^{2} \cdot a}{{b}^{3}}} \]
      2. mul-1-neg74.0%

        \[\leadsto -1 \cdot \frac{c}{b} + \color{blue}{\left(-\frac{{c}^{2} \cdot a}{{b}^{3}}\right)} \]
      3. unsub-neg74.0%

        \[\leadsto \color{blue}{-1 \cdot \frac{c}{b} - \frac{{c}^{2} \cdot a}{{b}^{3}}} \]
      4. associate-*r/74.0%

        \[\leadsto \color{blue}{\frac{-1 \cdot c}{b}} - \frac{{c}^{2} \cdot a}{{b}^{3}} \]
      5. neg-mul-174.0%

        \[\leadsto \frac{\color{blue}{-c}}{b} - \frac{{c}^{2} \cdot a}{{b}^{3}} \]
      6. associate-/l*77.7%

        \[\leadsto \frac{-c}{b} - \color{blue}{\frac{{c}^{2}}{\frac{{b}^{3}}{a}}} \]
      7. unpow277.7%

        \[\leadsto \frac{-c}{b} - \frac{\color{blue}{c \cdot c}}{\frac{{b}^{3}}{a}} \]
      8. associate-/l*94.1%

        \[\leadsto \frac{-c}{b} - \color{blue}{\frac{c}{\frac{\frac{{b}^{3}}{a}}{c}}} \]
    6. Simplified94.1%

      \[\leadsto \color{blue}{\frac{-c}{b} - \frac{c}{\frac{\frac{{b}^{3}}{a}}{c}}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification84.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -5.1 \cdot 10^{-30}:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \mathbf{elif}\;b \leq 1.7 \cdot 10^{-44}:\\ \;\;\;\;\frac{\sqrt{c \cdot \left(a \cdot -4\right)} - b}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b} - \frac{c}{\frac{\frac{{b}^{3}}{a}}{c}}\\ \end{array} \]

Alternative 4: 80.0% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq -5.1 \cdot 10^{-30}:\\
\;\;\;\;\frac{c}{b} - \frac{b}{a}\\

\mathbf{elif}\;b \leq 7 \cdot 10^{-45}:\\
\;\;\;\;0.5 \cdot \frac{\sqrt{c \cdot \frac{a \cdot 4}{-1}}}{a}\\

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


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

    1. Initial program 68.4%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
    2. Step-by-step derivation
      1. neg-sub068.4%

        \[\leadsto \frac{\color{blue}{\left(0 - b\right)} + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
      2. associate-+l-68.4%

        \[\leadsto \frac{\color{blue}{0 - \left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}{2 \cdot a} \]
      3. sub0-neg68.4%

        \[\leadsto \frac{\color{blue}{-\left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}{2 \cdot a} \]
      4. neg-mul-168.4%

        \[\leadsto \frac{\color{blue}{-1 \cdot \left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}{2 \cdot a} \]
      5. associate-*l/68.2%

        \[\leadsto \color{blue}{\frac{-1}{2 \cdot a} \cdot \left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)} \]
      6. *-commutative68.2%

        \[\leadsto \color{blue}{\left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right) \cdot \frac{-1}{2 \cdot a}} \]
      7. associate-/r*68.2%

        \[\leadsto \left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right) \cdot \color{blue}{\frac{\frac{-1}{2}}{a}} \]
      8. /-rgt-identity68.2%

        \[\leadsto \color{blue}{\frac{b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{1}} \cdot \frac{\frac{-1}{2}}{a} \]
      9. metadata-eval68.2%

        \[\leadsto \frac{b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\color{blue}{--1}} \cdot \frac{\frac{-1}{2}}{a} \]
    3. Simplified68.4%

      \[\leadsto \color{blue}{\left(b - \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)}\right) \cdot \frac{-0.5}{a}} \]
    4. Taylor expanded in b around -inf 91.9%

      \[\leadsto \color{blue}{\frac{c}{b} + -1 \cdot \frac{b}{a}} \]
    5. Step-by-step derivation
      1. mul-1-neg91.9%

        \[\leadsto \frac{c}{b} + \color{blue}{\left(-\frac{b}{a}\right)} \]
      2. unsub-neg91.9%

        \[\leadsto \color{blue}{\frac{c}{b} - \frac{b}{a}} \]
    6. Simplified91.9%

      \[\leadsto \color{blue}{\frac{c}{b} - \frac{b}{a}} \]

    if -5.09999999999999972e-30 < b < 7e-45

    1. Initial program 75.1%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
    2. Step-by-step derivation
      1. pow1/275.1%

        \[\leadsto \frac{\left(-b\right) + \color{blue}{{\left(b \cdot b - \left(4 \cdot a\right) \cdot c\right)}^{0.5}}}{2 \cdot a} \]
      2. pow-to-exp70.3%

        \[\leadsto \frac{\left(-b\right) + \color{blue}{e^{\log \left(b \cdot b - \left(4 \cdot a\right) \cdot c\right) \cdot 0.5}}}{2 \cdot a} \]
      3. *-commutative70.3%

        \[\leadsto \frac{\left(-b\right) + e^{\log \left(b \cdot b - \color{blue}{c \cdot \left(4 \cdot a\right)}\right) \cdot 0.5}}{2 \cdot a} \]
      4. *-commutative70.3%

        \[\leadsto \frac{\left(-b\right) + e^{\log \left(b \cdot b - c \cdot \color{blue}{\left(a \cdot 4\right)}\right) \cdot 0.5}}{2 \cdot a} \]
    3. Applied egg-rr70.3%

      \[\leadsto \frac{\left(-b\right) + \color{blue}{e^{\log \left(b \cdot b - c \cdot \left(a \cdot 4\right)\right) \cdot 0.5}}}{2 \cdot a} \]
    4. Taylor expanded in c around -inf 36.7%

      \[\leadsto \frac{\left(-b\right) + e^{\color{blue}{\left(-1 \cdot \log \left(\frac{-1}{c}\right) + \log \left(--4 \cdot a\right)\right)} \cdot 0.5}}{2 \cdot a} \]
    5. Step-by-step derivation
      1. +-commutative36.7%

        \[\leadsto \frac{\left(-b\right) + e^{\color{blue}{\left(\log \left(--4 \cdot a\right) + -1 \cdot \log \left(\frac{-1}{c}\right)\right)} \cdot 0.5}}{2 \cdot a} \]
      2. mul-1-neg36.7%

        \[\leadsto \frac{\left(-b\right) + e^{\left(\log \left(--4 \cdot a\right) + \color{blue}{\left(-\log \left(\frac{-1}{c}\right)\right)}\right) \cdot 0.5}}{2 \cdot a} \]
      3. unsub-neg36.7%

        \[\leadsto \frac{\left(-b\right) + e^{\color{blue}{\left(\log \left(--4 \cdot a\right) - \log \left(\frac{-1}{c}\right)\right)} \cdot 0.5}}{2 \cdot a} \]
      4. distribute-lft-neg-in36.7%

        \[\leadsto \frac{\left(-b\right) + e^{\left(\log \color{blue}{\left(\left(--4\right) \cdot a\right)} - \log \left(\frac{-1}{c}\right)\right) \cdot 0.5}}{2 \cdot a} \]
      5. metadata-eval36.7%

        \[\leadsto \frac{\left(-b\right) + e^{\left(\log \left(\color{blue}{4} \cdot a\right) - \log \left(\frac{-1}{c}\right)\right) \cdot 0.5}}{2 \cdot a} \]
      6. *-commutative36.7%

        \[\leadsto \frac{\left(-b\right) + e^{\left(\log \color{blue}{\left(a \cdot 4\right)} - \log \left(\frac{-1}{c}\right)\right) \cdot 0.5}}{2 \cdot a} \]
    6. Simplified36.7%

      \[\leadsto \frac{\left(-b\right) + e^{\color{blue}{\left(\log \left(a \cdot 4\right) - \log \left(\frac{-1}{c}\right)\right)} \cdot 0.5}}{2 \cdot a} \]
    7. Taylor expanded in b around 0 36.7%

      \[\leadsto \color{blue}{0.5 \cdot \frac{e^{0.5 \cdot \left(\log \left(4 \cdot a\right) - \log \left(\frac{-1}{c}\right)\right)}}{a}} \]
    8. Step-by-step derivation
      1. Simplified66.6%

        \[\leadsto \color{blue}{0.5 \cdot \frac{\sqrt{\frac{a \cdot 4}{-1} \cdot c}}{a}} \]

      if 7e-45 < b

      1. Initial program 13.3%

        \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
      2. Step-by-step derivation
        1. neg-sub013.3%

          \[\leadsto \frac{\color{blue}{\left(0 - b\right)} + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
        2. associate-+l-13.3%

          \[\leadsto \frac{\color{blue}{0 - \left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}{2 \cdot a} \]
        3. sub0-neg13.3%

          \[\leadsto \frac{\color{blue}{-\left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}{2 \cdot a} \]
        4. neg-mul-113.3%

          \[\leadsto \frac{\color{blue}{-1 \cdot \left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}{2 \cdot a} \]
        5. associate-*l/13.3%

          \[\leadsto \color{blue}{\frac{-1}{2 \cdot a} \cdot \left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)} \]
        6. *-commutative13.3%

          \[\leadsto \color{blue}{\left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right) \cdot \frac{-1}{2 \cdot a}} \]
        7. associate-/r*13.3%

          \[\leadsto \left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right) \cdot \color{blue}{\frac{\frac{-1}{2}}{a}} \]
        8. /-rgt-identity13.3%

          \[\leadsto \color{blue}{\frac{b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{1}} \cdot \frac{\frac{-1}{2}}{a} \]
        9. metadata-eval13.3%

          \[\leadsto \frac{b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\color{blue}{--1}} \cdot \frac{\frac{-1}{2}}{a} \]
      3. Simplified13.3%

        \[\leadsto \color{blue}{\left(b - \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)}\right) \cdot \frac{-0.5}{a}} \]
      4. Taylor expanded in b around inf 93.8%

        \[\leadsto \color{blue}{-1 \cdot \frac{c}{b}} \]
      5. Step-by-step derivation
        1. associate-*r/93.8%

          \[\leadsto \color{blue}{\frac{-1 \cdot c}{b}} \]
        2. neg-mul-193.8%

          \[\leadsto \frac{\color{blue}{-c}}{b} \]
      6. Simplified93.8%

        \[\leadsto \color{blue}{\frac{-c}{b}} \]
    9. Recombined 3 regimes into one program.
    10. Final simplification84.3%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -5.1 \cdot 10^{-30}:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \mathbf{elif}\;b \leq 7 \cdot 10^{-45}:\\ \;\;\;\;0.5 \cdot \frac{\sqrt{c \cdot \frac{a \cdot 4}{-1}}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \]

    Alternative 5: 80.5% accurate, 1.0× speedup?

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

      1. Initial program 68.4%

        \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
      2. Step-by-step derivation
        1. neg-sub068.4%

          \[\leadsto \frac{\color{blue}{\left(0 - b\right)} + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
        2. associate-+l-68.4%

          \[\leadsto \frac{\color{blue}{0 - \left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}{2 \cdot a} \]
        3. sub0-neg68.4%

          \[\leadsto \frac{\color{blue}{-\left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}{2 \cdot a} \]
        4. neg-mul-168.4%

          \[\leadsto \frac{\color{blue}{-1 \cdot \left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}{2 \cdot a} \]
        5. associate-*l/68.2%

          \[\leadsto \color{blue}{\frac{-1}{2 \cdot a} \cdot \left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)} \]
        6. *-commutative68.2%

          \[\leadsto \color{blue}{\left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right) \cdot \frac{-1}{2 \cdot a}} \]
        7. associate-/r*68.2%

          \[\leadsto \left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right) \cdot \color{blue}{\frac{\frac{-1}{2}}{a}} \]
        8. /-rgt-identity68.2%

          \[\leadsto \color{blue}{\frac{b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{1}} \cdot \frac{\frac{-1}{2}}{a} \]
        9. metadata-eval68.2%

          \[\leadsto \frac{b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\color{blue}{--1}} \cdot \frac{\frac{-1}{2}}{a} \]
      3. Simplified68.4%

        \[\leadsto \color{blue}{\left(b - \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)}\right) \cdot \frac{-0.5}{a}} \]
      4. Taylor expanded in b around -inf 91.9%

        \[\leadsto \color{blue}{\frac{c}{b} + -1 \cdot \frac{b}{a}} \]
      5. Step-by-step derivation
        1. mul-1-neg91.9%

          \[\leadsto \frac{c}{b} + \color{blue}{\left(-\frac{b}{a}\right)} \]
        2. unsub-neg91.9%

          \[\leadsto \color{blue}{\frac{c}{b} - \frac{b}{a}} \]
      6. Simplified91.9%

        \[\leadsto \color{blue}{\frac{c}{b} - \frac{b}{a}} \]

      if -6.09999999999999981e-30 < b < 7e-45

      1. Initial program 75.1%

        \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
      2. Step-by-step derivation
        1. neg-sub075.1%

          \[\leadsto \frac{\color{blue}{\left(0 - b\right)} + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
        2. associate-+l-75.1%

          \[\leadsto \frac{\color{blue}{0 - \left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}{2 \cdot a} \]
        3. sub0-neg75.1%

          \[\leadsto \frac{\color{blue}{-\left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}{2 \cdot a} \]
        4. neg-mul-175.1%

          \[\leadsto \frac{\color{blue}{-1 \cdot \left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}{2 \cdot a} \]
        5. associate-*l/75.0%

          \[\leadsto \color{blue}{\frac{-1}{2 \cdot a} \cdot \left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)} \]
        6. *-commutative75.0%

          \[\leadsto \color{blue}{\left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right) \cdot \frac{-1}{2 \cdot a}} \]
        7. associate-/r*75.0%

          \[\leadsto \left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right) \cdot \color{blue}{\frac{\frac{-1}{2}}{a}} \]
        8. /-rgt-identity75.0%

          \[\leadsto \color{blue}{\frac{b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{1}} \cdot \frac{\frac{-1}{2}}{a} \]
        9. metadata-eval75.0%

          \[\leadsto \frac{b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\color{blue}{--1}} \cdot \frac{\frac{-1}{2}}{a} \]
      3. Simplified75.0%

        \[\leadsto \color{blue}{\left(b - \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)}\right) \cdot \frac{-0.5}{a}} \]
      4. Taylor expanded in a around inf 68.2%

        \[\leadsto \left(b - \sqrt{\color{blue}{-4 \cdot \left(c \cdot a\right)}}\right) \cdot \frac{-0.5}{a} \]
      5. Step-by-step derivation
        1. *-commutative68.2%

          \[\leadsto \left(b - \sqrt{\color{blue}{\left(c \cdot a\right) \cdot -4}}\right) \cdot \frac{-0.5}{a} \]
        2. associate-*r*68.2%

          \[\leadsto \left(b - \sqrt{\color{blue}{c \cdot \left(a \cdot -4\right)}}\right) \cdot \frac{-0.5}{a} \]
      6. Simplified68.2%

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

      if 7e-45 < b

      1. Initial program 13.3%

        \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
      2. Step-by-step derivation
        1. neg-sub013.3%

          \[\leadsto \frac{\color{blue}{\left(0 - b\right)} + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
        2. associate-+l-13.3%

          \[\leadsto \frac{\color{blue}{0 - \left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}{2 \cdot a} \]
        3. sub0-neg13.3%

          \[\leadsto \frac{\color{blue}{-\left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}{2 \cdot a} \]
        4. neg-mul-113.3%

          \[\leadsto \frac{\color{blue}{-1 \cdot \left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}{2 \cdot a} \]
        5. associate-*l/13.3%

          \[\leadsto \color{blue}{\frac{-1}{2 \cdot a} \cdot \left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)} \]
        6. *-commutative13.3%

          \[\leadsto \color{blue}{\left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right) \cdot \frac{-1}{2 \cdot a}} \]
        7. associate-/r*13.3%

          \[\leadsto \left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right) \cdot \color{blue}{\frac{\frac{-1}{2}}{a}} \]
        8. /-rgt-identity13.3%

          \[\leadsto \color{blue}{\frac{b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{1}} \cdot \frac{\frac{-1}{2}}{a} \]
        9. metadata-eval13.3%

          \[\leadsto \frac{b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\color{blue}{--1}} \cdot \frac{\frac{-1}{2}}{a} \]
      3. Simplified13.3%

        \[\leadsto \color{blue}{\left(b - \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)}\right) \cdot \frac{-0.5}{a}} \]
      4. Taylor expanded in b around inf 93.8%

        \[\leadsto \color{blue}{-1 \cdot \frac{c}{b}} \]
      5. Step-by-step derivation
        1. associate-*r/93.8%

          \[\leadsto \color{blue}{\frac{-1 \cdot c}{b}} \]
        2. neg-mul-193.8%

          \[\leadsto \frac{\color{blue}{-c}}{b} \]
      6. Simplified93.8%

        \[\leadsto \color{blue}{\frac{-c}{b}} \]
    3. Recombined 3 regimes into one program.
    4. Final simplification84.8%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -6.1 \cdot 10^{-30}:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \mathbf{elif}\;b \leq 7 \cdot 10^{-45}:\\ \;\;\;\;\left(b - \sqrt{c \cdot \left(a \cdot -4\right)}\right) \cdot \frac{-0.5}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \]

    Alternative 6: 80.4% accurate, 1.0× speedup?

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

      1. Initial program 68.4%

        \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
      2. Step-by-step derivation
        1. neg-sub068.4%

          \[\leadsto \frac{\color{blue}{\left(0 - b\right)} + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
        2. associate-+l-68.4%

          \[\leadsto \frac{\color{blue}{0 - \left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}{2 \cdot a} \]
        3. sub0-neg68.4%

          \[\leadsto \frac{\color{blue}{-\left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}{2 \cdot a} \]
        4. neg-mul-168.4%

          \[\leadsto \frac{\color{blue}{-1 \cdot \left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}{2 \cdot a} \]
        5. associate-*l/68.2%

          \[\leadsto \color{blue}{\frac{-1}{2 \cdot a} \cdot \left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)} \]
        6. *-commutative68.2%

          \[\leadsto \color{blue}{\left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right) \cdot \frac{-1}{2 \cdot a}} \]
        7. associate-/r*68.2%

          \[\leadsto \left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right) \cdot \color{blue}{\frac{\frac{-1}{2}}{a}} \]
        8. /-rgt-identity68.2%

          \[\leadsto \color{blue}{\frac{b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{1}} \cdot \frac{\frac{-1}{2}}{a} \]
        9. metadata-eval68.2%

          \[\leadsto \frac{b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\color{blue}{--1}} \cdot \frac{\frac{-1}{2}}{a} \]
      3. Simplified68.4%

        \[\leadsto \color{blue}{\left(b - \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)}\right) \cdot \frac{-0.5}{a}} \]
      4. Taylor expanded in b around -inf 91.9%

        \[\leadsto \color{blue}{\frac{c}{b} + -1 \cdot \frac{b}{a}} \]
      5. Step-by-step derivation
        1. mul-1-neg91.9%

          \[\leadsto \frac{c}{b} + \color{blue}{\left(-\frac{b}{a}\right)} \]
        2. unsub-neg91.9%

          \[\leadsto \color{blue}{\frac{c}{b} - \frac{b}{a}} \]
      6. Simplified91.9%

        \[\leadsto \color{blue}{\frac{c}{b} - \frac{b}{a}} \]

      if -5.59999999999999977e-30 < b < 6.50000000000000001e-43

      1. Initial program 75.1%

        \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
      2. Step-by-step derivation
        1. pow1/275.1%

          \[\leadsto \frac{\left(-b\right) + \color{blue}{{\left(b \cdot b - \left(4 \cdot a\right) \cdot c\right)}^{0.5}}}{2 \cdot a} \]
        2. pow-to-exp70.3%

          \[\leadsto \frac{\left(-b\right) + \color{blue}{e^{\log \left(b \cdot b - \left(4 \cdot a\right) \cdot c\right) \cdot 0.5}}}{2 \cdot a} \]
        3. *-commutative70.3%

          \[\leadsto \frac{\left(-b\right) + e^{\log \left(b \cdot b - \color{blue}{c \cdot \left(4 \cdot a\right)}\right) \cdot 0.5}}{2 \cdot a} \]
        4. *-commutative70.3%

          \[\leadsto \frac{\left(-b\right) + e^{\log \left(b \cdot b - c \cdot \color{blue}{\left(a \cdot 4\right)}\right) \cdot 0.5}}{2 \cdot a} \]
      3. Applied egg-rr70.3%

        \[\leadsto \frac{\left(-b\right) + \color{blue}{e^{\log \left(b \cdot b - c \cdot \left(a \cdot 4\right)\right) \cdot 0.5}}}{2 \cdot a} \]
      4. Taylor expanded in b around 0 64.0%

        \[\leadsto \frac{\left(-b\right) + e^{\color{blue}{\log \left(-4 \cdot \left(c \cdot a\right)\right)} \cdot 0.5}}{2 \cdot a} \]
      5. Step-by-step derivation
        1. *-commutative64.0%

          \[\leadsto \frac{\left(-b\right) + e^{\log \left(-\color{blue}{\left(c \cdot a\right) \cdot 4}\right) \cdot 0.5}}{2 \cdot a} \]
        2. distribute-rgt-neg-in64.0%

          \[\leadsto \frac{\left(-b\right) + e^{\log \color{blue}{\left(\left(c \cdot a\right) \cdot \left(-4\right)\right)} \cdot 0.5}}{2 \cdot a} \]
        3. metadata-eval64.0%

          \[\leadsto \frac{\left(-b\right) + e^{\log \left(\left(c \cdot a\right) \cdot \color{blue}{-4}\right) \cdot 0.5}}{2 \cdot a} \]
        4. associate-*r*64.0%

          \[\leadsto \frac{\left(-b\right) + e^{\log \color{blue}{\left(c \cdot \left(a \cdot -4\right)\right)} \cdot 0.5}}{2 \cdot a} \]
      6. Simplified64.0%

        \[\leadsto \frac{\left(-b\right) + e^{\color{blue}{\log \left(c \cdot \left(a \cdot -4\right)\right)} \cdot 0.5}}{2 \cdot a} \]
      7. Step-by-step derivation
        1. expm1-log1p-u48.1%

          \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\left(-b\right) + e^{\log \left(c \cdot \left(a \cdot -4\right)\right) \cdot 0.5}}{2 \cdot a}\right)\right)} \]
        2. expm1-udef21.4%

          \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{\left(-b\right) + e^{\log \left(c \cdot \left(a \cdot -4\right)\right) \cdot 0.5}}{2 \cdot a}\right)} - 1} \]
        3. exp-to-pow21.5%

          \[\leadsto e^{\mathsf{log1p}\left(\frac{\left(-b\right) + \color{blue}{{\left(c \cdot \left(a \cdot -4\right)\right)}^{0.5}}}{2 \cdot a}\right)} - 1 \]
        4. *-commutative21.5%

          \[\leadsto e^{\mathsf{log1p}\left(\frac{\left(-b\right) + {\left(c \cdot \left(a \cdot -4\right)\right)}^{0.5}}{\color{blue}{a \cdot 2}}\right)} - 1 \]
      8. Applied egg-rr21.5%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{\left(-b\right) + {\left(c \cdot \left(a \cdot -4\right)\right)}^{0.5}}{a \cdot 2}\right)} - 1} \]
      9. Step-by-step derivation
        1. expm1-def50.3%

          \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\left(-b\right) + {\left(c \cdot \left(a \cdot -4\right)\right)}^{0.5}}{a \cdot 2}\right)\right)} \]
        2. expm1-log1p68.2%

          \[\leadsto \color{blue}{\frac{\left(-b\right) + {\left(c \cdot \left(a \cdot -4\right)\right)}^{0.5}}{a \cdot 2}} \]
        3. +-commutative68.2%

          \[\leadsto \frac{\color{blue}{{\left(c \cdot \left(a \cdot -4\right)\right)}^{0.5} + \left(-b\right)}}{a \cdot 2} \]
        4. unsub-neg68.2%

          \[\leadsto \frac{\color{blue}{{\left(c \cdot \left(a \cdot -4\right)\right)}^{0.5} - b}}{a \cdot 2} \]
        5. unpow1/268.2%

          \[\leadsto \frac{\color{blue}{\sqrt{c \cdot \left(a \cdot -4\right)}} - b}{a \cdot 2} \]
      10. Simplified68.2%

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

      if 6.50000000000000001e-43 < b

      1. Initial program 13.3%

        \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
      2. Step-by-step derivation
        1. neg-sub013.3%

          \[\leadsto \frac{\color{blue}{\left(0 - b\right)} + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
        2. associate-+l-13.3%

          \[\leadsto \frac{\color{blue}{0 - \left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}{2 \cdot a} \]
        3. sub0-neg13.3%

          \[\leadsto \frac{\color{blue}{-\left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}{2 \cdot a} \]
        4. neg-mul-113.3%

          \[\leadsto \frac{\color{blue}{-1 \cdot \left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}{2 \cdot a} \]
        5. associate-*l/13.3%

          \[\leadsto \color{blue}{\frac{-1}{2 \cdot a} \cdot \left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)} \]
        6. *-commutative13.3%

          \[\leadsto \color{blue}{\left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right) \cdot \frac{-1}{2 \cdot a}} \]
        7. associate-/r*13.3%

          \[\leadsto \left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right) \cdot \color{blue}{\frac{\frac{-1}{2}}{a}} \]
        8. /-rgt-identity13.3%

          \[\leadsto \color{blue}{\frac{b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{1}} \cdot \frac{\frac{-1}{2}}{a} \]
        9. metadata-eval13.3%

          \[\leadsto \frac{b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\color{blue}{--1}} \cdot \frac{\frac{-1}{2}}{a} \]
      3. Simplified13.3%

        \[\leadsto \color{blue}{\left(b - \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)}\right) \cdot \frac{-0.5}{a}} \]
      4. Taylor expanded in b around inf 93.8%

        \[\leadsto \color{blue}{-1 \cdot \frac{c}{b}} \]
      5. Step-by-step derivation
        1. associate-*r/93.8%

          \[\leadsto \color{blue}{\frac{-1 \cdot c}{b}} \]
        2. neg-mul-193.8%

          \[\leadsto \frac{\color{blue}{-c}}{b} \]
      6. Simplified93.8%

        \[\leadsto \color{blue}{\frac{-c}{b}} \]
    3. Recombined 3 regimes into one program.
    4. Final simplification84.8%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -5.6 \cdot 10^{-30}:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \mathbf{elif}\;b \leq 6.5 \cdot 10^{-43}:\\ \;\;\;\;\frac{\sqrt{c \cdot \left(a \cdot -4\right)} - b}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \]

    Alternative 7: 43.0% accurate, 19.1× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -5.2 \cdot 10^{-300}:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{0}{a}\\ \end{array} \end{array} \]
    (FPCore (a b c)
     :precision binary64
     (if (<= b -5.2e-300) (/ (- b) a) (/ 0.0 a)))
    double code(double a, double b, double c) {
    	double tmp;
    	if (b <= -5.2e-300) {
    		tmp = -b / a;
    	} else {
    		tmp = 0.0 / a;
    	}
    	return tmp;
    }
    
    real(8) function code(a, b, c)
        real(8), intent (in) :: a
        real(8), intent (in) :: b
        real(8), intent (in) :: c
        real(8) :: tmp
        if (b <= (-5.2d-300)) then
            tmp = -b / a
        else
            tmp = 0.0d0 / a
        end if
        code = tmp
    end function
    
    public static double code(double a, double b, double c) {
    	double tmp;
    	if (b <= -5.2e-300) {
    		tmp = -b / a;
    	} else {
    		tmp = 0.0 / a;
    	}
    	return tmp;
    }
    
    def code(a, b, c):
    	tmp = 0
    	if b <= -5.2e-300:
    		tmp = -b / a
    	else:
    		tmp = 0.0 / a
    	return tmp
    
    function code(a, b, c)
    	tmp = 0.0
    	if (b <= -5.2e-300)
    		tmp = Float64(Float64(-b) / a);
    	else
    		tmp = Float64(0.0 / a);
    	end
    	return tmp
    end
    
    function tmp_2 = code(a, b, c)
    	tmp = 0.0;
    	if (b <= -5.2e-300)
    		tmp = -b / a;
    	else
    		tmp = 0.0 / a;
    	end
    	tmp_2 = tmp;
    end
    
    code[a_, b_, c_] := If[LessEqual[b, -5.2e-300], N[((-b) / a), $MachinePrecision], N[(0.0 / a), $MachinePrecision]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;b \leq -5.2 \cdot 10^{-300}:\\
    \;\;\;\;\frac{-b}{a}\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{0}{a}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if b < -5.19999999999999993e-300

      1. Initial program 74.1%

        \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
      2. Step-by-step derivation
        1. neg-sub074.1%

          \[\leadsto \frac{\color{blue}{\left(0 - b\right)} + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
        2. associate-+l-74.1%

          \[\leadsto \frac{\color{blue}{0 - \left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}{2 \cdot a} \]
        3. sub0-neg74.1%

          \[\leadsto \frac{\color{blue}{-\left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}{2 \cdot a} \]
        4. neg-mul-174.1%

          \[\leadsto \frac{\color{blue}{-1 \cdot \left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}{2 \cdot a} \]
        5. associate-*l/73.9%

          \[\leadsto \color{blue}{\frac{-1}{2 \cdot a} \cdot \left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)} \]
        6. *-commutative73.9%

          \[\leadsto \color{blue}{\left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right) \cdot \frac{-1}{2 \cdot a}} \]
        7. associate-/r*73.9%

          \[\leadsto \left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right) \cdot \color{blue}{\frac{\frac{-1}{2}}{a}} \]
        8. /-rgt-identity73.9%

          \[\leadsto \color{blue}{\frac{b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{1}} \cdot \frac{\frac{-1}{2}}{a} \]
        9. metadata-eval73.9%

          \[\leadsto \frac{b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\color{blue}{--1}} \cdot \frac{\frac{-1}{2}}{a} \]
      3. Simplified74.0%

        \[\leadsto \color{blue}{\left(b - \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)}\right) \cdot \frac{-0.5}{a}} \]
      4. Taylor expanded in b around -inf 70.7%

        \[\leadsto \color{blue}{-1 \cdot \frac{b}{a}} \]
      5. Step-by-step derivation
        1. associate-*r/70.7%

          \[\leadsto \color{blue}{\frac{-1 \cdot b}{a}} \]
        2. neg-mul-170.7%

          \[\leadsto \frac{\color{blue}{-b}}{a} \]
      6. Simplified70.7%

        \[\leadsto \color{blue}{\frac{-b}{a}} \]

      if -5.19999999999999993e-300 < b

      1. Initial program 30.4%

        \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
      2. Step-by-step derivation
        1. clear-num30.4%

          \[\leadsto \color{blue}{\frac{1}{\frac{2 \cdot a}{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}}} \]
        2. inv-pow30.4%

          \[\leadsto \color{blue}{{\left(\frac{2 \cdot a}{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\right)}^{-1}} \]
        3. *-commutative30.4%

          \[\leadsto {\left(\frac{\color{blue}{a \cdot 2}}{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\right)}^{-1} \]
        4. neg-mul-130.4%

          \[\leadsto {\left(\frac{a \cdot 2}{\color{blue}{-1 \cdot b} + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\right)}^{-1} \]
        5. fma-def30.4%

          \[\leadsto {\left(\frac{a \cdot 2}{\color{blue}{\mathsf{fma}\left(-1, b, \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}\right)}^{-1} \]
        6. *-commutative30.4%

          \[\leadsto {\left(\frac{a \cdot 2}{\mathsf{fma}\left(-1, b, \sqrt{b \cdot b - \color{blue}{c \cdot \left(4 \cdot a\right)}}\right)}\right)}^{-1} \]
        7. *-commutative30.4%

          \[\leadsto {\left(\frac{a \cdot 2}{\mathsf{fma}\left(-1, b, \sqrt{b \cdot b - c \cdot \color{blue}{\left(a \cdot 4\right)}}\right)}\right)}^{-1} \]
      3. Applied egg-rr30.4%

        \[\leadsto \color{blue}{{\left(\frac{a \cdot 2}{\mathsf{fma}\left(-1, b, \sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)}\right)}\right)}^{-1}} \]
      4. Taylor expanded in a around 0 21.4%

        \[\leadsto \color{blue}{0.5 \cdot \frac{b + -1 \cdot b}{a}} \]
      5. Step-by-step derivation
        1. associate-*r/21.4%

          \[\leadsto \color{blue}{\frac{0.5 \cdot \left(b + -1 \cdot b\right)}{a}} \]
        2. distribute-rgt1-in21.4%

          \[\leadsto \frac{0.5 \cdot \color{blue}{\left(\left(-1 + 1\right) \cdot b\right)}}{a} \]
        3. metadata-eval21.4%

          \[\leadsto \frac{0.5 \cdot \left(\color{blue}{0} \cdot b\right)}{a} \]
        4. mul0-lft21.4%

          \[\leadsto \frac{0.5 \cdot \color{blue}{0}}{a} \]
        5. metadata-eval21.4%

          \[\leadsto \frac{\color{blue}{0}}{a} \]
      6. Simplified21.4%

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -5.2 \cdot 10^{-300}:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{0}{a}\\ \end{array} \]

    Alternative 8: 67.8% accurate, 19.1× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -2 \cdot 10^{-310}:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \end{array} \]
    (FPCore (a b c)
     :precision binary64
     (if (<= b -2e-310) (/ (- b) a) (/ (- c) b)))
    double code(double a, double b, double c) {
    	double tmp;
    	if (b <= -2e-310) {
    		tmp = -b / a;
    	} 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 <= (-2d-310)) then
            tmp = -b / a
        else
            tmp = -c / b
        end if
        code = tmp
    end function
    
    public static double code(double a, double b, double c) {
    	double tmp;
    	if (b <= -2e-310) {
    		tmp = -b / a;
    	} else {
    		tmp = -c / b;
    	}
    	return tmp;
    }
    
    def code(a, b, c):
    	tmp = 0
    	if b <= -2e-310:
    		tmp = -b / a
    	else:
    		tmp = -c / b
    	return tmp
    
    function code(a, b, c)
    	tmp = 0.0
    	if (b <= -2e-310)
    		tmp = Float64(Float64(-b) / a);
    	else
    		tmp = Float64(Float64(-c) / b);
    	end
    	return tmp
    end
    
    function tmp_2 = code(a, b, c)
    	tmp = 0.0;
    	if (b <= -2e-310)
    		tmp = -b / a;
    	else
    		tmp = -c / b;
    	end
    	tmp_2 = tmp;
    end
    
    code[a_, b_, c_] := If[LessEqual[b, -2e-310], N[((-b) / a), $MachinePrecision], N[((-c) / b), $MachinePrecision]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;b \leq -2 \cdot 10^{-310}:\\
    \;\;\;\;\frac{-b}{a}\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{-c}{b}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if b < -1.999999999999994e-310

      1. Initial program 74.1%

        \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
      2. Step-by-step derivation
        1. neg-sub074.1%

          \[\leadsto \frac{\color{blue}{\left(0 - b\right)} + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
        2. associate-+l-74.1%

          \[\leadsto \frac{\color{blue}{0 - \left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}{2 \cdot a} \]
        3. sub0-neg74.1%

          \[\leadsto \frac{\color{blue}{-\left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}{2 \cdot a} \]
        4. neg-mul-174.1%

          \[\leadsto \frac{\color{blue}{-1 \cdot \left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}{2 \cdot a} \]
        5. associate-*l/73.9%

          \[\leadsto \color{blue}{\frac{-1}{2 \cdot a} \cdot \left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)} \]
        6. *-commutative73.9%

          \[\leadsto \color{blue}{\left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right) \cdot \frac{-1}{2 \cdot a}} \]
        7. associate-/r*73.9%

          \[\leadsto \left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right) \cdot \color{blue}{\frac{\frac{-1}{2}}{a}} \]
        8. /-rgt-identity73.9%

          \[\leadsto \color{blue}{\frac{b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{1}} \cdot \frac{\frac{-1}{2}}{a} \]
        9. metadata-eval73.9%

          \[\leadsto \frac{b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\color{blue}{--1}} \cdot \frac{\frac{-1}{2}}{a} \]
      3. Simplified74.0%

        \[\leadsto \color{blue}{\left(b - \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)}\right) \cdot \frac{-0.5}{a}} \]
      4. Taylor expanded in b around -inf 68.8%

        \[\leadsto \color{blue}{-1 \cdot \frac{b}{a}} \]
      5. Step-by-step derivation
        1. associate-*r/68.8%

          \[\leadsto \color{blue}{\frac{-1 \cdot b}{a}} \]
        2. neg-mul-168.8%

          \[\leadsto \frac{\color{blue}{-b}}{a} \]
      6. Simplified68.8%

        \[\leadsto \color{blue}{\frac{-b}{a}} \]

      if -1.999999999999994e-310 < b

      1. Initial program 29.0%

        \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
      2. Step-by-step derivation
        1. neg-sub029.0%

          \[\leadsto \frac{\color{blue}{\left(0 - b\right)} + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
        2. associate-+l-29.0%

          \[\leadsto \frac{\color{blue}{0 - \left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}{2 \cdot a} \]
        3. sub0-neg29.0%

          \[\leadsto \frac{\color{blue}{-\left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}{2 \cdot a} \]
        4. neg-mul-129.0%

          \[\leadsto \frac{\color{blue}{-1 \cdot \left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}{2 \cdot a} \]
        5. associate-*l/28.9%

          \[\leadsto \color{blue}{\frac{-1}{2 \cdot a} \cdot \left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)} \]
        6. *-commutative28.9%

          \[\leadsto \color{blue}{\left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right) \cdot \frac{-1}{2 \cdot a}} \]
        7. associate-/r*28.9%

          \[\leadsto \left(b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right) \cdot \color{blue}{\frac{\frac{-1}{2}}{a}} \]
        8. /-rgt-identity28.9%

          \[\leadsto \color{blue}{\frac{b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{1}} \cdot \frac{\frac{-1}{2}}{a} \]
        9. metadata-eval28.9%

          \[\leadsto \frac{b - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\color{blue}{--1}} \cdot \frac{\frac{-1}{2}}{a} \]
      3. Simplified29.0%

        \[\leadsto \color{blue}{\left(b - \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)}\right) \cdot \frac{-0.5}{a}} \]
      4. Taylor expanded in b around inf 71.3%

        \[\leadsto \color{blue}{-1 \cdot \frac{c}{b}} \]
      5. Step-by-step derivation
        1. associate-*r/71.3%

          \[\leadsto \color{blue}{\frac{-1 \cdot c}{b}} \]
        2. neg-mul-171.3%

          \[\leadsto \frac{\color{blue}{-c}}{b} \]
      6. Simplified71.3%

        \[\leadsto \color{blue}{\frac{-c}{b}} \]
    3. Recombined 2 regimes into one program.
    4. Final simplification70.0%

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

    Alternative 9: 11.6% accurate, 38.7× speedup?

    \[\begin{array}{l} \\ \frac{0}{a} \end{array} \]
    (FPCore (a b c) :precision binary64 (/ 0.0 a))
    double code(double a, double b, double c) {
    	return 0.0 / a;
    }
    
    real(8) function code(a, b, c)
        real(8), intent (in) :: a
        real(8), intent (in) :: b
        real(8), intent (in) :: c
        code = 0.0d0 / a
    end function
    
    public static double code(double a, double b, double c) {
    	return 0.0 / a;
    }
    
    def code(a, b, c):
    	return 0.0 / a
    
    function code(a, b, c)
    	return Float64(0.0 / a)
    end
    
    function tmp = code(a, b, c)
    	tmp = 0.0 / a;
    end
    
    code[a_, b_, c_] := N[(0.0 / a), $MachinePrecision]
    
    \begin{array}{l}
    
    \\
    \frac{0}{a}
    \end{array}
    
    Derivation
    1. Initial program 52.9%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
    2. Step-by-step derivation
      1. clear-num52.8%

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

        \[\leadsto \color{blue}{{\left(\frac{2 \cdot a}{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\right)}^{-1}} \]
      3. *-commutative52.8%

        \[\leadsto {\left(\frac{\color{blue}{a \cdot 2}}{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\right)}^{-1} \]
      4. neg-mul-152.8%

        \[\leadsto {\left(\frac{a \cdot 2}{\color{blue}{-1 \cdot b} + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\right)}^{-1} \]
      5. fma-def52.8%

        \[\leadsto {\left(\frac{a \cdot 2}{\color{blue}{\mathsf{fma}\left(-1, b, \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}\right)}^{-1} \]
      6. *-commutative52.8%

        \[\leadsto {\left(\frac{a \cdot 2}{\mathsf{fma}\left(-1, b, \sqrt{b \cdot b - \color{blue}{c \cdot \left(4 \cdot a\right)}}\right)}\right)}^{-1} \]
      7. *-commutative52.8%

        \[\leadsto {\left(\frac{a \cdot 2}{\mathsf{fma}\left(-1, b, \sqrt{b \cdot b - c \cdot \color{blue}{\left(a \cdot 4\right)}}\right)}\right)}^{-1} \]
    3. Applied egg-rr52.8%

      \[\leadsto \color{blue}{{\left(\frac{a \cdot 2}{\mathsf{fma}\left(-1, b, \sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)}\right)}\right)}^{-1}} \]
    4. Taylor expanded in a around 0 11.7%

      \[\leadsto \color{blue}{0.5 \cdot \frac{b + -1 \cdot b}{a}} \]
    5. Step-by-step derivation
      1. associate-*r/11.7%

        \[\leadsto \color{blue}{\frac{0.5 \cdot \left(b + -1 \cdot b\right)}{a}} \]
      2. distribute-rgt1-in11.7%

        \[\leadsto \frac{0.5 \cdot \color{blue}{\left(\left(-1 + 1\right) \cdot b\right)}}{a} \]
      3. metadata-eval11.7%

        \[\leadsto \frac{0.5 \cdot \left(\color{blue}{0} \cdot b\right)}{a} \]
      4. mul0-lft11.7%

        \[\leadsto \frac{0.5 \cdot \color{blue}{0}}{a} \]
      5. metadata-eval11.7%

        \[\leadsto \frac{\color{blue}{0}}{a} \]
    6. Simplified11.7%

      \[\leadsto \color{blue}{\frac{0}{a}} \]
    7. Final simplification11.7%

      \[\leadsto \frac{0}{a} \]

    Reproduce

    ?
    herbie shell --seed 2023200 
    (FPCore (a b c)
      :name "Quadratic roots, full range"
      :precision binary64
      (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))