quad2m (problem 3.2.1, negative)

Percentage Accurate: 52.9% → 86.7%
Time: 10.8s
Alternatives: 10
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 10 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: 86.7% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{b_2 \cdot b_2 - c \cdot a}\\ \mathbf{if}\;b_2 \leq -3.8 \cdot 10^{+114}:\\ \;\;\;\;\frac{-0.5 \cdot c}{b_2}\\ \mathbf{elif}\;b_2 \leq -1.7 \cdot 10^{-130}:\\ \;\;\;\;\frac{\frac{c \cdot a}{\mathsf{fma}\left(-1, b_2, t_0\right)}}{a}\\ \mathbf{elif}\;b_2 \leq 1.2 \cdot 10^{+77}:\\ \;\;\;\;\frac{-b_2}{a} - \frac{t_0}{a}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a} + 0.5 \cdot \frac{c}{b_2}\\ \end{array} \end{array} \]
(FPCore (a b_2 c)
 :precision binary64
 (let* ((t_0 (sqrt (- (* b_2 b_2) (* c a)))))
   (if (<= b_2 -3.8e+114)
     (/ (* -0.5 c) b_2)
     (if (<= b_2 -1.7e-130)
       (/ (/ (* c a) (fma -1.0 b_2 t_0)) a)
       (if (<= b_2 1.2e+77)
         (- (/ (- b_2) a) (/ t_0 a))
         (+ (* -2.0 (/ b_2 a)) (* 0.5 (/ c b_2))))))))
double code(double a, double b_2, double c) {
	double t_0 = sqrt(((b_2 * b_2) - (c * a)));
	double tmp;
	if (b_2 <= -3.8e+114) {
		tmp = (-0.5 * c) / b_2;
	} else if (b_2 <= -1.7e-130) {
		tmp = ((c * a) / fma(-1.0, b_2, t_0)) / a;
	} else if (b_2 <= 1.2e+77) {
		tmp = (-b_2 / a) - (t_0 / a);
	} else {
		tmp = (-2.0 * (b_2 / a)) + (0.5 * (c / b_2));
	}
	return tmp;
}
function code(a, b_2, c)
	t_0 = sqrt(Float64(Float64(b_2 * b_2) - Float64(c * a)))
	tmp = 0.0
	if (b_2 <= -3.8e+114)
		tmp = Float64(Float64(-0.5 * c) / b_2);
	elseif (b_2 <= -1.7e-130)
		tmp = Float64(Float64(Float64(c * a) / fma(-1.0, b_2, t_0)) / a);
	elseif (b_2 <= 1.2e+77)
		tmp = Float64(Float64(Float64(-b_2) / a) - Float64(t_0 / a));
	else
		tmp = Float64(Float64(-2.0 * Float64(b_2 / a)) + Float64(0.5 * Float64(c / b_2)));
	end
	return tmp
end
code[a_, b$95$2_, c_] := Block[{t$95$0 = N[Sqrt[N[(N[(b$95$2 * b$95$2), $MachinePrecision] - N[(c * a), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[b$95$2, -3.8e+114], N[(N[(-0.5 * c), $MachinePrecision] / b$95$2), $MachinePrecision], If[LessEqual[b$95$2, -1.7e-130], N[(N[(N[(c * a), $MachinePrecision] / N[(-1.0 * b$95$2 + t$95$0), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[b$95$2, 1.2e+77], N[(N[((-b$95$2) / a), $MachinePrecision] - N[(t$95$0 / a), $MachinePrecision]), $MachinePrecision], N[(N[(-2.0 * N[(b$95$2 / a), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(c / b$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sqrt{b_2 \cdot b_2 - c \cdot a}\\
\mathbf{if}\;b_2 \leq -3.8 \cdot 10^{+114}:\\
\;\;\;\;\frac{-0.5 \cdot c}{b_2}\\

\mathbf{elif}\;b_2 \leq -1.7 \cdot 10^{-130}:\\
\;\;\;\;\frac{\frac{c \cdot a}{\mathsf{fma}\left(-1, b_2, t_0\right)}}{a}\\

\mathbf{elif}\;b_2 \leq 1.2 \cdot 10^{+77}:\\
\;\;\;\;\frac{-b_2}{a} - \frac{t_0}{a}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if b_2 < -3.8000000000000001e114

    1. Initial program 4.0%

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a} \]
    2. Taylor expanded in b_2 around -inf 98.1%

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

        \[\leadsto \color{blue}{\frac{-0.5 \cdot c}{b_2}} \]
    4. Simplified98.1%

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

    if -3.8000000000000001e114 < b_2 < -1.70000000000000003e-130

    1. Initial program 40.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{{\left(-b_2\right)}^{2} - \color{blue}{\left({b_2}^{2} - c \cdot a\right)}}{\mathsf{fma}\left(-1, b_2, \sqrt{\mathsf{fma}\left(-c, a, b_2 \cdot b_2\right)}\right)}}{a} \]
      8. associate--r-82.2%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{0 + c \cdot a}{\mathsf{fma}\left(-1, b_2, \sqrt{{b_2}^{2} + \color{blue}{\left(-c \cdot a\right)}}\right)}}{a} \]
      19. sub-neg82.2%

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

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

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

    if -1.70000000000000003e-130 < b_2 < 1.1999999999999999e77

    1. Initial program 83.9%

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

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

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

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

        \[\leadsto \frac{\left(-b_2\right) - {\color{blue}{\left({\left(b_2 \cdot b_2 - a \cdot c\right)}^{\left(\frac{0.5}{2}\right)}\right)}}^{2}}{a} \]
      5. metadata-eval83.6%

        \[\leadsto \frac{\left(-b_2\right) - {\left({\left(b_2 \cdot b_2 - a \cdot c\right)}^{\color{blue}{0.25}}\right)}^{2}}{a} \]
    3. Applied egg-rr83.6%

      \[\leadsto \frac{\left(-b_2\right) - \color{blue}{{\left({\left(b_2 \cdot b_2 - a \cdot c\right)}^{0.25}\right)}^{2}}}{a} \]
    4. Step-by-step derivation
      1. div-sub83.6%

        \[\leadsto \color{blue}{\frac{-b_2}{a} - \frac{{\left({\left(b_2 \cdot b_2 - a \cdot c\right)}^{0.25}\right)}^{2}}{a}} \]
      2. pow-pow83.9%

        \[\leadsto \frac{-b_2}{a} - \frac{\color{blue}{{\left(b_2 \cdot b_2 - a \cdot c\right)}^{\left(0.25 \cdot 2\right)}}}{a} \]
      3. metadata-eval83.9%

        \[\leadsto \frac{-b_2}{a} - \frac{{\left(b_2 \cdot b_2 - a \cdot c\right)}^{\color{blue}{0.5}}}{a} \]
      4. pow1/283.9%

        \[\leadsto \frac{-b_2}{a} - \frac{\color{blue}{\sqrt{b_2 \cdot b_2 - a \cdot c}}}{a} \]
      5. cancel-sign-sub-inv83.9%

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

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

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

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

      \[\leadsto \color{blue}{\frac{-b_2}{a} - \frac{\mathsf{hypot}\left(b_2, \sqrt{c \cdot \left(-a\right)}\right)}{a}} \]
    6. Step-by-step derivation
      1. hypot-udef73.8%

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

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

        \[\leadsto \frac{-b_2}{a} - \frac{\sqrt{b_2 \cdot b_2 + \color{blue}{\left(-a\right) \cdot c}}}{a} \]
      4. cancel-sign-sub-inv83.9%

        \[\leadsto \frac{-b_2}{a} - \frac{\sqrt{\color{blue}{b_2 \cdot b_2 - a \cdot c}}}{a} \]
      5. pow1/283.9%

        \[\leadsto \frac{-b_2}{a} - \frac{\color{blue}{{\left(b_2 \cdot b_2 - a \cdot c\right)}^{0.5}}}{a} \]
      6. *-commutative83.9%

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

      \[\leadsto \frac{-b_2}{a} - \frac{\color{blue}{{\left(b_2 \cdot b_2 - c \cdot a\right)}^{0.5}}}{a} \]
    8. Step-by-step derivation
      1. sqr-pow83.6%

        \[\leadsto \frac{-b_2}{a} - \frac{\color{blue}{{\left(b_2 \cdot b_2 - c \cdot a\right)}^{\left(\frac{0.5}{2}\right)} \cdot {\left(b_2 \cdot b_2 - c \cdot a\right)}^{\left(\frac{0.5}{2}\right)}}}{a} \]
      2. metadata-eval83.6%

        \[\leadsto \frac{-b_2}{a} - \frac{{\left(b_2 \cdot b_2 - c \cdot a\right)}^{\color{blue}{0.25}} \cdot {\left(b_2 \cdot b_2 - c \cdot a\right)}^{\left(\frac{0.5}{2}\right)}}{a} \]
      3. metadata-eval83.6%

        \[\leadsto \frac{-b_2}{a} - \frac{{\left(b_2 \cdot b_2 - c \cdot a\right)}^{0.25} \cdot {\left(b_2 \cdot b_2 - c \cdot a\right)}^{\color{blue}{0.25}}}{a} \]
    9. Applied egg-rr83.6%

      \[\leadsto \frac{-b_2}{a} - \frac{\color{blue}{{\left(b_2 \cdot b_2 - c \cdot a\right)}^{0.25} \cdot {\left(b_2 \cdot b_2 - c \cdot a\right)}^{0.25}}}{a} \]
    10. Step-by-step derivation
      1. pow-sqr83.9%

        \[\leadsto \frac{-b_2}{a} - \frac{\color{blue}{{\left(b_2 \cdot b_2 - c \cdot a\right)}^{\left(2 \cdot 0.25\right)}}}{a} \]
      2. metadata-eval83.9%

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

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

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

    if 1.1999999999999999e77 < b_2

    1. Initial program 58.0%

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a} \]
    2. Taylor expanded in b_2 around inf 95.7%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \leq -3.8 \cdot 10^{+114}:\\ \;\;\;\;\frac{-0.5 \cdot c}{b_2}\\ \mathbf{elif}\;b_2 \leq -1.7 \cdot 10^{-130}:\\ \;\;\;\;\frac{\frac{c \cdot a}{\mathsf{fma}\left(-1, b_2, \sqrt{b_2 \cdot b_2 - c \cdot a}\right)}}{a}\\ \mathbf{elif}\;b_2 \leq 1.2 \cdot 10^{+77}:\\ \;\;\;\;\frac{-b_2}{a} - \frac{\sqrt{b_2 \cdot b_2 - c \cdot a}}{a}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a} + 0.5 \cdot \frac{c}{b_2}\\ \end{array} \]

Alternative 2: 84.8% accurate, 0.9× speedup?

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

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

\mathbf{elif}\;b_2 \leq 1.3 \cdot 10^{+77}:\\
\;\;\;\;\frac{-b_2}{a} - \frac{\sqrt{b_2 \cdot b_2 - c \cdot a}}{a}\\

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


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

    1. Initial program 19.9%

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

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

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

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

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

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

      \[\leadsto \frac{\left(-b_2\right) - \sqrt{\color{blue}{\mathsf{fma}\left(-c, a, b_2 \cdot b_2\right)}}}{a} \]
    4. Step-by-step derivation
      1. clear-num19.9%

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

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

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

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

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

        \[\leadsto \frac{1}{\frac{a}{\left(-b_2\right) - \sqrt{\color{blue}{\left(-c\right) \cdot a + {b_2}^{2}}}}} \]
      4. distribute-lft-neg-out19.8%

        \[\leadsto \frac{1}{\frac{a}{\left(-b_2\right) - \sqrt{\color{blue}{\left(-c \cdot a\right)} + {b_2}^{2}}}} \]
      5. distribute-rgt-neg-out19.8%

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

        \[\leadsto \frac{1}{\frac{a}{\left(-b_2\right) - \sqrt{\color{blue}{{b_2}^{2} + c \cdot \left(-a\right)}}}} \]
      7. distribute-rgt-neg-out19.8%

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

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

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

      \[\leadsto \color{blue}{\frac{1}{\frac{a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - c \cdot a}}}} \]
    8. Taylor expanded in b_2 around -inf 88.0%

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

    if -1e-51 < b_2 < 1.3000000000000001e77

    1. Initial program 80.9%

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

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

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

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

        \[\leadsto \frac{\left(-b_2\right) - {\color{blue}{\left({\left(b_2 \cdot b_2 - a \cdot c\right)}^{\left(\frac{0.5}{2}\right)}\right)}}^{2}}{a} \]
      5. metadata-eval80.6%

        \[\leadsto \frac{\left(-b_2\right) - {\left({\left(b_2 \cdot b_2 - a \cdot c\right)}^{\color{blue}{0.25}}\right)}^{2}}{a} \]
    3. Applied egg-rr80.6%

      \[\leadsto \frac{\left(-b_2\right) - \color{blue}{{\left({\left(b_2 \cdot b_2 - a \cdot c\right)}^{0.25}\right)}^{2}}}{a} \]
    4. Step-by-step derivation
      1. div-sub80.6%

        \[\leadsto \color{blue}{\frac{-b_2}{a} - \frac{{\left({\left(b_2 \cdot b_2 - a \cdot c\right)}^{0.25}\right)}^{2}}{a}} \]
      2. pow-pow81.0%

        \[\leadsto \frac{-b_2}{a} - \frac{\color{blue}{{\left(b_2 \cdot b_2 - a \cdot c\right)}^{\left(0.25 \cdot 2\right)}}}{a} \]
      3. metadata-eval81.0%

        \[\leadsto \frac{-b_2}{a} - \frac{{\left(b_2 \cdot b_2 - a \cdot c\right)}^{\color{blue}{0.5}}}{a} \]
      4. pow1/281.0%

        \[\leadsto \frac{-b_2}{a} - \frac{\color{blue}{\sqrt{b_2 \cdot b_2 - a \cdot c}}}{a} \]
      5. cancel-sign-sub-inv81.0%

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

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

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

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

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

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

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

        \[\leadsto \frac{-b_2}{a} - \frac{\sqrt{b_2 \cdot b_2 + \color{blue}{\left(-a\right) \cdot c}}}{a} \]
      4. cancel-sign-sub-inv81.0%

        \[\leadsto \frac{-b_2}{a} - \frac{\sqrt{\color{blue}{b_2 \cdot b_2 - a \cdot c}}}{a} \]
      5. pow1/281.0%

        \[\leadsto \frac{-b_2}{a} - \frac{\color{blue}{{\left(b_2 \cdot b_2 - a \cdot c\right)}^{0.5}}}{a} \]
      6. *-commutative81.0%

        \[\leadsto \frac{-b_2}{a} - \frac{{\left(b_2 \cdot b_2 - \color{blue}{c \cdot a}\right)}^{0.5}}{a} \]
    7. Applied egg-rr81.0%

      \[\leadsto \frac{-b_2}{a} - \frac{\color{blue}{{\left(b_2 \cdot b_2 - c \cdot a\right)}^{0.5}}}{a} \]
    8. Step-by-step derivation
      1. sqr-pow80.6%

        \[\leadsto \frac{-b_2}{a} - \frac{\color{blue}{{\left(b_2 \cdot b_2 - c \cdot a\right)}^{\left(\frac{0.5}{2}\right)} \cdot {\left(b_2 \cdot b_2 - c \cdot a\right)}^{\left(\frac{0.5}{2}\right)}}}{a} \]
      2. metadata-eval80.6%

        \[\leadsto \frac{-b_2}{a} - \frac{{\left(b_2 \cdot b_2 - c \cdot a\right)}^{\color{blue}{0.25}} \cdot {\left(b_2 \cdot b_2 - c \cdot a\right)}^{\left(\frac{0.5}{2}\right)}}{a} \]
      3. metadata-eval80.6%

        \[\leadsto \frac{-b_2}{a} - \frac{{\left(b_2 \cdot b_2 - c \cdot a\right)}^{0.25} \cdot {\left(b_2 \cdot b_2 - c \cdot a\right)}^{\color{blue}{0.25}}}{a} \]
    9. Applied egg-rr80.6%

      \[\leadsto \frac{-b_2}{a} - \frac{\color{blue}{{\left(b_2 \cdot b_2 - c \cdot a\right)}^{0.25} \cdot {\left(b_2 \cdot b_2 - c \cdot a\right)}^{0.25}}}{a} \]
    10. Step-by-step derivation
      1. pow-sqr81.0%

        \[\leadsto \frac{-b_2}{a} - \frac{\color{blue}{{\left(b_2 \cdot b_2 - c \cdot a\right)}^{\left(2 \cdot 0.25\right)}}}{a} \]
      2. metadata-eval81.0%

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

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

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

    if 1.3000000000000001e77 < b_2

    1. Initial program 58.0%

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a} \]
    2. Taylor expanded in b_2 around inf 95.7%

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

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

Alternative 3: 84.8% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 19.9%

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

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

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

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

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

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

      \[\leadsto \frac{\left(-b_2\right) - \sqrt{\color{blue}{\mathsf{fma}\left(-c, a, b_2 \cdot b_2\right)}}}{a} \]
    4. Step-by-step derivation
      1. clear-num19.9%

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

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

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

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

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

        \[\leadsto \frac{1}{\frac{a}{\left(-b_2\right) - \sqrt{\color{blue}{\left(-c\right) \cdot a + {b_2}^{2}}}}} \]
      4. distribute-lft-neg-out19.8%

        \[\leadsto \frac{1}{\frac{a}{\left(-b_2\right) - \sqrt{\color{blue}{\left(-c \cdot a\right)} + {b_2}^{2}}}} \]
      5. distribute-rgt-neg-out19.8%

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

        \[\leadsto \frac{1}{\frac{a}{\left(-b_2\right) - \sqrt{\color{blue}{{b_2}^{2} + c \cdot \left(-a\right)}}}} \]
      7. distribute-rgt-neg-out19.8%

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

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

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

      \[\leadsto \color{blue}{\frac{1}{\frac{a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - c \cdot a}}}} \]
    8. Taylor expanded in b_2 around -inf 88.0%

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

    if -8.00000000000000025e-53 < b_2 < 1.4500000000000001e77

    1. Initial program 80.9%

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

    if 1.4500000000000001e77 < b_2

    1. Initial program 58.0%

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a} \]
    2. Taylor expanded in b_2 around inf 95.7%

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

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

Alternative 4: 79.4% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 22.7%

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

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

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

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

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

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

      \[\leadsto \frac{\left(-b_2\right) - \sqrt{\color{blue}{\mathsf{fma}\left(-c, a, b_2 \cdot b_2\right)}}}{a} \]
    4. Step-by-step derivation
      1. clear-num22.7%

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

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

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

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

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

        \[\leadsto \frac{1}{\frac{a}{\left(-b_2\right) - \sqrt{\color{blue}{\left(-c\right) \cdot a + {b_2}^{2}}}}} \]
      4. distribute-lft-neg-out22.6%

        \[\leadsto \frac{1}{\frac{a}{\left(-b_2\right) - \sqrt{\color{blue}{\left(-c \cdot a\right)} + {b_2}^{2}}}} \]
      5. distribute-rgt-neg-out22.6%

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

        \[\leadsto \frac{1}{\frac{a}{\left(-b_2\right) - \sqrt{\color{blue}{{b_2}^{2} + c \cdot \left(-a\right)}}}} \]
      7. distribute-rgt-neg-out22.6%

        \[\leadsto \frac{1}{\frac{a}{\left(-b_2\right) - \sqrt{{b_2}^{2} + \color{blue}{\left(-c \cdot a\right)}}}} \]
      8. sub-neg22.6%

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

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

      \[\leadsto \color{blue}{\frac{1}{\frac{a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - c \cdot a}}}} \]
    8. Taylor expanded in b_2 around -inf 84.5%

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

    if -8.8000000000000005e-120 < b_2 < 1.35000000000000007e-31

    1. Initial program 78.9%

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a} \]
    2. Taylor expanded in b_2 around 0 75.3%

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

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

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

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

    if 1.35000000000000007e-31 < b_2

    1. Initial program 68.8%

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a} \]
    2. Taylor expanded in b_2 around inf 90.0%

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

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

Alternative 5: 66.8% accurate, 7.4× speedup?

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

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

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


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

    1. Initial program 35.7%

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

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

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

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

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

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

      \[\leadsto \frac{\left(-b_2\right) - \sqrt{\color{blue}{\mathsf{fma}\left(-c, a, b_2 \cdot b_2\right)}}}{a} \]
    4. Step-by-step derivation
      1. clear-num35.7%

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

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

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

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

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

        \[\leadsto \frac{1}{\frac{a}{\left(-b_2\right) - \sqrt{\color{blue}{\left(-c\right) \cdot a + {b_2}^{2}}}}} \]
      4. distribute-lft-neg-out35.7%

        \[\leadsto \frac{1}{\frac{a}{\left(-b_2\right) - \sqrt{\color{blue}{\left(-c \cdot a\right)} + {b_2}^{2}}}} \]
      5. distribute-rgt-neg-out35.7%

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

        \[\leadsto \frac{1}{\frac{a}{\left(-b_2\right) - \sqrt{\color{blue}{{b_2}^{2} + c \cdot \left(-a\right)}}}} \]
      7. distribute-rgt-neg-out35.7%

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

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

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

      \[\leadsto \color{blue}{\frac{1}{\frac{a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - c \cdot a}}}} \]
    8. Taylor expanded in b_2 around -inf 69.3%

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

    if -5.0000000000022e-312 < b_2

    1. Initial program 70.8%

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a} \]
    2. Taylor expanded in b_2 around inf 69.5%

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

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

Alternative 6: 67.1% accurate, 8.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b_2 \leq -5 \cdot 10^{-312}:\\
\;\;\;\;\frac{-0.5 \cdot c}{b_2}\\

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


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

    1. Initial program 35.7%

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a} \]
    2. Taylor expanded in b_2 around -inf 68.4%

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

        \[\leadsto \color{blue}{\frac{-0.5 \cdot c}{b_2}} \]
    4. Simplified68.4%

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

    if -5.0000000000022e-312 < b_2

    1. Initial program 70.8%

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a} \]
    2. Taylor expanded in b_2 around inf 69.5%

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

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

Alternative 7: 47.0% accurate, 15.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b_2 \leq -1.8 \cdot 10^{-308}:\\
\;\;\;\;\frac{-0.5 \cdot c}{b_2}\\

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


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

    1. Initial program 35.7%

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a} \]
    2. Taylor expanded in b_2 around -inf 68.4%

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

        \[\leadsto \color{blue}{\frac{-0.5 \cdot c}{b_2}} \]
    4. Simplified68.4%

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

    if -1.7999999999999999e-308 < b_2

    1. Initial program 70.8%

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

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

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

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

        \[\leadsto \frac{\left(-b_2\right) - {\color{blue}{\left({\left(b_2 \cdot b_2 - a \cdot c\right)}^{\left(\frac{0.5}{2}\right)}\right)}}^{2}}{a} \]
      5. metadata-eval70.6%

        \[\leadsto \frac{\left(-b_2\right) - {\left({\left(b_2 \cdot b_2 - a \cdot c\right)}^{\color{blue}{0.25}}\right)}^{2}}{a} \]
    3. Applied egg-rr70.6%

      \[\leadsto \frac{\left(-b_2\right) - \color{blue}{{\left({\left(b_2 \cdot b_2 - a \cdot c\right)}^{0.25}\right)}^{2}}}{a} \]
    4. Taylor expanded in b_2 around inf 27.9%

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

        \[\leadsto \color{blue}{-\frac{b_2}{a}} \]
      2. distribute-frac-neg27.9%

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

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

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

Alternative 8: 66.8% accurate, 15.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b_2 \leq -5 \cdot 10^{-312}:\\
\;\;\;\;\frac{-0.5 \cdot c}{b_2}\\

\mathbf{else}:\\
\;\;\;\;\frac{b_2 \cdot -2}{a}\\


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

    1. Initial program 35.7%

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a} \]
    2. Taylor expanded in b_2 around -inf 68.4%

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

        \[\leadsto \color{blue}{\frac{-0.5 \cdot c}{b_2}} \]
    4. Simplified68.4%

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

    if -5.0000000000022e-312 < b_2

    1. Initial program 70.8%

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a} \]
    2. Taylor expanded in b_2 around inf 69.4%

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

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

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

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

Alternative 9: 23.7% accurate, 18.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b_2 \leq -7 \cdot 10^{-8}:\\
\;\;\;\;\frac{0}{a}\\

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


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

    1. Initial program 16.0%

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

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

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

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

        \[\leadsto \frac{\left(-b_2\right) - {\color{blue}{\left({\left(b_2 \cdot b_2 - a \cdot c\right)}^{\left(\frac{0.5}{2}\right)}\right)}}^{2}}{a} \]
      5. metadata-eval12.7%

        \[\leadsto \frac{\left(-b_2\right) - {\left({\left(b_2 \cdot b_2 - a \cdot c\right)}^{\color{blue}{0.25}}\right)}^{2}}{a} \]
    3. Applied egg-rr12.7%

      \[\leadsto \frac{\left(-b_2\right) - \color{blue}{{\left({\left(b_2 \cdot b_2 - a \cdot c\right)}^{0.25}\right)}^{2}}}{a} \]
    4. Taylor expanded in b_2 around -inf 45.0%

      \[\leadsto \frac{\color{blue}{-1 \cdot b_2 + b_2}}{a} \]
    5. Step-by-step derivation
      1. distribute-lft1-in45.0%

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

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

        \[\leadsto \frac{\color{blue}{0}}{a} \]
    6. Simplified45.0%

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

    if -7.00000000000000048e-8 < b_2

    1. Initial program 68.7%

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

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

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

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

        \[\leadsto \frac{\left(-b_2\right) - {\color{blue}{\left({\left(b_2 \cdot b_2 - a \cdot c\right)}^{\left(\frac{0.5}{2}\right)}\right)}}^{2}}{a} \]
      5. metadata-eval68.5%

        \[\leadsto \frac{\left(-b_2\right) - {\left({\left(b_2 \cdot b_2 - a \cdot c\right)}^{\color{blue}{0.25}}\right)}^{2}}{a} \]
    3. Applied egg-rr68.5%

      \[\leadsto \frac{\left(-b_2\right) - \color{blue}{{\left({\left(b_2 \cdot b_2 - a \cdot c\right)}^{0.25}\right)}^{2}}}{a} \]
    4. Taylor expanded in b_2 around inf 20.8%

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

        \[\leadsto \color{blue}{-\frac{b_2}{a}} \]
      2. distribute-frac-neg20.8%

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

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

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

Alternative 10: 11.1% accurate, 37.3× speedup?

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

\\
\frac{0}{a}
\end{array}
Derivation
  1. Initial program 53.1%

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

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

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

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

      \[\leadsto \frac{\left(-b_2\right) - {\color{blue}{\left({\left(b_2 \cdot b_2 - a \cdot c\right)}^{\left(\frac{0.5}{2}\right)}\right)}}^{2}}{a} \]
    5. metadata-eval51.9%

      \[\leadsto \frac{\left(-b_2\right) - {\left({\left(b_2 \cdot b_2 - a \cdot c\right)}^{\color{blue}{0.25}}\right)}^{2}}{a} \]
  3. Applied egg-rr51.9%

    \[\leadsto \frac{\left(-b_2\right) - \color{blue}{{\left({\left(b_2 \cdot b_2 - a \cdot c\right)}^{0.25}\right)}^{2}}}{a} \]
  4. Taylor expanded in b_2 around -inf 15.4%

    \[\leadsto \frac{\color{blue}{-1 \cdot b_2 + b_2}}{a} \]
  5. Step-by-step derivation
    1. distribute-lft1-in15.4%

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

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

      \[\leadsto \frac{\color{blue}{0}}{a} \]
  6. Simplified15.4%

    \[\leadsto \frac{\color{blue}{0}}{a} \]
  7. Final simplification15.4%

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

Reproduce

?
herbie shell --seed 2023238 
(FPCore (a b_2 c)
  :name "quad2m (problem 3.2.1, negative)"
  :precision binary64
  (/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))