jeff quadratic root 2

Percentage Accurate: 72.3% → 90.5%
Time: 17.7s
Alternatives: 7
Speedup: 0.9×

Specification

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

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

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


\end{array}
\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: 72.3% accurate, 1.0× speedup?

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

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

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


\end{array}
\end{array}

Alternative 1: 90.5% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)}\\ t_1 := \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - t\_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{-a}\\ \end{array}\\ t_2 := \mathsf{fma}\left(a, \frac{c}{b}, -b\right)\\ \mathbf{if}\;b \leq -6.5 \cdot 10^{+155}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;b \leq -3.8 \cdot 10^{-306}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{2 \cdot t\_2}\\ \mathbf{else}:\\ \;\;\;\;\frac{t\_0 - b}{2 \cdot a}\\ \end{array}\\ \mathbf{elif}\;b \leq 2 \cdot 10^{+83}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;b \geq 0:\\ \;\;\;\;\frac{c}{t\_2}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (sqrt (- (* b b) (* c (* 4.0 a)))))
        (t_1 (if (>= b 0.0) (/ (* 2.0 c) (- (- b) t_0)) (/ b (- a))))
        (t_2 (fma a (/ c b) (- b))))
   (if (<= b -6.5e+155)
     t_1
     (if (<= b -3.8e-306)
       (if (>= b 0.0) (/ (* 2.0 c) (* 2.0 t_2)) (/ (- t_0 b) (* 2.0 a)))
       (if (<= b 2e+83) t_1 (if (>= b 0.0) (/ c t_2) 0.0))))))
double code(double a, double b, double c) {
	double t_0 = sqrt(((b * b) - (c * (4.0 * a))));
	double tmp;
	if (b >= 0.0) {
		tmp = (2.0 * c) / (-b - t_0);
	} else {
		tmp = b / -a;
	}
	double t_1 = tmp;
	double t_2 = fma(a, (c / b), -b);
	double tmp_1;
	if (b <= -6.5e+155) {
		tmp_1 = t_1;
	} else if (b <= -3.8e-306) {
		double tmp_2;
		if (b >= 0.0) {
			tmp_2 = (2.0 * c) / (2.0 * t_2);
		} else {
			tmp_2 = (t_0 - b) / (2.0 * a);
		}
		tmp_1 = tmp_2;
	} else if (b <= 2e+83) {
		tmp_1 = t_1;
	} else if (b >= 0.0) {
		tmp_1 = c / t_2;
	} else {
		tmp_1 = 0.0;
	}
	return tmp_1;
}
function code(a, b, c)
	t_0 = sqrt(Float64(Float64(b * b) - Float64(c * Float64(4.0 * a))))
	tmp = 0.0
	if (b >= 0.0)
		tmp = Float64(Float64(2.0 * c) / Float64(Float64(-b) - t_0));
	else
		tmp = Float64(b / Float64(-a));
	end
	t_1 = tmp
	t_2 = fma(a, Float64(c / b), Float64(-b))
	tmp_1 = 0.0
	if (b <= -6.5e+155)
		tmp_1 = t_1;
	elseif (b <= -3.8e-306)
		tmp_2 = 0.0
		if (b >= 0.0)
			tmp_2 = Float64(Float64(2.0 * c) / Float64(2.0 * t_2));
		else
			tmp_2 = Float64(Float64(t_0 - b) / Float64(2.0 * a));
		end
		tmp_1 = tmp_2;
	elseif (b <= 2e+83)
		tmp_1 = t_1;
	elseif (b >= 0.0)
		tmp_1 = Float64(c / t_2);
	else
		tmp_1 = 0.0;
	end
	return tmp_1
end
code[a_, b_, c_] := Block[{t$95$0 = N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(c * N[(4.0 * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = If[GreaterEqual[b, 0.0], N[(N[(2.0 * c), $MachinePrecision] / N[((-b) - t$95$0), $MachinePrecision]), $MachinePrecision], N[(b / (-a)), $MachinePrecision]]}, Block[{t$95$2 = N[(a * N[(c / b), $MachinePrecision] + (-b)), $MachinePrecision]}, If[LessEqual[b, -6.5e+155], t$95$1, If[LessEqual[b, -3.8e-306], If[GreaterEqual[b, 0.0], N[(N[(2.0 * c), $MachinePrecision] / N[(2.0 * t$95$2), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 - b), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]], If[LessEqual[b, 2e+83], t$95$1, If[GreaterEqual[b, 0.0], N[(c / t$95$2), $MachinePrecision], 0.0]]]]]]]
\begin{array}{l}

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

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


\end{array}\\
t_2 := \mathsf{fma}\left(a, \frac{c}{b}, -b\right)\\
\mathbf{if}\;b \leq -6.5 \cdot 10^{+155}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;b \leq -3.8 \cdot 10^{-306}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot c}{2 \cdot t\_2}\\

\mathbf{else}:\\
\;\;\;\;\frac{t\_0 - b}{2 \cdot a}\\


\end{array}\\

\mathbf{elif}\;b \leq 2 \cdot 10^{+83}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;b \geq 0:\\
\;\;\;\;\frac{c}{t\_2}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if b < -6.50000000000000046e155 or -3.8e-306 < b < 2.00000000000000006e83

    1. Initial program 66.6%

      \[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. add-sqr-sqrt66.6%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}} \cdot \sqrt{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}}{2 \cdot a}\\ \end{array} \]
      2. pow266.6%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + {\left(\sqrt{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\right)}^{2}}{2 \cdot a}\\ \end{array} \]
      3. pow1/266.6%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + {\left(\sqrt{{\left(b \cdot b - \left(4 \cdot a\right) \cdot c\right)}^{0.5}}\right)}^{2}}{2 \cdot a}\\ \end{array} \]
      4. sqrt-pow166.6%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + {\left({\left(b \cdot b - \left(4 \cdot a\right) \cdot c\right)}^{\left(\frac{0.5}{2}\right)}\right)}^{2}}{2 \cdot a}\\ \end{array} \]
      5. fmm-def66.8%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + {\left({\left(\mathsf{fma}\left(b, b, -\left(4 \cdot a\right) \cdot c\right)\right)}^{\left(\frac{0.5}{2}\right)}\right)}^{2}}{2 \cdot a}\\ \end{array} \]
      6. *-commutative66.8%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + {\left({\left(\mathsf{fma}\left(b, b, -c \cdot \left(4 \cdot a\right)\right)\right)}^{\left(\frac{0.5}{2}\right)}\right)}^{2}}{2 \cdot a}\\ \end{array} \]
      7. distribute-rgt-neg-in66.8%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + {\left({\left(\mathsf{fma}\left(b, b, c \cdot \left(-4 \cdot a\right)\right)\right)}^{\left(\frac{0.5}{2}\right)}\right)}^{2}}{2 \cdot a}\\ \end{array} \]
      8. distribute-lft-neg-in66.8%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + {\left({\left(\mathsf{fma}\left(b, b, c \cdot \left(\left(-4\right) \cdot a\right)\right)\right)}^{\left(\frac{0.5}{2}\right)}\right)}^{2}}{2 \cdot a}\\ \end{array} \]
      9. metadata-eval66.8%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + {\left({\left(\mathsf{fma}\left(b, b, c \cdot \left(-4 \cdot a\right)\right)\right)}^{\left(\frac{0.5}{2}\right)}\right)}^{2}}{2 \cdot a}\\ \end{array} \]
      10. *-commutative66.8%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + {\left({\left(\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)\right)}^{\left(\frac{0.5}{2}\right)}\right)}^{2}}{2 \cdot a}\\ \end{array} \]
      11. metadata-eval66.8%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + {\left({\left(\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)\right)}^{0.25}\right)}^{2}}{2 \cdot a}\\ \end{array} \]
    4. Applied egg-rr66.8%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + {\left({\left(\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)\right)}^{0.25}\right)}^{2}}{2 \cdot a}\\ \end{array} \]
    5. Taylor expanded in b around -inf 92.3%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;-1 \cdot \frac{b}{a}\\ \end{array} \]
    6. Step-by-step derivation
      1. associate-*r/92.3%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1 \cdot b}{a}\\ \end{array} \]
      2. neg-mul-192.3%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{-b}{a}\\ \end{array} \]
    7. Simplified92.3%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{-b}{a}\\ \end{array} \]

    if -6.50000000000000046e155 < b < -3.8e-306

    1. Initial program 89.9%

      \[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
    2. Add Preprocessing
    3. Taylor expanded in a around 0 89.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\color{blue}{2 \cdot \frac{a \cdot c}{b} - 2 \cdot b}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
    4. Step-by-step derivation
      1. distribute-lft-out--89.9%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\color{blue}{2 \cdot \left(\frac{a \cdot c}{b} - b\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
      2. associate-/l*89.9%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{2 \cdot \left(\color{blue}{a \cdot \frac{c}{b}} - b\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
      3. fmm-def89.9%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{2 \cdot \color{blue}{\mathsf{fma}\left(a, \frac{c}{b}, -b\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
    5. Simplified89.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\color{blue}{2 \cdot \mathsf{fma}\left(a, \frac{c}{b}, -b\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]

    if 2.00000000000000006e83 < b

    1. Initial program 56.2%

      \[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
    2. Simplified56.2%

      \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;b \geq 0:\\ \;\;\;\;c \cdot \frac{-2}{b + \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{b - \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}}{a \cdot -2}\\ } \end{array}} \]
    3. Add Preprocessing
    4. Taylor expanded in c around 0 93.2%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;c \cdot \frac{-2}{\color{blue}{-2 \cdot \frac{a \cdot c}{b} + 2 \cdot b}}\\ \mathbf{else}:\\ \;\;\;\;\frac{b - \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}}{a \cdot -2}\\ \end{array} \]
    5. Step-by-step derivation
      1. fma-define93.2%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;c \cdot \frac{-2}{\color{blue}{\mathsf{fma}\left(-2, \frac{a \cdot c}{b}, 2 \cdot b\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{b - \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}}{a \cdot -2}\\ \end{array} \]
      2. associate-/l*99.7%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;c \cdot \frac{-2}{\mathsf{fma}\left(-2, \color{blue}{a \cdot \frac{c}{b}}, 2 \cdot b\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{b - \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}}{a \cdot -2}\\ \end{array} \]
      3. *-commutative99.7%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;c \cdot \frac{-2}{\mathsf{fma}\left(-2, a \cdot \frac{c}{b}, \color{blue}{b \cdot 2}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{b - \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}}{a \cdot -2}\\ \end{array} \]
    6. Simplified99.7%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;c \cdot \frac{-2}{\color{blue}{\mathsf{fma}\left(-2, a \cdot \frac{c}{b}, b \cdot 2\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{b - \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}}{a \cdot -2}\\ \end{array} \]
    7. Taylor expanded in c around 0 99.7%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;c \cdot \frac{-2}{\mathsf{fma}\left(-2, a \cdot \frac{c}{b}, b \cdot 2\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{b - b}{a \cdot -2}\\ \end{array} \]
    8. Taylor expanded in b around 0 93.4%

      \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{-2 \cdot \frac{a \cdot c}{b} + 2 \cdot b}\\ \mathbf{else}:\\ \;\;\;\;0\\ } \end{array}} \]
    9. Step-by-step derivation
      1. metadata-eval93.4%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{-2 \cdot \frac{a \cdot c}{b} + \color{blue}{\left(--2\right)} \cdot b}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
      2. cancel-sign-sub-inv93.4%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\color{blue}{-2 \cdot \frac{a \cdot c}{b} - -2 \cdot b}}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
      3. associate-*r/93.4%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\color{blue}{\frac{-2 \cdot c}{-2 \cdot \frac{a \cdot c}{b} - -2 \cdot b}}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
      4. distribute-lft-out--93.4%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-2 \cdot c}{\color{blue}{-2 \cdot \left(\frac{a \cdot c}{b} - b\right)}}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
      5. associate-/l*100.0%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-2 \cdot c}{-2 \cdot \left(\color{blue}{a \cdot \frac{c}{b}} - b\right)}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
      6. fmm-undef100.0%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-2 \cdot c}{-2 \cdot \color{blue}{\mathsf{fma}\left(a, \frac{c}{b}, -b\right)}}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
      7. times-frac100.0%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\color{blue}{\frac{-2}{-2} \cdot \frac{c}{\mathsf{fma}\left(a, \frac{c}{b}, -b\right)}}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
      8. metadata-eval100.0%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\color{blue}{1} \cdot \frac{c}{\mathsf{fma}\left(a, \frac{c}{b}, -b\right)}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
    10. Simplified100.0%

      \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;b \geq 0:\\ \;\;\;\;1 \cdot \frac{c}{\mathsf{fma}\left(a, \frac{c}{b}, -b\right)}\\ \mathbf{else}:\\ \;\;\;\;0\\ } \end{array}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification93.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -6.5 \cdot 10^{+155}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{-a}\\ \end{array}\\ \mathbf{elif}\;b \leq -3.8 \cdot 10^{-306}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{2 \cdot \mathsf{fma}\left(a, \frac{c}{b}, -b\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)} - b}{2 \cdot a}\\ \end{array}\\ \mathbf{elif}\;b \leq 2 \cdot 10^{+83}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{-a}\\ \end{array}\\ \mathbf{elif}\;b \geq 0:\\ \;\;\;\;\frac{c}{\mathsf{fma}\left(a, \frac{c}{b}, -b\right)}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 90.4% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)}\\ t_1 := \mathsf{fma}\left(a, \frac{c}{b}, -b\right)\\ t_2 := \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - t\_0}\\ \mathbf{else}:\\ \;\;\;\;b \cdot \left(\frac{c}{{b}^{2}} + \frac{-1}{a}\right)\\ \end{array}\\ \mathbf{if}\;b \leq -6.5 \cdot 10^{+155}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;b \leq 1.4 \cdot 10^{-306}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{2 \cdot t\_1}\\ \mathbf{else}:\\ \;\;\;\;\frac{t\_0 - b}{2 \cdot a}\\ \end{array}\\ \mathbf{elif}\;b \leq 5 \cdot 10^{+79}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;b \geq 0:\\ \;\;\;\;\frac{c}{t\_1}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (sqrt (- (* b b) (* c (* 4.0 a)))))
        (t_1 (fma a (/ c b) (- b)))
        (t_2
         (if (>= b 0.0)
           (/ (* 2.0 c) (- (- b) t_0))
           (* b (+ (/ c (pow b 2.0)) (/ -1.0 a))))))
   (if (<= b -6.5e+155)
     t_2
     (if (<= b 1.4e-306)
       (if (>= b 0.0) (/ (* 2.0 c) (* 2.0 t_1)) (/ (- t_0 b) (* 2.0 a)))
       (if (<= b 5e+79) t_2 (if (>= b 0.0) (/ c t_1) 0.0))))))
double code(double a, double b, double c) {
	double t_0 = sqrt(((b * b) - (c * (4.0 * a))));
	double t_1 = fma(a, (c / b), -b);
	double tmp;
	if (b >= 0.0) {
		tmp = (2.0 * c) / (-b - t_0);
	} else {
		tmp = b * ((c / pow(b, 2.0)) + (-1.0 / a));
	}
	double t_2 = tmp;
	double tmp_1;
	if (b <= -6.5e+155) {
		tmp_1 = t_2;
	} else if (b <= 1.4e-306) {
		double tmp_2;
		if (b >= 0.0) {
			tmp_2 = (2.0 * c) / (2.0 * t_1);
		} else {
			tmp_2 = (t_0 - b) / (2.0 * a);
		}
		tmp_1 = tmp_2;
	} else if (b <= 5e+79) {
		tmp_1 = t_2;
	} else if (b >= 0.0) {
		tmp_1 = c / t_1;
	} else {
		tmp_1 = 0.0;
	}
	return tmp_1;
}
function code(a, b, c)
	t_0 = sqrt(Float64(Float64(b * b) - Float64(c * Float64(4.0 * a))))
	t_1 = fma(a, Float64(c / b), Float64(-b))
	tmp = 0.0
	if (b >= 0.0)
		tmp = Float64(Float64(2.0 * c) / Float64(Float64(-b) - t_0));
	else
		tmp = Float64(b * Float64(Float64(c / (b ^ 2.0)) + Float64(-1.0 / a)));
	end
	t_2 = tmp
	tmp_1 = 0.0
	if (b <= -6.5e+155)
		tmp_1 = t_2;
	elseif (b <= 1.4e-306)
		tmp_2 = 0.0
		if (b >= 0.0)
			tmp_2 = Float64(Float64(2.0 * c) / Float64(2.0 * t_1));
		else
			tmp_2 = Float64(Float64(t_0 - b) / Float64(2.0 * a));
		end
		tmp_1 = tmp_2;
	elseif (b <= 5e+79)
		tmp_1 = t_2;
	elseif (b >= 0.0)
		tmp_1 = Float64(c / t_1);
	else
		tmp_1 = 0.0;
	end
	return tmp_1
end
code[a_, b_, c_] := Block[{t$95$0 = N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(c * N[(4.0 * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(a * N[(c / b), $MachinePrecision] + (-b)), $MachinePrecision]}, Block[{t$95$2 = If[GreaterEqual[b, 0.0], N[(N[(2.0 * c), $MachinePrecision] / N[((-b) - t$95$0), $MachinePrecision]), $MachinePrecision], N[(b * N[(N[(c / N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision] + N[(-1.0 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]}, If[LessEqual[b, -6.5e+155], t$95$2, If[LessEqual[b, 1.4e-306], If[GreaterEqual[b, 0.0], N[(N[(2.0 * c), $MachinePrecision] / N[(2.0 * t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 - b), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]], If[LessEqual[b, 5e+79], t$95$2, If[GreaterEqual[b, 0.0], N[(c / t$95$1), $MachinePrecision], 0.0]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)}\\
t_1 := \mathsf{fma}\left(a, \frac{c}{b}, -b\right)\\
t_2 := \begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) - t\_0}\\

\mathbf{else}:\\
\;\;\;\;b \cdot \left(\frac{c}{{b}^{2}} + \frac{-1}{a}\right)\\


\end{array}\\
\mathbf{if}\;b \leq -6.5 \cdot 10^{+155}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;b \leq 1.4 \cdot 10^{-306}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot c}{2 \cdot t\_1}\\

\mathbf{else}:\\
\;\;\;\;\frac{t\_0 - b}{2 \cdot a}\\


\end{array}\\

\mathbf{elif}\;b \leq 5 \cdot 10^{+79}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;b \geq 0:\\
\;\;\;\;\frac{c}{t\_1}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if b < -6.50000000000000046e155 or 1.4000000000000001e-306 < b < 5e79

    1. Initial program 67.8%

      \[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. add-sqr-sqrt67.8%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}} \cdot \sqrt{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}}{2 \cdot a}\\ \end{array} \]
      2. pow267.8%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + {\left(\sqrt{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\right)}^{2}}{2 \cdot a}\\ \end{array} \]
      3. pow1/267.8%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + {\left(\sqrt{{\left(b \cdot b - \left(4 \cdot a\right) \cdot c\right)}^{0.5}}\right)}^{2}}{2 \cdot a}\\ \end{array} \]
      4. sqrt-pow167.8%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + {\left({\left(b \cdot b - \left(4 \cdot a\right) \cdot c\right)}^{\left(\frac{0.5}{2}\right)}\right)}^{2}}{2 \cdot a}\\ \end{array} \]
      5. fmm-def67.9%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + {\left({\left(\mathsf{fma}\left(b, b, -\left(4 \cdot a\right) \cdot c\right)\right)}^{\left(\frac{0.5}{2}\right)}\right)}^{2}}{2 \cdot a}\\ \end{array} \]
      6. *-commutative67.9%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + {\left({\left(\mathsf{fma}\left(b, b, -c \cdot \left(4 \cdot a\right)\right)\right)}^{\left(\frac{0.5}{2}\right)}\right)}^{2}}{2 \cdot a}\\ \end{array} \]
      7. distribute-rgt-neg-in67.9%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + {\left({\left(\mathsf{fma}\left(b, b, c \cdot \left(-4 \cdot a\right)\right)\right)}^{\left(\frac{0.5}{2}\right)}\right)}^{2}}{2 \cdot a}\\ \end{array} \]
      8. distribute-lft-neg-in67.9%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + {\left({\left(\mathsf{fma}\left(b, b, c \cdot \left(\left(-4\right) \cdot a\right)\right)\right)}^{\left(\frac{0.5}{2}\right)}\right)}^{2}}{2 \cdot a}\\ \end{array} \]
      9. metadata-eval67.9%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + {\left({\left(\mathsf{fma}\left(b, b, c \cdot \left(-4 \cdot a\right)\right)\right)}^{\left(\frac{0.5}{2}\right)}\right)}^{2}}{2 \cdot a}\\ \end{array} \]
      10. *-commutative67.9%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + {\left({\left(\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)\right)}^{\left(\frac{0.5}{2}\right)}\right)}^{2}}{2 \cdot a}\\ \end{array} \]
      11. metadata-eval67.9%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + {\left({\left(\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)\right)}^{0.25}\right)}^{2}}{2 \cdot a}\\ \end{array} \]
    4. Applied egg-rr67.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + {\left({\left(\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)\right)}^{0.25}\right)}^{2}}{2 \cdot a}\\ \end{array} \]
    5. Taylor expanded in b around -inf 94.0%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;-1 \cdot \left(b \cdot \left(-1 \cdot \frac{c}{{b}^{2}} + \frac{1}{a}\right)\right)\\ \end{array} \]

    if -6.50000000000000046e155 < b < 1.4000000000000001e-306

    1. Initial program 88.0%

      \[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
    2. Add Preprocessing
    3. Taylor expanded in a around 0 88.0%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\color{blue}{2 \cdot \frac{a \cdot c}{b} - 2 \cdot b}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
    4. Step-by-step derivation
      1. distribute-lft-out--88.0%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\color{blue}{2 \cdot \left(\frac{a \cdot c}{b} - b\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
      2. associate-/l*88.0%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{2 \cdot \left(\color{blue}{a \cdot \frac{c}{b}} - b\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
      3. fmm-def88.0%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{2 \cdot \color{blue}{\mathsf{fma}\left(a, \frac{c}{b}, -b\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
    5. Simplified88.0%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\color{blue}{2 \cdot \mathsf{fma}\left(a, \frac{c}{b}, -b\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]

    if 5e79 < b

    1. Initial program 56.2%

      \[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
    2. Simplified56.2%

      \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;b \geq 0:\\ \;\;\;\;c \cdot \frac{-2}{b + \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{b - \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}}{a \cdot -2}\\ } \end{array}} \]
    3. Add Preprocessing
    4. Taylor expanded in c around 0 93.2%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;c \cdot \frac{-2}{\color{blue}{-2 \cdot \frac{a \cdot c}{b} + 2 \cdot b}}\\ \mathbf{else}:\\ \;\;\;\;\frac{b - \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}}{a \cdot -2}\\ \end{array} \]
    5. Step-by-step derivation
      1. fma-define93.2%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;c \cdot \frac{-2}{\color{blue}{\mathsf{fma}\left(-2, \frac{a \cdot c}{b}, 2 \cdot b\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{b - \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}}{a \cdot -2}\\ \end{array} \]
      2. associate-/l*99.7%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;c \cdot \frac{-2}{\mathsf{fma}\left(-2, \color{blue}{a \cdot \frac{c}{b}}, 2 \cdot b\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{b - \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}}{a \cdot -2}\\ \end{array} \]
      3. *-commutative99.7%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;c \cdot \frac{-2}{\mathsf{fma}\left(-2, a \cdot \frac{c}{b}, \color{blue}{b \cdot 2}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{b - \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}}{a \cdot -2}\\ \end{array} \]
    6. Simplified99.7%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;c \cdot \frac{-2}{\color{blue}{\mathsf{fma}\left(-2, a \cdot \frac{c}{b}, b \cdot 2\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{b - \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}}{a \cdot -2}\\ \end{array} \]
    7. Taylor expanded in c around 0 99.7%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;c \cdot \frac{-2}{\mathsf{fma}\left(-2, a \cdot \frac{c}{b}, b \cdot 2\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{b - b}{a \cdot -2}\\ \end{array} \]
    8. Taylor expanded in b around 0 93.4%

      \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{-2 \cdot \frac{a \cdot c}{b} + 2 \cdot b}\\ \mathbf{else}:\\ \;\;\;\;0\\ } \end{array}} \]
    9. Step-by-step derivation
      1. metadata-eval93.4%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{-2 \cdot \frac{a \cdot c}{b} + \color{blue}{\left(--2\right)} \cdot b}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
      2. cancel-sign-sub-inv93.4%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\color{blue}{-2 \cdot \frac{a \cdot c}{b} - -2 \cdot b}}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
      3. associate-*r/93.4%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\color{blue}{\frac{-2 \cdot c}{-2 \cdot \frac{a \cdot c}{b} - -2 \cdot b}}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
      4. distribute-lft-out--93.4%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-2 \cdot c}{\color{blue}{-2 \cdot \left(\frac{a \cdot c}{b} - b\right)}}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
      5. associate-/l*100.0%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-2 \cdot c}{-2 \cdot \left(\color{blue}{a \cdot \frac{c}{b}} - b\right)}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
      6. fmm-undef100.0%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-2 \cdot c}{-2 \cdot \color{blue}{\mathsf{fma}\left(a, \frac{c}{b}, -b\right)}}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
      7. times-frac100.0%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\color{blue}{\frac{-2}{-2} \cdot \frac{c}{\mathsf{fma}\left(a, \frac{c}{b}, -b\right)}}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
      8. metadata-eval100.0%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\color{blue}{1} \cdot \frac{c}{\mathsf{fma}\left(a, \frac{c}{b}, -b\right)}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
    10. Simplified100.0%

      \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;b \geq 0:\\ \;\;\;\;1 \cdot \frac{c}{\mathsf{fma}\left(a, \frac{c}{b}, -b\right)}\\ \mathbf{else}:\\ \;\;\;\;0\\ } \end{array}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification93.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -6.5 \cdot 10^{+155}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)}}\\ \mathbf{else}:\\ \;\;\;\;b \cdot \left(\frac{c}{{b}^{2}} + \frac{-1}{a}\right)\\ \end{array}\\ \mathbf{elif}\;b \leq 1.4 \cdot 10^{-306}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{2 \cdot \mathsf{fma}\left(a, \frac{c}{b}, -b\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)} - b}{2 \cdot a}\\ \end{array}\\ \mathbf{elif}\;b \leq 5 \cdot 10^{+79}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)}}\\ \mathbf{else}:\\ \;\;\;\;b \cdot \left(\frac{c}{{b}^{2}} + \frac{-1}{a}\right)\\ \end{array}\\ \mathbf{elif}\;b \geq 0:\\ \;\;\;\;\frac{c}{\mathsf{fma}\left(a, \frac{c}{b}, -b\right)}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 90.6% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)}\\ t_1 := \frac{2 \cdot c}{\left(-b\right) - t\_0}\\ \mathbf{if}\;b \leq -6.5 \cdot 10^{+155}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{-a}\\ \end{array}\\ \mathbf{elif}\;b \leq 3.3 \cdot 10^{+83}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;\frac{t\_0 - b}{2 \cdot a}\\ \end{array}\\ \mathbf{elif}\;b \geq 0:\\ \;\;\;\;\frac{c}{\mathsf{fma}\left(a, \frac{c}{b}, -b\right)}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (sqrt (- (* b b) (* c (* 4.0 a)))))
        (t_1 (/ (* 2.0 c) (- (- b) t_0))))
   (if (<= b -6.5e+155)
     (if (>= b 0.0) t_1 (/ b (- a)))
     (if (<= b 3.3e+83)
       (if (>= b 0.0) t_1 (/ (- t_0 b) (* 2.0 a)))
       (if (>= b 0.0) (/ c (fma a (/ c b) (- b))) 0.0)))))
double code(double a, double b, double c) {
	double t_0 = sqrt(((b * b) - (c * (4.0 * a))));
	double t_1 = (2.0 * c) / (-b - t_0);
	double tmp_1;
	if (b <= -6.5e+155) {
		double tmp_2;
		if (b >= 0.0) {
			tmp_2 = t_1;
		} else {
			tmp_2 = b / -a;
		}
		tmp_1 = tmp_2;
	} else if (b <= 3.3e+83) {
		double tmp_3;
		if (b >= 0.0) {
			tmp_3 = t_1;
		} else {
			tmp_3 = (t_0 - b) / (2.0 * a);
		}
		tmp_1 = tmp_3;
	} else if (b >= 0.0) {
		tmp_1 = c / fma(a, (c / b), -b);
	} else {
		tmp_1 = 0.0;
	}
	return tmp_1;
}
function code(a, b, c)
	t_0 = sqrt(Float64(Float64(b * b) - Float64(c * Float64(4.0 * a))))
	t_1 = Float64(Float64(2.0 * c) / Float64(Float64(-b) - t_0))
	tmp_1 = 0.0
	if (b <= -6.5e+155)
		tmp_2 = 0.0
		if (b >= 0.0)
			tmp_2 = t_1;
		else
			tmp_2 = Float64(b / Float64(-a));
		end
		tmp_1 = tmp_2;
	elseif (b <= 3.3e+83)
		tmp_3 = 0.0
		if (b >= 0.0)
			tmp_3 = t_1;
		else
			tmp_3 = Float64(Float64(t_0 - b) / Float64(2.0 * a));
		end
		tmp_1 = tmp_3;
	elseif (b >= 0.0)
		tmp_1 = Float64(c / fma(a, Float64(c / b), Float64(-b)));
	else
		tmp_1 = 0.0;
	end
	return tmp_1
end
code[a_, b_, c_] := Block[{t$95$0 = N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(c * N[(4.0 * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(2.0 * c), $MachinePrecision] / N[((-b) - t$95$0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -6.5e+155], If[GreaterEqual[b, 0.0], t$95$1, N[(b / (-a)), $MachinePrecision]], If[LessEqual[b, 3.3e+83], If[GreaterEqual[b, 0.0], t$95$1, N[(N[(t$95$0 - b), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]], If[GreaterEqual[b, 0.0], N[(c / N[(a * N[(c / b), $MachinePrecision] + (-b)), $MachinePrecision]), $MachinePrecision], 0.0]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)}\\
t_1 := \frac{2 \cdot c}{\left(-b\right) - t\_0}\\
\mathbf{if}\;b \leq -6.5 \cdot 10^{+155}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;t\_1\\

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


\end{array}\\

\mathbf{elif}\;b \leq 3.3 \cdot 10^{+83}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;t\_1\\

\mathbf{else}:\\
\;\;\;\;\frac{t\_0 - b}{2 \cdot a}\\


\end{array}\\

\mathbf{elif}\;b \geq 0:\\
\;\;\;\;\frac{c}{\mathsf{fma}\left(a, \frac{c}{b}, -b\right)}\\

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


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

    1. Initial program 36.3%

      \[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. add-sqr-sqrt36.3%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}} \cdot \sqrt{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}}{2 \cdot a}\\ \end{array} \]
      2. pow236.3%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + {\left(\sqrt{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\right)}^{2}}{2 \cdot a}\\ \end{array} \]
      3. pow1/236.3%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + {\left(\sqrt{{\left(b \cdot b - \left(4 \cdot a\right) \cdot c\right)}^{0.5}}\right)}^{2}}{2 \cdot a}\\ \end{array} \]
      4. sqrt-pow136.3%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + {\left({\left(b \cdot b - \left(4 \cdot a\right) \cdot c\right)}^{\left(\frac{0.5}{2}\right)}\right)}^{2}}{2 \cdot a}\\ \end{array} \]
      5. fmm-def36.6%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + {\left({\left(\mathsf{fma}\left(b, b, -\left(4 \cdot a\right) \cdot c\right)\right)}^{\left(\frac{0.5}{2}\right)}\right)}^{2}}{2 \cdot a}\\ \end{array} \]
      6. *-commutative36.6%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + {\left({\left(\mathsf{fma}\left(b, b, -c \cdot \left(4 \cdot a\right)\right)\right)}^{\left(\frac{0.5}{2}\right)}\right)}^{2}}{2 \cdot a}\\ \end{array} \]
      7. distribute-rgt-neg-in36.6%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + {\left({\left(\mathsf{fma}\left(b, b, c \cdot \left(-4 \cdot a\right)\right)\right)}^{\left(\frac{0.5}{2}\right)}\right)}^{2}}{2 \cdot a}\\ \end{array} \]
      8. distribute-lft-neg-in36.6%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + {\left({\left(\mathsf{fma}\left(b, b, c \cdot \left(\left(-4\right) \cdot a\right)\right)\right)}^{\left(\frac{0.5}{2}\right)}\right)}^{2}}{2 \cdot a}\\ \end{array} \]
      9. metadata-eval36.6%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + {\left({\left(\mathsf{fma}\left(b, b, c \cdot \left(-4 \cdot a\right)\right)\right)}^{\left(\frac{0.5}{2}\right)}\right)}^{2}}{2 \cdot a}\\ \end{array} \]
      10. *-commutative36.6%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + {\left({\left(\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)\right)}^{\left(\frac{0.5}{2}\right)}\right)}^{2}}{2 \cdot a}\\ \end{array} \]
      11. metadata-eval36.6%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + {\left({\left(\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)\right)}^{0.25}\right)}^{2}}{2 \cdot a}\\ \end{array} \]
    4. Applied egg-rr36.6%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + {\left({\left(\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)\right)}^{0.25}\right)}^{2}}{2 \cdot a}\\ \end{array} \]
    5. Taylor expanded in b around -inf 98.0%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;-1 \cdot \frac{b}{a}\\ \end{array} \]
    6. Step-by-step derivation
      1. associate-*r/98.0%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1 \cdot b}{a}\\ \end{array} \]
      2. neg-mul-198.0%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{-b}{a}\\ \end{array} \]
    7. Simplified98.0%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{-b}{a}\\ \end{array} \]

    if -6.50000000000000046e155 < b < 3.29999999999999985e83

    1. Initial program 89.2%

      \[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
    2. Add Preprocessing

    if 3.29999999999999985e83 < b

    1. Initial program 56.2%

      \[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
    2. Simplified56.2%

      \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;b \geq 0:\\ \;\;\;\;c \cdot \frac{-2}{b + \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{b - \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}}{a \cdot -2}\\ } \end{array}} \]
    3. Add Preprocessing
    4. Taylor expanded in c around 0 93.2%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;c \cdot \frac{-2}{\color{blue}{-2 \cdot \frac{a \cdot c}{b} + 2 \cdot b}}\\ \mathbf{else}:\\ \;\;\;\;\frac{b - \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}}{a \cdot -2}\\ \end{array} \]
    5. Step-by-step derivation
      1. fma-define93.2%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;c \cdot \frac{-2}{\color{blue}{\mathsf{fma}\left(-2, \frac{a \cdot c}{b}, 2 \cdot b\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{b - \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}}{a \cdot -2}\\ \end{array} \]
      2. associate-/l*99.7%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;c \cdot \frac{-2}{\mathsf{fma}\left(-2, \color{blue}{a \cdot \frac{c}{b}}, 2 \cdot b\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{b - \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}}{a \cdot -2}\\ \end{array} \]
      3. *-commutative99.7%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;c \cdot \frac{-2}{\mathsf{fma}\left(-2, a \cdot \frac{c}{b}, \color{blue}{b \cdot 2}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{b - \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}}{a \cdot -2}\\ \end{array} \]
    6. Simplified99.7%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;c \cdot \frac{-2}{\color{blue}{\mathsf{fma}\left(-2, a \cdot \frac{c}{b}, b \cdot 2\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{b - \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}}{a \cdot -2}\\ \end{array} \]
    7. Taylor expanded in c around 0 99.7%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;c \cdot \frac{-2}{\mathsf{fma}\left(-2, a \cdot \frac{c}{b}, b \cdot 2\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{b - b}{a \cdot -2}\\ \end{array} \]
    8. Taylor expanded in b around 0 93.4%

      \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{-2 \cdot \frac{a \cdot c}{b} + 2 \cdot b}\\ \mathbf{else}:\\ \;\;\;\;0\\ } \end{array}} \]
    9. Step-by-step derivation
      1. metadata-eval93.4%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{-2 \cdot \frac{a \cdot c}{b} + \color{blue}{\left(--2\right)} \cdot b}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
      2. cancel-sign-sub-inv93.4%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\color{blue}{-2 \cdot \frac{a \cdot c}{b} - -2 \cdot b}}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
      3. associate-*r/93.4%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\color{blue}{\frac{-2 \cdot c}{-2 \cdot \frac{a \cdot c}{b} - -2 \cdot b}}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
      4. distribute-lft-out--93.4%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-2 \cdot c}{\color{blue}{-2 \cdot \left(\frac{a \cdot c}{b} - b\right)}}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
      5. associate-/l*100.0%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-2 \cdot c}{-2 \cdot \left(\color{blue}{a \cdot \frac{c}{b}} - b\right)}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
      6. fmm-undef100.0%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-2 \cdot c}{-2 \cdot \color{blue}{\mathsf{fma}\left(a, \frac{c}{b}, -b\right)}}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
      7. times-frac100.0%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\color{blue}{\frac{-2}{-2} \cdot \frac{c}{\mathsf{fma}\left(a, \frac{c}{b}, -b\right)}}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
      8. metadata-eval100.0%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\color{blue}{1} \cdot \frac{c}{\mathsf{fma}\left(a, \frac{c}{b}, -b\right)}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
    10. Simplified100.0%

      \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;b \geq 0:\\ \;\;\;\;1 \cdot \frac{c}{\mathsf{fma}\left(a, \frac{c}{b}, -b\right)}\\ \mathbf{else}:\\ \;\;\;\;0\\ } \end{array}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification93.2%

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

Alternative 4: 70.2% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{2 \cdot \mathsf{fma}\left(a, \frac{c}{b}, -b\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)} - b}{2 \cdot a}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (>= b 0.0)
   (/ (* 2.0 c) (* 2.0 (fma a (/ c b) (- b))))
   (/ (- (sqrt (- (* b b) (* c (* 4.0 a)))) b) (* 2.0 a))))
double code(double a, double b, double c) {
	double tmp;
	if (b >= 0.0) {
		tmp = (2.0 * c) / (2.0 * fma(a, (c / b), -b));
	} else {
		tmp = (sqrt(((b * b) - (c * (4.0 * a)))) - b) / (2.0 * a);
	}
	return tmp;
}
function code(a, b, c)
	tmp = 0.0
	if (b >= 0.0)
		tmp = Float64(Float64(2.0 * c) / Float64(2.0 * fma(a, Float64(c / b), Float64(-b))));
	else
		tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(c * Float64(4.0 * a)))) - b) / Float64(2.0 * a));
	end
	return tmp
end
code[a_, b_, c_] := If[GreaterEqual[b, 0.0], N[(N[(2.0 * c), $MachinePrecision] / N[(2.0 * N[(a * N[(c / b), $MachinePrecision] + (-b)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(c * N[(4.0 * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot c}{2 \cdot \mathsf{fma}\left(a, \frac{c}{b}, -b\right)}\\

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


\end{array}
\end{array}
Derivation
  1. Initial program 72.5%

    \[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
  2. Add Preprocessing
  3. Taylor expanded in a around 0 68.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\color{blue}{2 \cdot \frac{a \cdot c}{b} - 2 \cdot b}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
  4. Step-by-step derivation
    1. distribute-lft-out--68.6%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\color{blue}{2 \cdot \left(\frac{a \cdot c}{b} - b\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
    2. associate-/l*70.2%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{2 \cdot \left(\color{blue}{a \cdot \frac{c}{b}} - b\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
    3. fmm-def70.2%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{2 \cdot \color{blue}{\mathsf{fma}\left(a, \frac{c}{b}, -b\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
  5. Simplified70.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\color{blue}{2 \cdot \mathsf{fma}\left(a, \frac{c}{b}, -b\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
  6. Final simplification70.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{2 \cdot \mathsf{fma}\left(a, \frac{c}{b}, -b\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)} - b}{2 \cdot a}\\ \end{array} \]
  7. Add Preprocessing

Alternative 5: 35.0% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{c}{\mathsf{fma}\left(a, \frac{c}{b}, -b\right)}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (>= b 0.0) (/ c (fma a (/ c b) (- b))) 0.0))
double code(double a, double b, double c) {
	double tmp;
	if (b >= 0.0) {
		tmp = c / fma(a, (c / b), -b);
	} else {
		tmp = 0.0;
	}
	return tmp;
}
function code(a, b, c)
	tmp = 0.0
	if (b >= 0.0)
		tmp = Float64(c / fma(a, Float64(c / b), Float64(-b)));
	else
		tmp = 0.0;
	end
	return tmp
end
code[a_, b_, c_] := If[GreaterEqual[b, 0.0], N[(c / N[(a * N[(c / b), $MachinePrecision] + (-b)), $MachinePrecision]), $MachinePrecision], 0.0]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{c}{\mathsf{fma}\left(a, \frac{c}{b}, -b\right)}\\

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


\end{array}
\end{array}
Derivation
  1. Initial program 72.5%

    \[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
  2. Simplified72.5%

    \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;b \geq 0:\\ \;\;\;\;c \cdot \frac{-2}{b + \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{b - \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}}{a \cdot -2}\\ } \end{array}} \]
  3. Add Preprocessing
  4. Taylor expanded in c around 0 68.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;c \cdot \frac{-2}{\color{blue}{-2 \cdot \frac{a \cdot c}{b} + 2 \cdot b}}\\ \mathbf{else}:\\ \;\;\;\;\frac{b - \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}}{a \cdot -2}\\ \end{array} \]
  5. Step-by-step derivation
    1. fma-define68.6%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;c \cdot \frac{-2}{\color{blue}{\mathsf{fma}\left(-2, \frac{a \cdot c}{b}, 2 \cdot b\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{b - \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}}{a \cdot -2}\\ \end{array} \]
    2. associate-/l*70.2%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;c \cdot \frac{-2}{\mathsf{fma}\left(-2, \color{blue}{a \cdot \frac{c}{b}}, 2 \cdot b\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{b - \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}}{a \cdot -2}\\ \end{array} \]
    3. *-commutative70.2%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;c \cdot \frac{-2}{\mathsf{fma}\left(-2, a \cdot \frac{c}{b}, \color{blue}{b \cdot 2}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{b - \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}}{a \cdot -2}\\ \end{array} \]
  6. Simplified70.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;c \cdot \frac{-2}{\color{blue}{\mathsf{fma}\left(-2, a \cdot \frac{c}{b}, b \cdot 2\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{b - \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}}{a \cdot -2}\\ \end{array} \]
  7. Taylor expanded in c around 0 33.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;c \cdot \frac{-2}{\mathsf{fma}\left(-2, a \cdot \frac{c}{b}, b \cdot 2\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{b - b}{a \cdot -2}\\ \end{array} \]
  8. Taylor expanded in b around 0 32.0%

    \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{-2 \cdot \frac{a \cdot c}{b} + 2 \cdot b}\\ \mathbf{else}:\\ \;\;\;\;0\\ } \end{array}} \]
  9. Step-by-step derivation
    1. metadata-eval32.0%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{-2 \cdot \frac{a \cdot c}{b} + \color{blue}{\left(--2\right)} \cdot b}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
    2. cancel-sign-sub-inv32.0%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\color{blue}{-2 \cdot \frac{a \cdot c}{b} - -2 \cdot b}}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
    3. associate-*r/32.0%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\color{blue}{\frac{-2 \cdot c}{-2 \cdot \frac{a \cdot c}{b} - -2 \cdot b}}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
    4. distribute-lft-out--32.0%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-2 \cdot c}{\color{blue}{-2 \cdot \left(\frac{a \cdot c}{b} - b\right)}}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
    5. associate-/l*33.6%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-2 \cdot c}{-2 \cdot \left(\color{blue}{a \cdot \frac{c}{b}} - b\right)}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
    6. fmm-undef33.6%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-2 \cdot c}{-2 \cdot \color{blue}{\mathsf{fma}\left(a, \frac{c}{b}, -b\right)}}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
    7. times-frac33.6%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\color{blue}{\frac{-2}{-2} \cdot \frac{c}{\mathsf{fma}\left(a, \frac{c}{b}, -b\right)}}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
    8. metadata-eval33.6%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\color{blue}{1} \cdot \frac{c}{\mathsf{fma}\left(a, \frac{c}{b}, -b\right)}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
  10. Simplified33.6%

    \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;b \geq 0:\\ \;\;\;\;1 \cdot \frac{c}{\mathsf{fma}\left(a, \frac{c}{b}, -b\right)}\\ \mathbf{else}:\\ \;\;\;\;0\\ } \end{array}} \]
  11. Final simplification33.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{c}{\mathsf{fma}\left(a, \frac{c}{b}, -b\right)}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
  12. Add Preprocessing

Alternative 6: 34.9% accurate, 6.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;c \cdot \frac{-2}{-2 \cdot \left(a \cdot \frac{c}{b}\right) + b \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{b - b}{a \cdot -2}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (>= b 0.0)
   (* c (/ -2.0 (+ (* -2.0 (* a (/ c b))) (* b 2.0))))
   (/ (- b b) (* a -2.0))))
double code(double a, double b, double c) {
	double tmp;
	if (b >= 0.0) {
		tmp = c * (-2.0 / ((-2.0 * (a * (c / b))) + (b * 2.0)));
	} else {
		tmp = (b - b) / (a * -2.0);
	}
	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 >= 0.0d0) then
        tmp = c * ((-2.0d0) / (((-2.0d0) * (a * (c / b))) + (b * 2.0d0)))
    else
        tmp = (b - b) / (a * (-2.0d0))
    end if
    code = tmp
end function
public static double code(double a, double b, double c) {
	double tmp;
	if (b >= 0.0) {
		tmp = c * (-2.0 / ((-2.0 * (a * (c / b))) + (b * 2.0)));
	} else {
		tmp = (b - b) / (a * -2.0);
	}
	return tmp;
}
def code(a, b, c):
	tmp = 0
	if b >= 0.0:
		tmp = c * (-2.0 / ((-2.0 * (a * (c / b))) + (b * 2.0)))
	else:
		tmp = (b - b) / (a * -2.0)
	return tmp
function code(a, b, c)
	tmp = 0.0
	if (b >= 0.0)
		tmp = Float64(c * Float64(-2.0 / Float64(Float64(-2.0 * Float64(a * Float64(c / b))) + Float64(b * 2.0))));
	else
		tmp = Float64(Float64(b - b) / Float64(a * -2.0));
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	tmp = 0.0;
	if (b >= 0.0)
		tmp = c * (-2.0 / ((-2.0 * (a * (c / b))) + (b * 2.0)));
	else
		tmp = (b - b) / (a * -2.0);
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := If[GreaterEqual[b, 0.0], N[(c * N[(-2.0 / N[(N[(-2.0 * N[(a * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(b * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(b - b), $MachinePrecision] / N[(a * -2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;c \cdot \frac{-2}{-2 \cdot \left(a \cdot \frac{c}{b}\right) + b \cdot 2}\\

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


\end{array}
\end{array}
Derivation
  1. Initial program 72.5%

    \[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
  2. Simplified72.5%

    \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;b \geq 0:\\ \;\;\;\;c \cdot \frac{-2}{b + \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{b - \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}}{a \cdot -2}\\ } \end{array}} \]
  3. Add Preprocessing
  4. Taylor expanded in c around 0 68.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;c \cdot \frac{-2}{\color{blue}{-2 \cdot \frac{a \cdot c}{b} + 2 \cdot b}}\\ \mathbf{else}:\\ \;\;\;\;\frac{b - \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}}{a \cdot -2}\\ \end{array} \]
  5. Step-by-step derivation
    1. fma-define68.6%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;c \cdot \frac{-2}{\color{blue}{\mathsf{fma}\left(-2, \frac{a \cdot c}{b}, 2 \cdot b\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{b - \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}}{a \cdot -2}\\ \end{array} \]
    2. associate-/l*70.2%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;c \cdot \frac{-2}{\mathsf{fma}\left(-2, \color{blue}{a \cdot \frac{c}{b}}, 2 \cdot b\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{b - \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}}{a \cdot -2}\\ \end{array} \]
    3. *-commutative70.2%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;c \cdot \frac{-2}{\mathsf{fma}\left(-2, a \cdot \frac{c}{b}, \color{blue}{b \cdot 2}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{b - \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}}{a \cdot -2}\\ \end{array} \]
  6. Simplified70.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;c \cdot \frac{-2}{\color{blue}{\mathsf{fma}\left(-2, a \cdot \frac{c}{b}, b \cdot 2\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{b - \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}}{a \cdot -2}\\ \end{array} \]
  7. Taylor expanded in c around 0 33.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;c \cdot \frac{-2}{\mathsf{fma}\left(-2, a \cdot \frac{c}{b}, b \cdot 2\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{b - b}{a \cdot -2}\\ \end{array} \]
  8. Step-by-step derivation
    1. div-inv33.5%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;c \cdot \color{blue}{\left(-2 \cdot \frac{1}{\mathsf{fma}\left(-2, a \cdot \frac{c}{b}, b \cdot 2\right)}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{b - b}{a \cdot -2}\\ \end{array} \]
  9. Applied egg-rr33.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;c \cdot \color{blue}{\left(-2 \cdot \frac{1}{\mathsf{fma}\left(-2, a \cdot \frac{c}{b}, b \cdot 2\right)}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{b - b}{a \cdot -2}\\ \end{array} \]
  10. Step-by-step derivation
    1. associate-*r/33.5%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;c \cdot \color{blue}{\frac{-2 \cdot 1}{\mathsf{fma}\left(-2, a \cdot \frac{c}{b}, b \cdot 2\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{b - b}{a \cdot -2}\\ \end{array} \]
    2. metadata-eval33.5%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;c \cdot \frac{\color{blue}{-2}}{\mathsf{fma}\left(-2, a \cdot \frac{c}{b}, b \cdot 2\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{b - b}{a \cdot -2}\\ \end{array} \]
    3. associate-*r/32.0%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;c \cdot \frac{-2}{\mathsf{fma}\left(-2, \color{blue}{\frac{a \cdot c}{b}}, b \cdot 2\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{b - b}{a \cdot -2}\\ \end{array} \]
  11. Simplified32.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;c \cdot \color{blue}{\frac{-2}{\mathsf{fma}\left(-2, \frac{a \cdot c}{b}, b \cdot 2\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{b - b}{a \cdot -2}\\ \end{array} \]
  12. Step-by-step derivation
    1. fma-undefine32.0%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;c \cdot \frac{-2}{\color{blue}{-2 \cdot \frac{a \cdot c}{b} + b \cdot 2}}\\ \mathbf{else}:\\ \;\;\;\;\frac{b - b}{a \cdot -2}\\ \end{array} \]
    2. associate-*r/33.5%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;c \cdot \frac{-2}{-2 \cdot \color{blue}{\left(a \cdot \frac{c}{b}\right)} + b \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{b - b}{a \cdot -2}\\ \end{array} \]
  13. Applied egg-rr33.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;c \cdot \frac{-2}{\color{blue}{-2 \cdot \left(a \cdot \frac{c}{b}\right) + b \cdot 2}}\\ \mathbf{else}:\\ \;\;\;\;\frac{b - b}{a \cdot -2}\\ \end{array} \]
  14. Add Preprocessing

Alternative 7: 34.9% accurate, 13.4× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{c}{-b}\\

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


\end{array}
\end{array}
Derivation
  1. Initial program 72.5%

    \[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
  2. Simplified72.5%

    \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;b \geq 0:\\ \;\;\;\;c \cdot \frac{-2}{b + \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{b - \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}}{a \cdot -2}\\ } \end{array}} \]
  3. Add Preprocessing
  4. Taylor expanded in c around 0 68.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;c \cdot \frac{-2}{\color{blue}{-2 \cdot \frac{a \cdot c}{b} + 2 \cdot b}}\\ \mathbf{else}:\\ \;\;\;\;\frac{b - \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}}{a \cdot -2}\\ \end{array} \]
  5. Step-by-step derivation
    1. fma-define68.6%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;c \cdot \frac{-2}{\color{blue}{\mathsf{fma}\left(-2, \frac{a \cdot c}{b}, 2 \cdot b\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{b - \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}}{a \cdot -2}\\ \end{array} \]
    2. associate-/l*70.2%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;c \cdot \frac{-2}{\mathsf{fma}\left(-2, \color{blue}{a \cdot \frac{c}{b}}, 2 \cdot b\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{b - \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}}{a \cdot -2}\\ \end{array} \]
    3. *-commutative70.2%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;c \cdot \frac{-2}{\mathsf{fma}\left(-2, a \cdot \frac{c}{b}, \color{blue}{b \cdot 2}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{b - \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}}{a \cdot -2}\\ \end{array} \]
  6. Simplified70.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;c \cdot \frac{-2}{\color{blue}{\mathsf{fma}\left(-2, a \cdot \frac{c}{b}, b \cdot 2\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{b - \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}}{a \cdot -2}\\ \end{array} \]
  7. Taylor expanded in c around 0 33.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;c \cdot \frac{-2}{\mathsf{fma}\left(-2, a \cdot \frac{c}{b}, b \cdot 2\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{b - b}{a \cdot -2}\\ \end{array} \]
  8. Taylor expanded in a around 0 33.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;c \cdot \color{blue}{\frac{-1}{b}}\\ \mathbf{else}:\\ \;\;\;\;\frac{b - b}{a \cdot -2}\\ \end{array} \]
  9. Taylor expanded in b around 0 33.2%

    \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;b \geq 0:\\ \;\;\;\;-1 \cdot \frac{c}{b}\\ \mathbf{else}:\\ \;\;\;\;0\\ } \end{array}} \]
  10. Step-by-step derivation
    1. associate-*r/33.2%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\color{blue}{\frac{-1 \cdot c}{b}}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
    2. neg-mul-133.2%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{\color{blue}{-c}}{b}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
  11. Simplified33.2%

    \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-c}{b}\\ \mathbf{else}:\\ \;\;\;\;0\\ } \end{array}} \]
  12. Final simplification33.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{c}{-b}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
  13. Add Preprocessing

Reproduce

?
herbie shell --seed 2024149 
(FPCore (a b c)
  :name "jeff quadratic root 2"
  :precision binary64
  (if (>= b 0.0) (/ (* 2.0 c) (- (- b) (sqrt (- (* b b) (* (* 4.0 a) c))))) (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a))))