Quadratic roots, full range

Percentage Accurate: 51.9% → 85.2%
Time: 12.4s
Alternatives: 8
Speedup: 12.9×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 8 alternatives:

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

Initial Program: 51.9% 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.2% accurate, 0.9× speedup?

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

\mathbf{elif}\;b \leq 9.8 \cdot 10^{-108}:\\
\;\;\;\;\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 < -2.30000000000000001e150

    1. Initial program 44.4%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{b}{a}} \]
    4. Step-by-step derivation
      1. mul-1-neg97.9%

        \[\leadsto \color{blue}{-\frac{b}{a}} \]
      2. distribute-neg-frac297.9%

        \[\leadsto \color{blue}{\frac{b}{-a}} \]
    5. Simplified97.9%

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

    if -2.30000000000000001e150 < b < 9.7999999999999996e-108

    1. Initial program 84.9%

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

    if 9.7999999999999996e-108 < b

    1. Initial program 22.9%

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

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

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

        \[\leadsto \color{blue}{\frac{c}{-b}} \]
    5. Simplified84.2%

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

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

Alternative 2: 80.6% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.75 \cdot 10^{-63}:\\
\;\;\;\;b \cdot \left(\frac{c}{{b}^{2}} + \frac{-1}{a}\right)\\

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

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


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

    1. Initial program 70.4%

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

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

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

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

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

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

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

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

    if -1.75000000000000002e-63 < b < 2.0000000000000001e-114

    1. Initial program 80.2%

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

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

    if 2.0000000000000001e-114 < b

    1. Initial program 23.5%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{c}{b}} \]
    4. Step-by-step derivation
      1. mul-1-neg82.7%

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

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

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

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

Alternative 3: 80.5% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq -7.4 \cdot 10^{-62}:\\
\;\;\;\;b \cdot \left(\frac{c}{{b}^{2}} + \frac{-1}{a}\right)\\

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

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


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

    1. Initial program 70.4%

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

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

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

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

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

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

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

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

    if -7.3999999999999996e-62 < b < 2.8000000000000001e-114

    1. Initial program 80.2%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. prod-diff79.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.8000000000000001e-114 < b

    1. Initial program 23.5%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{c}{b}} \]
    4. Step-by-step derivation
      1. mul-1-neg82.7%

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

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

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

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

Alternative 4: 80.1% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.8 \cdot 10^{-63}:\\
\;\;\;\;b \cdot \left(\frac{c}{{b}^{2}} + \frac{-1}{a}\right)\\

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

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


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

    1. Initial program 70.4%

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

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

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

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

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

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

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

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

    if -2.8000000000000002e-63 < b < 2.75000000000000005e-114

    1. Initial program 80.2%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. prod-diff79.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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)} \]
    6. Step-by-step derivation
      1. associate-*r*76.6%

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

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

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

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

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

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

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

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

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

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

    if 2.75000000000000005e-114 < b

    1. Initial program 23.5%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{c}{b}} \]
    4. Step-by-step derivation
      1. mul-1-neg82.7%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -2.8 \cdot 10^{-63}:\\ \;\;\;\;b \cdot \left(\frac{c}{{b}^{2}} + \frac{-1}{a}\right)\\ \mathbf{elif}\;b \leq 2.75 \cdot 10^{-114}:\\ \;\;\;\;\sqrt{c \cdot \left(a \cdot -4\right)} \cdot \frac{0.5}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{-b}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 80.2% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 69.7%

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

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

        \[\leadsto \color{blue}{-\frac{b}{a}} \]
      2. distribute-neg-frac283.4%

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

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

    if -2.7e-77 < b < 2.8000000000000001e-114

    1. Initial program 81.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{\mathsf{fma}\left(b, b, \mathsf{fma}\left(c, a \cdot -4, \mathsf{fma}\left(c, a \cdot -4, \left(4 \cdot a\right) \cdot c\right)\right)\right)}}}{2 \cdot a} \]
    5. Taylor expanded in b around 0 77.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)} \]
    6. Step-by-step derivation
      1. associate-*r*77.7%

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

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

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

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

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

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

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

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

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

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

    if 2.8000000000000001e-114 < b

    1. Initial program 23.5%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{c}{b}} \]
    4. Step-by-step derivation
      1. mul-1-neg82.7%

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

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

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

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

Alternative 6: 70.7% accurate, 1.0× speedup?

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

\mathbf{elif}\;b \leq 1.55 \cdot 10^{-108}:\\
\;\;\;\;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 < -3e-68

    1. Initial program 70.4%

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

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

        \[\leadsto \color{blue}{-\frac{b}{a}} \]
      2. distribute-neg-frac284.3%

        \[\leadsto \color{blue}{\frac{b}{-a}} \]
    5. Simplified84.3%

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

    if -3e-68 < b < 1.55000000000000007e-108

    1. Initial program 79.4%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. prod-diff78.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{0.5 \cdot \sqrt{\frac{-8 \cdot c + 4 \cdot c}{a}}} \]
    6. Step-by-step derivation
      1. distribute-rgt-out44.3%

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

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

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

    if 1.55000000000000007e-108 < b

    1. Initial program 22.9%

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

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

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

        \[\leadsto \color{blue}{\frac{c}{-b}} \]
    5. Simplified84.2%

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

Alternative 7: 67.5% accurate, 12.9× speedup?

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

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

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


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

    1. Initial program 73.9%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{b}{a}} \]
    4. Step-by-step derivation
      1. mul-1-neg60.9%

        \[\leadsto \color{blue}{-\frac{b}{a}} \]
      2. distribute-neg-frac260.9%

        \[\leadsto \color{blue}{\frac{b}{-a}} \]
    5. Simplified60.9%

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

    if 7.39999999999999954e-305 < b

    1. Initial program 35.0%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{c}{b}} \]
    4. Step-by-step derivation
      1. mul-1-neg66.7%

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

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

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

Alternative 8: 35.2% accurate, 29.0× speedup?

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

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

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

    \[\leadsto \color{blue}{-1 \cdot \frac{b}{a}} \]
  4. Step-by-step derivation
    1. mul-1-neg33.2%

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

      \[\leadsto \color{blue}{\frac{b}{-a}} \]
  5. Simplified33.2%

    \[\leadsto \color{blue}{\frac{b}{-a}} \]
  6. Add Preprocessing

Reproduce

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