The quadratic formula (r1)

Percentage Accurate: 53.2% → 85.4%
Time: 15.4s
Alternatives: 8
Speedup: 12.9×

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: 53.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: 85.4% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -6 \cdot 10^{+153}:\\ \;\;\;\;\frac{b}{-a}\\ \mathbf{elif}\;b \leq 4.2 \cdot 10^{-57}:\\ \;\;\;\;\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 -6e+153)
   (/ b (- a))
   (if (<= b 4.2e-57)
     (/ (- (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 <= -6e+153) {
		tmp = b / -a;
	} else if (b <= 4.2e-57) {
		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 <= (-6d+153)) then
        tmp = b / -a
    else if (b <= 4.2d-57) 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 <= -6e+153) {
		tmp = b / -a;
	} else if (b <= 4.2e-57) {
		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 <= -6e+153:
		tmp = b / -a
	elif b <= 4.2e-57:
		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 <= -6e+153)
		tmp = Float64(b / Float64(-a));
	elseif (b <= 4.2e-57)
		tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(Float64(a * 4.0) * c))) - b) / Float64(a * 2.0));
	else
		tmp = Float64(c / Float64(-b));
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	tmp = 0.0;
	if (b <= -6e+153)
		tmp = b / -a;
	elseif (b <= 4.2e-57)
		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, -6e+153], N[(b / (-a)), $MachinePrecision], If[LessEqual[b, 4.2e-57], 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 -6 \cdot 10^{+153}:\\
\;\;\;\;\frac{b}{-a}\\

\mathbf{elif}\;b \leq 4.2 \cdot 10^{-57}:\\
\;\;\;\;\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 < -6.00000000000000037e153

    1. Initial program 46.6%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - c \cdot \color{blue}{\left(\sqrt{a \cdot -4} \cdot \sqrt{a \cdot -4}\right)}}}{a \cdot 2} \]
      11. add-sqr-sqrt45.9%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - c \cdot \color{blue}{\left(a \cdot -4\right)}}}{a \cdot 2} \]
      12. add-cube-cbrt45.9%

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

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

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{{\left(\sqrt[3]{\left(c \cdot 4\right) \cdot a}\right)}^{3}}}}{a \cdot 2} \]
    7. Taylor expanded in b around -inf 91.6%

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

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

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

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

    if -6.00000000000000037e153 < b < 4.1999999999999999e-57

    1. Initial program 86.3%

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

    if 4.1999999999999999e-57 < b

    1. Initial program 8.6%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - c \cdot \sqrt{\left(a \cdot a\right) \cdot \color{blue}{\left(-4 \cdot -4\right)}}}}{a \cdot 2} \]
      9. swap-sqr6.7%

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - c \cdot \color{blue}{\left(\sqrt{a \cdot -4} \cdot \sqrt{a \cdot -4}\right)}}}{a \cdot 2} \]
      11. add-sqr-sqrt5.9%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - c \cdot \color{blue}{\left(a \cdot -4\right)}}}{a \cdot 2} \]
      12. add-cube-cbrt5.9%

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{-c}}{b} \]
    10. Simplified93.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -6 \cdot 10^{+153}:\\ \;\;\;\;\frac{b}{-a}\\ \mathbf{elif}\;b \leq 4.2 \cdot 10^{-57}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - \left(a \cdot 4\right) \cdot c} - b}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{-b}\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 80.0% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -5.8 \cdot 10^{-127}:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \mathbf{elif}\;b \leq 5.2 \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 -5.8e-127)
   (- (/ c b) (/ b a))
   (if (<= b 5.2e-47)
     (/ (- (sqrt (* a (* c -4.0))) b) (* a 2.0))
     (/ c (- b)))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= -5.8e-127) {
		tmp = (c / b) - (b / a);
	} else if (b <= 5.2e-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 <= (-5.8d-127)) then
        tmp = (c / b) - (b / a)
    else if (b <= 5.2d-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 <= -5.8e-127) {
		tmp = (c / b) - (b / a);
	} else if (b <= 5.2e-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 <= -5.8e-127:
		tmp = (c / b) - (b / a)
	elif b <= 5.2e-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 <= -5.8e-127)
		tmp = Float64(Float64(c / b) - Float64(b / a));
	elseif (b <= 5.2e-47)
		tmp = Float64(Float64(sqrt(Float64(a * Float64(c * -4.0))) - b) / Float64(a * 2.0));
	else
		tmp = Float64(c / Float64(-b));
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	tmp = 0.0;
	if (b <= -5.8e-127)
		tmp = (c / b) - (b / a);
	elseif (b <= 5.2e-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, -5.8e-127], N[(N[(c / b), $MachinePrecision] - N[(b / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 5.2e-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 -5.8 \cdot 10^{-127}:\\
\;\;\;\;\frac{c}{b} - \frac{b}{a}\\

\mathbf{elif}\;b \leq 5.2 \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 < -5.8000000000000001e-127

    1. Initial program 80.1%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - c \cdot \color{blue}{\left(\sqrt{a \cdot -4} \cdot \sqrt{a \cdot -4}\right)}}}{a \cdot 2} \]
      11. add-sqr-sqrt64.9%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - c \cdot \color{blue}{\left(a \cdot -4\right)}}}{a \cdot 2} \]
      12. add-cube-cbrt64.9%

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

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

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{{\left(\sqrt[3]{\left(c \cdot 4\right) \cdot a}\right)}^{3}}}}{a \cdot 2} \]
    7. Applied egg-rr79.9%

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

      \[\leadsto \color{blue}{-1 \cdot \left(b \cdot \left(-1 \cdot \frac{c}{{b}^{2}} + \frac{1}{a}\right)\right)} \]
    9. Step-by-step derivation
      1. mul-1-neg81.4%

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

        \[\leadsto -\color{blue}{\left(-1 \cdot \frac{c}{{b}^{2}} + \frac{1}{a}\right) \cdot b} \]
      3. distribute-rgt-neg-in81.4%

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

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

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

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

      \[\leadsto \color{blue}{\left(\frac{1}{a} - \frac{c}{{b}^{2}}\right) \cdot \left(-b\right)} \]
    11. Taylor expanded in a around 0 79.5%

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

        \[\leadsto \frac{\color{blue}{\frac{a \cdot c}{b} + -1 \cdot b}}{a} \]
      2. *-commutative79.5%

        \[\leadsto \frac{\frac{\color{blue}{c \cdot a}}{b} + -1 \cdot b}{a} \]
      3. associate-*r/81.6%

        \[\leadsto \frac{\color{blue}{c \cdot \frac{a}{b}} + -1 \cdot b}{a} \]
      4. mul-1-neg81.6%

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

        \[\leadsto \frac{\color{blue}{c \cdot \frac{a}{b} - b}}{a} \]
      6. div-sub81.6%

        \[\leadsto \color{blue}{\frac{c \cdot \frac{a}{b}}{a} - \frac{b}{a}} \]
      7. associate-/l*81.6%

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

        \[\leadsto c \cdot \color{blue}{\frac{a}{a \cdot b}} - \frac{b}{a} \]
      9. associate-/r*81.7%

        \[\leadsto c \cdot \color{blue}{\frac{\frac{a}{a}}{b}} - \frac{b}{a} \]
      10. *-inverses81.7%

        \[\leadsto c \cdot \frac{\color{blue}{1}}{b} - \frac{b}{a} \]
      11. associate-*r/81.7%

        \[\leadsto \color{blue}{\frac{c \cdot 1}{b}} - \frac{b}{a} \]
      12. *-rgt-identity81.7%

        \[\leadsto \frac{\color{blue}{c}}{b} - \frac{b}{a} \]
    13. Simplified81.7%

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

    if -5.8000000000000001e-127 < b < 5.2e-47

    1. Initial program 75.6%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - c \cdot \color{blue}{\left(\sqrt{a \cdot -4} \cdot \sqrt{a \cdot -4}\right)}}}{a \cdot 2} \]
      11. add-sqr-sqrt2.9%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - c \cdot \color{blue}{\left(a \cdot -4\right)}}}{a \cdot 2} \]
      12. add-cube-cbrt2.9%

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

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

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{{\left(\sqrt[3]{\left(c \cdot 4\right) \cdot a}\right)}^{3}}}}{a \cdot 2} \]
    7. Taylor expanded in c around -inf 0.0%

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

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

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

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

        \[\leadsto \frac{\left(-b\right) + \left(-\color{blue}{-1} \cdot \sqrt{a \cdot \left(c \cdot {\left(\sqrt[3]{-4}\right)}^{3}\right)}\right)}{a \cdot 2} \]
      5. distribute-lft-neg-in71.0%

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

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

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

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

    if 5.2e-47 < b

    1. Initial program 8.6%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - c \cdot \sqrt{\left(a \cdot a\right) \cdot \color{blue}{\left(-4 \cdot -4\right)}}}}{a \cdot 2} \]
      9. swap-sqr6.7%

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - c \cdot \color{blue}{\left(\sqrt{a \cdot -4} \cdot \sqrt{a \cdot -4}\right)}}}{a \cdot 2} \]
      11. add-sqr-sqrt5.9%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - c \cdot \color{blue}{\left(a \cdot -4\right)}}}{a \cdot 2} \]
      12. add-cube-cbrt5.9%

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{-c}}{b} \]
    10. Simplified93.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -5.8 \cdot 10^{-127}:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \mathbf{elif}\;b \leq 5.2 \cdot 10^{-47}:\\ \;\;\;\;\frac{\sqrt{a \cdot \left(c \cdot -4\right)} - b}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{-b}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 71.6% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;b \leq 4.5 \cdot 10^{-167}:\\
\;\;\;\;-0.5 \cdot \sqrt{c \cdot \frac{-4}{a}}\\

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


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

    1. Initial program 79.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. *-commutative79.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(b \cdot \left(-1 \cdot \frac{c}{{b}^{2}} + \frac{1}{a}\right)\right)} \]
    9. Step-by-step derivation
      1. mul-1-neg74.4%

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

        \[\leadsto -\color{blue}{\left(-1 \cdot \frac{c}{{b}^{2}} + \frac{1}{a}\right) \cdot b} \]
      3. distribute-rgt-neg-in74.4%

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

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

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

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

      \[\leadsto \color{blue}{\left(\frac{1}{a} - \frac{c}{{b}^{2}}\right) \cdot \left(-b\right)} \]
    11. Taylor expanded in a around 0 74.5%

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

        \[\leadsto \frac{\color{blue}{\frac{a \cdot c}{b} + -1 \cdot b}}{a} \]
      2. *-commutative74.5%

        \[\leadsto \frac{\frac{\color{blue}{c \cdot a}}{b} + -1 \cdot b}{a} \]
      3. associate-*r/76.5%

        \[\leadsto \frac{\color{blue}{c \cdot \frac{a}{b}} + -1 \cdot b}{a} \]
      4. mul-1-neg76.5%

        \[\leadsto \frac{c \cdot \frac{a}{b} + \color{blue}{\left(-b\right)}}{a} \]
      5. unsub-neg76.5%

        \[\leadsto \frac{\color{blue}{c \cdot \frac{a}{b} - b}}{a} \]
      6. div-sub76.5%

        \[\leadsto \color{blue}{\frac{c \cdot \frac{a}{b}}{a} - \frac{b}{a}} \]
      7. associate-/l*76.5%

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

        \[\leadsto c \cdot \color{blue}{\frac{a}{a \cdot b}} - \frac{b}{a} \]
      9. associate-/r*76.5%

        \[\leadsto c \cdot \color{blue}{\frac{\frac{a}{a}}{b}} - \frac{b}{a} \]
      10. *-inverses76.5%

        \[\leadsto c \cdot \frac{\color{blue}{1}}{b} - \frac{b}{a} \]
      11. associate-*r/76.5%

        \[\leadsto \color{blue}{\frac{c \cdot 1}{b}} - \frac{b}{a} \]
      12. *-rgt-identity76.5%

        \[\leadsto \frac{\color{blue}{c}}{b} - \frac{b}{a} \]
    13. Simplified76.5%

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

    if -2.60000000000000017e-208 < b < 4.5000000000000001e-167

    1. Initial program 74.4%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - c \cdot \color{blue}{\left(\sqrt{a \cdot -4} \cdot \sqrt{a \cdot -4}\right)}}}{a \cdot 2} \]
      11. add-sqr-sqrt0.7%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - c \cdot \color{blue}{\left(a \cdot -4\right)}}}{a \cdot 2} \]
      12. add-cube-cbrt0.7%

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

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

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{{\left(\sqrt[3]{\left(c \cdot 4\right) \cdot a}\right)}^{3}}}}{a \cdot 2} \]
    7. Taylor expanded in c around -inf 0.0%

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

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

        \[\leadsto -0.5 \cdot \left(\color{blue}{\left(\sqrt{-1} \cdot \sqrt{-1}\right)} \cdot \sqrt{\frac{c \cdot {\left(\sqrt[3]{-4}\right)}^{3}}{a}}\right) \]
      3. rem-square-sqrt28.0%

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

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

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

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

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

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

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

        \[\leadsto {\left(\color{blue}{\sqrt{\left(-1 \cdot \sqrt{c \cdot \frac{-4}{a}}\right) \cdot \left(-1 \cdot \sqrt{c \cdot \frac{-4}{a}}\right)}} \cdot -0.5\right)}^{1} \]
      5. mul-1-neg53.5%

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

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

        \[\leadsto {\left(\sqrt{\color{blue}{\sqrt{c \cdot \frac{-4}{a}} \cdot \sqrt{c \cdot \frac{-4}{a}}}} \cdot -0.5\right)}^{1} \]
      8. add-sqr-sqrt53.5%

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

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

      \[\leadsto \color{blue}{{\left(\sqrt{\frac{c \cdot -4}{a}} \cdot -0.5\right)}^{1}} \]
    12. Step-by-step derivation
      1. unpow153.3%

        \[\leadsto \color{blue}{\sqrt{\frac{c \cdot -4}{a}} \cdot -0.5} \]
      2. *-commutative53.3%

        \[\leadsto \color{blue}{-0.5 \cdot \sqrt{\frac{c \cdot -4}{a}}} \]
      3. associate-/l*53.5%

        \[\leadsto -0.5 \cdot \sqrt{\color{blue}{c \cdot \frac{-4}{a}}} \]
    13. Simplified53.5%

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

    if 4.5000000000000001e-167 < b

    1. Initial program 21.8%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - c \cdot \color{blue}{\left(\sqrt{a \cdot -4} \cdot \sqrt{a \cdot -4}\right)}}}{a \cdot 2} \]
      11. add-sqr-sqrt4.9%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - c \cdot \color{blue}{\left(a \cdot -4\right)}}}{a \cdot 2} \]
      12. add-cube-cbrt4.9%

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

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

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{{\left(\sqrt[3]{\left(c \cdot 4\right) \cdot a}\right)}^{3}}}}{a \cdot 2} \]
    7. Applied egg-rr21.8%

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

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

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

        \[\leadsto \frac{\color{blue}{-c}}{b} \]
    10. Simplified81.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -2.6 \cdot 10^{-208}:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \mathbf{elif}\;b \leq 4.5 \cdot 10^{-167}:\\ \;\;\;\;-0.5 \cdot \sqrt{c \cdot \frac{-4}{a}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{-b}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 71.2% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;b \leq 4.8 \cdot 10^{-105}:\\
\;\;\;\;\sqrt{\frac{-c}{a}}\\

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


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

    1. Initial program 79.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(\frac{1}{a} - \frac{c}{{b}^{2}}\right) \cdot \left(-b\right)} \]
    11. Taylor expanded in a around 0 75.2%

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

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

        \[\leadsto \frac{\frac{\color{blue}{c \cdot a}}{b} + -1 \cdot b}{a} \]
      3. associate-*r/77.1%

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

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

        \[\leadsto \frac{\color{blue}{c \cdot \frac{a}{b} - b}}{a} \]
      6. div-sub77.1%

        \[\leadsto \color{blue}{\frac{c \cdot \frac{a}{b}}{a} - \frac{b}{a}} \]
      7. associate-/l*77.1%

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

        \[\leadsto c \cdot \color{blue}{\frac{a}{a \cdot b}} - \frac{b}{a} \]
      9. associate-/r*77.2%

        \[\leadsto c \cdot \color{blue}{\frac{\frac{a}{a}}{b}} - \frac{b}{a} \]
      10. *-inverses77.2%

        \[\leadsto c \cdot \frac{\color{blue}{1}}{b} - \frac{b}{a} \]
      11. associate-*r/77.2%

        \[\leadsto \color{blue}{\frac{c \cdot 1}{b}} - \frac{b}{a} \]
      12. *-rgt-identity77.2%

        \[\leadsto \frac{\color{blue}{c}}{b} - \frac{b}{a} \]
    13. Simplified77.2%

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

    if -1.4200000000000001e-188 < b < 4.8000000000000003e-105

    1. Initial program 78.4%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - c \cdot \color{blue}{\left(\sqrt{a \cdot -4} \cdot \sqrt{a \cdot -4}\right)}}}{a \cdot 2} \]
      11. add-sqr-sqrt0.7%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - c \cdot \color{blue}{\left(a \cdot -4\right)}}}{a \cdot 2} \]
      12. add-cube-cbrt0.7%

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

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

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{{\left(\sqrt[3]{\left(c \cdot 4\right) \cdot a}\right)}^{3}}}}{a \cdot 2} \]
    7. Taylor expanded in c around -inf 0.0%

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

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

        \[\leadsto -0.5 \cdot \left(\color{blue}{\left(\sqrt{-1} \cdot \sqrt{-1}\right)} \cdot \sqrt{\frac{c \cdot {\left(\sqrt[3]{-4}\right)}^{3}}{a}}\right) \]
      3. rem-square-sqrt30.8%

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

        \[\leadsto -0.5 \cdot \left(-1 \cdot \sqrt{\color{blue}{c \cdot \frac{{\left(\sqrt[3]{-4}\right)}^{3}}{a}}}\right) \]
      5. rem-cube-cbrt31.0%

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

      \[\leadsto \color{blue}{-0.5 \cdot \left(-1 \cdot \sqrt{c \cdot \frac{-4}{a}}\right)} \]
    10. Step-by-step derivation
      1. add-sqr-sqrt31.0%

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

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

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

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

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

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

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

        \[\leadsto -0.5 \cdot \left(-1 \cdot \left(-\color{blue}{\sqrt{c} \cdot \sqrt{\frac{-4}{a}}}\right)\right) \]
      9. distribute-rgt-neg-in50.9%

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

      \[\leadsto -0.5 \cdot \left(-1 \cdot \color{blue}{\left(\sqrt{c} \cdot \left(-\sqrt{\frac{-4}{a}}\right)\right)}\right) \]
    12. Step-by-step derivation
      1. distribute-rgt-neg-out50.9%

        \[\leadsto -0.5 \cdot \left(-1 \cdot \color{blue}{\left(-\sqrt{c} \cdot \sqrt{\frac{-4}{a}}\right)}\right) \]
      2. distribute-lft-neg-out50.9%

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

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

      \[\leadsto -0.5 \cdot \left(-1 \cdot \color{blue}{\left(\sqrt{\frac{-4}{a}} \cdot \left(-\sqrt{c}\right)\right)}\right) \]
    14. Step-by-step derivation
      1. add-sqr-sqrt0.0%

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

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

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

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

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

      \[\leadsto \color{blue}{\sqrt{\left(c \cdot \frac{-4}{a}\right) \cdot 0.25}} \]
    16. Step-by-step derivation
      1. associate-*l*30.9%

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

        \[\leadsto \sqrt{c \cdot \color{blue}{\frac{-4 \cdot 0.25}{a}}} \]
      3. metadata-eval30.9%

        \[\leadsto \sqrt{c \cdot \frac{\color{blue}{-1}}{a}} \]
      4. metadata-eval30.9%

        \[\leadsto \sqrt{c \cdot \frac{\color{blue}{\frac{-2}{2}}}{a}} \]
      5. associate-/r*30.9%

        \[\leadsto \sqrt{c \cdot \color{blue}{\frac{-2}{2 \cdot a}}} \]
      6. *-commutative30.9%

        \[\leadsto \sqrt{c \cdot \frac{-2}{\color{blue}{a \cdot 2}}} \]
      7. associate-/l*30.9%

        \[\leadsto \sqrt{\color{blue}{\frac{c \cdot -2}{a \cdot 2}}} \]
      8. times-frac30.9%

        \[\leadsto \sqrt{\color{blue}{\frac{c}{a} \cdot \frac{-2}{2}}} \]
      9. metadata-eval30.9%

        \[\leadsto \sqrt{\frac{c}{a} \cdot \color{blue}{-1}} \]
      10. associate-*l/30.9%

        \[\leadsto \sqrt{\color{blue}{\frac{c \cdot -1}{a}}} \]
      11. *-commutative30.9%

        \[\leadsto \sqrt{\frac{\color{blue}{-1 \cdot c}}{a}} \]
      12. mul-1-neg30.9%

        \[\leadsto \sqrt{\frac{\color{blue}{-c}}{a}} \]
    17. Simplified30.9%

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

    if 4.8000000000000003e-105 < b

    1. Initial program 13.3%

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

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

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{c \cdot \left(4 \cdot a\right)}}}{a \cdot 2} \]
      2. add-sqr-sqrt8.7%

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

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

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

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

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

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - c \cdot \sqrt{\left(a \cdot a\right) \cdot \color{blue}{\left(-4 \cdot -4\right)}}}}{a \cdot 2} \]
      9. swap-sqr8.7%

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{-c}}{b} \]
    10. Simplified89.7%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -1.42 \cdot 10^{-188}:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \mathbf{elif}\;b \leq 4.8 \cdot 10^{-105}:\\ \;\;\;\;\sqrt{\frac{-c}{a}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{-b}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 67.5% accurate, 9.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -2 \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 -2e-310) (- (/ c b) (/ b a)) (/ c (- b))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= -2e-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 <= (-2d-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 <= -2e-310) {
		tmp = (c / b) - (b / a);
	} else {
		tmp = c / -b;
	}
	return tmp;
}
def code(a, b, c):
	tmp = 0
	if b <= -2e-310:
		tmp = (c / b) - (b / a)
	else:
		tmp = c / -b
	return tmp
function code(a, b, c)
	tmp = 0.0
	if (b <= -2e-310)
		tmp = Float64(Float64(c / b) - Float64(b / a));
	else
		tmp = Float64(c / Float64(-b));
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	tmp = 0.0;
	if (b <= -2e-310)
		tmp = (c / b) - (b / a);
	else
		tmp = c / -b;
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := If[LessEqual[b, -2e-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 -2 \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 < -1.999999999999994e-310

    1. Initial program 79.2%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - c \cdot \sqrt{\left(a \cdot a\right) \cdot \color{blue}{\left(-4 \cdot -4\right)}}}}{a \cdot 2} \]
      9. swap-sqr61.7%

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

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

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

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

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

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

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

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

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

        \[\leadsto -\color{blue}{\left(-1 \cdot \frac{c}{{b}^{2}} + \frac{1}{a}\right) \cdot b} \]
      3. distribute-rgt-neg-in67.7%

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

        \[\leadsto \color{blue}{\left(\frac{1}{a} + -1 \cdot \frac{c}{{b}^{2}}\right)} \cdot \left(-b\right) \]
      5. mul-1-neg67.7%

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

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

      \[\leadsto \color{blue}{\left(\frac{1}{a} - \frac{c}{{b}^{2}}\right) \cdot \left(-b\right)} \]
    11. Taylor expanded in a around 0 68.0%

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

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

        \[\leadsto \frac{\frac{\color{blue}{c \cdot a}}{b} + -1 \cdot b}{a} \]
      3. associate-*r/69.7%

        \[\leadsto \frac{\color{blue}{c \cdot \frac{a}{b}} + -1 \cdot b}{a} \]
      4. mul-1-neg69.7%

        \[\leadsto \frac{c \cdot \frac{a}{b} + \color{blue}{\left(-b\right)}}{a} \]
      5. unsub-neg69.7%

        \[\leadsto \frac{\color{blue}{c \cdot \frac{a}{b} - b}}{a} \]
      6. div-sub69.7%

        \[\leadsto \color{blue}{\frac{c \cdot \frac{a}{b}}{a} - \frac{b}{a}} \]
      7. associate-/l*69.7%

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

        \[\leadsto c \cdot \color{blue}{\frac{a}{a \cdot b}} - \frac{b}{a} \]
      9. associate-/r*69.8%

        \[\leadsto c \cdot \color{blue}{\frac{\frac{a}{a}}{b}} - \frac{b}{a} \]
      10. *-inverses69.8%

        \[\leadsto c \cdot \frac{\color{blue}{1}}{b} - \frac{b}{a} \]
      11. associate-*r/69.8%

        \[\leadsto \color{blue}{\frac{c \cdot 1}{b}} - \frac{b}{a} \]
      12. *-rgt-identity69.8%

        \[\leadsto \frac{\color{blue}{c}}{b} - \frac{b}{a} \]
    13. Simplified69.8%

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

    if -1.999999999999994e-310 < b

    1. Initial program 29.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - c \cdot \color{blue}{\left(a \cdot -4\right)}}}{a \cdot 2} \]
      12. add-cube-cbrt4.3%

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

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

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

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

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

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

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

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

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

Alternative 6: 67.4% accurate, 12.9× speedup?

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

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

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


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

    1. Initial program 79.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - c \cdot \color{blue}{\left(a \cdot -4\right)}}}{a \cdot 2} \]
      12. add-cube-cbrt52.3%

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

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

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{{\left(\sqrt[3]{\left(c \cdot 4\right) \cdot a}\right)}^{3}}}}{a \cdot 2} \]
    7. Taylor expanded in b around -inf 67.3%

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

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

        \[\leadsto \frac{\color{blue}{-b}}{a} \]
    9. Simplified67.3%

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

    if 1.84999999999999989e-290 < b

    1. Initial program 27.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{-c}}{b} \]
    10. Simplified73.4%

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

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

Alternative 7: 43.5% accurate, 12.9× speedup?

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

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

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


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

    1. Initial program 77.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. *-commutative77.7%

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

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{c \cdot \left(4 \cdot a\right)}}}{a \cdot 2} \]
      2. add-sqr-sqrt39.9%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - c \cdot \color{blue}{\left(\sqrt{a \cdot -4} \cdot \sqrt{a \cdot -4}\right)}}}{a \cdot 2} \]
      11. add-sqr-sqrt39.7%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - c \cdot \color{blue}{\left(a \cdot -4\right)}}}{a \cdot 2} \]
      12. add-cube-cbrt39.7%

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

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

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{{\left(\sqrt[3]{\left(c \cdot 4\right) \cdot a}\right)}^{3}}}}{a \cdot 2} \]
    7. Taylor expanded in b around -inf 51.6%

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

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

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

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

    if 2.1499999999999999e-29 < b

    1. Initial program 8.2%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - c \cdot \color{blue}{\left(\sqrt{a \cdot -4} \cdot \sqrt{a \cdot -4}\right)}}}{a \cdot 2} \]
      11. add-sqr-sqrt5.9%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - c \cdot \color{blue}{\left(a \cdot -4\right)}}}{a \cdot 2} \]
      12. add-cube-cbrt5.9%

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

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(b \cdot \left(-1 \cdot \frac{c}{{b}^{2}} + \frac{1}{a}\right)\right)} \]
    9. Step-by-step derivation
      1. mul-1-neg2.2%

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

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

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

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

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

        \[\leadsto \color{blue}{\left(\frac{1}{a} - \frac{c}{{b}^{2}}\right)} \cdot \left(-b\right) \]
    10. Simplified2.2%

      \[\leadsto \color{blue}{\left(\frac{1}{a} - \frac{c}{{b}^{2}}\right) \cdot \left(-b\right)} \]
    11. Taylor expanded in a around inf 27.6%

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

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

Alternative 8: 10.5% accurate, 38.7× speedup?

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

\\
\frac{c}{b}
\end{array}
Derivation
  1. Initial program 52.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - c \cdot \color{blue}{\left(a \cdot -4\right)}}}{a \cdot 2} \]
    12. add-cube-cbrt27.3%

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

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

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

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

    \[\leadsto \color{blue}{-1 \cdot \left(b \cdot \left(-1 \cdot \frac{c}{{b}^{2}} + \frac{1}{a}\right)\right)} \]
  9. Step-by-step derivation
    1. mul-1-neg32.3%

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

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

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

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

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

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

    \[\leadsto \color{blue}{\left(\frac{1}{a} - \frac{c}{{b}^{2}}\right) \cdot \left(-b\right)} \]
  11. Taylor expanded in a around inf 12.3%

    \[\leadsto \color{blue}{\frac{c}{b}} \]
  12. Add Preprocessing

Developer target: 70.7% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\\ \mathbf{if}\;b < 0:\\ \;\;\;\;\frac{\left(-b\right) + t\_0}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{a \cdot \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)
     (/ (+ (- b) t_0) (* 2.0 a))
     (/ c (* 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 = (-b + t_0) / (2.0 * a);
	} else {
		tmp = c / (a * ((-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 = (-b + t_0) / (2.0d0 * a)
    else
        tmp = c / (a * ((-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 = (-b + t_0) / (2.0 * a);
	} else {
		tmp = c / (a * ((-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 = (-b + t_0) / (2.0 * a)
	else:
		tmp = c / (a * ((-b - t_0) / (2.0 * a)))
	return tmp
function code(a, b, c)
	t_0 = sqrt(Float64(Float64(b * b) - Float64(Float64(4.0 * a) * c)))
	tmp = 0.0
	if (b < 0.0)
		tmp = Float64(Float64(Float64(-b) + t_0) / Float64(2.0 * a));
	else
		tmp = Float64(c / Float64(a * 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 = (-b + t_0) / (2.0 * a);
	else
		tmp = c / (a * ((-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[(N[(4.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[Less[b, 0.0], N[(N[((-b) + t$95$0), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision], N[(c / N[(a * N[(N[((-b) - t$95$0), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

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


\end{array}
\end{array}

Reproduce

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

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

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