quadm (p42, negative)

Percentage Accurate: 52.1% → 84.8%
Time: 11.5s
Alternatives: 7
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 7 alternatives:

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

Initial Program: 52.1% 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: 84.8% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 20.3%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{c}{b}} \]
    3. 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} \]
    4. Simplified84.8%

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

    if -2.69999999999999981e-155 < b < 3.30000000000000013e44

    1. Initial program 83.2%

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

      \[\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. fma-udef83.2%

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

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

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

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

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

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

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

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

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

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

    if 3.30000000000000013e44 < b

    1. Initial program 53.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 inf 93.6%

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

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

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

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

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

Alternative 2: 80.2% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -2.7 \cdot 10^{-155}:\\ \;\;\;\;\frac{-c}{b}\\ \mathbf{elif}\;b \leq 1.5 \cdot 10^{-48}:\\ \;\;\;\;-0.5 \cdot \frac{1}{\frac{a}{b + \sqrt{\left(c \cdot a\right) \cdot -4}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b -2.7e-155)
   (/ (- c) b)
   (if (<= b 1.5e-48)
     (* -0.5 (/ 1.0 (/ a (+ b (sqrt (* (* c a) -4.0))))))
     (- (/ c b) (/ b a)))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= -2.7e-155) {
		tmp = -c / b;
	} else if (b <= 1.5e-48) {
		tmp = -0.5 * (1.0 / (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 <= (-2.7d-155)) then
        tmp = -c / b
    else if (b <= 1.5d-48) then
        tmp = (-0.5d0) * (1.0d0 / (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 <= -2.7e-155) {
		tmp = -c / b;
	} else if (b <= 1.5e-48) {
		tmp = -0.5 * (1.0 / (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 <= -2.7e-155:
		tmp = -c / b
	elif b <= 1.5e-48:
		tmp = -0.5 * (1.0 / (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 <= -2.7e-155)
		tmp = Float64(Float64(-c) / b);
	elseif (b <= 1.5e-48)
		tmp = Float64(-0.5 * Float64(1.0 / Float64(a / Float64(b + sqrt(Float64(Float64(c * 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 <= -2.7e-155)
		tmp = -c / b;
	elseif (b <= 1.5e-48)
		tmp = -0.5 * (1.0 / (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, -2.7e-155], N[((-c) / b), $MachinePrecision], If[LessEqual[b, 1.5e-48], N[(-0.5 * N[(1.0 / N[(a / N[(b + N[Sqrt[N[(N[(c * a), $MachinePrecision] * -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 -2.7 \cdot 10^{-155}:\\
\;\;\;\;\frac{-c}{b}\\

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

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


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

    1. Initial program 20.3%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{c}{b}} \]
    3. 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} \]
    4. Simplified84.8%

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

    if -2.69999999999999981e-155 < b < 1.5e-48

    1. Initial program 81.3%

      \[\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} \]
    2. Simplified81.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-num81.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. inv-pow81.2%

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

      \[\leadsto -0.5 \cdot \color{blue}{{\left(\frac{a}{b + \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)}}\right)}^{-1}} \]
    5. Step-by-step derivation
      1. unpow-181.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. fma-udef81.2%

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

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

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

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

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

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

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

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

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

    if 1.5e-48 < b

    1. Initial program 61.1%

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

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

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

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

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

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

Alternative 3: 80.2% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 20.3%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{c}{b}} \]
    3. 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} \]
    4. Simplified84.8%

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

    if -2.69999999999999981e-155 < b < 3.6000000000000002e-48

    1. Initial program 81.3%

      \[\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} \]
    2. Simplified81.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 a around inf 71.2%

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

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

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

    if 3.6000000000000002e-48 < b

    1. Initial program 61.1%

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

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

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

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

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

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

Alternative 4: 68.5% accurate, 12.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq -5 \cdot 10^{-311}:\\
\;\;\;\;\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 < -5.00000000000023e-311

    1. Initial program 31.9%

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

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

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

        \[\leadsto \frac{\color{blue}{-c}}{b} \]
    4. Simplified66.0%

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

    if -5.00000000000023e-311 < b

    1. Initial program 70.3%

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

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

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

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

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

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

Alternative 5: 44.0% accurate, 19.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq -6.8 \cdot 10^{-294}:\\
\;\;\;\;0\\

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


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

    1. Initial program 31.5%

      \[\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} \]
    2. Step-by-step derivation
      1. clear-num31.6%

        \[\leadsto \color{blue}{\frac{1}{\frac{2 \cdot a}{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}}} \]
      2. associate-/r/31.5%

        \[\leadsto \color{blue}{\frac{1}{2 \cdot a} \cdot \left(\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}\right)} \]
      3. associate-/r*31.5%

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

        \[\leadsto \frac{\color{blue}{0.5}}{a} \cdot \left(\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}\right) \]
      5. add-sqr-sqrt28.9%

        \[\leadsto \frac{0.5}{a} \cdot \left(\left(-b\right) - \color{blue}{\sqrt{\sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}} \cdot \sqrt{\sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}}\right) \]
      6. cancel-sign-sub-inv28.9%

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

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

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

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

        \[\leadsto \frac{0.5}{a} \cdot \left(\color{blue}{\sqrt{b} \cdot \sqrt{b}} + \left(-\sqrt{\sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}\right) \cdot \sqrt{\sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}\right) \]
      11. add-sqr-sqrt26.4%

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

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

      \[\leadsto \frac{0.5}{a} \cdot \left(b - \sqrt{\color{blue}{{b}^{2}}}\right) \]
    5. Step-by-step derivation
      1. unpow23.5%

        \[\leadsto \frac{0.5}{a} \cdot \left(b - \sqrt{\color{blue}{b \cdot b}}\right) \]
    6. Simplified3.5%

      \[\leadsto \frac{0.5}{a} \cdot \left(b - \sqrt{\color{blue}{b \cdot b}}\right) \]
    7. Taylor expanded in a around 0 23.2%

      \[\leadsto \color{blue}{0} \]

    if -6.79999999999999963e-294 < b

    1. Initial program 70.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 inf 66.7%

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

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

        \[\leadsto \frac{\color{blue}{-b}}{a} \]
    4. Simplified66.7%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -6.8 \cdot 10^{-294}:\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;\frac{-b}{a}\\ \end{array} \]

Alternative 6: 68.3% accurate, 19.1× speedup?

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

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

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


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

    1. Initial program 31.5%

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

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

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

        \[\leadsto \frac{\color{blue}{-c}}{b} \]
    4. Simplified67.1%

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

    if -6.79999999999999963e-294 < b

    1. Initial program 70.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 inf 66.7%

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

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

        \[\leadsto \frac{\color{blue}{-b}}{a} \]
    4. Simplified66.7%

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

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

Alternative 7: 11.3% accurate, 116.0× speedup?

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

\\
0
\end{array}
Derivation
  1. Initial program 52.7%

    \[\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} \]
  2. Step-by-step derivation
    1. clear-num52.7%

      \[\leadsto \color{blue}{\frac{1}{\frac{2 \cdot a}{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}}} \]
    2. associate-/r/52.7%

      \[\leadsto \color{blue}{\frac{1}{2 \cdot a} \cdot \left(\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}\right)} \]
    3. associate-/r*52.7%

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

      \[\leadsto \frac{\color{blue}{0.5}}{a} \cdot \left(\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}\right) \]
    5. add-sqr-sqrt51.3%

      \[\leadsto \frac{0.5}{a} \cdot \left(\left(-b\right) - \color{blue}{\sqrt{\sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}} \cdot \sqrt{\sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}}\right) \]
    6. cancel-sign-sub-inv51.3%

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

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

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

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

      \[\leadsto \frac{0.5}{a} \cdot \left(\color{blue}{\sqrt{b} \cdot \sqrt{b}} + \left(-\sqrt{\sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}\right) \cdot \sqrt{\sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}\right) \]
    11. add-sqr-sqrt33.6%

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

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

    \[\leadsto \frac{0.5}{a} \cdot \left(b - \sqrt{\color{blue}{{b}^{2}}}\right) \]
  5. Step-by-step derivation
    1. unpow29.2%

      \[\leadsto \frac{0.5}{a} \cdot \left(b - \sqrt{\color{blue}{b \cdot b}}\right) \]
  6. Simplified9.2%

    \[\leadsto \frac{0.5}{a} \cdot \left(b - \sqrt{\color{blue}{b \cdot b}}\right) \]
  7. Taylor expanded in a around 0 11.9%

    \[\leadsto \color{blue}{0} \]
  8. Final simplification11.9%

    \[\leadsto 0 \]

Developer target: 71.5% 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 2023201 
(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)))