quad2p (problem 3.2.1, positive)

Percentage Accurate: 52.9% → 83.3%
Time: 14.2s
Alternatives: 11
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 11 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.9% 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: 83.3% accurate, 0.4× speedup?

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

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

\mathbf{elif}\;b_2 \leq 3.7 \cdot 10^{-70}:\\
\;\;\;\;{\left(\frac{a}{\mathsf{hypot}\left(b_2, \sqrt{c \cdot \left(-a\right)}\right) - b_2}\right)}^{-1}\\

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


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

    1. Initial program 71.1%

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

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

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

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

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

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

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

    if -3.3999999999999998e-41 < b_2 < 3.7e-70

    1. Initial program 78.9%

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

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

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

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

        \[\leadsto \color{blue}{\frac{1}{\frac{a}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}} \]
      2. inv-pow78.7%

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

        \[\leadsto {\left(\frac{a}{\sqrt{\color{blue}{b_2 \cdot b_2 + \left(-a \cdot c\right)}} - b_2}\right)}^{-1} \]
      4. add-sqr-sqrt78.7%

        \[\leadsto {\left(\frac{a}{\sqrt{b_2 \cdot b_2 + \color{blue}{\sqrt{-a \cdot c} \cdot \sqrt{-a \cdot c}}} - b_2}\right)}^{-1} \]
      5. hypot-def82.1%

        \[\leadsto {\left(\frac{a}{\color{blue}{\mathsf{hypot}\left(b_2, \sqrt{-a \cdot c}\right)} - b_2}\right)}^{-1} \]
      6. *-commutative82.1%

        \[\leadsto {\left(\frac{a}{\mathsf{hypot}\left(b_2, \sqrt{-\color{blue}{c \cdot a}}\right) - b_2}\right)}^{-1} \]
      7. distribute-rgt-neg-in82.1%

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

      \[\leadsto \color{blue}{{\left(\frac{a}{\mathsf{hypot}\left(b_2, \sqrt{c \cdot \left(-a\right)}\right) - b_2}\right)}^{-1}} \]

    if 3.7e-70 < b_2

    1. Initial program 12.5%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{-0.5 \cdot c}{b_2}} \]
    6. Applied egg-rr91.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \leq -3.4 \cdot 10^{-41}:\\ \;\;\;\;\frac{b_2 \cdot -2}{a}\\ \mathbf{elif}\;b_2 \leq 3.7 \cdot 10^{-70}:\\ \;\;\;\;{\left(\frac{a}{\mathsf{hypot}\left(b_2, \sqrt{c \cdot \left(-a\right)}\right) - b_2}\right)}^{-1}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot -0.5}{b_2}\\ \end{array} \]

Alternative 2: 83.3% accurate, 0.5× speedup?

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

\mathbf{elif}\;b_2 \leq 1.32 \cdot 10^{-70}:\\
\;\;\;\;\left(\mathsf{hypot}\left(b_2, \sqrt{c \cdot \left(-a\right)}\right) - b_2\right) \cdot \frac{1}{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 < -3.5e-41

    1. Initial program 71.1%

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

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

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

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

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

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

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

    if -3.5e-41 < b_2 < 1.3200000000000001e-70

    1. Initial program 78.9%

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

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

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

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

        \[\leadsto \color{blue}{\frac{1}{\frac{a}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}} \]
      2. associate-/r/78.7%

        \[\leadsto \color{blue}{\frac{1}{a} \cdot \left(\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2\right)} \]
      3. sub-neg78.7%

        \[\leadsto \frac{1}{a} \cdot \left(\sqrt{\color{blue}{b_2 \cdot b_2 + \left(-a \cdot c\right)}} - b_2\right) \]
      4. add-sqr-sqrt78.7%

        \[\leadsto \frac{1}{a} \cdot \left(\sqrt{b_2 \cdot b_2 + \color{blue}{\sqrt{-a \cdot c} \cdot \sqrt{-a \cdot c}}} - b_2\right) \]
      5. hypot-def82.1%

        \[\leadsto \frac{1}{a} \cdot \left(\color{blue}{\mathsf{hypot}\left(b_2, \sqrt{-a \cdot c}\right)} - b_2\right) \]
      6. *-commutative82.1%

        \[\leadsto \frac{1}{a} \cdot \left(\mathsf{hypot}\left(b_2, \sqrt{-\color{blue}{c \cdot a}}\right) - b_2\right) \]
      7. distribute-rgt-neg-in82.1%

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

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

    if 1.3200000000000001e-70 < b_2

    1. Initial program 12.5%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{-0.5 \cdot c}{b_2}} \]
    6. Applied egg-rr91.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \leq -3.5 \cdot 10^{-41}:\\ \;\;\;\;\frac{b_2 \cdot -2}{a}\\ \mathbf{elif}\;b_2 \leq 1.32 \cdot 10^{-70}:\\ \;\;\;\;\left(\mathsf{hypot}\left(b_2, \sqrt{c \cdot \left(-a\right)}\right) - b_2\right) \cdot \frac{1}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot -0.5}{b_2}\\ \end{array} \]

Alternative 3: 86.2% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b_2 \leq -1.25 \cdot 10^{+117}:\\ \;\;\;\;\frac{b_2 \cdot -2}{a}\\ \mathbf{elif}\;b_2 \leq 1.12 \cdot 10^{-74}:\\ \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(-c, a, b_2 \cdot b_2\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 -1.25e+117)
   (/ (* b_2 -2.0) a)
   (if (<= b_2 1.12e-74)
     (/ (- (sqrt (fma (- c) a (* b_2 b_2))) b_2) a)
     (/ (* c -0.5) b_2))))
double code(double a, double b_2, double c) {
	double tmp;
	if (b_2 <= -1.25e+117) {
		tmp = (b_2 * -2.0) / a;
	} else if (b_2 <= 1.12e-74) {
		tmp = (sqrt(fma(-c, a, (b_2 * b_2))) - b_2) / a;
	} else {
		tmp = (c * -0.5) / b_2;
	}
	return tmp;
}
function code(a, b_2, c)
	tmp = 0.0
	if (b_2 <= -1.25e+117)
		tmp = Float64(Float64(b_2 * -2.0) / a);
	elseif (b_2 <= 1.12e-74)
		tmp = Float64(Float64(sqrt(fma(Float64(-c), a, Float64(b_2 * b_2))) - b_2) / a);
	else
		tmp = Float64(Float64(c * -0.5) / b_2);
	end
	return tmp
end
code[a_, b$95$2_, c_] := If[LessEqual[b$95$2, -1.25e+117], N[(N[(b$95$2 * -2.0), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[b$95$2, 1.12e-74], N[(N[(N[Sqrt[N[((-c) * a + N[(b$95$2 * b$95$2), $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 -1.25 \cdot 10^{+117}:\\
\;\;\;\;\frac{b_2 \cdot -2}{a}\\

\mathbf{elif}\;b_2 \leq 1.12 \cdot 10^{-74}:\\
\;\;\;\;\frac{\sqrt{\mathsf{fma}\left(-c, a, b_2 \cdot b_2\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 < -1.24999999999999996e117

    1. Initial program 61.8%

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

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

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

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

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

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

    if -1.24999999999999996e117 < b_2 < 1.11999999999999999e-74

    1. Initial program 81.9%

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

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

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

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

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

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

        \[\leadsto \frac{\sqrt{\left(-\color{blue}{c \cdot a}\right) + b_2 \cdot b_2} - b_2}{a} \]
      4. distribute-lft-neg-in81.9%

        \[\leadsto \frac{\sqrt{\color{blue}{\left(-c\right) \cdot a} + b_2 \cdot b_2} - b_2}{a} \]
      5. fma-def81.9%

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

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

    if 1.11999999999999999e-74 < b_2

    1. Initial program 12.5%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{-0.5 \cdot c}{b_2}} \]
    6. Applied egg-rr91.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \leq -1.25 \cdot 10^{+117}:\\ \;\;\;\;\frac{b_2 \cdot -2}{a}\\ \mathbf{elif}\;b_2 \leq 1.12 \cdot 10^{-74}:\\ \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(-c, a, b_2 \cdot b_2\right)} - b_2}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot -0.5}{b_2}\\ \end{array} \]

Alternative 4: 86.2% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b_2 \leq -7.8 \cdot 10^{+113}:\\ \;\;\;\;\frac{b_2 \cdot -2}{a}\\ \mathbf{elif}\;b_2 \leq 1.65 \cdot 10^{-74}:\\ \;\;\;\;\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 -7.8e+113)
   (/ (* b_2 -2.0) a)
   (if (<= b_2 1.65e-74)
     (/ (- (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 <= -7.8e+113) {
		tmp = (b_2 * -2.0) / a;
	} else if (b_2 <= 1.65e-74) {
		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 <= (-7.8d+113)) then
        tmp = (b_2 * (-2.0d0)) / a
    else if (b_2 <= 1.65d-74) 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 <= -7.8e+113) {
		tmp = (b_2 * -2.0) / a;
	} else if (b_2 <= 1.65e-74) {
		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 <= -7.8e+113:
		tmp = (b_2 * -2.0) / a
	elif b_2 <= 1.65e-74:
		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 <= -7.8e+113)
		tmp = Float64(Float64(b_2 * -2.0) / a);
	elseif (b_2 <= 1.65e-74)
		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 <= -7.8e+113)
		tmp = (b_2 * -2.0) / a;
	elseif (b_2 <= 1.65e-74)
		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, -7.8e+113], N[(N[(b$95$2 * -2.0), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[b$95$2, 1.65e-74], 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 -7.8 \cdot 10^{+113}:\\
\;\;\;\;\frac{b_2 \cdot -2}{a}\\

\mathbf{elif}\;b_2 \leq 1.65 \cdot 10^{-74}:\\
\;\;\;\;\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 < -7.80000000000000039e113

    1. Initial program 61.8%

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

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

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

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

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

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

    if -7.80000000000000039e113 < b_2 < 1.64999999999999998e-74

    1. Initial program 81.9%

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

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

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

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

    if 1.64999999999999998e-74 < b_2

    1. Initial program 12.5%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{-0.5 \cdot c}{b_2}} \]
    6. Applied egg-rr91.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \leq -7.8 \cdot 10^{+113}:\\ \;\;\;\;\frac{b_2 \cdot -2}{a}\\ \mathbf{elif}\;b_2 \leq 1.65 \cdot 10^{-74}:\\ \;\;\;\;\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 5: 80.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b_2 \leq -8 \cdot 10^{-76}:\\ \;\;\;\;\frac{b_2 \cdot -2}{a}\\ \mathbf{elif}\;b_2 \leq 1.6 \cdot 10^{-75}:\\ \;\;\;\;\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 -8e-76)
   (/ (* b_2 -2.0) a)
   (if (<= b_2 1.6e-75) (/ (- (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 <= -8e-76) {
		tmp = (b_2 * -2.0) / a;
	} else if (b_2 <= 1.6e-75) {
		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 <= (-8d-76)) then
        tmp = (b_2 * (-2.0d0)) / a
    else if (b_2 <= 1.6d-75) 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 <= -8e-76) {
		tmp = (b_2 * -2.0) / a;
	} else if (b_2 <= 1.6e-75) {
		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 <= -8e-76:
		tmp = (b_2 * -2.0) / a
	elif b_2 <= 1.6e-75:
		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 <= -8e-76)
		tmp = Float64(Float64(b_2 * -2.0) / a);
	elseif (b_2 <= 1.6e-75)
		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 <= -8e-76)
		tmp = (b_2 * -2.0) / a;
	elseif (b_2 <= 1.6e-75)
		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, -8e-76], N[(N[(b$95$2 * -2.0), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[b$95$2, 1.6e-75], 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 -8 \cdot 10^{-76}:\\
\;\;\;\;\frac{b_2 \cdot -2}{a}\\

\mathbf{elif}\;b_2 \leq 1.6 \cdot 10^{-75}:\\
\;\;\;\;\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 < -7.99999999999999942e-76

    1. Initial program 73.1%

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

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

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

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

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

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

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

    if -7.99999999999999942e-76 < b_2 < 1.59999999999999988e-75

    1. Initial program 77.0%

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

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

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

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

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

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

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

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

    if 1.59999999999999988e-75 < b_2

    1. Initial program 12.5%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{-0.5 \cdot c}{b_2}} \]
    6. Applied egg-rr91.5%

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

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

Alternative 6: 67.9% 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 75.5%

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{-0.5 \cdot c}{b_2}} \]
    6. Applied egg-rr74.8%

      \[\leadsto \color{blue}{\frac{-0.5 \cdot c}{b_2}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification74.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 7: 47.8% accurate, 15.9× speedup?

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

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

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


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

    1. Initial program 75.5%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{-b_2}}{a} \]
    8. Simplified36.5%

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

    if 2.2999999999999999e-308 < b_2

    1. Initial program 26.4%

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

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

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

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

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

Alternative 8: 47.8% accurate, 15.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b_2 \leq -2 \cdot 10^{-310}:\\ \;\;\;\;\frac{-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 -2e-310) (/ (- b_2) a) (/ (* c -0.5) b_2)))
double code(double a, double b_2, double c) {
	double tmp;
	if (b_2 <= -2e-310) {
		tmp = -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 <= (-2d-310)) then
        tmp = -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 <= -2e-310) {
		tmp = -b_2 / a;
	} else {
		tmp = (c * -0.5) / b_2;
	}
	return tmp;
}
def code(a, b_2, c):
	tmp = 0
	if b_2 <= -2e-310:
		tmp = -b_2 / a
	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(-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 <= -2e-310)
		tmp = -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, -2e-310], N[((-b$95$2) / a), $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}:\\
\;\;\;\;\frac{-b_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 < -1.999999999999994e-310

    1. Initial program 75.5%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{-b_2}}{a} \]
    8. Simplified36.5%

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

    if -1.999999999999994e-310 < b_2

    1. Initial program 26.4%

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

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

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

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

        \[\leadsto \color{blue}{\frac{-0.5 \cdot c}{b_2}} \]
    6. Applied egg-rr74.8%

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

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

Alternative 9: 67.7% accurate, 15.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b_2 \leq -2 \cdot 10^{-310}:\\ \;\;\;\;\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 -2e-310) (/ (* b_2 -2.0) a) (/ (* c -0.5) b_2)))
double code(double a, double b_2, double c) {
	double tmp;
	if (b_2 <= -2e-310) {
		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 <= (-2d-310)) 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 <= -2e-310) {
		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 <= -2e-310:
		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 <= -2e-310)
		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 <= -2e-310)
		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, -2e-310], 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 -2 \cdot 10^{-310}:\\
\;\;\;\;\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 < -1.999999999999994e-310

    1. Initial program 75.5%

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

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

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

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

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

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

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

    if -1.999999999999994e-310 < b_2

    1. Initial program 26.4%

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

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

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

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

        \[\leadsto \color{blue}{\frac{-0.5 \cdot c}{b_2}} \]
    6. Applied egg-rr74.8%

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

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

Alternative 10: 23.9% 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 75.5%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{-b_2}}{a} \]
    8. Simplified36.5%

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

    if -1.999999999999994e-310 < b_2

    1. Initial program 26.4%

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

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

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

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

        \[\leadsto \color{blue}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c}}{a} - \frac{b_2}{a}} \]
      2. add-sqr-sqrt22.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-identity22.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-frac23.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-neg22.2%

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

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

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

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

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

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

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

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

Alternative 11: 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 50.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto 0 \]

Reproduce

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