jeff quadratic root 2

Percentage Accurate: 72.3% → 91.2%
Time: 23.4s
Alternatives: 11
Speedup: 1.0×

Specification

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

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

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


\end{array}
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 11 alternatives:

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

Initial Program: 72.3% accurate, 1.0× speedup?

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

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

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


\end{array}
\end{array}

Alternative 1: 91.2% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := c \cdot \left(a \cdot -4\right)\\ t_1 := \sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)}\\ t_2 := c \cdot \frac{-2}{b + b}\\ t_3 := \frac{b + b}{a} \cdot -0.5\\ \mathbf{if}\;b \leq -4.4 \cdot 10^{+151}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_3\\ \end{array}\\ \mathbf{elif}\;b \leq -2 \cdot 10^{-154}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\mathsf{expm1}\left(\frac{-c}{b}\right)\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{b - \sqrt{b \cdot b + t_0}}{a}\\ \end{array}\\ \mathbf{elif}\;b \leq -5 \cdot 10^{-256}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{1}{\frac{a}{b - \mathsf{hypot}\left(b, \sqrt{t_0}\right)}}\\ \end{array}\\ \mathbf{elif}\;b \leq 2.4 \cdot 10^{+90}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{c \cdot 2}{\left(-b\right) - t_1}\\ \mathbf{else}:\\ \;\;\;\;\frac{t_1 - b}{a \cdot 2}\\ \end{array}\\ \mathbf{elif}\;b \geq 0:\\ \;\;\;\;\frac{c \cdot -2}{b + b}\\ \mathbf{else}:\\ \;\;\;\;t_3\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (* c (* a -4.0)))
        (t_1 (sqrt (- (* b b) (* c (* a 4.0)))))
        (t_2 (* c (/ -2.0 (+ b b))))
        (t_3 (* (/ (+ b b) a) -0.5)))
   (if (<= b -4.4e+151)
     (if (>= b 0.0) t_2 t_3)
     (if (<= b -2e-154)
       (if (>= b 0.0)
         (expm1 (/ (- c) b))
         (* -0.5 (/ (- b (sqrt (+ (* b b) t_0))) a)))
       (if (<= b -5e-256)
         (if (>= b 0.0) t_2 (* -0.5 (/ 1.0 (/ a (- b (hypot b (sqrt t_0)))))))
         (if (<= b 2.4e+90)
           (if (>= b 0.0) (/ (* c 2.0) (- (- b) t_1)) (/ (- t_1 b) (* a 2.0)))
           (if (>= b 0.0) (/ (* c -2.0) (+ b b)) t_3)))))))
double code(double a, double b, double c) {
	double t_0 = c * (a * -4.0);
	double t_1 = sqrt(((b * b) - (c * (a * 4.0))));
	double t_2 = c * (-2.0 / (b + b));
	double t_3 = ((b + b) / a) * -0.5;
	double tmp_1;
	if (b <= -4.4e+151) {
		double tmp_2;
		if (b >= 0.0) {
			tmp_2 = t_2;
		} else {
			tmp_2 = t_3;
		}
		tmp_1 = tmp_2;
	} else if (b <= -2e-154) {
		double tmp_3;
		if (b >= 0.0) {
			tmp_3 = expm1((-c / b));
		} else {
			tmp_3 = -0.5 * ((b - sqrt(((b * b) + t_0))) / a);
		}
		tmp_1 = tmp_3;
	} else if (b <= -5e-256) {
		double tmp_4;
		if (b >= 0.0) {
			tmp_4 = t_2;
		} else {
			tmp_4 = -0.5 * (1.0 / (a / (b - hypot(b, sqrt(t_0)))));
		}
		tmp_1 = tmp_4;
	} else if (b <= 2.4e+90) {
		double tmp_5;
		if (b >= 0.0) {
			tmp_5 = (c * 2.0) / (-b - t_1);
		} else {
			tmp_5 = (t_1 - b) / (a * 2.0);
		}
		tmp_1 = tmp_5;
	} else if (b >= 0.0) {
		tmp_1 = (c * -2.0) / (b + b);
	} else {
		tmp_1 = t_3;
	}
	return tmp_1;
}
public static double code(double a, double b, double c) {
	double t_0 = c * (a * -4.0);
	double t_1 = Math.sqrt(((b * b) - (c * (a * 4.0))));
	double t_2 = c * (-2.0 / (b + b));
	double t_3 = ((b + b) / a) * -0.5;
	double tmp_1;
	if (b <= -4.4e+151) {
		double tmp_2;
		if (b >= 0.0) {
			tmp_2 = t_2;
		} else {
			tmp_2 = t_3;
		}
		tmp_1 = tmp_2;
	} else if (b <= -2e-154) {
		double tmp_3;
		if (b >= 0.0) {
			tmp_3 = Math.expm1((-c / b));
		} else {
			tmp_3 = -0.5 * ((b - Math.sqrt(((b * b) + t_0))) / a);
		}
		tmp_1 = tmp_3;
	} else if (b <= -5e-256) {
		double tmp_4;
		if (b >= 0.0) {
			tmp_4 = t_2;
		} else {
			tmp_4 = -0.5 * (1.0 / (a / (b - Math.hypot(b, Math.sqrt(t_0)))));
		}
		tmp_1 = tmp_4;
	} else if (b <= 2.4e+90) {
		double tmp_5;
		if (b >= 0.0) {
			tmp_5 = (c * 2.0) / (-b - t_1);
		} else {
			tmp_5 = (t_1 - b) / (a * 2.0);
		}
		tmp_1 = tmp_5;
	} else if (b >= 0.0) {
		tmp_1 = (c * -2.0) / (b + b);
	} else {
		tmp_1 = t_3;
	}
	return tmp_1;
}
def code(a, b, c):
	t_0 = c * (a * -4.0)
	t_1 = math.sqrt(((b * b) - (c * (a * 4.0))))
	t_2 = c * (-2.0 / (b + b))
	t_3 = ((b + b) / a) * -0.5
	tmp_1 = 0
	if b <= -4.4e+151:
		tmp_2 = 0
		if b >= 0.0:
			tmp_2 = t_2
		else:
			tmp_2 = t_3
		tmp_1 = tmp_2
	elif b <= -2e-154:
		tmp_3 = 0
		if b >= 0.0:
			tmp_3 = math.expm1((-c / b))
		else:
			tmp_3 = -0.5 * ((b - math.sqrt(((b * b) + t_0))) / a)
		tmp_1 = tmp_3
	elif b <= -5e-256:
		tmp_4 = 0
		if b >= 0.0:
			tmp_4 = t_2
		else:
			tmp_4 = -0.5 * (1.0 / (a / (b - math.hypot(b, math.sqrt(t_0)))))
		tmp_1 = tmp_4
	elif b <= 2.4e+90:
		tmp_5 = 0
		if b >= 0.0:
			tmp_5 = (c * 2.0) / (-b - t_1)
		else:
			tmp_5 = (t_1 - b) / (a * 2.0)
		tmp_1 = tmp_5
	elif b >= 0.0:
		tmp_1 = (c * -2.0) / (b + b)
	else:
		tmp_1 = t_3
	return tmp_1
function code(a, b, c)
	t_0 = Float64(c * Float64(a * -4.0))
	t_1 = sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 4.0))))
	t_2 = Float64(c * Float64(-2.0 / Float64(b + b)))
	t_3 = Float64(Float64(Float64(b + b) / a) * -0.5)
	tmp_1 = 0.0
	if (b <= -4.4e+151)
		tmp_2 = 0.0
		if (b >= 0.0)
			tmp_2 = t_2;
		else
			tmp_2 = t_3;
		end
		tmp_1 = tmp_2;
	elseif (b <= -2e-154)
		tmp_3 = 0.0
		if (b >= 0.0)
			tmp_3 = expm1(Float64(Float64(-c) / b));
		else
			tmp_3 = Float64(-0.5 * Float64(Float64(b - sqrt(Float64(Float64(b * b) + t_0))) / a));
		end
		tmp_1 = tmp_3;
	elseif (b <= -5e-256)
		tmp_4 = 0.0
		if (b >= 0.0)
			tmp_4 = t_2;
		else
			tmp_4 = Float64(-0.5 * Float64(1.0 / Float64(a / Float64(b - hypot(b, sqrt(t_0))))));
		end
		tmp_1 = tmp_4;
	elseif (b <= 2.4e+90)
		tmp_5 = 0.0
		if (b >= 0.0)
			tmp_5 = Float64(Float64(c * 2.0) / Float64(Float64(-b) - t_1));
		else
			tmp_5 = Float64(Float64(t_1 - b) / Float64(a * 2.0));
		end
		tmp_1 = tmp_5;
	elseif (b >= 0.0)
		tmp_1 = Float64(Float64(c * -2.0) / Float64(b + b));
	else
		tmp_1 = t_3;
	end
	return tmp_1
end
code[a_, b_, c_] := Block[{t$95$0 = N[(c * N[(a * -4.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(c * N[(a * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(c * N[(-2.0 / N[(b + b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[(b + b), $MachinePrecision] / a), $MachinePrecision] * -0.5), $MachinePrecision]}, If[LessEqual[b, -4.4e+151], If[GreaterEqual[b, 0.0], t$95$2, t$95$3], If[LessEqual[b, -2e-154], If[GreaterEqual[b, 0.0], N[(Exp[N[((-c) / b), $MachinePrecision]] - 1), $MachinePrecision], N[(-0.5 * N[(N[(b - N[Sqrt[N[(N[(b * b), $MachinePrecision] + t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]], If[LessEqual[b, -5e-256], If[GreaterEqual[b, 0.0], t$95$2, N[(-0.5 * N[(1.0 / N[(a / N[(b - N[Sqrt[b ^ 2 + N[Sqrt[t$95$0], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], If[LessEqual[b, 2.4e+90], If[GreaterEqual[b, 0.0], N[(N[(c * 2.0), $MachinePrecision] / N[((-b) - t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]], If[GreaterEqual[b, 0.0], N[(N[(c * -2.0), $MachinePrecision] / N[(b + b), $MachinePrecision]), $MachinePrecision], t$95$3]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := c \cdot \left(a \cdot -4\right)\\
t_1 := \sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)}\\
t_2 := c \cdot \frac{-2}{b + b}\\
t_3 := \frac{b + b}{a} \cdot -0.5\\
\mathbf{if}\;b \leq -4.4 \cdot 10^{+151}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;t_2\\

\mathbf{else}:\\
\;\;\;\;t_3\\


\end{array}\\

\mathbf{elif}\;b \leq -2 \cdot 10^{-154}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\mathsf{expm1}\left(\frac{-c}{b}\right)\\

\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{b - \sqrt{b \cdot b + t_0}}{a}\\


\end{array}\\

\mathbf{elif}\;b \leq -5 \cdot 10^{-256}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;t_2\\

\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{1}{\frac{a}{b - \mathsf{hypot}\left(b, \sqrt{t_0}\right)}}\\


\end{array}\\

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

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


\end{array}\\

\mathbf{elif}\;b \geq 0:\\
\;\;\;\;\frac{c \cdot -2}{b + b}\\

\mathbf{else}:\\
\;\;\;\;t_3\\


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if b < -4.40000000000000013e151

    1. Initial program 38.2%

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

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

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;c \cdot \frac{-2}{b + b}\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot b}{a} \cdot -0.5\\ \end{array} \]
    5. Step-by-step derivation
      1. count-2100.0%

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

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

    if -4.40000000000000013e151 < b < -1.9999999999999999e-154

    1. Initial program 91.8%

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

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

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

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

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

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(c \cdot \frac{-2}{b + b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{b - \sqrt{b \cdot b + c \cdot \left(a \cdot -4\right)}}{a} \cdot -0.5\\ \end{array} \]
    7. Applied egg-rr91.8%

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

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

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

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

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

    if -1.9999999999999999e-154 < b < -5e-256

    1. Initial program 51.7%

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

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

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

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

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

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

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

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

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

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

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

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

    if -5e-256 < b < 2.4000000000000001e90

    1. Initial program 83.5%

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

    if 2.4000000000000001e90 < b

    1. Initial program 45.2%

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

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

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;c \cdot \frac{-2}{b + b}\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot b}{a} \cdot -0.5\\ \end{array} \]
    5. Step-by-step derivation
      1. count-296.9%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -4.4 \cdot 10^{+151}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;c \cdot \frac{-2}{b + b}\\ \mathbf{else}:\\ \;\;\;\;\frac{b + b}{a} \cdot -0.5\\ \end{array}\\ \mathbf{elif}\;b \leq -2 \cdot 10^{-154}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\mathsf{expm1}\left(\frac{-c}{b}\right)\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{b - \sqrt{b \cdot b + c \cdot \left(a \cdot -4\right)}}{a}\\ \end{array}\\ \mathbf{elif}\;b \leq -5 \cdot 10^{-256}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;c \cdot \frac{-2}{b + b}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{1}{\frac{a}{b - \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -4\right)}\right)}}\\ \end{array}\\ \mathbf{elif}\;b \leq 2.4 \cdot 10^{+90}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{c \cdot 2}{\left(-b\right) - \sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{a \cdot 2}\\ \end{array}\\ \mathbf{elif}\;b \geq 0:\\ \;\;\;\;\frac{c \cdot -2}{b + b}\\ \mathbf{else}:\\ \;\;\;\;\frac{b + b}{a} \cdot -0.5\\ \end{array} \]

Alternative 2: 91.0% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := c \cdot \left(a \cdot -4\right)\\ t_1 := \frac{b + b}{a} \cdot -0.5\\ \mathbf{if}\;b \leq -2.5 \cdot 10^{+151}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;c \cdot \frac{-2}{b + b}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array}\\ \mathbf{elif}\;b \leq -1.4 \cdot 10^{-155}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\mathsf{expm1}\left(\frac{-c}{b}\right)\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{b - \sqrt{b \cdot b + t_0}}{a}\\ \end{array}\\ \mathbf{elif}\;b \leq 6 \cdot 10^{+89}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;c \cdot \frac{-2}{b + \sqrt{\mathsf{fma}\left(b, b, t_0\right)}}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot {\left(\sqrt[3]{\frac{b - \mathsf{hypot}\left(b, \sqrt{t_0}\right)}{a}}\right)}^{3}\\ \end{array}\\ \mathbf{elif}\;b \geq 0:\\ \;\;\;\;\frac{c \cdot -2}{b + b}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (* c (* a -4.0))) (t_1 (* (/ (+ b b) a) -0.5)))
   (if (<= b -2.5e+151)
     (if (>= b 0.0) (* c (/ -2.0 (+ b b))) t_1)
     (if (<= b -1.4e-155)
       (if (>= b 0.0)
         (expm1 (/ (- c) b))
         (* -0.5 (/ (- b (sqrt (+ (* b b) t_0))) a)))
       (if (<= b 6e+89)
         (if (>= b 0.0)
           (* c (/ -2.0 (+ b (sqrt (fma b b t_0)))))
           (* -0.5 (pow (cbrt (/ (- b (hypot b (sqrt t_0))) a)) 3.0)))
         (if (>= b 0.0) (/ (* c -2.0) (+ b b)) t_1))))))
double code(double a, double b, double c) {
	double t_0 = c * (a * -4.0);
	double t_1 = ((b + b) / a) * -0.5;
	double tmp_1;
	if (b <= -2.5e+151) {
		double tmp_2;
		if (b >= 0.0) {
			tmp_2 = c * (-2.0 / (b + b));
		} else {
			tmp_2 = t_1;
		}
		tmp_1 = tmp_2;
	} else if (b <= -1.4e-155) {
		double tmp_3;
		if (b >= 0.0) {
			tmp_3 = expm1((-c / b));
		} else {
			tmp_3 = -0.5 * ((b - sqrt(((b * b) + t_0))) / a);
		}
		tmp_1 = tmp_3;
	} else if (b <= 6e+89) {
		double tmp_4;
		if (b >= 0.0) {
			tmp_4 = c * (-2.0 / (b + sqrt(fma(b, b, t_0))));
		} else {
			tmp_4 = -0.5 * pow(cbrt(((b - hypot(b, sqrt(t_0))) / a)), 3.0);
		}
		tmp_1 = tmp_4;
	} else if (b >= 0.0) {
		tmp_1 = (c * -2.0) / (b + b);
	} else {
		tmp_1 = t_1;
	}
	return tmp_1;
}
function code(a, b, c)
	t_0 = Float64(c * Float64(a * -4.0))
	t_1 = Float64(Float64(Float64(b + b) / a) * -0.5)
	tmp_1 = 0.0
	if (b <= -2.5e+151)
		tmp_2 = 0.0
		if (b >= 0.0)
			tmp_2 = Float64(c * Float64(-2.0 / Float64(b + b)));
		else
			tmp_2 = t_1;
		end
		tmp_1 = tmp_2;
	elseif (b <= -1.4e-155)
		tmp_3 = 0.0
		if (b >= 0.0)
			tmp_3 = expm1(Float64(Float64(-c) / b));
		else
			tmp_3 = Float64(-0.5 * Float64(Float64(b - sqrt(Float64(Float64(b * b) + t_0))) / a));
		end
		tmp_1 = tmp_3;
	elseif (b <= 6e+89)
		tmp_4 = 0.0
		if (b >= 0.0)
			tmp_4 = Float64(c * Float64(-2.0 / Float64(b + sqrt(fma(b, b, t_0)))));
		else
			tmp_4 = Float64(-0.5 * (cbrt(Float64(Float64(b - hypot(b, sqrt(t_0))) / a)) ^ 3.0));
		end
		tmp_1 = tmp_4;
	elseif (b >= 0.0)
		tmp_1 = Float64(Float64(c * -2.0) / Float64(b + b));
	else
		tmp_1 = t_1;
	end
	return tmp_1
end
code[a_, b_, c_] := Block[{t$95$0 = N[(c * N[(a * -4.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(b + b), $MachinePrecision] / a), $MachinePrecision] * -0.5), $MachinePrecision]}, If[LessEqual[b, -2.5e+151], If[GreaterEqual[b, 0.0], N[(c * N[(-2.0 / N[(b + b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1], If[LessEqual[b, -1.4e-155], If[GreaterEqual[b, 0.0], N[(Exp[N[((-c) / b), $MachinePrecision]] - 1), $MachinePrecision], N[(-0.5 * N[(N[(b - N[Sqrt[N[(N[(b * b), $MachinePrecision] + t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]], If[LessEqual[b, 6e+89], If[GreaterEqual[b, 0.0], N[(c * N[(-2.0 / N[(b + N[Sqrt[N[(b * b + t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[Power[N[Power[N[(N[(b - N[Sqrt[b ^ 2 + N[Sqrt[t$95$0], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], 1/3], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision]], If[GreaterEqual[b, 0.0], N[(N[(c * -2.0), $MachinePrecision] / N[(b + b), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := c \cdot \left(a \cdot -4\right)\\
t_1 := \frac{b + b}{a} \cdot -0.5\\
\mathbf{if}\;b \leq -2.5 \cdot 10^{+151}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;c \cdot \frac{-2}{b + b}\\

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}\\

\mathbf{elif}\;b \leq -1.4 \cdot 10^{-155}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\mathsf{expm1}\left(\frac{-c}{b}\right)\\

\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{b - \sqrt{b \cdot b + t_0}}{a}\\


\end{array}\\

\mathbf{elif}\;b \leq 6 \cdot 10^{+89}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;c \cdot \frac{-2}{b + \sqrt{\mathsf{fma}\left(b, b, t_0\right)}}\\

\mathbf{else}:\\
\;\;\;\;-0.5 \cdot {\left(\sqrt[3]{\frac{b - \mathsf{hypot}\left(b, \sqrt{t_0}\right)}{a}}\right)}^{3}\\


\end{array}\\

\mathbf{elif}\;b \geq 0:\\
\;\;\;\;\frac{c \cdot -2}{b + b}\\

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if b < -2.5000000000000001e151

    1. Initial program 38.2%

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

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

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;c \cdot \frac{-2}{b + b}\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot b}{a} \cdot -0.5\\ \end{array} \]
    5. Step-by-step derivation
      1. count-2100.0%

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

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

    if -2.5000000000000001e151 < b < -1.4e-155

    1. Initial program 91.8%

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

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

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

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

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

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(c \cdot \frac{-2}{b + b}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{b - \sqrt{b \cdot b + c \cdot \left(a \cdot -4\right)}}{a} \cdot -0.5\\ \end{array} \]
    7. Applied egg-rr91.8%

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

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

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

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

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

    if -1.4e-155 < b < 6.00000000000000025e89

    1. Initial program 79.3%

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

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

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

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

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

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

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

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

    if 6.00000000000000025e89 < b

    1. Initial program 45.2%

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

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

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;c \cdot \frac{-2}{b + b}\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot b}{a} \cdot -0.5\\ \end{array} \]
    5. Step-by-step derivation
      1. count-296.9%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -2.5 \cdot 10^{+151}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;c \cdot \frac{-2}{b + b}\\ \mathbf{else}:\\ \;\;\;\;\frac{b + b}{a} \cdot -0.5\\ \end{array}\\ \mathbf{elif}\;b \leq -1.4 \cdot 10^{-155}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\mathsf{expm1}\left(\frac{-c}{b}\right)\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{b - \sqrt{b \cdot b + c \cdot \left(a \cdot -4\right)}}{a}\\ \end{array}\\ \mathbf{elif}\;b \leq 6 \cdot 10^{+89}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;c \cdot \frac{-2}{b + \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)}}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot {\left(\sqrt[3]{\frac{b - \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -4\right)}\right)}{a}}\right)}^{3}\\ \end{array}\\ \mathbf{elif}\;b \geq 0:\\ \;\;\;\;\frac{c \cdot -2}{b + b}\\ \mathbf{else}:\\ \;\;\;\;\frac{b + b}{a} \cdot -0.5\\ \end{array} \]

Alternative 3: 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)}\\ t_1 := \frac{b + b}{a} \cdot -0.5\\ \mathbf{if}\;b \leq -2.6 \cdot 10^{+151}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;c \cdot \frac{-2}{b + b}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array}\\ \mathbf{elif}\;b \leq 6.8 \cdot 10^{-304}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\mathsf{expm1}\left(\frac{-c}{b}\right)\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{b - t_0}{a}\\ \end{array}\\ \mathbf{elif}\;b \leq 7.6 \cdot 10^{+89}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;c \cdot \frac{-2}{b + t_0}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \mathsf{fma}\left(2, \frac{b}{a}, -2 \cdot \frac{c}{b}\right)\\ \end{array}\\ \mathbf{elif}\;b \geq 0:\\ \;\;\;\;\frac{c \cdot -2}{b + b}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (sqrt (+ (* b b) (* c (* a -4.0))))) (t_1 (* (/ (+ b b) a) -0.5)))
   (if (<= b -2.6e+151)
     (if (>= b 0.0) (* c (/ -2.0 (+ b b))) t_1)
     (if (<= b 6.8e-304)
       (if (>= b 0.0) (expm1 (/ (- c) b)) (* -0.5 (/ (- b t_0) a)))
       (if (<= b 7.6e+89)
         (if (>= b 0.0)
           (* c (/ -2.0 (+ b t_0)))
           (* -0.5 (fma 2.0 (/ b a) (* -2.0 (/ c b)))))
         (if (>= b 0.0) (/ (* c -2.0) (+ b b)) t_1))))))
double code(double a, double b, double c) {
	double t_0 = sqrt(((b * b) + (c * (a * -4.0))));
	double t_1 = ((b + b) / a) * -0.5;
	double tmp_1;
	if (b <= -2.6e+151) {
		double tmp_2;
		if (b >= 0.0) {
			tmp_2 = c * (-2.0 / (b + b));
		} else {
			tmp_2 = t_1;
		}
		tmp_1 = tmp_2;
	} else if (b <= 6.8e-304) {
		double tmp_3;
		if (b >= 0.0) {
			tmp_3 = expm1((-c / b));
		} else {
			tmp_3 = -0.5 * ((b - t_0) / a);
		}
		tmp_1 = tmp_3;
	} else if (b <= 7.6e+89) {
		double tmp_4;
		if (b >= 0.0) {
			tmp_4 = c * (-2.0 / (b + t_0));
		} else {
			tmp_4 = -0.5 * fma(2.0, (b / a), (-2.0 * (c / b)));
		}
		tmp_1 = tmp_4;
	} else if (b >= 0.0) {
		tmp_1 = (c * -2.0) / (b + b);
	} else {
		tmp_1 = t_1;
	}
	return tmp_1;
}
function code(a, b, c)
	t_0 = sqrt(Float64(Float64(b * b) + Float64(c * Float64(a * -4.0))))
	t_1 = Float64(Float64(Float64(b + b) / a) * -0.5)
	tmp_1 = 0.0
	if (b <= -2.6e+151)
		tmp_2 = 0.0
		if (b >= 0.0)
			tmp_2 = Float64(c * Float64(-2.0 / Float64(b + b)));
		else
			tmp_2 = t_1;
		end
		tmp_1 = tmp_2;
	elseif (b <= 6.8e-304)
		tmp_3 = 0.0
		if (b >= 0.0)
			tmp_3 = expm1(Float64(Float64(-c) / b));
		else
			tmp_3 = Float64(-0.5 * Float64(Float64(b - t_0) / a));
		end
		tmp_1 = tmp_3;
	elseif (b <= 7.6e+89)
		tmp_4 = 0.0
		if (b >= 0.0)
			tmp_4 = Float64(c * Float64(-2.0 / Float64(b + t_0)));
		else
			tmp_4 = Float64(-0.5 * fma(2.0, Float64(b / a), Float64(-2.0 * Float64(c / b))));
		end
		tmp_1 = tmp_4;
	elseif (b >= 0.0)
		tmp_1 = Float64(Float64(c * -2.0) / Float64(b + b));
	else
		tmp_1 = t_1;
	end
	return tmp_1
end
code[a_, b_, c_] := Block[{t$95$0 = N[Sqrt[N[(N[(b * b), $MachinePrecision] + N[(c * N[(a * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(b + b), $MachinePrecision] / a), $MachinePrecision] * -0.5), $MachinePrecision]}, If[LessEqual[b, -2.6e+151], If[GreaterEqual[b, 0.0], N[(c * N[(-2.0 / N[(b + b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1], If[LessEqual[b, 6.8e-304], If[GreaterEqual[b, 0.0], N[(Exp[N[((-c) / b), $MachinePrecision]] - 1), $MachinePrecision], N[(-0.5 * N[(N[(b - t$95$0), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]], If[LessEqual[b, 7.6e+89], If[GreaterEqual[b, 0.0], N[(c * N[(-2.0 / N[(b + t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(2.0 * N[(b / a), $MachinePrecision] + N[(-2.0 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], If[GreaterEqual[b, 0.0], N[(N[(c * -2.0), $MachinePrecision] / N[(b + b), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}

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

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}\\

\mathbf{elif}\;b \leq 6.8 \cdot 10^{-304}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\mathsf{expm1}\left(\frac{-c}{b}\right)\\

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


\end{array}\\

\mathbf{elif}\;b \leq 7.6 \cdot 10^{+89}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;c \cdot \frac{-2}{b + t_0}\\

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


\end{array}\\

\mathbf{elif}\;b \geq 0:\\
\;\;\;\;\frac{c \cdot -2}{b + b}\\

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if b < -2.60000000000000013e151

    1. Initial program 38.2%

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

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

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;c \cdot \frac{-2}{b + b}\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot b}{a} \cdot -0.5\\ \end{array} \]
    5. Step-by-step derivation
      1. count-2100.0%

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

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

    if -2.60000000000000013e151 < b < 6.7999999999999997e-304

    1. Initial program 78.3%

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

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

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

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

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

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

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

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

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

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

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

    if 6.7999999999999997e-304 < b < 7.60000000000000047e89

    1. Initial program 85.4%

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

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

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

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

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

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

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

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

    if 7.60000000000000047e89 < b

    1. Initial program 45.2%

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

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

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;c \cdot \frac{-2}{b + b}\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot b}{a} \cdot -0.5\\ \end{array} \]
    5. Step-by-step derivation
      1. count-296.9%

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

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

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

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

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

Alternative 4: 90.7% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)}\\ t_1 := \frac{b + b}{a} \cdot -0.5\\ \mathbf{if}\;b \leq -4.9 \cdot 10^{+151}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;c \cdot \frac{-2}{b + b}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array}\\ \mathbf{elif}\;b \leq 2.65 \cdot 10^{+88}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{c \cdot 2}{\left(-b\right) - t_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{t_0 - b}{a \cdot 2}\\ \end{array}\\ \mathbf{elif}\;b \geq 0:\\ \;\;\;\;\frac{c \cdot -2}{b + b}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (sqrt (- (* b b) (* c (* a 4.0))))) (t_1 (* (/ (+ b b) a) -0.5)))
   (if (<= b -4.9e+151)
     (if (>= b 0.0) (* c (/ -2.0 (+ b b))) t_1)
     (if (<= b 2.65e+88)
       (if (>= b 0.0) (/ (* c 2.0) (- (- b) t_0)) (/ (- t_0 b) (* a 2.0)))
       (if (>= b 0.0) (/ (* c -2.0) (+ b b)) t_1)))))
double code(double a, double b, double c) {
	double t_0 = sqrt(((b * b) - (c * (a * 4.0))));
	double t_1 = ((b + b) / a) * -0.5;
	double tmp_1;
	if (b <= -4.9e+151) {
		double tmp_2;
		if (b >= 0.0) {
			tmp_2 = c * (-2.0 / (b + b));
		} else {
			tmp_2 = t_1;
		}
		tmp_1 = tmp_2;
	} else if (b <= 2.65e+88) {
		double tmp_3;
		if (b >= 0.0) {
			tmp_3 = (c * 2.0) / (-b - t_0);
		} else {
			tmp_3 = (t_0 - b) / (a * 2.0);
		}
		tmp_1 = tmp_3;
	} else if (b >= 0.0) {
		tmp_1 = (c * -2.0) / (b + b);
	} else {
		tmp_1 = t_1;
	}
	return tmp_1;
}
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) :: t_1
    real(8) :: tmp
    real(8) :: tmp_1
    real(8) :: tmp_2
    real(8) :: tmp_3
    t_0 = sqrt(((b * b) - (c * (a * 4.0d0))))
    t_1 = ((b + b) / a) * (-0.5d0)
    if (b <= (-4.9d+151)) then
        if (b >= 0.0d0) then
            tmp_2 = c * ((-2.0d0) / (b + b))
        else
            tmp_2 = t_1
        end if
        tmp_1 = tmp_2
    else if (b <= 2.65d+88) then
        if (b >= 0.0d0) then
            tmp_3 = (c * 2.0d0) / (-b - t_0)
        else
            tmp_3 = (t_0 - b) / (a * 2.0d0)
        end if
        tmp_1 = tmp_3
    else if (b >= 0.0d0) then
        tmp_1 = (c * (-2.0d0)) / (b + b)
    else
        tmp_1 = t_1
    end if
    code = tmp_1
end function
public static double code(double a, double b, double c) {
	double t_0 = Math.sqrt(((b * b) - (c * (a * 4.0))));
	double t_1 = ((b + b) / a) * -0.5;
	double tmp_1;
	if (b <= -4.9e+151) {
		double tmp_2;
		if (b >= 0.0) {
			tmp_2 = c * (-2.0 / (b + b));
		} else {
			tmp_2 = t_1;
		}
		tmp_1 = tmp_2;
	} else if (b <= 2.65e+88) {
		double tmp_3;
		if (b >= 0.0) {
			tmp_3 = (c * 2.0) / (-b - t_0);
		} else {
			tmp_3 = (t_0 - b) / (a * 2.0);
		}
		tmp_1 = tmp_3;
	} else if (b >= 0.0) {
		tmp_1 = (c * -2.0) / (b + b);
	} else {
		tmp_1 = t_1;
	}
	return tmp_1;
}
def code(a, b, c):
	t_0 = math.sqrt(((b * b) - (c * (a * 4.0))))
	t_1 = ((b + b) / a) * -0.5
	tmp_1 = 0
	if b <= -4.9e+151:
		tmp_2 = 0
		if b >= 0.0:
			tmp_2 = c * (-2.0 / (b + b))
		else:
			tmp_2 = t_1
		tmp_1 = tmp_2
	elif b <= 2.65e+88:
		tmp_3 = 0
		if b >= 0.0:
			tmp_3 = (c * 2.0) / (-b - t_0)
		else:
			tmp_3 = (t_0 - b) / (a * 2.0)
		tmp_1 = tmp_3
	elif b >= 0.0:
		tmp_1 = (c * -2.0) / (b + b)
	else:
		tmp_1 = t_1
	return tmp_1
function code(a, b, c)
	t_0 = sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 4.0))))
	t_1 = Float64(Float64(Float64(b + b) / a) * -0.5)
	tmp_1 = 0.0
	if (b <= -4.9e+151)
		tmp_2 = 0.0
		if (b >= 0.0)
			tmp_2 = Float64(c * Float64(-2.0 / Float64(b + b)));
		else
			tmp_2 = t_1;
		end
		tmp_1 = tmp_2;
	elseif (b <= 2.65e+88)
		tmp_3 = 0.0
		if (b >= 0.0)
			tmp_3 = Float64(Float64(c * 2.0) / Float64(Float64(-b) - t_0));
		else
			tmp_3 = Float64(Float64(t_0 - b) / Float64(a * 2.0));
		end
		tmp_1 = tmp_3;
	elseif (b >= 0.0)
		tmp_1 = Float64(Float64(c * -2.0) / Float64(b + b));
	else
		tmp_1 = t_1;
	end
	return tmp_1
end
function tmp_5 = code(a, b, c)
	t_0 = sqrt(((b * b) - (c * (a * 4.0))));
	t_1 = ((b + b) / a) * -0.5;
	tmp_2 = 0.0;
	if (b <= -4.9e+151)
		tmp_3 = 0.0;
		if (b >= 0.0)
			tmp_3 = c * (-2.0 / (b + b));
		else
			tmp_3 = t_1;
		end
		tmp_2 = tmp_3;
	elseif (b <= 2.65e+88)
		tmp_4 = 0.0;
		if (b >= 0.0)
			tmp_4 = (c * 2.0) / (-b - t_0);
		else
			tmp_4 = (t_0 - b) / (a * 2.0);
		end
		tmp_2 = tmp_4;
	elseif (b >= 0.0)
		tmp_2 = (c * -2.0) / (b + b);
	else
		tmp_2 = t_1;
	end
	tmp_5 = tmp_2;
end
code[a_, b_, c_] := Block[{t$95$0 = N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(c * N[(a * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(b + b), $MachinePrecision] / a), $MachinePrecision] * -0.5), $MachinePrecision]}, If[LessEqual[b, -4.9e+151], If[GreaterEqual[b, 0.0], N[(c * N[(-2.0 / N[(b + b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1], If[LessEqual[b, 2.65e+88], If[GreaterEqual[b, 0.0], N[(N[(c * 2.0), $MachinePrecision] / N[((-b) - t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]], If[GreaterEqual[b, 0.0], N[(N[(c * -2.0), $MachinePrecision] / N[(b + b), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}

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

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}\\

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

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


\end{array}\\

\mathbf{elif}\;b \geq 0:\\
\;\;\;\;\frac{c \cdot -2}{b + b}\\

\mathbf{else}:\\
\;\;\;\;t_1\\


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

    1. Initial program 38.2%

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

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

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;c \cdot \frac{-2}{b + b}\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot b}{a} \cdot -0.5\\ \end{array} \]
    5. Step-by-step derivation
      1. count-2100.0%

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

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

    if -4.8999999999999999e151 < b < 2.64999999999999994e88

    1. Initial program 82.5%

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

    if 2.64999999999999994e88 < b

    1. Initial program 45.2%

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

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

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;c \cdot \frac{-2}{b + b}\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot b}{a} \cdot -0.5\\ \end{array} \]
    5. Step-by-step derivation
      1. count-296.9%

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

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

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

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

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

Alternative 5: 85.9% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
t_0 := c \cdot \left(a \cdot -4\right)\\
t_1 := \frac{b + b}{a} \cdot -0.5\\
\mathbf{if}\;b \leq -5.2 \cdot 10^{+153}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;c \cdot \frac{-2}{b + b}\\

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}\\

\mathbf{elif}\;b \leq 6.8 \cdot 10^{-304}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\mathsf{expm1}\left(\frac{-c}{b}\right)\\

\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{b - \sqrt{b \cdot b + t_0}}{a}\\


\end{array}\\

\mathbf{elif}\;b \leq 1.25 \cdot 10^{-94}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{c \cdot -2}{b + \sqrt{t_0}}\\

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


\end{array}\\

\mathbf{elif}\;b \geq 0:\\
\;\;\;\;\frac{c \cdot -2}{b + b}\\

\mathbf{else}:\\
\;\;\;\;t_1\\


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

    1. Initial program 38.2%

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

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

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;c \cdot \frac{-2}{b + b}\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot b}{a} \cdot -0.5\\ \end{array} \]
    5. Step-by-step derivation
      1. count-2100.0%

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

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

    if -5.1999999999999998e153 < b < 6.7999999999999997e-304

    1. Initial program 78.3%

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

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

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

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

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

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

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

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

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

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

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

    if 6.7999999999999997e-304 < b < 1.2499999999999999e-94

    1. Initial program 77.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.2499999999999999e-94 < b

    1. Initial program 63.9%

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

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

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;c \cdot \frac{-2}{b + b}\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot b}{a} \cdot -0.5\\ \end{array} \]
    5. Step-by-step derivation
      1. count-285.5%

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

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

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

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

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

Alternative 6: 81.4% accurate, 1.0× speedup?

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

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

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


\end{array}\\

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

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


\end{array}\\

\mathbf{elif}\;b \leq 1.25 \cdot 10^{-94}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;c \cdot \frac{-2}{b + t_2}\\

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


\end{array}\\

\mathbf{elif}\;b \geq 0:\\
\;\;\;\;\frac{c \cdot -2}{b + b}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if b < -6.5e-48

    1. Initial program 57.9%

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

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

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

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

    if -6.5e-48 < b < -1.999999999999994e-310

    1. Initial program 67.7%

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

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

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

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

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

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

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

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

    if -1.999999999999994e-310 < b < 1.2499999999999999e-94

    1. Initial program 75.6%

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

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

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

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

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

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

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

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

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

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

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

    if 1.2499999999999999e-94 < b

    1. Initial program 63.9%

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

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

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;c \cdot \frac{-2}{b + b}\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot b}{a} \cdot -0.5\\ \end{array} \]
    5. Step-by-step derivation
      1. count-285.5%

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

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

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

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

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

Alternative 7: 81.4% accurate, 1.0× speedup?

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

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

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


\end{array}\\

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

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


\end{array}\\

\mathbf{elif}\;b \leq 1.16 \cdot 10^{-94}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{c \cdot -2}{b + t_2}\\

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


\end{array}\\

\mathbf{elif}\;b \geq 0:\\
\;\;\;\;\frac{c \cdot -2}{b + b}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if b < -4.40000000000000025e-48

    1. Initial program 57.9%

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

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

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

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

    if -4.40000000000000025e-48 < b < -1.999999999999994e-310

    1. Initial program 67.7%

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

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

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

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

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

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

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

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

    if -1.999999999999994e-310 < b < 1.16000000000000001e-94

    1. Initial program 75.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.16000000000000001e-94 < b

    1. Initial program 63.9%

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

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

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;c \cdot \frac{-2}{b + b}\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot b}{a} \cdot -0.5\\ \end{array} \]
    5. Step-by-step derivation
      1. count-285.5%

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

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

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

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

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

Alternative 8: 74.4% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
t_0 := c \cdot \frac{-2}{b + b}\\
\mathbf{if}\;b \leq -4.8 \cdot 10^{-48}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;t_0\\

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


\end{array}\\

\mathbf{elif}\;b \geq 0:\\
\;\;\;\;t_0\\

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


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

    1. Initial program 57.9%

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

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

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

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

    if -4.8e-48 < b

    1. Initial program 67.6%

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

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

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

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

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

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

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

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

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

Alternative 9: 35.2% accurate, 13.0× speedup?

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

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

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


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

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

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

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

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

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;c \cdot \frac{-2}{b + b}\\ \mathbf{else}:\\ \;\;\;\;\frac{-2 \cdot c}{b} \cdot -0.5\\ \end{array} \]
  7. Simplified38.4%

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

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

Alternative 10: 67.0% accurate, 13.0× speedup?

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

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

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


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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;c \cdot \frac{-2}{b + b}\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot b}{a} \cdot -0.5\\ \end{array} \]
  5. Step-by-step derivation
    1. count-268.1%

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

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

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

Alternative 11: 67.1% accurate, 13.0× speedup?

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

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

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


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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;c \cdot \frac{-2}{b + b}\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot b}{a} \cdot -0.5\\ \end{array} \]
  5. Step-by-step derivation
    1. count-268.1%

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

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

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

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

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

Reproduce

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