Cubic critical, wide range

Percentage Accurate: 17.2% → 99.7%
Time: 8.7s
Alternatives: 7
Speedup: 23.2×

Specification

?
\[\left(\left(4.930380657631324 \cdot 10^{-32} < a \land a < 2.028240960365167 \cdot 10^{+31}\right) \land \left(4.930380657631324 \cdot 10^{-32} < b \land b < 2.028240960365167 \cdot 10^{+31}\right)\right) \land \left(4.930380657631324 \cdot 10^{-32} < c \land c < 2.028240960365167 \cdot 10^{+31}\right)\]
\[\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 7 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: 17.2% 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: 99.7% accurate, 0.5× speedup?

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

\\
\frac{\frac{c}{\left(-b\right) - \sqrt{\mathsf{fma}\left(c, a \cdot -3, b \cdot b\right)}} \cdot \left(a \cdot 3\right)}{a \cdot 3}
\end{array}
Derivation
  1. Initial program 18.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. add-cbrt-cube18.4%

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

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

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

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

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

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

      \[\leadsto \frac{\frac{\left(-b\right) \cdot \left(-b\right) - \color{blue}{\sqrt[3]{{\left(b \cdot b - c \cdot \left(a \cdot 3\right)\right)}^{3}}}}{\left(-b\right) - \sqrt{\sqrt[3]{{\left(b \cdot b - c \cdot \left(a \cdot 3\right)\right)}^{3}}}}}{3 \cdot a} \]
    3. rem-cbrt-cube18.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{c \cdot \left(a \cdot 3\right) + 0}{\left(-b\right) - \sqrt{\color{blue}{\mathsf{fma}\left(c, -a \cdot 3, {b}^{2}\right)}}}}{3 \cdot a} \]
    12. distribute-rgt-neg-in99.5%

      \[\leadsto \frac{\frac{c \cdot \left(a \cdot 3\right) + 0}{\left(-b\right) - \sqrt{\mathsf{fma}\left(c, \color{blue}{a \cdot \left(-3\right)}, {b}^{2}\right)}}}{3 \cdot a} \]
    13. metadata-eval99.5%

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

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

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

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

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

    \[\leadsto \frac{\color{blue}{\left(c \cdot \left(a \cdot 3\right)\right) \cdot \frac{1}{\left(-b\right) - \sqrt{\mathsf{fma}\left(c, a \cdot -3, b \cdot b\right)}}}}{3 \cdot a} \]
  10. Step-by-step derivation
    1. associate-*r/99.5%

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

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

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

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

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

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

Alternative 2: 95.2% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := c \cdot \left(a \cdot 3\right)\\ t_1 := \sqrt{b \cdot b - t_0}\\ \mathbf{if}\;\frac{t_1 - b}{a \cdot 3} \leq -1000000000:\\ \;\;\;\;\frac{\frac{b \cdot b + \left(t_0 - b \cdot b\right)}{\left(-b\right) - t_1}}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;-0.375 \cdot \left(a \cdot \frac{c \cdot c}{{b}^{3}}\right) + -0.5 \cdot \frac{c}{b}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (* c (* a 3.0))) (t_1 (sqrt (- (* b b) t_0))))
   (if (<= (/ (- t_1 b) (* a 3.0)) -1000000000.0)
     (/ (/ (+ (* b b) (- t_0 (* b b))) (- (- b) t_1)) (* a 3.0))
     (+ (* -0.375 (* a (/ (* c c) (pow b 3.0)))) (* -0.5 (/ c b))))))
double code(double a, double b, double c) {
	double t_0 = c * (a * 3.0);
	double t_1 = sqrt(((b * b) - t_0));
	double tmp;
	if (((t_1 - b) / (a * 3.0)) <= -1000000000.0) {
		tmp = (((b * b) + (t_0 - (b * b))) / (-b - t_1)) / (a * 3.0);
	} else {
		tmp = (-0.375 * (a * ((c * c) / pow(b, 3.0)))) + (-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) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = c * (a * 3.0d0)
    t_1 = sqrt(((b * b) - t_0))
    if (((t_1 - b) / (a * 3.0d0)) <= (-1000000000.0d0)) then
        tmp = (((b * b) + (t_0 - (b * b))) / (-b - t_1)) / (a * 3.0d0)
    else
        tmp = ((-0.375d0) * (a * ((c * c) / (b ** 3.0d0)))) + ((-0.5d0) * (c / b))
    end if
    code = tmp
end function
public static double code(double a, double b, double c) {
	double t_0 = c * (a * 3.0);
	double t_1 = Math.sqrt(((b * b) - t_0));
	double tmp;
	if (((t_1 - b) / (a * 3.0)) <= -1000000000.0) {
		tmp = (((b * b) + (t_0 - (b * b))) / (-b - t_1)) / (a * 3.0);
	} else {
		tmp = (-0.375 * (a * ((c * c) / Math.pow(b, 3.0)))) + (-0.5 * (c / b));
	}
	return tmp;
}
def code(a, b, c):
	t_0 = c * (a * 3.0)
	t_1 = math.sqrt(((b * b) - t_0))
	tmp = 0
	if ((t_1 - b) / (a * 3.0)) <= -1000000000.0:
		tmp = (((b * b) + (t_0 - (b * b))) / (-b - t_1)) / (a * 3.0)
	else:
		tmp = (-0.375 * (a * ((c * c) / math.pow(b, 3.0)))) + (-0.5 * (c / b))
	return tmp
function code(a, b, c)
	t_0 = Float64(c * Float64(a * 3.0))
	t_1 = sqrt(Float64(Float64(b * b) - t_0))
	tmp = 0.0
	if (Float64(Float64(t_1 - b) / Float64(a * 3.0)) <= -1000000000.0)
		tmp = Float64(Float64(Float64(Float64(b * b) + Float64(t_0 - Float64(b * b))) / Float64(Float64(-b) - t_1)) / Float64(a * 3.0));
	else
		tmp = Float64(Float64(-0.375 * Float64(a * Float64(Float64(c * c) / (b ^ 3.0)))) + Float64(-0.5 * Float64(c / b)));
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	t_0 = c * (a * 3.0);
	t_1 = sqrt(((b * b) - t_0));
	tmp = 0.0;
	if (((t_1 - b) / (a * 3.0)) <= -1000000000.0)
		tmp = (((b * b) + (t_0 - (b * b))) / (-b - t_1)) / (a * 3.0);
	else
		tmp = (-0.375 * (a * ((c * c) / (b ^ 3.0)))) + (-0.5 * (c / b));
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := Block[{t$95$0 = N[(c * N[(a * 3.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(N[(b * b), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(N[(t$95$1 - b), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], -1000000000.0], N[(N[(N[(N[(b * b), $MachinePrecision] + N[(t$95$0 - N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[((-b) - t$95$1), $MachinePrecision]), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision], N[(N[(-0.375 * N[(a * N[(N[(c * c), $MachinePrecision] / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := c \cdot \left(a \cdot 3\right)\\
t_1 := \sqrt{b \cdot b - t_0}\\
\mathbf{if}\;\frac{t_1 - b}{a \cdot 3} \leq -1000000000:\\
\;\;\;\;\frac{\frac{b \cdot b + \left(t_0 - b \cdot b\right)}{\left(-b\right) - t_1}}{a \cdot 3}\\

\mathbf{else}:\\
\;\;\;\;-0.375 \cdot \left(a \cdot \frac{c \cdot c}{{b}^{3}}\right) + -0.5 \cdot \frac{c}{b}\\


\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 3 a) c)))) (*.f64 3 a)) < -1e9

    1. Initial program 87.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. add-cbrt-cube87.3%

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

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

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

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

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

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

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

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

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

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

    if -1e9 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 3 a) c)))) (*.f64 3 a))

    1. Initial program 14.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. /-rgt-identity14.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{-0.3333333333333333} \cdot \frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{-a} \]
      15. neg-mul-114.7%

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

      \[\leadsto \color{blue}{-0.3333333333333333 \cdot \frac{b - \sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)}}{a}} \]
    4. Taylor expanded in b around inf 96.9%

      \[\leadsto \color{blue}{-0.5 \cdot \frac{c}{b} + -0.375 \cdot \frac{{c}^{2} \cdot a}{{b}^{3}}} \]
    5. Step-by-step derivation
      1. +-commutative96.9%

        \[\leadsto \color{blue}{-0.375 \cdot \frac{{c}^{2} \cdot a}{{b}^{3}} + -0.5 \cdot \frac{c}{b}} \]
      2. fma-def96.9%

        \[\leadsto \color{blue}{\mathsf{fma}\left(-0.375, \frac{{c}^{2} \cdot a}{{b}^{3}}, -0.5 \cdot \frac{c}{b}\right)} \]
      3. associate-/l*96.9%

        \[\leadsto \mathsf{fma}\left(-0.375, \color{blue}{\frac{{c}^{2}}{\frac{{b}^{3}}{a}}}, -0.5 \cdot \frac{c}{b}\right) \]
      4. unpow296.9%

        \[\leadsto \mathsf{fma}\left(-0.375, \frac{\color{blue}{c \cdot c}}{\frac{{b}^{3}}{a}}, -0.5 \cdot \frac{c}{b}\right) \]
    6. Simplified96.9%

      \[\leadsto \color{blue}{\mathsf{fma}\left(-0.375, \frac{c \cdot c}{\frac{{b}^{3}}{a}}, -0.5 \cdot \frac{c}{b}\right)} \]
    7. Step-by-step derivation
      1. fma-udef96.9%

        \[\leadsto \color{blue}{-0.375 \cdot \frac{c \cdot c}{\frac{{b}^{3}}{a}} + -0.5 \cdot \frac{c}{b}} \]
      2. associate-/r/96.9%

        \[\leadsto -0.375 \cdot \color{blue}{\left(\frac{c \cdot c}{{b}^{3}} \cdot a\right)} + -0.5 \cdot \frac{c}{b} \]
    8. Applied egg-rr96.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3} \leq -1000000000:\\ \;\;\;\;\frac{\frac{b \cdot b + \left(c \cdot \left(a \cdot 3\right) - b \cdot b\right)}{\left(-b\right) - \sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)}}}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;-0.375 \cdot \left(a \cdot \frac{c \cdot c}{{b}^{3}}\right) + -0.5 \cdot \frac{c}{b}\\ \end{array} \]

Alternative 3: 95.1% accurate, 0.5× 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 -1000000000:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;-0.375 \cdot \left(a \cdot \frac{c \cdot c}{{b}^{3}}\right) + -0.5 \cdot \frac{c}{b}\\ \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 -1000000000.0)
     t_0
     (+ (* -0.375 (* a (/ (* c c) (pow b 3.0)))) (* -0.5 (/ c b))))))
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 <= -1000000000.0) {
		tmp = t_0;
	} else {
		tmp = (-0.375 * (a * ((c * c) / pow(b, 3.0)))) + (-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) :: t_0
    real(8) :: tmp
    t_0 = (sqrt(((b * b) - (c * (a * 3.0d0)))) - b) / (a * 3.0d0)
    if (t_0 <= (-1000000000.0d0)) then
        tmp = t_0
    else
        tmp = ((-0.375d0) * (a * ((c * c) / (b ** 3.0d0)))) + ((-0.5d0) * (c / b))
    end if
    code = tmp
end function
public static double code(double a, double b, double c) {
	double t_0 = (Math.sqrt(((b * b) - (c * (a * 3.0)))) - b) / (a * 3.0);
	double tmp;
	if (t_0 <= -1000000000.0) {
		tmp = t_0;
	} else {
		tmp = (-0.375 * (a * ((c * c) / Math.pow(b, 3.0)))) + (-0.5 * (c / b));
	}
	return tmp;
}
def code(a, b, c):
	t_0 = (math.sqrt(((b * b) - (c * (a * 3.0)))) - b) / (a * 3.0)
	tmp = 0
	if t_0 <= -1000000000.0:
		tmp = t_0
	else:
		tmp = (-0.375 * (a * ((c * c) / math.pow(b, 3.0)))) + (-0.5 * (c / b))
	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 <= -1000000000.0)
		tmp = t_0;
	else
		tmp = Float64(Float64(-0.375 * Float64(a * Float64(Float64(c * c) / (b ^ 3.0)))) + Float64(-0.5 * Float64(c / b)));
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	t_0 = (sqrt(((b * b) - (c * (a * 3.0)))) - b) / (a * 3.0);
	tmp = 0.0;
	if (t_0 <= -1000000000.0)
		tmp = t_0;
	else
		tmp = (-0.375 * (a * ((c * c) / (b ^ 3.0)))) + (-0.5 * (c / b));
	end
	tmp_2 = 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, -1000000000.0], t$95$0, N[(N[(-0.375 * N[(a * N[(N[(c * c), $MachinePrecision] / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-0.5 * N[(c / b), $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 -1000000000:\\
\;\;\;\;t_0\\

\mathbf{else}:\\
\;\;\;\;-0.375 \cdot \left(a \cdot \frac{c \cdot c}{{b}^{3}}\right) + -0.5 \cdot \frac{c}{b}\\


\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 3 a) c)))) (*.f64 3 a)) < -1e9

    1. Initial program 87.5%

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

    if -1e9 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 3 a) c)))) (*.f64 3 a))

    1. Initial program 14.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. /-rgt-identity14.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{-0.3333333333333333} \cdot \frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{-a} \]
      15. neg-mul-114.7%

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

      \[\leadsto \color{blue}{-0.3333333333333333 \cdot \frac{b - \sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)}}{a}} \]
    4. Taylor expanded in b around inf 96.9%

      \[\leadsto \color{blue}{-0.5 \cdot \frac{c}{b} + -0.375 \cdot \frac{{c}^{2} \cdot a}{{b}^{3}}} \]
    5. Step-by-step derivation
      1. +-commutative96.9%

        \[\leadsto \color{blue}{-0.375 \cdot \frac{{c}^{2} \cdot a}{{b}^{3}} + -0.5 \cdot \frac{c}{b}} \]
      2. fma-def96.9%

        \[\leadsto \color{blue}{\mathsf{fma}\left(-0.375, \frac{{c}^{2} \cdot a}{{b}^{3}}, -0.5 \cdot \frac{c}{b}\right)} \]
      3. associate-/l*96.9%

        \[\leadsto \mathsf{fma}\left(-0.375, \color{blue}{\frac{{c}^{2}}{\frac{{b}^{3}}{a}}}, -0.5 \cdot \frac{c}{b}\right) \]
      4. unpow296.9%

        \[\leadsto \mathsf{fma}\left(-0.375, \frac{\color{blue}{c \cdot c}}{\frac{{b}^{3}}{a}}, -0.5 \cdot \frac{c}{b}\right) \]
    6. Simplified96.9%

      \[\leadsto \color{blue}{\mathsf{fma}\left(-0.375, \frac{c \cdot c}{\frac{{b}^{3}}{a}}, -0.5 \cdot \frac{c}{b}\right)} \]
    7. Step-by-step derivation
      1. fma-udef96.9%

        \[\leadsto \color{blue}{-0.375 \cdot \frac{c \cdot c}{\frac{{b}^{3}}{a}} + -0.5 \cdot \frac{c}{b}} \]
      2. associate-/r/96.9%

        \[\leadsto -0.375 \cdot \color{blue}{\left(\frac{c \cdot c}{{b}^{3}} \cdot a\right)} + -0.5 \cdot \frac{c}{b} \]
    8. Applied egg-rr96.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3} \leq -1000000000:\\ \;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;-0.375 \cdot \left(a \cdot \frac{c \cdot c}{{b}^{3}}\right) + -0.5 \cdot \frac{c}{b}\\ \end{array} \]

Alternative 4: 99.3% accurate, 0.5× speedup?

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

\\
\frac{1}{a} \cdot \frac{c}{\frac{\left(-b\right) - \sqrt{\mathsf{fma}\left(c, a \cdot -3, b \cdot b\right)}}{a}}
\end{array}
Derivation
  1. Initial program 18.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. add-cbrt-cube18.4%

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

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

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

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

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

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

      \[\leadsto \frac{\frac{\left(-b\right) \cdot \left(-b\right) - \color{blue}{\sqrt[3]{{\left(b \cdot b - c \cdot \left(a \cdot 3\right)\right)}^{3}}}}{\left(-b\right) - \sqrt{\sqrt[3]{{\left(b \cdot b - c \cdot \left(a \cdot 3\right)\right)}^{3}}}}}{3 \cdot a} \]
    3. rem-cbrt-cube18.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{c \cdot \left(a \cdot 3\right) + 0}{\left(-b\right) - \sqrt{\color{blue}{\mathsf{fma}\left(c, -a \cdot 3, {b}^{2}\right)}}}}{3 \cdot a} \]
    12. distribute-rgt-neg-in99.5%

      \[\leadsto \frac{\frac{c \cdot \left(a \cdot 3\right) + 0}{\left(-b\right) - \sqrt{\mathsf{fma}\left(c, \color{blue}{a \cdot \left(-3\right)}, {b}^{2}\right)}}}{3 \cdot a} \]
    13. metadata-eval99.5%

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

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

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

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

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

    \[\leadsto \frac{\color{blue}{\left(c \cdot \left(a \cdot 3\right)\right) \cdot \frac{1}{\left(-b\right) - \sqrt{\mathsf{fma}\left(c, a \cdot -3, b \cdot b\right)}}}}{3 \cdot a} \]
  10. Step-by-step derivation
    1. associate-*r/99.5%

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

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

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

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

    \[\leadsto \frac{\color{blue}{\frac{c}{\left(-b\right) - \sqrt{\mathsf{fma}\left(c, a \cdot -3, b \cdot b\right)}} \cdot \left(a \cdot 3\right)}}{3 \cdot a} \]
  12. Step-by-step derivation
    1. expm1-log1p-u83.0%

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

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{\frac{c}{\left(-b\right) - \sqrt{\mathsf{fma}\left(c, a \cdot -3, b \cdot b\right)}} \cdot \left(a \cdot 3\right)}{3 \cdot a}\right)} - 1} \]
    3. times-frac20.8%

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

    \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{\frac{c}{\left(-b\right) - \sqrt{\mathsf{fma}\left(c, a \cdot -3, b \cdot b\right)}}}{3} \cdot \frac{a \cdot 3}{a}\right)} - 1} \]
  14. Step-by-step derivation
    1. expm1-def82.7%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{1}}{a} \cdot \frac{c \cdot a}{\left(-b\right) - \sqrt{\mathsf{fma}\left(c, a \cdot -3, b \cdot b\right)}} \]
    14. associate-/l*99.4%

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

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

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

Alternative 5: 99.7% accurate, 0.5× speedup?

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

\\
\frac{\frac{c \cdot a}{a}}{\left(-b\right) - \sqrt{\mathsf{fma}\left(c, a \cdot -3, b \cdot b\right)}}
\end{array}
Derivation
  1. Initial program 18.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. add-cbrt-cube18.4%

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

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

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

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

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

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

      \[\leadsto \frac{\frac{\left(-b\right) \cdot \left(-b\right) - \color{blue}{\sqrt[3]{{\left(b \cdot b - c \cdot \left(a \cdot 3\right)\right)}^{3}}}}{\left(-b\right) - \sqrt{\sqrt[3]{{\left(b \cdot b - c \cdot \left(a \cdot 3\right)\right)}^{3}}}}}{3 \cdot a} \]
    3. rem-cbrt-cube18.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{c \cdot \left(a \cdot 3\right) + 0}{\left(-b\right) - \sqrt{\color{blue}{\mathsf{fma}\left(c, -a \cdot 3, {b}^{2}\right)}}}}{3 \cdot a} \]
    12. distribute-rgt-neg-in99.5%

      \[\leadsto \frac{\frac{c \cdot \left(a \cdot 3\right) + 0}{\left(-b\right) - \sqrt{\mathsf{fma}\left(c, \color{blue}{a \cdot \left(-3\right)}, {b}^{2}\right)}}}{3 \cdot a} \]
    13. metadata-eval99.5%

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{c \cdot \left(a \cdot 3\right)}{\left(-b\right) - \sqrt{\mathsf{fma}\left(c, a \cdot -3, b \cdot b\right)}} \cdot \frac{1}{a \cdot 3}} \]
  10. Step-by-step derivation
    1. associate-*l/99.5%

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

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

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

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

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

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

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

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

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

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

Alternative 6: 95.5% accurate, 1.0× speedup?

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

\\
-0.375 \cdot \left(a \cdot \frac{c \cdot c}{{b}^{3}}\right) + -0.5 \cdot \frac{c}{b}
\end{array}
Derivation
  1. Initial program 18.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. /-rgt-identity18.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{-0.3333333333333333} \cdot \frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{-a} \]
    15. neg-mul-118.4%

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

    \[\leadsto \color{blue}{-0.3333333333333333 \cdot \frac{b - \sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)}}{a}} \]
  4. Taylor expanded in b around inf 94.5%

    \[\leadsto \color{blue}{-0.5 \cdot \frac{c}{b} + -0.375 \cdot \frac{{c}^{2} \cdot a}{{b}^{3}}} \]
  5. Step-by-step derivation
    1. +-commutative94.5%

      \[\leadsto \color{blue}{-0.375 \cdot \frac{{c}^{2} \cdot a}{{b}^{3}} + -0.5 \cdot \frac{c}{b}} \]
    2. fma-def94.5%

      \[\leadsto \color{blue}{\mathsf{fma}\left(-0.375, \frac{{c}^{2} \cdot a}{{b}^{3}}, -0.5 \cdot \frac{c}{b}\right)} \]
    3. associate-/l*94.5%

      \[\leadsto \mathsf{fma}\left(-0.375, \color{blue}{\frac{{c}^{2}}{\frac{{b}^{3}}{a}}}, -0.5 \cdot \frac{c}{b}\right) \]
    4. unpow294.5%

      \[\leadsto \mathsf{fma}\left(-0.375, \frac{\color{blue}{c \cdot c}}{\frac{{b}^{3}}{a}}, -0.5 \cdot \frac{c}{b}\right) \]
  6. Simplified94.5%

    \[\leadsto \color{blue}{\mathsf{fma}\left(-0.375, \frac{c \cdot c}{\frac{{b}^{3}}{a}}, -0.5 \cdot \frac{c}{b}\right)} \]
  7. Step-by-step derivation
    1. fma-udef94.5%

      \[\leadsto \color{blue}{-0.375 \cdot \frac{c \cdot c}{\frac{{b}^{3}}{a}} + -0.5 \cdot \frac{c}{b}} \]
    2. associate-/r/94.5%

      \[\leadsto -0.375 \cdot \color{blue}{\left(\frac{c \cdot c}{{b}^{3}} \cdot a\right)} + -0.5 \cdot \frac{c}{b} \]
  8. Applied egg-rr94.5%

    \[\leadsto \color{blue}{-0.375 \cdot \left(\frac{c \cdot c}{{b}^{3}} \cdot a\right) + -0.5 \cdot \frac{c}{b}} \]
  9. Final simplification94.5%

    \[\leadsto -0.375 \cdot \left(a \cdot \frac{c \cdot c}{{b}^{3}}\right) + -0.5 \cdot \frac{c}{b} \]

Alternative 7: 90.8% accurate, 23.2× speedup?

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

\\
-0.5 \cdot \frac{c}{b}
\end{array}
Derivation
  1. Initial program 18.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. /-rgt-identity18.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{-0.3333333333333333} \cdot \frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{-a} \]
    15. neg-mul-118.4%

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

    \[\leadsto \color{blue}{-0.3333333333333333 \cdot \frac{b - \sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)}}{a}} \]
  4. Taylor expanded in b around inf 89.7%

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

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

Reproduce

?
herbie shell --seed 2023230 
(FPCore (a b c)
  :name "Cubic critical, wide range"
  :precision binary64
  :pre (and (and (and (< 4.930380657631324e-32 a) (< a 2.028240960365167e+31)) (and (< 4.930380657631324e-32 b) (< b 2.028240960365167e+31))) (and (< 4.930380657631324e-32 c) (< c 2.028240960365167e+31)))
  (/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))