quadm (p42, negative)

Percentage Accurate: 51.3% → 85.8%
Time: 12.2s
Alternatives: 8
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 8 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: 51.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.8% accurate, 0.5× speedup?

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

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

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

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


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

    1. Initial program 13.8%

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

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

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

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

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

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

    if -5.19999999999999988e-33 < b < 3.69999999999999991e96

    1. Initial program 80.9%

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

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

    if 3.69999999999999991e96 < 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. Simplified53.0%

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

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

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

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

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

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

Alternative 2: 85.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -5 \cdot 10^{-33}:\\ \;\;\;\;\frac{-c}{b}\\ \mathbf{elif}\;b \leq 9.6 \cdot 10^{+95}:\\ \;\;\;\;\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 -5e-33)
   (/ (- c) b)
   (if (<= b 9.6e+95)
     (/ (- (- 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 <= -5e-33) {
		tmp = -c / b;
	} else if (b <= 9.6e+95) {
		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 <= (-5d-33)) then
        tmp = -c / b
    else if (b <= 9.6d+95) 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 <= -5e-33) {
		tmp = -c / b;
	} else if (b <= 9.6e+95) {
		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 <= -5e-33:
		tmp = -c / b
	elif b <= 9.6e+95:
		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 <= -5e-33)
		tmp = Float64(Float64(-c) / b);
	elseif (b <= 9.6e+95)
		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 <= -5e-33)
		tmp = -c / b;
	elseif (b <= 9.6e+95)
		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, -5e-33], N[((-c) / b), $MachinePrecision], If[LessEqual[b, 9.6e+95], 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 -5 \cdot 10^{-33}:\\
\;\;\;\;\frac{-c}{b}\\

\mathbf{elif}\;b \leq 9.6 \cdot 10^{+95}:\\
\;\;\;\;\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 < -5.00000000000000028e-33

    1. Initial program 13.8%

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

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

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

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

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

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

    if -5.00000000000000028e-33 < b < 9.6000000000000002e95

    1. Initial program 80.9%

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

    if 9.6000000000000002e95 < 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. Simplified53.0%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -5 \cdot 10^{-33}:\\ \;\;\;\;\frac{-c}{b}\\ \mathbf{elif}\;b \leq 9.6 \cdot 10^{+95}:\\ \;\;\;\;\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: 81.3% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 17.6%

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

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

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

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

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

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

    if -1.10000000000000003e-77 < b < 7.90000000000000016e-81

    1. Initial program 75.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 0 72.2%

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

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

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

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

    if 7.90000000000000016e-81 < b

    1. Initial program 69.0%

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

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

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

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

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

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

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

Alternative 4: 81.3% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 17.6%

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

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

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

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

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

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

    if -1.24999999999999991e-77 < b < 7.5999999999999997e-81

    1. Initial program 75.8%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{-0.5 \cdot \frac{{\left(e^{0.25 \cdot \left(-1 \cdot \log \left(\frac{1}{a}\right) + \log \left(-4 \cdot c\right)\right)}\right)}^{2} + b}{a}} \]
    8. Step-by-step derivation
      1. Simplified72.2%

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

      if 7.5999999999999997e-81 < b

      1. Initial program 69.0%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{c}{b} - \frac{b}{a}} \]
    9. Recombined 3 regimes into one program.
    10. Final simplification81.5%

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

    Alternative 5: 43.4% accurate, 19.1× speedup?

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

      1. Initial program 13.9%

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

          \[\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/13.9%

          \[\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*13.9%

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

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

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

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

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

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

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

          \[\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) \]
        11. *-commutative7.7%

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

          \[\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) \]
        13. metadata-eval7.7%

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

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

        \[\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 a around 0 22.1%

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

      if -8.1999999999999997e-26 < b

      1. Initial program 70.6%

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

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

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

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

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

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -8.2 \cdot 10^{-26}:\\ \;\;\;\;\frac{c}{b}\\ \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 -2.3 \cdot 10^{-303}:\\ \;\;\;\;\frac{-c}{b}\\ \mathbf{else}:\\ \;\;\;\;\frac{-b}{a}\\ \end{array} \end{array} \]
    (FPCore (a b c)
     :precision binary64
     (if (<= b -2.3e-303) (/ (- c) b) (/ (- b) a)))
    double code(double a, double b, double c) {
    	double tmp;
    	if (b <= -2.3e-303) {
    		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.3d-303)) 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.3e-303) {
    		tmp = -c / b;
    	} else {
    		tmp = -b / a;
    	}
    	return tmp;
    }
    
    def code(a, b, c):
    	tmp = 0
    	if b <= -2.3e-303:
    		tmp = -c / b
    	else:
    		tmp = -b / a
    	return tmp
    
    function code(a, b, c)
    	tmp = 0.0
    	if (b <= -2.3e-303)
    		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.3e-303)
    		tmp = -c / b;
    	else
    		tmp = -b / a;
    	end
    	tmp_2 = tmp;
    end
    
    code[a_, b_, c_] := If[LessEqual[b, -2.3e-303], N[((-c) / b), $MachinePrecision], N[((-b) / a), $MachinePrecision]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;b \leq -2.3 \cdot 10^{-303}:\\
    \;\;\;\;\frac{-c}{b}\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{-b}{a}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if b < -2.29999999999999995e-303

      1. Initial program 31.6%

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

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

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

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

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

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

      if -2.29999999999999995e-303 < b

      1. Initial program 70.8%

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

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

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

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

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

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

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

    Alternative 7: 2.5% accurate, 38.7× speedup?

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

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

        \[\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/53.2%

        \[\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*53.2%

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

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

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

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

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

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

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

        \[\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) \]
      11. *-commutative33.9%

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

        \[\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) \]
      13. metadata-eval33.9%

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

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

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

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

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

    Alternative 8: 11.2% accurate, 38.7× speedup?

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

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

        \[\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/53.2%

        \[\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*53.2%

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

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

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

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

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

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

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

        \[\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) \]
      11. *-commutative33.9%

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

        \[\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) \]
      13. metadata-eval33.9%

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

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

      \[\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 a around 0 9.0%

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

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

    Developer target: 70.0% 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 2023256 
    (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)))