quadp (p42, positive)

Percentage Accurate: 52.6% → 85.8%
Time: 11.4s
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: 52.6% 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, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq -9 \cdot 10^{+78}:\\
\;\;\;\;\frac{-b}{a}\\

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

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


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

    1. Initial program 52.6%

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

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

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

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

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

    if -8.9999999999999999e78 < b < 2.69999999999999994e-73

    1. Initial program 85.8%

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

    if 2.69999999999999994e-73 < b

    1. Initial program 14.6%

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

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

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

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

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

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

Alternative 2: 80.2% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq -4.6 \cdot 10^{-144}:\\
\;\;\;\;\frac{c}{b} - \frac{b}{a}\\

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

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


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

    1. Initial program 71.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 80.0%

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

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

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

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

    if -4.6e-144 < b < 9.5000000000000007e-74

    1. Initial program 77.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. add-sqr-sqrt77.4%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{{\left(e^{0.25 \cdot \left(-1 \cdot \log \left(\frac{1}{a}\right) + \log \left(-4 \cdot c\right)\right)}\right)}^{2} - b}}{2 \cdot a} \]
    5. Simplified76.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 9.5000000000000007e-74 < b

    1. Initial program 14.6%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -4.6 \cdot 10^{-144}:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \mathbf{elif}\;b \leq 9.5 \cdot 10^{-74}:\\ \;\;\;\;\frac{1}{\frac{a \cdot 2}{\sqrt{c \cdot \left(a \cdot -4\right)} - b}}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \]

Alternative 3: 80.2% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq -4.6 \cdot 10^{-144}:\\
\;\;\;\;\frac{c}{b} - \frac{b}{a}\\

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

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


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

    1. Initial program 71.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 80.0%

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

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

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

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

    if -4.6e-144 < b < 1.24999999999999999e-71

    1. Initial program 77.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. add-sqr-sqrt77.4%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{{\left(e^{0.25 \cdot \left(-1 \cdot \log \left(\frac{1}{a}\right) + \log \left(-4 \cdot c\right)\right)}\right)}^{2} - b}}{2 \cdot a} \]
    5. Simplified76.5%

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

    if 1.24999999999999999e-71 < b

    1. Initial program 14.6%

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

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

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

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

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

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

Alternative 4: 67.2% accurate, 10.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq -3.6 \cdot 10^{-304}:\\
\;\;\;\;\frac{c}{b} - \frac{b}{a}\\

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


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

    1. Initial program 73.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 67.5%

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

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

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

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

    if -3.6000000000000001e-304 < b

    1. Initial program 31.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. add-sqr-sqrt28.4%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{{\left(\frac{2 \cdot a}{\left(-b\right) + {\left({\left(\mathsf{fma}\left(b, b, \left(-4 \cdot a\right) \cdot c\right)\right)}^{0.25}\right)}^{2}}\right)}^{-1}} \]
      3. *-commutative28.5%

        \[\leadsto {\left(\frac{\color{blue}{a \cdot 2}}{\left(-b\right) + {\left({\left(\mathsf{fma}\left(b, b, \left(-4 \cdot a\right) \cdot c\right)\right)}^{0.25}\right)}^{2}}\right)}^{-1} \]
      4. neg-mul-128.5%

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

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

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

        \[\leadsto {\left(\frac{a \cdot 2}{\mathsf{fma}\left(\color{blue}{-1}, b, {\left({\left(\mathsf{fma}\left(b, b, \left(-4 \cdot a\right) \cdot c\right)\right)}^{0.25}\right)}^{2}\right)}\right)}^{-1} \]
      8. pow-pow31.0%

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

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

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

        \[\leadsto {\left(\frac{a \cdot 2}{\mathsf{fma}\left(-1, b, \sqrt{\color{blue}{b \cdot b + \left(-4 \cdot a\right) \cdot c}}\right)}\right)}^{-1} \]
      12. add-sqr-sqrt29.6%

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

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

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

      \[\leadsto \color{blue}{{\left(\frac{a \cdot 2}{\mathsf{fma}\left(-1, b, \mathsf{hypot}\left(b, \sqrt{-4 \cdot \left(a \cdot c\right)}\right)\right)}\right)}^{-1}} \]
    6. Step-by-step derivation
      1. unpow-139.2%

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

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

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

      \[\leadsto \color{blue}{\frac{1}{\frac{a}{\frac{\mathsf{fma}\left(-1, b, \mathsf{hypot}\left(b, \sqrt{-4 \cdot \left(c \cdot a\right)}\right)\right)}{2}}}} \]
    8. Taylor expanded in b around inf 0.0%

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

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

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

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

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

        \[\leadsto \frac{1}{\frac{4}{\color{blue}{\sqrt{-4} \cdot \sqrt{-4}}} \cdot \frac{b}{c} + \frac{a}{b}} \]
      6. rem-square-sqrt69.7%

        \[\leadsto \frac{1}{\frac{4}{\color{blue}{-4}} \cdot \frac{b}{c} + \frac{a}{b}} \]
      7. metadata-eval69.7%

        \[\leadsto \frac{1}{\color{blue}{-1} \cdot \frac{b}{c} + \frac{a}{b}} \]
    10. Simplified69.7%

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

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

Alternative 5: 67.6% accurate, 12.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -1 \cdot 10^{-309}:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b -1e-309) (- (/ c b) (/ b a)) (/ (- c) b)))
double code(double a, double b, double c) {
	double tmp;
	if (b <= -1e-309) {
		tmp = (c / b) - (b / a);
	} else {
		tmp = -c / b;
	}
	return tmp;
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8) :: tmp
    if (b <= (-1d-309)) then
        tmp = (c / b) - (b / a)
    else
        tmp = -c / b
    end if
    code = tmp
end function
public static double code(double a, double b, double c) {
	double tmp;
	if (b <= -1e-309) {
		tmp = (c / b) - (b / a);
	} else {
		tmp = -c / b;
	}
	return tmp;
}
def code(a, b, c):
	tmp = 0
	if b <= -1e-309:
		tmp = (c / b) - (b / a)
	else:
		tmp = -c / b
	return tmp
function code(a, b, c)
	tmp = 0.0
	if (b <= -1e-309)
		tmp = Float64(Float64(c / b) - Float64(b / a));
	else
		tmp = Float64(Float64(-c) / b);
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	tmp = 0.0;
	if (b <= -1e-309)
		tmp = (c / b) - (b / a);
	else
		tmp = -c / b;
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := If[LessEqual[b, -1e-309], N[(N[(c / b), $MachinePrecision] - N[(b / a), $MachinePrecision]), $MachinePrecision], N[((-c) / b), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq -1 \cdot 10^{-309}:\\
\;\;\;\;\frac{c}{b} - \frac{b}{a}\\

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


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

    1. Initial program 73.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 65.9%

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

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

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

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

    if -1.000000000000002e-309 < b

    1. Initial program 29.5%

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

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

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

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

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

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

Alternative 6: 43.2% accurate, 19.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq -1 \cdot 10^{-309}:\\
\;\;\;\;\frac{-b}{a}\\

\mathbf{else}:\\
\;\;\;\;\frac{0}{a}\\


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

    1. Initial program 73.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 65.6%

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

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

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

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

    if -1.000000000000002e-309 < b

    1. Initial program 29.5%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{1}{\frac{2 \cdot a}{\left(-b\right) + {\left({\left(\mathsf{fma}\left(b, b, \left(-4 \cdot a\right) \cdot c\right)\right)}^{0.25}\right)}^{2}}}} \]
      2. inv-pow26.9%

        \[\leadsto \color{blue}{{\left(\frac{2 \cdot a}{\left(-b\right) + {\left({\left(\mathsf{fma}\left(b, b, \left(-4 \cdot a\right) \cdot c\right)\right)}^{0.25}\right)}^{2}}\right)}^{-1}} \]
      3. *-commutative26.9%

        \[\leadsto {\left(\frac{\color{blue}{a \cdot 2}}{\left(-b\right) + {\left({\left(\mathsf{fma}\left(b, b, \left(-4 \cdot a\right) \cdot c\right)\right)}^{0.25}\right)}^{2}}\right)}^{-1} \]
      4. neg-mul-126.9%

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

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

        \[\leadsto {\left(\frac{a \cdot 2}{\color{blue}{\mathsf{fma}\left(\frac{-2}{2}, b, {\left({\left(\mathsf{fma}\left(b, b, \left(-4 \cdot a\right) \cdot c\right)\right)}^{0.25}\right)}^{2}\right)}}\right)}^{-1} \]
      7. metadata-eval26.9%

        \[\leadsto {\left(\frac{a \cdot 2}{\mathsf{fma}\left(\color{blue}{-1}, b, {\left({\left(\mathsf{fma}\left(b, b, \left(-4 \cdot a\right) \cdot c\right)\right)}^{0.25}\right)}^{2}\right)}\right)}^{-1} \]
      8. pow-pow29.5%

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

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

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

        \[\leadsto {\left(\frac{a \cdot 2}{\mathsf{fma}\left(-1, b, \sqrt{\color{blue}{b \cdot b + \left(-4 \cdot a\right) \cdot c}}\right)}\right)}^{-1} \]
      12. add-sqr-sqrt28.1%

        \[\leadsto {\left(\frac{a \cdot 2}{\mathsf{fma}\left(-1, b, \sqrt{b \cdot b + \color{blue}{\sqrt{\left(-4 \cdot a\right) \cdot c} \cdot \sqrt{\left(-4 \cdot a\right) \cdot c}}}\right)}\right)}^{-1} \]
      13. hypot-udef37.8%

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

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

      \[\leadsto \color{blue}{{\left(\frac{a \cdot 2}{\mathsf{fma}\left(-1, b, \mathsf{hypot}\left(b, \sqrt{-4 \cdot \left(a \cdot c\right)}\right)\right)}\right)}^{-1}} \]
    6. Step-by-step derivation
      1. unpow-137.8%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{0.5 \cdot \left(b + -1 \cdot b\right)}{a}} \]
      2. distribute-rgt1-in22.9%

        \[\leadsto \frac{0.5 \cdot \color{blue}{\left(\left(-1 + 1\right) \cdot b\right)}}{a} \]
      3. metadata-eval22.9%

        \[\leadsto \frac{0.5 \cdot \left(\color{blue}{0} \cdot b\right)}{a} \]
      4. mul0-lft22.9%

        \[\leadsto \frac{0.5 \cdot \color{blue}{0}}{a} \]
      5. metadata-eval22.9%

        \[\leadsto \frac{\color{blue}{0}}{a} \]
    10. Simplified22.9%

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

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

Alternative 7: 67.4% accurate, 19.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -1 \cdot 10^{-309}:\\ \;\;\;\;\frac{-b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b -1e-309) (/ (- b) a) (/ (- c) b)))
double code(double a, double b, double c) {
	double tmp;
	if (b <= -1e-309) {
		tmp = -b / a;
	} else {
		tmp = -c / b;
	}
	return tmp;
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8) :: tmp
    if (b <= (-1d-309)) then
        tmp = -b / a
    else
        tmp = -c / b
    end if
    code = tmp
end function
public static double code(double a, double b, double c) {
	double tmp;
	if (b <= -1e-309) {
		tmp = -b / a;
	} else {
		tmp = -c / b;
	}
	return tmp;
}
def code(a, b, c):
	tmp = 0
	if b <= -1e-309:
		tmp = -b / a
	else:
		tmp = -c / b
	return tmp
function code(a, b, c)
	tmp = 0.0
	if (b <= -1e-309)
		tmp = Float64(Float64(-b) / a);
	else
		tmp = Float64(Float64(-c) / b);
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	tmp = 0.0;
	if (b <= -1e-309)
		tmp = -b / a;
	else
		tmp = -c / b;
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := If[LessEqual[b, -1e-309], N[((-b) / a), $MachinePrecision], N[((-c) / b), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq -1 \cdot 10^{-309}:\\
\;\;\;\;\frac{-b}{a}\\

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


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

    1. Initial program 73.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 65.6%

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

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

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

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

    if -1.000000000000002e-309 < b

    1. Initial program 29.5%

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

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

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

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

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

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

Alternative 8: 11.2% accurate, 38.7× speedup?

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

\\
\frac{0}{a}
\end{array}
Derivation
  1. Initial program 50.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. add-sqr-sqrt49.1%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{1}{\frac{2 \cdot a}{\left(-b\right) + {\left({\left(\mathsf{fma}\left(b, b, \left(-4 \cdot a\right) \cdot c\right)\right)}^{0.25}\right)}^{2}}}} \]
    2. inv-pow49.2%

      \[\leadsto \color{blue}{{\left(\frac{2 \cdot a}{\left(-b\right) + {\left({\left(\mathsf{fma}\left(b, b, \left(-4 \cdot a\right) \cdot c\right)\right)}^{0.25}\right)}^{2}}\right)}^{-1}} \]
    3. *-commutative49.2%

      \[\leadsto {\left(\frac{\color{blue}{a \cdot 2}}{\left(-b\right) + {\left({\left(\mathsf{fma}\left(b, b, \left(-4 \cdot a\right) \cdot c\right)\right)}^{0.25}\right)}^{2}}\right)}^{-1} \]
    4. neg-mul-149.2%

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

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

      \[\leadsto {\left(\frac{a \cdot 2}{\color{blue}{\mathsf{fma}\left(\frac{-2}{2}, b, {\left({\left(\mathsf{fma}\left(b, b, \left(-4 \cdot a\right) \cdot c\right)\right)}^{0.25}\right)}^{2}\right)}}\right)}^{-1} \]
    7. metadata-eval49.2%

      \[\leadsto {\left(\frac{a \cdot 2}{\mathsf{fma}\left(\color{blue}{-1}, b, {\left({\left(\mathsf{fma}\left(b, b, \left(-4 \cdot a\right) \cdot c\right)\right)}^{0.25}\right)}^{2}\right)}\right)}^{-1} \]
    8. pow-pow50.7%

      \[\leadsto {\left(\frac{a \cdot 2}{\mathsf{fma}\left(-1, b, \color{blue}{{\left(\mathsf{fma}\left(b, b, \left(-4 \cdot a\right) \cdot c\right)\right)}^{\left(0.25 \cdot 2\right)}}\right)}\right)}^{-1} \]
    9. metadata-eval50.7%

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

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

      \[\leadsto {\left(\frac{a \cdot 2}{\mathsf{fma}\left(-1, b, \sqrt{\color{blue}{b \cdot b + \left(-4 \cdot a\right) \cdot c}}\right)}\right)}^{-1} \]
    12. add-sqr-sqrt41.4%

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

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

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

    \[\leadsto \color{blue}{{\left(\frac{a \cdot 2}{\mathsf{fma}\left(-1, b, \mathsf{hypot}\left(b, \sqrt{-4 \cdot \left(a \cdot c\right)}\right)\right)}\right)}^{-1}} \]
  6. Step-by-step derivation
    1. unpow-149.0%

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{0.5 \cdot \left(b + -1 \cdot b\right)}{a}} \]
    2. distribute-rgt1-in13.3%

      \[\leadsto \frac{0.5 \cdot \color{blue}{\left(\left(-1 + 1\right) \cdot b\right)}}{a} \]
    3. metadata-eval13.3%

      \[\leadsto \frac{0.5 \cdot \left(\color{blue}{0} \cdot b\right)}{a} \]
    4. mul0-lft13.3%

      \[\leadsto \frac{0.5 \cdot \color{blue}{0}}{a} \]
    5. metadata-eval13.3%

      \[\leadsto \frac{\color{blue}{0}}{a} \]
  10. Simplified13.3%

    \[\leadsto \color{blue}{\frac{0}{a}} \]
  11. Final simplification13.3%

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

Developer target: 70.4% 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{\left(-b\right) + t_0}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{a \cdot \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)
     (/ (+ (- b) t_0) (* 2.0 a))
     (/ c (* 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 = (-b + t_0) / (2.0 * a);
	} else {
		tmp = c / (a * ((-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 = (-b + t_0) / (2.0d0 * a)
    else
        tmp = c / (a * ((-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 = (-b + t_0) / (2.0 * a);
	} else {
		tmp = c / (a * ((-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 = (-b + t_0) / (2.0 * a)
	else:
		tmp = c / (a * ((-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(Float64(Float64(-b) + t_0) / Float64(2.0 * a));
	else
		tmp = Float64(c / Float64(a * 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 = (-b + t_0) / (2.0 * a);
	else
		tmp = c / (a * ((-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[(N[((-b) + t$95$0), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision], N[(c / N[(a * N[(N[((-b) - t$95$0), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]), $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{\left(-b\right) + t_0}{2 \cdot a}\\

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


\end{array}
\end{array}

Reproduce

?
herbie shell --seed 2023264 
(FPCore (a b c)
  :name "quadp (p42, positive)"
  :precision binary64

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

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