quadp (p42, positive)

Percentage Accurate: 51.7% → 84.2%
Time: 16.5s
Alternatives: 11
Speedup: 12.9×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 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: 51.7% accurate, 1.0× speedup?

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

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

Alternative 1: 84.2% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -4 \cdot 10^{+154}:\\ \;\;\;\;\frac{\left|b + \mathsf{fma}\left(-2, a \cdot \frac{c}{b}, b\right)\right|}{a \cdot 2}\\ \mathbf{elif}\;b \leq 6.2 \cdot 10^{-6}:\\ \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} - b}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b -4e+154)
   (/ (fabs (+ b (fma -2.0 (* a (/ c b)) b))) (* a 2.0))
   (if (<= b 6.2e-6)
     (/ (- (sqrt (fma b b (* c (* a -4.0)))) b) (* a 2.0))
     (/ (- c) b))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= -4e+154) {
		tmp = fabs((b + fma(-2.0, (a * (c / b)), b))) / (a * 2.0);
	} else if (b <= 6.2e-6) {
		tmp = (sqrt(fma(b, b, (c * (a * -4.0)))) - b) / (a * 2.0);
	} else {
		tmp = -c / b;
	}
	return tmp;
}
function code(a, b, c)
	tmp = 0.0
	if (b <= -4e+154)
		tmp = Float64(abs(Float64(b + fma(-2.0, Float64(a * Float64(c / b)), b))) / Float64(a * 2.0));
	elseif (b <= 6.2e-6)
		tmp = Float64(Float64(sqrt(fma(b, b, Float64(c * Float64(a * -4.0)))) - b) / Float64(a * 2.0));
	else
		tmp = Float64(Float64(-c) / b);
	end
	return tmp
end
code[a_, b_, c_] := If[LessEqual[b, -4e+154], N[(N[Abs[N[(b + N[(-2.0 * N[(a * N[(c / b), $MachinePrecision]), $MachinePrecision] + b), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 6.2e-6], N[(N[(N[Sqrt[N[(b * b + N[(c * N[(a * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[((-c) / b), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq -4 \cdot 10^{+154}:\\
\;\;\;\;\frac{\left|b + \mathsf{fma}\left(-2, a \cdot \frac{c}{b}, b\right)\right|}{a \cdot 2}\\

\mathbf{elif}\;b \leq 6.2 \cdot 10^{-6}:\\
\;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} - b}{a \cdot 2}\\

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


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

    1. Initial program 29.7%

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

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

      \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{a \cdot 2}} \]
    4. Add Preprocessing
    5. Taylor expanded in a around 0 2.1%

      \[\leadsto \frac{\left(-b\right) + \color{blue}{\left(b + -2 \cdot \frac{a \cdot c}{b}\right)}}{a \cdot 2} \]
    6. Step-by-step derivation
      1. add-sqr-sqrt2.1%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\sqrt{{\left(b + \color{blue}{\left(-2 \cdot \frac{a \cdot c}{b} + b\right)}\right)}^{2}}}{a \cdot 2} \]
      10. fma-define30.0%

        \[\leadsto \frac{\sqrt{{\left(b + \color{blue}{\mathsf{fma}\left(-2, \frac{a \cdot c}{b}, b\right)}\right)}^{2}}}{a \cdot 2} \]
      11. associate-/l*30.0%

        \[\leadsto \frac{\sqrt{{\left(b + \mathsf{fma}\left(-2, \color{blue}{a \cdot \frac{c}{b}}, b\right)\right)}^{2}}}{a \cdot 2} \]
    7. Applied egg-rr30.0%

      \[\leadsto \frac{\color{blue}{\sqrt{{\left(b + \mathsf{fma}\left(-2, a \cdot \frac{c}{b}, b\right)\right)}^{2}}}}{a \cdot 2} \]
    8. Step-by-step derivation
      1. unpow230.0%

        \[\leadsto \frac{\sqrt{\color{blue}{\left(b + \mathsf{fma}\left(-2, a \cdot \frac{c}{b}, b\right)\right) \cdot \left(b + \mathsf{fma}\left(-2, a \cdot \frac{c}{b}, b\right)\right)}}}{a \cdot 2} \]
      2. rem-sqrt-square95.6%

        \[\leadsto \frac{\color{blue}{\left|b + \mathsf{fma}\left(-2, a \cdot \frac{c}{b}, b\right)\right|}}{a \cdot 2} \]
    9. Simplified95.6%

      \[\leadsto \frac{\color{blue}{\left|b + \mathsf{fma}\left(-2, a \cdot \frac{c}{b}, b\right)\right|}}{a \cdot 2} \]

    if -4.00000000000000015e154 < b < 6.1999999999999999e-6

    1. Initial program 82.1%

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

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

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

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

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

        \[\leadsto \frac{\sqrt{\mathsf{fma}\left(b, b, -4 \cdot \color{blue}{\left(c \cdot a\right)}\right)} - b}{a \cdot 2} \]
      6. associate-*r*82.2%

        \[\leadsto \frac{\sqrt{\mathsf{fma}\left(b, b, -\color{blue}{\left(4 \cdot c\right) \cdot a}\right)} - b}{a \cdot 2} \]
      7. distribute-lft-neg-in82.2%

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

        \[\leadsto \frac{\sqrt{\mathsf{fma}\left(b, b, \left(-\color{blue}{c \cdot 4}\right) \cdot a\right)} - b}{a \cdot 2} \]
      9. distribute-rgt-neg-in82.2%

        \[\leadsto \frac{\sqrt{\mathsf{fma}\left(b, b, \color{blue}{\left(c \cdot \left(-4\right)\right)} \cdot a\right)} - b}{a \cdot 2} \]
      10. associate-*r*82.2%

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

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

      \[\leadsto \color{blue}{\frac{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(-4 \cdot a\right)\right)} - b}{a \cdot 2}} \]
    4. Add Preprocessing

    if 6.1999999999999999e-6 < b

    1. Initial program 14.7%

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

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

      \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{a \cdot 2}} \]
    4. Add Preprocessing
    5. Taylor expanded in b around inf 87.9%

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

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

        \[\leadsto \frac{\color{blue}{-c}}{b} \]
    7. Simplified87.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -4 \cdot 10^{+154}:\\ \;\;\;\;\frac{\left|b + \mathsf{fma}\left(-2, a \cdot \frac{c}{b}, b\right)\right|}{a \cdot 2}\\ \mathbf{elif}\;b \leq 6.2 \cdot 10^{-6}:\\ \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} - b}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 84.3% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -3 \cdot 10^{+153}:\\ \;\;\;\;\frac{\left|b + \mathsf{fma}\left(-2, a \cdot \frac{c}{b}, b\right)\right|}{a \cdot 2}\\ \mathbf{elif}\;b \leq 2.4 \cdot 10^{-8}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)} - b}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b -3e+153)
   (/ (fabs (+ b (fma -2.0 (* a (/ c b)) b))) (* a 2.0))
   (if (<= b 2.4e-8)
     (/ (- (sqrt (- (* b b) (* 4.0 (* a c)))) b) (* a 2.0))
     (/ (- c) b))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= -3e+153) {
		tmp = fabs((b + fma(-2.0, (a * (c / b)), b))) / (a * 2.0);
	} else if (b <= 2.4e-8) {
		tmp = (sqrt(((b * b) - (4.0 * (a * c)))) - b) / (a * 2.0);
	} else {
		tmp = -c / b;
	}
	return tmp;
}
function code(a, b, c)
	tmp = 0.0
	if (b <= -3e+153)
		tmp = Float64(abs(Float64(b + fma(-2.0, Float64(a * Float64(c / b)), b))) / Float64(a * 2.0));
	elseif (b <= 2.4e-8)
		tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(4.0 * Float64(a * c)))) - b) / Float64(a * 2.0));
	else
		tmp = Float64(Float64(-c) / b);
	end
	return tmp
end
code[a_, b_, c_] := If[LessEqual[b, -3e+153], N[(N[Abs[N[(b + N[(-2.0 * N[(a * N[(c / b), $MachinePrecision]), $MachinePrecision] + b), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 2.4e-8], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(4.0 * N[(a * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[((-c) / b), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq -3 \cdot 10^{+153}:\\
\;\;\;\;\frac{\left|b + \mathsf{fma}\left(-2, a \cdot \frac{c}{b}, b\right)\right|}{a \cdot 2}\\

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

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


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

    1. Initial program 29.7%

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

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

      \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{a \cdot 2}} \]
    4. Add Preprocessing
    5. Taylor expanded in a around 0 2.1%

      \[\leadsto \frac{\left(-b\right) + \color{blue}{\left(b + -2 \cdot \frac{a \cdot c}{b}\right)}}{a \cdot 2} \]
    6. Step-by-step derivation
      1. add-sqr-sqrt2.1%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\sqrt{{\left(b + \color{blue}{\left(-2 \cdot \frac{a \cdot c}{b} + b\right)}\right)}^{2}}}{a \cdot 2} \]
      10. fma-define30.0%

        \[\leadsto \frac{\sqrt{{\left(b + \color{blue}{\mathsf{fma}\left(-2, \frac{a \cdot c}{b}, b\right)}\right)}^{2}}}{a \cdot 2} \]
      11. associate-/l*30.0%

        \[\leadsto \frac{\sqrt{{\left(b + \mathsf{fma}\left(-2, \color{blue}{a \cdot \frac{c}{b}}, b\right)\right)}^{2}}}{a \cdot 2} \]
    7. Applied egg-rr30.0%

      \[\leadsto \frac{\color{blue}{\sqrt{{\left(b + \mathsf{fma}\left(-2, a \cdot \frac{c}{b}, b\right)\right)}^{2}}}}{a \cdot 2} \]
    8. Step-by-step derivation
      1. unpow230.0%

        \[\leadsto \frac{\sqrt{\color{blue}{\left(b + \mathsf{fma}\left(-2, a \cdot \frac{c}{b}, b\right)\right) \cdot \left(b + \mathsf{fma}\left(-2, a \cdot \frac{c}{b}, b\right)\right)}}}{a \cdot 2} \]
      2. rem-sqrt-square95.6%

        \[\leadsto \frac{\color{blue}{\left|b + \mathsf{fma}\left(-2, a \cdot \frac{c}{b}, b\right)\right|}}{a \cdot 2} \]
    9. Simplified95.6%

      \[\leadsto \frac{\color{blue}{\left|b + \mathsf{fma}\left(-2, a \cdot \frac{c}{b}, b\right)\right|}}{a \cdot 2} \]

    if -3.00000000000000019e153 < b < 2.39999999999999998e-8

    1. Initial program 82.1%

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

    if 2.39999999999999998e-8 < b

    1. Initial program 14.7%

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

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

      \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{a \cdot 2}} \]
    4. Add Preprocessing
    5. Taylor expanded in b around inf 87.9%

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

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

        \[\leadsto \frac{\color{blue}{-c}}{b} \]
    7. Simplified87.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -3 \cdot 10^{+153}:\\ \;\;\;\;\frac{\left|b + \mathsf{fma}\left(-2, a \cdot \frac{c}{b}, b\right)\right|}{a \cdot 2}\\ \mathbf{elif}\;b \leq 2.4 \cdot 10^{-8}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)} - b}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 79.2% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{a \cdot \left(c \cdot -4\right)}\\ t_1 := \frac{b}{-a}\\ t_2 := \frac{-0.5}{a} \cdot \left(b - t\_0\right)\\ \mathbf{if}\;b \leq -2.4 \cdot 10^{-30}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;b \leq -5 \cdot 10^{-89}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;b \leq -2 \cdot 10^{-129}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;b \leq 1.45 \cdot 10^{-105}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;b \leq 9.8 \cdot 10^{-25}:\\ \;\;\;\;\frac{1}{\frac{a}{b} - \frac{b}{c}}\\ \mathbf{elif}\;b \leq 2.7 \cdot 10^{-8}:\\ \;\;\;\;\frac{\frac{t\_0}{--2}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (sqrt (* a (* c -4.0))))
        (t_1 (/ b (- a)))
        (t_2 (* (/ -0.5 a) (- b t_0))))
   (if (<= b -2.4e-30)
     t_1
     (if (<= b -5e-89)
       t_2
       (if (<= b -2e-129)
         t_1
         (if (<= b 1.45e-105)
           t_2
           (if (<= b 9.8e-25)
             (/ 1.0 (- (/ a b) (/ b c)))
             (if (<= b 2.7e-8) (/ (/ t_0 (- -2.0)) a) (/ (- c) b)))))))))
double code(double a, double b, double c) {
	double t_0 = sqrt((a * (c * -4.0)));
	double t_1 = b / -a;
	double t_2 = (-0.5 / a) * (b - t_0);
	double tmp;
	if (b <= -2.4e-30) {
		tmp = t_1;
	} else if (b <= -5e-89) {
		tmp = t_2;
	} else if (b <= -2e-129) {
		tmp = t_1;
	} else if (b <= 1.45e-105) {
		tmp = t_2;
	} else if (b <= 9.8e-25) {
		tmp = 1.0 / ((a / b) - (b / c));
	} else if (b <= 2.7e-8) {
		tmp = (t_0 / -(-2.0)) / a;
	} else {
		tmp = -c / b;
	}
	return tmp;
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_0 = sqrt((a * (c * (-4.0d0))))
    t_1 = b / -a
    t_2 = ((-0.5d0) / a) * (b - t_0)
    if (b <= (-2.4d-30)) then
        tmp = t_1
    else if (b <= (-5d-89)) then
        tmp = t_2
    else if (b <= (-2d-129)) then
        tmp = t_1
    else if (b <= 1.45d-105) then
        tmp = t_2
    else if (b <= 9.8d-25) then
        tmp = 1.0d0 / ((a / b) - (b / c))
    else if (b <= 2.7d-8) then
        tmp = (t_0 / -(-2.0d0)) / a
    else
        tmp = -c / b
    end if
    code = tmp
end function
public static double code(double a, double b, double c) {
	double t_0 = Math.sqrt((a * (c * -4.0)));
	double t_1 = b / -a;
	double t_2 = (-0.5 / a) * (b - t_0);
	double tmp;
	if (b <= -2.4e-30) {
		tmp = t_1;
	} else if (b <= -5e-89) {
		tmp = t_2;
	} else if (b <= -2e-129) {
		tmp = t_1;
	} else if (b <= 1.45e-105) {
		tmp = t_2;
	} else if (b <= 9.8e-25) {
		tmp = 1.0 / ((a / b) - (b / c));
	} else if (b <= 2.7e-8) {
		tmp = (t_0 / -(-2.0)) / a;
	} else {
		tmp = -c / b;
	}
	return tmp;
}
def code(a, b, c):
	t_0 = math.sqrt((a * (c * -4.0)))
	t_1 = b / -a
	t_2 = (-0.5 / a) * (b - t_0)
	tmp = 0
	if b <= -2.4e-30:
		tmp = t_1
	elif b <= -5e-89:
		tmp = t_2
	elif b <= -2e-129:
		tmp = t_1
	elif b <= 1.45e-105:
		tmp = t_2
	elif b <= 9.8e-25:
		tmp = 1.0 / ((a / b) - (b / c))
	elif b <= 2.7e-8:
		tmp = (t_0 / -(-2.0)) / a
	else:
		tmp = -c / b
	return tmp
function code(a, b, c)
	t_0 = sqrt(Float64(a * Float64(c * -4.0)))
	t_1 = Float64(b / Float64(-a))
	t_2 = Float64(Float64(-0.5 / a) * Float64(b - t_0))
	tmp = 0.0
	if (b <= -2.4e-30)
		tmp = t_1;
	elseif (b <= -5e-89)
		tmp = t_2;
	elseif (b <= -2e-129)
		tmp = t_1;
	elseif (b <= 1.45e-105)
		tmp = t_2;
	elseif (b <= 9.8e-25)
		tmp = Float64(1.0 / Float64(Float64(a / b) - Float64(b / c)));
	elseif (b <= 2.7e-8)
		tmp = Float64(Float64(t_0 / Float64(-(-2.0))) / a);
	else
		tmp = Float64(Float64(-c) / b);
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	t_0 = sqrt((a * (c * -4.0)));
	t_1 = b / -a;
	t_2 = (-0.5 / a) * (b - t_0);
	tmp = 0.0;
	if (b <= -2.4e-30)
		tmp = t_1;
	elseif (b <= -5e-89)
		tmp = t_2;
	elseif (b <= -2e-129)
		tmp = t_1;
	elseif (b <= 1.45e-105)
		tmp = t_2;
	elseif (b <= 9.8e-25)
		tmp = 1.0 / ((a / b) - (b / c));
	elseif (b <= 2.7e-8)
		tmp = (t_0 / -(-2.0)) / a;
	else
		tmp = -c / b;
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := Block[{t$95$0 = N[Sqrt[N[(a * N[(c * -4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(b / (-a)), $MachinePrecision]}, Block[{t$95$2 = N[(N[(-0.5 / a), $MachinePrecision] * N[(b - t$95$0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -2.4e-30], t$95$1, If[LessEqual[b, -5e-89], t$95$2, If[LessEqual[b, -2e-129], t$95$1, If[LessEqual[b, 1.45e-105], t$95$2, If[LessEqual[b, 9.8e-25], N[(1.0 / N[(N[(a / b), $MachinePrecision] - N[(b / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 2.7e-8], N[(N[(t$95$0 / (--2.0)), $MachinePrecision] / a), $MachinePrecision], N[((-c) / b), $MachinePrecision]]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sqrt{a \cdot \left(c \cdot -4\right)}\\
t_1 := \frac{b}{-a}\\
t_2 := \frac{-0.5}{a} \cdot \left(b - t\_0\right)\\
\mathbf{if}\;b \leq -2.4 \cdot 10^{-30}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;b \leq -5 \cdot 10^{-89}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;b \leq -2 \cdot 10^{-129}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;b \leq 1.45 \cdot 10^{-105}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;b \leq 9.8 \cdot 10^{-25}:\\
\;\;\;\;\frac{1}{\frac{a}{b} - \frac{b}{c}}\\

\mathbf{elif}\;b \leq 2.7 \cdot 10^{-8}:\\
\;\;\;\;\frac{\frac{t\_0}{--2}}{a}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if b < -2.39999999999999985e-30 or -4.99999999999999967e-89 < b < -1.9999999999999999e-129

    1. Initial program 63.9%

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

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

      \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{a \cdot 2}} \]
    4. Add Preprocessing
    5. Taylor expanded in b around -inf 87.6%

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

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

        \[\leadsto \frac{\color{blue}{-b}}{a} \]
    7. Simplified87.6%

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

    if -2.39999999999999985e-30 < b < -4.99999999999999967e-89 or -1.9999999999999999e-129 < b < 1.45000000000000002e-105

    1. Initial program 83.6%

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

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

      \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{a \cdot 2}} \]
    4. Add Preprocessing
    5. Taylor expanded in b around 0 73.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(b - \sqrt{a \cdot \left(c \cdot -4\right)}\right) \cdot \left(\frac{1}{a} \cdot \color{blue}{-0.5}\right) \]
    9. Applied egg-rr73.0%

      \[\leadsto \color{blue}{\left(b - \sqrt{a \cdot \left(c \cdot -4\right)}\right) \cdot \left(\frac{1}{a} \cdot -0.5\right)} \]
    10. Step-by-step derivation
      1. *-commutative73.0%

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

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

        \[\leadsto \frac{\color{blue}{-0.5}}{a} \cdot \left(b - \sqrt{a \cdot \left(c \cdot -4\right)}\right) \]
    11. Simplified73.0%

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

    if 1.45000000000000002e-105 < b < 9.7999999999999998e-25

    1. Initial program 39.4%

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

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

      \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{a \cdot 2}} \]
    4. Add Preprocessing
    5. Applied egg-rr22.1%

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

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

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

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

      \[\leadsto \left(b - \color{blue}{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -4\right)\right)}}\right) \cdot \frac{1}{a \cdot -2} \]
    8. Step-by-step derivation
      1. un-div-inv39.4%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\frac{4}{\color{blue}{\sqrt{-4} \cdot \sqrt{-4}}} \cdot \frac{b}{c} + \frac{a}{b}} \]
      5. rem-square-sqrt55.0%

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

        \[\leadsto \frac{1}{\color{blue}{-1} \cdot \frac{b}{c} + \frac{a}{b}} \]
      7. associate-*r/55.0%

        \[\leadsto \frac{1}{\color{blue}{\frac{-1 \cdot b}{c}} + \frac{a}{b}} \]
      8. mul-1-neg55.0%

        \[\leadsto \frac{1}{\frac{\color{blue}{-b}}{c} + \frac{a}{b}} \]
    12. Simplified55.0%

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

    if 9.7999999999999998e-25 < b < 2.70000000000000002e-8

    1. Initial program 83.7%

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

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

      \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{a \cdot 2}} \]
    4. Add Preprocessing
    5. Applied egg-rr84.0%

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

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

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

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

      \[\leadsto \left(b - \color{blue}{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -4\right)\right)}}\right) \cdot \frac{1}{a \cdot -2} \]
    8. Step-by-step derivation
      1. un-div-inv83.7%

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{1}{\frac{a \cdot -2}{b - \mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -4\right)}\right)}}} \]
    10. Step-by-step derivation
      1. clear-num83.7%

        \[\leadsto \color{blue}{\frac{b - \mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -4\right)}\right)}{a \cdot -2}} \]
      2. *-un-lft-identity83.7%

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

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

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

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

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

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

        \[\leadsto \frac{\frac{\color{blue}{0} - \sqrt{a \cdot \left(c \cdot -4\right)}}{-2}}{a} \]
      5. neg-sub083.7%

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

        \[\leadsto \frac{\frac{-\sqrt{\color{blue}{\left(c \cdot -4\right) \cdot a}}}{-2}}{a} \]
    13. Simplified83.7%

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

    if 2.70000000000000002e-8 < b

    1. Initial program 14.7%

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

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

      \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{a \cdot 2}} \]
    4. Add Preprocessing
    5. Taylor expanded in b around inf 87.9%

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

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

        \[\leadsto \frac{\color{blue}{-c}}{b} \]
    7. Simplified87.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -2.4 \cdot 10^{-30}:\\ \;\;\;\;\frac{b}{-a}\\ \mathbf{elif}\;b \leq -5 \cdot 10^{-89}:\\ \;\;\;\;\frac{-0.5}{a} \cdot \left(b - \sqrt{a \cdot \left(c \cdot -4\right)}\right)\\ \mathbf{elif}\;b \leq -2 \cdot 10^{-129}:\\ \;\;\;\;\frac{b}{-a}\\ \mathbf{elif}\;b \leq 1.45 \cdot 10^{-105}:\\ \;\;\;\;\frac{-0.5}{a} \cdot \left(b - \sqrt{a \cdot \left(c \cdot -4\right)}\right)\\ \mathbf{elif}\;b \leq 9.8 \cdot 10^{-25}:\\ \;\;\;\;\frac{1}{\frac{a}{b} - \frac{b}{c}}\\ \mathbf{elif}\;b \leq 2.7 \cdot 10^{-8}:\\ \;\;\;\;\frac{\frac{\sqrt{a \cdot \left(c \cdot -4\right)}}{--2}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 79.1% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{b}{-a}\\ t_1 := \sqrt{a \cdot \left(c \cdot -4\right)}\\ t_2 := \frac{t\_1 - b}{a \cdot 2}\\ \mathbf{if}\;b \leq -3.5 \cdot 10^{-27}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;b \leq -2.4 \cdot 10^{-90}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;b \leq -2 \cdot 10^{-129}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;b \leq 1.95 \cdot 10^{-109}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;b \leq 9.8 \cdot 10^{-25}:\\ \;\;\;\;\frac{1}{\frac{a}{b} - \frac{b}{c}}\\ \mathbf{elif}\;b \leq 2.4 \cdot 10^{-8}:\\ \;\;\;\;\frac{\frac{t\_1}{--2}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (/ b (- a)))
        (t_1 (sqrt (* a (* c -4.0))))
        (t_2 (/ (- t_1 b) (* a 2.0))))
   (if (<= b -3.5e-27)
     t_0
     (if (<= b -2.4e-90)
       t_2
       (if (<= b -2e-129)
         t_0
         (if (<= b 1.95e-109)
           t_2
           (if (<= b 9.8e-25)
             (/ 1.0 (- (/ a b) (/ b c)))
             (if (<= b 2.4e-8) (/ (/ t_1 (- -2.0)) a) (/ (- c) b)))))))))
double code(double a, double b, double c) {
	double t_0 = b / -a;
	double t_1 = sqrt((a * (c * -4.0)));
	double t_2 = (t_1 - b) / (a * 2.0);
	double tmp;
	if (b <= -3.5e-27) {
		tmp = t_0;
	} else if (b <= -2.4e-90) {
		tmp = t_2;
	} else if (b <= -2e-129) {
		tmp = t_0;
	} else if (b <= 1.95e-109) {
		tmp = t_2;
	} else if (b <= 9.8e-25) {
		tmp = 1.0 / ((a / b) - (b / c));
	} else if (b <= 2.4e-8) {
		tmp = (t_1 / -(-2.0)) / a;
	} else {
		tmp = -c / b;
	}
	return tmp;
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_0 = b / -a
    t_1 = sqrt((a * (c * (-4.0d0))))
    t_2 = (t_1 - b) / (a * 2.0d0)
    if (b <= (-3.5d-27)) then
        tmp = t_0
    else if (b <= (-2.4d-90)) then
        tmp = t_2
    else if (b <= (-2d-129)) then
        tmp = t_0
    else if (b <= 1.95d-109) then
        tmp = t_2
    else if (b <= 9.8d-25) then
        tmp = 1.0d0 / ((a / b) - (b / c))
    else if (b <= 2.4d-8) then
        tmp = (t_1 / -(-2.0d0)) / a
    else
        tmp = -c / b
    end if
    code = tmp
end function
public static double code(double a, double b, double c) {
	double t_0 = b / -a;
	double t_1 = Math.sqrt((a * (c * -4.0)));
	double t_2 = (t_1 - b) / (a * 2.0);
	double tmp;
	if (b <= -3.5e-27) {
		tmp = t_0;
	} else if (b <= -2.4e-90) {
		tmp = t_2;
	} else if (b <= -2e-129) {
		tmp = t_0;
	} else if (b <= 1.95e-109) {
		tmp = t_2;
	} else if (b <= 9.8e-25) {
		tmp = 1.0 / ((a / b) - (b / c));
	} else if (b <= 2.4e-8) {
		tmp = (t_1 / -(-2.0)) / a;
	} else {
		tmp = -c / b;
	}
	return tmp;
}
def code(a, b, c):
	t_0 = b / -a
	t_1 = math.sqrt((a * (c * -4.0)))
	t_2 = (t_1 - b) / (a * 2.0)
	tmp = 0
	if b <= -3.5e-27:
		tmp = t_0
	elif b <= -2.4e-90:
		tmp = t_2
	elif b <= -2e-129:
		tmp = t_0
	elif b <= 1.95e-109:
		tmp = t_2
	elif b <= 9.8e-25:
		tmp = 1.0 / ((a / b) - (b / c))
	elif b <= 2.4e-8:
		tmp = (t_1 / -(-2.0)) / a
	else:
		tmp = -c / b
	return tmp
function code(a, b, c)
	t_0 = Float64(b / Float64(-a))
	t_1 = sqrt(Float64(a * Float64(c * -4.0)))
	t_2 = Float64(Float64(t_1 - b) / Float64(a * 2.0))
	tmp = 0.0
	if (b <= -3.5e-27)
		tmp = t_0;
	elseif (b <= -2.4e-90)
		tmp = t_2;
	elseif (b <= -2e-129)
		tmp = t_0;
	elseif (b <= 1.95e-109)
		tmp = t_2;
	elseif (b <= 9.8e-25)
		tmp = Float64(1.0 / Float64(Float64(a / b) - Float64(b / c)));
	elseif (b <= 2.4e-8)
		tmp = Float64(Float64(t_1 / Float64(-(-2.0))) / a);
	else
		tmp = Float64(Float64(-c) / b);
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	t_0 = b / -a;
	t_1 = sqrt((a * (c * -4.0)));
	t_2 = (t_1 - b) / (a * 2.0);
	tmp = 0.0;
	if (b <= -3.5e-27)
		tmp = t_0;
	elseif (b <= -2.4e-90)
		tmp = t_2;
	elseif (b <= -2e-129)
		tmp = t_0;
	elseif (b <= 1.95e-109)
		tmp = t_2;
	elseif (b <= 9.8e-25)
		tmp = 1.0 / ((a / b) - (b / c));
	elseif (b <= 2.4e-8)
		tmp = (t_1 / -(-2.0)) / a;
	else
		tmp = -c / b;
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := Block[{t$95$0 = N[(b / (-a)), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(a * N[(c * -4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(t$95$1 - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -3.5e-27], t$95$0, If[LessEqual[b, -2.4e-90], t$95$2, If[LessEqual[b, -2e-129], t$95$0, If[LessEqual[b, 1.95e-109], t$95$2, If[LessEqual[b, 9.8e-25], N[(1.0 / N[(N[(a / b), $MachinePrecision] - N[(b / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 2.4e-8], N[(N[(t$95$1 / (--2.0)), $MachinePrecision] / a), $MachinePrecision], N[((-c) / b), $MachinePrecision]]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{b}{-a}\\
t_1 := \sqrt{a \cdot \left(c \cdot -4\right)}\\
t_2 := \frac{t\_1 - b}{a \cdot 2}\\
\mathbf{if}\;b \leq -3.5 \cdot 10^{-27}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;b \leq -2.4 \cdot 10^{-90}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;b \leq -2 \cdot 10^{-129}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;b \leq 1.95 \cdot 10^{-109}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;b \leq 9.8 \cdot 10^{-25}:\\
\;\;\;\;\frac{1}{\frac{a}{b} - \frac{b}{c}}\\

\mathbf{elif}\;b \leq 2.4 \cdot 10^{-8}:\\
\;\;\;\;\frac{\frac{t\_1}{--2}}{a}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if b < -3.5000000000000001e-27 or -2.4000000000000002e-90 < b < -1.9999999999999999e-129

    1. Initial program 63.9%

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

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

      \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{a \cdot 2}} \]
    4. Add Preprocessing
    5. Taylor expanded in b around -inf 87.6%

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

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

        \[\leadsto \frac{\color{blue}{-b}}{a} \]
    7. Simplified87.6%

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

    if -3.5000000000000001e-27 < b < -2.4000000000000002e-90 or -1.9999999999999999e-129 < b < 1.95000000000000011e-109

    1. Initial program 83.6%

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

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

      \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{a \cdot 2}} \]
    4. Add Preprocessing
    5. Taylor expanded in b around 0 73.2%

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

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

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

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

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

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

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

    if 1.95000000000000011e-109 < b < 9.7999999999999998e-25

    1. Initial program 39.4%

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

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

      \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{a \cdot 2}} \]
    4. Add Preprocessing
    5. Applied egg-rr22.1%

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

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

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

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

      \[\leadsto \left(b - \color{blue}{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -4\right)\right)}}\right) \cdot \frac{1}{a \cdot -2} \]
    8. Step-by-step derivation
      1. un-div-inv39.4%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\frac{4}{\color{blue}{\sqrt{-4} \cdot \sqrt{-4}}} \cdot \frac{b}{c} + \frac{a}{b}} \]
      5. rem-square-sqrt55.0%

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

        \[\leadsto \frac{1}{\color{blue}{-1} \cdot \frac{b}{c} + \frac{a}{b}} \]
      7. associate-*r/55.0%

        \[\leadsto \frac{1}{\color{blue}{\frac{-1 \cdot b}{c}} + \frac{a}{b}} \]
      8. mul-1-neg55.0%

        \[\leadsto \frac{1}{\frac{\color{blue}{-b}}{c} + \frac{a}{b}} \]
    12. Simplified55.0%

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

    if 9.7999999999999998e-25 < b < 2.39999999999999998e-8

    1. Initial program 83.7%

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

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

      \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{a \cdot 2}} \]
    4. Add Preprocessing
    5. Applied egg-rr84.0%

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

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

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

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

      \[\leadsto \left(b - \color{blue}{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -4\right)\right)}}\right) \cdot \frac{1}{a \cdot -2} \]
    8. Step-by-step derivation
      1. un-div-inv83.7%

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{1}{\frac{a \cdot -2}{b - \mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -4\right)}\right)}}} \]
    10. Step-by-step derivation
      1. clear-num83.7%

        \[\leadsto \color{blue}{\frac{b - \mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -4\right)}\right)}{a \cdot -2}} \]
      2. *-un-lft-identity83.7%

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

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

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

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

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

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

        \[\leadsto \frac{\frac{\color{blue}{0} - \sqrt{a \cdot \left(c \cdot -4\right)}}{-2}}{a} \]
      5. neg-sub083.7%

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

        \[\leadsto \frac{\frac{-\sqrt{\color{blue}{\left(c \cdot -4\right) \cdot a}}}{-2}}{a} \]
    13. Simplified83.7%

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

    if 2.39999999999999998e-8 < b

    1. Initial program 14.7%

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

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

      \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{a \cdot 2}} \]
    4. Add Preprocessing
    5. Taylor expanded in b around inf 87.9%

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

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

        \[\leadsto \frac{\color{blue}{-c}}{b} \]
    7. Simplified87.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -3.5 \cdot 10^{-27}:\\ \;\;\;\;\frac{b}{-a}\\ \mathbf{elif}\;b \leq -2.4 \cdot 10^{-90}:\\ \;\;\;\;\frac{\sqrt{a \cdot \left(c \cdot -4\right)} - b}{a \cdot 2}\\ \mathbf{elif}\;b \leq -2 \cdot 10^{-129}:\\ \;\;\;\;\frac{b}{-a}\\ \mathbf{elif}\;b \leq 1.95 \cdot 10^{-109}:\\ \;\;\;\;\frac{\sqrt{a \cdot \left(c \cdot -4\right)} - b}{a \cdot 2}\\ \mathbf{elif}\;b \leq 9.8 \cdot 10^{-25}:\\ \;\;\;\;\frac{1}{\frac{a}{b} - \frac{b}{c}}\\ \mathbf{elif}\;b \leq 2.4 \cdot 10^{-8}:\\ \;\;\;\;\frac{\frac{\sqrt{a \cdot \left(c \cdot -4\right)}}{--2}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 79.0% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{b}{-a}\\ t_1 := \sqrt{a \cdot \left(c \cdot -4\right)}\\ t_2 := \frac{t\_1 - b}{a \cdot 2}\\ \mathbf{if}\;b \leq -2.2 \cdot 10^{-26}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;b \leq -5.9 \cdot 10^{-89}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;b \leq -2 \cdot 10^{-129}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;b \leq 1.5 \cdot 10^{-106}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;b \leq 9.8 \cdot 10^{-25}:\\ \;\;\;\;\frac{1}{\frac{\mathsf{fma}\left(a, \frac{c}{b}, 4 \cdot \frac{b}{-4}\right)}{c}}\\ \mathbf{elif}\;b \leq 2.4 \cdot 10^{-8}:\\ \;\;\;\;\frac{\frac{t\_1}{--2}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (/ b (- a)))
        (t_1 (sqrt (* a (* c -4.0))))
        (t_2 (/ (- t_1 b) (* a 2.0))))
   (if (<= b -2.2e-26)
     t_0
     (if (<= b -5.9e-89)
       t_2
       (if (<= b -2e-129)
         t_0
         (if (<= b 1.5e-106)
           t_2
           (if (<= b 9.8e-25)
             (/ 1.0 (/ (fma a (/ c b) (* 4.0 (/ b -4.0))) c))
             (if (<= b 2.4e-8) (/ (/ t_1 (- -2.0)) a) (/ (- c) b)))))))))
double code(double a, double b, double c) {
	double t_0 = b / -a;
	double t_1 = sqrt((a * (c * -4.0)));
	double t_2 = (t_1 - b) / (a * 2.0);
	double tmp;
	if (b <= -2.2e-26) {
		tmp = t_0;
	} else if (b <= -5.9e-89) {
		tmp = t_2;
	} else if (b <= -2e-129) {
		tmp = t_0;
	} else if (b <= 1.5e-106) {
		tmp = t_2;
	} else if (b <= 9.8e-25) {
		tmp = 1.0 / (fma(a, (c / b), (4.0 * (b / -4.0))) / c);
	} else if (b <= 2.4e-8) {
		tmp = (t_1 / -(-2.0)) / a;
	} else {
		tmp = -c / b;
	}
	return tmp;
}
function code(a, b, c)
	t_0 = Float64(b / Float64(-a))
	t_1 = sqrt(Float64(a * Float64(c * -4.0)))
	t_2 = Float64(Float64(t_1 - b) / Float64(a * 2.0))
	tmp = 0.0
	if (b <= -2.2e-26)
		tmp = t_0;
	elseif (b <= -5.9e-89)
		tmp = t_2;
	elseif (b <= -2e-129)
		tmp = t_0;
	elseif (b <= 1.5e-106)
		tmp = t_2;
	elseif (b <= 9.8e-25)
		tmp = Float64(1.0 / Float64(fma(a, Float64(c / b), Float64(4.0 * Float64(b / -4.0))) / c));
	elseif (b <= 2.4e-8)
		tmp = Float64(Float64(t_1 / Float64(-(-2.0))) / a);
	else
		tmp = Float64(Float64(-c) / b);
	end
	return tmp
end
code[a_, b_, c_] := Block[{t$95$0 = N[(b / (-a)), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(a * N[(c * -4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(t$95$1 - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -2.2e-26], t$95$0, If[LessEqual[b, -5.9e-89], t$95$2, If[LessEqual[b, -2e-129], t$95$0, If[LessEqual[b, 1.5e-106], t$95$2, If[LessEqual[b, 9.8e-25], N[(1.0 / N[(N[(a * N[(c / b), $MachinePrecision] + N[(4.0 * N[(b / -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 2.4e-8], N[(N[(t$95$1 / (--2.0)), $MachinePrecision] / a), $MachinePrecision], N[((-c) / b), $MachinePrecision]]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{b}{-a}\\
t_1 := \sqrt{a \cdot \left(c \cdot -4\right)}\\
t_2 := \frac{t\_1 - b}{a \cdot 2}\\
\mathbf{if}\;b \leq -2.2 \cdot 10^{-26}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;b \leq -5.9 \cdot 10^{-89}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;b \leq -2 \cdot 10^{-129}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;b \leq 1.5 \cdot 10^{-106}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;b \leq 9.8 \cdot 10^{-25}:\\
\;\;\;\;\frac{1}{\frac{\mathsf{fma}\left(a, \frac{c}{b}, 4 \cdot \frac{b}{-4}\right)}{c}}\\

\mathbf{elif}\;b \leq 2.4 \cdot 10^{-8}:\\
\;\;\;\;\frac{\frac{t\_1}{--2}}{a}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if b < -2.2000000000000001e-26 or -5.90000000000000021e-89 < b < -1.9999999999999999e-129

    1. Initial program 63.9%

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

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

      \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{a \cdot 2}} \]
    4. Add Preprocessing
    5. Taylor expanded in b around -inf 87.6%

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

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

        \[\leadsto \frac{\color{blue}{-b}}{a} \]
    7. Simplified87.6%

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

    if -2.2000000000000001e-26 < b < -5.90000000000000021e-89 or -1.9999999999999999e-129 < b < 1.50000000000000009e-106

    1. Initial program 83.6%

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

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

      \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{a \cdot 2}} \]
    4. Add Preprocessing
    5. Taylor expanded in b around 0 73.2%

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

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

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

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

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

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

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

    if 1.50000000000000009e-106 < b < 9.7999999999999998e-25

    1. Initial program 39.4%

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

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

      \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{a \cdot 2}} \]
    4. Add Preprocessing
    5. Applied egg-rr22.1%

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

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

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

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

      \[\leadsto \left(b - \color{blue}{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -4\right)\right)}}\right) \cdot \frac{1}{a \cdot -2} \]
    8. Step-by-step derivation
      1. un-div-inv39.4%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\frac{\mathsf{fma}\left(a, \frac{c}{b}, 4 \cdot \frac{b}{\color{blue}{\sqrt{-4} \cdot \sqrt{-4}}}\right)}{c}} \]
      5. rem-square-sqrt55.0%

        \[\leadsto \frac{1}{\frac{\mathsf{fma}\left(a, \frac{c}{b}, 4 \cdot \frac{b}{\color{blue}{-4}}\right)}{c}} \]
    12. Simplified55.0%

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

    if 9.7999999999999998e-25 < b < 2.39999999999999998e-8

    1. Initial program 83.7%

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

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

      \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{a \cdot 2}} \]
    4. Add Preprocessing
    5. Applied egg-rr84.0%

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

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

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

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

      \[\leadsto \left(b - \color{blue}{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -4\right)\right)}}\right) \cdot \frac{1}{a \cdot -2} \]
    8. Step-by-step derivation
      1. un-div-inv83.7%

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{1}{\frac{a \cdot -2}{b - \mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -4\right)}\right)}}} \]
    10. Step-by-step derivation
      1. clear-num83.7%

        \[\leadsto \color{blue}{\frac{b - \mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -4\right)}\right)}{a \cdot -2}} \]
      2. *-un-lft-identity83.7%

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

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

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

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

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

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

        \[\leadsto \frac{\frac{\color{blue}{0} - \sqrt{a \cdot \left(c \cdot -4\right)}}{-2}}{a} \]
      5. neg-sub083.7%

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

        \[\leadsto \frac{\frac{-\sqrt{\color{blue}{\left(c \cdot -4\right) \cdot a}}}{-2}}{a} \]
    13. Simplified83.7%

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

    if 2.39999999999999998e-8 < b

    1. Initial program 14.7%

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

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

      \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{a \cdot 2}} \]
    4. Add Preprocessing
    5. Taylor expanded in b around inf 87.9%

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

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

        \[\leadsto \frac{\color{blue}{-c}}{b} \]
    7. Simplified87.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -2.2 \cdot 10^{-26}:\\ \;\;\;\;\frac{b}{-a}\\ \mathbf{elif}\;b \leq -5.9 \cdot 10^{-89}:\\ \;\;\;\;\frac{\sqrt{a \cdot \left(c \cdot -4\right)} - b}{a \cdot 2}\\ \mathbf{elif}\;b \leq -2 \cdot 10^{-129}:\\ \;\;\;\;\frac{b}{-a}\\ \mathbf{elif}\;b \leq 1.5 \cdot 10^{-106}:\\ \;\;\;\;\frac{\sqrt{a \cdot \left(c \cdot -4\right)} - b}{a \cdot 2}\\ \mathbf{elif}\;b \leq 9.8 \cdot 10^{-25}:\\ \;\;\;\;\frac{1}{\frac{\mathsf{fma}\left(a, \frac{c}{b}, 4 \cdot \frac{b}{-4}\right)}{c}}\\ \mathbf{elif}\;b \leq 2.4 \cdot 10^{-8}:\\ \;\;\;\;\frac{\frac{\sqrt{a \cdot \left(c \cdot -4\right)}}{--2}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 79.2% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
t_0 := \frac{\frac{\sqrt{a \cdot \left(c \cdot -4\right)}}{--2}}{a}\\
\mathbf{if}\;b \leq -1.7 \cdot 10^{-129}:\\
\;\;\;\;\frac{b}{-a}\\

\mathbf{elif}\;b \leq 5.6 \cdot 10^{-105}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;b \leq 9.8 \cdot 10^{-25}:\\
\;\;\;\;\frac{1}{\frac{a}{b} - \frac{b}{c}}\\

\mathbf{elif}\;b \leq 2.4 \cdot 10^{-8}:\\
\;\;\;\;t\_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if b < -1.70000000000000007e-129

    1. Initial program 67.8%

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

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

      \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{a \cdot 2}} \]
    4. Add Preprocessing
    5. Taylor expanded in b around -inf 81.0%

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

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

        \[\leadsto \frac{\color{blue}{-b}}{a} \]
    7. Simplified81.0%

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

    if -1.70000000000000007e-129 < b < 5.6e-105 or 9.7999999999999998e-25 < b < 2.39999999999999998e-8

    1. Initial program 80.9%

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

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

      \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{a \cdot 2}} \]
    4. Add Preprocessing
    5. Applied egg-rr80.5%

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

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

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

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

      \[\leadsto \left(b - \color{blue}{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -4\right)\right)}}\right) \cdot \frac{1}{a \cdot -2} \]
    8. Step-by-step derivation
      1. un-div-inv80.9%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{b - \mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -4\right)}\right)}{a \cdot -2}} \]
      2. *-un-lft-identity80.6%

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

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

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

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

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

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

        \[\leadsto \frac{\frac{\color{blue}{0} - \sqrt{a \cdot \left(c \cdot -4\right)}}{-2}}{a} \]
      5. neg-sub075.2%

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

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

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

    if 5.6e-105 < b < 9.7999999999999998e-25

    1. Initial program 39.4%

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

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

      \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{a \cdot 2}} \]
    4. Add Preprocessing
    5. Applied egg-rr22.1%

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

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

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

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

      \[\leadsto \left(b - \color{blue}{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -4\right)\right)}}\right) \cdot \frac{1}{a \cdot -2} \]
    8. Step-by-step derivation
      1. un-div-inv39.4%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\frac{4}{\color{blue}{\sqrt{-4} \cdot \sqrt{-4}}} \cdot \frac{b}{c} + \frac{a}{b}} \]
      5. rem-square-sqrt55.0%

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

        \[\leadsto \frac{1}{\color{blue}{-1} \cdot \frac{b}{c} + \frac{a}{b}} \]
      7. associate-*r/55.0%

        \[\leadsto \frac{1}{\color{blue}{\frac{-1 \cdot b}{c}} + \frac{a}{b}} \]
      8. mul-1-neg55.0%

        \[\leadsto \frac{1}{\frac{\color{blue}{-b}}{c} + \frac{a}{b}} \]
    12. Simplified55.0%

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

    if 2.39999999999999998e-8 < b

    1. Initial program 14.7%

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

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

      \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{a \cdot 2}} \]
    4. Add Preprocessing
    5. Taylor expanded in b around inf 87.9%

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

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

        \[\leadsto \frac{\color{blue}{-c}}{b} \]
    7. Simplified87.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -1.7 \cdot 10^{-129}:\\ \;\;\;\;\frac{b}{-a}\\ \mathbf{elif}\;b \leq 5.6 \cdot 10^{-105}:\\ \;\;\;\;\frac{\frac{\sqrt{a \cdot \left(c \cdot -4\right)}}{--2}}{a}\\ \mathbf{elif}\;b \leq 9.8 \cdot 10^{-25}:\\ \;\;\;\;\frac{1}{\frac{a}{b} - \frac{b}{c}}\\ \mathbf{elif}\;b \leq 2.4 \cdot 10^{-8}:\\ \;\;\;\;\frac{\frac{\sqrt{a \cdot \left(c \cdot -4\right)}}{--2}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 84.3% accurate, 0.9× speedup?

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

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

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

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


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

    1. Initial program 29.7%

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

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

      \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{a \cdot 2}} \]
    4. Add Preprocessing
    5. Taylor expanded in b around -inf 95.5%

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

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

        \[\leadsto \frac{\color{blue}{-b}}{a} \]
    7. Simplified95.5%

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

    if -1.25000000000000001e154 < b < 2.6499999999999999e-8

    1. Initial program 82.1%

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

    if 2.6499999999999999e-8 < b

    1. Initial program 14.7%

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

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

      \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{a \cdot 2}} \]
    4. Add Preprocessing
    5. Taylor expanded in b around inf 87.9%

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

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

        \[\leadsto \frac{\color{blue}{-c}}{b} \]
    7. Simplified87.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -1.25 \cdot 10^{+154}:\\ \;\;\;\;\frac{b}{-a}\\ \mathbf{elif}\;b \leq 2.65 \cdot 10^{-8}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)} - b}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 42.5% accurate, 12.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq 550000:\\
\;\;\;\;\frac{b}{-a}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < 5.5e5

    1. Initial program 69.2%

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

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

      \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{a \cdot 2}} \]
    4. Add Preprocessing
    5. Taylor expanded in b around -inf 53.5%

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

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

        \[\leadsto \frac{\color{blue}{-b}}{a} \]
    7. Simplified53.5%

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

    if 5.5e5 < b

    1. Initial program 15.0%

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

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

      \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{a \cdot 2}} \]
    4. Add Preprocessing
    5. Taylor expanded in b around inf 71.8%

      \[\leadsto \frac{\color{blue}{-2 \cdot \frac{a \cdot c}{b}}}{a \cdot 2} \]
    6. Step-by-step derivation
      1. frac-2neg71.8%

        \[\leadsto \color{blue}{\frac{--2 \cdot \frac{a \cdot c}{b}}{-a \cdot 2}} \]
      2. div-inv71.8%

        \[\leadsto \color{blue}{\left(--2 \cdot \frac{a \cdot c}{b}\right) \cdot \frac{1}{-a \cdot 2}} \]
      3. associate-*r/71.8%

        \[\leadsto \left(-\color{blue}{\frac{-2 \cdot \left(a \cdot c\right)}{b}}\right) \cdot \frac{1}{-a \cdot 2} \]
      4. distribute-neg-frac271.8%

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

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

        \[\leadsto \frac{\color{blue}{\left(a \cdot -2\right)} \cdot c}{-b} \cdot \frac{1}{-a \cdot 2} \]
      7. add-sqr-sqrt0.0%

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

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

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

        \[\leadsto \frac{\left(a \cdot -2\right) \cdot c}{\color{blue}{\sqrt{b} \cdot \sqrt{b}}} \cdot \frac{1}{-a \cdot 2} \]
      11. add-sqr-sqrt23.2%

        \[\leadsto \frac{\left(a \cdot -2\right) \cdot c}{\color{blue}{b}} \cdot \frac{1}{-a \cdot 2} \]
      12. distribute-rgt-neg-in23.2%

        \[\leadsto \frac{\left(a \cdot -2\right) \cdot c}{b} \cdot \frac{1}{\color{blue}{a \cdot \left(-2\right)}} \]
      13. metadata-eval23.2%

        \[\leadsto \frac{\left(a \cdot -2\right) \cdot c}{b} \cdot \frac{1}{a \cdot \color{blue}{-2}} \]
      14. associate-/r*23.2%

        \[\leadsto \frac{\left(a \cdot -2\right) \cdot c}{b} \cdot \color{blue}{\frac{\frac{1}{a}}{-2}} \]
      15. div-inv23.2%

        \[\leadsto \frac{\left(a \cdot -2\right) \cdot c}{b} \cdot \color{blue}{\left(\frac{1}{a} \cdot \frac{1}{-2}\right)} \]
      16. metadata-eval23.2%

        \[\leadsto \frac{\left(a \cdot -2\right) \cdot c}{b} \cdot \left(\frac{1}{a} \cdot \color{blue}{-0.5}\right) \]
    7. Applied egg-rr23.2%

      \[\leadsto \color{blue}{\frac{\left(a \cdot -2\right) \cdot c}{b} \cdot \left(\frac{1}{a} \cdot -0.5\right)} \]
    8. Step-by-step derivation
      1. *-commutative23.2%

        \[\leadsto \color{blue}{\left(\frac{1}{a} \cdot -0.5\right) \cdot \frac{\left(a \cdot -2\right) \cdot c}{b}} \]
      2. associate-*l/23.2%

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

        \[\leadsto \frac{\color{blue}{-0.5}}{a} \cdot \frac{\left(a \cdot -2\right) \cdot c}{b} \]
      4. associate-/l*23.2%

        \[\leadsto \frac{-0.5}{a} \cdot \color{blue}{\left(\left(a \cdot -2\right) \cdot \frac{c}{b}\right)} \]
    9. Simplified23.2%

      \[\leadsto \color{blue}{\frac{-0.5}{a} \cdot \left(\left(a \cdot -2\right) \cdot \frac{c}{b}\right)} \]
    10. Taylor expanded in a around 0 23.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 550000:\\ \;\;\;\;\frac{b}{-a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b}\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 67.8% accurate, 12.9× speedup?

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

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

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


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

    1. Initial program 71.3%

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

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

      \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{a \cdot 2}} \]
    4. Add Preprocessing
    5. Taylor expanded in b around -inf 67.0%

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

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

        \[\leadsto \frac{\color{blue}{-b}}{a} \]
    7. Simplified67.0%

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

    if 4.4000000000000002e-254 < b

    1. Initial program 31.0%

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

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

      \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{a \cdot 2}} \]
    4. Add Preprocessing
    5. Taylor expanded in b around inf 68.7%

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

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

        \[\leadsto \frac{\color{blue}{-c}}{b} \]
    7. Simplified68.7%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 4.4 \cdot 10^{-254}:\\ \;\;\;\;\frac{b}{-a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 2.5% accurate, 38.7× speedup?

\[\begin{array}{l} \\ \frac{b}{a} \end{array} \]
(FPCore (a b c) :precision binary64 (/ b a))
double code(double a, double b, double c) {
	return b / a;
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    code = b / a
end function
public static double code(double a, double b, double c) {
	return b / a;
}
def code(a, b, c):
	return b / a
function code(a, b, c)
	return Float64(b / a)
end
function tmp = code(a, b, c)
	tmp = b / a;
end
code[a_, b_, c_] := N[(b / a), $MachinePrecision]
\begin{array}{l}

\\
\frac{b}{a}
\end{array}
Derivation
  1. Initial program 53.5%

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

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

    \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{a \cdot 2}} \]
  4. Add Preprocessing
  5. Applied egg-rr24.7%

    \[\leadsto \color{blue}{\frac{0.5}{a} \cdot \left(b + \mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -4\right)}\right)\right)} \]
  6. Taylor expanded in a around 0 2.2%

    \[\leadsto \color{blue}{\frac{b}{a}} \]
  7. Final simplification2.2%

    \[\leadsto \frac{b}{a} \]
  8. Add Preprocessing

Alternative 11: 10.9% accurate, 38.7× speedup?

\[\begin{array}{l} \\ \frac{c}{b} \end{array} \]
(FPCore (a b c) :precision binary64 (/ c b))
double code(double a, double b, double c) {
	return c / b;
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    code = c / b
end function
public static double code(double a, double b, double c) {
	return c / b;
}
def code(a, b, c):
	return c / b
function code(a, b, c)
	return Float64(c / b)
end
function tmp = code(a, b, c)
	tmp = c / b;
end
code[a_, b_, c_] := N[(c / b), $MachinePrecision]
\begin{array}{l}

\\
\frac{c}{b}
\end{array}
Derivation
  1. Initial program 53.5%

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

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

    \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{a \cdot 2}} \]
  4. Add Preprocessing
  5. Taylor expanded in b around inf 24.4%

    \[\leadsto \frac{\color{blue}{-2 \cdot \frac{a \cdot c}{b}}}{a \cdot 2} \]
  6. Step-by-step derivation
    1. frac-2neg24.4%

      \[\leadsto \color{blue}{\frac{--2 \cdot \frac{a \cdot c}{b}}{-a \cdot 2}} \]
    2. div-inv24.4%

      \[\leadsto \color{blue}{\left(--2 \cdot \frac{a \cdot c}{b}\right) \cdot \frac{1}{-a \cdot 2}} \]
    3. associate-*r/24.4%

      \[\leadsto \left(-\color{blue}{\frac{-2 \cdot \left(a \cdot c\right)}{b}}\right) \cdot \frac{1}{-a \cdot 2} \]
    4. distribute-neg-frac224.4%

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

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

      \[\leadsto \frac{\color{blue}{\left(a \cdot -2\right)} \cdot c}{-b} \cdot \frac{1}{-a \cdot 2} \]
    7. add-sqr-sqrt1.2%

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

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

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

      \[\leadsto \frac{\left(a \cdot -2\right) \cdot c}{\color{blue}{\sqrt{b} \cdot \sqrt{b}}} \cdot \frac{1}{-a \cdot 2} \]
    11. add-sqr-sqrt8.9%

      \[\leadsto \frac{\left(a \cdot -2\right) \cdot c}{\color{blue}{b}} \cdot \frac{1}{-a \cdot 2} \]
    12. distribute-rgt-neg-in8.9%

      \[\leadsto \frac{\left(a \cdot -2\right) \cdot c}{b} \cdot \frac{1}{\color{blue}{a \cdot \left(-2\right)}} \]
    13. metadata-eval8.9%

      \[\leadsto \frac{\left(a \cdot -2\right) \cdot c}{b} \cdot \frac{1}{a \cdot \color{blue}{-2}} \]
    14. associate-/r*8.9%

      \[\leadsto \frac{\left(a \cdot -2\right) \cdot c}{b} \cdot \color{blue}{\frac{\frac{1}{a}}{-2}} \]
    15. div-inv8.9%

      \[\leadsto \frac{\left(a \cdot -2\right) \cdot c}{b} \cdot \color{blue}{\left(\frac{1}{a} \cdot \frac{1}{-2}\right)} \]
    16. metadata-eval8.9%

      \[\leadsto \frac{\left(a \cdot -2\right) \cdot c}{b} \cdot \left(\frac{1}{a} \cdot \color{blue}{-0.5}\right) \]
  7. Applied egg-rr8.9%

    \[\leadsto \color{blue}{\frac{\left(a \cdot -2\right) \cdot c}{b} \cdot \left(\frac{1}{a} \cdot -0.5\right)} \]
  8. Step-by-step derivation
    1. *-commutative8.9%

      \[\leadsto \color{blue}{\left(\frac{1}{a} \cdot -0.5\right) \cdot \frac{\left(a \cdot -2\right) \cdot c}{b}} \]
    2. associate-*l/8.9%

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

      \[\leadsto \frac{\color{blue}{-0.5}}{a} \cdot \frac{\left(a \cdot -2\right) \cdot c}{b} \]
    4. associate-/l*9.0%

      \[\leadsto \frac{-0.5}{a} \cdot \color{blue}{\left(\left(a \cdot -2\right) \cdot \frac{c}{b}\right)} \]
  9. Simplified9.0%

    \[\leadsto \color{blue}{\frac{-0.5}{a} \cdot \left(\left(a \cdot -2\right) \cdot \frac{c}{b}\right)} \]
  10. Taylor expanded in a around 0 9.0%

    \[\leadsto \color{blue}{\frac{c}{b}} \]
  11. Final simplification9.0%

    \[\leadsto \frac{c}{b} \]
  12. Add Preprocessing

Developer target: 99.7% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left|\frac{b}{2}\right|\\ t_1 := \sqrt{\left|a\right|} \cdot \sqrt{\left|c\right|}\\ t_2 := \begin{array}{l} \mathbf{if}\;\mathsf{copysign}\left(a, c\right) = a:\\ \;\;\;\;\sqrt{t\_0 - t\_1} \cdot \sqrt{t\_0 + t\_1}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{hypot}\left(\frac{b}{2}, t\_1\right)\\ \end{array}\\ \mathbf{if}\;b < 0:\\ \;\;\;\;\frac{t\_2 - \frac{b}{2}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{\frac{b}{2} + t\_2}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (fabs (/ b 2.0)))
        (t_1 (* (sqrt (fabs a)) (sqrt (fabs c))))
        (t_2
         (if (== (copysign a c) a)
           (* (sqrt (- t_0 t_1)) (sqrt (+ t_0 t_1)))
           (hypot (/ b 2.0) t_1))))
   (if (< b 0.0) (/ (- t_2 (/ b 2.0)) a) (/ (- c) (+ (/ b 2.0) t_2)))))
double code(double a, double b, double c) {
	double t_0 = fabs((b / 2.0));
	double t_1 = sqrt(fabs(a)) * sqrt(fabs(c));
	double tmp;
	if (copysign(a, c) == a) {
		tmp = sqrt((t_0 - t_1)) * sqrt((t_0 + t_1));
	} else {
		tmp = hypot((b / 2.0), t_1);
	}
	double t_2 = tmp;
	double tmp_1;
	if (b < 0.0) {
		tmp_1 = (t_2 - (b / 2.0)) / a;
	} else {
		tmp_1 = -c / ((b / 2.0) + t_2);
	}
	return tmp_1;
}
public static double code(double a, double b, double c) {
	double t_0 = Math.abs((b / 2.0));
	double t_1 = Math.sqrt(Math.abs(a)) * Math.sqrt(Math.abs(c));
	double tmp;
	if (Math.copySign(a, c) == a) {
		tmp = Math.sqrt((t_0 - t_1)) * Math.sqrt((t_0 + t_1));
	} else {
		tmp = Math.hypot((b / 2.0), t_1);
	}
	double t_2 = tmp;
	double tmp_1;
	if (b < 0.0) {
		tmp_1 = (t_2 - (b / 2.0)) / a;
	} else {
		tmp_1 = -c / ((b / 2.0) + t_2);
	}
	return tmp_1;
}
def code(a, b, c):
	t_0 = math.fabs((b / 2.0))
	t_1 = math.sqrt(math.fabs(a)) * math.sqrt(math.fabs(c))
	tmp = 0
	if math.copysign(a, c) == a:
		tmp = math.sqrt((t_0 - t_1)) * math.sqrt((t_0 + t_1))
	else:
		tmp = math.hypot((b / 2.0), t_1)
	t_2 = tmp
	tmp_1 = 0
	if b < 0.0:
		tmp_1 = (t_2 - (b / 2.0)) / a
	else:
		tmp_1 = -c / ((b / 2.0) + t_2)
	return tmp_1
function code(a, b, c)
	t_0 = abs(Float64(b / 2.0))
	t_1 = Float64(sqrt(abs(a)) * sqrt(abs(c)))
	tmp = 0.0
	if (copysign(a, c) == a)
		tmp = Float64(sqrt(Float64(t_0 - t_1)) * sqrt(Float64(t_0 + t_1)));
	else
		tmp = hypot(Float64(b / 2.0), t_1);
	end
	t_2 = tmp
	tmp_1 = 0.0
	if (b < 0.0)
		tmp_1 = Float64(Float64(t_2 - Float64(b / 2.0)) / a);
	else
		tmp_1 = Float64(Float64(-c) / Float64(Float64(b / 2.0) + t_2));
	end
	return tmp_1
end
function tmp_3 = code(a, b, c)
	t_0 = abs((b / 2.0));
	t_1 = sqrt(abs(a)) * sqrt(abs(c));
	tmp = 0.0;
	if ((sign(c) * abs(a)) == a)
		tmp = sqrt((t_0 - t_1)) * sqrt((t_0 + t_1));
	else
		tmp = hypot((b / 2.0), t_1);
	end
	t_2 = tmp;
	tmp_2 = 0.0;
	if (b < 0.0)
		tmp_2 = (t_2 - (b / 2.0)) / a;
	else
		tmp_2 = -c / ((b / 2.0) + t_2);
	end
	tmp_3 = tmp_2;
end
code[a_, b_, c_] := Block[{t$95$0 = N[Abs[N[(b / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Sqrt[N[Abs[a], $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[Abs[c], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = If[Equal[N[With[{TMP1 = Abs[a], TMP2 = Sign[c]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision], a], N[(N[Sqrt[N[(t$95$0 - t$95$1), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(t$95$0 + t$95$1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(b / 2.0), $MachinePrecision] ^ 2 + t$95$1 ^ 2], $MachinePrecision]]}, If[Less[b, 0.0], N[(N[(t$95$2 - N[(b / 2.0), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[((-c) / N[(N[(b / 2.0), $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left|\frac{b}{2}\right|\\
t_1 := \sqrt{\left|a\right|} \cdot \sqrt{\left|c\right|}\\
t_2 := \begin{array}{l}
\mathbf{if}\;\mathsf{copysign}\left(a, c\right) = a:\\
\;\;\;\;\sqrt{t\_0 - t\_1} \cdot \sqrt{t\_0 + t\_1}\\

\mathbf{else}:\\
\;\;\;\;\mathsf{hypot}\left(\frac{b}{2}, t\_1\right)\\


\end{array}\\
\mathbf{if}\;b < 0:\\
\;\;\;\;\frac{t\_2 - \frac{b}{2}}{a}\\

\mathbf{else}:\\
\;\;\;\;\frac{-c}{\frac{b}{2} + t\_2}\\


\end{array}
\end{array}

Reproduce

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

  :alt
  (if (< b 0.0) (/ (- (if (== (copysign a c) a) (* (sqrt (- (fabs (/ b 2.0)) (* (sqrt (fabs a)) (sqrt (fabs c))))) (sqrt (+ (fabs (/ b 2.0)) (* (sqrt (fabs a)) (sqrt (fabs c)))))) (hypot (/ b 2.0) (* (sqrt (fabs a)) (sqrt (fabs c))))) (/ b 2.0)) a) (/ (- c) (+ (/ b 2.0) (if (== (copysign a c) a) (* (sqrt (- (fabs (/ b 2.0)) (* (sqrt (fabs a)) (sqrt (fabs c))))) (sqrt (+ (fabs (/ b 2.0)) (* (sqrt (fabs a)) (sqrt (fabs c)))))) (hypot (/ b 2.0) (* (sqrt (fabs a)) (sqrt (fabs c))))))))

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