quad2p (problem 3.2.1, positive)

Percentage Accurate: 52.1% → 85.4%
Time: 11.7s
Alternatives: 8
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 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.1% 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: 85.4% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b_2 \leq -3.6 \cdot 10^{+108}:\\ \;\;\;\;\frac{b_2 \cdot -2}{a}\\ \mathbf{elif}\;b_2 \leq 5.1 \cdot 10^{-54}:\\ \;\;\;\;\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{0.5 \cdot \frac{a}{b_2} + -2 \cdot \frac{b_2}{c}}\\ \end{array} \end{array} \]
(FPCore (a b_2 c)
 :precision binary64
 (if (<= b_2 -3.6e+108)
   (/ (* b_2 -2.0) a)
   (if (<= b_2 5.1e-54)
     (/ (- (sqrt (- (* b_2 b_2) (* a c))) b_2) a)
     (/ 1.0 (+ (* 0.5 (/ a b_2)) (* -2.0 (/ b_2 c)))))))
double code(double a, double b_2, double c) {
	double tmp;
	if (b_2 <= -3.6e+108) {
		tmp = (b_2 * -2.0) / a;
	} else if (b_2 <= 5.1e-54) {
		tmp = (sqrt(((b_2 * b_2) - (a * c))) - b_2) / a;
	} else {
		tmp = 1.0 / ((0.5 * (a / b_2)) + (-2.0 * (b_2 / c)));
	}
	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 <= (-3.6d+108)) then
        tmp = (b_2 * (-2.0d0)) / a
    else if (b_2 <= 5.1d-54) then
        tmp = (sqrt(((b_2 * b_2) - (a * c))) - b_2) / a
    else
        tmp = 1.0d0 / ((0.5d0 * (a / b_2)) + ((-2.0d0) * (b_2 / c)))
    end if
    code = tmp
end function
public static double code(double a, double b_2, double c) {
	double tmp;
	if (b_2 <= -3.6e+108) {
		tmp = (b_2 * -2.0) / a;
	} else if (b_2 <= 5.1e-54) {
		tmp = (Math.sqrt(((b_2 * b_2) - (a * c))) - b_2) / a;
	} else {
		tmp = 1.0 / ((0.5 * (a / b_2)) + (-2.0 * (b_2 / c)));
	}
	return tmp;
}
def code(a, b_2, c):
	tmp = 0
	if b_2 <= -3.6e+108:
		tmp = (b_2 * -2.0) / a
	elif b_2 <= 5.1e-54:
		tmp = (math.sqrt(((b_2 * b_2) - (a * c))) - b_2) / a
	else:
		tmp = 1.0 / ((0.5 * (a / b_2)) + (-2.0 * (b_2 / c)))
	return tmp
function code(a, b_2, c)
	tmp = 0.0
	if (b_2 <= -3.6e+108)
		tmp = Float64(Float64(b_2 * -2.0) / a);
	elseif (b_2 <= 5.1e-54)
		tmp = Float64(Float64(sqrt(Float64(Float64(b_2 * b_2) - Float64(a * c))) - b_2) / a);
	else
		tmp = Float64(1.0 / Float64(Float64(0.5 * Float64(a / b_2)) + Float64(-2.0 * Float64(b_2 / c))));
	end
	return tmp
end
function tmp_2 = code(a, b_2, c)
	tmp = 0.0;
	if (b_2 <= -3.6e+108)
		tmp = (b_2 * -2.0) / a;
	elseif (b_2 <= 5.1e-54)
		tmp = (sqrt(((b_2 * b_2) - (a * c))) - b_2) / a;
	else
		tmp = 1.0 / ((0.5 * (a / b_2)) + (-2.0 * (b_2 / c)));
	end
	tmp_2 = tmp;
end
code[a_, b$95$2_, c_] := If[LessEqual[b$95$2, -3.6e+108], N[(N[(b$95$2 * -2.0), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[b$95$2, 5.1e-54], 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[(1.0 / N[(N[(0.5 * N[(a / b$95$2), $MachinePrecision]), $MachinePrecision] + N[(-2.0 * N[(b$95$2 / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

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

\mathbf{else}:\\
\;\;\;\;\frac{1}{0.5 \cdot \frac{a}{b_2} + -2 \cdot \frac{b_2}{c}}\\


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

    1. Initial program 47.0%

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

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

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

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

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

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

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

    if -3.6e108 < b_2 < 5.1000000000000001e-54

    1. Initial program 84.0%

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

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

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

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

    if 5.1000000000000001e-54 < b_2

    1. Initial program 13.5%

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

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

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

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

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

        \[\leadsto \frac{\sqrt[3]{\color{blue}{{\left(\sqrt{b_2 \cdot b_2 - a \cdot c}\right)}^{3}}} - b_2}{a} \]
      3. pow1/36.5%

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

        \[\leadsto \frac{{\color{blue}{\left({\left(b_2 \cdot b_2 - a \cdot c\right)}^{\left(\frac{3}{2}\right)}\right)}}^{0.3333333333333333} - b_2}{a} \]
      5. fma-neg6.6%

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

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

        \[\leadsto \frac{{\left({\left(\mathsf{fma}\left(b_2, b_2, \color{blue}{c \cdot \left(-a\right)}\right)\right)}^{\left(\frac{3}{2}\right)}\right)}^{0.3333333333333333} - b_2}{a} \]
      8. metadata-eval6.6%

        \[\leadsto \frac{{\left({\left(\mathsf{fma}\left(b_2, b_2, c \cdot \left(-a\right)\right)\right)}^{\color{blue}{1.5}}\right)}^{0.3333333333333333} - b_2}{a} \]
    5. Applied egg-rr6.6%

      \[\leadsto \frac{\color{blue}{{\left({\left(\mathsf{fma}\left(b_2, b_2, c \cdot \left(-a\right)\right)\right)}^{1.5}\right)}^{0.3333333333333333}} - b_2}{a} \]
    6. Step-by-step derivation
      1. unpow1/37.4%

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

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

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

        \[\leadsto \frac{\sqrt[3]{{\color{blue}{\left(b_2 \cdot b_2 - a \cdot c\right)}}^{1.5}} - b_2}{a} \]
      5. *-commutative7.3%

        \[\leadsto \frac{\sqrt[3]{{\left(b_2 \cdot b_2 - \color{blue}{c \cdot a}\right)}^{1.5}} - b_2}{a} \]
    7. Simplified7.3%

      \[\leadsto \frac{\color{blue}{\sqrt[3]{{\left(b_2 \cdot b_2 - c \cdot a\right)}^{1.5}}} - b_2}{a} \]
    8. Step-by-step derivation
      1. clear-num7.3%

        \[\leadsto \color{blue}{\frac{1}{\frac{a}{\sqrt[3]{{\left(b_2 \cdot b_2 - c \cdot a\right)}^{1.5}} - b_2}}} \]
      2. inv-pow7.3%

        \[\leadsto \color{blue}{{\left(\frac{a}{\sqrt[3]{{\left(b_2 \cdot b_2 - c \cdot a\right)}^{1.5}} - b_2}\right)}^{-1}} \]
      3. pow1/36.5%

        \[\leadsto {\left(\frac{a}{\color{blue}{{\left({\left(b_2 \cdot b_2 - c \cdot a\right)}^{1.5}\right)}^{0.3333333333333333}} - b_2}\right)}^{-1} \]
      4. pow-pow13.4%

        \[\leadsto {\left(\frac{a}{\color{blue}{{\left(b_2 \cdot b_2 - c \cdot a\right)}^{\left(1.5 \cdot 0.3333333333333333\right)}} - b_2}\right)}^{-1} \]
      5. *-commutative13.4%

        \[\leadsto {\left(\frac{a}{{\left(b_2 \cdot b_2 - \color{blue}{a \cdot c}\right)}^{\left(1.5 \cdot 0.3333333333333333\right)} - b_2}\right)}^{-1} \]
      6. metadata-eval13.4%

        \[\leadsto {\left(\frac{a}{{\left(b_2 \cdot b_2 - a \cdot c\right)}^{\color{blue}{0.5}} - b_2}\right)}^{-1} \]
    9. Applied egg-rr13.4%

      \[\leadsto \color{blue}{{\left(\frac{a}{{\left(b_2 \cdot b_2 - a \cdot c\right)}^{0.5} - b_2}\right)}^{-1}} \]
    10. Step-by-step derivation
      1. unpow-113.4%

        \[\leadsto \color{blue}{\frac{1}{\frac{a}{{\left(b_2 \cdot b_2 - a \cdot c\right)}^{0.5} - b_2}}} \]
      2. unpow1/213.4%

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

        \[\leadsto \frac{1}{\frac{a}{\sqrt{b_2 \cdot b_2 - \color{blue}{c \cdot a}} - b_2}} \]
    11. Simplified13.4%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \leq -3.6 \cdot 10^{+108}:\\ \;\;\;\;\frac{b_2 \cdot -2}{a}\\ \mathbf{elif}\;b_2 \leq 5.1 \cdot 10^{-54}:\\ \;\;\;\;\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{0.5 \cdot \frac{a}{b_2} + -2 \cdot \frac{b_2}{c}}\\ \end{array} \]

Alternative 2: 81.0% accurate, 1.0× speedup?

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

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

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

\mathbf{else}:\\
\;\;\;\;\frac{1}{0.5 \cdot \frac{a}{b_2} + -2 \cdot \frac{b_2}{c}}\\


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

    1. Initial program 65.2%

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

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

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

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

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

    if -3.6e-51 < b_2 < 1.1e-55

    1. Initial program 79.6%

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

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

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

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

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

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

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

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

    if 1.1e-55 < b_2

    1. Initial program 13.5%

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

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

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

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

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

        \[\leadsto \frac{\sqrt[3]{\color{blue}{{\left(\sqrt{b_2 \cdot b_2 - a \cdot c}\right)}^{3}}} - b_2}{a} \]
      3. pow1/36.5%

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

        \[\leadsto \frac{{\color{blue}{\left({\left(b_2 \cdot b_2 - a \cdot c\right)}^{\left(\frac{3}{2}\right)}\right)}}^{0.3333333333333333} - b_2}{a} \]
      5. fma-neg6.6%

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

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

        \[\leadsto \frac{{\left({\left(\mathsf{fma}\left(b_2, b_2, \color{blue}{c \cdot \left(-a\right)}\right)\right)}^{\left(\frac{3}{2}\right)}\right)}^{0.3333333333333333} - b_2}{a} \]
      8. metadata-eval6.6%

        \[\leadsto \frac{{\left({\left(\mathsf{fma}\left(b_2, b_2, c \cdot \left(-a\right)\right)\right)}^{\color{blue}{1.5}}\right)}^{0.3333333333333333} - b_2}{a} \]
    5. Applied egg-rr6.6%

      \[\leadsto \frac{\color{blue}{{\left({\left(\mathsf{fma}\left(b_2, b_2, c \cdot \left(-a\right)\right)\right)}^{1.5}\right)}^{0.3333333333333333}} - b_2}{a} \]
    6. Step-by-step derivation
      1. unpow1/37.4%

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

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

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

        \[\leadsto \frac{\sqrt[3]{{\color{blue}{\left(b_2 \cdot b_2 - a \cdot c\right)}}^{1.5}} - b_2}{a} \]
      5. *-commutative7.3%

        \[\leadsto \frac{\sqrt[3]{{\left(b_2 \cdot b_2 - \color{blue}{c \cdot a}\right)}^{1.5}} - b_2}{a} \]
    7. Simplified7.3%

      \[\leadsto \frac{\color{blue}{\sqrt[3]{{\left(b_2 \cdot b_2 - c \cdot a\right)}^{1.5}}} - b_2}{a} \]
    8. Step-by-step derivation
      1. clear-num7.3%

        \[\leadsto \color{blue}{\frac{1}{\frac{a}{\sqrt[3]{{\left(b_2 \cdot b_2 - c \cdot a\right)}^{1.5}} - b_2}}} \]
      2. inv-pow7.3%

        \[\leadsto \color{blue}{{\left(\frac{a}{\sqrt[3]{{\left(b_2 \cdot b_2 - c \cdot a\right)}^{1.5}} - b_2}\right)}^{-1}} \]
      3. pow1/36.5%

        \[\leadsto {\left(\frac{a}{\color{blue}{{\left({\left(b_2 \cdot b_2 - c \cdot a\right)}^{1.5}\right)}^{0.3333333333333333}} - b_2}\right)}^{-1} \]
      4. pow-pow13.4%

        \[\leadsto {\left(\frac{a}{\color{blue}{{\left(b_2 \cdot b_2 - c \cdot a\right)}^{\left(1.5 \cdot 0.3333333333333333\right)}} - b_2}\right)}^{-1} \]
      5. *-commutative13.4%

        \[\leadsto {\left(\frac{a}{{\left(b_2 \cdot b_2 - \color{blue}{a \cdot c}\right)}^{\left(1.5 \cdot 0.3333333333333333\right)} - b_2}\right)}^{-1} \]
      6. metadata-eval13.4%

        \[\leadsto {\left(\frac{a}{{\left(b_2 \cdot b_2 - a \cdot c\right)}^{\color{blue}{0.5}} - b_2}\right)}^{-1} \]
    9. Applied egg-rr13.4%

      \[\leadsto \color{blue}{{\left(\frac{a}{{\left(b_2 \cdot b_2 - a \cdot c\right)}^{0.5} - b_2}\right)}^{-1}} \]
    10. Step-by-step derivation
      1. unpow-113.4%

        \[\leadsto \color{blue}{\frac{1}{\frac{a}{{\left(b_2 \cdot b_2 - a \cdot c\right)}^{0.5} - b_2}}} \]
      2. unpow1/213.4%

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

        \[\leadsto \frac{1}{\frac{a}{\sqrt{b_2 \cdot b_2 - \color{blue}{c \cdot a}} - b_2}} \]
    11. Simplified13.4%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \leq -3.6 \cdot 10^{-51}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a} + 0.5 \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \leq 1.1 \cdot 10^{-55}:\\ \;\;\;\;\frac{\sqrt{c \cdot \left(-a\right)} - b_2}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{0.5 \cdot \frac{a}{b_2} + -2 \cdot \frac{b_2}{c}}\\ \end{array} \]

Alternative 3: 80.6% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b_2 \leq -2.55 \cdot 10^{-61}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a} + 0.5 \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \leq 2.25 \cdot 10^{-57}:\\ \;\;\;\;\frac{\sqrt{c \cdot \left(-a\right)}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{0.5 \cdot \frac{a}{b_2} + -2 \cdot \frac{b_2}{c}}\\ \end{array} \end{array} \]
(FPCore (a b_2 c)
 :precision binary64
 (if (<= b_2 -2.55e-61)
   (+ (* -2.0 (/ b_2 a)) (* 0.5 (/ c b_2)))
   (if (<= b_2 2.25e-57)
     (/ (sqrt (* c (- a))) a)
     (/ 1.0 (+ (* 0.5 (/ a b_2)) (* -2.0 (/ b_2 c)))))))
double code(double a, double b_2, double c) {
	double tmp;
	if (b_2 <= -2.55e-61) {
		tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2));
	} else if (b_2 <= 2.25e-57) {
		tmp = sqrt((c * -a)) / a;
	} else {
		tmp = 1.0 / ((0.5 * (a / b_2)) + (-2.0 * (b_2 / c)));
	}
	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 <= (-2.55d-61)) then
        tmp = ((-2.0d0) * (b_2 / a)) + (0.5d0 * (c / b_2))
    else if (b_2 <= 2.25d-57) then
        tmp = sqrt((c * -a)) / a
    else
        tmp = 1.0d0 / ((0.5d0 * (a / b_2)) + ((-2.0d0) * (b_2 / c)))
    end if
    code = tmp
end function
public static double code(double a, double b_2, double c) {
	double tmp;
	if (b_2 <= -2.55e-61) {
		tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2));
	} else if (b_2 <= 2.25e-57) {
		tmp = Math.sqrt((c * -a)) / a;
	} else {
		tmp = 1.0 / ((0.5 * (a / b_2)) + (-2.0 * (b_2 / c)));
	}
	return tmp;
}
def code(a, b_2, c):
	tmp = 0
	if b_2 <= -2.55e-61:
		tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2))
	elif b_2 <= 2.25e-57:
		tmp = math.sqrt((c * -a)) / a
	else:
		tmp = 1.0 / ((0.5 * (a / b_2)) + (-2.0 * (b_2 / c)))
	return tmp
function code(a, b_2, c)
	tmp = 0.0
	if (b_2 <= -2.55e-61)
		tmp = Float64(Float64(-2.0 * Float64(b_2 / a)) + Float64(0.5 * Float64(c / b_2)));
	elseif (b_2 <= 2.25e-57)
		tmp = Float64(sqrt(Float64(c * Float64(-a))) / a);
	else
		tmp = Float64(1.0 / Float64(Float64(0.5 * Float64(a / b_2)) + Float64(-2.0 * Float64(b_2 / c))));
	end
	return tmp
end
function tmp_2 = code(a, b_2, c)
	tmp = 0.0;
	if (b_2 <= -2.55e-61)
		tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2));
	elseif (b_2 <= 2.25e-57)
		tmp = sqrt((c * -a)) / a;
	else
		tmp = 1.0 / ((0.5 * (a / b_2)) + (-2.0 * (b_2 / c)));
	end
	tmp_2 = tmp;
end
code[a_, b$95$2_, c_] := If[LessEqual[b$95$2, -2.55e-61], 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.25e-57], N[(N[Sqrt[N[(c * (-a)), $MachinePrecision]], $MachinePrecision] / a), $MachinePrecision], N[(1.0 / N[(N[(0.5 * N[(a / b$95$2), $MachinePrecision]), $MachinePrecision] + N[(-2.0 * N[(b$95$2 / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

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

\mathbf{else}:\\
\;\;\;\;\frac{1}{0.5 \cdot \frac{a}{b_2} + -2 \cdot \frac{b_2}{c}}\\


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

    1. Initial program 66.8%

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

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

        \[\leadsto \frac{\color{blue}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{a} \]
    3. Simplified66.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 86.4%

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

    if -2.54999999999999984e-61 < b_2 < 2.24999999999999986e-57

    1. Initial program 78.5%

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

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

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

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

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

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

        \[\leadsto \frac{\sqrt{\color{blue}{\left(b_2 \cdot b_2 + \left(-a \cdot c\right)\right)} + \mathsf{fma}\left(-c, a, c \cdot a\right)} - b_2}{a} \]
      4. associate-+l+78.1%

        \[\leadsto \frac{\sqrt{\color{blue}{b_2 \cdot b_2 + \left(\left(-a \cdot c\right) + \mathsf{fma}\left(-c, a, c \cdot a\right)\right)}} - b_2}{a} \]
      5. distribute-rgt-neg-in78.1%

        \[\leadsto \frac{\sqrt{b_2 \cdot b_2 + \left(\color{blue}{a \cdot \left(-c\right)} + \mathsf{fma}\left(-c, a, c \cdot a\right)\right)} - b_2}{a} \]
      6. fma-def78.0%

        \[\leadsto \frac{\sqrt{b_2 \cdot b_2 + \color{blue}{\mathsf{fma}\left(a, -c, \mathsf{fma}\left(-c, a, c \cdot a\right)\right)}} - b_2}{a} \]
      7. *-commutative78.0%

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

        \[\leadsto \frac{\sqrt{b_2 \cdot b_2 + \mathsf{fma}\left(a, -c, \color{blue}{\left(-c\right) \cdot a + a \cdot c}\right)} - b_2}{a} \]
      9. distribute-lft-neg-in78.1%

        \[\leadsto \frac{\sqrt{b_2 \cdot b_2 + \mathsf{fma}\left(a, -c, \color{blue}{\left(-c \cdot a\right)} + a \cdot c\right)} - b_2}{a} \]
      10. *-commutative78.1%

        \[\leadsto \frac{\sqrt{b_2 \cdot b_2 + \mathsf{fma}\left(a, -c, \left(-\color{blue}{a \cdot c}\right) + a \cdot c\right)} - b_2}{a} \]
      11. distribute-rgt-neg-in78.1%

        \[\leadsto \frac{\sqrt{b_2 \cdot b_2 + \mathsf{fma}\left(a, -c, \color{blue}{a \cdot \left(-c\right)} + a \cdot c\right)} - b_2}{a} \]
      12. fma-def78.0%

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

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

      \[\leadsto \color{blue}{\frac{1}{a} \cdot \sqrt{c \cdot a + -2 \cdot \left(c \cdot a\right)}} \]
    7. Step-by-step derivation
      1. associate-*l/74.1%

        \[\leadsto \color{blue}{\frac{1 \cdot \sqrt{c \cdot a + -2 \cdot \left(c \cdot a\right)}}{a}} \]
      2. distribute-rgt1-in74.5%

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

        \[\leadsto \frac{1 \cdot \sqrt{\color{blue}{-1} \cdot \left(c \cdot a\right)}}{a} \]
      4. mul-1-neg74.5%

        \[\leadsto \frac{1 \cdot \sqrt{\color{blue}{-c \cdot a}}}{a} \]
      5. distribute-rgt-neg-out74.5%

        \[\leadsto \frac{1 \cdot \sqrt{\color{blue}{c \cdot \left(-a\right)}}}{a} \]
      6. *-lft-identity74.5%

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

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

    if 2.24999999999999986e-57 < b_2

    1. Initial program 13.5%

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

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

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

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

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

        \[\leadsto \frac{\sqrt[3]{\color{blue}{{\left(\sqrt{b_2 \cdot b_2 - a \cdot c}\right)}^{3}}} - b_2}{a} \]
      3. pow1/36.5%

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

        \[\leadsto \frac{{\color{blue}{\left({\left(b_2 \cdot b_2 - a \cdot c\right)}^{\left(\frac{3}{2}\right)}\right)}}^{0.3333333333333333} - b_2}{a} \]
      5. fma-neg6.6%

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

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

        \[\leadsto \frac{{\left({\left(\mathsf{fma}\left(b_2, b_2, \color{blue}{c \cdot \left(-a\right)}\right)\right)}^{\left(\frac{3}{2}\right)}\right)}^{0.3333333333333333} - b_2}{a} \]
      8. metadata-eval6.6%

        \[\leadsto \frac{{\left({\left(\mathsf{fma}\left(b_2, b_2, c \cdot \left(-a\right)\right)\right)}^{\color{blue}{1.5}}\right)}^{0.3333333333333333} - b_2}{a} \]
    5. Applied egg-rr6.6%

      \[\leadsto \frac{\color{blue}{{\left({\left(\mathsf{fma}\left(b_2, b_2, c \cdot \left(-a\right)\right)\right)}^{1.5}\right)}^{0.3333333333333333}} - b_2}{a} \]
    6. Step-by-step derivation
      1. unpow1/37.4%

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

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

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

        \[\leadsto \frac{\sqrt[3]{{\color{blue}{\left(b_2 \cdot b_2 - a \cdot c\right)}}^{1.5}} - b_2}{a} \]
      5. *-commutative7.3%

        \[\leadsto \frac{\sqrt[3]{{\left(b_2 \cdot b_2 - \color{blue}{c \cdot a}\right)}^{1.5}} - b_2}{a} \]
    7. Simplified7.3%

      \[\leadsto \frac{\color{blue}{\sqrt[3]{{\left(b_2 \cdot b_2 - c \cdot a\right)}^{1.5}}} - b_2}{a} \]
    8. Step-by-step derivation
      1. clear-num7.3%

        \[\leadsto \color{blue}{\frac{1}{\frac{a}{\sqrt[3]{{\left(b_2 \cdot b_2 - c \cdot a\right)}^{1.5}} - b_2}}} \]
      2. inv-pow7.3%

        \[\leadsto \color{blue}{{\left(\frac{a}{\sqrt[3]{{\left(b_2 \cdot b_2 - c \cdot a\right)}^{1.5}} - b_2}\right)}^{-1}} \]
      3. pow1/36.5%

        \[\leadsto {\left(\frac{a}{\color{blue}{{\left({\left(b_2 \cdot b_2 - c \cdot a\right)}^{1.5}\right)}^{0.3333333333333333}} - b_2}\right)}^{-1} \]
      4. pow-pow13.4%

        \[\leadsto {\left(\frac{a}{\color{blue}{{\left(b_2 \cdot b_2 - c \cdot a\right)}^{\left(1.5 \cdot 0.3333333333333333\right)}} - b_2}\right)}^{-1} \]
      5. *-commutative13.4%

        \[\leadsto {\left(\frac{a}{{\left(b_2 \cdot b_2 - \color{blue}{a \cdot c}\right)}^{\left(1.5 \cdot 0.3333333333333333\right)} - b_2}\right)}^{-1} \]
      6. metadata-eval13.4%

        \[\leadsto {\left(\frac{a}{{\left(b_2 \cdot b_2 - a \cdot c\right)}^{\color{blue}{0.5}} - b_2}\right)}^{-1} \]
    9. Applied egg-rr13.4%

      \[\leadsto \color{blue}{{\left(\frac{a}{{\left(b_2 \cdot b_2 - a \cdot c\right)}^{0.5} - b_2}\right)}^{-1}} \]
    10. Step-by-step derivation
      1. unpow-113.4%

        \[\leadsto \color{blue}{\frac{1}{\frac{a}{{\left(b_2 \cdot b_2 - a \cdot c\right)}^{0.5} - b_2}}} \]
      2. unpow1/213.4%

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

        \[\leadsto \frac{1}{\frac{a}{\sqrt{b_2 \cdot b_2 - \color{blue}{c \cdot a}} - b_2}} \]
    11. Simplified13.4%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \leq -2.55 \cdot 10^{-61}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a} + 0.5 \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \leq 2.25 \cdot 10^{-57}:\\ \;\;\;\;\frac{\sqrt{c \cdot \left(-a\right)}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{0.5 \cdot \frac{a}{b_2} + -2 \cdot \frac{b_2}{c}}\\ \end{array} \]

Alternative 4: 67.4% accurate, 7.4× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\frac{1}{0.5 \cdot \frac{a}{b_2} + -2 \cdot \frac{b_2}{c}}\\


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

    1. Initial program 71.0%

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

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

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

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

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

    if -4.09999999999999999e-284 < b_2

    1. Initial program 31.5%

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

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

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

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

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

        \[\leadsto \frac{\sqrt[3]{\color{blue}{{\left(\sqrt{b_2 \cdot b_2 - a \cdot c}\right)}^{3}}} - b_2}{a} \]
      3. pow1/321.1%

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

        \[\leadsto \frac{{\color{blue}{\left({\left(b_2 \cdot b_2 - a \cdot c\right)}^{\left(\frac{3}{2}\right)}\right)}}^{0.3333333333333333} - b_2}{a} \]
      5. fma-neg21.1%

        \[\leadsto \frac{{\left({\color{blue}{\left(\mathsf{fma}\left(b_2, b_2, -a \cdot c\right)\right)}}^{\left(\frac{3}{2}\right)}\right)}^{0.3333333333333333} - b_2}{a} \]
      6. *-commutative21.1%

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

        \[\leadsto \frac{{\left({\left(\mathsf{fma}\left(b_2, b_2, \color{blue}{c \cdot \left(-a\right)}\right)\right)}^{\left(\frac{3}{2}\right)}\right)}^{0.3333333333333333} - b_2}{a} \]
      8. metadata-eval21.1%

        \[\leadsto \frac{{\left({\left(\mathsf{fma}\left(b_2, b_2, c \cdot \left(-a\right)\right)\right)}^{\color{blue}{1.5}}\right)}^{0.3333333333333333} - b_2}{a} \]
    5. Applied egg-rr21.1%

      \[\leadsto \frac{\color{blue}{{\left({\left(\mathsf{fma}\left(b_2, b_2, c \cdot \left(-a\right)\right)\right)}^{1.5}\right)}^{0.3333333333333333}} - b_2}{a} \]
    6. Step-by-step derivation
      1. unpow1/323.0%

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

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

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

        \[\leadsto \frac{\sqrt[3]{{\color{blue}{\left(b_2 \cdot b_2 - a \cdot c\right)}}^{1.5}} - b_2}{a} \]
      5. *-commutative22.9%

        \[\leadsto \frac{\sqrt[3]{{\left(b_2 \cdot b_2 - \color{blue}{c \cdot a}\right)}^{1.5}} - b_2}{a} \]
    7. Simplified22.9%

      \[\leadsto \frac{\color{blue}{\sqrt[3]{{\left(b_2 \cdot b_2 - c \cdot a\right)}^{1.5}}} - b_2}{a} \]
    8. Step-by-step derivation
      1. clear-num22.9%

        \[\leadsto \color{blue}{\frac{1}{\frac{a}{\sqrt[3]{{\left(b_2 \cdot b_2 - c \cdot a\right)}^{1.5}} - b_2}}} \]
      2. inv-pow22.9%

        \[\leadsto \color{blue}{{\left(\frac{a}{\sqrt[3]{{\left(b_2 \cdot b_2 - c \cdot a\right)}^{1.5}} - b_2}\right)}^{-1}} \]
      3. pow1/321.1%

        \[\leadsto {\left(\frac{a}{\color{blue}{{\left({\left(b_2 \cdot b_2 - c \cdot a\right)}^{1.5}\right)}^{0.3333333333333333}} - b_2}\right)}^{-1} \]
      4. pow-pow31.4%

        \[\leadsto {\left(\frac{a}{\color{blue}{{\left(b_2 \cdot b_2 - c \cdot a\right)}^{\left(1.5 \cdot 0.3333333333333333\right)}} - b_2}\right)}^{-1} \]
      5. *-commutative31.4%

        \[\leadsto {\left(\frac{a}{{\left(b_2 \cdot b_2 - \color{blue}{a \cdot c}\right)}^{\left(1.5 \cdot 0.3333333333333333\right)} - b_2}\right)}^{-1} \]
      6. metadata-eval31.4%

        \[\leadsto {\left(\frac{a}{{\left(b_2 \cdot b_2 - a \cdot c\right)}^{\color{blue}{0.5}} - b_2}\right)}^{-1} \]
    9. Applied egg-rr31.4%

      \[\leadsto \color{blue}{{\left(\frac{a}{{\left(b_2 \cdot b_2 - a \cdot c\right)}^{0.5} - b_2}\right)}^{-1}} \]
    10. Step-by-step derivation
      1. unpow-131.4%

        \[\leadsto \color{blue}{\frac{1}{\frac{a}{{\left(b_2 \cdot b_2 - a \cdot c\right)}^{0.5} - b_2}}} \]
      2. unpow1/231.4%

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

        \[\leadsto \frac{1}{\frac{a}{\sqrt{b_2 \cdot b_2 - \color{blue}{c \cdot a}} - b_2}} \]
    11. Simplified31.4%

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

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

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

Alternative 5: 67.6% accurate, 8.6× speedup?

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

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

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


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

    1. Initial program 71.6%

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

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

        \[\leadsto \frac{\color{blue}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{a} \]
    3. Simplified71.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 64.3%

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

    if -1.000000000000002e-309 < b_2

    1. Initial program 29.8%

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

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

        \[\leadsto \frac{\color{blue}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{a} \]
    3. Simplified29.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 64.7%

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

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

Alternative 6: 47.9% accurate, 15.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b_2 \leq -1 \cdot 10^{-309}:\\ \;\;\;\;\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 -1e-309) (/ (- b_2) a) (* (/ c b_2) -0.5)))
double code(double a, double b_2, double c) {
	double tmp;
	if (b_2 <= -1e-309) {
		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 <= (-1d-309)) 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 <= -1e-309) {
		tmp = -b_2 / a;
	} else {
		tmp = (c / b_2) * -0.5;
	}
	return tmp;
}
def code(a, b_2, c):
	tmp = 0
	if b_2 <= -1e-309:
		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 <= -1e-309)
		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 <= -1e-309)
		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, -1e-309], 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 -1 \cdot 10^{-309}:\\
\;\;\;\;\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 < -1.000000000000002e-309

    1. Initial program 71.6%

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

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

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

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

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

        \[\leadsto \frac{\sqrt[3]{\color{blue}{{\left(\sqrt{b_2 \cdot b_2 - a \cdot c}\right)}^{3}}} - b_2}{a} \]
      3. pow1/357.9%

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

        \[\leadsto \frac{{\color{blue}{\left({\left(b_2 \cdot b_2 - a \cdot c\right)}^{\left(\frac{3}{2}\right)}\right)}}^{0.3333333333333333} - b_2}{a} \]
      5. fma-neg57.9%

        \[\leadsto \frac{{\left({\color{blue}{\left(\mathsf{fma}\left(b_2, b_2, -a \cdot c\right)\right)}}^{\left(\frac{3}{2}\right)}\right)}^{0.3333333333333333} - b_2}{a} \]
      6. *-commutative57.9%

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

        \[\leadsto \frac{{\left({\left(\mathsf{fma}\left(b_2, b_2, \color{blue}{c \cdot \left(-a\right)}\right)\right)}^{\left(\frac{3}{2}\right)}\right)}^{0.3333333333333333} - b_2}{a} \]
      8. metadata-eval57.9%

        \[\leadsto \frac{{\left({\left(\mathsf{fma}\left(b_2, b_2, c \cdot \left(-a\right)\right)\right)}^{\color{blue}{1.5}}\right)}^{0.3333333333333333} - b_2}{a} \]
    5. Applied egg-rr57.9%

      \[\leadsto \frac{\color{blue}{{\left({\left(\mathsf{fma}\left(b_2, b_2, c \cdot \left(-a\right)\right)\right)}^{1.5}\right)}^{0.3333333333333333}} - b_2}{a} \]
    6. Step-by-step derivation
      1. unpow1/360.5%

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

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

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

        \[\leadsto \frac{\sqrt[3]{{\color{blue}{\left(b_2 \cdot b_2 - a \cdot c\right)}}^{1.5}} - b_2}{a} \]
      5. *-commutative60.4%

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

      \[\leadsto \frac{\color{blue}{\sqrt[3]{{\left(b_2 \cdot b_2 - c \cdot a\right)}^{1.5}}} - b_2}{a} \]
    8. Taylor expanded in b_2 around 0 36.2%

      \[\leadsto \frac{\sqrt[3]{{\color{blue}{\left(-1 \cdot \left(c \cdot a\right)\right)}}^{1.5}} - b_2}{a} \]
    9. Step-by-step derivation
      1. mul-1-neg36.2%

        \[\leadsto \frac{\sqrt[3]{{\color{blue}{\left(-c \cdot a\right)}}^{1.5}} - b_2}{a} \]
      2. distribute-rgt-neg-in36.2%

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

      \[\leadsto \frac{\sqrt[3]{{\color{blue}{\left(c \cdot \left(-a\right)\right)}}^{1.5}} - b_2}{a} \]
    11. Taylor expanded in c around 0 27.0%

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

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

        \[\leadsto \frac{\color{blue}{-b_2}}{a} \]
    13. Simplified27.0%

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

    if -1.000000000000002e-309 < b_2

    1. Initial program 29.8%

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

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

        \[\leadsto \frac{\color{blue}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{a} \]
    3. Simplified29.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 64.7%

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

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

Alternative 7: 67.4% accurate, 15.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b_2 \leq -1 \cdot 10^{-309}:\\ \;\;\;\;\frac{b_2 \cdot -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 -1e-309) (/ (* b_2 -2.0) a) (* (/ c b_2) -0.5)))
double code(double a, double b_2, double c) {
	double tmp;
	if (b_2 <= -1e-309) {
		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 <= (-1d-309)) 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 <= -1e-309) {
		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 <= -1e-309:
		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 <= -1e-309)
		tmp = Float64(Float64(b_2 * -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 <= -1e-309)
		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, -1e-309], N[(N[(b$95$2 * -2.0), $MachinePrecision] / a), $MachinePrecision], N[(N[(c / b$95$2), $MachinePrecision] * -0.5), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b_2 \leq -1 \cdot 10^{-309}:\\
\;\;\;\;\frac{b_2 \cdot -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 < -1.000000000000002e-309

    1. Initial program 71.6%

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

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

        \[\leadsto \frac{\color{blue}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{a} \]
    3. Simplified71.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 64.0%

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

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

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

    if -1.000000000000002e-309 < b_2

    1. Initial program 29.8%

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

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

        \[\leadsto \frac{\color{blue}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{a} \]
    3. Simplified29.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 64.7%

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

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

Alternative 8: 15.4% accurate, 28.0× speedup?

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

\\
\frac{-b_2}{a}
\end{array}
Derivation
  1. Initial program 51.7%

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

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

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

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

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

      \[\leadsto \frac{\sqrt[3]{\color{blue}{{\left(\sqrt{b_2 \cdot b_2 - a \cdot c}\right)}^{3}}} - b_2}{a} \]
    3. pow1/339.8%

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

      \[\leadsto \frac{{\color{blue}{\left({\left(b_2 \cdot b_2 - a \cdot c\right)}^{\left(\frac{3}{2}\right)}\right)}}^{0.3333333333333333} - b_2}{a} \]
    5. fma-neg39.8%

      \[\leadsto \frac{{\left({\color{blue}{\left(\mathsf{fma}\left(b_2, b_2, -a \cdot c\right)\right)}}^{\left(\frac{3}{2}\right)}\right)}^{0.3333333333333333} - b_2}{a} \]
    6. *-commutative39.8%

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

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

      \[\leadsto \frac{{\left({\left(\mathsf{fma}\left(b_2, b_2, c \cdot \left(-a\right)\right)\right)}^{\color{blue}{1.5}}\right)}^{0.3333333333333333} - b_2}{a} \]
  5. Applied egg-rr39.8%

    \[\leadsto \frac{\color{blue}{{\left({\left(\mathsf{fma}\left(b_2, b_2, c \cdot \left(-a\right)\right)\right)}^{1.5}\right)}^{0.3333333333333333}} - b_2}{a} \]
  6. Step-by-step derivation
    1. unpow1/342.0%

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

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

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

      \[\leadsto \frac{\sqrt[3]{{\color{blue}{\left(b_2 \cdot b_2 - a \cdot c\right)}}^{1.5}} - b_2}{a} \]
    5. *-commutative41.9%

      \[\leadsto \frac{\sqrt[3]{{\left(b_2 \cdot b_2 - \color{blue}{c \cdot a}\right)}^{1.5}} - b_2}{a} \]
  7. Simplified41.9%

    \[\leadsto \frac{\color{blue}{\sqrt[3]{{\left(b_2 \cdot b_2 - c \cdot a\right)}^{1.5}}} - b_2}{a} \]
  8. Taylor expanded in b_2 around 0 27.9%

    \[\leadsto \frac{\sqrt[3]{{\color{blue}{\left(-1 \cdot \left(c \cdot a\right)\right)}}^{1.5}} - b_2}{a} \]
  9. Step-by-step derivation
    1. mul-1-neg27.9%

      \[\leadsto \frac{\sqrt[3]{{\color{blue}{\left(-c \cdot a\right)}}^{1.5}} - b_2}{a} \]
    2. distribute-rgt-neg-in27.9%

      \[\leadsto \frac{\sqrt[3]{{\color{blue}{\left(c \cdot \left(-a\right)\right)}}^{1.5}} - b_2}{a} \]
  10. Simplified27.9%

    \[\leadsto \frac{\sqrt[3]{{\color{blue}{\left(c \cdot \left(-a\right)\right)}}^{1.5}} - b_2}{a} \]
  11. Taylor expanded in c around 0 15.4%

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

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

      \[\leadsto \frac{\color{blue}{-b_2}}{a} \]
  13. Simplified15.4%

    \[\leadsto \color{blue}{\frac{-b_2}{a}} \]
  14. Final simplification15.4%

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

Reproduce

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