Quadratic roots, full range

Percentage Accurate: 52.2% → 88.8%
Time: 9.8s
Alternatives: 8
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 8 alternatives:

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

Initial Program: 52.2% 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: 88.8% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -1 \cdot 10^{+151}:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{elif}\;b \leq 4.2 \cdot 10^{-277}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - \left(a \cdot 4\right) \cdot c} - b}{a \cdot 2}\\ \mathbf{elif}\;b \leq 0.045:\\ \;\;\;\;\frac{c \cdot -2}{b + \mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -4\right)}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b -1e+151)
   (/ (- b) a)
   (if (<= b 4.2e-277)
     (/ (- (sqrt (- (* b b) (* (* a 4.0) c))) b) (* a 2.0))
     (if (<= b 0.045)
       (/ (* c -2.0) (+ b (hypot b (sqrt (* a (* c -4.0))))))
       (/ (- c) b)))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= -1e+151) {
		tmp = -b / a;
	} else if (b <= 4.2e-277) {
		tmp = (sqrt(((b * b) - ((a * 4.0) * c))) - b) / (a * 2.0);
	} else if (b <= 0.045) {
		tmp = (c * -2.0) / (b + hypot(b, sqrt((a * (c * -4.0)))));
	} else {
		tmp = -c / b;
	}
	return tmp;
}
public static double code(double a, double b, double c) {
	double tmp;
	if (b <= -1e+151) {
		tmp = -b / a;
	} else if (b <= 4.2e-277) {
		tmp = (Math.sqrt(((b * b) - ((a * 4.0) * c))) - b) / (a * 2.0);
	} else if (b <= 0.045) {
		tmp = (c * -2.0) / (b + Math.hypot(b, Math.sqrt((a * (c * -4.0)))));
	} else {
		tmp = -c / b;
	}
	return tmp;
}
def code(a, b, c):
	tmp = 0
	if b <= -1e+151:
		tmp = -b / a
	elif b <= 4.2e-277:
		tmp = (math.sqrt(((b * b) - ((a * 4.0) * c))) - b) / (a * 2.0)
	elif b <= 0.045:
		tmp = (c * -2.0) / (b + math.hypot(b, math.sqrt((a * (c * -4.0)))))
	else:
		tmp = -c / b
	return tmp
function code(a, b, c)
	tmp = 0.0
	if (b <= -1e+151)
		tmp = Float64(Float64(-b) / a);
	elseif (b <= 4.2e-277)
		tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(Float64(a * 4.0) * c))) - b) / Float64(a * 2.0));
	elseif (b <= 0.045)
		tmp = Float64(Float64(c * -2.0) / Float64(b + hypot(b, sqrt(Float64(a * Float64(c * -4.0))))));
	else
		tmp = Float64(Float64(-c) / b);
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	tmp = 0.0;
	if (b <= -1e+151)
		tmp = -b / a;
	elseif (b <= 4.2e-277)
		tmp = (sqrt(((b * b) - ((a * 4.0) * c))) - b) / (a * 2.0);
	elseif (b <= 0.045)
		tmp = (c * -2.0) / (b + hypot(b, sqrt((a * (c * -4.0)))));
	else
		tmp = -c / b;
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := If[LessEqual[b, -1e+151], N[((-b) / a), $MachinePrecision], If[LessEqual[b, 4.2e-277], 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], If[LessEqual[b, 0.045], N[(N[(c * -2.0), $MachinePrecision] / N[(b + N[Sqrt[b ^ 2 + N[Sqrt[N[(a * N[(c * -4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-c) / b), $MachinePrecision]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;b \leq 0.045:\\
\;\;\;\;\frac{c \cdot -2}{b + \mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -4\right)}\right)}\\

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


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

    1. Initial program 39.7%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
    2. Taylor expanded in b around -inf 100.0%

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

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

        \[\leadsto \frac{\color{blue}{-b}}{a} \]
    4. Simplified100.0%

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

    if -1.00000000000000002e151 < b < 4.1999999999999999e-277

    1. Initial program 91.0%

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

    if 4.1999999999999999e-277 < b < 0.044999999999999998

    1. Initial program 70.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. frac-2neg70.5%

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

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

      \[\leadsto \color{blue}{\left(b - \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -4\right)}\right)\right) \cdot \frac{1}{a \cdot -2}} \]
    4. Step-by-step derivation
      1. associate-*r*70.4%

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

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

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

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

        \[\leadsto \left(b - \mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -4\right)}\right)\right) \cdot \color{blue}{\frac{\frac{1}{-2}}{a}} \]
      6. metadata-eval70.5%

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

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

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

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

        \[\leadsto \frac{b \cdot b - \sqrt{b \cdot b + \sqrt{a \cdot \left(c \cdot -4\right)} \cdot \sqrt{a \cdot \left(c \cdot -4\right)}} \cdot \color{blue}{\sqrt{b \cdot b + \sqrt{a \cdot \left(c \cdot -4\right)} \cdot \sqrt{a \cdot \left(c \cdot -4\right)}}}}{b + \mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -4\right)}\right)} \cdot \frac{-0.5}{a} \]
      4. add-sqr-sqrt70.3%

        \[\leadsto \frac{b \cdot b - \color{blue}{\left(b \cdot b + \sqrt{a \cdot \left(c \cdot -4\right)} \cdot \sqrt{a \cdot \left(c \cdot -4\right)}\right)}}{b + \mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -4\right)}\right)} \cdot \frac{-0.5}{a} \]
      5. add-sqr-sqrt70.2%

        \[\leadsto \frac{b \cdot b - \left(b \cdot b + \color{blue}{a \cdot \left(c \cdot -4\right)}\right)}{b + \mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -4\right)}\right)} \cdot \frac{-0.5}{a} \]
    7. Applied egg-rr70.2%

      \[\leadsto \color{blue}{\frac{b \cdot b - \left(b \cdot b + a \cdot \left(c \cdot -4\right)\right)}{b + \mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -4\right)}\right)}} \cdot \frac{-0.5}{a} \]
    8. Step-by-step derivation
      1. associate--r+81.2%

        \[\leadsto \frac{\color{blue}{\left(b \cdot b - b \cdot b\right) - a \cdot \left(c \cdot -4\right)}}{b + \mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -4\right)}\right)} \cdot \frac{-0.5}{a} \]
      2. +-inverses81.2%

        \[\leadsto \frac{\color{blue}{0} - a \cdot \left(c \cdot -4\right)}{b + \mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -4\right)}\right)} \cdot \frac{-0.5}{a} \]
    9. Simplified81.2%

      \[\leadsto \color{blue}{\frac{0 - a \cdot \left(c \cdot -4\right)}{b + \mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -4\right)}\right)}} \cdot \frac{-0.5}{a} \]
    10. Step-by-step derivation
      1. associate-*l/81.3%

        \[\leadsto \color{blue}{\frac{\left(0 - a \cdot \left(c \cdot -4\right)\right) \cdot \frac{-0.5}{a}}{b + \mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -4\right)}\right)}} \]
      2. sub0-neg81.3%

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

      \[\leadsto \color{blue}{\frac{\left(-a \cdot \left(c \cdot -4\right)\right) \cdot \frac{-0.5}{a}}{b + \mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -4\right)}\right)}} \]
    12. Taylor expanded in a around 0 93.7%

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

    if 0.044999999999999998 < b

    1. Initial program 15.3%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
    2. Taylor expanded in b around inf 89.3%

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

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

        \[\leadsto \frac{\color{blue}{-c}}{b} \]
    4. Simplified89.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -1 \cdot 10^{+151}:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{elif}\;b \leq 4.2 \cdot 10^{-277}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - \left(a \cdot 4\right) \cdot c} - b}{a \cdot 2}\\ \mathbf{elif}\;b \leq 0.045:\\ \;\;\;\;\frac{c \cdot -2}{b + \mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -4\right)}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \]

Alternative 2: 86.1% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 39.7%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
    2. Taylor expanded in b around -inf 100.0%

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

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

        \[\leadsto \frac{\color{blue}{-b}}{a} \]
    4. Simplified100.0%

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

    if -1e148 < b < 2.50000000000000006e-47

    1. Initial program 88.9%

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

    if 2.50000000000000006e-47 < b

    1. Initial program 18.6%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
    2. Taylor expanded in b around inf 85.0%

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

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

        \[\leadsto \frac{\color{blue}{-c}}{b} \]
    4. Simplified85.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -1 \cdot 10^{+148}:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{elif}\;b \leq 2.5 \cdot 10^{-47}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - \left(a \cdot 4\right) \cdot c} - b}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \]

Alternative 3: 80.0% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;b \leq 1.15 \cdot 10^{-46}:\\
\;\;\;\;0.5 \cdot \left(\sqrt{a \cdot \left(c \cdot -4\right)} \cdot \frac{1}{a}\right)\\

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


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

    1. Initial program 74.0%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
    2. Taylor expanded in b around -inf 83.1%

      \[\leadsto \color{blue}{-1 \cdot \frac{b}{a} + \frac{c}{b}} \]
    3. Step-by-step derivation
      1. +-commutative83.1%

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

        \[\leadsto \frac{c}{b} + \color{blue}{\left(-\frac{b}{a}\right)} \]
      3. unsub-neg83.1%

        \[\leadsto \color{blue}{\frac{c}{b} - \frac{b}{a}} \]
    4. Simplified83.1%

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

    if -5.99999999999999985e-145 < b < 1.15e-46

    1. Initial program 82.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. prod-diff82.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{0.5 \cdot \left(\frac{1}{a} \cdot \sqrt{-8 \cdot \left(a \cdot c\right) + 4 \cdot \left(a \cdot c\right)}\right)} \]
    5. Step-by-step derivation
      1. distribute-rgt-out80.4%

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

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

        \[\leadsto 0.5 \cdot \left(\frac{1}{a} \cdot \sqrt{\color{blue}{a \cdot \left(c \cdot -4\right)}}\right) \]
      4. *-commutative80.4%

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

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

    if 1.15e-46 < b

    1. Initial program 18.6%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
    2. Taylor expanded in b around inf 85.0%

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

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

        \[\leadsto \frac{\color{blue}{-c}}{b} \]
    4. Simplified85.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -6 \cdot 10^{-145}:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \mathbf{elif}\;b \leq 1.15 \cdot 10^{-46}:\\ \;\;\;\;0.5 \cdot \left(\sqrt{a \cdot \left(c \cdot -4\right)} \cdot \frac{1}{a}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \]

Alternative 4: 80.0% accurate, 1.0× speedup?

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

\mathbf{elif}\;b \leq 1.85 \cdot 10^{-47}:\\
\;\;\;\;\frac{\sqrt{a \cdot \left(c \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 < -0.149999999999999994

    1. Initial program 66.8%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
    2. Taylor expanded in b around -inf 96.1%

      \[\leadsto \color{blue}{-1 \cdot \frac{b}{a} + \frac{c}{b}} \]
    3. Step-by-step derivation
      1. +-commutative96.1%

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

        \[\leadsto \frac{c}{b} + \color{blue}{\left(-\frac{b}{a}\right)} \]
      3. unsub-neg96.1%

        \[\leadsto \color{blue}{\frac{c}{b} - \frac{b}{a}} \]
    4. Simplified96.1%

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

    if -0.149999999999999994 < b < 1.85e-47

    1. Initial program 85.7%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b + \mathsf{fma}\left(c, a \cdot -4, \mathsf{fma}\left(-c, 4 \cdot a, \color{blue}{\left(4 \cdot a\right) \cdot c}\right)\right)}}{2 \cdot a} \]
      12. fma-udef85.5%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b + \mathsf{fma}\left(c, a \cdot -4, \color{blue}{\left(-c\right) \cdot \left(4 \cdot a\right) + \left(4 \cdot a\right) \cdot c}\right)}}{2 \cdot a} \]
      13. distribute-lft-neg-in85.5%

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\sqrt{-8 \cdot \left(a \cdot c\right) + 4 \cdot \left(a \cdot c\right)} - b}}{2 \cdot a} \]
      3. distribute-rgt-out71.5%

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

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

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

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

    if 1.85e-47 < b

    1. Initial program 18.6%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
    2. Taylor expanded in b around inf 85.0%

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

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

        \[\leadsto \frac{\color{blue}{-c}}{b} \]
    4. Simplified85.0%

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

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

Alternative 5: 80.0% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 74.0%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
    2. Taylor expanded in b around -inf 83.1%

      \[\leadsto \color{blue}{-1 \cdot \frac{b}{a} + \frac{c}{b}} \]
    3. Step-by-step derivation
      1. +-commutative83.1%

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

        \[\leadsto \frac{c}{b} + \color{blue}{\left(-\frac{b}{a}\right)} \]
      3. unsub-neg83.1%

        \[\leadsto \color{blue}{\frac{c}{b} - \frac{b}{a}} \]
    4. Simplified83.1%

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

    if -5.99999999999999985e-145 < b < 1.7000000000000001e-47

    1. Initial program 82.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. prod-diff82.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{0.5 \cdot \left(\frac{1}{a} \cdot \sqrt{-8 \cdot \left(a \cdot c\right) + 4 \cdot \left(a \cdot c\right)}\right)} \]
    5. Step-by-step derivation
      1. associate-*l/80.1%

        \[\leadsto 0.5 \cdot \color{blue}{\frac{1 \cdot \sqrt{-8 \cdot \left(a \cdot c\right) + 4 \cdot \left(a \cdot c\right)}}{a}} \]
      2. distribute-rgt-out80.3%

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

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

        \[\leadsto 0.5 \cdot \frac{1 \cdot \sqrt{\color{blue}{a \cdot \left(c \cdot -4\right)}}}{a} \]
      5. *-lft-identity80.3%

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

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

    if 1.7000000000000001e-47 < b

    1. Initial program 18.6%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
    2. Taylor expanded in b around inf 85.0%

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

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

        \[\leadsto \frac{\color{blue}{-c}}{b} \]
    4. Simplified85.0%

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

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

Alternative 6: 68.5% accurate, 12.8× speedup?

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

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

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


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

    1. Initial program 75.0%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
    2. Taylor expanded in b around -inf 70.0%

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

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

        \[\leadsto \frac{c}{b} + \color{blue}{\left(-\frac{b}{a}\right)} \]
      3. unsub-neg70.0%

        \[\leadsto \color{blue}{\frac{c}{b} - \frac{b}{a}} \]
    4. Simplified70.0%

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

    if -4.999999999999985e-310 < b

    1. Initial program 36.9%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
    2. Taylor expanded in b around inf 66.1%

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

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

        \[\leadsto \frac{\color{blue}{-c}}{b} \]
    4. Simplified66.1%

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

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

Alternative 7: 68.3% accurate, 19.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq 4.2 \cdot 10^{-277}:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b 4.2e-277) (/ (- b) a) (/ (- c) b)))
double code(double a, double b, double c) {
	double tmp;
	if (b <= 4.2e-277) {
		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 <= 4.2d-277) 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 <= 4.2e-277) {
		tmp = -b / a;
	} else {
		tmp = -c / b;
	}
	return tmp;
}
def code(a, b, c):
	tmp = 0
	if b <= 4.2e-277:
		tmp = -b / a
	else:
		tmp = -c / b
	return tmp
function code(a, b, c)
	tmp = 0.0
	if (b <= 4.2e-277)
		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 <= 4.2e-277)
		tmp = -b / a;
	else
		tmp = -c / b;
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := If[LessEqual[b, 4.2e-277], N[((-b) / a), $MachinePrecision], N[((-c) / b), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq 4.2 \cdot 10^{-277}:\\
\;\;\;\;\frac{-b}{a}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < 4.1999999999999999e-277

    1. Initial program 75.4%

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

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

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

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

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

    if 4.1999999999999999e-277 < b

    1. Initial program 36.0%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
    2. Taylor expanded in b around inf 67.0%

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

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

        \[\leadsto \frac{\color{blue}{-c}}{b} \]
    4. Simplified67.0%

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

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

Alternative 8: 35.0% accurate, 29.0× speedup?

\[\begin{array}{l} \\ \frac{-b}{a} \end{array} \]
(FPCore (a b c) :precision binary64 (/ (- b) a))
double code(double a, double b, double c) {
	return -b / 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 / a
end function
public static double code(double a, double b, double c) {
	return -b / a;
}
def code(a, b, c):
	return -b / a
function code(a, b, c)
	return Float64(Float64(-b) / a)
end
function tmp = code(a, b, c)
	tmp = -b / a;
end
code[a_, b_, c_] := N[((-b) / a), $MachinePrecision]
\begin{array}{l}

\\
\frac{-b}{a}
\end{array}
Derivation
  1. Initial program 55.2%

    \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
  2. Taylor expanded in b around -inf 34.8%

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

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

      \[\leadsto \frac{\color{blue}{-b}}{a} \]
  4. Simplified34.8%

    \[\leadsto \color{blue}{\frac{-b}{a}} \]
  5. Final simplification34.8%

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

Reproduce

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