quadm (p42, negative)

Percentage Accurate: 53.3% → 83.9%
Time: 11.8s
Alternatives: 11
Speedup: 19.1×

Specification

?
\[\begin{array}{l} \\ \frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (/ (- (- b) (sqrt (- (* b b) (* 4.0 (* a c))))) (* 2.0 a)))
double code(double a, double b, double c) {
	return (-b - sqrt(((b * b) - (4.0 * (a * c))))) / (2.0 * a);
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    code = (-b - sqrt(((b * b) - (4.0d0 * (a * c))))) / (2.0d0 * a)
end function
public static double code(double a, double b, double c) {
	return (-b - Math.sqrt(((b * b) - (4.0 * (a * c))))) / (2.0 * a);
}
def code(a, b, c):
	return (-b - math.sqrt(((b * b) - (4.0 * (a * c))))) / (2.0 * a)
function code(a, b, c)
	return Float64(Float64(Float64(-b) - sqrt(Float64(Float64(b * b) - Float64(4.0 * Float64(a * c))))) / Float64(2.0 * a))
end
function tmp = code(a, b, c)
	tmp = (-b - sqrt(((b * b) - (4.0 * (a * c))))) / (2.0 * a);
end
code[a_, b_, c_] := N[(N[((-b) - N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(4.0 * N[(a * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a}
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 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: 53.3% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (/ (- (- b) (sqrt (- (* b b) (* 4.0 (* a c))))) (* 2.0 a)))
double code(double a, double b, double c) {
	return (-b - sqrt(((b * b) - (4.0 * (a * c))))) / (2.0 * a);
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    code = (-b - sqrt(((b * b) - (4.0d0 * (a * c))))) / (2.0d0 * a)
end function
public static double code(double a, double b, double c) {
	return (-b - Math.sqrt(((b * b) - (4.0 * (a * c))))) / (2.0 * a);
}
def code(a, b, c):
	return (-b - math.sqrt(((b * b) - (4.0 * (a * c))))) / (2.0 * a)
function code(a, b, c)
	return Float64(Float64(Float64(-b) - sqrt(Float64(Float64(b * b) - Float64(4.0 * Float64(a * c))))) / Float64(2.0 * a))
end
function tmp = code(a, b, c)
	tmp = (-b - sqrt(((b * b) - (4.0 * (a * c))))) / (2.0 * a);
end
code[a_, b_, c_] := N[(N[((-b) - N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(4.0 * N[(a * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a}
\end{array}

Alternative 1: 83.9% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.66 \cdot 10^{-195}:\\
\;\;\;\;\frac{-c}{b}\\

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

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


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

    1. Initial program 20.6%

      \[\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} \]
    2. Simplified20.7%

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

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

        \[\leadsto \color{blue}{\frac{-1 \cdot c}{b}} \]
      2. neg-mul-184.8%

        \[\leadsto \frac{\color{blue}{-c}}{b} \]
    5. Simplified84.8%

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

    if -1.66e-195 < b < 3.9999999999999999e101

    1. Initial program 80.8%

      \[\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} \]
    2. Simplified80.8%

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

    if 3.9999999999999999e101 < b

    1. Initial program 58.8%

      \[\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} \]
    2. Simplified58.8%

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

      \[\leadsto \color{blue}{\frac{c}{b} + -1 \cdot \frac{b}{a}} \]
    4. Step-by-step derivation
      1. mul-1-neg95.3%

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

        \[\leadsto \color{blue}{\frac{c}{b} - \frac{b}{a}} \]
    5. Simplified95.3%

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

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

Alternative 2: 83.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -1.66 \cdot 10^{-195}:\\ \;\;\;\;\frac{-c}{b}\\ \mathbf{elif}\;b \leq 8.5 \cdot 10^{+100}:\\ \;\;\;\;\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(c \cdot a\right)}}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b -1.66e-195)
   (/ (- c) b)
   (if (<= b 8.5e+100)
     (/ (- (- b) (sqrt (- (* b b) (* 4.0 (* c a))))) (* a 2.0))
     (- (/ c b) (/ b a)))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= -1.66e-195) {
		tmp = -c / b;
	} else if (b <= 8.5e+100) {
		tmp = (-b - sqrt(((b * b) - (4.0 * (c * a))))) / (a * 2.0);
	} else {
		tmp = (c / b) - (b / 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) :: tmp
    if (b <= (-1.66d-195)) then
        tmp = -c / b
    else if (b <= 8.5d+100) then
        tmp = (-b - sqrt(((b * b) - (4.0d0 * (c * a))))) / (a * 2.0d0)
    else
        tmp = (c / b) - (b / a)
    end if
    code = tmp
end function
public static double code(double a, double b, double c) {
	double tmp;
	if (b <= -1.66e-195) {
		tmp = -c / b;
	} else if (b <= 8.5e+100) {
		tmp = (-b - Math.sqrt(((b * b) - (4.0 * (c * a))))) / (a * 2.0);
	} else {
		tmp = (c / b) - (b / a);
	}
	return tmp;
}
def code(a, b, c):
	tmp = 0
	if b <= -1.66e-195:
		tmp = -c / b
	elif b <= 8.5e+100:
		tmp = (-b - math.sqrt(((b * b) - (4.0 * (c * a))))) / (a * 2.0)
	else:
		tmp = (c / b) - (b / a)
	return tmp
function code(a, b, c)
	tmp = 0.0
	if (b <= -1.66e-195)
		tmp = Float64(Float64(-c) / b);
	elseif (b <= 8.5e+100)
		tmp = Float64(Float64(Float64(-b) - sqrt(Float64(Float64(b * b) - Float64(4.0 * Float64(c * a))))) / Float64(a * 2.0));
	else
		tmp = Float64(Float64(c / b) - Float64(b / a));
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	tmp = 0.0;
	if (b <= -1.66e-195)
		tmp = -c / b;
	elseif (b <= 8.5e+100)
		tmp = (-b - sqrt(((b * b) - (4.0 * (c * a))))) / (a * 2.0);
	else
		tmp = (c / b) - (b / a);
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := If[LessEqual[b, -1.66e-195], N[((-c) / b), $MachinePrecision], If[LessEqual[b, 8.5e+100], N[(N[((-b) - N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(4.0 * N[(c * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] - N[(b / a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.66 \cdot 10^{-195}:\\
\;\;\;\;\frac{-c}{b}\\

\mathbf{elif}\;b \leq 8.5 \cdot 10^{+100}:\\
\;\;\;\;\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(c \cdot a\right)}}{a \cdot 2}\\

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


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

    1. Initial program 20.6%

      \[\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} \]
    2. Simplified20.7%

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

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

        \[\leadsto \color{blue}{\frac{-1 \cdot c}{b}} \]
      2. neg-mul-184.8%

        \[\leadsto \frac{\color{blue}{-c}}{b} \]
    5. Simplified84.8%

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

    if -1.66e-195 < b < 8.50000000000000043e100

    1. Initial program 80.8%

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

    if 8.50000000000000043e100 < b

    1. Initial program 58.8%

      \[\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} \]
    2. Simplified58.8%

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

      \[\leadsto \color{blue}{\frac{c}{b} + -1 \cdot \frac{b}{a}} \]
    4. Step-by-step derivation
      1. mul-1-neg95.3%

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

        \[\leadsto \color{blue}{\frac{c}{b} - \frac{b}{a}} \]
    5. Simplified95.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -1.66 \cdot 10^{-195}:\\ \;\;\;\;\frac{-c}{b}\\ \mathbf{elif}\;b \leq 8.5 \cdot 10^{+100}:\\ \;\;\;\;\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(c \cdot a\right)}}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \end{array} \]

Alternative 3: 83.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -1.66 \cdot 10^{-195}:\\ \;\;\;\;\frac{-c}{b}\\ \mathbf{elif}\;b \leq 1.35 \cdot 10^{+102}:\\ \;\;\;\;\frac{-0.5}{a} \cdot \left(b + \sqrt{b \cdot b + c \cdot \left(a \cdot -4\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b -1.66e-195)
   (/ (- c) b)
   (if (<= b 1.35e+102)
     (* (/ -0.5 a) (+ b (sqrt (+ (* b b) (* c (* a -4.0))))))
     (- (/ c b) (/ b a)))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= -1.66e-195) {
		tmp = -c / b;
	} else if (b <= 1.35e+102) {
		tmp = (-0.5 / a) * (b + sqrt(((b * b) + (c * (a * -4.0)))));
	} else {
		tmp = (c / b) - (b / 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) :: tmp
    if (b <= (-1.66d-195)) then
        tmp = -c / b
    else if (b <= 1.35d+102) then
        tmp = ((-0.5d0) / a) * (b + sqrt(((b * b) + (c * (a * (-4.0d0))))))
    else
        tmp = (c / b) - (b / a)
    end if
    code = tmp
end function
public static double code(double a, double b, double c) {
	double tmp;
	if (b <= -1.66e-195) {
		tmp = -c / b;
	} else if (b <= 1.35e+102) {
		tmp = (-0.5 / a) * (b + Math.sqrt(((b * b) + (c * (a * -4.0)))));
	} else {
		tmp = (c / b) - (b / a);
	}
	return tmp;
}
def code(a, b, c):
	tmp = 0
	if b <= -1.66e-195:
		tmp = -c / b
	elif b <= 1.35e+102:
		tmp = (-0.5 / a) * (b + math.sqrt(((b * b) + (c * (a * -4.0)))))
	else:
		tmp = (c / b) - (b / a)
	return tmp
function code(a, b, c)
	tmp = 0.0
	if (b <= -1.66e-195)
		tmp = Float64(Float64(-c) / b);
	elseif (b <= 1.35e+102)
		tmp = Float64(Float64(-0.5 / a) * Float64(b + sqrt(Float64(Float64(b * b) + Float64(c * Float64(a * -4.0))))));
	else
		tmp = Float64(Float64(c / b) - Float64(b / a));
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	tmp = 0.0;
	if (b <= -1.66e-195)
		tmp = -c / b;
	elseif (b <= 1.35e+102)
		tmp = (-0.5 / a) * (b + sqrt(((b * b) + (c * (a * -4.0)))));
	else
		tmp = (c / b) - (b / a);
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := If[LessEqual[b, -1.66e-195], N[((-c) / b), $MachinePrecision], If[LessEqual[b, 1.35e+102], N[(N[(-0.5 / a), $MachinePrecision] * N[(b + N[Sqrt[N[(N[(b * b), $MachinePrecision] + N[(c * N[(a * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] - N[(b / a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.66 \cdot 10^{-195}:\\
\;\;\;\;\frac{-c}{b}\\

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

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


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

    1. Initial program 20.6%

      \[\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} \]
    2. Simplified20.7%

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

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

        \[\leadsto \color{blue}{\frac{-1 \cdot c}{b}} \]
      2. neg-mul-184.8%

        \[\leadsto \frac{\color{blue}{-c}}{b} \]
    5. Simplified84.8%

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

    if -1.66e-195 < b < 1.3500000000000001e102

    1. Initial program 80.8%

      \[\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} \]
    2. Simplified80.8%

      \[\leadsto \color{blue}{-0.5 \cdot \frac{b + \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)}}{a}} \]
    3. Step-by-step derivation
      1. expm1-log1p-u52.0%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(-0.5 \cdot \frac{b + \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)}}{a}\right)\right)} \]
      2. expm1-udef27.4%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(-0.5 \cdot \frac{b + \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)}}{a}\right)} - 1} \]
      3. *-commutative27.4%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{b + \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)}}{a} \cdot -0.5}\right)} - 1 \]
    4. Applied egg-rr27.4%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{b + \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)}}{a} \cdot -0.5\right)} - 1} \]
    5. Step-by-step derivation
      1. expm1-def52.0%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{b + \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)}}{a} \cdot -0.5\right)\right)} \]
      2. expm1-log1p80.8%

        \[\leadsto \color{blue}{\frac{b + \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)}}{a} \cdot -0.5} \]
      3. associate-*l/80.8%

        \[\leadsto \color{blue}{\frac{\left(b + \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)}\right) \cdot -0.5}{a}} \]
      4. *-commutative80.8%

        \[\leadsto \frac{\color{blue}{-0.5 \cdot \left(b + \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)}\right)}}{a} \]
      5. associate-/l*80.6%

        \[\leadsto \color{blue}{\frac{-0.5}{\frac{a}{b + \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)}}}} \]
      6. associate-/r/80.7%

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

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

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

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

        \[\leadsto \frac{-0.5}{a} \cdot \left(b + \sqrt{b \cdot b + \left(a \cdot c\right) \cdot \color{blue}{\left(-4\right)}}\right) \]
      11. distribute-rgt-neg-in80.7%

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

        \[\leadsto \frac{-0.5}{a} \cdot \left(b + \sqrt{b \cdot b + \left(-\color{blue}{a \cdot \left(c \cdot 4\right)}\right)}\right) \]
      13. *-rgt-identity80.7%

        \[\leadsto \frac{-0.5}{a} \cdot \left(b + \sqrt{b \cdot b + \left(-\color{blue}{\left(a \cdot \left(c \cdot 4\right)\right) \cdot 1}\right)}\right) \]
      14. fma-udef80.7%

        \[\leadsto \frac{-0.5}{a} \cdot \left(b + \sqrt{\color{blue}{\mathsf{fma}\left(b, b, -\left(a \cdot \left(c \cdot 4\right)\right) \cdot 1\right)}}\right) \]
      15. *-rgt-identity80.7%

        \[\leadsto \frac{-0.5}{a} \cdot \left(b + \sqrt{\mathsf{fma}\left(b, b, -\color{blue}{a \cdot \left(c \cdot 4\right)}\right)}\right) \]
      16. *-commutative80.7%

        \[\leadsto \frac{-0.5}{a} \cdot \left(b + \sqrt{\mathsf{fma}\left(b, b, -\color{blue}{\left(c \cdot 4\right) \cdot a}\right)}\right) \]
      17. associate-*r*80.7%

        \[\leadsto \frac{-0.5}{a} \cdot \left(b + \sqrt{\mathsf{fma}\left(b, b, -\color{blue}{c \cdot \left(4 \cdot a\right)}\right)}\right) \]
      18. distribute-rgt-neg-in80.7%

        \[\leadsto \frac{-0.5}{a} \cdot \left(b + \sqrt{\mathsf{fma}\left(b, b, \color{blue}{c \cdot \left(-4 \cdot a\right)}\right)}\right) \]
      19. *-commutative80.7%

        \[\leadsto \frac{-0.5}{a} \cdot \left(b + \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(-\color{blue}{a \cdot 4}\right)\right)}\right) \]
      20. distribute-rgt-neg-in80.7%

        \[\leadsto \frac{-0.5}{a} \cdot \left(b + \sqrt{\mathsf{fma}\left(b, b, c \cdot \color{blue}{\left(a \cdot \left(-4\right)\right)}\right)}\right) \]
      21. metadata-eval80.7%

        \[\leadsto \frac{-0.5}{a} \cdot \left(b + \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot \color{blue}{-4}\right)\right)}\right) \]
    6. Simplified80.7%

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

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

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

    if 1.3500000000000001e102 < b

    1. Initial program 58.8%

      \[\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} \]
    2. Simplified58.8%

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

      \[\leadsto \color{blue}{\frac{c}{b} + -1 \cdot \frac{b}{a}} \]
    4. Step-by-step derivation
      1. mul-1-neg95.3%

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

        \[\leadsto \color{blue}{\frac{c}{b} - \frac{b}{a}} \]
    5. Simplified95.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -1.66 \cdot 10^{-195}:\\ \;\;\;\;\frac{-c}{b}\\ \mathbf{elif}\;b \leq 1.35 \cdot 10^{+102}:\\ \;\;\;\;\frac{-0.5}{a} \cdot \left(b + \sqrt{b \cdot b + c \cdot \left(a \cdot -4\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \end{array} \]

Alternative 4: 79.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -1.66 \cdot 10^{-195}:\\ \;\;\;\;\frac{-c}{b}\\ \mathbf{elif}\;b \leq 1.55 \cdot 10^{-77}:\\ \;\;\;\;\frac{\left(-b\right) - \sqrt{c \cdot \left(a \cdot -4\right)}}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b -1.66e-195)
   (/ (- c) b)
   (if (<= b 1.55e-77)
     (/ (- (- b) (sqrt (* c (* a -4.0)))) (* a 2.0))
     (- (/ c b) (/ b a)))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= -1.66e-195) {
		tmp = -c / b;
	} else if (b <= 1.55e-77) {
		tmp = (-b - sqrt((c * (a * -4.0)))) / (a * 2.0);
	} else {
		tmp = (c / b) - (b / 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) :: tmp
    if (b <= (-1.66d-195)) then
        tmp = -c / b
    else if (b <= 1.55d-77) then
        tmp = (-b - sqrt((c * (a * (-4.0d0))))) / (a * 2.0d0)
    else
        tmp = (c / b) - (b / a)
    end if
    code = tmp
end function
public static double code(double a, double b, double c) {
	double tmp;
	if (b <= -1.66e-195) {
		tmp = -c / b;
	} else if (b <= 1.55e-77) {
		tmp = (-b - Math.sqrt((c * (a * -4.0)))) / (a * 2.0);
	} else {
		tmp = (c / b) - (b / a);
	}
	return tmp;
}
def code(a, b, c):
	tmp = 0
	if b <= -1.66e-195:
		tmp = -c / b
	elif b <= 1.55e-77:
		tmp = (-b - math.sqrt((c * (a * -4.0)))) / (a * 2.0)
	else:
		tmp = (c / b) - (b / a)
	return tmp
function code(a, b, c)
	tmp = 0.0
	if (b <= -1.66e-195)
		tmp = Float64(Float64(-c) / b);
	elseif (b <= 1.55e-77)
		tmp = Float64(Float64(Float64(-b) - sqrt(Float64(c * Float64(a * -4.0)))) / Float64(a * 2.0));
	else
		tmp = Float64(Float64(c / b) - Float64(b / a));
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	tmp = 0.0;
	if (b <= -1.66e-195)
		tmp = -c / b;
	elseif (b <= 1.55e-77)
		tmp = (-b - sqrt((c * (a * -4.0)))) / (a * 2.0);
	else
		tmp = (c / b) - (b / a);
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := If[LessEqual[b, -1.66e-195], N[((-c) / b), $MachinePrecision], If[LessEqual[b, 1.55e-77], N[(N[((-b) - N[Sqrt[N[(c * N[(a * -4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] - N[(b / a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.66 \cdot 10^{-195}:\\
\;\;\;\;\frac{-c}{b}\\

\mathbf{elif}\;b \leq 1.55 \cdot 10^{-77}:\\
\;\;\;\;\frac{\left(-b\right) - \sqrt{c \cdot \left(a \cdot -4\right)}}{a \cdot 2}\\

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


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

    1. Initial program 20.6%

      \[\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} \]
    2. Simplified20.7%

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

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

        \[\leadsto \color{blue}{\frac{-1 \cdot c}{b}} \]
      2. neg-mul-184.8%

        \[\leadsto \frac{\color{blue}{-c}}{b} \]
    5. Simplified84.8%

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

    if -1.66e-195 < b < 1.55000000000000004e-77

    1. Initial program 77.0%

      \[\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} \]
    2. Taylor expanded in b around 0 70.3%

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

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

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

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

    if 1.55000000000000004e-77 < b

    1. Initial program 67.0%

      \[\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} \]
    2. Simplified67.1%

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

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

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

        \[\leadsto \color{blue}{\frac{c}{b} - \frac{b}{a}} \]
    5. Simplified87.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -1.66 \cdot 10^{-195}:\\ \;\;\;\;\frac{-c}{b}\\ \mathbf{elif}\;b \leq 1.55 \cdot 10^{-77}:\\ \;\;\;\;\frac{\left(-b\right) - \sqrt{c \cdot \left(a \cdot -4\right)}}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \end{array} \]

Alternative 5: 79.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -1.66 \cdot 10^{-195}:\\ \;\;\;\;\frac{-c}{b}\\ \mathbf{elif}\;b \leq 2.2 \cdot 10^{-77}:\\ \;\;\;\;\frac{-0.5}{a} \cdot \left(b + \sqrt{c \cdot \left(a \cdot -4\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b -1.66e-195)
   (/ (- c) b)
   (if (<= b 2.2e-77)
     (* (/ -0.5 a) (+ b (sqrt (* c (* a -4.0)))))
     (- (/ c b) (/ b a)))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= -1.66e-195) {
		tmp = -c / b;
	} else if (b <= 2.2e-77) {
		tmp = (-0.5 / a) * (b + sqrt((c * (a * -4.0))));
	} else {
		tmp = (c / b) - (b / 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) :: tmp
    if (b <= (-1.66d-195)) then
        tmp = -c / b
    else if (b <= 2.2d-77) then
        tmp = ((-0.5d0) / a) * (b + sqrt((c * (a * (-4.0d0)))))
    else
        tmp = (c / b) - (b / a)
    end if
    code = tmp
end function
public static double code(double a, double b, double c) {
	double tmp;
	if (b <= -1.66e-195) {
		tmp = -c / b;
	} else if (b <= 2.2e-77) {
		tmp = (-0.5 / a) * (b + Math.sqrt((c * (a * -4.0))));
	} else {
		tmp = (c / b) - (b / a);
	}
	return tmp;
}
def code(a, b, c):
	tmp = 0
	if b <= -1.66e-195:
		tmp = -c / b
	elif b <= 2.2e-77:
		tmp = (-0.5 / a) * (b + math.sqrt((c * (a * -4.0))))
	else:
		tmp = (c / b) - (b / a)
	return tmp
function code(a, b, c)
	tmp = 0.0
	if (b <= -1.66e-195)
		tmp = Float64(Float64(-c) / b);
	elseif (b <= 2.2e-77)
		tmp = Float64(Float64(-0.5 / a) * Float64(b + sqrt(Float64(c * Float64(a * -4.0)))));
	else
		tmp = Float64(Float64(c / b) - Float64(b / a));
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	tmp = 0.0;
	if (b <= -1.66e-195)
		tmp = -c / b;
	elseif (b <= 2.2e-77)
		tmp = (-0.5 / a) * (b + sqrt((c * (a * -4.0))));
	else
		tmp = (c / b) - (b / a);
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := If[LessEqual[b, -1.66e-195], N[((-c) / b), $MachinePrecision], If[LessEqual[b, 2.2e-77], N[(N[(-0.5 / a), $MachinePrecision] * N[(b + N[Sqrt[N[(c * N[(a * -4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] - N[(b / a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.66 \cdot 10^{-195}:\\
\;\;\;\;\frac{-c}{b}\\

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

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


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

    1. Initial program 20.6%

      \[\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} \]
    2. Simplified20.7%

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

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

        \[\leadsto \color{blue}{\frac{-1 \cdot c}{b}} \]
      2. neg-mul-184.8%

        \[\leadsto \frac{\color{blue}{-c}}{b} \]
    5. Simplified84.8%

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

    if -1.66e-195 < b < 2.20000000000000007e-77

    1. Initial program 77.0%

      \[\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} \]
    2. Simplified77.0%

      \[\leadsto \color{blue}{-0.5 \cdot \frac{b + \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)}}{a}} \]
    3. Step-by-step derivation
      1. expm1-log1p-u51.1%

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

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(-0.5 \cdot \frac{b + \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)}}{a}\right)} - 1} \]
      3. *-commutative25.7%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{b + \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)}}{a} \cdot -0.5}\right)} - 1 \]
    4. Applied egg-rr25.7%

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

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{b + \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)}}{a} \cdot -0.5\right)\right)} \]
      2. expm1-log1p77.0%

        \[\leadsto \color{blue}{\frac{b + \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)}}{a} \cdot -0.5} \]
      3. associate-*l/77.0%

        \[\leadsto \color{blue}{\frac{\left(b + \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)}\right) \cdot -0.5}{a}} \]
      4. *-commutative77.0%

        \[\leadsto \frac{\color{blue}{-0.5 \cdot \left(b + \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)}\right)}}{a} \]
      5. associate-/l*76.9%

        \[\leadsto \color{blue}{\frac{-0.5}{\frac{a}{b + \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)}}}} \]
      6. associate-/r/77.0%

        \[\leadsto \color{blue}{\frac{-0.5}{a} \cdot \left(b + \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)}\right)} \]
      7. fma-udef77.0%

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

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

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

        \[\leadsto \frac{-0.5}{a} \cdot \left(b + \sqrt{b \cdot b + \left(a \cdot c\right) \cdot \color{blue}{\left(-4\right)}}\right) \]
      11. distribute-rgt-neg-in76.9%

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

        \[\leadsto \frac{-0.5}{a} \cdot \left(b + \sqrt{b \cdot b + \left(-\color{blue}{a \cdot \left(c \cdot 4\right)}\right)}\right) \]
      13. *-rgt-identity77.0%

        \[\leadsto \frac{-0.5}{a} \cdot \left(b + \sqrt{b \cdot b + \left(-\color{blue}{\left(a \cdot \left(c \cdot 4\right)\right) \cdot 1}\right)}\right) \]
      14. fma-udef77.0%

        \[\leadsto \frac{-0.5}{a} \cdot \left(b + \sqrt{\color{blue}{\mathsf{fma}\left(b, b, -\left(a \cdot \left(c \cdot 4\right)\right) \cdot 1\right)}}\right) \]
      15. *-rgt-identity77.0%

        \[\leadsto \frac{-0.5}{a} \cdot \left(b + \sqrt{\mathsf{fma}\left(b, b, -\color{blue}{a \cdot \left(c \cdot 4\right)}\right)}\right) \]
      16. *-commutative77.0%

        \[\leadsto \frac{-0.5}{a} \cdot \left(b + \sqrt{\mathsf{fma}\left(b, b, -\color{blue}{\left(c \cdot 4\right) \cdot a}\right)}\right) \]
      17. associate-*r*77.0%

        \[\leadsto \frac{-0.5}{a} \cdot \left(b + \sqrt{\mathsf{fma}\left(b, b, -\color{blue}{c \cdot \left(4 \cdot a\right)}\right)}\right) \]
      18. distribute-rgt-neg-in77.0%

        \[\leadsto \frac{-0.5}{a} \cdot \left(b + \sqrt{\mathsf{fma}\left(b, b, \color{blue}{c \cdot \left(-4 \cdot a\right)}\right)}\right) \]
      19. *-commutative77.0%

        \[\leadsto \frac{-0.5}{a} \cdot \left(b + \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(-\color{blue}{a \cdot 4}\right)\right)}\right) \]
      20. distribute-rgt-neg-in77.0%

        \[\leadsto \frac{-0.5}{a} \cdot \left(b + \sqrt{\mathsf{fma}\left(b, b, c \cdot \color{blue}{\left(a \cdot \left(-4\right)\right)}\right)}\right) \]
      21. metadata-eval77.0%

        \[\leadsto \frac{-0.5}{a} \cdot \left(b + \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot \color{blue}{-4}\right)\right)}\right) \]
    6. Simplified77.0%

      \[\leadsto \color{blue}{\frac{-0.5}{a} \cdot \left(b + \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)}\right)} \]
    7. Taylor expanded in b around 0 70.2%

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

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

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

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

    if 2.20000000000000007e-77 < b

    1. Initial program 67.0%

      \[\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} \]
    2. Simplified67.1%

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

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

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

        \[\leadsto \color{blue}{\frac{c}{b} - \frac{b}{a}} \]
    5. Simplified87.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -1.66 \cdot 10^{-195}:\\ \;\;\;\;\frac{-c}{b}\\ \mathbf{elif}\;b \leq 2.2 \cdot 10^{-77}:\\ \;\;\;\;\frac{-0.5}{a} \cdot \left(b + \sqrt{c \cdot \left(a \cdot -4\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \end{array} \]

Alternative 6: 79.5% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -1.66 \cdot 10^{-195}:\\ \;\;\;\;\frac{-c}{b}\\ \mathbf{elif}\;b \leq 3.5 \cdot 10^{-77}:\\ \;\;\;\;-0.5 \cdot \frac{\sqrt{a \cdot \frac{c}{-0.25}}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b -1.66e-195)
   (/ (- c) b)
   (if (<= b 3.5e-77)
     (* -0.5 (/ (sqrt (* a (/ c -0.25))) a))
     (- (/ c b) (/ b a)))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= -1.66e-195) {
		tmp = -c / b;
	} else if (b <= 3.5e-77) {
		tmp = -0.5 * (sqrt((a * (c / -0.25))) / a);
	} else {
		tmp = (c / b) - (b / 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) :: tmp
    if (b <= (-1.66d-195)) then
        tmp = -c / b
    else if (b <= 3.5d-77) then
        tmp = (-0.5d0) * (sqrt((a * (c / (-0.25d0)))) / a)
    else
        tmp = (c / b) - (b / a)
    end if
    code = tmp
end function
public static double code(double a, double b, double c) {
	double tmp;
	if (b <= -1.66e-195) {
		tmp = -c / b;
	} else if (b <= 3.5e-77) {
		tmp = -0.5 * (Math.sqrt((a * (c / -0.25))) / a);
	} else {
		tmp = (c / b) - (b / a);
	}
	return tmp;
}
def code(a, b, c):
	tmp = 0
	if b <= -1.66e-195:
		tmp = -c / b
	elif b <= 3.5e-77:
		tmp = -0.5 * (math.sqrt((a * (c / -0.25))) / a)
	else:
		tmp = (c / b) - (b / a)
	return tmp
function code(a, b, c)
	tmp = 0.0
	if (b <= -1.66e-195)
		tmp = Float64(Float64(-c) / b);
	elseif (b <= 3.5e-77)
		tmp = Float64(-0.5 * Float64(sqrt(Float64(a * Float64(c / -0.25))) / a));
	else
		tmp = Float64(Float64(c / b) - Float64(b / a));
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	tmp = 0.0;
	if (b <= -1.66e-195)
		tmp = -c / b;
	elseif (b <= 3.5e-77)
		tmp = -0.5 * (sqrt((a * (c / -0.25))) / a);
	else
		tmp = (c / b) - (b / a);
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := If[LessEqual[b, -1.66e-195], N[((-c) / b), $MachinePrecision], If[LessEqual[b, 3.5e-77], N[(-0.5 * N[(N[Sqrt[N[(a * N[(c / -0.25), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(N[(c / b), $MachinePrecision] - N[(b / a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.66 \cdot 10^{-195}:\\
\;\;\;\;\frac{-c}{b}\\

\mathbf{elif}\;b \leq 3.5 \cdot 10^{-77}:\\
\;\;\;\;-0.5 \cdot \frac{\sqrt{a \cdot \frac{c}{-0.25}}}{a}\\

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


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

    1. Initial program 20.6%

      \[\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} \]
    2. Simplified20.7%

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

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

        \[\leadsto \color{blue}{\frac{-1 \cdot c}{b}} \]
      2. neg-mul-184.8%

        \[\leadsto \frac{\color{blue}{-c}}{b} \]
    5. Simplified84.8%

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

    if -1.66e-195 < b < 3.50000000000000013e-77

    1. Initial program 77.0%

      \[\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} \]
    2. Simplified77.0%

      \[\leadsto \color{blue}{-0.5 \cdot \frac{b + \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)}}{a}} \]
    3. Step-by-step derivation
      1. pow1/277.0%

        \[\leadsto -0.5 \cdot \frac{b + \color{blue}{{\left(\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)\right)}^{0.5}}}{a} \]
      2. pow-to-exp72.4%

        \[\leadsto -0.5 \cdot \frac{b + \color{blue}{e^{\log \left(\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)\right) \cdot 0.5}}}{a} \]
    4. Applied egg-rr72.4%

      \[\leadsto -0.5 \cdot \frac{b + \color{blue}{e^{\log \left(\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)\right) \cdot 0.5}}}{a} \]
    5. Taylor expanded in a around -inf 42.3%

      \[\leadsto -0.5 \cdot \frac{b + e^{\color{blue}{\left(\log \left(4 \cdot c\right) + -1 \cdot \log \left(\frac{-1}{a}\right)\right)} \cdot 0.5}}{a} \]
    6. Step-by-step derivation
      1. mul-1-neg42.3%

        \[\leadsto -0.5 \cdot \frac{b + e^{\left(\log \left(4 \cdot c\right) + \color{blue}{\left(-\log \left(\frac{-1}{a}\right)\right)}\right) \cdot 0.5}}{a} \]
      2. unsub-neg42.3%

        \[\leadsto -0.5 \cdot \frac{b + e^{\color{blue}{\left(\log \left(4 \cdot c\right) - \log \left(\frac{-1}{a}\right)\right)} \cdot 0.5}}{a} \]
      3. *-commutative42.3%

        \[\leadsto -0.5 \cdot \frac{b + e^{\left(\log \color{blue}{\left(c \cdot 4\right)} - \log \left(\frac{-1}{a}\right)\right) \cdot 0.5}}{a} \]
    7. Simplified42.3%

      \[\leadsto -0.5 \cdot \frac{b + e^{\color{blue}{\left(\log \left(c \cdot 4\right) - \log \left(\frac{-1}{a}\right)\right)} \cdot 0.5}}{a} \]
    8. Taylor expanded in b around 0 42.0%

      \[\leadsto -0.5 \cdot \color{blue}{\frac{e^{0.5 \cdot \left(\log \left(4 \cdot c\right) - \log \left(\frac{-1}{a}\right)\right)}}{a}} \]
    9. Step-by-step derivation
      1. *-commutative42.0%

        \[\leadsto -0.5 \cdot \frac{e^{\color{blue}{\left(\log \left(4 \cdot c\right) - \log \left(\frac{-1}{a}\right)\right) \cdot 0.5}}}{a} \]
      2. log-prod42.1%

        \[\leadsto -0.5 \cdot \frac{e^{\left(\color{blue}{\left(\log 4 + \log c\right)} - \log \left(\frac{-1}{a}\right)\right) \cdot 0.5}}{a} \]
      3. +-commutative42.1%

        \[\leadsto -0.5 \cdot \frac{e^{\left(\color{blue}{\left(\log c + \log 4\right)} - \log \left(\frac{-1}{a}\right)\right) \cdot 0.5}}{a} \]
      4. log-prod42.0%

        \[\leadsto -0.5 \cdot \frac{e^{\left(\color{blue}{\log \left(c \cdot 4\right)} - \log \left(\frac{-1}{a}\right)\right) \cdot 0.5}}{a} \]
      5. log-div64.8%

        \[\leadsto -0.5 \cdot \frac{e^{\color{blue}{\log \left(\frac{c \cdot 4}{\frac{-1}{a}}\right)} \cdot 0.5}}{a} \]
      6. exp-to-pow68.9%

        \[\leadsto -0.5 \cdot \frac{\color{blue}{{\left(\frac{c \cdot 4}{\frac{-1}{a}}\right)}^{0.5}}}{a} \]
      7. unpow1/268.9%

        \[\leadsto -0.5 \cdot \frac{\color{blue}{\sqrt{\frac{c \cdot 4}{\frac{-1}{a}}}}}{a} \]
      8. associate-/r/68.9%

        \[\leadsto -0.5 \cdot \frac{\sqrt{\color{blue}{\frac{c \cdot 4}{-1} \cdot a}}}{a} \]
      9. *-commutative68.9%

        \[\leadsto -0.5 \cdot \frac{\sqrt{\color{blue}{a \cdot \frac{c \cdot 4}{-1}}}}{a} \]
      10. associate-/l*68.9%

        \[\leadsto -0.5 \cdot \frac{\sqrt{a \cdot \color{blue}{\frac{c}{\frac{-1}{4}}}}}{a} \]
      11. metadata-eval68.9%

        \[\leadsto -0.5 \cdot \frac{\sqrt{a \cdot \frac{c}{\color{blue}{-0.25}}}}{a} \]
    10. Simplified68.9%

      \[\leadsto -0.5 \cdot \color{blue}{\frac{\sqrt{a \cdot \frac{c}{-0.25}}}{a}} \]

    if 3.50000000000000013e-77 < b

    1. Initial program 67.0%

      \[\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} \]
    2. Simplified67.1%

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

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

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

        \[\leadsto \color{blue}{\frac{c}{b} - \frac{b}{a}} \]
    5. Simplified87.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -1.66 \cdot 10^{-195}:\\ \;\;\;\;\frac{-c}{b}\\ \mathbf{elif}\;b \leq 3.5 \cdot 10^{-77}:\\ \;\;\;\;-0.5 \cdot \frac{\sqrt{a \cdot \frac{c}{-0.25}}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \end{array} \]

Alternative 7: 68.6% accurate, 12.8× speedup?

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

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

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


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

    1. Initial program 30.0%

      \[\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} \]
    2. Simplified30.0%

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

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

        \[\leadsto \color{blue}{\frac{-1 \cdot c}{b}} \]
      2. neg-mul-170.6%

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

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

    if -3.999999999999988e-310 < b

    1. Initial program 70.4%

      \[\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} \]
    2. Simplified70.5%

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

      \[\leadsto \color{blue}{\frac{c}{b} + -1 \cdot \frac{b}{a}} \]
    4. Step-by-step derivation
      1. mul-1-neg71.9%

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

        \[\leadsto \color{blue}{\frac{c}{b} - \frac{b}{a}} \]
    5. Simplified71.9%

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

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

Alternative 8: 43.9% accurate, 19.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq -6.3 \cdot 10^{-27}:\\
\;\;\;\;\frac{c}{b}\\

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


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

    1. Initial program 13.8%

      \[\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} \]
    2. Simplified13.8%

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

      \[\leadsto \color{blue}{\frac{c}{b} + -1 \cdot \frac{b}{a}} \]
    4. Step-by-step derivation
      1. mul-1-neg2.7%

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

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

      \[\leadsto \color{blue}{\frac{c}{b} - \frac{b}{a}} \]
    6. Taylor expanded in c around inf 22.3%

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

    if -6.3000000000000001e-27 < b

    1. Initial program 65.6%

      \[\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} \]
    2. Simplified65.7%

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

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

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

        \[\leadsto \frac{\color{blue}{-b}}{a} \]
    5. Simplified48.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -6.3 \cdot 10^{-27}:\\ \;\;\;\;\frac{c}{b}\\ \mathbf{else}:\\ \;\;\;\;-\frac{b}{a}\\ \end{array} \]

Alternative 9: 68.4% accurate, 19.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq -3.8 \cdot 10^{-298}:\\
\;\;\;\;\frac{-c}{b}\\

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


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

    1. Initial program 28.5%

      \[\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} \]
    2. Simplified28.6%

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

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

        \[\leadsto \color{blue}{\frac{-1 \cdot c}{b}} \]
      2. neg-mul-172.0%

        \[\leadsto \frac{\color{blue}{-c}}{b} \]
    5. Simplified72.0%

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

    if -3.8e-298 < b

    1. Initial program 71.2%

      \[\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} \]
    2. Simplified71.3%

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

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

        \[\leadsto \color{blue}{\frac{-1 \cdot b}{a}} \]
      2. mul-1-neg69.8%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -3.8 \cdot 10^{-298}:\\ \;\;\;\;\frac{-c}{b}\\ \mathbf{else}:\\ \;\;\;\;-\frac{b}{a}\\ \end{array} \]

Alternative 10: 2.5% accurate, 38.7× speedup?

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

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

    \[\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} \]
  2. Simplified47.3%

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

      \[\leadsto -0.5 \cdot \color{blue}{\frac{1}{\frac{a}{b + \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)}}}} \]
    2. un-div-inv47.2%

      \[\leadsto \color{blue}{\frac{-0.5}{\frac{a}{b + \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)}}}} \]
  4. Applied egg-rr47.2%

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

    \[\leadsto \frac{-0.5}{\color{blue}{0.5 \cdot \frac{b}{c} + -0.5 \cdot \frac{a}{b}}} \]
  6. Taylor expanded in b around 0 2.8%

    \[\leadsto \color{blue}{\frac{b}{a}} \]
  7. Final simplification2.8%

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

Alternative 11: 10.5% accurate, 38.7× speedup?

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

\\
\frac{c}{b}
\end{array}
Derivation
  1. Initial program 47.2%

    \[\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} \]
  2. Simplified47.3%

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

    \[\leadsto \color{blue}{\frac{c}{b} + -1 \cdot \frac{b}{a}} \]
  4. Step-by-step derivation
    1. mul-1-neg31.9%

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

      \[\leadsto \color{blue}{\frac{c}{b} - \frac{b}{a}} \]
  5. Simplified31.9%

    \[\leadsto \color{blue}{\frac{c}{b} - \frac{b}{a}} \]
  6. Taylor expanded in c around inf 9.7%

    \[\leadsto \color{blue}{\frac{c}{b}} \]
  7. Final simplification9.7%

    \[\leadsto \frac{c}{b} \]

Developer target: 71.1% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}\\ \mathbf{if}\;b < 0:\\ \;\;\;\;\frac{c}{a \cdot \frac{\left(-b\right) + t_0}{2 \cdot a}}\\ \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)
     (/ c (* a (/ (+ (- b) t_0) (* 2.0 a))))
     (/ (- (- b) t_0) (* 2.0 a)))))
double code(double a, double b, double c) {
	double t_0 = sqrt(((b * b) - (4.0 * (a * c))));
	double tmp;
	if (b < 0.0) {
		tmp = c / (a * ((-b + t_0) / (2.0 * a)));
	} 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 = c / (a * ((-b + t_0) / (2.0d0 * a)))
    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 = c / (a * ((-b + t_0) / (2.0 * a)));
	} 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 = c / (a * ((-b + t_0) / (2.0 * a)))
	else:
		tmp = (-b - t_0) / (2.0 * a)
	return tmp
function code(a, b, c)
	t_0 = sqrt(Float64(Float64(b * b) - Float64(4.0 * Float64(a * c))))
	tmp = 0.0
	if (b < 0.0)
		tmp = Float64(c / Float64(a * Float64(Float64(Float64(-b) + t_0) / Float64(2.0 * a))));
	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 = c / (a * ((-b + t_0) / (2.0 * a)));
	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[(4.0 * N[(a * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[Less[b, 0.0], N[(c / N[(a * N[(N[((-b) + t$95$0), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]), $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 - 4 \cdot \left(a \cdot c\right)}\\
\mathbf{if}\;b < 0:\\
\;\;\;\;\frac{c}{a \cdot \frac{\left(-b\right) + t_0}{2 \cdot a}}\\

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


\end{array}
\end{array}

Reproduce

?
herbie shell --seed 2023213 
(FPCore (a b c)
  :name "quadm (p42, negative)"
  :precision binary64

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

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