quad2p (problem 3.2.1, positive)

Percentage Accurate: 51.7% → 84.5%
Time: 12.0s
Alternatives: 9
Speedup: 15.9×

Specification

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

\\
\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{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 9 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.7% accurate, 1.0× speedup?

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

\\
\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}
\end{array}

Alternative 1: 84.5% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b_2 \leq -8.2 \cdot 10^{+165}:\\
\;\;\;\;-2 \cdot \frac{b_2}{a} + 0.5 \cdot \frac{c}{b_2}\\

\mathbf{elif}\;b_2 \leq 4.8 \cdot 10^{-95}:\\
\;\;\;\;\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}\\

\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b_2}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if b_2 < -8.2000000000000005e165

    1. Initial program 45.3%

      \[\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a} \]
    2. Step-by-step derivation
      1. +-commutative45.3%

        \[\leadsto \frac{\color{blue}{\sqrt{b_2 \cdot b_2 - a \cdot c} + \left(-b_2\right)}}{a} \]
      2. unsub-neg45.3%

        \[\leadsto \frac{\color{blue}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{a} \]
    3. Simplified45.3%

      \[\leadsto \color{blue}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}} \]
    4. Taylor expanded in b_2 around -inf 94.7%

      \[\leadsto \color{blue}{-2 \cdot \frac{b_2}{a} + 0.5 \cdot \frac{c}{b_2}} \]

    if -8.2000000000000005e165 < b_2 < 4.8e-95

    1. Initial program 84.9%

      \[\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a} \]
    2. Step-by-step derivation
      1. +-commutative84.9%

        \[\leadsto \frac{\color{blue}{\sqrt{b_2 \cdot b_2 - a \cdot c} + \left(-b_2\right)}}{a} \]
      2. unsub-neg84.9%

        \[\leadsto \frac{\color{blue}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{a} \]
    3. Simplified84.9%

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

    if 4.8e-95 < b_2

    1. Initial program 16.4%

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

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

        \[\leadsto \frac{\color{blue}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{a} \]
    3. Simplified16.4%

      \[\leadsto \color{blue}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}} \]
    4. Taylor expanded in b_2 around inf 64.9%

      \[\leadsto \frac{\color{blue}{-0.5 \cdot \frac{c \cdot a}{b_2}}}{a} \]
    5. Taylor expanded in c around 0 87.0%

      \[\leadsto \color{blue}{-0.5 \cdot \frac{c}{b_2}} \]
    6. Step-by-step derivation
      1. associate-*r/87.0%

        \[\leadsto \color{blue}{\frac{-0.5 \cdot c}{b_2}} \]
    7. Simplified87.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \leq -8.2 \cdot 10^{+165}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a} + 0.5 \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \leq 4.8 \cdot 10^{-95}:\\ \;\;\;\;\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot -0.5}{b_2}\\ \end{array} \]

Alternative 2: 80.5% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b_2 \leq -6.5 \cdot 10^{-76}:\\
\;\;\;\;-2 \cdot \frac{b_2}{a} + 0.5 \cdot \frac{c}{b_2}\\

\mathbf{elif}\;b_2 \leq 2.6 \cdot 10^{-95}:\\
\;\;\;\;\frac{\sqrt{c \cdot \left(-a\right)} - b_2}{a}\\

\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b_2}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if b_2 < -6.5e-76

    1. Initial program 70.9%

      \[\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a} \]
    2. Step-by-step derivation
      1. +-commutative70.9%

        \[\leadsto \frac{\color{blue}{\sqrt{b_2 \cdot b_2 - a \cdot c} + \left(-b_2\right)}}{a} \]
      2. unsub-neg70.9%

        \[\leadsto \frac{\color{blue}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{a} \]
    3. Simplified70.9%

      \[\leadsto \color{blue}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}} \]
    4. Taylor expanded in b_2 around -inf 88.0%

      \[\leadsto \color{blue}{-2 \cdot \frac{b_2}{a} + 0.5 \cdot \frac{c}{b_2}} \]

    if -6.5e-76 < b_2 < 2.60000000000000001e-95

    1. Initial program 79.4%

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

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

        \[\leadsto \frac{\color{blue}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{a} \]
    3. Simplified79.4%

      \[\leadsto \color{blue}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}} \]
    4. Taylor expanded in b_2 around 0 75.8%

      \[\leadsto \frac{\sqrt{\color{blue}{-1 \cdot \left(c \cdot a\right)}} - b_2}{a} \]
    5. Step-by-step derivation
      1. mul-1-neg75.8%

        \[\leadsto \frac{\sqrt{\color{blue}{-c \cdot a}} - b_2}{a} \]
      2. distribute-rgt-neg-out75.8%

        \[\leadsto \frac{\sqrt{\color{blue}{c \cdot \left(-a\right)}} - b_2}{a} \]
    6. Simplified75.8%

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

    if 2.60000000000000001e-95 < b_2

    1. Initial program 16.4%

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

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

        \[\leadsto \frac{\color{blue}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{a} \]
    3. Simplified16.4%

      \[\leadsto \color{blue}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}} \]
    4. Taylor expanded in b_2 around inf 64.9%

      \[\leadsto \frac{\color{blue}{-0.5 \cdot \frac{c \cdot a}{b_2}}}{a} \]
    5. Taylor expanded in c around 0 87.0%

      \[\leadsto \color{blue}{-0.5 \cdot \frac{c}{b_2}} \]
    6. Step-by-step derivation
      1. associate-*r/87.0%

        \[\leadsto \color{blue}{\frac{-0.5 \cdot c}{b_2}} \]
    7. Simplified87.0%

      \[\leadsto \color{blue}{\frac{-0.5 \cdot c}{b_2}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification84.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \leq -6.5 \cdot 10^{-76}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a} + 0.5 \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \leq 2.6 \cdot 10^{-95}:\\ \;\;\;\;\frac{\sqrt{c \cdot \left(-a\right)} - b_2}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot -0.5}{b_2}\\ \end{array} \]

Alternative 3: 68.2% accurate, 8.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b_2 \leq -2 \cdot 10^{-310}:\\
\;\;\;\;-2 \cdot \frac{b_2}{a} + 0.5 \cdot \frac{c}{b_2}\\

\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b_2}\\


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

    1. Initial program 74.6%

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

        \[\leadsto \frac{\color{blue}{\sqrt{b_2 \cdot b_2 - a \cdot c} + \left(-b_2\right)}}{a} \]
      2. unsub-neg74.6%

        \[\leadsto \frac{\color{blue}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{a} \]
    3. Simplified74.6%

      \[\leadsto \color{blue}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}} \]
    4. Taylor expanded in b_2 around -inf 67.6%

      \[\leadsto \color{blue}{-2 \cdot \frac{b_2}{a} + 0.5 \cdot \frac{c}{b_2}} \]

    if -1.999999999999994e-310 < b_2

    1. Initial program 33.3%

      \[\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a} \]
    2. Step-by-step derivation
      1. +-commutative33.3%

        \[\leadsto \frac{\color{blue}{\sqrt{b_2 \cdot b_2 - a \cdot c} + \left(-b_2\right)}}{a} \]
      2. unsub-neg33.3%

        \[\leadsto \frac{\color{blue}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{a} \]
    3. Simplified33.3%

      \[\leadsto \color{blue}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}} \]
    4. Taylor expanded in b_2 around inf 48.3%

      \[\leadsto \frac{\color{blue}{-0.5 \cdot \frac{c \cdot a}{b_2}}}{a} \]
    5. Taylor expanded in c around 0 66.5%

      \[\leadsto \color{blue}{-0.5 \cdot \frac{c}{b_2}} \]
    6. Step-by-step derivation
      1. associate-*r/66.5%

        \[\leadsto \color{blue}{\frac{-0.5 \cdot c}{b_2}} \]
    7. Simplified66.5%

      \[\leadsto \color{blue}{\frac{-0.5 \cdot c}{b_2}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification67.0%

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

Alternative 4: 48.0% accurate, 15.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b_2 \leq 6.8 \cdot 10^{-297}:\\
\;\;\;\;\frac{-b_2}{a}\\

\mathbf{else}:\\
\;\;\;\;\frac{c}{b_2} \cdot -0.5\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b_2 < 6.79999999999999966e-297

    1. Initial program 74.8%

      \[\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a} \]
    2. Step-by-step derivation
      1. +-commutative74.8%

        \[\leadsto \frac{\color{blue}{\sqrt{b_2 \cdot b_2 - a \cdot c} + \left(-b_2\right)}}{a} \]
      2. unsub-neg74.8%

        \[\leadsto \frac{\color{blue}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{a} \]
    3. Simplified74.8%

      \[\leadsto \color{blue}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}} \]
    4. Step-by-step derivation
      1. add-cube-cbrt74.3%

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

        \[\leadsto \frac{\color{blue}{\sqrt{\sqrt[3]{b_2 \cdot b_2 - a \cdot c} \cdot \sqrt[3]{b_2 \cdot b_2 - a \cdot c}} \cdot \sqrt{\sqrt[3]{b_2 \cdot b_2 - a \cdot c}}} - b_2}{a} \]
      3. pow274.4%

        \[\leadsto \frac{\sqrt{\color{blue}{{\left(\sqrt[3]{b_2 \cdot b_2 - a \cdot c}\right)}^{2}}} \cdot \sqrt{\sqrt[3]{b_2 \cdot b_2 - a \cdot c}} - b_2}{a} \]
      4. fma-neg74.4%

        \[\leadsto \frac{\sqrt{{\left(\sqrt[3]{\color{blue}{\mathsf{fma}\left(b_2, b_2, -a \cdot c\right)}}\right)}^{2}} \cdot \sqrt{\sqrt[3]{b_2 \cdot b_2 - a \cdot c}} - b_2}{a} \]
      5. *-commutative74.4%

        \[\leadsto \frac{\sqrt{{\left(\sqrt[3]{\mathsf{fma}\left(b_2, b_2, -\color{blue}{c \cdot a}\right)}\right)}^{2}} \cdot \sqrt{\sqrt[3]{b_2 \cdot b_2 - a \cdot c}} - b_2}{a} \]
      6. distribute-rgt-neg-in74.4%

        \[\leadsto \frac{\sqrt{{\left(\sqrt[3]{\mathsf{fma}\left(b_2, b_2, \color{blue}{c \cdot \left(-a\right)}\right)}\right)}^{2}} \cdot \sqrt{\sqrt[3]{b_2 \cdot b_2 - a \cdot c}} - b_2}{a} \]
      7. add-sqr-sqrt74.4%

        \[\leadsto \frac{\sqrt{{\left(\sqrt[3]{\mathsf{fma}\left(b_2, b_2, c \cdot \left(-a\right)\right)}\right)}^{2}} \cdot \sqrt{\sqrt[3]{\color{blue}{\sqrt{b_2 \cdot b_2 - a \cdot c} \cdot \sqrt{b_2 \cdot b_2 - a \cdot c}}}} - b_2}{a} \]
      8. cbrt-prod74.4%

        \[\leadsto \frac{\sqrt{{\left(\sqrt[3]{\mathsf{fma}\left(b_2, b_2, c \cdot \left(-a\right)\right)}\right)}^{2}} \cdot \sqrt{\color{blue}{\sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c}} \cdot \sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c}}}} - b_2}{a} \]
      9. cbrt-prod74.4%

        \[\leadsto \frac{\sqrt{{\left(\sqrt[3]{\mathsf{fma}\left(b_2, b_2, c \cdot \left(-a\right)\right)}\right)}^{2}} \cdot \sqrt{\color{blue}{\sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c} \cdot \sqrt{b_2 \cdot b_2 - a \cdot c}}}} - b_2}{a} \]
      10. add-sqr-sqrt74.4%

        \[\leadsto \frac{\sqrt{{\left(\sqrt[3]{\mathsf{fma}\left(b_2, b_2, c \cdot \left(-a\right)\right)}\right)}^{2}} \cdot \sqrt{\sqrt[3]{\color{blue}{b_2 \cdot b_2 - a \cdot c}}} - b_2}{a} \]
      11. fma-neg74.4%

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

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

        \[\leadsto \frac{\sqrt{\color{blue}{\sqrt[3]{\mathsf{fma}\left(b_2, b_2, c \cdot \left(-a\right)\right)} \cdot \sqrt[3]{\mathsf{fma}\left(b_2, b_2, c \cdot \left(-a\right)\right)}}} \cdot \sqrt{\sqrt[3]{\mathsf{fma}\left(b_2, b_2, c \cdot \left(-a\right)\right)}} - b_2}{a} \]
      2. rem-sqrt-square74.4%

        \[\leadsto \frac{\color{blue}{\left|\sqrt[3]{\mathsf{fma}\left(b_2, b_2, c \cdot \left(-a\right)\right)}\right|} \cdot \sqrt{\sqrt[3]{\mathsf{fma}\left(b_2, b_2, c \cdot \left(-a\right)\right)}} - b_2}{a} \]
      3. distribute-rgt-neg-out74.4%

        \[\leadsto \frac{\left|\sqrt[3]{\mathsf{fma}\left(b_2, b_2, \color{blue}{-c \cdot a}\right)}\right| \cdot \sqrt{\sqrt[3]{\mathsf{fma}\left(b_2, b_2, c \cdot \left(-a\right)\right)}} - b_2}{a} \]
      4. *-commutative74.4%

        \[\leadsto \frac{\left|\sqrt[3]{\mathsf{fma}\left(b_2, b_2, -\color{blue}{a \cdot c}\right)}\right| \cdot \sqrt{\sqrt[3]{\mathsf{fma}\left(b_2, b_2, c \cdot \left(-a\right)\right)}} - b_2}{a} \]
      5. fma-neg74.4%

        \[\leadsto \frac{\left|\sqrt[3]{\color{blue}{b_2 \cdot b_2 - a \cdot c}}\right| \cdot \sqrt{\sqrt[3]{\mathsf{fma}\left(b_2, b_2, c \cdot \left(-a\right)\right)}} - b_2}{a} \]
      6. *-commutative74.4%

        \[\leadsto \frac{\left|\sqrt[3]{b_2 \cdot b_2 - \color{blue}{c \cdot a}}\right| \cdot \sqrt{\sqrt[3]{\mathsf{fma}\left(b_2, b_2, c \cdot \left(-a\right)\right)}} - b_2}{a} \]
      7. distribute-rgt-neg-out74.4%

        \[\leadsto \frac{\left|\sqrt[3]{b_2 \cdot b_2 - c \cdot a}\right| \cdot \sqrt{\sqrt[3]{\mathsf{fma}\left(b_2, b_2, \color{blue}{-c \cdot a}\right)}} - b_2}{a} \]
      8. *-commutative74.4%

        \[\leadsto \frac{\left|\sqrt[3]{b_2 \cdot b_2 - c \cdot a}\right| \cdot \sqrt{\sqrt[3]{\mathsf{fma}\left(b_2, b_2, -\color{blue}{a \cdot c}\right)}} - b_2}{a} \]
      9. fma-neg74.4%

        \[\leadsto \frac{\left|\sqrt[3]{b_2 \cdot b_2 - c \cdot a}\right| \cdot \sqrt{\sqrt[3]{\color{blue}{b_2 \cdot b_2 - a \cdot c}}} - b_2}{a} \]
      10. *-commutative74.4%

        \[\leadsto \frac{\left|\sqrt[3]{b_2 \cdot b_2 - c \cdot a}\right| \cdot \sqrt{\sqrt[3]{b_2 \cdot b_2 - \color{blue}{c \cdot a}}} - b_2}{a} \]
    7. Simplified74.4%

      \[\leadsto \frac{\color{blue}{\left|\sqrt[3]{b_2 \cdot b_2 - c \cdot a}\right| \cdot \sqrt{\sqrt[3]{b_2 \cdot b_2 - c \cdot a}}} - b_2}{a} \]
    8. Taylor expanded in b_2 around inf 30.0%

      \[\leadsto \frac{\color{blue}{-1 \cdot b_2}}{a} \]
    9. Step-by-step derivation
      1. neg-mul-130.0%

        \[\leadsto \frac{\color{blue}{-b_2}}{a} \]
    10. Simplified30.0%

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

    if 6.79999999999999966e-297 < b_2

    1. Initial program 32.8%

      \[\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a} \]
    2. Step-by-step derivation
      1. +-commutative32.8%

        \[\leadsto \frac{\color{blue}{\sqrt{b_2 \cdot b_2 - a \cdot c} + \left(-b_2\right)}}{a} \]
      2. unsub-neg32.8%

        \[\leadsto \frac{\color{blue}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{a} \]
    3. Simplified32.8%

      \[\leadsto \color{blue}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}} \]
    4. Taylor expanded in b_2 around inf 67.0%

      \[\leadsto \color{blue}{-0.5 \cdot \frac{c}{b_2}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification48.5%

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

Alternative 5: 67.8% accurate, 15.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b_2 \leq 6.8 \cdot 10^{-297}:\\
\;\;\;\;b_2 \cdot \frac{-2}{a}\\

\mathbf{else}:\\
\;\;\;\;\frac{c}{b_2} \cdot -0.5\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b_2 < 6.79999999999999966e-297

    1. Initial program 74.8%

      \[\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a} \]
    2. Step-by-step derivation
      1. +-commutative74.8%

        \[\leadsto \frac{\color{blue}{\sqrt{b_2 \cdot b_2 - a \cdot c} + \left(-b_2\right)}}{a} \]
      2. unsub-neg74.8%

        \[\leadsto \frac{\color{blue}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{a} \]
    3. Simplified74.8%

      \[\leadsto \color{blue}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}} \]
    4. Step-by-step derivation
      1. div-sub74.8%

        \[\leadsto \color{blue}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c}}{a} - \frac{b_2}{a}} \]
      2. add-sqr-sqrt74.6%

        \[\leadsto \frac{\color{blue}{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c}} \cdot \sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c}}}}{a} - \frac{b_2}{a} \]
      3. *-un-lft-identity74.6%

        \[\leadsto \frac{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c}} \cdot \sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c}}}{\color{blue}{1 \cdot a}} - \frac{b_2}{a} \]
      4. times-frac74.5%

        \[\leadsto \color{blue}{\frac{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c}}}{1} \cdot \frac{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c}}}{a}} - \frac{b_2}{a} \]
      5. fma-neg74.6%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c}}}{1}, \frac{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c}}}{a}, -\frac{b_2}{a}\right)} \]
    5. Applied egg-rr74.6%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{{\left(\mathsf{fma}\left(b_2, b_2, c \cdot \left(-a\right)\right)\right)}^{0.25}}{1}, \frac{{\left(\mathsf{fma}\left(b_2, b_2, c \cdot \left(-a\right)\right)\right)}^{0.25}}{a}, -\frac{b_2}{a}\right)} \]
    6. Taylor expanded in b_2 around -inf 67.1%

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

        \[\leadsto \color{blue}{\left(2 \cdot -1\right) \cdot \frac{b_2}{a}} + 0.5 \cdot \frac{c}{b_2} \]
      2. metadata-eval67.1%

        \[\leadsto \color{blue}{-2} \cdot \frac{b_2}{a} + 0.5 \cdot \frac{c}{b_2} \]
      3. *-commutative67.1%

        \[\leadsto -2 \cdot \frac{b_2}{a} + \color{blue}{\frac{c}{b_2} \cdot 0.5} \]
    8. Simplified67.1%

      \[\leadsto \color{blue}{-2 \cdot \frac{b_2}{a} + \frac{c}{b_2} \cdot 0.5} \]
    9. Taylor expanded in b_2 around inf 66.8%

      \[\leadsto \color{blue}{-2 \cdot \frac{b_2}{a}} \]
    10. Step-by-step derivation
      1. associate-*r/66.8%

        \[\leadsto \color{blue}{\frac{-2 \cdot b_2}{a}} \]
      2. associate-*l/66.6%

        \[\leadsto \color{blue}{\frac{-2}{a} \cdot b_2} \]
      3. *-commutative66.6%

        \[\leadsto \color{blue}{b_2 \cdot \frac{-2}{a}} \]
    11. Simplified66.6%

      \[\leadsto \color{blue}{b_2 \cdot \frac{-2}{a}} \]

    if 6.79999999999999966e-297 < b_2

    1. Initial program 32.8%

      \[\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a} \]
    2. Step-by-step derivation
      1. +-commutative32.8%

        \[\leadsto \frac{\color{blue}{\sqrt{b_2 \cdot b_2 - a \cdot c} + \left(-b_2\right)}}{a} \]
      2. unsub-neg32.8%

        \[\leadsto \frac{\color{blue}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{a} \]
    3. Simplified32.8%

      \[\leadsto \color{blue}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}} \]
    4. Taylor expanded in b_2 around inf 67.0%

      \[\leadsto \color{blue}{-0.5 \cdot \frac{c}{b_2}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification66.8%

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

Alternative 6: 67.8% accurate, 15.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b_2 \leq 7.2 \cdot 10^{-297}:\\
\;\;\;\;b_2 \cdot \frac{-2}{a}\\

\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b_2}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b_2 < 7.19999999999999988e-297

    1. Initial program 74.8%

      \[\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a} \]
    2. Step-by-step derivation
      1. +-commutative74.8%

        \[\leadsto \frac{\color{blue}{\sqrt{b_2 \cdot b_2 - a \cdot c} + \left(-b_2\right)}}{a} \]
      2. unsub-neg74.8%

        \[\leadsto \frac{\color{blue}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{a} \]
    3. Simplified74.8%

      \[\leadsto \color{blue}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}} \]
    4. Step-by-step derivation
      1. div-sub74.8%

        \[\leadsto \color{blue}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c}}{a} - \frac{b_2}{a}} \]
      2. add-sqr-sqrt74.6%

        \[\leadsto \frac{\color{blue}{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c}} \cdot \sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c}}}}{a} - \frac{b_2}{a} \]
      3. *-un-lft-identity74.6%

        \[\leadsto \frac{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c}} \cdot \sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c}}}{\color{blue}{1 \cdot a}} - \frac{b_2}{a} \]
      4. times-frac74.5%

        \[\leadsto \color{blue}{\frac{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c}}}{1} \cdot \frac{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c}}}{a}} - \frac{b_2}{a} \]
      5. fma-neg74.6%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c}}}{1}, \frac{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c}}}{a}, -\frac{b_2}{a}\right)} \]
    5. Applied egg-rr74.6%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{{\left(\mathsf{fma}\left(b_2, b_2, c \cdot \left(-a\right)\right)\right)}^{0.25}}{1}, \frac{{\left(\mathsf{fma}\left(b_2, b_2, c \cdot \left(-a\right)\right)\right)}^{0.25}}{a}, -\frac{b_2}{a}\right)} \]
    6. Taylor expanded in b_2 around -inf 67.1%

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

        \[\leadsto \color{blue}{\left(2 \cdot -1\right) \cdot \frac{b_2}{a}} + 0.5 \cdot \frac{c}{b_2} \]
      2. metadata-eval67.1%

        \[\leadsto \color{blue}{-2} \cdot \frac{b_2}{a} + 0.5 \cdot \frac{c}{b_2} \]
      3. *-commutative67.1%

        \[\leadsto -2 \cdot \frac{b_2}{a} + \color{blue}{\frac{c}{b_2} \cdot 0.5} \]
    8. Simplified67.1%

      \[\leadsto \color{blue}{-2 \cdot \frac{b_2}{a} + \frac{c}{b_2} \cdot 0.5} \]
    9. Taylor expanded in b_2 around inf 66.8%

      \[\leadsto \color{blue}{-2 \cdot \frac{b_2}{a}} \]
    10. Step-by-step derivation
      1. associate-*r/66.8%

        \[\leadsto \color{blue}{\frac{-2 \cdot b_2}{a}} \]
      2. associate-*l/66.6%

        \[\leadsto \color{blue}{\frac{-2}{a} \cdot b_2} \]
      3. *-commutative66.6%

        \[\leadsto \color{blue}{b_2 \cdot \frac{-2}{a}} \]
    11. Simplified66.6%

      \[\leadsto \color{blue}{b_2 \cdot \frac{-2}{a}} \]

    if 7.19999999999999988e-297 < b_2

    1. Initial program 32.8%

      \[\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a} \]
    2. Step-by-step derivation
      1. +-commutative32.8%

        \[\leadsto \frac{\color{blue}{\sqrt{b_2 \cdot b_2 - a \cdot c} + \left(-b_2\right)}}{a} \]
      2. unsub-neg32.8%

        \[\leadsto \frac{\color{blue}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{a} \]
    3. Simplified32.8%

      \[\leadsto \color{blue}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}} \]
    4. Taylor expanded in b_2 around inf 48.7%

      \[\leadsto \frac{\color{blue}{-0.5 \cdot \frac{c \cdot a}{b_2}}}{a} \]
    5. Taylor expanded in c around 0 67.0%

      \[\leadsto \color{blue}{-0.5 \cdot \frac{c}{b_2}} \]
    6. Step-by-step derivation
      1. associate-*r/67.0%

        \[\leadsto \color{blue}{\frac{-0.5 \cdot c}{b_2}} \]
    7. Simplified67.0%

      \[\leadsto \color{blue}{\frac{-0.5 \cdot c}{b_2}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification66.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \leq 7.2 \cdot 10^{-297}:\\ \;\;\;\;b_2 \cdot \frac{-2}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot -0.5}{b_2}\\ \end{array} \]

Alternative 7: 68.0% accurate, 15.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b_2 \leq 8.4 \cdot 10^{-297}:\\
\;\;\;\;\frac{b_2 \cdot -2}{a}\\

\mathbf{else}:\\
\;\;\;\;\frac{c \cdot -0.5}{b_2}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b_2 < 8.40000000000000054e-297

    1. Initial program 74.8%

      \[\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a} \]
    2. Step-by-step derivation
      1. +-commutative74.8%

        \[\leadsto \frac{\color{blue}{\sqrt{b_2 \cdot b_2 - a \cdot c} + \left(-b_2\right)}}{a} \]
      2. unsub-neg74.8%

        \[\leadsto \frac{\color{blue}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{a} \]
    3. Simplified74.8%

      \[\leadsto \color{blue}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}} \]
    4. Taylor expanded in b_2 around -inf 66.8%

      \[\leadsto \frac{\color{blue}{-2 \cdot b_2}}{a} \]
    5. Step-by-step derivation
      1. *-commutative66.8%

        \[\leadsto \frac{\color{blue}{b_2 \cdot -2}}{a} \]
    6. Simplified66.8%

      \[\leadsto \frac{\color{blue}{b_2 \cdot -2}}{a} \]

    if 8.40000000000000054e-297 < b_2

    1. Initial program 32.8%

      \[\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a} \]
    2. Step-by-step derivation
      1. +-commutative32.8%

        \[\leadsto \frac{\color{blue}{\sqrt{b_2 \cdot b_2 - a \cdot c} + \left(-b_2\right)}}{a} \]
      2. unsub-neg32.8%

        \[\leadsto \frac{\color{blue}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{a} \]
    3. Simplified32.8%

      \[\leadsto \color{blue}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}} \]
    4. Taylor expanded in b_2 around inf 48.7%

      \[\leadsto \frac{\color{blue}{-0.5 \cdot \frac{c \cdot a}{b_2}}}{a} \]
    5. Taylor expanded in c around 0 67.0%

      \[\leadsto \color{blue}{-0.5 \cdot \frac{c}{b_2}} \]
    6. Step-by-step derivation
      1. associate-*r/67.0%

        \[\leadsto \color{blue}{\frac{-0.5 \cdot c}{b_2}} \]
    7. Simplified67.0%

      \[\leadsto \color{blue}{\frac{-0.5 \cdot c}{b_2}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification66.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \leq 8.4 \cdot 10^{-297}:\\ \;\;\;\;\frac{b_2 \cdot -2}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot -0.5}{b_2}\\ \end{array} \]

Alternative 8: 23.8% accurate, 18.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b_2 \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\frac{-b_2}{a}\\

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


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

    1. Initial program 74.6%

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

        \[\leadsto \frac{\color{blue}{\sqrt{b_2 \cdot b_2 - a \cdot c} + \left(-b_2\right)}}{a} \]
      2. unsub-neg74.6%

        \[\leadsto \frac{\color{blue}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{a} \]
    3. Simplified74.6%

      \[\leadsto \color{blue}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}} \]
    4. Step-by-step derivation
      1. add-cube-cbrt74.1%

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

        \[\leadsto \frac{\color{blue}{\sqrt{\sqrt[3]{b_2 \cdot b_2 - a \cdot c} \cdot \sqrt[3]{b_2 \cdot b_2 - a \cdot c}} \cdot \sqrt{\sqrt[3]{b_2 \cdot b_2 - a \cdot c}}} - b_2}{a} \]
      3. pow274.2%

        \[\leadsto \frac{\sqrt{\color{blue}{{\left(\sqrt[3]{b_2 \cdot b_2 - a \cdot c}\right)}^{2}}} \cdot \sqrt{\sqrt[3]{b_2 \cdot b_2 - a \cdot c}} - b_2}{a} \]
      4. fma-neg74.2%

        \[\leadsto \frac{\sqrt{{\left(\sqrt[3]{\color{blue}{\mathsf{fma}\left(b_2, b_2, -a \cdot c\right)}}\right)}^{2}} \cdot \sqrt{\sqrt[3]{b_2 \cdot b_2 - a \cdot c}} - b_2}{a} \]
      5. *-commutative74.2%

        \[\leadsto \frac{\sqrt{{\left(\sqrt[3]{\mathsf{fma}\left(b_2, b_2, -\color{blue}{c \cdot a}\right)}\right)}^{2}} \cdot \sqrt{\sqrt[3]{b_2 \cdot b_2 - a \cdot c}} - b_2}{a} \]
      6. distribute-rgt-neg-in74.2%

        \[\leadsto \frac{\sqrt{{\left(\sqrt[3]{\mathsf{fma}\left(b_2, b_2, \color{blue}{c \cdot \left(-a\right)}\right)}\right)}^{2}} \cdot \sqrt{\sqrt[3]{b_2 \cdot b_2 - a \cdot c}} - b_2}{a} \]
      7. add-sqr-sqrt74.2%

        \[\leadsto \frac{\sqrt{{\left(\sqrt[3]{\mathsf{fma}\left(b_2, b_2, c \cdot \left(-a\right)\right)}\right)}^{2}} \cdot \sqrt{\sqrt[3]{\color{blue}{\sqrt{b_2 \cdot b_2 - a \cdot c} \cdot \sqrt{b_2 \cdot b_2 - a \cdot c}}}} - b_2}{a} \]
      8. cbrt-prod74.2%

        \[\leadsto \frac{\sqrt{{\left(\sqrt[3]{\mathsf{fma}\left(b_2, b_2, c \cdot \left(-a\right)\right)}\right)}^{2}} \cdot \sqrt{\color{blue}{\sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c}} \cdot \sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c}}}} - b_2}{a} \]
      9. cbrt-prod74.2%

        \[\leadsto \frac{\sqrt{{\left(\sqrt[3]{\mathsf{fma}\left(b_2, b_2, c \cdot \left(-a\right)\right)}\right)}^{2}} \cdot \sqrt{\color{blue}{\sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c} \cdot \sqrt{b_2 \cdot b_2 - a \cdot c}}}} - b_2}{a} \]
      10. add-sqr-sqrt74.2%

        \[\leadsto \frac{\sqrt{{\left(\sqrt[3]{\mathsf{fma}\left(b_2, b_2, c \cdot \left(-a\right)\right)}\right)}^{2}} \cdot \sqrt{\sqrt[3]{\color{blue}{b_2 \cdot b_2 - a \cdot c}}} - b_2}{a} \]
      11. fma-neg74.2%

        \[\leadsto \frac{\sqrt{{\left(\sqrt[3]{\mathsf{fma}\left(b_2, b_2, c \cdot \left(-a\right)\right)}\right)}^{2}} \cdot \sqrt{\sqrt[3]{\color{blue}{\mathsf{fma}\left(b_2, b_2, -a \cdot c\right)}}} - b_2}{a} \]
    5. Applied egg-rr74.2%

      \[\leadsto \frac{\color{blue}{\sqrt{{\left(\sqrt[3]{\mathsf{fma}\left(b_2, b_2, c \cdot \left(-a\right)\right)}\right)}^{2}} \cdot \sqrt{\sqrt[3]{\mathsf{fma}\left(b_2, b_2, c \cdot \left(-a\right)\right)}}} - b_2}{a} \]
    6. Step-by-step derivation
      1. unpow274.2%

        \[\leadsto \frac{\sqrt{\color{blue}{\sqrt[3]{\mathsf{fma}\left(b_2, b_2, c \cdot \left(-a\right)\right)} \cdot \sqrt[3]{\mathsf{fma}\left(b_2, b_2, c \cdot \left(-a\right)\right)}}} \cdot \sqrt{\sqrt[3]{\mathsf{fma}\left(b_2, b_2, c \cdot \left(-a\right)\right)}} - b_2}{a} \]
      2. rem-sqrt-square74.2%

        \[\leadsto \frac{\color{blue}{\left|\sqrt[3]{\mathsf{fma}\left(b_2, b_2, c \cdot \left(-a\right)\right)}\right|} \cdot \sqrt{\sqrt[3]{\mathsf{fma}\left(b_2, b_2, c \cdot \left(-a\right)\right)}} - b_2}{a} \]
      3. distribute-rgt-neg-out74.2%

        \[\leadsto \frac{\left|\sqrt[3]{\mathsf{fma}\left(b_2, b_2, \color{blue}{-c \cdot a}\right)}\right| \cdot \sqrt{\sqrt[3]{\mathsf{fma}\left(b_2, b_2, c \cdot \left(-a\right)\right)}} - b_2}{a} \]
      4. *-commutative74.2%

        \[\leadsto \frac{\left|\sqrt[3]{\mathsf{fma}\left(b_2, b_2, -\color{blue}{a \cdot c}\right)}\right| \cdot \sqrt{\sqrt[3]{\mathsf{fma}\left(b_2, b_2, c \cdot \left(-a\right)\right)}} - b_2}{a} \]
      5. fma-neg74.2%

        \[\leadsto \frac{\left|\sqrt[3]{\color{blue}{b_2 \cdot b_2 - a \cdot c}}\right| \cdot \sqrt{\sqrt[3]{\mathsf{fma}\left(b_2, b_2, c \cdot \left(-a\right)\right)}} - b_2}{a} \]
      6. *-commutative74.2%

        \[\leadsto \frac{\left|\sqrt[3]{b_2 \cdot b_2 - \color{blue}{c \cdot a}}\right| \cdot \sqrt{\sqrt[3]{\mathsf{fma}\left(b_2, b_2, c \cdot \left(-a\right)\right)}} - b_2}{a} \]
      7. distribute-rgt-neg-out74.2%

        \[\leadsto \frac{\left|\sqrt[3]{b_2 \cdot b_2 - c \cdot a}\right| \cdot \sqrt{\sqrt[3]{\mathsf{fma}\left(b_2, b_2, \color{blue}{-c \cdot a}\right)}} - b_2}{a} \]
      8. *-commutative74.2%

        \[\leadsto \frac{\left|\sqrt[3]{b_2 \cdot b_2 - c \cdot a}\right| \cdot \sqrt{\sqrt[3]{\mathsf{fma}\left(b_2, b_2, -\color{blue}{a \cdot c}\right)}} - b_2}{a} \]
      9. fma-neg74.2%

        \[\leadsto \frac{\left|\sqrt[3]{b_2 \cdot b_2 - c \cdot a}\right| \cdot \sqrt{\sqrt[3]{\color{blue}{b_2 \cdot b_2 - a \cdot c}}} - b_2}{a} \]
      10. *-commutative74.2%

        \[\leadsto \frac{\left|\sqrt[3]{b_2 \cdot b_2 - c \cdot a}\right| \cdot \sqrt{\sqrt[3]{b_2 \cdot b_2 - \color{blue}{c \cdot a}}} - b_2}{a} \]
    7. Simplified74.2%

      \[\leadsto \frac{\color{blue}{\left|\sqrt[3]{b_2 \cdot b_2 - c \cdot a}\right| \cdot \sqrt{\sqrt[3]{b_2 \cdot b_2 - c \cdot a}}} - b_2}{a} \]
    8. Taylor expanded in b_2 around inf 30.2%

      \[\leadsto \frac{\color{blue}{-1 \cdot b_2}}{a} \]
    9. Step-by-step derivation
      1. neg-mul-130.2%

        \[\leadsto \frac{\color{blue}{-b_2}}{a} \]
    10. Simplified30.2%

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

    if -1.999999999999994e-310 < b_2

    1. Initial program 33.3%

      \[\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a} \]
    2. Step-by-step derivation
      1. +-commutative33.3%

        \[\leadsto \frac{\color{blue}{\sqrt{b_2 \cdot b_2 - a \cdot c} + \left(-b_2\right)}}{a} \]
      2. unsub-neg33.3%

        \[\leadsto \frac{\color{blue}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{a} \]
    3. Simplified33.3%

      \[\leadsto \color{blue}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}} \]
    4. Step-by-step derivation
      1. div-sub33.0%

        \[\leadsto \color{blue}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c}}{a} - \frac{b_2}{a}} \]
      2. add-sqr-sqrt31.8%

        \[\leadsto \frac{\color{blue}{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c}} \cdot \sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c}}}}{a} - \frac{b_2}{a} \]
      3. *-un-lft-identity31.8%

        \[\leadsto \frac{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c}} \cdot \sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c}}}{\color{blue}{1 \cdot a}} - \frac{b_2}{a} \]
      4. times-frac32.6%

        \[\leadsto \color{blue}{\frac{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c}}}{1} \cdot \frac{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c}}}{a}} - \frac{b_2}{a} \]
      5. fma-neg29.6%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c}}}{1}, \frac{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c}}}{a}, -\frac{b_2}{a}\right)} \]
    5. Applied egg-rr29.6%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{{\left(\mathsf{fma}\left(b_2, b_2, c \cdot \left(-a\right)\right)\right)}^{0.25}}{1}, \frac{{\left(\mathsf{fma}\left(b_2, b_2, c \cdot \left(-a\right)\right)\right)}^{0.25}}{a}, -\frac{b_2}{a}\right)} \]
    6. Taylor expanded in b_2 around inf 10.4%

      \[\leadsto \color{blue}{\frac{b_2}{a} + -1 \cdot \frac{b_2}{a}} \]
    7. Step-by-step derivation
      1. distribute-rgt1-in10.4%

        \[\leadsto \color{blue}{\left(-1 + 1\right) \cdot \frac{b_2}{a}} \]
      2. metadata-eval10.4%

        \[\leadsto \color{blue}{0} \cdot \frac{b_2}{a} \]
      3. mul0-lft13.1%

        \[\leadsto \color{blue}{0} \]
    8. Simplified13.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \leq -2 \cdot 10^{-310}:\\ \;\;\;\;\frac{-b_2}{a}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]

Alternative 9: 11.3% accurate, 112.0× speedup?

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

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

    \[\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a} \]
  2. Step-by-step derivation
    1. +-commutative53.8%

      \[\leadsto \frac{\color{blue}{\sqrt{b_2 \cdot b_2 - a \cdot c} + \left(-b_2\right)}}{a} \]
    2. unsub-neg53.8%

      \[\leadsto \frac{\color{blue}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{a} \]
  3. Simplified53.8%

    \[\leadsto \color{blue}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}} \]
  4. Step-by-step derivation
    1. div-sub53.7%

      \[\leadsto \color{blue}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c}}{a} - \frac{b_2}{a}} \]
    2. add-sqr-sqrt52.9%

      \[\leadsto \frac{\color{blue}{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c}} \cdot \sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c}}}}{a} - \frac{b_2}{a} \]
    3. *-un-lft-identity52.9%

      \[\leadsto \frac{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c}} \cdot \sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c}}}{\color{blue}{1 \cdot a}} - \frac{b_2}{a} \]
    4. times-frac53.3%

      \[\leadsto \color{blue}{\frac{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c}}}{1} \cdot \frac{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c}}}{a}} - \frac{b_2}{a} \]
    5. fma-neg51.8%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c}}}{1}, \frac{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c}}}{a}, -\frac{b_2}{a}\right)} \]
  5. Applied egg-rr51.8%

    \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{{\left(\mathsf{fma}\left(b_2, b_2, c \cdot \left(-a\right)\right)\right)}^{0.25}}{1}, \frac{{\left(\mathsf{fma}\left(b_2, b_2, c \cdot \left(-a\right)\right)\right)}^{0.25}}{a}, -\frac{b_2}{a}\right)} \]
  6. Taylor expanded in b_2 around inf 6.5%

    \[\leadsto \color{blue}{\frac{b_2}{a} + -1 \cdot \frac{b_2}{a}} \]
  7. Step-by-step derivation
    1. distribute-rgt1-in6.5%

      \[\leadsto \color{blue}{\left(-1 + 1\right) \cdot \frac{b_2}{a}} \]
    2. metadata-eval6.5%

      \[\leadsto \color{blue}{0} \cdot \frac{b_2}{a} \]
    3. mul0-lft8.0%

      \[\leadsto \color{blue}{0} \]
  8. Simplified8.0%

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

    \[\leadsto 0 \]

Reproduce

?
herbie shell --seed 2023257 
(FPCore (a b_2 c)
  :name "quad2p (problem 3.2.1, positive)"
  :precision binary64
  (/ (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))