Cubic critical

Percentage Accurate: 52.0% → 85.8%
Time: 17.2s
Alternatives: 8
Speedup: 11.6×

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 8 alternatives:

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

Initial Program: 52.0% 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: 85.8% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.6 \cdot 10^{+118}:\\
\;\;\;\;\frac{\frac{b \cdot 2}{-3}}{a}\\

\mathbf{elif}\;b \leq 1.1 \cdot 10^{-41}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - \left(a \cdot 3\right) \cdot c} - b}{a \cdot 3}\\

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


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

    1. Initial program 57.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-sub057.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-neg57.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-57.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-neg57.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-neg57.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-in57.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-neg57.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-neg57.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*57.3%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
    3. Simplified57.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. Applied egg-rr51.8%

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

      \[\leadsto \color{blue}{\left(2 \cdot b\right)} \cdot \frac{1}{a \cdot -3} \]
    7. Step-by-step derivation
      1. *-commutative96.5%

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

      \[\leadsto \color{blue}{\left(b \cdot 2\right)} \cdot \frac{1}{a \cdot -3} \]
    9. Step-by-step derivation
      1. un-div-inv96.5%

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

        \[\leadsto \frac{b \cdot 2}{\color{blue}{-3 \cdot a}} \]
      3. associate-/r*96.5%

        \[\leadsto \color{blue}{\frac{\frac{b \cdot 2}{-3}}{a}} \]
    10. Applied egg-rr96.5%

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

    if -2.60000000000000016e118 < b < 1.1e-41

    1. Initial program 84.6%

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

    if 1.1e-41 < b

    1. Initial program 12.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-sub012.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-neg12.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-12.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-neg12.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-neg12.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-in12.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-neg12.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-neg12.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*12.4%

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

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

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

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

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

Alternative 2: 85.7% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.3 \cdot 10^{+118}:\\
\;\;\;\;\frac{\frac{b \cdot 2}{-3}}{a}\\

\mathbf{elif}\;b \leq 1.3 \cdot 10^{-41}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)} - b}{a \cdot 3}\\

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


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

    1. Initial program 57.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-sub057.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-neg57.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-57.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-neg57.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-neg57.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-in57.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-neg57.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-neg57.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*57.3%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
    3. Simplified57.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. Applied egg-rr51.8%

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

      \[\leadsto \color{blue}{\left(2 \cdot b\right)} \cdot \frac{1}{a \cdot -3} \]
    7. Step-by-step derivation
      1. *-commutative96.5%

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

      \[\leadsto \color{blue}{\left(b \cdot 2\right)} \cdot \frac{1}{a \cdot -3} \]
    9. Step-by-step derivation
      1. un-div-inv96.5%

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

        \[\leadsto \frac{b \cdot 2}{\color{blue}{-3 \cdot a}} \]
      3. associate-/r*96.5%

        \[\leadsto \color{blue}{\frac{\frac{b \cdot 2}{-3}}{a}} \]
    10. Applied egg-rr96.5%

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

    if -2.30000000000000016e118 < b < 1.3e-41

    1. Initial program 84.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-sub084.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-neg84.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-84.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-neg84.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-neg84.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-in84.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-neg84.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-neg84.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*84.4%

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

    if 1.3e-41 < b

    1. Initial program 12.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-sub012.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-neg12.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-12.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-neg12.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-neg12.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-in12.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-neg12.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-neg12.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*12.4%

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

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

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

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

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

Alternative 3: 80.2% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;b \leq 2 \cdot 10^{-41}:\\
\;\;\;\;\frac{-0.3333333333333333}{a} \cdot \left(b - \sqrt{a \cdot \left(-3 \cdot c\right)}\right)\\

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


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

    1. Initial program 69.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-sub069.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-neg69.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-69.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-neg69.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-neg69.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-in69.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-neg69.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-neg69.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*69.5%

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

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

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

        \[\leadsto \color{blue}{\frac{b}{a} \cdot -0.6666666666666666} \]
      2. associate-*l/93.2%

        \[\leadsto \color{blue}{\frac{b \cdot -0.6666666666666666}{a}} \]
      3. associate-/l*93.2%

        \[\leadsto \color{blue}{b \cdot \frac{-0.6666666666666666}{a}} \]
    8. Simplified93.2%

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

    if -8.9999999999999995e-14 < b < 2.00000000000000001e-41

    1. Initial program 81.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-sub081.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-neg81.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-81.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-neg81.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-neg81.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-in81.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-neg81.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-neg81.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*81.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\color{blue}{b} - \sqrt{c \cdot \left(a \cdot -3\right)}\right) \cdot \frac{1}{-3 \cdot a} \]
      15. distribute-lft-neg-in73.9%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{-0.3333333333333333}{a} \cdot \left(b - \sqrt{a \cdot \left(c \cdot \color{blue}{-3}\right)}\right) \]
    11. Simplified73.9%

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

    if 2.00000000000000001e-41 < b

    1. Initial program 12.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-sub012.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-neg12.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-12.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-neg12.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-neg12.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-in12.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-neg12.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-neg12.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*12.4%

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

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

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

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

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

Alternative 4: 80.3% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;b \leq 1.7 \cdot 10^{-41}:\\
\;\;\;\;\frac{\sqrt{c \cdot \left(-3 \cdot a\right)} - b}{a \cdot 3}\\

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


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

    1. Initial program 69.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-sub069.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-neg69.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-69.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-neg69.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-neg69.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-in69.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-neg69.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-neg69.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*69.5%

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

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

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

        \[\leadsto \color{blue}{\frac{b}{a} \cdot -0.6666666666666666} \]
      2. associate-*l/93.2%

        \[\leadsto \color{blue}{\frac{b \cdot -0.6666666666666666}{a}} \]
      3. associate-/l*93.2%

        \[\leadsto \color{blue}{b \cdot \frac{-0.6666666666666666}{a}} \]
    8. Simplified93.2%

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

    if -1.14999999999999995e-15 < b < 1.6999999999999999e-41

    1. Initial program 81.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-sub081.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-neg81.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-81.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-neg81.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-neg81.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-in81.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-neg81.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-neg81.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*81.6%

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

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

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

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

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

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

    if 1.6999999999999999e-41 < b

    1. Initial program 12.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-sub012.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-neg12.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-12.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-neg12.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-neg12.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-in12.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-neg12.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-neg12.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*12.4%

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

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

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

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

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

Alternative 5: 67.0% accurate, 9.7× speedup?

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

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

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


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

    1. Initial program 75.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-sub075.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-neg75.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-75.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-neg75.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-neg75.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-in75.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-neg75.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-neg75.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*75.0%

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

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

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

      \[\leadsto \color{blue}{\left(2 \cdot b\right)} \cdot \frac{1}{a \cdot -3} \]
    7. Step-by-step derivation
      1. *-commutative62.6%

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

      \[\leadsto \color{blue}{\left(b \cdot 2\right)} \cdot \frac{1}{a \cdot -3} \]
    9. Step-by-step derivation
      1. un-div-inv62.7%

        \[\leadsto \color{blue}{\frac{b \cdot 2}{a \cdot -3}} \]
      2. *-commutative62.7%

        \[\leadsto \frac{b \cdot 2}{\color{blue}{-3 \cdot a}} \]
      3. associate-/r*62.7%

        \[\leadsto \color{blue}{\frac{\frac{b \cdot 2}{-3}}{a}} \]
    10. Applied egg-rr62.7%

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

    if 1.80000000000000008e-232 < b

    1. Initial program 29.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 66.9% accurate, 11.6× speedup?

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

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

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


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

    1. Initial program 75.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-sub075.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-neg75.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-75.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-neg75.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-neg75.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-in75.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-neg75.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-neg75.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*75.0%

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

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

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

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

        \[\leadsto \color{blue}{\frac{b}{a} \cdot -0.6666666666666666} \]
      2. associate-*l/62.6%

        \[\leadsto \color{blue}{\frac{b \cdot -0.6666666666666666}{a}} \]
      3. associate-/l*62.7%

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

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

    if 1.80000000000000008e-232 < b

    1. Initial program 29.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 2.5% accurate, 23.2× speedup?

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

\\
1.3333333333333333 \cdot \frac{b}{a}
\end{array}
Derivation
  1. Initial program 55.2%

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

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

      \[\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. Simplified55.1%

    \[\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. Step-by-step derivation
    1. *-un-lft-identity55.1%

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

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

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

      \[\leadsto \frac{\mathsf{fma}\left(1, \sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)}, -\color{blue}{1 \cdot b}\right) + \mathsf{fma}\left(-b, 1, b \cdot 1\right)}{3 \cdot a} \]
    5. *-un-lft-identity55.1%

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

      \[\leadsto \frac{\color{blue}{\left(1 \cdot \sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)} + \left(-b\right)\right)} + \mathsf{fma}\left(-b, 1, b \cdot 1\right)}{3 \cdot a} \]
    7. *-un-lft-identity55.1%

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\left(b + \sqrt{b \cdot b + \color{blue}{\sqrt{a \cdot \left(c \cdot -3\right)} \cdot \sqrt{a \cdot \left(c \cdot -3\right)}}}\right) + \mathsf{fma}\left(-b, 1, b \cdot 1\right)}{3 \cdot a} \]
    16. hypot-define28.1%

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

    \[\leadsto \frac{\color{blue}{\left(b + \mathsf{hypot}\left(b, \sqrt{a \cdot \left(c \cdot -3\right)}\right)\right) + \mathsf{fma}\left(b, 1, b\right)}}{3 \cdot a} \]
  7. Step-by-step derivation
    1. +-commutative27.7%

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

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

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

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

      \[\leadsto \frac{\mathsf{hypot}\left(b, \sqrt{\color{blue}{c \cdot \left(a \cdot -3\right)}}\right) + \left(b + \mathsf{fma}\left(b, 1, b\right)\right)}{3 \cdot a} \]
    6. fma-undefine27.8%

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

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

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

    \[\leadsto \color{blue}{1.3333333333333333 \cdot \frac{b}{a}} \]
  10. Final simplification2.3%

    \[\leadsto 1.3333333333333333 \cdot \frac{b}{a} \]
  11. Add Preprocessing

Alternative 8: 34.3% 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 55.2%

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{3 \cdot \left(a \cdot c\right)}}}{3 \cdot a} \]
  3. Simplified55.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. Applied egg-rr55.1%

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

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

      \[\leadsto \color{blue}{\frac{b}{a} \cdot -0.6666666666666666} \]
    2. associate-*l/36.6%

      \[\leadsto \color{blue}{\frac{b \cdot -0.6666666666666666}{a}} \]
    3. associate-/l*36.6%

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

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

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

Reproduce

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