Cubic critical

Percentage Accurate: 51.3% → 61.0%
Time: 18.0s
Alternatives: 15
Speedup: 1.0×

Specification

?
\[\begin{array}{l} \\ \frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))
double code(double a, double b, double c) {
	return (-b + sqrt(((b * b) - ((3.0 * a) * c)))) / (3.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) - ((3.0d0 * a) * c)))) / (3.0d0 * a)
end function
public static double code(double a, double b, double c) {
	return (-b + Math.sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a);
}
def code(a, b, c):
	return (-b + math.sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a)
function code(a, b, c)
	return Float64(Float64(Float64(-b) + sqrt(Float64(Float64(b * b) - Float64(Float64(3.0 * a) * c)))) / Float64(3.0 * a))
end
function tmp = code(a, b, c)
	tmp = (-b + sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a);
end
code[a_, b_, c_] := N[(N[((-b) + N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(3.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \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 15 alternatives:

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

Initial Program: 51.3% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))
double code(double a, double b, double c) {
	return (-b + sqrt(((b * b) - ((3.0 * a) * c)))) / (3.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) - ((3.0d0 * a) * c)))) / (3.0d0 * a)
end function
public static double code(double a, double b, double c) {
	return (-b + Math.sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a);
}
def code(a, b, c):
	return (-b + math.sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a)
function code(a, b, c)
	return Float64(Float64(Float64(-b) + sqrt(Float64(Float64(b * b) - Float64(Float64(3.0 * a) * c)))) / Float64(3.0 * a))
end
function tmp = code(a, b, c)
	tmp = (-b + sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a);
end
code[a_, b_, c_] := N[(N[((-b) + N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(3.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

Alternative 1: 61.0% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -1.7 \cdot 10^{-53}:\\ \;\;\;\;b \cdot \left(0.6666666666666666 \cdot \frac{-1}{a} - -0.5 \cdot \frac{c}{{b}^{2}}\right)\\ \mathbf{else}:\\ \;\;\;\;0.3333333333333333 \cdot \frac{\mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -3\right)}\right) - b}{a}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b -1.7e-53)
   (* b (- (* 0.6666666666666666 (/ -1.0 a)) (* -0.5 (/ c (pow b 2.0)))))
   (* 0.3333333333333333 (/ (- (hypot b (sqrt (* a (* c -3.0)))) b) a))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= -1.7e-53) {
		tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.5 * (c / pow(b, 2.0))));
	} else {
		tmp = 0.3333333333333333 * ((hypot(b, sqrt((a * (c * -3.0)))) - b) / a);
	}
	return tmp;
}
public static double code(double a, double b, double c) {
	double tmp;
	if (b <= -1.7e-53) {
		tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.5 * (c / Math.pow(b, 2.0))));
	} else {
		tmp = 0.3333333333333333 * ((Math.hypot(b, Math.sqrt((a * (c * -3.0)))) - b) / a);
	}
	return tmp;
}
def code(a, b, c):
	tmp = 0
	if b <= -1.7e-53:
		tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.5 * (c / math.pow(b, 2.0))))
	else:
		tmp = 0.3333333333333333 * ((math.hypot(b, math.sqrt((a * (c * -3.0)))) - b) / a)
	return tmp
function code(a, b, c)
	tmp = 0.0
	if (b <= -1.7e-53)
		tmp = Float64(b * Float64(Float64(0.6666666666666666 * Float64(-1.0 / a)) - Float64(-0.5 * Float64(c / (b ^ 2.0)))));
	else
		tmp = Float64(0.3333333333333333 * Float64(Float64(hypot(b, sqrt(Float64(a * Float64(c * -3.0)))) - b) / a));
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	tmp = 0.0;
	if (b <= -1.7e-53)
		tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.5 * (c / (b ^ 2.0))));
	else
		tmp = 0.3333333333333333 * ((hypot(b, sqrt((a * (c * -3.0)))) - b) / a);
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := If[LessEqual[b, -1.7e-53], N[(b * N[(N[(0.6666666666666666 * N[(-1.0 / a), $MachinePrecision]), $MachinePrecision] - N[(-0.5 * N[(c / N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.3333333333333333 * N[(N[(N[Sqrt[b ^ 2 + N[Sqrt[N[(a * N[(c * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] ^ 2], $MachinePrecision] - b), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.7 \cdot 10^{-53}:\\
\;\;\;\;b \cdot \left(0.6666666666666666 \cdot \frac{-1}{a} - -0.5 \cdot \frac{c}{{b}^{2}}\right)\\

\mathbf{else}:\\
\;\;\;\;0.3333333333333333 \cdot \frac{\mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -3\right)}\right) - b}{a}\\


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

    1. Initial program 65.7%

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

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

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

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

        \[\leadsto \frac{\color{blue}{-\left(b - \sqrt{\left(-b\right) \cdot \left(-b\right) - \left(3 \cdot a\right) \cdot c}\right)}}{3 \cdot a} \]
      5. sub-neg65.7%

        \[\leadsto \frac{-\color{blue}{\left(b + \left(-\sqrt{\left(-b\right) \cdot \left(-b\right) - \left(3 \cdot a\right) \cdot c}\right)\right)}}{3 \cdot a} \]
      6. distribute-neg-in65.7%

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

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

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

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

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

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

    if -1.7e-53 < b

    1. Initial program 40.8%

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\left(-b\right) + \left(-\left(-\sqrt{\left(-b\right) \cdot \left(-b\right) - \left(3 \cdot a\right) \cdot c}\right)\right)}}{3 \cdot a} \]
      7. remove-double-neg40.8%

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{b}{-3} - \frac{\mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -3\right)}\right)}{-3}}}{a} \]
      3. div-sub41.9%

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

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

        \[\leadsto \frac{b \cdot \color{blue}{-0.3333333333333333}}{a} - \frac{\frac{\mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -3\right)}\right)}{-3}}{a} \]
      6. div-inv41.8%

        \[\leadsto \frac{b \cdot -0.3333333333333333}{a} - \frac{\color{blue}{\mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -3\right)}\right) \cdot \frac{1}{-3}}}{a} \]
      7. metadata-eval41.8%

        \[\leadsto \frac{b \cdot -0.3333333333333333}{a} - \frac{\mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -3\right)}\right) \cdot \color{blue}{-0.3333333333333333}}{a} \]
    7. Applied egg-rr41.8%

      \[\leadsto \color{blue}{\frac{b \cdot -0.3333333333333333}{a} - \frac{\mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -3\right)}\right) \cdot -0.3333333333333333}{a}} \]
    8. Simplified45.0%

      \[\leadsto \color{blue}{0.3333333333333333 \cdot \frac{\mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -3\right)}\right) - b}{a}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification61.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -1.7 \cdot 10^{-53}:\\ \;\;\;\;b \cdot \left(0.6666666666666666 \cdot \frac{-1}{a} - -0.5 \cdot \frac{c}{{b}^{2}}\right)\\ \mathbf{else}:\\ \;\;\;\;0.3333333333333333 \cdot \frac{\mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -3\right)}\right) - b}{a}\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 53.9% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -1.7 \cdot 10^{-53}:\\ \;\;\;\;b \cdot \left(0.6666666666666666 \cdot \frac{-1}{a} - -0.5 \cdot \frac{c}{{b}^{2}}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{e^{\log \left(\mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -3\right)}\right)\right)} - b}{a \cdot 3}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b -1.7e-53)
   (* b (- (* 0.6666666666666666 (/ -1.0 a)) (* -0.5 (/ c (pow b 2.0)))))
   (/ (- (exp (log (hypot b (sqrt (* a (* c -3.0)))))) b) (* a 3.0))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= -1.7e-53) {
		tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.5 * (c / pow(b, 2.0))));
	} else {
		tmp = (exp(log(hypot(b, sqrt((a * (c * -3.0)))))) - b) / (a * 3.0);
	}
	return tmp;
}
public static double code(double a, double b, double c) {
	double tmp;
	if (b <= -1.7e-53) {
		tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.5 * (c / Math.pow(b, 2.0))));
	} else {
		tmp = (Math.exp(Math.log(Math.hypot(b, Math.sqrt((a * (c * -3.0)))))) - b) / (a * 3.0);
	}
	return tmp;
}
def code(a, b, c):
	tmp = 0
	if b <= -1.7e-53:
		tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.5 * (c / math.pow(b, 2.0))))
	else:
		tmp = (math.exp(math.log(math.hypot(b, math.sqrt((a * (c * -3.0)))))) - b) / (a * 3.0)
	return tmp
function code(a, b, c)
	tmp = 0.0
	if (b <= -1.7e-53)
		tmp = Float64(b * Float64(Float64(0.6666666666666666 * Float64(-1.0 / a)) - Float64(-0.5 * Float64(c / (b ^ 2.0)))));
	else
		tmp = Float64(Float64(exp(log(hypot(b, sqrt(Float64(a * Float64(c * -3.0)))))) - b) / Float64(a * 3.0));
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	tmp = 0.0;
	if (b <= -1.7e-53)
		tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.5 * (c / (b ^ 2.0))));
	else
		tmp = (exp(log(hypot(b, sqrt((a * (c * -3.0)))))) - b) / (a * 3.0);
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := If[LessEqual[b, -1.7e-53], N[(b * N[(N[(0.6666666666666666 * N[(-1.0 / a), $MachinePrecision]), $MachinePrecision] - N[(-0.5 * N[(c / N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Exp[N[Log[N[Sqrt[b ^ 2 + N[Sqrt[N[(a * N[(c * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] ^ 2], $MachinePrecision]], $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.7 \cdot 10^{-53}:\\
\;\;\;\;b \cdot \left(0.6666666666666666 \cdot \frac{-1}{a} - -0.5 \cdot \frac{c}{{b}^{2}}\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{e^{\log \left(\mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -3\right)}\right)\right)} - b}{a \cdot 3}\\


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

    1. Initial program 65.7%

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

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

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

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

        \[\leadsto \frac{\color{blue}{-\left(b - \sqrt{\left(-b\right) \cdot \left(-b\right) - \left(3 \cdot a\right) \cdot c}\right)}}{3 \cdot a} \]
      5. sub-neg65.7%

        \[\leadsto \frac{-\color{blue}{\left(b + \left(-\sqrt{\left(-b\right) \cdot \left(-b\right) - \left(3 \cdot a\right) \cdot c}\right)\right)}}{3 \cdot a} \]
      6. distribute-neg-in65.7%

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

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

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

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

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

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

    if -1.7e-53 < b

    1. Initial program 40.8%

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\left(-b\right) + \left(-\left(-\sqrt{\left(-b\right) \cdot \left(-b\right) - \left(3 \cdot a\right) \cdot c}\right)\right)}}{3 \cdot a} \]
      7. remove-double-neg40.8%

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

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

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

      \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)}}{3 \cdot a}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. sub-neg40.8%

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

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

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

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b + \color{blue}{\left(-\left(a \cdot c\right) \cdot 3\right)}}}{3 \cdot a} \]
      6. distribute-rgt-neg-in40.8%

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

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

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)}}}{3 \cdot a} \]
      10. add-exp-log34.1%

        \[\leadsto \frac{\left(-b\right) + \color{blue}{e^{\log \left(\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)}\right)}}}{3 \cdot a} \]
      11. fma-undefine34.1%

        \[\leadsto \frac{\left(-b\right) + e^{\log \left(\sqrt{\color{blue}{b \cdot b + a \cdot \left(c \cdot -3\right)}}\right)}}{3 \cdot a} \]
      12. add-sqr-sqrt32.9%

        \[\leadsto \frac{\left(-b\right) + e^{\log \left(\sqrt{b \cdot b + \color{blue}{\sqrt{a \cdot \left(c \cdot -3\right)} \cdot \sqrt{a \cdot \left(c \cdot -3\right)}}}\right)}}{3 \cdot a} \]
      13. hypot-define33.9%

        \[\leadsto \frac{\left(-b\right) + e^{\log \color{blue}{\left(\mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -3\right)}\right)\right)}}}{3 \cdot a} \]
    6. Applied egg-rr33.9%

      \[\leadsto \frac{\left(-b\right) + \color{blue}{e^{\log \left(\mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -3\right)}\right)\right)}}}{3 \cdot a} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification54.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -1.7 \cdot 10^{-53}:\\ \;\;\;\;b \cdot \left(0.6666666666666666 \cdot \frac{-1}{a} - -0.5 \cdot \frac{c}{{b}^{2}}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{e^{\log \left(\mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -3\right)}\right)\right)} - b}{a \cdot 3}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 56.4% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3}\\ \mathbf{if}\;t\_0 \leq 10^{+273}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;b \cdot \left(-\mathsf{fma}\left(0.16666666666666666, c \cdot \frac{-3}{{b}^{2}}, \frac{0.6666666666666666}{a}\right)\right)\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (/ (- (sqrt (- (* b b) (* c (* a 3.0)))) b) (* a 3.0))))
   (if (<= t_0 1e+273)
     t_0
     (*
      b
      (-
       (fma
        0.16666666666666666
        (* c (/ -3.0 (pow b 2.0)))
        (/ 0.6666666666666666 a)))))))
double code(double a, double b, double c) {
	double t_0 = (sqrt(((b * b) - (c * (a * 3.0)))) - b) / (a * 3.0);
	double tmp;
	if (t_0 <= 1e+273) {
		tmp = t_0;
	} else {
		tmp = b * -fma(0.16666666666666666, (c * (-3.0 / pow(b, 2.0))), (0.6666666666666666 / a));
	}
	return tmp;
}
function code(a, b, c)
	t_0 = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 3.0)))) - b) / Float64(a * 3.0))
	tmp = 0.0
	if (t_0 <= 1e+273)
		tmp = t_0;
	else
		tmp = Float64(b * Float64(-fma(0.16666666666666666, Float64(c * Float64(-3.0 / (b ^ 2.0))), Float64(0.6666666666666666 / a))));
	end
	return tmp
end
code[a_, b_, c_] := Block[{t$95$0 = N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(c * N[(a * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 1e+273], t$95$0, N[(b * (-N[(0.16666666666666666 * N[(c * N[(-3.0 / N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.6666666666666666 / a), $MachinePrecision]), $MachinePrecision])), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3}\\
\mathbf{if}\;t\_0 \leq 10^{+273}:\\
\;\;\;\;t\_0\\

\mathbf{else}:\\
\;\;\;\;b \cdot \left(-\mathsf{fma}\left(0.16666666666666666, c \cdot \frac{-3}{{b}^{2}}, \frac{0.6666666666666666}{a}\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 3 binary64) a) c)))) (*.f64 #s(literal 3 binary64) a)) < 9.99999999999999945e272

    1. Initial program 58.1%

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

    if 9.99999999999999945e272 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 #s(literal 3 binary64) a) c)))) (*.f64 #s(literal 3 binary64) a))

    1. Initial program 23.7%

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

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

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

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

        \[\leadsto \frac{\color{blue}{-\left(b - \sqrt{\left(-b\right) \cdot \left(-b\right) - \left(3 \cdot a\right) \cdot c}\right)}}{3 \cdot a} \]
      5. sub-neg23.7%

        \[\leadsto \frac{-\color{blue}{\left(b + \left(-\sqrt{\left(-b\right) \cdot \left(-b\right) - \left(3 \cdot a\right) \cdot c}\right)\right)}}{3 \cdot a} \]
      6. distribute-neg-in23.7%

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

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

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

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(b \cdot \left(0.16666666666666666 \cdot \frac{c \cdot {\left(\sqrt{-3}\right)}^{2}}{{b}^{2}} + 0.6666666666666666 \cdot \frac{1}{a}\right)\right)} \]
    7. Step-by-step derivation
      1. mul-1-neg0.0%

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(0.16666666666666666, \frac{c \cdot {\left(\sqrt{-3}\right)}^{2}}{{b}^{2}}, 0.6666666666666666 \cdot \frac{1}{a}\right)} \cdot \left(-b\right) \]
      5. associate-/l*0.0%

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

        \[\leadsto \mathsf{fma}\left(0.16666666666666666, c \cdot \frac{\color{blue}{\sqrt{-3} \cdot \sqrt{-3}}}{{b}^{2}}, 0.6666666666666666 \cdot \frac{1}{a}\right) \cdot \left(-b\right) \]
      7. rem-square-sqrt39.1%

        \[\leadsto \mathsf{fma}\left(0.16666666666666666, c \cdot \frac{\color{blue}{-3}}{{b}^{2}}, 0.6666666666666666 \cdot \frac{1}{a}\right) \cdot \left(-b\right) \]
      8. associate-*r/39.1%

        \[\leadsto \mathsf{fma}\left(0.16666666666666666, c \cdot \frac{-3}{{b}^{2}}, \color{blue}{\frac{0.6666666666666666 \cdot 1}{a}}\right) \cdot \left(-b\right) \]
      9. metadata-eval39.1%

        \[\leadsto \mathsf{fma}\left(0.16666666666666666, c \cdot \frac{-3}{{b}^{2}}, \frac{\color{blue}{0.6666666666666666}}{a}\right) \cdot \left(-b\right) \]
    8. Simplified39.1%

      \[\leadsto \color{blue}{\mathsf{fma}\left(0.16666666666666666, c \cdot \frac{-3}{{b}^{2}}, \frac{0.6666666666666666}{a}\right) \cdot \left(-b\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification53.3%

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

Alternative 4: 52.5% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -2.8 \cdot 10^{-106}:\\ \;\;\;\;b \cdot \left(0.6666666666666666 \cdot \frac{-1}{a} - -0.5 \cdot \frac{c}{{b}^{2}}\right)\\ \mathbf{else}:\\ \;\;\;\;0.3333333333333333 \cdot \frac{b + \mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -3\right)}\right)}{a}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b -2.8e-106)
   (* b (- (* 0.6666666666666666 (/ -1.0 a)) (* -0.5 (/ c (pow b 2.0)))))
   (* 0.3333333333333333 (/ (+ b (hypot b (sqrt (* a (* c -3.0))))) a))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= -2.8e-106) {
		tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.5 * (c / pow(b, 2.0))));
	} else {
		tmp = 0.3333333333333333 * ((b + hypot(b, sqrt((a * (c * -3.0))))) / a);
	}
	return tmp;
}
public static double code(double a, double b, double c) {
	double tmp;
	if (b <= -2.8e-106) {
		tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.5 * (c / Math.pow(b, 2.0))));
	} else {
		tmp = 0.3333333333333333 * ((b + Math.hypot(b, Math.sqrt((a * (c * -3.0))))) / a);
	}
	return tmp;
}
def code(a, b, c):
	tmp = 0
	if b <= -2.8e-106:
		tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.5 * (c / math.pow(b, 2.0))))
	else:
		tmp = 0.3333333333333333 * ((b + math.hypot(b, math.sqrt((a * (c * -3.0))))) / a)
	return tmp
function code(a, b, c)
	tmp = 0.0
	if (b <= -2.8e-106)
		tmp = Float64(b * Float64(Float64(0.6666666666666666 * Float64(-1.0 / a)) - Float64(-0.5 * Float64(c / (b ^ 2.0)))));
	else
		tmp = Float64(0.3333333333333333 * Float64(Float64(b + hypot(b, sqrt(Float64(a * Float64(c * -3.0))))) / a));
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	tmp = 0.0;
	if (b <= -2.8e-106)
		tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.5 * (c / (b ^ 2.0))));
	else
		tmp = 0.3333333333333333 * ((b + hypot(b, sqrt((a * (c * -3.0))))) / a);
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := If[LessEqual[b, -2.8e-106], N[(b * N[(N[(0.6666666666666666 * N[(-1.0 / a), $MachinePrecision]), $MachinePrecision] - N[(-0.5 * N[(c / N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.3333333333333333 * N[(N[(b + N[Sqrt[b ^ 2 + N[Sqrt[N[(a * N[(c * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.8 \cdot 10^{-106}:\\
\;\;\;\;b \cdot \left(0.6666666666666666 \cdot \frac{-1}{a} - -0.5 \cdot \frac{c}{{b}^{2}}\right)\\

\mathbf{else}:\\
\;\;\;\;0.3333333333333333 \cdot \frac{b + \mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -3\right)}\right)}{a}\\


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

    1. Initial program 68.1%

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

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

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

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

        \[\leadsto \frac{\color{blue}{-\left(b - \sqrt{\left(-b\right) \cdot \left(-b\right) - \left(3 \cdot a\right) \cdot c}\right)}}{3 \cdot a} \]
      5. sub-neg68.1%

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

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

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

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

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

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

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

    if -2.79999999999999988e-106 < b

    1. Initial program 37.7%

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

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

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

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

        \[\leadsto \frac{\color{blue}{-\left(b - \sqrt{\left(-b\right) \cdot \left(-b\right) - \left(3 \cdot a\right) \cdot c}\right)}}{3 \cdot a} \]
      5. sub-neg37.7%

        \[\leadsto \frac{-\color{blue}{\left(b + \left(-\sqrt{\left(-b\right) \cdot \left(-b\right) - \left(3 \cdot a\right) \cdot c}\right)\right)}}{3 \cdot a} \]
      6. distribute-neg-in37.7%

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

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

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

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

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

      \[\leadsto \color{blue}{\left(b + \mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -3\right)}\right)\right) \cdot \frac{0.3333333333333333}{a}} \]
    6. Step-by-step derivation
      1. *-commutative28.5%

        \[\leadsto \color{blue}{\frac{0.3333333333333333}{a} \cdot \left(b + \mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -3\right)}\right)\right)} \]
      2. associate-*l/28.5%

        \[\leadsto \color{blue}{\frac{0.3333333333333333 \cdot \left(b + \mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -3\right)}\right)\right)}{a}} \]
      3. associate-*r/28.6%

        \[\leadsto \color{blue}{0.3333333333333333 \cdot \frac{b + \mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -3\right)}\right)}{a}} \]
    7. Simplified28.6%

      \[\leadsto \color{blue}{0.3333333333333333 \cdot \frac{b + \mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -3\right)}\right)}{a}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification52.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -2.8 \cdot 10^{-106}:\\ \;\;\;\;b \cdot \left(0.6666666666666666 \cdot \frac{-1}{a} - -0.5 \cdot \frac{c}{{b}^{2}}\right)\\ \mathbf{else}:\\ \;\;\;\;0.3333333333333333 \cdot \frac{b + \mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -3\right)}\right)}{a}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 52.5% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -1.02 \cdot 10^{-102}:\\ \;\;\;\;b \cdot \left(0.6666666666666666 \cdot \frac{-1}{a} - -0.5 \cdot \frac{c}{{b}^{2}}\right)\\ \mathbf{else}:\\ \;\;\;\;0.3333333333333333 \cdot \frac{b + \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -3\right)}\right)}{a}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b -1.02e-102)
   (* b (- (* 0.6666666666666666 (/ -1.0 a)) (* -0.5 (/ c (pow b 2.0)))))
   (* 0.3333333333333333 (/ (+ b (hypot b (sqrt (* c (* a -3.0))))) a))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= -1.02e-102) {
		tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.5 * (c / pow(b, 2.0))));
	} else {
		tmp = 0.3333333333333333 * ((b + hypot(b, sqrt((c * (a * -3.0))))) / a);
	}
	return tmp;
}
public static double code(double a, double b, double c) {
	double tmp;
	if (b <= -1.02e-102) {
		tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.5 * (c / Math.pow(b, 2.0))));
	} else {
		tmp = 0.3333333333333333 * ((b + Math.hypot(b, Math.sqrt((c * (a * -3.0))))) / a);
	}
	return tmp;
}
def code(a, b, c):
	tmp = 0
	if b <= -1.02e-102:
		tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.5 * (c / math.pow(b, 2.0))))
	else:
		tmp = 0.3333333333333333 * ((b + math.hypot(b, math.sqrt((c * (a * -3.0))))) / a)
	return tmp
function code(a, b, c)
	tmp = 0.0
	if (b <= -1.02e-102)
		tmp = Float64(b * Float64(Float64(0.6666666666666666 * Float64(-1.0 / a)) - Float64(-0.5 * Float64(c / (b ^ 2.0)))));
	else
		tmp = Float64(0.3333333333333333 * Float64(Float64(b + hypot(b, sqrt(Float64(c * Float64(a * -3.0))))) / a));
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	tmp = 0.0;
	if (b <= -1.02e-102)
		tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.5 * (c / (b ^ 2.0))));
	else
		tmp = 0.3333333333333333 * ((b + hypot(b, sqrt((c * (a * -3.0))))) / a);
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := If[LessEqual[b, -1.02e-102], N[(b * N[(N[(0.6666666666666666 * N[(-1.0 / a), $MachinePrecision]), $MachinePrecision] - N[(-0.5 * N[(c / N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.3333333333333333 * N[(N[(b + N[Sqrt[b ^ 2 + N[Sqrt[N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.02 \cdot 10^{-102}:\\
\;\;\;\;b \cdot \left(0.6666666666666666 \cdot \frac{-1}{a} - -0.5 \cdot \frac{c}{{b}^{2}}\right)\\

\mathbf{else}:\\
\;\;\;\;0.3333333333333333 \cdot \frac{b + \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -3\right)}\right)}{a}\\


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

    1. Initial program 68.1%

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

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

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

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

        \[\leadsto \frac{\color{blue}{-\left(b - \sqrt{\left(-b\right) \cdot \left(-b\right) - \left(3 \cdot a\right) \cdot c}\right)}}{3 \cdot a} \]
      5. sub-neg68.1%

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

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

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

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

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

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

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

    if -1.01999999999999996e-102 < b

    1. Initial program 37.7%

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

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

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

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

        \[\leadsto \frac{\color{blue}{-\left(b - \sqrt{\left(-b\right) \cdot \left(-b\right) - \left(3 \cdot a\right) \cdot c}\right)}}{3 \cdot a} \]
      5. sub-neg37.7%

        \[\leadsto \frac{-\color{blue}{\left(b + \left(-\sqrt{\left(-b\right) \cdot \left(-b\right) - \left(3 \cdot a\right) \cdot c}\right)\right)}}{3 \cdot a} \]
      6. distribute-neg-in37.7%

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

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

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

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

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

      \[\leadsto \color{blue}{\left(b + \mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -3\right)}\right)\right) \cdot \frac{0.3333333333333333}{a}} \]
    6. Step-by-step derivation
      1. *-commutative28.5%

        \[\leadsto \color{blue}{\frac{0.3333333333333333}{a} \cdot \left(b + \mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -3\right)}\right)\right)} \]
      2. associate-*l/28.5%

        \[\leadsto \color{blue}{\frac{0.3333333333333333 \cdot \left(b + \mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -3\right)}\right)\right)}{a}} \]
      3. associate-*r/28.6%

        \[\leadsto \color{blue}{0.3333333333333333 \cdot \frac{b + \mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -3\right)}\right)}{a}} \]
      4. associate-*r*28.6%

        \[\leadsto 0.3333333333333333 \cdot \frac{b + \mathsf{hypot}\left(b, \sqrt{\color{blue}{\left(a \cdot c\right) \cdot -3}}\right)}{a} \]
      5. *-commutative28.6%

        \[\leadsto 0.3333333333333333 \cdot \frac{b + \mathsf{hypot}\left(b, \sqrt{\color{blue}{\left(c \cdot a\right)} \cdot -3}\right)}{a} \]
      6. associate-*r*28.6%

        \[\leadsto 0.3333333333333333 \cdot \frac{b + \mathsf{hypot}\left(b, \sqrt{\color{blue}{c \cdot \left(a \cdot -3\right)}}\right)}{a} \]
    7. Simplified28.6%

      \[\leadsto \color{blue}{0.3333333333333333 \cdot \frac{b + \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -3\right)}\right)}{a}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification52.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -1.02 \cdot 10^{-102}:\\ \;\;\;\;b \cdot \left(0.6666666666666666 \cdot \frac{-1}{a} - -0.5 \cdot \frac{c}{{b}^{2}}\right)\\ \mathbf{else}:\\ \;\;\;\;0.3333333333333333 \cdot \frac{b + \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -3\right)}\right)}{a}\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 52.5% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -1.06 \cdot 10^{-104}:\\ \;\;\;\;b \cdot \left(0.6666666666666666 \cdot \frac{-1}{a} - -0.5 \cdot \frac{c}{{b}^{2}}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{0.3333333333333333}{a} \cdot \left(b + \mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -3\right)}\right)\right)\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b -1.06e-104)
   (* b (- (* 0.6666666666666666 (/ -1.0 a)) (* -0.5 (/ c (pow b 2.0)))))
   (* (/ 0.3333333333333333 a) (+ b (hypot b (sqrt (* a (* c -3.0))))))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= -1.06e-104) {
		tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.5 * (c / pow(b, 2.0))));
	} else {
		tmp = (0.3333333333333333 / a) * (b + hypot(b, sqrt((a * (c * -3.0)))));
	}
	return tmp;
}
public static double code(double a, double b, double c) {
	double tmp;
	if (b <= -1.06e-104) {
		tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.5 * (c / Math.pow(b, 2.0))));
	} else {
		tmp = (0.3333333333333333 / a) * (b + Math.hypot(b, Math.sqrt((a * (c * -3.0)))));
	}
	return tmp;
}
def code(a, b, c):
	tmp = 0
	if b <= -1.06e-104:
		tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.5 * (c / math.pow(b, 2.0))))
	else:
		tmp = (0.3333333333333333 / a) * (b + math.hypot(b, math.sqrt((a * (c * -3.0)))))
	return tmp
function code(a, b, c)
	tmp = 0.0
	if (b <= -1.06e-104)
		tmp = Float64(b * Float64(Float64(0.6666666666666666 * Float64(-1.0 / a)) - Float64(-0.5 * Float64(c / (b ^ 2.0)))));
	else
		tmp = Float64(Float64(0.3333333333333333 / a) * Float64(b + hypot(b, sqrt(Float64(a * Float64(c * -3.0))))));
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	tmp = 0.0;
	if (b <= -1.06e-104)
		tmp = b * ((0.6666666666666666 * (-1.0 / a)) - (-0.5 * (c / (b ^ 2.0))));
	else
		tmp = (0.3333333333333333 / a) * (b + hypot(b, sqrt((a * (c * -3.0)))));
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := If[LessEqual[b, -1.06e-104], N[(b * N[(N[(0.6666666666666666 * N[(-1.0 / a), $MachinePrecision]), $MachinePrecision] - N[(-0.5 * N[(c / N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(0.3333333333333333 / a), $MachinePrecision] * N[(b + N[Sqrt[b ^ 2 + N[Sqrt[N[(a * N[(c * -3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.06 \cdot 10^{-104}:\\
\;\;\;\;b \cdot \left(0.6666666666666666 \cdot \frac{-1}{a} - -0.5 \cdot \frac{c}{{b}^{2}}\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{0.3333333333333333}{a} \cdot \left(b + \mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -3\right)}\right)\right)\\


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

    1. Initial program 68.1%

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

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

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

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

        \[\leadsto \frac{\color{blue}{-\left(b - \sqrt{\left(-b\right) \cdot \left(-b\right) - \left(3 \cdot a\right) \cdot c}\right)}}{3 \cdot a} \]
      5. sub-neg68.1%

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

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

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

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

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

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

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

    if -1.06e-104 < b

    1. Initial program 37.7%

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

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

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

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

        \[\leadsto \frac{\color{blue}{-\left(b - \sqrt{\left(-b\right) \cdot \left(-b\right) - \left(3 \cdot a\right) \cdot c}\right)}}{3 \cdot a} \]
      5. sub-neg37.7%

        \[\leadsto \frac{-\color{blue}{\left(b + \left(-\sqrt{\left(-b\right) \cdot \left(-b\right) - \left(3 \cdot a\right) \cdot c}\right)\right)}}{3 \cdot a} \]
      6. distribute-neg-in37.7%

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{0.3333333333333333}{a} \cdot \left(b + \mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -3\right)}\right)\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification52.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -1.06 \cdot 10^{-104}:\\ \;\;\;\;b \cdot \left(0.6666666666666666 \cdot \frac{-1}{a} - -0.5 \cdot \frac{c}{{b}^{2}}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{0.3333333333333333}{a} \cdot \left(b + \mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -3\right)}\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 51.2% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \frac{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)} - b}{a \cdot 3} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (/ (- (sqrt (fma b b (* a (* c -3.0)))) b) (* a 3.0)))
double code(double a, double b, double c) {
	return (sqrt(fma(b, b, (a * (c * -3.0)))) - b) / (a * 3.0);
}
function code(a, b, c)
	return Float64(Float64(sqrt(fma(b, b, Float64(a * Float64(c * -3.0)))) - b) / Float64(a * 3.0))
end
code[a_, b_, c_] := N[(N[(N[Sqrt[N[(b * b + N[(a * N[(c * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)} - b}{a \cdot 3}
\end{array}
Derivation
  1. Initial program 49.5%

    \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
  2. Step-by-step derivation
    1. /-rgt-identity49.5%

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

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

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

    \[\leadsto \frac{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)} - b}{a \cdot 3} \]
  6. Add Preprocessing

Alternative 8: 47.2% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \cdot 3 \leq -2 \cdot 10^{-15}:\\
\;\;\;\;\frac{-0.5 \cdot c}{b}\\

\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - 3 \cdot \left(c \cdot a\right)} - b}{a \cdot 3}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 #s(literal 3 binary64) a) < -2.0000000000000002e-15

    1. Initial program 28.6%

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\left(-b\right) + \left(-\left(-\sqrt{\left(-b\right) \cdot \left(-b\right) - \left(3 \cdot a\right) \cdot c}\right)\right)}}{3 \cdot a} \]
      7. remove-double-neg28.6%

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

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

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

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

      \[\leadsto \frac{\color{blue}{-1.5 \cdot \frac{a \cdot c}{b}}}{3 \cdot a} \]
    6. Step-by-step derivation
      1. *-commutative32.5%

        \[\leadsto \frac{\color{blue}{\frac{a \cdot c}{b} \cdot -1.5}}{3 \cdot a} \]
      2. *-commutative32.5%

        \[\leadsto \frac{\frac{a \cdot c}{b} \cdot -1.5}{\color{blue}{a \cdot 3}} \]
      3. times-frac32.4%

        \[\leadsto \color{blue}{\frac{\frac{a \cdot c}{b}}{a} \cdot \frac{-1.5}{3}} \]
      4. associate-/l*39.3%

        \[\leadsto \frac{\color{blue}{a \cdot \frac{c}{b}}}{a} \cdot \frac{-1.5}{3} \]
      5. *-un-lft-identity39.3%

        \[\leadsto \frac{a \cdot \frac{c}{b}}{\color{blue}{1 \cdot a}} \cdot \frac{-1.5}{3} \]
      6. times-frac32.4%

        \[\leadsto \color{blue}{\left(\frac{a}{1} \cdot \frac{\frac{c}{b}}{a}\right)} \cdot \frac{-1.5}{3} \]
      7. /-rgt-identity32.4%

        \[\leadsto \left(\color{blue}{a} \cdot \frac{\frac{c}{b}}{a}\right) \cdot \frac{-1.5}{3} \]
      8. metadata-eval32.4%

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

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

      \[\leadsto \color{blue}{-0.5 \cdot \frac{c}{b}} \]
    9. Step-by-step derivation
      1. *-commutative39.8%

        \[\leadsto \color{blue}{\frac{c}{b} \cdot -0.5} \]
      2. associate-*l/39.8%

        \[\leadsto \color{blue}{\frac{c \cdot -0.5}{b}} \]
      3. metadata-eval39.8%

        \[\leadsto \frac{c \cdot \color{blue}{\left(0.16666666666666666 \cdot -3\right)}}{b} \]
      4. rem-square-sqrt0.0%

        \[\leadsto \frac{c \cdot \left(0.16666666666666666 \cdot \color{blue}{\left(\sqrt{-3} \cdot \sqrt{-3}\right)}\right)}{b} \]
      5. unpow20.0%

        \[\leadsto \frac{c \cdot \left(0.16666666666666666 \cdot \color{blue}{{\left(\sqrt{-3}\right)}^{2}}\right)}{b} \]
      6. associate-*r/0.0%

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

        \[\leadsto c \cdot \frac{0.16666666666666666 \cdot \color{blue}{\left(\sqrt{-3} \cdot \sqrt{-3}\right)}}{b} \]
      8. rem-square-sqrt39.7%

        \[\leadsto c \cdot \frac{0.16666666666666666 \cdot \color{blue}{-3}}{b} \]
      9. metadata-eval39.7%

        \[\leadsto c \cdot \frac{\color{blue}{-0.5}}{b} \]
    10. Simplified39.7%

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

        \[\leadsto \color{blue}{\frac{c \cdot -0.5}{b}} \]
    12. Applied egg-rr39.8%

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

    if -2.0000000000000002e-15 < (*.f64 #s(literal 3 binary64) a)

    1. Initial program 55.8%

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

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

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

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

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

        \[\leadsto \frac{-\color{blue}{\left(b + \left(-\sqrt{\left(-b\right) \cdot \left(-b\right) - \left(3 \cdot a\right) \cdot c}\right)\right)}}{3 \cdot a} \]
      6. distribute-neg-in55.8%

        \[\leadsto \frac{\color{blue}{\left(-b\right) + \left(-\left(-\sqrt{\left(-b\right) \cdot \left(-b\right) - \left(3 \cdot a\right) \cdot c}\right)\right)}}{3 \cdot a} \]
      7. remove-double-neg55.8%

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

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

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

      \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)}}{3 \cdot a}} \]
    4. Add Preprocessing
  3. Recombined 2 regimes into one program.
  4. Final simplification52.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot 3 \leq -2 \cdot 10^{-15}:\\ \;\;\;\;\frac{-0.5 \cdot c}{b}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - 3 \cdot \left(c \cdot a\right)} - b}{a \cdot 3}\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 35.4% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;c \leq -3.4 \cdot 10^{-145}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\

\mathbf{else}:\\
\;\;\;\;b \cdot \left(0.6666666666666666 \cdot \frac{-1}{a} - -0.5 \cdot \frac{c}{{b}^{2}}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if c < -3.3999999999999999e-145

    1. Initial program 42.3%

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

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

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

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

        \[\leadsto \frac{\color{blue}{-\left(b - \sqrt{\left(-b\right) \cdot \left(-b\right) - \left(3 \cdot a\right) \cdot c}\right)}}{3 \cdot a} \]
      5. sub-neg42.3%

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

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

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

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

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

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

      \[\leadsto \color{blue}{-0.5 \cdot \frac{c}{b}} \]
    6. Step-by-step derivation
      1. *-commutative39.2%

        \[\leadsto \color{blue}{\frac{c}{b} \cdot -0.5} \]
    7. Simplified39.2%

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

    if -3.3999999999999999e-145 < c

    1. Initial program 53.1%

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

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

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

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

        \[\leadsto \frac{\color{blue}{-\left(b - \sqrt{\left(-b\right) \cdot \left(-b\right) - \left(3 \cdot a\right) \cdot c}\right)}}{3 \cdot a} \]
      5. sub-neg53.1%

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

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

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

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(b \cdot \left(-0.5 \cdot \frac{c}{{b}^{2}} + 0.6666666666666666 \cdot \frac{1}{a}\right)\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification41.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \leq -3.4 \cdot 10^{-145}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b}\\ \mathbf{else}:\\ \;\;\;\;b \cdot \left(0.6666666666666666 \cdot \frac{-1}{a} - -0.5 \cdot \frac{c}{{b}^{2}}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 51.3% accurate, 1.0× speedup?

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

\\
\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3}
\end{array}
Derivation
  1. Initial program 49.5%

    \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
  2. Add Preprocessing
  3. Final simplification49.5%

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

Alternative 11: 35.8% accurate, 11.6× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < 1.25e-241

    1. Initial program 48.7%

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

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

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

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

        \[\leadsto \frac{\color{blue}{-\left(b - \sqrt{\left(-b\right) \cdot \left(-b\right) - \left(3 \cdot a\right) \cdot c}\right)}}{3 \cdot a} \]
      5. sub-neg48.7%

        \[\leadsto \frac{-\color{blue}{\left(b + \left(-\sqrt{\left(-b\right) \cdot \left(-b\right) - \left(3 \cdot a\right) \cdot c}\right)\right)}}{3 \cdot a} \]
      6. distribute-neg-in48.7%

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

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

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

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

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

      \[\leadsto \color{blue}{-0.6666666666666666 \cdot \frac{b}{a}} \]
    6. Step-by-step derivation
      1. *-commutative42.7%

        \[\leadsto \color{blue}{\frac{b}{a} \cdot -0.6666666666666666} \]
    7. Simplified42.7%

      \[\leadsto \color{blue}{\frac{b}{a} \cdot -0.6666666666666666} \]
    8. Step-by-step derivation
      1. *-commutative42.7%

        \[\leadsto \color{blue}{-0.6666666666666666 \cdot \frac{b}{a}} \]
      2. clear-num42.7%

        \[\leadsto -0.6666666666666666 \cdot \color{blue}{\frac{1}{\frac{a}{b}}} \]
      3. un-div-inv43.9%

        \[\leadsto \color{blue}{\frac{-0.6666666666666666}{\frac{a}{b}}} \]
    9. Applied egg-rr43.9%

      \[\leadsto \color{blue}{\frac{-0.6666666666666666}{\frac{a}{b}}} \]
    10. Step-by-step derivation
      1. associate-/r/43.9%

        \[\leadsto \color{blue}{\frac{-0.6666666666666666}{a} \cdot b} \]
    11. Simplified43.9%

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

    if 1.25e-241 < a

    1. Initial program 50.4%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{-0.5 \cdot \frac{c}{b}} \]
    6. Step-by-step derivation
      1. *-commutative38.2%

        \[\leadsto \color{blue}{\frac{c}{b} \cdot -0.5} \]
    7. Simplified38.2%

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

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

Alternative 12: 35.5% accurate, 11.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.5 \cdot 10^{-19}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\

\mathbf{else}:\\
\;\;\;\;\frac{-0.6666666666666666}{\frac{a}{b}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -1.49999999999999996e-19

    1. Initial program 30.4%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{-0.5 \cdot \frac{c}{b}} \]
    6. Step-by-step derivation
      1. *-commutative39.5%

        \[\leadsto \color{blue}{\frac{c}{b} \cdot -0.5} \]
    7. Simplified39.5%

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

    if -1.49999999999999996e-19 < a

    1. Initial program 55.6%

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\left(-b\right) + \left(-\left(-\sqrt{\left(-b\right) \cdot \left(-b\right) - \left(3 \cdot a\right) \cdot c}\right)\right)}}{3 \cdot a} \]
      7. remove-double-neg55.6%

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

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

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

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

      \[\leadsto \color{blue}{-0.6666666666666666 \cdot \frac{b}{a}} \]
    6. Step-by-step derivation
      1. *-commutative40.3%

        \[\leadsto \color{blue}{\frac{b}{a} \cdot -0.6666666666666666} \]
    7. Simplified40.3%

      \[\leadsto \color{blue}{\frac{b}{a} \cdot -0.6666666666666666} \]
    8. Step-by-step derivation
      1. *-commutative40.3%

        \[\leadsto \color{blue}{-0.6666666666666666 \cdot \frac{b}{a}} \]
      2. clear-num40.3%

        \[\leadsto -0.6666666666666666 \cdot \color{blue}{\frac{1}{\frac{a}{b}}} \]
      3. un-div-inv41.1%

        \[\leadsto \color{blue}{\frac{-0.6666666666666666}{\frac{a}{b}}} \]
    9. Applied egg-rr41.1%

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

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

Alternative 13: 35.2% accurate, 23.2× speedup?

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

\\
c \cdot \frac{-0.5}{b}
\end{array}
Derivation
  1. Initial program 49.5%

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

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

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

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

      \[\leadsto \frac{\color{blue}{-\left(b - \sqrt{\left(-b\right) \cdot \left(-b\right) - \left(3 \cdot a\right) \cdot c}\right)}}{3 \cdot a} \]
    5. sub-neg49.5%

      \[\leadsto \frac{-\color{blue}{\left(b + \left(-\sqrt{\left(-b\right) \cdot \left(-b\right) - \left(3 \cdot a\right) \cdot c}\right)\right)}}{3 \cdot a} \]
    6. distribute-neg-in49.5%

      \[\leadsto \frac{\color{blue}{\left(-b\right) + \left(-\left(-\sqrt{\left(-b\right) \cdot \left(-b\right) - \left(3 \cdot a\right) \cdot c}\right)\right)}}{3 \cdot a} \]
    7. remove-double-neg49.5%

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

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

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

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

    \[\leadsto \frac{\color{blue}{-1.5 \cdot \frac{a \cdot c}{b}}}{3 \cdot a} \]
  6. Step-by-step derivation
    1. *-commutative28.1%

      \[\leadsto \frac{\color{blue}{\frac{a \cdot c}{b} \cdot -1.5}}{3 \cdot a} \]
    2. *-commutative28.1%

      \[\leadsto \frac{\frac{a \cdot c}{b} \cdot -1.5}{\color{blue}{a \cdot 3}} \]
    3. times-frac28.1%

      \[\leadsto \color{blue}{\frac{\frac{a \cdot c}{b}}{a} \cdot \frac{-1.5}{3}} \]
    4. associate-/l*31.8%

      \[\leadsto \frac{\color{blue}{a \cdot \frac{c}{b}}}{a} \cdot \frac{-1.5}{3} \]
    5. *-un-lft-identity31.8%

      \[\leadsto \frac{a \cdot \frac{c}{b}}{\color{blue}{1 \cdot a}} \cdot \frac{-1.5}{3} \]
    6. times-frac30.9%

      \[\leadsto \color{blue}{\left(\frac{a}{1} \cdot \frac{\frac{c}{b}}{a}\right)} \cdot \frac{-1.5}{3} \]
    7. /-rgt-identity30.9%

      \[\leadsto \left(\color{blue}{a} \cdot \frac{\frac{c}{b}}{a}\right) \cdot \frac{-1.5}{3} \]
    8. metadata-eval30.9%

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

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

    \[\leadsto \color{blue}{-0.5 \cdot \frac{c}{b}} \]
  9. Step-by-step derivation
    1. *-commutative35.9%

      \[\leadsto \color{blue}{\frac{c}{b} \cdot -0.5} \]
    2. associate-*l/35.9%

      \[\leadsto \color{blue}{\frac{c \cdot -0.5}{b}} \]
    3. metadata-eval35.9%

      \[\leadsto \frac{c \cdot \color{blue}{\left(0.16666666666666666 \cdot -3\right)}}{b} \]
    4. rem-square-sqrt0.0%

      \[\leadsto \frac{c \cdot \left(0.16666666666666666 \cdot \color{blue}{\left(\sqrt{-3} \cdot \sqrt{-3}\right)}\right)}{b} \]
    5. unpow20.0%

      \[\leadsto \frac{c \cdot \left(0.16666666666666666 \cdot \color{blue}{{\left(\sqrt{-3}\right)}^{2}}\right)}{b} \]
    6. associate-*r/0.0%

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

      \[\leadsto c \cdot \frac{0.16666666666666666 \cdot \color{blue}{\left(\sqrt{-3} \cdot \sqrt{-3}\right)}}{b} \]
    8. rem-square-sqrt35.8%

      \[\leadsto c \cdot \frac{0.16666666666666666 \cdot \color{blue}{-3}}{b} \]
    9. metadata-eval35.8%

      \[\leadsto c \cdot \frac{\color{blue}{-0.5}}{b} \]
  10. Simplified35.8%

    \[\leadsto \color{blue}{c \cdot \frac{-0.5}{b}} \]
  11. Final simplification35.8%

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

Alternative 14: 35.7% accurate, 23.2× speedup?

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

\\
b \cdot \frac{-0.6666666666666666}{a}
\end{array}
Derivation
  1. Initial program 49.5%

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

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

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

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

      \[\leadsto \frac{\color{blue}{-\left(b - \sqrt{\left(-b\right) \cdot \left(-b\right) - \left(3 \cdot a\right) \cdot c}\right)}}{3 \cdot a} \]
    5. sub-neg49.5%

      \[\leadsto \frac{-\color{blue}{\left(b + \left(-\sqrt{\left(-b\right) \cdot \left(-b\right) - \left(3 \cdot a\right) \cdot c}\right)\right)}}{3 \cdot a} \]
    6. distribute-neg-in49.5%

      \[\leadsto \frac{\color{blue}{\left(-b\right) + \left(-\left(-\sqrt{\left(-b\right) \cdot \left(-b\right) - \left(3 \cdot a\right) \cdot c}\right)\right)}}{3 \cdot a} \]
    7. remove-double-neg49.5%

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

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

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

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

    \[\leadsto \color{blue}{-0.6666666666666666 \cdot \frac{b}{a}} \]
  6. Step-by-step derivation
    1. *-commutative38.0%

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

    \[\leadsto \color{blue}{\frac{b}{a} \cdot -0.6666666666666666} \]
  8. Step-by-step derivation
    1. *-commutative38.0%

      \[\leadsto \color{blue}{-0.6666666666666666 \cdot \frac{b}{a}} \]
    2. clear-num38.0%

      \[\leadsto -0.6666666666666666 \cdot \color{blue}{\frac{1}{\frac{a}{b}}} \]
    3. un-div-inv38.6%

      \[\leadsto \color{blue}{\frac{-0.6666666666666666}{\frac{a}{b}}} \]
  9. Applied egg-rr38.6%

    \[\leadsto \color{blue}{\frac{-0.6666666666666666}{\frac{a}{b}}} \]
  10. Step-by-step derivation
    1. associate-/r/38.6%

      \[\leadsto \color{blue}{\frac{-0.6666666666666666}{a} \cdot b} \]
  11. Simplified38.6%

    \[\leadsto \color{blue}{\frac{-0.6666666666666666}{a} \cdot b} \]
  12. Final simplification38.6%

    \[\leadsto b \cdot \frac{-0.6666666666666666}{a} \]
  13. Add Preprocessing

Alternative 15: 35.7% accurate, 23.2× speedup?

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

\\
\frac{b}{a \cdot -1.5}
\end{array}
Derivation
  1. Initial program 49.5%

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

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

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

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

      \[\leadsto \frac{\color{blue}{-\left(b - \sqrt{\left(-b\right) \cdot \left(-b\right) - \left(3 \cdot a\right) \cdot c}\right)}}{3 \cdot a} \]
    5. sub-neg49.5%

      \[\leadsto \frac{-\color{blue}{\left(b + \left(-\sqrt{\left(-b\right) \cdot \left(-b\right) - \left(3 \cdot a\right) \cdot c}\right)\right)}}{3 \cdot a} \]
    6. distribute-neg-in49.5%

      \[\leadsto \frac{\color{blue}{\left(-b\right) + \left(-\left(-\sqrt{\left(-b\right) \cdot \left(-b\right) - \left(3 \cdot a\right) \cdot c}\right)\right)}}{3 \cdot a} \]
    7. remove-double-neg49.5%

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

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

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

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

    \[\leadsto \color{blue}{-0.6666666666666666 \cdot \frac{b}{a}} \]
  6. Step-by-step derivation
    1. *-commutative38.0%

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

    \[\leadsto \color{blue}{\frac{b}{a} \cdot -0.6666666666666666} \]
  8. Step-by-step derivation
    1. *-commutative38.0%

      \[\leadsto \color{blue}{-0.6666666666666666 \cdot \frac{b}{a}} \]
    2. clear-num38.0%

      \[\leadsto -0.6666666666666666 \cdot \color{blue}{\frac{1}{\frac{a}{b}}} \]
    3. un-div-inv38.6%

      \[\leadsto \color{blue}{\frac{-0.6666666666666666}{\frac{a}{b}}} \]
  9. Applied egg-rr38.6%

    \[\leadsto \color{blue}{\frac{-0.6666666666666666}{\frac{a}{b}}} \]
  10. Step-by-step derivation
    1. associate-/r/38.6%

      \[\leadsto \color{blue}{\frac{-0.6666666666666666}{a} \cdot b} \]
  11. Simplified38.6%

    \[\leadsto \color{blue}{\frac{-0.6666666666666666}{a} \cdot b} \]
  12. Step-by-step derivation
    1. *-commutative38.6%

      \[\leadsto \color{blue}{b \cdot \frac{-0.6666666666666666}{a}} \]
    2. clear-num38.6%

      \[\leadsto b \cdot \color{blue}{\frac{1}{\frac{a}{-0.6666666666666666}}} \]
    3. un-div-inv38.7%

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

      \[\leadsto \frac{b}{\color{blue}{a \cdot \frac{1}{-0.6666666666666666}}} \]
    5. metadata-eval38.7%

      \[\leadsto \frac{b}{a \cdot \color{blue}{-1.5}} \]
  13. Applied egg-rr38.7%

    \[\leadsto \color{blue}{\frac{b}{a \cdot -1.5}} \]
  14. Final simplification38.7%

    \[\leadsto \frac{b}{a \cdot -1.5} \]
  15. Add Preprocessing

Reproduce

?
herbie shell --seed 2024066 
(FPCore (a b c)
  :name "Cubic critical"
  :precision binary64
  (/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))