quadm (p42, negative)

Percentage Accurate: 52.3% → 85.4%
Time: 16.9s
Alternatives: 10
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 10 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.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: 85.4% accurate, 0.4× speedup?

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

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

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

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


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

    1. Initial program 22.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 86.9%

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

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

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

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

    if -1.4500000000000001e-85 < b < 4.4999999999999999e69

    1. Initial program 82.0%

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

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

        \[\leadsto \frac{\color{blue}{-1 \cdot b}}{2 \cdot a} - \frac{\sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a} \]
      3. times-frac82.0%

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

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

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

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

        \[\leadsto \mathsf{fma}\left(-0.5, \frac{b}{a}, \color{blue}{\frac{-\left(-\sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}\right)}{-2 \cdot a}}\right) \]
      8. remove-double-neg82.0%

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

        \[\leadsto \mathsf{fma}\left(-0.5, \frac{b}{a}, \frac{\sqrt{\color{blue}{\mathsf{fma}\left(b, b, -4 \cdot \left(a \cdot c\right)\right)}}}{-2 \cdot a}\right) \]
      10. distribute-lft-neg-in81.9%

        \[\leadsto \mathsf{fma}\left(-0.5, \frac{b}{a}, \frac{\sqrt{\mathsf{fma}\left(b, b, \color{blue}{\left(-4\right) \cdot \left(a \cdot c\right)}\right)}}{-2 \cdot a}\right) \]
      11. *-commutative81.9%

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

        \[\leadsto \mathsf{fma}\left(-0.5, \frac{b}{a}, \frac{\sqrt{\mathsf{fma}\left(b, b, \color{blue}{a \cdot \left(c \cdot \left(-4\right)\right)}\right)}}{-2 \cdot a}\right) \]
      13. metadata-eval81.9%

        \[\leadsto \mathsf{fma}\left(-0.5, \frac{b}{a}, \frac{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot \color{blue}{-4}\right)\right)}}{-2 \cdot a}\right) \]
      14. *-commutative81.9%

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

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

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

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

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

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

    if 4.4999999999999999e69 < b

    1. Initial program 57.8%

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

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

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

        \[\leadsto \frac{\color{blue}{-b}}{a} \]
    4. Simplified97.2%

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

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

Alternative 2: 85.3% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 22.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 86.9%

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

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

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

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

    if -7.60000000000000022e-88 < b < 5.99999999999999967e69

    1. Initial program 82.0%

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

    if 5.99999999999999967e69 < b

    1. Initial program 57.8%

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

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

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

        \[\leadsto \frac{\color{blue}{-b}}{a} \]
    4. Simplified97.2%

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

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

Alternative 3: 85.3% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 22.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 86.9%

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

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

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

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

    if -3.8e-87 < b < 5.2000000000000001e67

    1. Initial program 82.0%

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

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

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

        \[\leadsto \color{blue}{\frac{1}{-2 \cdot a} \cdot \left(-\left(\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}\right)\right)} \]
      4. distribute-lft-neg-in81.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.2000000000000001e67 < b

    1. Initial program 57.8%

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

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

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

        \[\leadsto \frac{\color{blue}{-b}}{a} \]
    4. Simplified97.2%

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

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

Alternative 4: 80.8% accurate, 1.0× speedup?

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

\mathbf{elif}\;b \leq 2.25 \cdot 10^{-120}:\\
\;\;\;\;\frac{\left(-b\right) - \sqrt{a \cdot \left(c \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 < -6.0000000000000002e-86

    1. Initial program 22.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 86.9%

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

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

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

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

    if -6.0000000000000002e-86 < b < 2.25e-120

    1. Initial program 79.4%

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

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

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

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

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

    if 2.25e-120 < b

    1. Initial program 67.2%

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

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

        \[\leadsto \color{blue}{\frac{c}{b} + -1 \cdot \frac{b}{a}} \]
      2. mul-1-neg88.3%

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

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

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

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

Alternative 5: 80.8% accurate, 1.0× speedup?

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

\mathbf{elif}\;b \leq 2.8 \cdot 10^{-120}:\\
\;\;\;\;\frac{-0.5}{a} \cdot \left(b + \sqrt{a \cdot \left(c \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 < -3.20000000000000012e-88

    1. Initial program 22.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 86.9%

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

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

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

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

    if -3.20000000000000012e-88 < b < 2.79999999999999994e-120

    1. Initial program 79.4%

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

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

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

        \[\leadsto \color{blue}{\frac{1}{-2 \cdot a} \cdot \left(-\left(\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}\right)\right)} \]
      4. distribute-lft-neg-in79.3%

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

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

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

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

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

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

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

        \[\leadsto \frac{-0.5}{a} \cdot \left(b + \sqrt{\color{blue}{\mathsf{fma}\left(b, b, -4 \cdot \left(a \cdot c\right)\right)}}\right) \]
      12. distribute-lft-neg-in79.3%

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

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

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

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

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

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

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

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

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

    if 2.79999999999999994e-120 < b

    1. Initial program 67.2%

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

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

        \[\leadsto \color{blue}{\frac{c}{b} + -1 \cdot \frac{b}{a}} \]
      2. mul-1-neg88.3%

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

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

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

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

Alternative 6: 67.5% accurate, 12.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -5 \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 -5e-310) (/ (- c) b) (- (/ c b) (/ b a))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= -5e-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 <= (-5d-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 <= -5e-310) {
		tmp = -c / b;
	} else {
		tmp = (c / b) - (b / a);
	}
	return tmp;
}
def code(a, b, c):
	tmp = 0
	if b <= -5e-310:
		tmp = -c / b
	else:
		tmp = (c / b) - (b / a)
	return tmp
function code(a, b, c)
	tmp = 0.0
	if (b <= -5e-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 <= -5e-310)
		tmp = -c / b;
	else
		tmp = (c / b) - (b / a);
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := If[LessEqual[b, -5e-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 -5 \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 < -4.999999999999985e-310

    1. Initial program 35.8%

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

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

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

        \[\leadsto \frac{\color{blue}{-c}}{b} \]
    4. Simplified69.3%

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

    if -4.999999999999985e-310 < 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 78.3%

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

        \[\leadsto \color{blue}{\frac{c}{b} + -1 \cdot \frac{b}{a}} \]
      2. mul-1-neg78.3%

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

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

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

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

Alternative 7: 42.7% accurate, 19.1× speedup?

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

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

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


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

    1. Initial program 18.6%

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

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

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

        \[\leadsto \color{blue}{\frac{1}{-2 \cdot a} \cdot \left(-\left(\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}\right)\right)} \]
      4. distribute-lft-neg-in18.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{-0.5}{a} \cdot \left(b + \color{blue}{\left(b + -2 \cdot \frac{a \cdot c}{b}\right)}\right) \]
    5. Step-by-step derivation
      1. associate-*r/2.4%

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

        \[\leadsto \frac{-0.5}{a} \cdot \left(b + \left(b + \color{blue}{\left(a \cdot \frac{c}{b}\right) \cdot -2}\right)\right) \]
      3. associate-*l*2.4%

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

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

      \[\leadsto \frac{-0.5}{a} \cdot \left(b + \color{blue}{\left(b + a \cdot \left(-2 \cdot \frac{c}{b}\right)\right)}\right) \]
    7. Taylor expanded in a around inf 34.6%

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

    if -1.4000000000000001e-20 < b

    1. Initial program 68.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 55.2%

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

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

        \[\leadsto \frac{\color{blue}{-b}}{a} \]
    4. Simplified55.2%

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

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

Alternative 8: 67.3% accurate, 19.1× speedup?

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

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

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


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

    1. Initial program 35.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 69.8%

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

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

        \[\leadsto \frac{\color{blue}{-c}}{b} \]
    4. Simplified69.8%

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

    if -2.5999999999999998e-301 < b

    1. Initial program 70.2%

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

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

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

        \[\leadsto \frac{\color{blue}{-b}}{a} \]
    4. Simplified76.8%

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

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

Alternative 9: 13.1% accurate, 22.9× speedup?

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

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

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


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

    1. Initial program 18.2%

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

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

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

        \[\leadsto \color{blue}{\frac{1}{-2 \cdot a} \cdot \left(-\left(\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}\right)\right)} \]
      4. distribute-lft-neg-in18.2%

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

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

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

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

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

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

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

        \[\leadsto \frac{-0.5}{a} \cdot \left(b + \sqrt{\color{blue}{\mathsf{fma}\left(b, b, -4 \cdot \left(a \cdot c\right)\right)}}\right) \]
      12. distribute-lft-neg-in18.2%

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

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

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

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

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

      \[\leadsto \frac{-0.5}{a} \cdot \left(b + \color{blue}{\left(b + -2 \cdot \frac{a \cdot c}{b}\right)}\right) \]
    5. Step-by-step derivation
      1. associate-*r/2.5%

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

        \[\leadsto \frac{-0.5}{a} \cdot \left(b + \left(b + \color{blue}{\left(a \cdot \frac{c}{b}\right) \cdot -2}\right)\right) \]
      3. associate-*l*2.5%

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

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

      \[\leadsto \frac{-0.5}{a} \cdot \left(b + \color{blue}{\left(b + a \cdot \left(-2 \cdot \frac{c}{b}\right)\right)}\right) \]
    7. Taylor expanded in a around inf 36.1%

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

    if -4 < b

    1. Initial program 67.9%

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

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

        \[\leadsto \color{blue}{1 \cdot \frac{\left(-b\right) - \frac{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -4\right)\right)}{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -4\right)\right)}}}{2 \cdot a}} \]
      2. *-commutative56.1%

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

      \[\leadsto \color{blue}{\left(\frac{-0.5}{a} \cdot \left(b + \mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -4\right)}\right)\right)\right) \cdot 1} \]
    5. Simplified6.0%

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

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

Alternative 10: 5.4% accurate, 38.7× speedup?

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

\\
\frac{-0.5}{a}
\end{array}
Derivation
  1. Initial program 51.4%

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

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

      \[\leadsto \color{blue}{1 \cdot \frac{\left(-b\right) - \frac{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -4\right)\right)}{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -4\right)\right)}}}{2 \cdot a}} \]
    2. *-commutative43.2%

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

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

    \[\leadsto \color{blue}{\frac{-0.5}{a}} \]
  6. Final simplification5.2%

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

Developer target: 99.7% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left|\frac{b}{2}\right|\\ t_1 := \sqrt{\left|a\right|} \cdot \sqrt{\left|c\right|}\\ t_2 := \begin{array}{l} \mathbf{if}\;\mathsf{copysign}\left(a, c\right) = a:\\ \;\;\;\;\sqrt{t_0 - t_1} \cdot \sqrt{t_0 + t_1}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{hypot}\left(\frac{b}{2}, t_1\right)\\ \end{array}\\ \mathbf{if}\;b < 0:\\ \;\;\;\;\frac{c}{t_2 - \frac{b}{2}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{b}{2} + t_2}{-a}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (fabs (/ b 2.0)))
        (t_1 (* (sqrt (fabs a)) (sqrt (fabs c))))
        (t_2
         (if (== (copysign a c) a)
           (* (sqrt (- t_0 t_1)) (sqrt (+ t_0 t_1)))
           (hypot (/ b 2.0) t_1))))
   (if (< b 0.0) (/ c (- t_2 (/ b 2.0))) (/ (+ (/ b 2.0) t_2) (- a)))))
double code(double a, double b, double c) {
	double t_0 = fabs((b / 2.0));
	double t_1 = sqrt(fabs(a)) * sqrt(fabs(c));
	double tmp;
	if (copysign(a, c) == a) {
		tmp = sqrt((t_0 - t_1)) * sqrt((t_0 + t_1));
	} else {
		tmp = hypot((b / 2.0), t_1);
	}
	double t_2 = tmp;
	double tmp_1;
	if (b < 0.0) {
		tmp_1 = c / (t_2 - (b / 2.0));
	} else {
		tmp_1 = ((b / 2.0) + t_2) / -a;
	}
	return tmp_1;
}
public static double code(double a, double b, double c) {
	double t_0 = Math.abs((b / 2.0));
	double t_1 = Math.sqrt(Math.abs(a)) * Math.sqrt(Math.abs(c));
	double tmp;
	if (Math.copySign(a, c) == a) {
		tmp = Math.sqrt((t_0 - t_1)) * Math.sqrt((t_0 + t_1));
	} else {
		tmp = Math.hypot((b / 2.0), t_1);
	}
	double t_2 = tmp;
	double tmp_1;
	if (b < 0.0) {
		tmp_1 = c / (t_2 - (b / 2.0));
	} else {
		tmp_1 = ((b / 2.0) + t_2) / -a;
	}
	return tmp_1;
}
def code(a, b, c):
	t_0 = math.fabs((b / 2.0))
	t_1 = math.sqrt(math.fabs(a)) * math.sqrt(math.fabs(c))
	tmp = 0
	if math.copysign(a, c) == a:
		tmp = math.sqrt((t_0 - t_1)) * math.sqrt((t_0 + t_1))
	else:
		tmp = math.hypot((b / 2.0), t_1)
	t_2 = tmp
	tmp_1 = 0
	if b < 0.0:
		tmp_1 = c / (t_2 - (b / 2.0))
	else:
		tmp_1 = ((b / 2.0) + t_2) / -a
	return tmp_1
function code(a, b, c)
	t_0 = abs(Float64(b / 2.0))
	t_1 = Float64(sqrt(abs(a)) * sqrt(abs(c)))
	tmp = 0.0
	if (copysign(a, c) == a)
		tmp = Float64(sqrt(Float64(t_0 - t_1)) * sqrt(Float64(t_0 + t_1)));
	else
		tmp = hypot(Float64(b / 2.0), t_1);
	end
	t_2 = tmp
	tmp_1 = 0.0
	if (b < 0.0)
		tmp_1 = Float64(c / Float64(t_2 - Float64(b / 2.0)));
	else
		tmp_1 = Float64(Float64(Float64(b / 2.0) + t_2) / Float64(-a));
	end
	return tmp_1
end
function tmp_3 = code(a, b, c)
	t_0 = abs((b / 2.0));
	t_1 = sqrt(abs(a)) * sqrt(abs(c));
	tmp = 0.0;
	if ((sign(c) * abs(a)) == a)
		tmp = sqrt((t_0 - t_1)) * sqrt((t_0 + t_1));
	else
		tmp = hypot((b / 2.0), t_1);
	end
	t_2 = tmp;
	tmp_2 = 0.0;
	if (b < 0.0)
		tmp_2 = c / (t_2 - (b / 2.0));
	else
		tmp_2 = ((b / 2.0) + t_2) / -a;
	end
	tmp_3 = tmp_2;
end
code[a_, b_, c_] := Block[{t$95$0 = N[Abs[N[(b / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Sqrt[N[Abs[a], $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[Abs[c], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = If[Equal[N[With[{TMP1 = Abs[a], TMP2 = Sign[c]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision], a], N[(N[Sqrt[N[(t$95$0 - t$95$1), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(t$95$0 + t$95$1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(b / 2.0), $MachinePrecision] ^ 2 + t$95$1 ^ 2], $MachinePrecision]]}, If[Less[b, 0.0], N[(c / N[(t$95$2 - N[(b / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(b / 2.0), $MachinePrecision] + t$95$2), $MachinePrecision] / (-a)), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left|\frac{b}{2}\right|\\
t_1 := \sqrt{\left|a\right|} \cdot \sqrt{\left|c\right|}\\
t_2 := \begin{array}{l}
\mathbf{if}\;\mathsf{copysign}\left(a, c\right) = a:\\
\;\;\;\;\sqrt{t_0 - t_1} \cdot \sqrt{t_0 + t_1}\\

\mathbf{else}:\\
\;\;\;\;\mathsf{hypot}\left(\frac{b}{2}, t_1\right)\\


\end{array}\\
\mathbf{if}\;b < 0:\\
\;\;\;\;\frac{c}{t_2 - \frac{b}{2}}\\

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


\end{array}
\end{array}

Reproduce

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

  :herbie-target
  (if (< b 0.0) (/ c (- (if (== (copysign a c) a) (* (sqrt (- (fabs (/ b 2.0)) (* (sqrt (fabs a)) (sqrt (fabs c))))) (sqrt (+ (fabs (/ b 2.0)) (* (sqrt (fabs a)) (sqrt (fabs c)))))) (hypot (/ b 2.0) (* (sqrt (fabs a)) (sqrt (fabs c))))) (/ b 2.0))) (/ (+ (/ b 2.0) (if (== (copysign a c) a) (* (sqrt (- (fabs (/ b 2.0)) (* (sqrt (fabs a)) (sqrt (fabs c))))) (sqrt (+ (fabs (/ b 2.0)) (* (sqrt (fabs a)) (sqrt (fabs c)))))) (hypot (/ b 2.0) (* (sqrt (fabs a)) (sqrt (fabs c)))))) (- a)))

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