The quadratic formula (r1)

Percentage Accurate: 52.0% → 84.6%
Time: 17.8s
Alternatives: 7
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 7 alternatives:

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

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

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -3.15 \cdot 10^{+94}:\\ \;\;\;\;\frac{b}{-a}\\ \mathbf{elif}\;b \leq 6 \cdot 10^{-173}:\\ \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} - b}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{-b}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b -3.15e+94)
   (/ b (- a))
   (if (<= b 6e-173)
     (/ (- (sqrt (fma a (* c -4.0) (* b b))) b) (* a 2.0))
     (/ c (- b)))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= -3.15e+94) {
		tmp = b / -a;
	} else if (b <= 6e-173) {
		tmp = (sqrt(fma(a, (c * -4.0), (b * b))) - b) / (a * 2.0);
	} else {
		tmp = c / -b;
	}
	return tmp;
}
function code(a, b, c)
	tmp = 0.0
	if (b <= -3.15e+94)
		tmp = Float64(b / Float64(-a));
	elseif (b <= 6e-173)
		tmp = Float64(Float64(sqrt(fma(a, Float64(c * -4.0), Float64(b * b))) - b) / Float64(a * 2.0));
	else
		tmp = Float64(c / Float64(-b));
	end
	return tmp
end
code[a_, b_, c_] := If[LessEqual[b, -3.15e+94], N[(b / (-a)), $MachinePrecision], If[LessEqual[b, 6e-173], N[(N[(N[Sqrt[N[(a * N[(c * -4.0), $MachinePrecision] + N[(b * b), $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.15 \cdot 10^{+94}:\\
\;\;\;\;\frac{b}{-a}\\

\mathbf{elif}\;b \leq 6 \cdot 10^{-173}:\\
\;\;\;\;\frac{\sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} - b}{a \cdot 2}\\

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


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

    1. Initial program 65.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. *-commutative65.3%

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

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

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

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

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

    if -3.15e94 < b < 6.0000000000000002e-173

    1. Initial program 88.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. *-commutative88.1%

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

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

    if 6.0000000000000002e-173 < b

    1. Initial program 18.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. *-commutative18.7%

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

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

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

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

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

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

Alternative 2: 84.6% accurate, 0.9× speedup?

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

\mathbf{elif}\;b \leq 6 \cdot 10^{-173}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - 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 < -3.0000000000000001e94

    1. Initial program 65.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. *-commutative65.3%

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

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

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

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

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

    if -3.0000000000000001e94 < b < 6.0000000000000002e-173

    1. Initial program 88.1%

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

    if 6.0000000000000002e-173 < b

    1. Initial program 18.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. *-commutative18.7%

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

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

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

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

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

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

Alternative 3: 79.9% accurate, 1.0× speedup?

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

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

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

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


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

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

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

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

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

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

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

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

    if -4.40000000000000024e-89 < b < 6.0000000000000002e-173

    1. Initial program 76.6%

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

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

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

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

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

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

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

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

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

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

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

    if 6.0000000000000002e-173 < b

    1. Initial program 18.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. *-commutative18.7%

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

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

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

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

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

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

Alternative 4: 68.3% accurate, 9.7× speedup?

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

    1. Initial program 78.8%

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

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

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

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

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

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

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

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

    if -9.999999999999969e-311 < b

    1. Initial program 28.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. *-commutative28.0%

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

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

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

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

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

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

Alternative 5: 43.5% accurate, 12.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq 13.6:\\
\;\;\;\;\frac{b}{-a}\\

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


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

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

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

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

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

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

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

    if 13.5999999999999996 < b

    1. Initial program 11.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. *-commutative11.2%

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

      \[\leadsto \frac{\color{blue}{-2 \cdot \frac{a \cdot c}{b}}}{a \cdot 2} \]
    6. Step-by-step derivation
      1. clear-num77.3%

        \[\leadsto \color{blue}{\frac{1}{\frac{a \cdot 2}{-2 \cdot \frac{a \cdot c}{b}}}} \]
      2. inv-pow77.3%

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

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

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

        \[\leadsto {\left(\color{blue}{-1} \cdot \frac{a}{\frac{a \cdot c}{b}}\right)}^{-1} \]
      6. associate-/l*80.4%

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

      \[\leadsto \color{blue}{{\left(-1 \cdot \frac{a}{a \cdot \frac{c}{b}}\right)}^{-1}} \]
    8. Step-by-step derivation
      1. unpow-180.4%

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

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

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

      \[\leadsto \color{blue}{\frac{1}{\frac{-a}{a \cdot \frac{c}{b}}}} \]
    10. Step-by-step derivation
      1. clear-num82.1%

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

        \[\leadsto \color{blue}{a \cdot \frac{\frac{c}{b}}{-a}} \]
      3. add-sqr-sqrt39.9%

        \[\leadsto a \cdot \frac{\frac{c}{b}}{\color{blue}{\sqrt{-a} \cdot \sqrt{-a}}} \]
      4. sqrt-unprod37.6%

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

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

        \[\leadsto a \cdot \frac{\frac{c}{b}}{\color{blue}{\sqrt{a} \cdot \sqrt{a}}} \]
      7. add-sqr-sqrt32.9%

        \[\leadsto a \cdot \frac{\frac{c}{b}}{\color{blue}{a}} \]
    11. Applied egg-rr32.9%

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

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

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

        \[\leadsto \color{blue}{1} \cdot \frac{c}{b} \]
      4. *-lft-identity32.7%

        \[\leadsto \color{blue}{\frac{c}{b}} \]
    13. Simplified32.7%

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

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

Alternative 6: 68.1% accurate, 12.9× speedup?

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

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

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


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

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

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

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

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

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

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

    if 4.00000000000000007e-294 < b

    1. Initial program 27.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. *-commutative27.3%

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

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

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

        \[\leadsto \color{blue}{\frac{-c}{b}} \]
    7. Simplified72.4%

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

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

Alternative 7: 10.9% accurate, 38.7× speedup?

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

\\
\frac{c}{b}
\end{array}
Derivation
  1. Initial program 57.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. *-commutative57.5%

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

    \[\leadsto \frac{\color{blue}{-2 \cdot \frac{a \cdot c}{b}}}{a \cdot 2} \]
  6. Step-by-step derivation
    1. clear-num24.7%

      \[\leadsto \color{blue}{\frac{1}{\frac{a \cdot 2}{-2 \cdot \frac{a \cdot c}{b}}}} \]
    2. inv-pow24.7%

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

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

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

      \[\leadsto {\left(\color{blue}{-1} \cdot \frac{a}{\frac{a \cdot c}{b}}\right)}^{-1} \]
    6. associate-/l*26.9%

      \[\leadsto {\left(-1 \cdot \frac{a}{\color{blue}{a \cdot \frac{c}{b}}}\right)}^{-1} \]
  7. Applied egg-rr26.9%

    \[\leadsto \color{blue}{{\left(-1 \cdot \frac{a}{a \cdot \frac{c}{b}}\right)}^{-1}} \]
  8. Step-by-step derivation
    1. unpow-126.9%

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

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

      \[\leadsto \frac{1}{\frac{\color{blue}{-a}}{a \cdot \frac{c}{b}}} \]
  9. Simplified26.9%

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

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

      \[\leadsto \color{blue}{a \cdot \frac{\frac{c}{b}}{-a}} \]
    3. add-sqr-sqrt14.2%

      \[\leadsto a \cdot \frac{\frac{c}{b}}{\color{blue}{\sqrt{-a} \cdot \sqrt{-a}}} \]
    4. sqrt-unprod15.2%

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

      \[\leadsto a \cdot \frac{\frac{c}{b}}{\sqrt{\color{blue}{a \cdot a}}} \]
    6. sqrt-unprod5.0%

      \[\leadsto a \cdot \frac{\frac{c}{b}}{\color{blue}{\sqrt{a} \cdot \sqrt{a}}} \]
    7. add-sqr-sqrt11.2%

      \[\leadsto a \cdot \frac{\frac{c}{b}}{\color{blue}{a}} \]
  11. Applied egg-rr11.2%

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

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

      \[\leadsto \color{blue}{\frac{a}{a} \cdot \frac{c}{b}} \]
    3. *-inverses10.9%

      \[\leadsto \color{blue}{1} \cdot \frac{c}{b} \]
    4. *-lft-identity10.9%

      \[\leadsto \color{blue}{\frac{c}{b}} \]
  13. Simplified10.9%

    \[\leadsto \color{blue}{\frac{c}{b}} \]
  14. Final simplification10.9%

    \[\leadsto \frac{c}{b} \]
  15. Add Preprocessing

Developer target: 70.5% accurate, 0.9× speedup?

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

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

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


\end{array}
\end{array}

Reproduce

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

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

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