jeff quadratic root 2

Percentage Accurate: 72.2% → 90.6%
Time: 29.0s
Alternatives: 8
Speedup: 1.0×

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 8 alternatives:

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

Initial Program: 72.2% 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.6% accurate, 0.5× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\frac{\left|b + \mathsf{fma}\left(-2, c \cdot \frac{a}{b}, b\right)\right|}{2 \cdot a}\\


\end{array}\\

\mathbf{elif}\;b \leq 10^{+135}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) - t\_0}\\

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


\end{array}\\

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

\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{2 \cdot \left|a \cdot \frac{c}{b} - b\right|}{a}\\


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

    1. Initial program 41.1%

      \[\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 41.1%

      \[\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--41.1%

        \[\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*41.1%

        \[\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. fma-neg41.1%

        \[\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. Simplified41.1%

      \[\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. Taylor expanded in a around 0 2.0%

      \[\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{\left(-b\right) + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)}{2 \cdot a}\\ \end{array} \]
    7. Step-by-step derivation
      1. add-sqr-sqrt1.9%

        \[\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{\left(-b\right) + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)} \cdot \sqrt{\left(-b\right) + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)}}{2 \cdot a}\\ \end{array} \]
      2. sqrt-unprod2.1%

        \[\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{\left(\left(-b\right) + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)\right) \cdot \left(\left(-b\right) + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)\right)}}{2 \cdot a}\\ \end{array} \]
      3. pow22.1%

        \[\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{{\left(\left(-b\right) + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)\right)}^{2}}}{2 \cdot a}\\ \end{array} \]
      4. add-sqr-sqrt12.4%

        \[\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{{\left(\sqrt{-b} \cdot \sqrt{-b} + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)\right)}^{2}}}{2 \cdot a}\\ \end{array} \]
      5. sqrt-unprod41.0%

        \[\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{{\left(\sqrt{\left(-b\right) \cdot \left(-b\right)} + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)\right)}^{2}}}{2 \cdot a}\\ \end{array} \]
      6. sqr-neg41.0%

        \[\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{{\left(\sqrt{b \cdot b} + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)\right)}^{2}}}{2 \cdot a}\\ \end{array} \]
      7. sqrt-prod0.0%

        \[\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{{\left(\sqrt{b} \cdot \sqrt{b} + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)\right)}^{2}}}{2 \cdot a}\\ \end{array} \]
      8. add-sqr-sqrt41.3%

        \[\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{{\left(b + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)\right)}^{2}}}{2 \cdot a}\\ \end{array} \]
      9. +-commutative41.3%

        \[\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{{\left(b + \left(-2 \cdot \frac{a \cdot c}{b} + b\right)\right)}^{2}}}{2 \cdot a}\\ \end{array} \]
      10. fma-define41.3%

        \[\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{{\left(b + \mathsf{fma}\left(-2, \frac{a \cdot c}{b}, b\right)\right)}^{2}}}{2 \cdot a}\\ \end{array} \]
      11. associate-/l*41.3%

        \[\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{{\left(b + \mathsf{fma}\left(-2, a \cdot \frac{c}{b}, b\right)\right)}^{2}}}{2 \cdot a}\\ \end{array} \]
    8. Applied egg-rr41.3%

      \[\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{{\left(b + \mathsf{fma}\left(-2, a \cdot \frac{c}{b}, b\right)\right)}^{2}}}{2 \cdot a}\\ \end{array} \]
    9. Step-by-step derivation
      1. unpow241.3%

        \[\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{\left(b + \mathsf{fma}\left(-2, a \cdot \frac{c}{b}, b\right)\right) \cdot \left(b + \mathsf{fma}\left(-2, a \cdot \frac{c}{b}, b\right)\right)}}{2 \cdot a}\\ \end{array} \]
      2. rem-sqrt-square98.3%

        \[\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{\left|b + \mathsf{fma}\left(-2, a \cdot \frac{c}{b}, b\right)\right|}{2 \cdot a}\\ \end{array} \]
      3. associate-*r/88.8%

        \[\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{\left|b + \mathsf{fma}\left(-2, \frac{a \cdot c}{b}, b\right)\right|}{2 \cdot a}\\ \end{array} \]
      4. *-commutative88.8%

        \[\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{\left|b + \mathsf{fma}\left(-2, \frac{c \cdot a}{b}, b\right)\right|}{2 \cdot a}\\ \end{array} \]
      5. associate-*r/98.3%

        \[\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{\left|b + \mathsf{fma}\left(-2, c \cdot \frac{a}{b}, b\right)\right|}{2 \cdot a}\\ \end{array} \]
    10. Simplified98.3%

      \[\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{\left|b + \mathsf{fma}\left(-2, c \cdot \frac{a}{b}, b\right)\right|}{2 \cdot a}\\ \end{array} \]

    if -5.00000000000000004e154 < b < 9.99999999999999962e134

    1. Initial program 87.4%

      \[\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 9.99999999999999962e134 < b

    1. Initial program 49.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. Taylor expanded in a around 0 93.5%

      \[\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--93.5%

        \[\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*96.8%

        \[\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. fma-neg96.8%

        \[\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. Simplified96.8%

      \[\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. Taylor expanded in a around 0 96.8%

      \[\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{\left(-b\right) + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)}{2 \cdot a}\\ \end{array} \]
    7. Step-by-step derivation
      1. add-sqr-sqrt96.8%

        \[\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{\left(-b\right) + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)} \cdot \sqrt{\left(-b\right) + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)}}{2 \cdot a}\\ \end{array} \]
      2. sqrt-unprod96.8%

        \[\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{\left(\left(-b\right) + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)\right) \cdot \left(\left(-b\right) + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)\right)}}{2 \cdot a}\\ \end{array} \]
      3. pow296.8%

        \[\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{{\left(\left(-b\right) + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)\right)}^{2}}}{2 \cdot a}\\ \end{array} \]
      4. add-sqr-sqrt96.8%

        \[\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{{\left(\sqrt{-b} \cdot \sqrt{-b} + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)\right)}^{2}}}{2 \cdot a}\\ \end{array} \]
      5. sqrt-unprod96.8%

        \[\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{{\left(\sqrt{\left(-b\right) \cdot \left(-b\right)} + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)\right)}^{2}}}{2 \cdot a}\\ \end{array} \]
      6. sqr-neg96.8%

        \[\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{{\left(\sqrt{b \cdot b} + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)\right)}^{2}}}{2 \cdot a}\\ \end{array} \]
      7. sqrt-prod96.8%

        \[\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{{\left(\sqrt{b} \cdot \sqrt{b} + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)\right)}^{2}}}{2 \cdot a}\\ \end{array} \]
      8. add-sqr-sqrt96.8%

        \[\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{{\left(b + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)\right)}^{2}}}{2 \cdot a}\\ \end{array} \]
      9. +-commutative96.8%

        \[\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{{\left(b + \left(-2 \cdot \frac{a \cdot c}{b} + b\right)\right)}^{2}}}{2 \cdot a}\\ \end{array} \]
      10. fma-define96.8%

        \[\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{{\left(b + \mathsf{fma}\left(-2, \frac{a \cdot c}{b}, b\right)\right)}^{2}}}{2 \cdot a}\\ \end{array} \]
      11. associate-/l*96.8%

        \[\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{{\left(b + \mathsf{fma}\left(-2, a \cdot \frac{c}{b}, b\right)\right)}^{2}}}{2 \cdot a}\\ \end{array} \]
    8. Applied egg-rr96.8%

      \[\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{{\left(b + \mathsf{fma}\left(-2, a \cdot \frac{c}{b}, b\right)\right)}^{2}}}{2 \cdot a}\\ \end{array} \]
    9. Step-by-step derivation
      1. unpow296.8%

        \[\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{\left(b + \mathsf{fma}\left(-2, a \cdot \frac{c}{b}, b\right)\right) \cdot \left(b + \mathsf{fma}\left(-2, a \cdot \frac{c}{b}, b\right)\right)}}{2 \cdot a}\\ \end{array} \]
      2. rem-sqrt-square96.8%

        \[\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{\left|b + \mathsf{fma}\left(-2, a \cdot \frac{c}{b}, b\right)\right|}{2 \cdot a}\\ \end{array} \]
      3. associate-*r/96.8%

        \[\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{\left|b + \mathsf{fma}\left(-2, \frac{a \cdot c}{b}, b\right)\right|}{2 \cdot a}\\ \end{array} \]
      4. *-commutative96.8%

        \[\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{\left|b + \mathsf{fma}\left(-2, \frac{c \cdot a}{b}, b\right)\right|}{2 \cdot a}\\ \end{array} \]
      5. associate-*r/96.8%

        \[\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{\left|b + \mathsf{fma}\left(-2, c \cdot \frac{a}{b}, b\right)\right|}{2 \cdot a}\\ \end{array} \]
    10. Simplified96.8%

      \[\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{\left|b + \mathsf{fma}\left(-2, c \cdot \frac{a}{b}, b\right)\right|}{2 \cdot a}\\ \end{array} \]
    11. Taylor expanded in b around 0 96.8%

      \[\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}:\\ \;\;\;\;0.5 \cdot \frac{\left|-2 \cdot \frac{a \cdot c}{b} + 2 \cdot b\right|}{a}\\ \end{array} \]
    12. Step-by-step derivation
      1. metadata-eval96.8%

        \[\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}:\\ \;\;\;\;0.5 \cdot \frac{\left|-2 \cdot \frac{a \cdot c}{b} + \left(--2\right) \cdot b\right|}{a}\\ \end{array} \]
      2. cancel-sign-sub-inv96.8%

        \[\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}:\\ \;\;\;\;0.5 \cdot \frac{\left|-2 \cdot \frac{a \cdot c}{b} - -2 \cdot b\right|}{a}\\ \end{array} \]
      3. distribute-lft-out--96.8%

        \[\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}:\\ \;\;\;\;0.5 \cdot \frac{\left|-2 \cdot \left(\frac{a \cdot c}{b} - b\right)\right|}{a}\\ \end{array} \]
      4. fabs-mul96.8%

        \[\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}:\\ \;\;\;\;\color{blue}{0.5} \cdot \frac{\left|-2\right| \cdot \left|\frac{a \cdot c}{b} - b\right|}{a}\\ \end{array} \]
      5. metadata-eval96.8%

        \[\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}:\\ \;\;\;\;0.5 \cdot \frac{2 \cdot \left|\frac{a \cdot c}{b} - b\right|}{a}\\ \end{array} \]
      6. associate-/l*96.8%

        \[\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}:\\ \;\;\;\;0.5 \cdot \frac{2 \cdot \left|a \cdot \frac{c}{b} - b\right|}{a}\\ \end{array} \]
    13. Simplified96.8%

      \[\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}:\\ \;\;\;\;0.5 \cdot \frac{2 \cdot \left|a \cdot \frac{c}{b} - b\right|}{a}\\ \end{array} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification91.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -5 \cdot 10^{+154}:\\ \;\;\;\;\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{\left|b + \mathsf{fma}\left(-2, c \cdot \frac{a}{b}, b\right)\right|}{2 \cdot a}\\ \end{array}\\ \mathbf{elif}\;b \leq 10^{+135}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{2 \cdot a}\\ \end{array}\\ \mathbf{elif}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{2 \cdot \mathsf{fma}\left(a, \frac{c}{b}, -b\right)}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \frac{2 \cdot \left|a \cdot \frac{c}{b} - b\right|}{a}\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 90.6% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
t_0 := \sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)}\\
t_1 := \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}:\\
\;\;\;\;0.5 \cdot \frac{2 \cdot \left|a \cdot \frac{c}{b} - b\right|}{a}\\


\end{array}\\
\mathbf{if}\;b \leq -1.5 \cdot 10^{+154}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;b \leq -1 \cdot 10^{-310}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{b}{a}\\

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


\end{array}\\

\mathbf{elif}\;b \leq 10^{+135}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) - t\_0}\\

\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(2, \frac{b}{c}, -2 \cdot \frac{a}{b}\right) \cdot \left(-c\right)}{2 \cdot a}\\


\end{array}\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if b < -1.50000000000000013e154 or 9.99999999999999962e134 < b

    1. Initial program 45.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 69.2%

      \[\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--69.2%

        \[\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*71.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. fma-neg71.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. Simplified71.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} \]
    6. Taylor expanded in a around 0 52.8%

      \[\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{\left(-b\right) + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)}{2 \cdot a}\\ \end{array} \]
    7. Step-by-step derivation
      1. add-sqr-sqrt52.8%

        \[\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{\left(-b\right) + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)} \cdot \sqrt{\left(-b\right) + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)}}{2 \cdot a}\\ \end{array} \]
      2. sqrt-unprod52.9%

        \[\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{\left(\left(-b\right) + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)\right) \cdot \left(\left(-b\right) + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)\right)}}{2 \cdot a}\\ \end{array} \]
      3. pow252.9%

        \[\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{{\left(\left(-b\right) + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)\right)}^{2}}}{2 \cdot a}\\ \end{array} \]
      4. add-sqr-sqrt57.6%

        \[\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{{\left(\sqrt{-b} \cdot \sqrt{-b} + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)\right)}^{2}}}{2 \cdot a}\\ \end{array} \]
      5. sqrt-unprod70.9%

        \[\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{{\left(\sqrt{\left(-b\right) \cdot \left(-b\right)} + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)\right)}^{2}}}{2 \cdot a}\\ \end{array} \]
      6. sqr-neg70.9%

        \[\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{{\left(\sqrt{b \cdot b} + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)\right)}^{2}}}{2 \cdot a}\\ \end{array} \]
      7. sqrt-prod51.9%

        \[\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{{\left(\sqrt{b} \cdot \sqrt{b} + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)\right)}^{2}}}{2 \cdot a}\\ \end{array} \]
      8. add-sqr-sqrt71.0%

        \[\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{{\left(b + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)\right)}^{2}}}{2 \cdot a}\\ \end{array} \]
      9. +-commutative71.0%

        \[\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{{\left(b + \left(-2 \cdot \frac{a \cdot c}{b} + b\right)\right)}^{2}}}{2 \cdot a}\\ \end{array} \]
      10. fma-define71.0%

        \[\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{{\left(b + \mathsf{fma}\left(-2, \frac{a \cdot c}{b}, b\right)\right)}^{2}}}{2 \cdot a}\\ \end{array} \]
      11. associate-/l*71.0%

        \[\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{{\left(b + \mathsf{fma}\left(-2, a \cdot \frac{c}{b}, b\right)\right)}^{2}}}{2 \cdot a}\\ \end{array} \]
    8. Applied egg-rr71.0%

      \[\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{{\left(b + \mathsf{fma}\left(-2, a \cdot \frac{c}{b}, b\right)\right)}^{2}}}{2 \cdot a}\\ \end{array} \]
    9. Step-by-step derivation
      1. unpow271.0%

        \[\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{\left(b + \mathsf{fma}\left(-2, a \cdot \frac{c}{b}, b\right)\right) \cdot \left(b + \mathsf{fma}\left(-2, a \cdot \frac{c}{b}, b\right)\right)}}{2 \cdot a}\\ \end{array} \]
      2. rem-sqrt-square97.5%

        \[\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{\left|b + \mathsf{fma}\left(-2, a \cdot \frac{c}{b}, b\right)\right|}{2 \cdot a}\\ \end{array} \]
      3. associate-*r/93.1%

        \[\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{\left|b + \mathsf{fma}\left(-2, \frac{a \cdot c}{b}, b\right)\right|}{2 \cdot a}\\ \end{array} \]
      4. *-commutative93.1%

        \[\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{\left|b + \mathsf{fma}\left(-2, \frac{c \cdot a}{b}, b\right)\right|}{2 \cdot a}\\ \end{array} \]
      5. associate-*r/97.5%

        \[\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{\left|b + \mathsf{fma}\left(-2, c \cdot \frac{a}{b}, b\right)\right|}{2 \cdot a}\\ \end{array} \]
    10. Simplified97.5%

      \[\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{\left|b + \mathsf{fma}\left(-2, c \cdot \frac{a}{b}, b\right)\right|}{2 \cdot a}\\ \end{array} \]
    11. Taylor expanded in b around 0 93.1%

      \[\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}:\\ \;\;\;\;0.5 \cdot \frac{\left|-2 \cdot \frac{a \cdot c}{b} + 2 \cdot b\right|}{a}\\ \end{array} \]
    12. Step-by-step derivation
      1. metadata-eval93.1%

        \[\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}:\\ \;\;\;\;0.5 \cdot \frac{\left|-2 \cdot \frac{a \cdot c}{b} + \left(--2\right) \cdot b\right|}{a}\\ \end{array} \]
      2. cancel-sign-sub-inv93.1%

        \[\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}:\\ \;\;\;\;0.5 \cdot \frac{\left|-2 \cdot \frac{a \cdot c}{b} - -2 \cdot b\right|}{a}\\ \end{array} \]
      3. distribute-lft-out--93.1%

        \[\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}:\\ \;\;\;\;0.5 \cdot \frac{\left|-2 \cdot \left(\frac{a \cdot c}{b} - b\right)\right|}{a}\\ \end{array} \]
      4. fabs-mul93.1%

        \[\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}:\\ \;\;\;\;\color{blue}{0.5} \cdot \frac{\left|-2\right| \cdot \left|\frac{a \cdot c}{b} - b\right|}{a}\\ \end{array} \]
      5. metadata-eval93.1%

        \[\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}:\\ \;\;\;\;0.5 \cdot \frac{2 \cdot \left|\frac{a \cdot c}{b} - b\right|}{a}\\ \end{array} \]
      6. associate-/l*97.5%

        \[\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}:\\ \;\;\;\;0.5 \cdot \frac{2 \cdot \left|a \cdot \frac{c}{b} - b\right|}{a}\\ \end{array} \]
    13. Simplified97.5%

      \[\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}:\\ \;\;\;\;0.5 \cdot \frac{2 \cdot \left|a \cdot \frac{c}{b} - b\right|}{a}\\ \end{array} \]

    if -1.50000000000000013e154 < b < -9.999999999999969e-311

    1. Initial program 87.1%

      \[\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 87.1%

      \[\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--87.1%

        \[\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*87.1%

        \[\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. fma-neg87.1%

        \[\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. Simplified87.1%

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

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

    if -9.999999999999969e-311 < b < 9.99999999999999962e134

    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 b around -inf 88.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 \left(b \cdot \left(2 + -2 \cdot \frac{a \cdot c}{{b}^{2}}\right)\right)}{2 \cdot a}\\ \end{array} \]
    4. Step-by-step derivation
      1. mul-1-neg88.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 \cdot \left(2 + -2 \cdot \frac{a \cdot c}{{b}^{2}}\right)}{2 \cdot a}\\ \end{array} \]
      2. distribute-rgt-neg-in88.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 \cdot \left(-\left(2 + -2 \cdot \frac{a \cdot c}{{b}^{2}}\right)\right)}{2 \cdot a}\\ \end{array} \]
      3. distribute-neg-in88.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 \cdot \left(\left(-2\right) + \left(--2 \cdot \frac{a \cdot c}{{b}^{2}}\right)\right)}{2 \cdot a}\\ \end{array} \]
      4. metadata-eval88.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 \cdot \left(-2 + \left(--2 \cdot \frac{a \cdot c}{{b}^{2}}\right)\right)}{2 \cdot a}\\ \end{array} \]
      5. associate-/l*88.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 \cdot \left(-2 + \left(--2 \cdot \left(a \cdot \frac{c}{{b}^{2}}\right)\right)\right)}{2 \cdot a}\\ \end{array} \]
      6. associate-*r*88.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 \cdot \left(-2 + \left(-\left(-2 \cdot a\right) \cdot \frac{c}{{b}^{2}}\right)\right)}{2 \cdot a}\\ \end{array} \]
    5. Simplified88.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 \cdot \left(-2 + \left(-\left(-2 \cdot a\right) \cdot \frac{c}{{b}^{2}}\right)\right)}{2 \cdot a}\\ \end{array} \]
    6. Step-by-step derivation
      1. pow288.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 \cdot \left(-2 + \left(-\left(-2 \cdot a\right) \cdot \frac{c}{b \cdot b}\right)\right)}{2 \cdot a}\\ \end{array} \]
      2. add-sqr-sqrt88.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 \cdot \left(-2 + \left(-\left(-2 \cdot a\right) \cdot \left(\sqrt{\frac{c}{b \cdot b}} \cdot \sqrt{\frac{c}{b \cdot b}}\right)\right)\right)}{2 \cdot a}\\ \end{array} \]
      3. sqrt-div88.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 \cdot \left(-2 + \left(-\left(-2 \cdot a\right) \cdot \left(\frac{\sqrt{c}}{\sqrt{b \cdot b}} \cdot \sqrt{\frac{c}{b \cdot b}}\right)\right)\right)}{2 \cdot a}\\ \end{array} \]
      4. sqrt-prod88.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 \cdot \left(-2 + \left(-\left(-2 \cdot a\right) \cdot \left(\frac{\sqrt{c}}{\sqrt{b} \cdot \sqrt{b}} \cdot \sqrt{\frac{c}{b \cdot b}}\right)\right)\right)}{2 \cdot a}\\ \end{array} \]
      5. add-sqr-sqrt88.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 \cdot \left(-2 + \left(-\left(-2 \cdot a\right) \cdot \left(\frac{\sqrt{c}}{b} \cdot \sqrt{\frac{c}{b \cdot b}}\right)\right)\right)}{2 \cdot a}\\ \end{array} \]
      6. sqrt-div88.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 \cdot \left(-2 + \left(-\left(-2 \cdot a\right) \cdot \left(\frac{\sqrt{c}}{b} \cdot \frac{\sqrt{c}}{\sqrt{b \cdot b}}\right)\right)\right)}{2 \cdot a}\\ \end{array} \]
      7. sqrt-prod88.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 \cdot \left(-2 + \left(-\left(-2 \cdot a\right) \cdot \left(\frac{\sqrt{c}}{b} \cdot \frac{\sqrt{c}}{\sqrt{b} \cdot \sqrt{b}}\right)\right)\right)}{2 \cdot a}\\ \end{array} \]
      8. add-sqr-sqrt88.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 \cdot \left(-2 + \left(-\left(-2 \cdot a\right) \cdot \left(\frac{\sqrt{c}}{b} \cdot \frac{\sqrt{c}}{b}\right)\right)\right)}{2 \cdot a}\\ \end{array} \]
    7. Applied egg-rr88.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 \cdot \left(-2 + \left(-\left(-2 \cdot a\right) \cdot \left(\frac{\sqrt{c}}{b} \cdot \frac{\sqrt{c}}{b}\right)\right)\right)}{2 \cdot a}\\ \end{array} \]
    8. Step-by-step derivation
      1. unpow288.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 \cdot \left(-2 + \left(-\left(-2 \cdot a\right) \cdot {\left(\frac{\sqrt{c}}{b}\right)}^{2}\right)\right)}{2 \cdot a}\\ \end{array} \]
    9. Simplified88.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 \cdot \left(-2 + \left(-\left(-2 \cdot a\right) \cdot {\left(\frac{\sqrt{c}}{b}\right)}^{2}\right)\right)}{2 \cdot a}\\ \end{array} \]
    10. Taylor expanded in c around -inf 88.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 \left(c \cdot \left(2 \cdot \frac{b}{c} + 2 \cdot \frac{a \cdot {\left(\sqrt{-1}\right)}^{2}}{b}\right)\right)}{2 \cdot a}\\ \end{array} \]
    11. Step-by-step derivation
      1. mul-1-neg88.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{-c \cdot \left(2 \cdot \frac{b}{c} + 2 \cdot \frac{a \cdot {\left(\sqrt{-1}\right)}^{2}}{b}\right)}{2 \cdot a}\\ \end{array} \]
      2. *-commutative88.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{-\left(2 \cdot \frac{b}{c} + 2 \cdot \frac{a \cdot {\left(\sqrt{-1}\right)}^{2}}{b}\right) \cdot c}{2 \cdot a}\\ \end{array} \]
      3. distribute-rgt-neg-in88.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{\left(2 \cdot \frac{b}{c} + 2 \cdot \frac{a \cdot {\left(\sqrt{-1}\right)}^{2}}{b}\right) \cdot \left(-c\right)}{2 \cdot a}\\ \end{array} \]
      4. fma-define88.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{\mathsf{fma}\left(2, \frac{b}{c}, 2 \cdot \frac{a \cdot {\left(\sqrt{-1}\right)}^{2}}{b}\right) \cdot \left(-c\right)}{2 \cdot a}\\ \end{array} \]
      5. associate-*r/88.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{\mathsf{fma}\left(2, \frac{b}{c}, \frac{2 \cdot \left(a \cdot {\left(\sqrt{-1}\right)}^{2}\right)}{b}\right) \cdot \left(-c\right)}{2 \cdot a}\\ \end{array} \]
      6. *-commutative88.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{\mathsf{fma}\left(2, \frac{b}{c}, \frac{2 \cdot \left({\left(\sqrt{-1}\right)}^{2} \cdot a\right)}{b}\right) \cdot \left(-c\right)}{2 \cdot a}\\ \end{array} \]
      7. unpow288.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{\mathsf{fma}\left(2, \frac{b}{c}, \frac{2 \cdot \left(\left(\sqrt{-1} \cdot \sqrt{-1}\right) \cdot a\right)}{b}\right) \cdot \left(-c\right)}{2 \cdot a}\\ \end{array} \]
      8. rem-square-sqrt88.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{\mathsf{fma}\left(2, \frac{b}{c}, \frac{2 \cdot \left(-1 \cdot a\right)}{b}\right) \cdot \left(-c\right)}{2 \cdot a}\\ \end{array} \]
      9. associate-*r*88.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{\mathsf{fma}\left(2, \frac{b}{c}, \frac{\left(2 \cdot -1\right) \cdot a}{b}\right) \cdot \left(-c\right)}{2 \cdot a}\\ \end{array} \]
      10. metadata-eval88.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{\mathsf{fma}\left(2, \frac{b}{c}, \frac{-2 \cdot a}{b}\right) \cdot \left(-c\right)}{2 \cdot a}\\ \end{array} \]
      11. associate-*r/88.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{\mathsf{fma}\left(2, \frac{b}{c}, -2 \cdot \frac{a}{b}\right) \cdot \left(-c\right)}{2 \cdot a}\\ \end{array} \]
    12. Simplified88.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{\mathsf{fma}\left(2, \frac{b}{c}, -2 \cdot \frac{a}{b}\right) \cdot \left(-c\right)}{2 \cdot a}\\ \end{array} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification91.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -1.5 \cdot 10^{+154}:\\ \;\;\;\;\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}:\\ \;\;\;\;0.5 \cdot \frac{2 \cdot \left|a \cdot \frac{c}{b} - b\right|}{a}\\ \end{array}\\ \mathbf{elif}\;b \leq -1 \cdot 10^{-310}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{2 \cdot a}\\ \end{array}\\ \mathbf{elif}\;b \leq 10^{+135}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(2, \frac{b}{c}, -2 \cdot \frac{a}{b}\right) \cdot \left(-c\right)}{2 \cdot a}\\ \end{array}\\ \mathbf{elif}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{2 \cdot \mathsf{fma}\left(a, \frac{c}{b}, -b\right)}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \frac{2 \cdot \left|a \cdot \frac{c}{b} - b\right|}{a}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 90.5% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)}\\ \mathbf{if}\;b \leq -5 \cdot 10^{+154} \lor \neg \left(b \leq 10^{+135}\right):\\ \;\;\;\;\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}:\\ \;\;\;\;0.5 \cdot \frac{2 \cdot \left|a \cdot \frac{c}{b} - b\right|}{a}\\ \end{array}\\ \mathbf{elif}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - t\_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{t\_0 - b}{2 \cdot a}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (sqrt (- (* b b) (* c (* a 4.0))))))
   (if (or (<= b -5e+154) (not (<= b 1e+135)))
     (if (>= b 0.0)
       (/ (* 2.0 c) (* 2.0 (fma a (/ c b) (- b))))
       (* 0.5 (/ (* 2.0 (fabs (- (* a (/ c b)) b))) a)))
     (if (>= b 0.0) (/ (* 2.0 c) (- (- b) t_0)) (/ (- t_0 b) (* 2.0 a))))))
double code(double a, double b, double c) {
	double t_0 = sqrt(((b * b) - (c * (a * 4.0))));
	double tmp_1;
	if ((b <= -5e+154) || !(b <= 1e+135)) {
		double tmp_2;
		if (b >= 0.0) {
			tmp_2 = (2.0 * c) / (2.0 * fma(a, (c / b), -b));
		} else {
			tmp_2 = 0.5 * ((2.0 * fabs(((a * (c / b)) - b))) / a);
		}
		tmp_1 = tmp_2;
	} else if (b >= 0.0) {
		tmp_1 = (2.0 * c) / (-b - t_0);
	} else {
		tmp_1 = (t_0 - b) / (2.0 * a);
	}
	return tmp_1;
}
function code(a, b, c)
	t_0 = sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 4.0))))
	tmp_1 = 0.0
	if ((b <= -5e+154) || !(b <= 1e+135))
		tmp_2 = 0.0
		if (b >= 0.0)
			tmp_2 = Float64(Float64(2.0 * c) / Float64(2.0 * fma(a, Float64(c / b), Float64(-b))));
		else
			tmp_2 = Float64(0.5 * Float64(Float64(2.0 * abs(Float64(Float64(a * Float64(c / b)) - b))) / a));
		end
		tmp_1 = tmp_2;
	elseif (b >= 0.0)
		tmp_1 = Float64(Float64(2.0 * c) / Float64(Float64(-b) - t_0));
	else
		tmp_1 = Float64(Float64(t_0 - b) / Float64(2.0 * a));
	end
	return tmp_1
end
code[a_, b_, c_] := Block[{t$95$0 = N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(c * N[(a * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[Or[LessEqual[b, -5e+154], N[Not[LessEqual[b, 1e+135]], $MachinePrecision]], 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[(0.5 * N[(N[(2.0 * N[Abs[N[(N[(a * N[(c / b), $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]], If[GreaterEqual[b, 0.0], N[(N[(2.0 * c), $MachinePrecision] / N[((-b) - t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 - b), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)}\\
\mathbf{if}\;b \leq -5 \cdot 10^{+154} \lor \neg \left(b \leq 10^{+135}\right):\\
\;\;\;\;\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}:\\
\;\;\;\;0.5 \cdot \frac{2 \cdot \left|a \cdot \frac{c}{b} - b\right|}{a}\\


\end{array}\\

\mathbf{elif}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) - t\_0}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < -5.00000000000000004e154 or 9.99999999999999962e134 < b

    1. Initial program 45.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 69.2%

      \[\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--69.2%

        \[\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*71.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. fma-neg71.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. Simplified71.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} \]
    6. Taylor expanded in a around 0 52.8%

      \[\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{\left(-b\right) + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)}{2 \cdot a}\\ \end{array} \]
    7. Step-by-step derivation
      1. add-sqr-sqrt52.8%

        \[\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{\left(-b\right) + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)} \cdot \sqrt{\left(-b\right) + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)}}{2 \cdot a}\\ \end{array} \]
      2. sqrt-unprod52.9%

        \[\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{\left(\left(-b\right) + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)\right) \cdot \left(\left(-b\right) + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)\right)}}{2 \cdot a}\\ \end{array} \]
      3. pow252.9%

        \[\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{{\left(\left(-b\right) + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)\right)}^{2}}}{2 \cdot a}\\ \end{array} \]
      4. add-sqr-sqrt57.6%

        \[\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{{\left(\sqrt{-b} \cdot \sqrt{-b} + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)\right)}^{2}}}{2 \cdot a}\\ \end{array} \]
      5. sqrt-unprod70.9%

        \[\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{{\left(\sqrt{\left(-b\right) \cdot \left(-b\right)} + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)\right)}^{2}}}{2 \cdot a}\\ \end{array} \]
      6. sqr-neg70.9%

        \[\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{{\left(\sqrt{b \cdot b} + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)\right)}^{2}}}{2 \cdot a}\\ \end{array} \]
      7. sqrt-prod51.9%

        \[\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{{\left(\sqrt{b} \cdot \sqrt{b} + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)\right)}^{2}}}{2 \cdot a}\\ \end{array} \]
      8. add-sqr-sqrt71.0%

        \[\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{{\left(b + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)\right)}^{2}}}{2 \cdot a}\\ \end{array} \]
      9. +-commutative71.0%

        \[\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{{\left(b + \left(-2 \cdot \frac{a \cdot c}{b} + b\right)\right)}^{2}}}{2 \cdot a}\\ \end{array} \]
      10. fma-define71.0%

        \[\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{{\left(b + \mathsf{fma}\left(-2, \frac{a \cdot c}{b}, b\right)\right)}^{2}}}{2 \cdot a}\\ \end{array} \]
      11. associate-/l*71.0%

        \[\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{{\left(b + \mathsf{fma}\left(-2, a \cdot \frac{c}{b}, b\right)\right)}^{2}}}{2 \cdot a}\\ \end{array} \]
    8. Applied egg-rr71.0%

      \[\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{{\left(b + \mathsf{fma}\left(-2, a \cdot \frac{c}{b}, b\right)\right)}^{2}}}{2 \cdot a}\\ \end{array} \]
    9. Step-by-step derivation
      1. unpow271.0%

        \[\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{\left(b + \mathsf{fma}\left(-2, a \cdot \frac{c}{b}, b\right)\right) \cdot \left(b + \mathsf{fma}\left(-2, a \cdot \frac{c}{b}, b\right)\right)}}{2 \cdot a}\\ \end{array} \]
      2. rem-sqrt-square97.5%

        \[\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{\left|b + \mathsf{fma}\left(-2, a \cdot \frac{c}{b}, b\right)\right|}{2 \cdot a}\\ \end{array} \]
      3. associate-*r/93.1%

        \[\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{\left|b + \mathsf{fma}\left(-2, \frac{a \cdot c}{b}, b\right)\right|}{2 \cdot a}\\ \end{array} \]
      4. *-commutative93.1%

        \[\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{\left|b + \mathsf{fma}\left(-2, \frac{c \cdot a}{b}, b\right)\right|}{2 \cdot a}\\ \end{array} \]
      5. associate-*r/97.5%

        \[\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{\left|b + \mathsf{fma}\left(-2, c \cdot \frac{a}{b}, b\right)\right|}{2 \cdot a}\\ \end{array} \]
    10. Simplified97.5%

      \[\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{\left|b + \mathsf{fma}\left(-2, c \cdot \frac{a}{b}, b\right)\right|}{2 \cdot a}\\ \end{array} \]
    11. Taylor expanded in b around 0 93.1%

      \[\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}:\\ \;\;\;\;0.5 \cdot \frac{\left|-2 \cdot \frac{a \cdot c}{b} + 2 \cdot b\right|}{a}\\ \end{array} \]
    12. Step-by-step derivation
      1. metadata-eval93.1%

        \[\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}:\\ \;\;\;\;0.5 \cdot \frac{\left|-2 \cdot \frac{a \cdot c}{b} + \left(--2\right) \cdot b\right|}{a}\\ \end{array} \]
      2. cancel-sign-sub-inv93.1%

        \[\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}:\\ \;\;\;\;0.5 \cdot \frac{\left|-2 \cdot \frac{a \cdot c}{b} - -2 \cdot b\right|}{a}\\ \end{array} \]
      3. distribute-lft-out--93.1%

        \[\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}:\\ \;\;\;\;0.5 \cdot \frac{\left|-2 \cdot \left(\frac{a \cdot c}{b} - b\right)\right|}{a}\\ \end{array} \]
      4. fabs-mul93.1%

        \[\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}:\\ \;\;\;\;\color{blue}{0.5} \cdot \frac{\left|-2\right| \cdot \left|\frac{a \cdot c}{b} - b\right|}{a}\\ \end{array} \]
      5. metadata-eval93.1%

        \[\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}:\\ \;\;\;\;0.5 \cdot \frac{2 \cdot \left|\frac{a \cdot c}{b} - b\right|}{a}\\ \end{array} \]
      6. associate-/l*97.5%

        \[\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}:\\ \;\;\;\;0.5 \cdot \frac{2 \cdot \left|a \cdot \frac{c}{b} - b\right|}{a}\\ \end{array} \]
    13. Simplified97.5%

      \[\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}:\\ \;\;\;\;0.5 \cdot \frac{2 \cdot \left|a \cdot \frac{c}{b} - b\right|}{a}\\ \end{array} \]

    if -5.00000000000000004e154 < b < 9.99999999999999962e134

    1. Initial program 87.4%

      \[\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. Recombined 2 regimes into one program.
  4. Final simplification91.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -5 \cdot 10^{+154} \lor \neg \left(b \leq 10^{+135}\right):\\ \;\;\;\;\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}:\\ \;\;\;\;0.5 \cdot \frac{2 \cdot \left|a \cdot \frac{c}{b} - b\right|}{a}\\ \end{array}\\ \mathbf{elif}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{2 \cdot a}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 78.7% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
t_0 := \frac{2 \cdot c}{2 \cdot \mathsf{fma}\left(a, \frac{c}{b}, -b\right)}\\
\mathbf{if}\;b \leq -5 \cdot 10^{+154}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;t\_0\\

\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{2 \cdot \left|a \cdot \frac{c}{b} - b\right|}{a}\\


\end{array}\\

\mathbf{elif}\;b \leq 1.22 \cdot 10^{-204}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{b}{a}\\

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


\end{array}\\

\mathbf{elif}\;b \geq 0:\\
\;\;\;\;t\_0\\

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


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

    1. Initial program 41.1%

      \[\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 41.1%

      \[\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--41.1%

        \[\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*41.1%

        \[\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. fma-neg41.1%

        \[\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. Simplified41.1%

      \[\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. Taylor expanded in a around 0 2.0%

      \[\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{\left(-b\right) + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)}{2 \cdot a}\\ \end{array} \]
    7. Step-by-step derivation
      1. add-sqr-sqrt1.9%

        \[\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{\left(-b\right) + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)} \cdot \sqrt{\left(-b\right) + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)}}{2 \cdot a}\\ \end{array} \]
      2. sqrt-unprod2.1%

        \[\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{\left(\left(-b\right) + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)\right) \cdot \left(\left(-b\right) + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)\right)}}{2 \cdot a}\\ \end{array} \]
      3. pow22.1%

        \[\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{{\left(\left(-b\right) + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)\right)}^{2}}}{2 \cdot a}\\ \end{array} \]
      4. add-sqr-sqrt12.4%

        \[\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{{\left(\sqrt{-b} \cdot \sqrt{-b} + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)\right)}^{2}}}{2 \cdot a}\\ \end{array} \]
      5. sqrt-unprod41.0%

        \[\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{{\left(\sqrt{\left(-b\right) \cdot \left(-b\right)} + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)\right)}^{2}}}{2 \cdot a}\\ \end{array} \]
      6. sqr-neg41.0%

        \[\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{{\left(\sqrt{b \cdot b} + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)\right)}^{2}}}{2 \cdot a}\\ \end{array} \]
      7. sqrt-prod0.0%

        \[\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{{\left(\sqrt{b} \cdot \sqrt{b} + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)\right)}^{2}}}{2 \cdot a}\\ \end{array} \]
      8. add-sqr-sqrt41.3%

        \[\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{{\left(b + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)\right)}^{2}}}{2 \cdot a}\\ \end{array} \]
      9. +-commutative41.3%

        \[\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{{\left(b + \left(-2 \cdot \frac{a \cdot c}{b} + b\right)\right)}^{2}}}{2 \cdot a}\\ \end{array} \]
      10. fma-define41.3%

        \[\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{{\left(b + \mathsf{fma}\left(-2, \frac{a \cdot c}{b}, b\right)\right)}^{2}}}{2 \cdot a}\\ \end{array} \]
      11. associate-/l*41.3%

        \[\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{{\left(b + \mathsf{fma}\left(-2, a \cdot \frac{c}{b}, b\right)\right)}^{2}}}{2 \cdot a}\\ \end{array} \]
    8. Applied egg-rr41.3%

      \[\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{{\left(b + \mathsf{fma}\left(-2, a \cdot \frac{c}{b}, b\right)\right)}^{2}}}{2 \cdot a}\\ \end{array} \]
    9. Step-by-step derivation
      1. unpow241.3%

        \[\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{\left(b + \mathsf{fma}\left(-2, a \cdot \frac{c}{b}, b\right)\right) \cdot \left(b + \mathsf{fma}\left(-2, a \cdot \frac{c}{b}, b\right)\right)}}{2 \cdot a}\\ \end{array} \]
      2. rem-sqrt-square98.3%

        \[\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{\left|b + \mathsf{fma}\left(-2, a \cdot \frac{c}{b}, b\right)\right|}{2 \cdot a}\\ \end{array} \]
      3. associate-*r/88.8%

        \[\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{\left|b + \mathsf{fma}\left(-2, \frac{a \cdot c}{b}, b\right)\right|}{2 \cdot a}\\ \end{array} \]
      4. *-commutative88.8%

        \[\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{\left|b + \mathsf{fma}\left(-2, \frac{c \cdot a}{b}, b\right)\right|}{2 \cdot a}\\ \end{array} \]
      5. associate-*r/98.3%

        \[\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{\left|b + \mathsf{fma}\left(-2, c \cdot \frac{a}{b}, b\right)\right|}{2 \cdot a}\\ \end{array} \]
    10. Simplified98.3%

      \[\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{\left|b + \mathsf{fma}\left(-2, c \cdot \frac{a}{b}, b\right)\right|}{2 \cdot a}\\ \end{array} \]
    11. Taylor expanded in b around 0 88.8%

      \[\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}:\\ \;\;\;\;0.5 \cdot \frac{\left|-2 \cdot \frac{a \cdot c}{b} + 2 \cdot b\right|}{a}\\ \end{array} \]
    12. Step-by-step derivation
      1. metadata-eval88.8%

        \[\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}:\\ \;\;\;\;0.5 \cdot \frac{\left|-2 \cdot \frac{a \cdot c}{b} + \left(--2\right) \cdot b\right|}{a}\\ \end{array} \]
      2. cancel-sign-sub-inv88.8%

        \[\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}:\\ \;\;\;\;0.5 \cdot \frac{\left|-2 \cdot \frac{a \cdot c}{b} - -2 \cdot b\right|}{a}\\ \end{array} \]
      3. distribute-lft-out--88.8%

        \[\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}:\\ \;\;\;\;0.5 \cdot \frac{\left|-2 \cdot \left(\frac{a \cdot c}{b} - b\right)\right|}{a}\\ \end{array} \]
      4. fabs-mul88.8%

        \[\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}:\\ \;\;\;\;\color{blue}{0.5} \cdot \frac{\left|-2\right| \cdot \left|\frac{a \cdot c}{b} - b\right|}{a}\\ \end{array} \]
      5. metadata-eval88.8%

        \[\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}:\\ \;\;\;\;0.5 \cdot \frac{2 \cdot \left|\frac{a \cdot c}{b} - b\right|}{a}\\ \end{array} \]
      6. associate-/l*98.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}:\\ \;\;\;\;0.5 \cdot \frac{2 \cdot \left|a \cdot \frac{c}{b} - b\right|}{a}\\ \end{array} \]
    13. Simplified98.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}:\\ \;\;\;\;0.5 \cdot \frac{2 \cdot \left|a \cdot \frac{c}{b} - b\right|}{a}\\ \end{array} \]

    if -5.00000000000000004e154 < b < 1.22000000000000005e-204

    1. Initial program 85.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 76.1%

      \[\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--76.1%

        \[\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*76.1%

        \[\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. fma-neg76.1%

        \[\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. Simplified76.1%

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

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

    if 1.22000000000000005e-204 < b

    1. Initial program 67.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
    3. Taylor expanded in a around 0 76.7%

      \[\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--76.7%

        \[\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*78.5%

        \[\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. fma-neg78.5%

        \[\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. Simplified78.5%

      \[\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. Taylor expanded in a around 0 78.5%

      \[\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{\left(-b\right) + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)}{2 \cdot a}\\ \end{array} \]
    7. Step-by-step derivation
      1. div-inv78.5%

        \[\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{\left(-b\right) + \left(b + -2 \cdot \left(\left(a \cdot c\right) \cdot \frac{1}{b}\right)\right)}{2 \cdot a}\\ \end{array} \]
      2. *-commutative78.5%

        \[\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{\left(-b\right) + \left(b + -2 \cdot \left(\left(c \cdot a\right) \cdot \frac{1}{b}\right)\right)}{2 \cdot a}\\ \end{array} \]
      3. frac-2neg78.5%

        \[\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{\left(-b\right) + \left(b + -2 \cdot \left(\left(c \cdot a\right) \cdot \frac{-1}{-b}\right)\right)}{2 \cdot a}\\ \end{array} \]
      4. metadata-eval78.5%

        \[\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{\left(-b\right) + \left(b + -2 \cdot \left(\left(c \cdot a\right) \cdot \frac{-1}{-b}\right)\right)}{2 \cdot a}\\ \end{array} \]
      5. add-sqr-sqrt78.5%

        \[\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{\left(-b\right) + \left(b + -2 \cdot \left(\left(c \cdot a\right) \cdot \frac{-1}{\sqrt{-b} \cdot \sqrt{-b}}\right)\right)}{2 \cdot a}\\ \end{array} \]
      6. sqrt-unprod78.5%

        \[\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{\left(-b\right) + \left(b + -2 \cdot \left(\left(c \cdot a\right) \cdot \frac{-1}{\sqrt{\left(-b\right) \cdot \left(-b\right)}}\right)\right)}{2 \cdot a}\\ \end{array} \]
      7. sqr-neg78.5%

        \[\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{\left(-b\right) + \left(b + -2 \cdot \left(\left(c \cdot a\right) \cdot \frac{-1}{\sqrt{b \cdot b}}\right)\right)}{2 \cdot a}\\ \end{array} \]
      8. sqrt-prod78.5%

        \[\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{\left(-b\right) + \left(b + -2 \cdot \left(\left(c \cdot a\right) \cdot \frac{-1}{\sqrt{b} \cdot \sqrt{b}}\right)\right)}{2 \cdot a}\\ \end{array} \]
      9. add-sqr-sqrt78.5%

        \[\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{\left(-b\right) + \left(b + -2 \cdot \left(\left(c \cdot a\right) \cdot \frac{-1}{b}\right)\right)}{2 \cdot a}\\ \end{array} \]
    8. Applied egg-rr78.5%

      \[\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{\left(-b\right) + \left(b + -2 \cdot \left(\left(c \cdot a\right) \cdot \frac{-1}{b}\right)\right)}{2 \cdot a}\\ \end{array} \]
    9. Step-by-step derivation
      1. associate-*l*78.5%

        \[\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{\left(-b\right) + \left(b + -2 \cdot \left(c \cdot \left(a \cdot \frac{-1}{b}\right)\right)\right)}{2 \cdot a}\\ \end{array} \]
    10. Simplified78.5%

      \[\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{\left(-b\right) + \left(b + -2 \cdot \left(c \cdot \left(a \cdot \frac{-1}{b}\right)\right)\right)}{2 \cdot a}\\ \end{array} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification81.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -5 \cdot 10^{+154}:\\ \;\;\;\;\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}:\\ \;\;\;\;0.5 \cdot \frac{2 \cdot \left|a \cdot \frac{c}{b} - b\right|}{a}\\ \end{array}\\ \mathbf{elif}\;b \leq 1.22 \cdot 10^{-204}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{2 \cdot a}\\ \end{array}\\ \mathbf{elif}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{2 \cdot \mathsf{fma}\left(a, \frac{c}{b}, -b\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(b + -2 \cdot \left(c \cdot \left(a \cdot \frac{-1}{b}\right)\right)\right) - b}{2 \cdot a}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 78.8% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
t_0 := \frac{2 \cdot c}{2 \cdot \mathsf{fma}\left(a, \frac{c}{b}, -b\right)}\\
\mathbf{if}\;b \leq -5 \cdot 10^{+154}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;t\_0\\

\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{2 \cdot \left|a \cdot \frac{c}{b} - b\right|}{a}\\


\end{array}\\

\mathbf{elif}\;b \geq 0:\\
\;\;\;\;t\_0\\

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


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

    1. Initial program 41.1%

      \[\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 41.1%

      \[\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--41.1%

        \[\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*41.1%

        \[\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. fma-neg41.1%

        \[\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. Simplified41.1%

      \[\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. Taylor expanded in a around 0 2.0%

      \[\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{\left(-b\right) + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)}{2 \cdot a}\\ \end{array} \]
    7. Step-by-step derivation
      1. add-sqr-sqrt1.9%

        \[\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{\left(-b\right) + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)} \cdot \sqrt{\left(-b\right) + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)}}{2 \cdot a}\\ \end{array} \]
      2. sqrt-unprod2.1%

        \[\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{\left(\left(-b\right) + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)\right) \cdot \left(\left(-b\right) + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)\right)}}{2 \cdot a}\\ \end{array} \]
      3. pow22.1%

        \[\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{{\left(\left(-b\right) + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)\right)}^{2}}}{2 \cdot a}\\ \end{array} \]
      4. add-sqr-sqrt12.4%

        \[\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{{\left(\sqrt{-b} \cdot \sqrt{-b} + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)\right)}^{2}}}{2 \cdot a}\\ \end{array} \]
      5. sqrt-unprod41.0%

        \[\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{{\left(\sqrt{\left(-b\right) \cdot \left(-b\right)} + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)\right)}^{2}}}{2 \cdot a}\\ \end{array} \]
      6. sqr-neg41.0%

        \[\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{{\left(\sqrt{b \cdot b} + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)\right)}^{2}}}{2 \cdot a}\\ \end{array} \]
      7. sqrt-prod0.0%

        \[\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{{\left(\sqrt{b} \cdot \sqrt{b} + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)\right)}^{2}}}{2 \cdot a}\\ \end{array} \]
      8. add-sqr-sqrt41.3%

        \[\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{{\left(b + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)\right)}^{2}}}{2 \cdot a}\\ \end{array} \]
      9. +-commutative41.3%

        \[\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{{\left(b + \left(-2 \cdot \frac{a \cdot c}{b} + b\right)\right)}^{2}}}{2 \cdot a}\\ \end{array} \]
      10. fma-define41.3%

        \[\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{{\left(b + \mathsf{fma}\left(-2, \frac{a \cdot c}{b}, b\right)\right)}^{2}}}{2 \cdot a}\\ \end{array} \]
      11. associate-/l*41.3%

        \[\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{{\left(b + \mathsf{fma}\left(-2, a \cdot \frac{c}{b}, b\right)\right)}^{2}}}{2 \cdot a}\\ \end{array} \]
    8. Applied egg-rr41.3%

      \[\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{{\left(b + \mathsf{fma}\left(-2, a \cdot \frac{c}{b}, b\right)\right)}^{2}}}{2 \cdot a}\\ \end{array} \]
    9. Step-by-step derivation
      1. unpow241.3%

        \[\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{\left(b + \mathsf{fma}\left(-2, a \cdot \frac{c}{b}, b\right)\right) \cdot \left(b + \mathsf{fma}\left(-2, a \cdot \frac{c}{b}, b\right)\right)}}{2 \cdot a}\\ \end{array} \]
      2. rem-sqrt-square98.3%

        \[\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{\left|b + \mathsf{fma}\left(-2, a \cdot \frac{c}{b}, b\right)\right|}{2 \cdot a}\\ \end{array} \]
      3. associate-*r/88.8%

        \[\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{\left|b + \mathsf{fma}\left(-2, \frac{a \cdot c}{b}, b\right)\right|}{2 \cdot a}\\ \end{array} \]
      4. *-commutative88.8%

        \[\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{\left|b + \mathsf{fma}\left(-2, \frac{c \cdot a}{b}, b\right)\right|}{2 \cdot a}\\ \end{array} \]
      5. associate-*r/98.3%

        \[\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{\left|b + \mathsf{fma}\left(-2, c \cdot \frac{a}{b}, b\right)\right|}{2 \cdot a}\\ \end{array} \]
    10. Simplified98.3%

      \[\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{\left|b + \mathsf{fma}\left(-2, c \cdot \frac{a}{b}, b\right)\right|}{2 \cdot a}\\ \end{array} \]
    11. Taylor expanded in b around 0 88.8%

      \[\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}:\\ \;\;\;\;0.5 \cdot \frac{\left|-2 \cdot \frac{a \cdot c}{b} + 2 \cdot b\right|}{a}\\ \end{array} \]
    12. Step-by-step derivation
      1. metadata-eval88.8%

        \[\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}:\\ \;\;\;\;0.5 \cdot \frac{\left|-2 \cdot \frac{a \cdot c}{b} + \left(--2\right) \cdot b\right|}{a}\\ \end{array} \]
      2. cancel-sign-sub-inv88.8%

        \[\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}:\\ \;\;\;\;0.5 \cdot \frac{\left|-2 \cdot \frac{a \cdot c}{b} - -2 \cdot b\right|}{a}\\ \end{array} \]
      3. distribute-lft-out--88.8%

        \[\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}:\\ \;\;\;\;0.5 \cdot \frac{\left|-2 \cdot \left(\frac{a \cdot c}{b} - b\right)\right|}{a}\\ \end{array} \]
      4. fabs-mul88.8%

        \[\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}:\\ \;\;\;\;\color{blue}{0.5} \cdot \frac{\left|-2\right| \cdot \left|\frac{a \cdot c}{b} - b\right|}{a}\\ \end{array} \]
      5. metadata-eval88.8%

        \[\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}:\\ \;\;\;\;0.5 \cdot \frac{2 \cdot \left|\frac{a \cdot c}{b} - b\right|}{a}\\ \end{array} \]
      6. associate-/l*98.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}:\\ \;\;\;\;0.5 \cdot \frac{2 \cdot \left|a \cdot \frac{c}{b} - b\right|}{a}\\ \end{array} \]
    13. Simplified98.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}:\\ \;\;\;\;0.5 \cdot \frac{2 \cdot \left|a \cdot \frac{c}{b} - b\right|}{a}\\ \end{array} \]

    if -5.00000000000000004e154 < b

    1. Initial program 76.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
    3. Taylor expanded in a around 0 76.4%

      \[\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--76.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}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
      2. associate-/l*77.3%

        \[\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. fma-neg77.3%

        \[\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. Simplified77.3%

      \[\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} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification81.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -5 \cdot 10^{+154}:\\ \;\;\;\;\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}:\\ \;\;\;\;0.5 \cdot \frac{2 \cdot \left|a \cdot \frac{c}{b} - b\right|}{a}\\ \end{array}\\ \mathbf{elif}\;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(a \cdot 4\right)} - b}{2 \cdot a}\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 67.1% 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}:\\ \;\;\;\;0.5 \cdot \frac{2 \cdot \left|a \cdot \frac{c}{b} - b\right|}{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))))
   (* 0.5 (/ (* 2.0 (fabs (- (* a (/ c b)) b))) 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 = 0.5 * ((2.0 * fabs(((a * (c / b)) - b))) / 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(0.5 * Float64(Float64(2.0 * abs(Float64(Float64(a * Float64(c / b)) - b))) / 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[(0.5 * N[(N[(2.0 * N[Abs[N[(N[(a * N[(c / b), $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 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}:\\
\;\;\;\;0.5 \cdot \frac{2 \cdot \left|a \cdot \frac{c}{b} - b\right|}{a}\\


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

    \[\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 69.3%

    \[\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--69.3%

      \[\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.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. fma-neg70.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. Simplified70.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} \]
  6. Taylor expanded in a around 0 33.9%

    \[\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{\left(-b\right) + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)}{2 \cdot a}\\ \end{array} \]
  7. Step-by-step derivation
    1. add-sqr-sqrt33.7%

      \[\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{\left(-b\right) + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)} \cdot \sqrt{\left(-b\right) + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)}}{2 \cdot a}\\ \end{array} \]
    2. sqrt-unprod34.4%

      \[\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{\left(\left(-b\right) + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)\right) \cdot \left(\left(-b\right) + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)\right)}}{2 \cdot a}\\ \end{array} \]
    3. pow234.4%

      \[\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{{\left(\left(-b\right) + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)\right)}^{2}}}{2 \cdot a}\\ \end{array} \]
    4. add-sqr-sqrt38.5%

      \[\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{{\left(\sqrt{-b} \cdot \sqrt{-b} + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)\right)}^{2}}}{2 \cdot a}\\ \end{array} \]
    5. sqrt-unprod42.3%

      \[\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{{\left(\sqrt{\left(-b\right) \cdot \left(-b\right)} + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)\right)}^{2}}}{2 \cdot a}\\ \end{array} \]
    6. sqr-neg42.3%

      \[\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{{\left(\sqrt{b \cdot b} + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)\right)}^{2}}}{2 \cdot a}\\ \end{array} \]
    7. sqrt-prod32.7%

      \[\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{{\left(\sqrt{b} \cdot \sqrt{b} + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)\right)}^{2}}}{2 \cdot a}\\ \end{array} \]
    8. add-sqr-sqrt59.4%

      \[\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{{\left(b + \left(b + -2 \cdot \frac{a \cdot c}{b}\right)\right)}^{2}}}{2 \cdot a}\\ \end{array} \]
    9. +-commutative59.4%

      \[\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{{\left(b + \left(-2 \cdot \frac{a \cdot c}{b} + b\right)\right)}^{2}}}{2 \cdot a}\\ \end{array} \]
    10. fma-define59.4%

      \[\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{{\left(b + \mathsf{fma}\left(-2, \frac{a \cdot c}{b}, b\right)\right)}^{2}}}{2 \cdot a}\\ \end{array} \]
    11. associate-/l*59.4%

      \[\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{{\left(b + \mathsf{fma}\left(-2, a \cdot \frac{c}{b}, b\right)\right)}^{2}}}{2 \cdot a}\\ \end{array} \]
  8. Applied egg-rr59.4%

    \[\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{{\left(b + \mathsf{fma}\left(-2, a \cdot \frac{c}{b}, b\right)\right)}^{2}}}{2 \cdot a}\\ \end{array} \]
  9. Step-by-step derivation
    1. unpow259.4%

      \[\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{\left(b + \mathsf{fma}\left(-2, a \cdot \frac{c}{b}, b\right)\right) \cdot \left(b + \mathsf{fma}\left(-2, a \cdot \frac{c}{b}, b\right)\right)}}{2 \cdot a}\\ \end{array} \]
    2. rem-sqrt-square72.6%

      \[\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{\left|b + \mathsf{fma}\left(-2, a \cdot \frac{c}{b}, b\right)\right|}{2 \cdot a}\\ \end{array} \]
    3. associate-*r/70.6%

      \[\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{\left|b + \mathsf{fma}\left(-2, \frac{a \cdot c}{b}, b\right)\right|}{2 \cdot a}\\ \end{array} \]
    4. *-commutative70.6%

      \[\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{\left|b + \mathsf{fma}\left(-2, \frac{c \cdot a}{b}, b\right)\right|}{2 \cdot a}\\ \end{array} \]
    5. associate-*r/72.5%

      \[\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{\left|b + \mathsf{fma}\left(-2, c \cdot \frac{a}{b}, b\right)\right|}{2 \cdot a}\\ \end{array} \]
  10. Simplified72.5%

    \[\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{\left|b + \mathsf{fma}\left(-2, c \cdot \frac{a}{b}, b\right)\right|}{2 \cdot a}\\ \end{array} \]
  11. Taylor expanded in b around 0 70.6%

    \[\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}:\\ \;\;\;\;0.5 \cdot \frac{\left|-2 \cdot \frac{a \cdot c}{b} + 2 \cdot b\right|}{a}\\ \end{array} \]
  12. Step-by-step derivation
    1. metadata-eval70.6%

      \[\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}:\\ \;\;\;\;0.5 \cdot \frac{\left|-2 \cdot \frac{a \cdot c}{b} + \left(--2\right) \cdot b\right|}{a}\\ \end{array} \]
    2. cancel-sign-sub-inv70.6%

      \[\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}:\\ \;\;\;\;0.5 \cdot \frac{\left|-2 \cdot \frac{a \cdot c}{b} - -2 \cdot b\right|}{a}\\ \end{array} \]
    3. distribute-lft-out--70.6%

      \[\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}:\\ \;\;\;\;0.5 \cdot \frac{\left|-2 \cdot \left(\frac{a \cdot c}{b} - b\right)\right|}{a}\\ \end{array} \]
    4. fabs-mul70.6%

      \[\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}:\\ \;\;\;\;\color{blue}{0.5} \cdot \frac{\left|-2\right| \cdot \left|\frac{a \cdot c}{b} - b\right|}{a}\\ \end{array} \]
    5. metadata-eval70.6%

      \[\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}:\\ \;\;\;\;0.5 \cdot \frac{2 \cdot \left|\frac{a \cdot c}{b} - b\right|}{a}\\ \end{array} \]
    6. associate-/l*72.5%

      \[\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}:\\ \;\;\;\;0.5 \cdot \frac{2 \cdot \left|a \cdot \frac{c}{b} - b\right|}{a}\\ \end{array} \]
  13. Simplified72.5%

    \[\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}:\\ \;\;\;\;0.5 \cdot \frac{2 \cdot \left|a \cdot \frac{c}{b} - b\right|}{a}\\ \end{array} \]
  14. Final simplification72.5%

    \[\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}:\\ \;\;\;\;0.5 \cdot \frac{2 \cdot \left|a \cdot \frac{c}{b} - b\right|}{a}\\ \end{array} \]
  15. Add Preprocessing

Alternative 7: 66.8% accurate, 10.1× speedup?

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

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


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

    \[\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. Simplified69.1%

    \[\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 b around -inf 71.2%

    \[\leadsto \begin{array}{l} \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 - -1 \cdot b}{a \cdot -2}\\ \end{array} \]
  5. Taylor expanded in b around inf 71.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;c \cdot \color{blue}{\frac{-1}{b}}\\ \mathbf{else}:\\ \;\;\;\;\frac{b - -1 \cdot b}{a \cdot -2}\\ \end{array} \]
  6. Final simplification71.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;c \cdot \frac{-1}{b}\\ \mathbf{else}:\\ \;\;\;\;\frac{b + b}{a \cdot -2}\\ \end{array} \]
  7. Add Preprocessing

Alternative 8: 66.9% accurate, 10.1× speedup?

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

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

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


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

    \[\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. Simplified69.1%

    \[\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 b around -inf 71.2%

    \[\leadsto \begin{array}{l} \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 - -1 \cdot b}{a \cdot -2}\\ \end{array} \]
  5. Taylor expanded in c around 0 72.0%

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

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

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

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

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

Reproduce

?
herbie shell --seed 2024078 
(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))))