Quadratic roots, full range

Percentage Accurate: 51.7% → 85.6%
Time: 13.7s
Alternatives: 10
Speedup: 19.1×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 10 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: 51.7% accurate, 1.0× speedup?

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

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

Alternative 1: 85.6% accurate, 1.0× speedup?

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

\mathbf{elif}\;b \leq 1.75 \cdot 10^{-59}:\\
\;\;\;\;\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 < -3.0000000000000001e143

    1. Initial program 48.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. *-commutative48.7%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\color{blue}{a \cdot 2}} \]
    3. Simplified48.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. Taylor expanded in b around -inf 95.0%

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

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

        \[\leadsto \frac{\color{blue}{-b}}{a} \]
    7. Simplified95.0%

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

    if -3.0000000000000001e143 < b < 1.75e-59

    1. Initial program 85.6%

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

    if 1.75e-59 < b

    1. Initial program 20.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. *-commutative20.1%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\color{blue}{a \cdot 2}} \]
    3. Simplified20.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. Taylor expanded in b around inf 83.0%

      \[\leadsto \color{blue}{-1 \cdot \frac{c}{b}} \]
    6. Step-by-step derivation
      1. mul-1-neg83.0%

        \[\leadsto \color{blue}{-\frac{c}{b}} \]
      2. distribute-neg-frac83.0%

        \[\leadsto \color{blue}{\frac{-c}{b}} \]
    7. Simplified83.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -3 \cdot 10^{+143}:\\ \;\;\;\;-\frac{b}{a}\\ \mathbf{elif}\;b \leq 1.75 \cdot 10^{-59}:\\ \;\;\;\;\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: 81.0% accurate, 1.0× speedup?

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

\mathbf{elif}\;b \leq 5.6 \cdot 10^{-62}:\\
\;\;\;\;\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 < -2.20000000000000006e-58

    1. Initial program 73.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. *-commutative73.7%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\color{blue}{a \cdot 2}} \]
    3. Simplified73.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. Taylor expanded in b around -inf 86.1%

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

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

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

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

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

    if -2.20000000000000006e-58 < b < 5.60000000000000005e-62

    1. Initial program 80.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. *-commutative80.9%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\color{blue}{a \cdot 2}} \]
    3. Simplified80.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. prod-diff80.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.60000000000000005e-62 < b

    1. Initial program 20.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. *-commutative20.1%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\color{blue}{a \cdot 2}} \]
    3. Simplified20.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. Taylor expanded in b around inf 83.0%

      \[\leadsto \color{blue}{-1 \cdot \frac{c}{b}} \]
    6. Step-by-step derivation
      1. mul-1-neg83.0%

        \[\leadsto \color{blue}{-\frac{c}{b}} \]
      2. distribute-neg-frac83.0%

        \[\leadsto \color{blue}{\frac{-c}{b}} \]
    7. Simplified83.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -2.2 \cdot 10^{-58}:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \mathbf{elif}\;b \leq 5.6 \cdot 10^{-62}:\\ \;\;\;\;\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: 72.0% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;b \leq 1.8 \cdot 10^{-101}:\\
\;\;\;\;0.5 \cdot \frac{1}{\sqrt{\frac{a}{c} \cdot -0.25}}\\

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


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

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\color{blue}{a \cdot 2}} \]
    3. Simplified77.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. Taylor expanded in b around -inf 78.5%

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

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

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

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

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

    if -2.60000000000000011e-141 < b < 1.8e-101

    1. Initial program 75.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. *-commutative75.7%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\color{blue}{a \cdot 2}} \]
    3. Simplified75.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. prod-diff75.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 0.5 \cdot \sqrt{\color{blue}{1} \cdot \frac{-4 \cdot c}{a}} \]
      4. *-commutative33.8%

        \[\leadsto 0.5 \cdot \sqrt{1 \cdot \frac{\color{blue}{c \cdot -4}}{a}} \]
    15. Simplified33.8%

      \[\leadsto 0.5 \cdot \color{blue}{\sqrt{1 \cdot \frac{c \cdot -4}{a}}} \]
    16. Step-by-step derivation
      1. *-un-lft-identity33.8%

        \[\leadsto 0.5 \cdot \sqrt{\color{blue}{\frac{c \cdot -4}{a}}} \]
      2. clear-num33.8%

        \[\leadsto 0.5 \cdot \sqrt{\color{blue}{\frac{1}{\frac{a}{c \cdot -4}}}} \]
      3. sqrt-div33.8%

        \[\leadsto 0.5 \cdot \color{blue}{\frac{\sqrt{1}}{\sqrt{\frac{a}{c \cdot -4}}}} \]
      4. metadata-eval33.8%

        \[\leadsto 0.5 \cdot \frac{\color{blue}{1}}{\sqrt{\frac{a}{c \cdot -4}}} \]
      5. *-un-lft-identity33.8%

        \[\leadsto 0.5 \cdot \frac{1}{\sqrt{\frac{\color{blue}{1 \cdot a}}{c \cdot -4}}} \]
      6. *-commutative33.8%

        \[\leadsto 0.5 \cdot \frac{1}{\sqrt{\frac{1 \cdot a}{\color{blue}{-4 \cdot c}}}} \]
      7. times-frac33.8%

        \[\leadsto 0.5 \cdot \frac{1}{\sqrt{\color{blue}{\frac{1}{-4} \cdot \frac{a}{c}}}} \]
      8. metadata-eval33.8%

        \[\leadsto 0.5 \cdot \frac{1}{\sqrt{\color{blue}{-0.25} \cdot \frac{a}{c}}} \]
    17. Applied egg-rr33.8%

      \[\leadsto 0.5 \cdot \color{blue}{\frac{1}{\sqrt{-0.25 \cdot \frac{a}{c}}}} \]
    18. Step-by-step derivation
      1. *-commutative33.8%

        \[\leadsto 0.5 \cdot \frac{1}{\sqrt{\color{blue}{\frac{a}{c} \cdot -0.25}}} \]
    19. Simplified33.8%

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

    if 1.8e-101 < b

    1. Initial program 23.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. *-commutative23.0%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\color{blue}{a \cdot 2}} \]
    3. Simplified23.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. Taylor expanded in b around inf 80.2%

      \[\leadsto \color{blue}{-1 \cdot \frac{c}{b}} \]
    6. Step-by-step derivation
      1. mul-1-neg80.2%

        \[\leadsto \color{blue}{-\frac{c}{b}} \]
      2. distribute-neg-frac80.2%

        \[\leadsto \color{blue}{\frac{-c}{b}} \]
    7. Simplified80.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -2.6 \cdot 10^{-141}:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \mathbf{elif}\;b \leq 1.8 \cdot 10^{-101}:\\ \;\;\;\;0.5 \cdot \frac{1}{\sqrt{\frac{a}{c} \cdot -0.25}}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 80.7% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 73.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. *-commutative73.7%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\color{blue}{a \cdot 2}} \]
    3. Simplified73.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. Taylor expanded in b around -inf 86.1%

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

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

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

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

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

    if -2.8999999999999999e-58 < b < 4.10000000000000013e-60

    1. Initial program 80.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. *-commutative80.9%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\color{blue}{a \cdot 2}} \]
    3. Simplified80.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. prod-diff80.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 4.10000000000000013e-60 < b

    1. Initial program 20.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. *-commutative20.1%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\color{blue}{a \cdot 2}} \]
    3. Simplified20.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. Taylor expanded in b around inf 83.0%

      \[\leadsto \color{blue}{-1 \cdot \frac{c}{b}} \]
    6. Step-by-step derivation
      1. mul-1-neg83.0%

        \[\leadsto \color{blue}{-\frac{c}{b}} \]
      2. distribute-neg-frac83.0%

        \[\leadsto \color{blue}{\frac{-c}{b}} \]
    7. Simplified83.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -2.9 \cdot 10^{-58}:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \mathbf{elif}\;b \leq 4.1 \cdot 10^{-60}:\\ \;\;\;\;0.5 \cdot \frac{\sqrt{a \cdot \left(c \cdot -4\right)}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 72.1% accurate, 1.0× speedup?

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

\mathbf{elif}\;b \leq 5.1 \cdot 10^{-104}:\\
\;\;\;\;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 < -6.79999999999999966e-143

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\color{blue}{a \cdot 2}} \]
    3. Simplified77.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. Taylor expanded in b around -inf 78.5%

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

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

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

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

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

    if -6.79999999999999966e-143 < b < 5.09999999999999992e-104

    1. Initial program 75.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. *-commutative75.7%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\color{blue}{a \cdot 2}} \]
    3. Simplified75.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. prod-diff75.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 0.5 \cdot \sqrt{\color{blue}{1} \cdot \frac{-4 \cdot c}{a}} \]
      4. *-commutative33.8%

        \[\leadsto 0.5 \cdot \sqrt{1 \cdot \frac{\color{blue}{c \cdot -4}}{a}} \]
    15. Simplified33.8%

      \[\leadsto 0.5 \cdot \color{blue}{\sqrt{1 \cdot \frac{c \cdot -4}{a}}} \]
    16. Step-by-step derivation
      1. expm1-log1p-u33.2%

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

        \[\leadsto 0.5 \cdot \color{blue}{\left(e^{\mathsf{log1p}\left(\sqrt{1 \cdot \frac{c \cdot -4}{a}}\right)} - 1\right)} \]
      3. *-un-lft-identity17.5%

        \[\leadsto 0.5 \cdot \left(e^{\mathsf{log1p}\left(\sqrt{\color{blue}{\frac{c \cdot -4}{a}}}\right)} - 1\right) \]
      4. *-un-lft-identity17.5%

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

        \[\leadsto 0.5 \cdot \left(e^{\mathsf{log1p}\left(\sqrt{\color{blue}{\frac{c}{1} \cdot \frac{-4}{a}}}\right)} - 1\right) \]
      6. /-rgt-identity17.5%

        \[\leadsto 0.5 \cdot \left(e^{\mathsf{log1p}\left(\sqrt{\color{blue}{c} \cdot \frac{-4}{a}}\right)} - 1\right) \]
    17. Applied egg-rr17.5%

      \[\leadsto 0.5 \cdot \color{blue}{\left(e^{\mathsf{log1p}\left(\sqrt{c \cdot \frac{-4}{a}}\right)} - 1\right)} \]
    18. Step-by-step derivation
      1. expm1-def33.1%

        \[\leadsto 0.5 \cdot \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{c \cdot \frac{-4}{a}}\right)\right)} \]
      2. expm1-log1p33.7%

        \[\leadsto 0.5 \cdot \color{blue}{\sqrt{c \cdot \frac{-4}{a}}} \]
    19. Simplified33.7%

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

    if 5.09999999999999992e-104 < b

    1. Initial program 23.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. *-commutative23.0%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\color{blue}{a \cdot 2}} \]
    3. Simplified23.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. Taylor expanded in b around inf 80.2%

      \[\leadsto \color{blue}{-1 \cdot \frac{c}{b}} \]
    6. Step-by-step derivation
      1. mul-1-neg80.2%

        \[\leadsto \color{blue}{-\frac{c}{b}} \]
      2. distribute-neg-frac80.2%

        \[\leadsto \color{blue}{\frac{-c}{b}} \]
    7. Simplified80.2%

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

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

Alternative 6: 72.1% accurate, 1.0× speedup?

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

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

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

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


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

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\color{blue}{a \cdot 2}} \]
    3. Simplified77.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. Taylor expanded in b around -inf 78.5%

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

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

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

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

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

    if -3.0999999999999999e-140 < b < 4.99999999999999979e-104

    1. Initial program 75.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. *-commutative75.7%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\color{blue}{a \cdot 2}} \]
    3. Simplified75.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. prod-diff75.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 0.5 \cdot \sqrt{\color{blue}{1} \cdot \frac{-4 \cdot c}{a}} \]
      4. *-commutative33.8%

        \[\leadsto 0.5 \cdot \sqrt{1 \cdot \frac{\color{blue}{c \cdot -4}}{a}} \]
    15. Simplified33.8%

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

    if 4.99999999999999979e-104 < b

    1. Initial program 23.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. *-commutative23.0%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\color{blue}{a \cdot 2}} \]
    3. Simplified23.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. Taylor expanded in b around inf 80.2%

      \[\leadsto \color{blue}{-1 \cdot \frac{c}{b}} \]
    6. Step-by-step derivation
      1. mul-1-neg80.2%

        \[\leadsto \color{blue}{-\frac{c}{b}} \]
      2. distribute-neg-frac80.2%

        \[\leadsto \color{blue}{\frac{-c}{b}} \]
    7. Simplified80.2%

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

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

Alternative 7: 68.5% accurate, 12.8× speedup?

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

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

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


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

    1. Initial program 78.5%

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

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

      \[\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. Taylor expanded in b around -inf 66.6%

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

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

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

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

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

    if -4.999999999999985e-310 < b

    1. Initial program 32.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. *-commutative32.0%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\color{blue}{a \cdot 2}} \]
    3. Simplified32.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. Taylor expanded in b around inf 68.0%

      \[\leadsto \color{blue}{-1 \cdot \frac{c}{b}} \]
    6. Step-by-step derivation
      1. mul-1-neg68.0%

        \[\leadsto \color{blue}{-\frac{c}{b}} \]
      2. distribute-neg-frac68.0%

        \[\leadsto \color{blue}{\frac{-c}{b}} \]
    7. Simplified68.0%

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

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

Alternative 8: 44.2% accurate, 19.1× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\frac{0}{a}\\


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

    1. Initial program 78.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. *-commutative78.3%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\color{blue}{a \cdot 2}} \]
    3. Simplified78.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. Taylor expanded in b around -inf 67.0%

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

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

        \[\leadsto \frac{\color{blue}{-b}}{a} \]
    7. Simplified67.0%

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

    if -6.6000000000000001e-301 < b

    1. Initial program 32.5%

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

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

      \[\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. pow1/232.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{{\left(\frac{a \cdot 2}{\left(-b\right) + e^{\log \left(\mathsf{fma}\left(a, c \cdot -4, {b}^{2}\right)\right) \cdot 0.5}}\right)}^{-1}} \]
      3. neg-mul-125.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{0}}{a} \]
    13. Simplified23.8%

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

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

Alternative 9: 68.4% accurate, 19.1× speedup?

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

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

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


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

    1. Initial program 78.5%

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

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

      \[\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. Taylor expanded in b around -inf 66.5%

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

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

        \[\leadsto \frac{\color{blue}{-b}}{a} \]
    7. Simplified66.5%

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

    if 8.0000000000000003e-309 < b

    1. Initial program 32.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. *-commutative32.0%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\color{blue}{a \cdot 2}} \]
    3. Simplified32.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. Taylor expanded in b around inf 68.0%

      \[\leadsto \color{blue}{-1 \cdot \frac{c}{b}} \]
    6. Step-by-step derivation
      1. mul-1-neg68.0%

        \[\leadsto \color{blue}{-\frac{c}{b}} \]
      2. distribute-neg-frac68.0%

        \[\leadsto \color{blue}{\frac{-c}{b}} \]
    7. Simplified68.0%

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

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

Alternative 10: 11.2% accurate, 38.7× speedup?

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

\\
\frac{0}{a}
\end{array}
Derivation
  1. Initial program 54.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. *-commutative54.7%

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\color{blue}{a \cdot 2}} \]
  3. Simplified54.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. pow1/254.7%

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\left(-b\right) + {\color{blue}{\left(\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)\right)}}^{0.5}}{a \cdot 2} \]
    11. pow-to-exp49.1%

      \[\leadsto \frac{\left(-b\right) + \color{blue}{e^{\log \left(\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)\right) \cdot 0.5}}}{a \cdot 2} \]
    12. pow249.1%

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

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

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

      \[\leadsto \color{blue}{{\left(\frac{a \cdot 2}{\left(-b\right) + e^{\log \left(\mathsf{fma}\left(a, c \cdot -4, {b}^{2}\right)\right) \cdot 0.5}}\right)}^{-1}} \]
    3. neg-mul-149.1%

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

      \[\leadsto {\left(\frac{a \cdot 2}{\color{blue}{\mathsf{fma}\left(-1, b, e^{\log \left(\mathsf{fma}\left(a, c \cdot -4, {b}^{2}\right)\right) \cdot 0.5}\right)}}\right)}^{-1} \]
    5. exp-to-pow54.6%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{0}}{a} \]
  13. Simplified13.6%

    \[\leadsto \color{blue}{\frac{0}{a}} \]
  14. Final simplification13.6%

    \[\leadsto \frac{0}{a} \]
  15. Add Preprocessing

Reproduce

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