quadp (p42, positive)

Percentage Accurate: 52.4% → 88.0%
Time: 14.2s
Alternatives: 14
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 14 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 52.4% 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: 88.0% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := a \cdot \left(4 \cdot c\right)\\ \mathbf{if}\;b \leq -6 \cdot 10^{+138}:\\ \;\;\;\;\frac{b}{-a}\\ \mathbf{elif}\;b \leq 4.6 \cdot 10^{-112}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)} - b}{a \cdot 2}\\ \mathbf{elif}\;b \leq 2.05 \cdot 10^{+33}:\\ \;\;\;\;\frac{\frac{\left({b}^{2} - {b}^{2}\right) - t\_0}{b + \sqrt{{b}^{2} - t\_0}}}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{-b}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (* a (* 4.0 c))))
   (if (<= b -6e+138)
     (/ b (- a))
     (if (<= b 4.6e-112)
       (/ (- (sqrt (- (* b b) (* 4.0 (* a c)))) b) (* a 2.0))
       (if (<= b 2.05e+33)
         (/
          (/
           (- (- (pow b 2.0) (pow b 2.0)) t_0)
           (+ b (sqrt (- (pow b 2.0) t_0))))
          (* a 2.0))
         (/ c (- b)))))))
double code(double a, double b, double c) {
	double t_0 = a * (4.0 * c);
	double tmp;
	if (b <= -6e+138) {
		tmp = b / -a;
	} else if (b <= 4.6e-112) {
		tmp = (sqrt(((b * b) - (4.0 * (a * c)))) - b) / (a * 2.0);
	} else if (b <= 2.05e+33) {
		tmp = (((pow(b, 2.0) - pow(b, 2.0)) - t_0) / (b + sqrt((pow(b, 2.0) - t_0)))) / (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) :: t_0
    real(8) :: tmp
    t_0 = a * (4.0d0 * c)
    if (b <= (-6d+138)) then
        tmp = b / -a
    else if (b <= 4.6d-112) then
        tmp = (sqrt(((b * b) - (4.0d0 * (a * c)))) - b) / (a * 2.0d0)
    else if (b <= 2.05d+33) then
        tmp = ((((b ** 2.0d0) - (b ** 2.0d0)) - t_0) / (b + sqrt(((b ** 2.0d0) - t_0)))) / (a * 2.0d0)
    else
        tmp = c / -b
    end if
    code = tmp
end function
public static double code(double a, double b, double c) {
	double t_0 = a * (4.0 * c);
	double tmp;
	if (b <= -6e+138) {
		tmp = b / -a;
	} else if (b <= 4.6e-112) {
		tmp = (Math.sqrt(((b * b) - (4.0 * (a * c)))) - b) / (a * 2.0);
	} else if (b <= 2.05e+33) {
		tmp = (((Math.pow(b, 2.0) - Math.pow(b, 2.0)) - t_0) / (b + Math.sqrt((Math.pow(b, 2.0) - t_0)))) / (a * 2.0);
	} else {
		tmp = c / -b;
	}
	return tmp;
}
def code(a, b, c):
	t_0 = a * (4.0 * c)
	tmp = 0
	if b <= -6e+138:
		tmp = b / -a
	elif b <= 4.6e-112:
		tmp = (math.sqrt(((b * b) - (4.0 * (a * c)))) - b) / (a * 2.0)
	elif b <= 2.05e+33:
		tmp = (((math.pow(b, 2.0) - math.pow(b, 2.0)) - t_0) / (b + math.sqrt((math.pow(b, 2.0) - t_0)))) / (a * 2.0)
	else:
		tmp = c / -b
	return tmp
function code(a, b, c)
	t_0 = Float64(a * Float64(4.0 * c))
	tmp = 0.0
	if (b <= -6e+138)
		tmp = Float64(b / Float64(-a));
	elseif (b <= 4.6e-112)
		tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(4.0 * Float64(a * c)))) - b) / Float64(a * 2.0));
	elseif (b <= 2.05e+33)
		tmp = Float64(Float64(Float64(Float64((b ^ 2.0) - (b ^ 2.0)) - t_0) / Float64(b + sqrt(Float64((b ^ 2.0) - t_0)))) / Float64(a * 2.0));
	else
		tmp = Float64(c / Float64(-b));
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	t_0 = a * (4.0 * c);
	tmp = 0.0;
	if (b <= -6e+138)
		tmp = b / -a;
	elseif (b <= 4.6e-112)
		tmp = (sqrt(((b * b) - (4.0 * (a * c)))) - b) / (a * 2.0);
	elseif (b <= 2.05e+33)
		tmp = ((((b ^ 2.0) - (b ^ 2.0)) - t_0) / (b + sqrt(((b ^ 2.0) - t_0)))) / (a * 2.0);
	else
		tmp = c / -b;
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := Block[{t$95$0 = N[(a * N[(4.0 * c), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -6e+138], N[(b / (-a)), $MachinePrecision], If[LessEqual[b, 4.6e-112], 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], If[LessEqual[b, 2.05e+33], N[(N[(N[(N[(N[Power[b, 2.0], $MachinePrecision] - N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision] / N[(b + N[Sqrt[N[(N[Power[b, 2.0], $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[(c / (-b)), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := a \cdot \left(4 \cdot c\right)\\
\mathbf{if}\;b \leq -6 \cdot 10^{+138}:\\
\;\;\;\;\frac{b}{-a}\\

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

\mathbf{elif}\;b \leq 2.05 \cdot 10^{+33}:\\
\;\;\;\;\frac{\frac{\left({b}^{2} - {b}^{2}\right) - t\_0}{b + \sqrt{{b}^{2} - t\_0}}}{a \cdot 2}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if b < -6.0000000000000002e138

    1. Initial program 46.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. *-commutative46.6%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{\color{blue}{a \cdot 2}} \]
    3. Simplified46.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 -inf 94.4%

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

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

        \[\leadsto \frac{\color{blue}{-b}}{a} \]
    7. Simplified94.4%

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

    if -6.0000000000000002e138 < b < 4.59999999999999981e-112

    1. Initial program 85.3%

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

    if 4.59999999999999981e-112 < b < 2.04999999999999997e33

    1. Initial program 49.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. *-commutative49.9%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{\color{blue}{a \cdot 2}} \]
    3. Simplified49.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. Step-by-step derivation
      1. add-cube-cbrt49.5%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{{\left(-b\right)}^{2} - \left({b}^{2} - \color{blue}{\left(\sqrt[3]{a \cdot \left(c \cdot 4\right)} \cdot \sqrt[3]{a \cdot \left(c \cdot 4\right)}\right) \cdot \sqrt[3]{a \cdot \left(c \cdot 4\right)}}\right)}{\left(-b\right) - \sqrt{b \cdot b - {\left(\sqrt[3]{a \cdot \left(c \cdot 4\right)}\right)}^{3}}}}{a \cdot 2} \]
      7. add-cube-cbrt49.6%

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

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

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

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

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

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

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

    if 2.04999999999999997e33 < b

    1. Initial program 8.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. *-commutative8.2%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{\color{blue}{a \cdot 2}} \]
    3. Simplified8.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 88.7%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -6 \cdot 10^{+138}:\\ \;\;\;\;\frac{b}{-a}\\ \mathbf{elif}\;b \leq 4.6 \cdot 10^{-112}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)} - b}{a \cdot 2}\\ \mathbf{elif}\;b \leq 2.05 \cdot 10^{+33}:\\ \;\;\;\;\frac{\frac{\left({b}^{2} - {b}^{2}\right) - a \cdot \left(4 \cdot c\right)}{b + \sqrt{{b}^{2} - a \cdot \left(4 \cdot c\right)}}}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{-b}\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 86.2% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -1 \cdot 10^{+140}:\\ \;\;\;\;\frac{b}{-a}\\ \mathbf{elif}\;b \leq 8.5 \cdot 10^{-15}:\\ \;\;\;\;\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 -1e+140)
   (/ b (- a))
   (if (<= b 8.5e-15)
     (/ (- (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 <= -1e+140) {
		tmp = b / -a;
	} else if (b <= 8.5e-15) {
		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 <= (-1d+140)) then
        tmp = b / -a
    else if (b <= 8.5d-15) 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 <= -1e+140) {
		tmp = b / -a;
	} else if (b <= 8.5e-15) {
		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 <= -1e+140:
		tmp = b / -a
	elif b <= 8.5e-15:
		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 <= -1e+140)
		tmp = Float64(b / Float64(-a));
	elseif (b <= 8.5e-15)
		tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(4.0 * Float64(a * c)))) - b) / Float64(a * 2.0));
	else
		tmp = Float64(c / Float64(-b));
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	tmp = 0.0;
	if (b <= -1e+140)
		tmp = b / -a;
	elseif (b <= 8.5e-15)
		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, -1e+140], N[(b / (-a)), $MachinePrecision], If[LessEqual[b, 8.5e-15], 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 \cdot 10^{+140}:\\
\;\;\;\;\frac{b}{-a}\\

\mathbf{elif}\;b \leq 8.5 \cdot 10^{-15}:\\
\;\;\;\;\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.00000000000000006e140

    1. Initial program 46.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. *-commutative46.6%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{\color{blue}{a \cdot 2}} \]
    3. Simplified46.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 -inf 94.4%

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

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

        \[\leadsto \frac{\color{blue}{-b}}{a} \]
    7. Simplified94.4%

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

    if -1.00000000000000006e140 < b < 8.50000000000000007e-15

    1. Initial program 80.6%

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

    if 8.50000000000000007e-15 < b

    1. Initial program 10.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. *-commutative10.3%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{\color{blue}{a \cdot 2}} \]
    3. Simplified10.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 87.7%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -1 \cdot 10^{+140}:\\ \;\;\;\;\frac{b}{-a}\\ \mathbf{elif}\;b \leq 8.5 \cdot 10^{-15}:\\ \;\;\;\;\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: 70.8% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq -8.2 \cdot 10^{-97}:\\
\;\;\;\;b \cdot \left(\frac{c}{{b}^{2}} + \frac{-1}{a}\right)\\

\mathbf{elif}\;b \leq -1.05 \cdot 10^{-241}:\\
\;\;\;\;\sqrt{\left(-4 \cdot \frac{c}{a}\right) \cdot 0.25}\\

\mathbf{elif}\;b \leq 9 \cdot 10^{-163}:\\
\;\;\;\;-0.5 \cdot \frac{1}{\sqrt{-0.25 \cdot \frac{a}{c}}}\\

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


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

    1. Initial program 70.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. *-commutative70.0%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{\color{blue}{a \cdot 2}} \]
    3. Simplified70.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 82.9%

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

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

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

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

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

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

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

    if -8.19999999999999986e-97 < b < -1.05e-241

    1. Initial program 88.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. *-commutative88.9%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{\color{blue}{a \cdot 2}} \]
    3. Simplified88.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. Step-by-step derivation
      1. add-cube-cbrt88.1%

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

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

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

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

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{{\left(\sqrt[3]{a \cdot \left(c \cdot 4\right)}\right)}^{3}}}}{a \cdot 2} \]
    7. Taylor expanded in a around -inf 0.0%

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

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

        \[\leadsto -0.5 \cdot \left(\color{blue}{\left(\sqrt{-1} \cdot \sqrt{-1}\right)} \cdot \sqrt{\frac{c \cdot {\left(\sqrt[3]{-4}\right)}^{3}}{a}}\right) \]
      3. rem-square-sqrt57.3%

        \[\leadsto -0.5 \cdot \left(\color{blue}{-1} \cdot \sqrt{\frac{c \cdot {\left(\sqrt[3]{-4}\right)}^{3}}{a}}\right) \]
      4. rem-cube-cbrt57.7%

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

        \[\leadsto -0.5 \cdot \left(-1 \cdot \sqrt{\color{blue}{c \cdot \frac{-4}{a}}}\right) \]
    9. Simplified57.7%

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

        \[\leadsto -0.5 \cdot \left(-1 \cdot \sqrt{\color{blue}{\frac{c \cdot -4}{a}}}\right) \]
    11. Applied egg-rr57.7%

      \[\leadsto -0.5 \cdot \left(-1 \cdot \sqrt{\color{blue}{\frac{c \cdot -4}{a}}}\right) \]
    12. Step-by-step derivation
      1. add-sqr-sqrt57.5%

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

        \[\leadsto \color{blue}{\sqrt{\left(-0.5 \cdot \left(-1 \cdot \sqrt{\frac{c \cdot -4}{a}}\right)\right) \cdot \left(-0.5 \cdot \left(-1 \cdot \sqrt{\frac{c \cdot -4}{a}}\right)\right)}} \]
      3. *-commutative57.7%

        \[\leadsto \sqrt{\color{blue}{\left(\left(-1 \cdot \sqrt{\frac{c \cdot -4}{a}}\right) \cdot -0.5\right)} \cdot \left(-0.5 \cdot \left(-1 \cdot \sqrt{\frac{c \cdot -4}{a}}\right)\right)} \]
      4. *-commutative57.7%

        \[\leadsto \sqrt{\left(\left(-1 \cdot \sqrt{\frac{c \cdot -4}{a}}\right) \cdot -0.5\right) \cdot \color{blue}{\left(\left(-1 \cdot \sqrt{\frac{c \cdot -4}{a}}\right) \cdot -0.5\right)}} \]
      5. swap-sqr57.7%

        \[\leadsto \sqrt{\color{blue}{\left(\left(-1 \cdot \sqrt{\frac{c \cdot -4}{a}}\right) \cdot \left(-1 \cdot \sqrt{\frac{c \cdot -4}{a}}\right)\right) \cdot \left(-0.5 \cdot -0.5\right)}} \]
      6. mul-1-neg57.7%

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

        \[\leadsto \sqrt{\left(\left(-\sqrt{\frac{c \cdot -4}{a}}\right) \cdot \color{blue}{\left(-\sqrt{\frac{c \cdot -4}{a}}\right)}\right) \cdot \left(-0.5 \cdot -0.5\right)} \]
      8. sqr-neg57.7%

        \[\leadsto \sqrt{\color{blue}{\left(\sqrt{\frac{c \cdot -4}{a}} \cdot \sqrt{\frac{c \cdot -4}{a}}\right)} \cdot \left(-0.5 \cdot -0.5\right)} \]
      9. add-sqr-sqrt57.7%

        \[\leadsto \sqrt{\color{blue}{\frac{c \cdot -4}{a}} \cdot \left(-0.5 \cdot -0.5\right)} \]
      10. *-commutative57.7%

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

        \[\leadsto \sqrt{\color{blue}{\left(-4 \cdot \frac{c}{a}\right)} \cdot \left(-0.5 \cdot -0.5\right)} \]
      12. metadata-eval57.7%

        \[\leadsto \sqrt{\left(-4 \cdot \frac{c}{a}\right) \cdot \color{blue}{0.25}} \]
    13. Applied egg-rr57.7%

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

    if -1.05e-241 < b < 8.9999999999999995e-163

    1. Initial program 82.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. *-commutative82.8%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{\color{blue}{a \cdot 2}} \]
    3. Simplified82.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. Step-by-step derivation
      1. add-cube-cbrt82.4%

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

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

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

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

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{{\left(\sqrt[3]{a \cdot \left(c \cdot 4\right)}\right)}^{3}}}}{a \cdot 2} \]
    7. Taylor expanded in a around -inf 0.0%

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

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

        \[\leadsto -0.5 \cdot \left(\color{blue}{\left(\sqrt{-1} \cdot \sqrt{-1}\right)} \cdot \sqrt{\frac{c \cdot {\left(\sqrt[3]{-4}\right)}^{3}}{a}}\right) \]
      3. rem-square-sqrt28.0%

        \[\leadsto -0.5 \cdot \left(\color{blue}{-1} \cdot \sqrt{\frac{c \cdot {\left(\sqrt[3]{-4}\right)}^{3}}{a}}\right) \]
      4. rem-cube-cbrt28.1%

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

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

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

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

      \[\leadsto -0.5 \cdot \left(-1 \cdot \sqrt{\color{blue}{\frac{c \cdot -4}{a}}}\right) \]
    12. Step-by-step derivation
      1. add-sqr-sqrt0.8%

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

        \[\leadsto -0.5 \cdot \color{blue}{\sqrt{\left(-1 \cdot \sqrt{\frac{c \cdot -4}{a}}\right) \cdot \left(-1 \cdot \sqrt{\frac{c \cdot -4}{a}}\right)}} \]
      3. mul-1-neg42.9%

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

        \[\leadsto -0.5 \cdot \sqrt{\left(-\sqrt{\frac{c \cdot -4}{a}}\right) \cdot \color{blue}{\left(-\sqrt{\frac{c \cdot -4}{a}}\right)}} \]
      5. sqr-neg42.9%

        \[\leadsto -0.5 \cdot \sqrt{\color{blue}{\sqrt{\frac{c \cdot -4}{a}} \cdot \sqrt{\frac{c \cdot -4}{a}}}} \]
      6. add-sqr-sqrt42.9%

        \[\leadsto -0.5 \cdot \sqrt{\color{blue}{\frac{c \cdot -4}{a}}} \]
      7. clear-num42.8%

        \[\leadsto -0.5 \cdot \sqrt{\color{blue}{\frac{1}{\frac{a}{c \cdot -4}}}} \]
      8. sqrt-div45.0%

        \[\leadsto -0.5 \cdot \color{blue}{\frac{\sqrt{1}}{\sqrt{\frac{a}{c \cdot -4}}}} \]
      9. metadata-eval45.0%

        \[\leadsto -0.5 \cdot \frac{\color{blue}{1}}{\sqrt{\frac{a}{c \cdot -4}}} \]
      10. *-un-lft-identity45.0%

        \[\leadsto -0.5 \cdot \frac{1}{\sqrt{\frac{\color{blue}{1 \cdot a}}{c \cdot -4}}} \]
      11. *-commutative45.0%

        \[\leadsto -0.5 \cdot \frac{1}{\sqrt{\frac{1 \cdot a}{\color{blue}{-4 \cdot c}}}} \]
      12. times-frac45.0%

        \[\leadsto -0.5 \cdot \frac{1}{\sqrt{\color{blue}{\frac{1}{-4} \cdot \frac{a}{c}}}} \]
      13. metadata-eval45.0%

        \[\leadsto -0.5 \cdot \frac{1}{\sqrt{\color{blue}{-0.25} \cdot \frac{a}{c}}} \]
    13. Applied egg-rr45.0%

      \[\leadsto -0.5 \cdot \color{blue}{\frac{1}{\sqrt{-0.25 \cdot \frac{a}{c}}}} \]

    if 8.9999999999999995e-163 < b

    1. Initial program 21.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. *-commutative21.6%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{\color{blue}{a \cdot 2}} \]
    3. Simplified21.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. Step-by-step derivation
      1. add-exp-log14.3%

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

        \[\leadsto e^{\log \color{blue}{\left(\frac{-\left(\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}\right)}{-a \cdot 2}\right)}} \]
    6. Applied egg-rr14.3%

      \[\leadsto \color{blue}{e^{\log \left(\frac{b - \sqrt{\mathsf{fma}\left(a \cdot c, -4, {b}^{2}\right)}}{a \cdot -2}\right)}} \]
    7. Step-by-step derivation
      1. rem-exp-log21.6%

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

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

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

      \[\leadsto \frac{1}{\color{blue}{-1 \cdot \frac{b}{c} + \frac{a}{b}}} \]
    10. Step-by-step derivation
      1. +-commutative76.3%

        \[\leadsto \frac{1}{\color{blue}{\frac{a}{b} + -1 \cdot \frac{b}{c}}} \]
      2. mul-1-neg76.3%

        \[\leadsto \frac{1}{\frac{a}{b} + \color{blue}{\left(-\frac{b}{c}\right)}} \]
      3. unsub-neg76.3%

        \[\leadsto \frac{1}{\color{blue}{\frac{a}{b} - \frac{b}{c}}} \]
    11. Simplified76.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -8.2 \cdot 10^{-97}:\\ \;\;\;\;b \cdot \left(\frac{c}{{b}^{2}} + \frac{-1}{a}\right)\\ \mathbf{elif}\;b \leq -1.05 \cdot 10^{-241}:\\ \;\;\;\;\sqrt{\left(-4 \cdot \frac{c}{a}\right) \cdot 0.25}\\ \mathbf{elif}\;b \leq 9 \cdot 10^{-163}:\\ \;\;\;\;-0.5 \cdot \frac{1}{\sqrt{-0.25 \cdot \frac{a}{c}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{a}{b} - \frac{b}{c}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 70.8% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -8.4 \cdot 10^{-97}:\\ \;\;\;\;\frac{b}{-a}\\ \mathbf{elif}\;b \leq -2.4 \cdot 10^{-242}:\\ \;\;\;\;\sqrt{\left(-4 \cdot \frac{c}{a}\right) \cdot 0.25}\\ \mathbf{elif}\;b \leq 1.05 \cdot 10^{-162}:\\ \;\;\;\;-0.5 \cdot \frac{1}{\sqrt{-0.25 \cdot \frac{a}{c}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{a}{b} - \frac{b}{c}}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b -8.4e-97)
   (/ b (- a))
   (if (<= b -2.4e-242)
     (sqrt (* (* -4.0 (/ c a)) 0.25))
     (if (<= b 1.05e-162)
       (* -0.5 (/ 1.0 (sqrt (* -0.25 (/ a c)))))
       (/ 1.0 (- (/ a b) (/ b c)))))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= -8.4e-97) {
		tmp = b / -a;
	} else if (b <= -2.4e-242) {
		tmp = sqrt(((-4.0 * (c / a)) * 0.25));
	} else if (b <= 1.05e-162) {
		tmp = -0.5 * (1.0 / sqrt((-0.25 * (a / c))));
	} else {
		tmp = 1.0 / ((a / b) - (b / c));
	}
	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 <= (-8.4d-97)) then
        tmp = b / -a
    else if (b <= (-2.4d-242)) then
        tmp = sqrt((((-4.0d0) * (c / a)) * 0.25d0))
    else if (b <= 1.05d-162) then
        tmp = (-0.5d0) * (1.0d0 / sqrt(((-0.25d0) * (a / c))))
    else
        tmp = 1.0d0 / ((a / b) - (b / c))
    end if
    code = tmp
end function
public static double code(double a, double b, double c) {
	double tmp;
	if (b <= -8.4e-97) {
		tmp = b / -a;
	} else if (b <= -2.4e-242) {
		tmp = Math.sqrt(((-4.0 * (c / a)) * 0.25));
	} else if (b <= 1.05e-162) {
		tmp = -0.5 * (1.0 / Math.sqrt((-0.25 * (a / c))));
	} else {
		tmp = 1.0 / ((a / b) - (b / c));
	}
	return tmp;
}
def code(a, b, c):
	tmp = 0
	if b <= -8.4e-97:
		tmp = b / -a
	elif b <= -2.4e-242:
		tmp = math.sqrt(((-4.0 * (c / a)) * 0.25))
	elif b <= 1.05e-162:
		tmp = -0.5 * (1.0 / math.sqrt((-0.25 * (a / c))))
	else:
		tmp = 1.0 / ((a / b) - (b / c))
	return tmp
function code(a, b, c)
	tmp = 0.0
	if (b <= -8.4e-97)
		tmp = Float64(b / Float64(-a));
	elseif (b <= -2.4e-242)
		tmp = sqrt(Float64(Float64(-4.0 * Float64(c / a)) * 0.25));
	elseif (b <= 1.05e-162)
		tmp = Float64(-0.5 * Float64(1.0 / sqrt(Float64(-0.25 * Float64(a / c)))));
	else
		tmp = Float64(1.0 / Float64(Float64(a / b) - Float64(b / c)));
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	tmp = 0.0;
	if (b <= -8.4e-97)
		tmp = b / -a;
	elseif (b <= -2.4e-242)
		tmp = sqrt(((-4.0 * (c / a)) * 0.25));
	elseif (b <= 1.05e-162)
		tmp = -0.5 * (1.0 / sqrt((-0.25 * (a / c))));
	else
		tmp = 1.0 / ((a / b) - (b / c));
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := If[LessEqual[b, -8.4e-97], N[(b / (-a)), $MachinePrecision], If[LessEqual[b, -2.4e-242], N[Sqrt[N[(N[(-4.0 * N[(c / a), $MachinePrecision]), $MachinePrecision] * 0.25), $MachinePrecision]], $MachinePrecision], If[LessEqual[b, 1.05e-162], N[(-0.5 * N[(1.0 / N[Sqrt[N[(-0.25 * N[(a / c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(a / b), $MachinePrecision] - N[(b / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;b \leq 1.05 \cdot 10^{-162}:\\
\;\;\;\;-0.5 \cdot \frac{1}{\sqrt{-0.25 \cdot \frac{a}{c}}}\\

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


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

    1. Initial program 70.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. *-commutative70.0%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{\color{blue}{a \cdot 2}} \]
    3. Simplified70.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 82.7%

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

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

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

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

    if -8.4000000000000005e-97 < b < -2.4000000000000001e-242

    1. Initial program 88.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. *-commutative88.9%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{\color{blue}{a \cdot 2}} \]
    3. Simplified88.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. Step-by-step derivation
      1. add-cube-cbrt88.1%

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

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

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

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

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{{\left(\sqrt[3]{a \cdot \left(c \cdot 4\right)}\right)}^{3}}}}{a \cdot 2} \]
    7. Taylor expanded in a around -inf 0.0%

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

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

        \[\leadsto -0.5 \cdot \left(\color{blue}{\left(\sqrt{-1} \cdot \sqrt{-1}\right)} \cdot \sqrt{\frac{c \cdot {\left(\sqrt[3]{-4}\right)}^{3}}{a}}\right) \]
      3. rem-square-sqrt57.3%

        \[\leadsto -0.5 \cdot \left(\color{blue}{-1} \cdot \sqrt{\frac{c \cdot {\left(\sqrt[3]{-4}\right)}^{3}}{a}}\right) \]
      4. rem-cube-cbrt57.7%

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

        \[\leadsto -0.5 \cdot \left(-1 \cdot \sqrt{\color{blue}{c \cdot \frac{-4}{a}}}\right) \]
    9. Simplified57.7%

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

        \[\leadsto -0.5 \cdot \left(-1 \cdot \sqrt{\color{blue}{\frac{c \cdot -4}{a}}}\right) \]
    11. Applied egg-rr57.7%

      \[\leadsto -0.5 \cdot \left(-1 \cdot \sqrt{\color{blue}{\frac{c \cdot -4}{a}}}\right) \]
    12. Step-by-step derivation
      1. add-sqr-sqrt57.5%

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

        \[\leadsto \color{blue}{\sqrt{\left(-0.5 \cdot \left(-1 \cdot \sqrt{\frac{c \cdot -4}{a}}\right)\right) \cdot \left(-0.5 \cdot \left(-1 \cdot \sqrt{\frac{c \cdot -4}{a}}\right)\right)}} \]
      3. *-commutative57.7%

        \[\leadsto \sqrt{\color{blue}{\left(\left(-1 \cdot \sqrt{\frac{c \cdot -4}{a}}\right) \cdot -0.5\right)} \cdot \left(-0.5 \cdot \left(-1 \cdot \sqrt{\frac{c \cdot -4}{a}}\right)\right)} \]
      4. *-commutative57.7%

        \[\leadsto \sqrt{\left(\left(-1 \cdot \sqrt{\frac{c \cdot -4}{a}}\right) \cdot -0.5\right) \cdot \color{blue}{\left(\left(-1 \cdot \sqrt{\frac{c \cdot -4}{a}}\right) \cdot -0.5\right)}} \]
      5. swap-sqr57.7%

        \[\leadsto \sqrt{\color{blue}{\left(\left(-1 \cdot \sqrt{\frac{c \cdot -4}{a}}\right) \cdot \left(-1 \cdot \sqrt{\frac{c \cdot -4}{a}}\right)\right) \cdot \left(-0.5 \cdot -0.5\right)}} \]
      6. mul-1-neg57.7%

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

        \[\leadsto \sqrt{\left(\left(-\sqrt{\frac{c \cdot -4}{a}}\right) \cdot \color{blue}{\left(-\sqrt{\frac{c \cdot -4}{a}}\right)}\right) \cdot \left(-0.5 \cdot -0.5\right)} \]
      8. sqr-neg57.7%

        \[\leadsto \sqrt{\color{blue}{\left(\sqrt{\frac{c \cdot -4}{a}} \cdot \sqrt{\frac{c \cdot -4}{a}}\right)} \cdot \left(-0.5 \cdot -0.5\right)} \]
      9. add-sqr-sqrt57.7%

        \[\leadsto \sqrt{\color{blue}{\frac{c \cdot -4}{a}} \cdot \left(-0.5 \cdot -0.5\right)} \]
      10. *-commutative57.7%

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

        \[\leadsto \sqrt{\color{blue}{\left(-4 \cdot \frac{c}{a}\right)} \cdot \left(-0.5 \cdot -0.5\right)} \]
      12. metadata-eval57.7%

        \[\leadsto \sqrt{\left(-4 \cdot \frac{c}{a}\right) \cdot \color{blue}{0.25}} \]
    13. Applied egg-rr57.7%

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

    if -2.4000000000000001e-242 < b < 1.05e-162

    1. Initial program 82.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. *-commutative82.8%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{\color{blue}{a \cdot 2}} \]
    3. Simplified82.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. Step-by-step derivation
      1. add-cube-cbrt82.4%

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

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

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

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

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{{\left(\sqrt[3]{a \cdot \left(c \cdot 4\right)}\right)}^{3}}}}{a \cdot 2} \]
    7. Taylor expanded in a around -inf 0.0%

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

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

        \[\leadsto -0.5 \cdot \left(\color{blue}{\left(\sqrt{-1} \cdot \sqrt{-1}\right)} \cdot \sqrt{\frac{c \cdot {\left(\sqrt[3]{-4}\right)}^{3}}{a}}\right) \]
      3. rem-square-sqrt28.0%

        \[\leadsto -0.5 \cdot \left(\color{blue}{-1} \cdot \sqrt{\frac{c \cdot {\left(\sqrt[3]{-4}\right)}^{3}}{a}}\right) \]
      4. rem-cube-cbrt28.1%

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

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

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

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

      \[\leadsto -0.5 \cdot \left(-1 \cdot \sqrt{\color{blue}{\frac{c \cdot -4}{a}}}\right) \]
    12. Step-by-step derivation
      1. add-sqr-sqrt0.8%

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

        \[\leadsto -0.5 \cdot \color{blue}{\sqrt{\left(-1 \cdot \sqrt{\frac{c \cdot -4}{a}}\right) \cdot \left(-1 \cdot \sqrt{\frac{c \cdot -4}{a}}\right)}} \]
      3. mul-1-neg42.9%

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

        \[\leadsto -0.5 \cdot \sqrt{\left(-\sqrt{\frac{c \cdot -4}{a}}\right) \cdot \color{blue}{\left(-\sqrt{\frac{c \cdot -4}{a}}\right)}} \]
      5. sqr-neg42.9%

        \[\leadsto -0.5 \cdot \sqrt{\color{blue}{\sqrt{\frac{c \cdot -4}{a}} \cdot \sqrt{\frac{c \cdot -4}{a}}}} \]
      6. add-sqr-sqrt42.9%

        \[\leadsto -0.5 \cdot \sqrt{\color{blue}{\frac{c \cdot -4}{a}}} \]
      7. clear-num42.8%

        \[\leadsto -0.5 \cdot \sqrt{\color{blue}{\frac{1}{\frac{a}{c \cdot -4}}}} \]
      8. sqrt-div45.0%

        \[\leadsto -0.5 \cdot \color{blue}{\frac{\sqrt{1}}{\sqrt{\frac{a}{c \cdot -4}}}} \]
      9. metadata-eval45.0%

        \[\leadsto -0.5 \cdot \frac{\color{blue}{1}}{\sqrt{\frac{a}{c \cdot -4}}} \]
      10. *-un-lft-identity45.0%

        \[\leadsto -0.5 \cdot \frac{1}{\sqrt{\frac{\color{blue}{1 \cdot a}}{c \cdot -4}}} \]
      11. *-commutative45.0%

        \[\leadsto -0.5 \cdot \frac{1}{\sqrt{\frac{1 \cdot a}{\color{blue}{-4 \cdot c}}}} \]
      12. times-frac45.0%

        \[\leadsto -0.5 \cdot \frac{1}{\sqrt{\color{blue}{\frac{1}{-4} \cdot \frac{a}{c}}}} \]
      13. metadata-eval45.0%

        \[\leadsto -0.5 \cdot \frac{1}{\sqrt{\color{blue}{-0.25} \cdot \frac{a}{c}}} \]
    13. Applied egg-rr45.0%

      \[\leadsto -0.5 \cdot \color{blue}{\frac{1}{\sqrt{-0.25 \cdot \frac{a}{c}}}} \]

    if 1.05e-162 < b

    1. Initial program 21.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. *-commutative21.6%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{\color{blue}{a \cdot 2}} \]
    3. Simplified21.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. Step-by-step derivation
      1. add-exp-log14.3%

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

        \[\leadsto e^{\log \color{blue}{\left(\frac{-\left(\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}\right)}{-a \cdot 2}\right)}} \]
    6. Applied egg-rr14.3%

      \[\leadsto \color{blue}{e^{\log \left(\frac{b - \sqrt{\mathsf{fma}\left(a \cdot c, -4, {b}^{2}\right)}}{a \cdot -2}\right)}} \]
    7. Step-by-step derivation
      1. rem-exp-log21.6%

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

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

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

      \[\leadsto \frac{1}{\color{blue}{-1 \cdot \frac{b}{c} + \frac{a}{b}}} \]
    10. Step-by-step derivation
      1. +-commutative76.3%

        \[\leadsto \frac{1}{\color{blue}{\frac{a}{b} + -1 \cdot \frac{b}{c}}} \]
      2. mul-1-neg76.3%

        \[\leadsto \frac{1}{\frac{a}{b} + \color{blue}{\left(-\frac{b}{c}\right)}} \]
      3. unsub-neg76.3%

        \[\leadsto \frac{1}{\color{blue}{\frac{a}{b} - \frac{b}{c}}} \]
    11. Simplified76.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -8.4 \cdot 10^{-97}:\\ \;\;\;\;\frac{b}{-a}\\ \mathbf{elif}\;b \leq -2.4 \cdot 10^{-242}:\\ \;\;\;\;\sqrt{\left(-4 \cdot \frac{c}{a}\right) \cdot 0.25}\\ \mathbf{elif}\;b \leq 1.05 \cdot 10^{-162}:\\ \;\;\;\;-0.5 \cdot \frac{1}{\sqrt{-0.25 \cdot \frac{a}{c}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{a}{b} - \frac{b}{c}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 70.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := -4 \cdot \frac{c}{a}\\ \mathbf{if}\;b \leq -7.5 \cdot 10^{-97}:\\ \;\;\;\;\frac{b}{-a}\\ \mathbf{elif}\;b \leq -4.1 \cdot 10^{-241}:\\ \;\;\;\;\sqrt{t\_0 \cdot 0.25}\\ \mathbf{elif}\;b \leq 8.2 \cdot 10^{-163}:\\ \;\;\;\;-0.5 \cdot \sqrt{t\_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{a}{b} - \frac{b}{c}}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (* -4.0 (/ c a))))
   (if (<= b -7.5e-97)
     (/ b (- a))
     (if (<= b -4.1e-241)
       (sqrt (* t_0 0.25))
       (if (<= b 8.2e-163) (* -0.5 (sqrt t_0)) (/ 1.0 (- (/ a b) (/ b c))))))))
double code(double a, double b, double c) {
	double t_0 = -4.0 * (c / a);
	double tmp;
	if (b <= -7.5e-97) {
		tmp = b / -a;
	} else if (b <= -4.1e-241) {
		tmp = sqrt((t_0 * 0.25));
	} else if (b <= 8.2e-163) {
		tmp = -0.5 * sqrt(t_0);
	} else {
		tmp = 1.0 / ((a / b) - (b / c));
	}
	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 = (-4.0d0) * (c / a)
    if (b <= (-7.5d-97)) then
        tmp = b / -a
    else if (b <= (-4.1d-241)) then
        tmp = sqrt((t_0 * 0.25d0))
    else if (b <= 8.2d-163) then
        tmp = (-0.5d0) * sqrt(t_0)
    else
        tmp = 1.0d0 / ((a / b) - (b / c))
    end if
    code = tmp
end function
public static double code(double a, double b, double c) {
	double t_0 = -4.0 * (c / a);
	double tmp;
	if (b <= -7.5e-97) {
		tmp = b / -a;
	} else if (b <= -4.1e-241) {
		tmp = Math.sqrt((t_0 * 0.25));
	} else if (b <= 8.2e-163) {
		tmp = -0.5 * Math.sqrt(t_0);
	} else {
		tmp = 1.0 / ((a / b) - (b / c));
	}
	return tmp;
}
def code(a, b, c):
	t_0 = -4.0 * (c / a)
	tmp = 0
	if b <= -7.5e-97:
		tmp = b / -a
	elif b <= -4.1e-241:
		tmp = math.sqrt((t_0 * 0.25))
	elif b <= 8.2e-163:
		tmp = -0.5 * math.sqrt(t_0)
	else:
		tmp = 1.0 / ((a / b) - (b / c))
	return tmp
function code(a, b, c)
	t_0 = Float64(-4.0 * Float64(c / a))
	tmp = 0.0
	if (b <= -7.5e-97)
		tmp = Float64(b / Float64(-a));
	elseif (b <= -4.1e-241)
		tmp = sqrt(Float64(t_0 * 0.25));
	elseif (b <= 8.2e-163)
		tmp = Float64(-0.5 * sqrt(t_0));
	else
		tmp = Float64(1.0 / Float64(Float64(a / b) - Float64(b / c)));
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	t_0 = -4.0 * (c / a);
	tmp = 0.0;
	if (b <= -7.5e-97)
		tmp = b / -a;
	elseif (b <= -4.1e-241)
		tmp = sqrt((t_0 * 0.25));
	elseif (b <= 8.2e-163)
		tmp = -0.5 * sqrt(t_0);
	else
		tmp = 1.0 / ((a / b) - (b / c));
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := Block[{t$95$0 = N[(-4.0 * N[(c / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -7.5e-97], N[(b / (-a)), $MachinePrecision], If[LessEqual[b, -4.1e-241], N[Sqrt[N[(t$95$0 * 0.25), $MachinePrecision]], $MachinePrecision], If[LessEqual[b, 8.2e-163], N[(-0.5 * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(a / b), $MachinePrecision] - N[(b / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := -4 \cdot \frac{c}{a}\\
\mathbf{if}\;b \leq -7.5 \cdot 10^{-97}:\\
\;\;\;\;\frac{b}{-a}\\

\mathbf{elif}\;b \leq -4.1 \cdot 10^{-241}:\\
\;\;\;\;\sqrt{t\_0 \cdot 0.25}\\

\mathbf{elif}\;b \leq 8.2 \cdot 10^{-163}:\\
\;\;\;\;-0.5 \cdot \sqrt{t\_0}\\

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


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

    1. Initial program 70.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. *-commutative70.0%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{\color{blue}{a \cdot 2}} \]
    3. Simplified70.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 82.7%

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

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

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

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

    if -7.5e-97 < b < -4.0999999999999999e-241

    1. Initial program 88.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. *-commutative88.9%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{\color{blue}{a \cdot 2}} \]
    3. Simplified88.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. Step-by-step derivation
      1. add-cube-cbrt88.1%

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

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

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

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

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{{\left(\sqrt[3]{a \cdot \left(c \cdot 4\right)}\right)}^{3}}}}{a \cdot 2} \]
    7. Taylor expanded in a around -inf 0.0%

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

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

        \[\leadsto -0.5 \cdot \left(\color{blue}{\left(\sqrt{-1} \cdot \sqrt{-1}\right)} \cdot \sqrt{\frac{c \cdot {\left(\sqrt[3]{-4}\right)}^{3}}{a}}\right) \]
      3. rem-square-sqrt57.3%

        \[\leadsto -0.5 \cdot \left(\color{blue}{-1} \cdot \sqrt{\frac{c \cdot {\left(\sqrt[3]{-4}\right)}^{3}}{a}}\right) \]
      4. rem-cube-cbrt57.7%

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

        \[\leadsto -0.5 \cdot \left(-1 \cdot \sqrt{\color{blue}{c \cdot \frac{-4}{a}}}\right) \]
    9. Simplified57.7%

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

        \[\leadsto -0.5 \cdot \left(-1 \cdot \sqrt{\color{blue}{\frac{c \cdot -4}{a}}}\right) \]
    11. Applied egg-rr57.7%

      \[\leadsto -0.5 \cdot \left(-1 \cdot \sqrt{\color{blue}{\frac{c \cdot -4}{a}}}\right) \]
    12. Step-by-step derivation
      1. add-sqr-sqrt57.5%

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

        \[\leadsto \color{blue}{\sqrt{\left(-0.5 \cdot \left(-1 \cdot \sqrt{\frac{c \cdot -4}{a}}\right)\right) \cdot \left(-0.5 \cdot \left(-1 \cdot \sqrt{\frac{c \cdot -4}{a}}\right)\right)}} \]
      3. *-commutative57.7%

        \[\leadsto \sqrt{\color{blue}{\left(\left(-1 \cdot \sqrt{\frac{c \cdot -4}{a}}\right) \cdot -0.5\right)} \cdot \left(-0.5 \cdot \left(-1 \cdot \sqrt{\frac{c \cdot -4}{a}}\right)\right)} \]
      4. *-commutative57.7%

        \[\leadsto \sqrt{\left(\left(-1 \cdot \sqrt{\frac{c \cdot -4}{a}}\right) \cdot -0.5\right) \cdot \color{blue}{\left(\left(-1 \cdot \sqrt{\frac{c \cdot -4}{a}}\right) \cdot -0.5\right)}} \]
      5. swap-sqr57.7%

        \[\leadsto \sqrt{\color{blue}{\left(\left(-1 \cdot \sqrt{\frac{c \cdot -4}{a}}\right) \cdot \left(-1 \cdot \sqrt{\frac{c \cdot -4}{a}}\right)\right) \cdot \left(-0.5 \cdot -0.5\right)}} \]
      6. mul-1-neg57.7%

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

        \[\leadsto \sqrt{\left(\left(-\sqrt{\frac{c \cdot -4}{a}}\right) \cdot \color{blue}{\left(-\sqrt{\frac{c \cdot -4}{a}}\right)}\right) \cdot \left(-0.5 \cdot -0.5\right)} \]
      8. sqr-neg57.7%

        \[\leadsto \sqrt{\color{blue}{\left(\sqrt{\frac{c \cdot -4}{a}} \cdot \sqrt{\frac{c \cdot -4}{a}}\right)} \cdot \left(-0.5 \cdot -0.5\right)} \]
      9. add-sqr-sqrt57.7%

        \[\leadsto \sqrt{\color{blue}{\frac{c \cdot -4}{a}} \cdot \left(-0.5 \cdot -0.5\right)} \]
      10. *-commutative57.7%

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

        \[\leadsto \sqrt{\color{blue}{\left(-4 \cdot \frac{c}{a}\right)} \cdot \left(-0.5 \cdot -0.5\right)} \]
      12. metadata-eval57.7%

        \[\leadsto \sqrt{\left(-4 \cdot \frac{c}{a}\right) \cdot \color{blue}{0.25}} \]
    13. Applied egg-rr57.7%

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

    if -4.0999999999999999e-241 < b < 8.19999999999999965e-163

    1. Initial program 82.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. *-commutative82.8%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{\color{blue}{a \cdot 2}} \]
    3. Simplified82.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. Step-by-step derivation
      1. add-cube-cbrt82.4%

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

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

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

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

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{{\left(\sqrt[3]{a \cdot \left(c \cdot 4\right)}\right)}^{3}}}}{a \cdot 2} \]
    7. Taylor expanded in a around -inf 0.0%

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

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

        \[\leadsto -0.5 \cdot \left(\color{blue}{\left(\sqrt{-1} \cdot \sqrt{-1}\right)} \cdot \sqrt{\frac{c \cdot {\left(\sqrt[3]{-4}\right)}^{3}}{a}}\right) \]
      3. rem-square-sqrt28.0%

        \[\leadsto -0.5 \cdot \left(\color{blue}{-1} \cdot \sqrt{\frac{c \cdot {\left(\sqrt[3]{-4}\right)}^{3}}{a}}\right) \]
      4. rem-cube-cbrt28.1%

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

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

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

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

      \[\leadsto -0.5 \cdot \left(-1 \cdot \sqrt{\color{blue}{\frac{c \cdot -4}{a}}}\right) \]
    12. Step-by-step derivation
      1. add-sqr-sqrt0.8%

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

        \[\leadsto -0.5 \cdot \color{blue}{\sqrt{\left(-1 \cdot \sqrt{\frac{c \cdot -4}{a}}\right) \cdot \left(-1 \cdot \sqrt{\frac{c \cdot -4}{a}}\right)}} \]
      3. mul-1-neg42.9%

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

        \[\leadsto -0.5 \cdot \sqrt{\left(-\sqrt{\frac{c \cdot -4}{a}}\right) \cdot \color{blue}{\left(-\sqrt{\frac{c \cdot -4}{a}}\right)}} \]
      5. sqr-neg42.9%

        \[\leadsto -0.5 \cdot \sqrt{\color{blue}{\sqrt{\frac{c \cdot -4}{a}} \cdot \sqrt{\frac{c \cdot -4}{a}}}} \]
      6. add-sqr-sqrt42.9%

        \[\leadsto -0.5 \cdot \sqrt{\color{blue}{\frac{c \cdot -4}{a}}} \]
      7. *-commutative42.9%

        \[\leadsto -0.5 \cdot \sqrt{\frac{\color{blue}{-4 \cdot c}}{a}} \]
      8. associate-/l*42.9%

        \[\leadsto -0.5 \cdot \sqrt{\color{blue}{-4 \cdot \frac{c}{a}}} \]
    13. Applied egg-rr42.9%

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

    if 8.19999999999999965e-163 < b

    1. Initial program 21.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. *-commutative21.6%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{\color{blue}{a \cdot 2}} \]
    3. Simplified21.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. Step-by-step derivation
      1. add-exp-log14.3%

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

        \[\leadsto e^{\log \color{blue}{\left(\frac{-\left(\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}\right)}{-a \cdot 2}\right)}} \]
    6. Applied egg-rr14.3%

      \[\leadsto \color{blue}{e^{\log \left(\frac{b - \sqrt{\mathsf{fma}\left(a \cdot c, -4, {b}^{2}\right)}}{a \cdot -2}\right)}} \]
    7. Step-by-step derivation
      1. rem-exp-log21.6%

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

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

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

      \[\leadsto \frac{1}{\color{blue}{-1 \cdot \frac{b}{c} + \frac{a}{b}}} \]
    10. Step-by-step derivation
      1. +-commutative76.3%

        \[\leadsto \frac{1}{\color{blue}{\frac{a}{b} + -1 \cdot \frac{b}{c}}} \]
      2. mul-1-neg76.3%

        \[\leadsto \frac{1}{\frac{a}{b} + \color{blue}{\left(-\frac{b}{c}\right)}} \]
      3. unsub-neg76.3%

        \[\leadsto \frac{1}{\color{blue}{\frac{a}{b} - \frac{b}{c}}} \]
    11. Simplified76.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -7.5 \cdot 10^{-97}:\\ \;\;\;\;\frac{b}{-a}\\ \mathbf{elif}\;b \leq -4.1 \cdot 10^{-241}:\\ \;\;\;\;\sqrt{\left(-4 \cdot \frac{c}{a}\right) \cdot 0.25}\\ \mathbf{elif}\;b \leq 8.2 \cdot 10^{-163}:\\ \;\;\;\;-0.5 \cdot \sqrt{-4 \cdot \frac{c}{a}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{a}{b} - \frac{b}{c}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 80.7% accurate, 1.0× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if b < -5.3999999999999999e-92

    1. Initial program 69.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. *-commutative69.7%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{\color{blue}{a \cdot 2}} \]
    3. Simplified69.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 83.7%

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

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

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

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

        \[\leadsto b \cdot \left(-\left(\frac{1}{a} + \color{blue}{\left(-\frac{c}{{b}^{2}}\right)}\right)\right) \]
      5. unsub-neg83.7%

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

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

    if -5.3999999999999999e-92 < b < 5.99999999999999996e-9

    1. Initial program 74.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. *-commutative74.8%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{\color{blue}{a \cdot 2}} \]
    3. Simplified74.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 0 69.8%

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

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

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

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

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

    if 5.99999999999999996e-9 < b

    1. Initial program 10.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. *-commutative10.3%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{\color{blue}{a \cdot 2}} \]
    3. Simplified10.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 87.7%

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

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

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

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

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

Alternative 7: 71.5% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -1.15 \cdot 10^{-96}:\\ \;\;\;\;\frac{b}{-a}\\ \mathbf{elif}\;b \leq 6.2 \cdot 10^{-160}:\\ \;\;\;\;\sqrt{\left(-4 \cdot \frac{c}{a}\right) \cdot 0.25}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{a}{b} - \frac{b}{c}}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b -1.15e-96)
   (/ b (- a))
   (if (<= b 6.2e-160)
     (sqrt (* (* -4.0 (/ c a)) 0.25))
     (/ 1.0 (- (/ a b) (/ b c))))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= -1.15e-96) {
		tmp = b / -a;
	} else if (b <= 6.2e-160) {
		tmp = sqrt(((-4.0 * (c / a)) * 0.25));
	} else {
		tmp = 1.0 / ((a / b) - (b / c));
	}
	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.15d-96)) then
        tmp = b / -a
    else if (b <= 6.2d-160) then
        tmp = sqrt((((-4.0d0) * (c / a)) * 0.25d0))
    else
        tmp = 1.0d0 / ((a / b) - (b / c))
    end if
    code = tmp
end function
public static double code(double a, double b, double c) {
	double tmp;
	if (b <= -1.15e-96) {
		tmp = b / -a;
	} else if (b <= 6.2e-160) {
		tmp = Math.sqrt(((-4.0 * (c / a)) * 0.25));
	} else {
		tmp = 1.0 / ((a / b) - (b / c));
	}
	return tmp;
}
def code(a, b, c):
	tmp = 0
	if b <= -1.15e-96:
		tmp = b / -a
	elif b <= 6.2e-160:
		tmp = math.sqrt(((-4.0 * (c / a)) * 0.25))
	else:
		tmp = 1.0 / ((a / b) - (b / c))
	return tmp
function code(a, b, c)
	tmp = 0.0
	if (b <= -1.15e-96)
		tmp = Float64(b / Float64(-a));
	elseif (b <= 6.2e-160)
		tmp = sqrt(Float64(Float64(-4.0 * Float64(c / a)) * 0.25));
	else
		tmp = Float64(1.0 / Float64(Float64(a / b) - Float64(b / c)));
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	tmp = 0.0;
	if (b <= -1.15e-96)
		tmp = b / -a;
	elseif (b <= 6.2e-160)
		tmp = sqrt(((-4.0 * (c / a)) * 0.25));
	else
		tmp = 1.0 / ((a / b) - (b / c));
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := If[LessEqual[b, -1.15e-96], N[(b / (-a)), $MachinePrecision], If[LessEqual[b, 6.2e-160], N[Sqrt[N[(N[(-4.0 * N[(c / a), $MachinePrecision]), $MachinePrecision] * 0.25), $MachinePrecision]], $MachinePrecision], N[(1.0 / N[(N[(a / b), $MachinePrecision] - N[(b / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{elif}\;b \leq 6.2 \cdot 10^{-160}:\\
\;\;\;\;\sqrt{\left(-4 \cdot \frac{c}{a}\right) \cdot 0.25}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if b < -1.15e-96

    1. Initial program 70.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. *-commutative70.0%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{\color{blue}{a \cdot 2}} \]
    3. Simplified70.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 82.7%

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

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

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

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

    if -1.15e-96 < b < 6.2000000000000001e-160

    1. Initial program 85.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. *-commutative85.1%

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

      \[\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. Step-by-step derivation
      1. add-cube-cbrt84.6%

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

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

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

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

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{{\left(\sqrt[3]{a \cdot \left(c \cdot 4\right)}\right)}^{3}}}}{a \cdot 2} \]
    7. Taylor expanded in a around -inf 0.0%

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

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

        \[\leadsto -0.5 \cdot \left(\color{blue}{\left(\sqrt{-1} \cdot \sqrt{-1}\right)} \cdot \sqrt{\frac{c \cdot {\left(\sqrt[3]{-4}\right)}^{3}}{a}}\right) \]
      3. rem-square-sqrt38.9%

        \[\leadsto -0.5 \cdot \left(\color{blue}{-1} \cdot \sqrt{\frac{c \cdot {\left(\sqrt[3]{-4}\right)}^{3}}{a}}\right) \]
      4. rem-cube-cbrt39.2%

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

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

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

        \[\leadsto -0.5 \cdot \left(-1 \cdot \sqrt{\color{blue}{\frac{c \cdot -4}{a}}}\right) \]
    11. Applied egg-rr39.2%

      \[\leadsto -0.5 \cdot \left(-1 \cdot \sqrt{\color{blue}{\frac{c \cdot -4}{a}}}\right) \]
    12. Step-by-step derivation
      1. add-sqr-sqrt38.9%

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

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

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

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

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

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

        \[\leadsto \sqrt{\left(\left(-\sqrt{\frac{c \cdot -4}{a}}\right) \cdot \color{blue}{\left(-\sqrt{\frac{c \cdot -4}{a}}\right)}\right) \cdot \left(-0.5 \cdot -0.5\right)} \]
      8. sqr-neg39.2%

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

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

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

        \[\leadsto \sqrt{\color{blue}{\left(-4 \cdot \frac{c}{a}\right)} \cdot \left(-0.5 \cdot -0.5\right)} \]
      12. metadata-eval39.2%

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

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

    if 6.2000000000000001e-160 < b

    1. Initial program 20.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. *-commutative20.9%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{\color{blue}{a \cdot 2}} \]
    3. Simplified20.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. Step-by-step derivation
      1. add-exp-log13.6%

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

        \[\leadsto e^{\log \color{blue}{\left(\frac{-\left(\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}\right)}{-a \cdot 2}\right)}} \]
    6. Applied egg-rr13.6%

      \[\leadsto \color{blue}{e^{\log \left(\frac{b - \sqrt{\mathsf{fma}\left(a \cdot c, -4, {b}^{2}\right)}}{a \cdot -2}\right)}} \]
    7. Step-by-step derivation
      1. rem-exp-log20.9%

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

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

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

      \[\leadsto \frac{1}{\color{blue}{-1 \cdot \frac{b}{c} + \frac{a}{b}}} \]
    10. Step-by-step derivation
      1. +-commutative76.9%

        \[\leadsto \frac{1}{\color{blue}{\frac{a}{b} + -1 \cdot \frac{b}{c}}} \]
      2. mul-1-neg76.9%

        \[\leadsto \frac{1}{\frac{a}{b} + \color{blue}{\left(-\frac{b}{c}\right)}} \]
      3. unsub-neg76.9%

        \[\leadsto \frac{1}{\color{blue}{\frac{a}{b} - \frac{b}{c}}} \]
    11. Simplified76.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -1.15 \cdot 10^{-96}:\\ \;\;\;\;\frac{b}{-a}\\ \mathbf{elif}\;b \leq 6.2 \cdot 10^{-160}:\\ \;\;\;\;\sqrt{\left(-4 \cdot \frac{c}{a}\right) \cdot 0.25}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{a}{b} - \frac{b}{c}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 67.3% accurate, 8.3× speedup?

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

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

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


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

    1. Initial program 74.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. *-commutative74.8%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{\color{blue}{a \cdot 2}} \]
    3. Simplified74.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 65.8%

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

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

        \[\leadsto \frac{\color{blue}{-b}}{a} \]
    7. Simplified65.8%

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

    if -9.999999999999969e-311 < b

    1. Initial program 30.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. *-commutative30.9%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{\color{blue}{a \cdot 2}} \]
    3. Simplified30.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. Step-by-step derivation
      1. add-exp-log18.2%

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

        \[\leadsto e^{\log \color{blue}{\left(\frac{-\left(\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}\right)}{-a \cdot 2}\right)}} \]
    6. Applied egg-rr18.2%

      \[\leadsto \color{blue}{e^{\log \left(\frac{b - \sqrt{\mathsf{fma}\left(a \cdot c, -4, {b}^{2}\right)}}{a \cdot -2}\right)}} \]
    7. Step-by-step derivation
      1. rem-exp-log30.9%

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

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

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

      \[\leadsto \frac{1}{\color{blue}{-1 \cdot \frac{b}{c} + \frac{a}{b}}} \]
    10. Step-by-step derivation
      1. +-commutative65.4%

        \[\leadsto \frac{1}{\color{blue}{\frac{a}{b} + -1 \cdot \frac{b}{c}}} \]
      2. mul-1-neg65.4%

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

        \[\leadsto \frac{1}{\color{blue}{\frac{a}{b} - \frac{b}{c}}} \]
    11. Simplified65.4%

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

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

Alternative 9: 67.5% accurate, 12.9× speedup?

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

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

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


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

    1. Initial program 75.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. *-commutative75.7%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{\color{blue}{a \cdot 2}} \]
    3. Simplified75.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 63.4%

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

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

        \[\leadsto \frac{\color{blue}{-b}}{a} \]
    7. Simplified63.4%

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

    if 2.69999999999999993e-272 < b

    1. Initial program 28.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. *-commutative28.3%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{\color{blue}{a \cdot 2}} \]
    3. Simplified28.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.6%

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

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

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

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

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

Alternative 10: 43.1% accurate, 12.9× speedup?

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

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

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


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

    1. Initial program 72.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. *-commutative72.1%

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

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

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

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

        \[\leadsto \frac{\color{blue}{-b}}{a} \]
    7. Simplified47.8%

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

    if 3.80000000000000015e-7 < b

    1. Initial program 10.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. *-commutative10.3%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{\color{blue}{a \cdot 2}} \]
    3. Simplified10.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 87.7%

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

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

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

      \[\leadsto \color{blue}{\frac{-c}{b}} \]
    8. Step-by-step derivation
      1. add-sqr-sqrt41.8%

        \[\leadsto \frac{\color{blue}{\sqrt{-c} \cdot \sqrt{-c}}}{b} \]
      2. sqrt-unprod41.2%

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

        \[\leadsto \frac{\sqrt{\color{blue}{c \cdot c}}}{b} \]
      4. sqrt-unprod14.9%

        \[\leadsto \frac{\color{blue}{\sqrt{c} \cdot \sqrt{c}}}{b} \]
      5. add-sqr-sqrt23.4%

        \[\leadsto \frac{\color{blue}{c}}{b} \]
      6. *-un-lft-identity23.4%

        \[\leadsto \color{blue}{1 \cdot \frac{c}{b}} \]
    9. Applied egg-rr23.4%

      \[\leadsto \color{blue}{1 \cdot \frac{c}{b}} \]
    10. Step-by-step derivation
      1. *-lft-identity23.4%

        \[\leadsto \color{blue}{\frac{c}{b}} \]
    11. Simplified23.4%

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

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

Alternative 11: 12.4% accurate, 12.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq 1.05 \cdot 10^{+70}:\\ \;\;\;\;b \cdot \left(-c\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b}\\ \end{array} \end{array} \]
(FPCore (a b c) :precision binary64 (if (<= b 1.05e+70) (* b (- c)) (/ c b)))
double code(double a, double b, double c) {
	double tmp;
	if (b <= 1.05e+70) {
		tmp = b * -c;
	} 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.05d+70) then
        tmp = b * -c
    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.05e+70) {
		tmp = b * -c;
	} else {
		tmp = c / b;
	}
	return tmp;
}
def code(a, b, c):
	tmp = 0
	if b <= 1.05e+70:
		tmp = b * -c
	else:
		tmp = c / b
	return tmp
function code(a, b, c)
	tmp = 0.0
	if (b <= 1.05e+70)
		tmp = Float64(b * Float64(-c));
	else
		tmp = Float64(c / b);
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	tmp = 0.0;
	if (b <= 1.05e+70)
		tmp = b * -c;
	else
		tmp = c / b;
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := If[LessEqual[b, 1.05e+70], N[(b * (-c)), $MachinePrecision], N[(c / b), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.05 \cdot 10^{+70}:\\
\;\;\;\;b \cdot \left(-c\right)\\

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


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

    1. Initial program 66.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. *-commutative66.0%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{\color{blue}{a \cdot 2}} \]
    3. Simplified66.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 17.3%

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

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

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

      \[\leadsto \color{blue}{\frac{-c}{b}} \]
    8. Step-by-step derivation
      1. frac-2neg17.3%

        \[\leadsto \color{blue}{\frac{-\left(-c\right)}{-b}} \]
      2. div-inv17.2%

        \[\leadsto \color{blue}{\left(-\left(-c\right)\right) \cdot \frac{1}{-b}} \]
      3. remove-double-neg17.2%

        \[\leadsto \color{blue}{c} \cdot \frac{1}{-b} \]
      4. add-exp-log1.3%

        \[\leadsto c \cdot \color{blue}{e^{\log \left(\frac{1}{-b}\right)}} \]
      5. metadata-eval1.3%

        \[\leadsto c \cdot e^{\log \left(\frac{\color{blue}{--1}}{-b}\right)} \]
      6. frac-2neg1.3%

        \[\leadsto c \cdot e^{\log \color{blue}{\left(\frac{-1}{b}\right)}} \]
      7. add-sqr-sqrt0.4%

        \[\leadsto c \cdot e^{\color{blue}{\sqrt{\log \left(\frac{-1}{b}\right)} \cdot \sqrt{\log \left(\frac{-1}{b}\right)}}} \]
      8. sqrt-unprod4.5%

        \[\leadsto c \cdot e^{\color{blue}{\sqrt{\log \left(\frac{-1}{b}\right) \cdot \log \left(\frac{-1}{b}\right)}}} \]
      9. sqr-neg4.5%

        \[\leadsto c \cdot e^{\sqrt{\color{blue}{\left(-\log \left(\frac{-1}{b}\right)\right) \cdot \left(-\log \left(\frac{-1}{b}\right)\right)}}} \]
      10. sqrt-unprod4.1%

        \[\leadsto c \cdot e^{\color{blue}{\sqrt{-\log \left(\frac{-1}{b}\right)} \cdot \sqrt{-\log \left(\frac{-1}{b}\right)}}} \]
      11. add-sqr-sqrt4.7%

        \[\leadsto c \cdot e^{\color{blue}{-\log \left(\frac{-1}{b}\right)}} \]
      12. rec-exp4.7%

        \[\leadsto c \cdot \color{blue}{\frac{1}{e^{\log \left(\frac{-1}{b}\right)}}} \]
      13. add-exp-log7.0%

        \[\leadsto c \cdot \frac{1}{\color{blue}{\frac{-1}{b}}} \]
      14. frac-2neg7.0%

        \[\leadsto c \cdot \frac{1}{\color{blue}{\frac{--1}{-b}}} \]
      15. metadata-eval7.0%

        \[\leadsto c \cdot \frac{1}{\frac{\color{blue}{1}}{-b}} \]
      16. remove-double-div7.0%

        \[\leadsto c \cdot \color{blue}{\left(-b\right)} \]
    9. Applied egg-rr7.0%

      \[\leadsto \color{blue}{c \cdot \left(-b\right)} \]

    if 1.05000000000000004e70 < b

    1. Initial program 7.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. *-commutative7.4%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{\color{blue}{a \cdot 2}} \]
    3. Simplified7.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. Taylor expanded in b around inf 90.9%

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

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

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

      \[\leadsto \color{blue}{\frac{-c}{b}} \]
    8. Step-by-step derivation
      1. add-sqr-sqrt43.4%

        \[\leadsto \frac{\color{blue}{\sqrt{-c} \cdot \sqrt{-c}}}{b} \]
      2. sqrt-unprod48.9%

        \[\leadsto \frac{\color{blue}{\sqrt{\left(-c\right) \cdot \left(-c\right)}}}{b} \]
      3. sqr-neg48.9%

        \[\leadsto \frac{\sqrt{\color{blue}{c \cdot c}}}{b} \]
      4. sqrt-unprod19.4%

        \[\leadsto \frac{\color{blue}{\sqrt{c} \cdot \sqrt{c}}}{b} \]
      5. add-sqr-sqrt30.3%

        \[\leadsto \frac{\color{blue}{c}}{b} \]
      6. *-un-lft-identity30.3%

        \[\leadsto \color{blue}{1 \cdot \frac{c}{b}} \]
    9. Applied egg-rr30.3%

      \[\leadsto \color{blue}{1 \cdot \frac{c}{b}} \]
    10. Step-by-step derivation
      1. *-lft-identity30.3%

        \[\leadsto \color{blue}{\frac{c}{b}} \]
    11. Simplified30.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 1.05 \cdot 10^{+70}:\\ \;\;\;\;b \cdot \left(-c\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b}\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 11.1% 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 51.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. *-commutative51.8%

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{\color{blue}{a \cdot 2}} \]
  3. Simplified51.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 35.1%

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

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

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

    \[\leadsto \color{blue}{\frac{-c}{b}} \]
  8. Step-by-step derivation
    1. add-sqr-sqrt17.0%

      \[\leadsto \frac{\color{blue}{\sqrt{-c} \cdot \sqrt{-c}}}{b} \]
    2. sqrt-unprod17.9%

      \[\leadsto \frac{\color{blue}{\sqrt{\left(-c\right) \cdot \left(-c\right)}}}{b} \]
    3. sqr-neg17.9%

      \[\leadsto \frac{\sqrt{\color{blue}{c \cdot c}}}{b} \]
    4. sqrt-unprod5.7%

      \[\leadsto \frac{\color{blue}{\sqrt{c} \cdot \sqrt{c}}}{b} \]
    5. add-sqr-sqrt9.8%

      \[\leadsto \frac{\color{blue}{c}}{b} \]
    6. *-un-lft-identity9.8%

      \[\leadsto \color{blue}{1 \cdot \frac{c}{b}} \]
  9. Applied egg-rr9.8%

    \[\leadsto \color{blue}{1 \cdot \frac{c}{b}} \]
  10. Step-by-step derivation
    1. *-lft-identity9.8%

      \[\leadsto \color{blue}{\frac{c}{b}} \]
  11. Simplified9.8%

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

Alternative 13: 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 51.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. *-commutative51.8%

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{\color{blue}{a \cdot 2}} \]
  3. Simplified51.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 32.9%

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

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

      \[\leadsto \frac{\color{blue}{-b}}{a} \]
  7. Simplified32.9%

    \[\leadsto \color{blue}{\frac{-b}{a}} \]
  8. Step-by-step derivation
    1. add-sqr-sqrt31.2%

      \[\leadsto \frac{\color{blue}{\sqrt{-b} \cdot \sqrt{-b}}}{a} \]
    2. sqrt-unprod25.0%

      \[\leadsto \frac{\color{blue}{\sqrt{\left(-b\right) \cdot \left(-b\right)}}}{a} \]
    3. sqr-neg25.0%

      \[\leadsto \frac{\sqrt{\color{blue}{b \cdot b}}}{a} \]
    4. sqrt-prod1.9%

      \[\leadsto \frac{\color{blue}{\sqrt{b} \cdot \sqrt{b}}}{a} \]
    5. add-sqr-sqrt2.7%

      \[\leadsto \frac{\color{blue}{b}}{a} \]
    6. add-cbrt-cube2.3%

      \[\leadsto \frac{\color{blue}{\sqrt[3]{\left(b \cdot b\right) \cdot b}}}{a} \]
    7. pow1/311.2%

      \[\leadsto \frac{\color{blue}{{\left(\left(b \cdot b\right) \cdot b\right)}^{0.3333333333333333}}}{a} \]
    8. pow311.2%

      \[\leadsto \frac{{\color{blue}{\left({b}^{3}\right)}}^{0.3333333333333333}}{a} \]
  9. Applied egg-rr11.2%

    \[\leadsto \frac{\color{blue}{{\left({b}^{3}\right)}^{0.3333333333333333}}}{a} \]
  10. Taylor expanded in b around 0 2.7%

    \[\leadsto \color{blue}{\frac{b}{a}} \]
  11. Add Preprocessing

Alternative 14: 2.3% accurate, 38.7× speedup?

\[\begin{array}{l} \\ b \cdot 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}

\\
b \cdot a
\end{array}
Derivation
  1. Initial program 51.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. *-commutative51.8%

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{\color{blue}{a \cdot 2}} \]
  3. Simplified51.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 32.9%

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

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

      \[\leadsto \frac{\color{blue}{-b}}{a} \]
  7. Simplified32.9%

    \[\leadsto \color{blue}{\frac{-b}{a}} \]
  8. Step-by-step derivation
    1. add-sqr-sqrt31.2%

      \[\leadsto \frac{\color{blue}{\sqrt{-b} \cdot \sqrt{-b}}}{a} \]
    2. sqrt-unprod25.0%

      \[\leadsto \frac{\color{blue}{\sqrt{\left(-b\right) \cdot \left(-b\right)}}}{a} \]
    3. sqr-neg25.0%

      \[\leadsto \frac{\sqrt{\color{blue}{b \cdot b}}}{a} \]
    4. sqrt-prod1.9%

      \[\leadsto \frac{\color{blue}{\sqrt{b} \cdot \sqrt{b}}}{a} \]
    5. add-sqr-sqrt2.7%

      \[\leadsto \frac{\color{blue}{b}}{a} \]
    6. add-cbrt-cube2.3%

      \[\leadsto \frac{\color{blue}{\sqrt[3]{\left(b \cdot b\right) \cdot b}}}{a} \]
    7. pow1/311.2%

      \[\leadsto \frac{\color{blue}{{\left(\left(b \cdot b\right) \cdot b\right)}^{0.3333333333333333}}}{a} \]
    8. pow311.2%

      \[\leadsto \frac{{\color{blue}{\left({b}^{3}\right)}}^{0.3333333333333333}}{a} \]
  9. Applied egg-rr11.2%

    \[\leadsto \frac{\color{blue}{{\left({b}^{3}\right)}^{0.3333333333333333}}}{a} \]
  10. Step-by-step derivation
    1. expm1-log1p-u5.6%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{{\left({b}^{3}\right)}^{0.3333333333333333}}{a}\right)\right)} \]
    2. *-un-lft-identity5.6%

      \[\leadsto \color{blue}{1 \cdot \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{{\left({b}^{3}\right)}^{0.3333333333333333}}{a}\right)\right)} \]
    3. unpow1/32.0%

      \[\leadsto 1 \cdot \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\color{blue}{\sqrt[3]{{b}^{3}}}}{a}\right)\right) \]
    4. rem-cbrt-cube2.2%

      \[\leadsto 1 \cdot \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\color{blue}{b}}{a}\right)\right) \]
    5. div-inv2.2%

      \[\leadsto 1 \cdot \mathsf{expm1}\left(\mathsf{log1p}\left(\color{blue}{b \cdot \frac{1}{a}}\right)\right) \]
    6. expm1-log1p-u2.7%

      \[\leadsto 1 \cdot \color{blue}{\left(b \cdot \frac{1}{a}\right)} \]
    7. rem-exp-log1.4%

      \[\leadsto 1 \cdot \left(b \cdot \color{blue}{e^{\log \left(\frac{1}{a}\right)}}\right) \]
    8. neg-log1.4%

      \[\leadsto 1 \cdot \left(b \cdot e^{\color{blue}{-\log a}}\right) \]
    9. add-sqr-sqrt0.5%

      \[\leadsto 1 \cdot \left(b \cdot e^{\color{blue}{\sqrt{-\log a} \cdot \sqrt{-\log a}}}\right) \]
    10. sqrt-unprod1.2%

      \[\leadsto 1 \cdot \left(b \cdot e^{\color{blue}{\sqrt{\left(-\log a\right) \cdot \left(-\log a\right)}}}\right) \]
    11. sqr-neg1.2%

      \[\leadsto 1 \cdot \left(b \cdot e^{\sqrt{\color{blue}{\log a \cdot \log a}}}\right) \]
    12. sqrt-unprod0.7%

      \[\leadsto 1 \cdot \left(b \cdot e^{\color{blue}{\sqrt{\log a} \cdot \sqrt{\log a}}}\right) \]
    13. add-sqr-sqrt1.3%

      \[\leadsto 1 \cdot \left(b \cdot e^{\color{blue}{\log a}}\right) \]
    14. add-exp-log2.4%

      \[\leadsto 1 \cdot \left(b \cdot \color{blue}{a}\right) \]
  11. Applied egg-rr2.4%

    \[\leadsto \color{blue}{1 \cdot \left(b \cdot a\right)} \]
  12. Step-by-step derivation
    1. *-lft-identity2.4%

      \[\leadsto \color{blue}{b \cdot a} \]
  13. Simplified2.4%

    \[\leadsto \color{blue}{b \cdot a} \]
  14. Add Preprocessing

Developer Target 1: 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 2024133 
(FPCore (a b c)
  :name "quadp (p42, positive)"
  :precision binary64
  :herbie-expected 10

  :alt
  (! :herbie-platform default (let ((sqtD (let ((x (* (sqrt (fabs a)) (sqrt (fabs c))))) (if (== (copysign a c) a) (* (sqrt (- (fabs (/ b 2)) x)) (sqrt (+ (fabs (/ b 2)) x))) (hypot (/ b 2) x))))) (if (< b 0) (/ (- sqtD (/ b 2)) a) (/ (- c) (+ (/ b 2) sqtD)))))

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