The quadratic formula (r2)

Percentage Accurate: 52.4% → 80.5%
Time: 12.2s
Alternatives: 8
Speedup: 19.1×

Specification

?
\[\begin{array}{l} \\ \frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{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(4.0 * Float64(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[(4.0 * N[(a * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

\[\begin{array}{l} \\ \frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{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(4.0 * Float64(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[(4.0 * N[(a * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

Alternative 1: 80.5% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -150000000:\\ \;\;\;\;\frac{-c}{b} - {\left(\frac{{\left(\sqrt[3]{c}\right)}^{2}}{b}\right)}^{3} \cdot a\\ \mathbf{elif}\;b \leq 2 \cdot 10^{-90}:\\ \;\;\;\;-0.5 \cdot \frac{1}{a \cdot \frac{1}{b + \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -4\right)}\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{-b}{a}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b -150000000.0)
   (- (/ (- c) b) (* (pow (/ (pow (cbrt c) 2.0) b) 3.0) a))
   (if (<= b 2e-90)
     (* -0.5 (/ 1.0 (* a (/ 1.0 (+ b (hypot b (sqrt (* c (* a -4.0)))))))))
     (/ (- b) a))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= -150000000.0) {
		tmp = (-c / b) - (pow((pow(cbrt(c), 2.0) / b), 3.0) * a);
	} else if (b <= 2e-90) {
		tmp = -0.5 * (1.0 / (a * (1.0 / (b + hypot(b, sqrt((c * (a * -4.0))))))));
	} else {
		tmp = -b / a;
	}
	return tmp;
}
public static double code(double a, double b, double c) {
	double tmp;
	if (b <= -150000000.0) {
		tmp = (-c / b) - (Math.pow((Math.pow(Math.cbrt(c), 2.0) / b), 3.0) * a);
	} else if (b <= 2e-90) {
		tmp = -0.5 * (1.0 / (a * (1.0 / (b + Math.hypot(b, Math.sqrt((c * (a * -4.0))))))));
	} else {
		tmp = -b / a;
	}
	return tmp;
}
function code(a, b, c)
	tmp = 0.0
	if (b <= -150000000.0)
		tmp = Float64(Float64(Float64(-c) / b) - Float64((Float64((cbrt(c) ^ 2.0) / b) ^ 3.0) * a));
	elseif (b <= 2e-90)
		tmp = Float64(-0.5 * Float64(1.0 / Float64(a * Float64(1.0 / Float64(b + hypot(b, sqrt(Float64(c * Float64(a * -4.0)))))))));
	else
		tmp = Float64(Float64(-b) / a);
	end
	return tmp
end
code[a_, b_, c_] := If[LessEqual[b, -150000000.0], N[(N[((-c) / b), $MachinePrecision] - N[(N[Power[N[(N[Power[N[Power[c, 1/3], $MachinePrecision], 2.0], $MachinePrecision] / b), $MachinePrecision], 3.0], $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 2e-90], N[(-0.5 * N[(1.0 / N[(a * N[(1.0 / N[(b + N[Sqrt[b ^ 2 + N[Sqrt[N[(c * N[(a * -4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-b) / a), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq -150000000:\\
\;\;\;\;\frac{-c}{b} - {\left(\frac{{\left(\sqrt[3]{c}\right)}^{2}}{b}\right)}^{3} \cdot a\\

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

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


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

    1. Initial program 13.9%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{-c}{b} - \frac{\color{blue}{c \cdot c}}{\frac{{b}^{3}}{a}} \]
    4. Simplified81.8%

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

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

        \[\leadsto \frac{-c}{b} - \color{blue}{{\left(\sqrt[3]{\frac{c \cdot c}{\frac{{b}^{3}}{a}}}\right)}^{2}} \cdot \sqrt[3]{\frac{c \cdot c}{\frac{{b}^{3}}{a}}} \]
      3. cbrt-div81.8%

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

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

        \[\leadsto \frac{-c}{b} - {\left(\frac{\color{blue}{{\left(\sqrt[3]{c}\right)}^{2}}}{\sqrt[3]{\frac{{b}^{3}}{a}}}\right)}^{2} \cdot \sqrt[3]{\frac{c \cdot c}{\frac{{b}^{3}}{a}}} \]
      6. cbrt-div81.8%

        \[\leadsto \frac{-c}{b} - {\left(\frac{{\left(\sqrt[3]{c}\right)}^{2}}{\color{blue}{\frac{\sqrt[3]{{b}^{3}}}{\sqrt[3]{a}}}}\right)}^{2} \cdot \sqrt[3]{\frac{c \cdot c}{\frac{{b}^{3}}{a}}} \]
      7. rem-cbrt-cube81.8%

        \[\leadsto \frac{-c}{b} - {\left(\frac{{\left(\sqrt[3]{c}\right)}^{2}}{\frac{\color{blue}{b}}{\sqrt[3]{a}}}\right)}^{2} \cdot \sqrt[3]{\frac{c \cdot c}{\frac{{b}^{3}}{a}}} \]
      8. cbrt-div81.8%

        \[\leadsto \frac{-c}{b} - {\left(\frac{{\left(\sqrt[3]{c}\right)}^{2}}{\frac{b}{\sqrt[3]{a}}}\right)}^{2} \cdot \color{blue}{\frac{\sqrt[3]{c \cdot c}}{\sqrt[3]{\frac{{b}^{3}}{a}}}} \]
      9. cbrt-prod94.0%

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

        \[\leadsto \frac{-c}{b} - {\left(\frac{{\left(\sqrt[3]{c}\right)}^{2}}{\frac{b}{\sqrt[3]{a}}}\right)}^{2} \cdot \frac{\color{blue}{{\left(\sqrt[3]{c}\right)}^{2}}}{\sqrt[3]{\frac{{b}^{3}}{a}}} \]
      11. cbrt-div94.0%

        \[\leadsto \frac{-c}{b} - {\left(\frac{{\left(\sqrt[3]{c}\right)}^{2}}{\frac{b}{\sqrt[3]{a}}}\right)}^{2} \cdot \frac{{\left(\sqrt[3]{c}\right)}^{2}}{\color{blue}{\frac{\sqrt[3]{{b}^{3}}}{\sqrt[3]{a}}}} \]
      12. rem-cbrt-cube94.0%

        \[\leadsto \frac{-c}{b} - {\left(\frac{{\left(\sqrt[3]{c}\right)}^{2}}{\frac{b}{\sqrt[3]{a}}}\right)}^{2} \cdot \frac{{\left(\sqrt[3]{c}\right)}^{2}}{\frac{\color{blue}{b}}{\sqrt[3]{a}}} \]
    6. Applied egg-rr94.0%

      \[\leadsto \frac{-c}{b} - \color{blue}{{\left(\frac{{\left(\sqrt[3]{c}\right)}^{2}}{\frac{b}{\sqrt[3]{a}}}\right)}^{2} \cdot \frac{{\left(\sqrt[3]{c}\right)}^{2}}{\frac{b}{\sqrt[3]{a}}}} \]
    7. Step-by-step derivation
      1. pow-plus94.0%

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

        \[\leadsto \frac{-c}{b} - {\left(\frac{{\left(\sqrt[3]{c}\right)}^{2}}{\frac{b}{\sqrt[3]{a}}}\right)}^{\color{blue}{3}} \]
      3. associate-/r/94.0%

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

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

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

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

    if -1.5e8 < b < 1.99999999999999999e-90

    1. Initial program 67.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -0.5 \cdot \color{blue}{\left(-1 \cdot \frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{a}\right)} \]
      16. div-sub67.7%

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

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

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

        \[\leadsto -0.5 \cdot \color{blue}{{\left(\frac{a}{b + \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)}}\right)}^{-1}} \]
    5. Applied egg-rr67.6%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -0.5 \cdot \frac{1}{a \cdot \frac{1}{b + \sqrt{\color{blue}{b \cdot b + c \cdot \left(a \cdot -4\right)}}}} \]
      3. add-sqr-sqrt67.6%

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

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

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

    if 1.99999999999999999e-90 < b

    1. Initial program 59.1%

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

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

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

        \[\leadsto \frac{\color{blue}{-b}}{a} \]
    4. Simplified88.9%

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

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

Alternative 2: 80.9% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq -64000:\\
\;\;\;\;\frac{-c}{b}\\

\mathbf{elif}\;b \leq 2.2 \cdot 10^{-90}:\\
\;\;\;\;-0.5 \cdot \frac{1}{a \cdot \frac{1}{b + \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -4\right)}\right)}}\\

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


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

    1. Initial program 13.8%

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

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

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

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

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

    if -64000 < b < 2.19999999999999986e-90

    1. Initial program 68.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -0.5 \cdot \color{blue}{\left(-1 \cdot \frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{a}\right)} \]
      16. div-sub68.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -0.5 \cdot \frac{1}{a \cdot \frac{1}{b + \sqrt{b \cdot b + \color{blue}{\sqrt{c \cdot \left(a \cdot -4\right)} \cdot \sqrt{c \cdot \left(a \cdot -4\right)}}}}} \]
      4. hypot-def70.0%

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

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

    if 2.19999999999999986e-90 < b

    1. Initial program 59.1%

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

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

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

        \[\leadsto \frac{\color{blue}{-b}}{a} \]
    4. Simplified88.9%

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

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

Alternative 3: 82.2% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq -440000:\\
\;\;\;\;\frac{-c}{b}\\

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

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


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

    1. Initial program 13.8%

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

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

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

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

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

    if -4.4e5 < b < 3.9999999999999997e-40

    1. Initial program 71.6%

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

    if 3.9999999999999997e-40 < b

    1. Initial program 53.6%

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

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

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

        \[\leadsto \frac{\color{blue}{-b}}{a} \]
    4. Simplified88.7%

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

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

Alternative 4: 79.2% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq -85000:\\
\;\;\;\;\frac{-c}{b}\\

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

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


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

    1. Initial program 13.8%

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

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

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

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

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

    if -85000 < b < 5.2000000000000003e-96

    1. Initial program 68.4%

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

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

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

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

    if 5.2000000000000003e-96 < b

    1. Initial program 59.1%

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

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

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

        \[\leadsto \frac{\color{blue}{-b}}{a} \]
    4. Simplified88.9%

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

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

Alternative 5: 66.7% accurate, 6.8× speedup?

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

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

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


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

    1. Initial program 36.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -0.5 \cdot \color{blue}{\left(-1 \cdot \frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{a}\right)} \]
      16. div-sub36.4%

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

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

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

        \[\leadsto -0.5 \cdot \color{blue}{{\left(\frac{a}{b + \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)}}\right)}^{-1}} \]
    5. Applied egg-rr36.7%

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

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

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

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

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

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

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

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

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

      \[\leadsto -0.5 \cdot \frac{1}{\color{blue}{0.5 \cdot \frac{b}{c} + -0.5 \cdot \frac{a}{b}}} \]

    if -4.999999999999985e-310 < b

    1. Initial program 61.7%

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

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

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

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

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

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

Alternative 6: 67.0% accurate, 12.8× speedup?

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

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

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


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

    1. Initial program 36.7%

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

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

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

        \[\leadsto \frac{\color{blue}{-c}}{b} \]
    4. Simplified64.6%

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

    if -4.999999999999985e-310 < b

    1. Initial program 61.7%

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

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

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

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

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

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

Alternative 7: 66.8% accurate, 19.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq -5.4 \cdot 10^{-305}:\\
\;\;\;\;\frac{-c}{b}\\

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


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

    1. Initial program 36.3%

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

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

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

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

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

    if -5.3999999999999998e-305 < b

    1. Initial program 62.0%

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

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

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

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

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

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

Alternative 8: 34.9% 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 47.8%

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

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

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

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

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

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

Developer target: 70.2% accurate, 1.0× speedup?

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

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

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


\end{array}
\end{array}

Reproduce

?
herbie shell --seed 2023178 
(FPCore (a b c)
  :name "The quadratic formula (r2)"
  :precision binary64

  :herbie-target
  (if (< b 0.0) (/ c (* a (/ (+ (- b) (sqrt (- (* b b) (* 4.0 (* a c))))) (* 2.0 a)))) (/ (- (- b) (sqrt (- (* b b) (* 4.0 (* a c))))) (* 2.0 a)))

  (/ (- (- b) (sqrt (- (* b b) (* 4.0 (* a c))))) (* 2.0 a)))