jeff quadratic root 1

Percentage Accurate: 72.2% → 90.5%
Time: 20.4s
Alternatives: 9
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{\left(-b\right) - t_0}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) + t_0}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (sqrt (- (* b b) (* (* 4.0 a) c)))))
   (if (>= b 0.0) (/ (- (- b) t_0) (* 2.0 a)) (/ (* 2.0 c) (+ (- b) t_0)))))
double code(double a, double b, double c) {
	double t_0 = sqrt(((b * b) - ((4.0 * a) * c)));
	double tmp;
	if (b >= 0.0) {
		tmp = (-b - t_0) / (2.0 * a);
	} else {
		tmp = (2.0 * c) / (-b + t_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) :: t_0
    real(8) :: tmp
    t_0 = sqrt(((b * b) - ((4.0d0 * a) * c)))
    if (b >= 0.0d0) then
        tmp = (-b - t_0) / (2.0d0 * a)
    else
        tmp = (2.0d0 * c) / (-b + t_0)
    end if
    code = tmp
end function
public static double code(double a, double b, double c) {
	double t_0 = Math.sqrt(((b * b) - ((4.0 * a) * c)));
	double tmp;
	if (b >= 0.0) {
		tmp = (-b - t_0) / (2.0 * a);
	} else {
		tmp = (2.0 * c) / (-b + t_0);
	}
	return tmp;
}
def code(a, b, c):
	t_0 = math.sqrt(((b * b) - ((4.0 * a) * c)))
	tmp = 0
	if b >= 0.0:
		tmp = (-b - t_0) / (2.0 * a)
	else:
		tmp = (2.0 * c) / (-b + t_0)
	return tmp
function code(a, b, c)
	t_0 = sqrt(Float64(Float64(b * b) - Float64(Float64(4.0 * a) * c)))
	tmp = 0.0
	if (b >= 0.0)
		tmp = Float64(Float64(Float64(-b) - t_0) / Float64(2.0 * a));
	else
		tmp = Float64(Float64(2.0 * c) / Float64(Float64(-b) + t_0));
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	t_0 = sqrt(((b * b) - ((4.0 * a) * c)));
	tmp = 0.0;
	if (b >= 0.0)
		tmp = (-b - t_0) / (2.0 * a);
	else
		tmp = (2.0 * c) / (-b + t_0);
	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[((-b) - t$95$0), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 * c), $MachinePrecision] / N[((-b) + t$95$0), $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{\left(-b\right) - t_0}{2 \cdot a}\\

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


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

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


\end{array}
\end{array}

Alternative 1: 90.5% accurate, 1.0× 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^{+153}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \frac{\mathsf{fma}\left(-2, \frac{a \cdot c}{b}, b \cdot 2\right)}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{\mathsf{fma}\left(-2, b, \frac{c}{b} \cdot \left(a \cdot 2\right)\right)}\\ \end{array}\\ \mathbf{elif}\;b \leq 9.5 \cdot 10^{+116}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{\left(-b\right) - t_0}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{t_0 - b}\\ \end{array}\\ \mathbf{else}:\\ \;\;\;\;\frac{-b}{a}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (sqrt (- (* b b) (* c (* a 4.0))))))
   (if (<= b -5e+153)
     (if (>= b 0.0)
       (* -0.5 (/ (fma -2.0 (/ (* a c) b) (* b 2.0)) a))
       (/ (* c 2.0) (fma -2.0 b (* (/ c b) (* a 2.0)))))
     (if (<= b 9.5e+116)
       (if (>= b 0.0) (/ (- (- b) t_0) (* a 2.0)) (/ (* c 2.0) (- t_0 b)))
       (/ (- b) 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+153) {
		double tmp_2;
		if (b >= 0.0) {
			tmp_2 = -0.5 * (fma(-2.0, ((a * c) / b), (b * 2.0)) / a);
		} else {
			tmp_2 = (c * 2.0) / fma(-2.0, b, ((c / b) * (a * 2.0)));
		}
		tmp_1 = tmp_2;
	} else if (b <= 9.5e+116) {
		double tmp_3;
		if (b >= 0.0) {
			tmp_3 = (-b - t_0) / (a * 2.0);
		} else {
			tmp_3 = (c * 2.0) / (t_0 - b);
		}
		tmp_1 = tmp_3;
	} else {
		tmp_1 = -b / 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+153)
		tmp_2 = 0.0
		if (b >= 0.0)
			tmp_2 = Float64(-0.5 * Float64(fma(-2.0, Float64(Float64(a * c) / b), Float64(b * 2.0)) / a));
		else
			tmp_2 = Float64(Float64(c * 2.0) / fma(-2.0, b, Float64(Float64(c / b) * Float64(a * 2.0))));
		end
		tmp_1 = tmp_2;
	elseif (b <= 9.5e+116)
		tmp_3 = 0.0
		if (b >= 0.0)
			tmp_3 = Float64(Float64(Float64(-b) - t_0) / Float64(a * 2.0));
		else
			tmp_3 = Float64(Float64(c * 2.0) / Float64(t_0 - b));
		end
		tmp_1 = tmp_3;
	else
		tmp_1 = Float64(Float64(-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]}, If[LessEqual[b, -5e+153], If[GreaterEqual[b, 0.0], N[(-0.5 * N[(N[(-2.0 * N[(N[(a * c), $MachinePrecision] / b), $MachinePrecision] + N[(b * 2.0), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(N[(c * 2.0), $MachinePrecision] / N[(-2.0 * b + N[(N[(c / b), $MachinePrecision] * N[(a * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], If[LessEqual[b, 9.5e+116], If[GreaterEqual[b, 0.0], N[(N[((-b) - t$95$0), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(c * 2.0), $MachinePrecision] / N[(t$95$0 - b), $MachinePrecision]), $MachinePrecision]], N[((-b) / a), $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^{+153}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;-0.5 \cdot \frac{\mathsf{fma}\left(-2, \frac{a \cdot c}{b}, b \cdot 2\right)}{a}\\

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


\end{array}\\

\mathbf{elif}\;b \leq 9.5 \cdot 10^{+116}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{\left(-b\right) - t_0}{a \cdot 2}\\

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


\end{array}\\

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


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

    1. Initial program 38.8%

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

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

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

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

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

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

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

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \frac{b + \sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -4\right)\right)}}{a}\\ \mathbf{else}:\\ \;\;\;\;e^{\mathsf{log1p}\left(c \cdot \frac{2}{\mathsf{fma}\left(-2, b, 2 \cdot \frac{a}{\frac{b}{c}}\right)}\right)} - 1\\ \end{array} \]
      3. associate-*r/43.9%

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

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

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

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \frac{b + \sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -4\right)\right)}}{a}\\ \mathbf{else}:\\ \;\;\;\;e^{\mathsf{log1p}\left(\frac{c \cdot 2}{\mathsf{fma}\left(-2, b, \left(2 \cdot a\right) \cdot \frac{c}{b}\right)}\right)} - 1\\ \end{array} \]
    8. Step-by-step derivation
      1. expm1-def97.6%

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

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

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

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

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

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

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

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

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

    if -5.00000000000000018e153 < b < 9.5000000000000004e116

    1. Initial program 88.7%

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

    if 9.5000000000000004e116 < b

    1. Initial program 42.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-b}{a}\\ \end{array} \]
    10. Simplified93.8%

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

Alternative 2: 90.2% accurate, 1.0× speedup?

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

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

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


\end{array}\\

\mathbf{elif}\;b \leq 4 \cdot 10^{+113}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{\left(-b\right) - t_0}{a \cdot 2}\\

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


\end{array}\\

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


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

    1. Initial program 41.1%

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

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

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

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

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

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

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

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \frac{b + \sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -4\right)\right)}}{a}\\ \mathbf{else}:\\ \;\;\;\;e^{\mathsf{log1p}\left(c \cdot \frac{2}{\mathsf{fma}\left(-2, b, 2 \cdot \frac{a}{\frac{b}{c}}\right)}\right)} - 1\\ \end{array} \]
      3. associate-*r/42.3%

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

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \frac{b + \sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -4\right)\right)}}{a}\\ \mathbf{else}:\\ \;\;\;\;e^{\mathsf{log1p}\left(\frac{c \cdot 2}{\mathsf{fma}\left(-2, b, \frac{2 \cdot a}{\frac{b}{c}}\right)}\right)} - 1\\ \end{array} \]
      5. div-inv42.3%

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

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \frac{b + \sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -4\right)\right)}}{a}\\ \mathbf{else}:\\ \;\;\;\;e^{\mathsf{log1p}\left(\frac{c \cdot 2}{\mathsf{fma}\left(-2, b, \left(2 \cdot a\right) \cdot \frac{c}{b}\right)}\right)} - 1\\ \end{array} \]
    7. Applied egg-rr42.3%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \frac{b + \sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -4\right)\right)}}{a}\\ \mathbf{else}:\\ \;\;\;\;e^{\mathsf{log1p}\left(\frac{c \cdot 2}{\mathsf{fma}\left(-2, b, \left(2 \cdot a\right) \cdot \frac{c}{b}\right)}\right)} - 1\\ \end{array} \]
    8. Step-by-step derivation
      1. expm1-def95.8%

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

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

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

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

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

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

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

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

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

    if -5.00000000000000025e141 < b < 4e113

    1. Initial program 88.6%

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

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

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

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

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

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

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

    if 4e113 < b

    1. Initial program 42.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-b}{a}\\ \end{array} \]
    10. Simplified93.8%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-b}{a}\\ \end{array} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification91.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -5 \cdot 10^{+141}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \frac{\mathsf{fma}\left(-2, \frac{a \cdot c}{b}, b \cdot 2\right)}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{\mathsf{fma}\left(-2, b, \frac{c}{b} \cdot \left(a \cdot 2\right)\right)}\\ \end{array}\\ \mathbf{elif}\;b \leq 4 \cdot 10^{+113}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{\left(-b\right) - \sqrt{b \cdot b - \left(a \cdot c\right) \cdot 4}}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{\frac{\sqrt{b \cdot b - \left(a \cdot c\right) \cdot 4} - b}{c}}\\ \end{array}\\ \mathbf{else}:\\ \;\;\;\;\frac{-b}{a}\\ \end{array} \]

Alternative 3: 78.7% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.9 \cdot 10^{+139}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;-0.5 \cdot \frac{\mathsf{fma}\left(-2, \frac{a \cdot c}{b}, b \cdot 2\right)}{a}\\

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


\end{array}\\

\mathbf{elif}\;b \geq 0:\\
\;\;\;\;\frac{-b}{a}\\

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


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

    1. Initial program 41.1%

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

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

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

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

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

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

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

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \frac{b + \sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -4\right)\right)}}{a}\\ \mathbf{else}:\\ \;\;\;\;e^{\mathsf{log1p}\left(c \cdot \frac{2}{\mathsf{fma}\left(-2, b, 2 \cdot \frac{a}{\frac{b}{c}}\right)}\right)} - 1\\ \end{array} \]
      3. associate-*r/42.3%

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

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \frac{b + \sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -4\right)\right)}}{a}\\ \mathbf{else}:\\ \;\;\;\;e^{\mathsf{log1p}\left(\frac{c \cdot 2}{\mathsf{fma}\left(-2, b, \frac{2 \cdot a}{\frac{b}{c}}\right)}\right)} - 1\\ \end{array} \]
      5. div-inv42.3%

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

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \frac{b + \sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -4\right)\right)}}{a}\\ \mathbf{else}:\\ \;\;\;\;e^{\mathsf{log1p}\left(\frac{c \cdot 2}{\mathsf{fma}\left(-2, b, \left(2 \cdot a\right) \cdot \frac{c}{b}\right)}\right)} - 1\\ \end{array} \]
    7. Applied egg-rr42.3%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \frac{b + \sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -4\right)\right)}}{a}\\ \mathbf{else}:\\ \;\;\;\;e^{\mathsf{log1p}\left(\frac{c \cdot 2}{\mathsf{fma}\left(-2, b, \left(2 \cdot a\right) \cdot \frac{c}{b}\right)}\right)} - 1\\ \end{array} \]
    8. Step-by-step derivation
      1. expm1-def95.8%

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

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

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

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

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

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

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

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

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

    if -1.9e139 < b

    1. Initial program 78.4%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 67.1% accurate, 1.0× speedup?

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \frac{\mathsf{fma}\left(-2, e^{\mathsf{log1p}\left(\frac{\color{blue}{c \cdot a}}{b}\right)} - 1, b \cdot 2\right)}{a}\\ \mathbf{else}:\\ \;\;\;\;c \cdot \frac{2}{\mathsf{fma}\left(-2, b, 2 \cdot \frac{a}{\frac{b}{c}}\right)}\\ \end{array} \]
    4. *-un-lft-identity64.4%

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \frac{\mathsf{fma}\left(-2, e^{\mathsf{log1p}\left(\color{blue}{\frac{c}{1} \cdot \frac{a}{b}}\right)} - 1, b \cdot 2\right)}{a}\\ \mathbf{else}:\\ \;\;\;\;c \cdot \frac{2}{\mathsf{fma}\left(-2, b, 2 \cdot \frac{a}{\frac{b}{c}}\right)}\\ \end{array} \]
    6. /-rgt-identity65.6%

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

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

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

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

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

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

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

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

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

Alternative 5: 66.7% accurate, 7.8× speedup?

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 66.7% accurate, 10.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;-0.5 \cdot \frac{1}{\frac{a}{b \cdot 2}}\\

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 66.5% accurate, 13.0× speedup?

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 34.6% accurate, 16.7× speedup?

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;\color{blue}{2} \cdot \frac{-0.5}{\frac{a}{b}}\\ \end{array} \]
  9. Applied egg-rr31.4%

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot -0.5}{\frac{a}{b}}\\ \end{array} \]
    2. metadata-eval31.4%

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{\frac{a}{b}}\\ \end{array} \]
  11. Simplified31.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{\frac{a}{b}}\\ \end{array} \]
  12. Final simplification31.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{\frac{a}{b}}\\ \end{array} \]

Alternative 9: 34.6% accurate, 29.5× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-b}{a}\\ \end{array} \]
  10. Simplified31.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-b}{a}\\ \end{array} \]
  11. Final simplification31.4%

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

Reproduce

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