Cubic critical, narrow range

Percentage Accurate: 55.6% → 97.8%
Time: 22.0s
Alternatives: 10
Speedup: 23.2×

Specification

?
\[\left(\left(1.0536712127723509 \cdot 10^{-8} < a \land a < 94906265.62425156\right) \land \left(1.0536712127723509 \cdot 10^{-8} < b \land b < 94906265.62425156\right)\right) \land \left(1.0536712127723509 \cdot 10^{-8} < c \land c < 94906265.62425156\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 10 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: 55.6% 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: 97.8% accurate, 0.2× speedup?

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

\\
\frac{\frac{\left(-3 \cdot a\right) \cdot c}{b + \sqrt{\mathsf{fma}\left(b, b, -3 \cdot \left(a \cdot c\right)\right)}}}{{\left(\sqrt[3]{a}\right)}^{2} \cdot \left(\sqrt[3]{a} \cdot 3\right)}
\end{array}
Derivation
  1. Initial program 52.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-sub052.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-neg52.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-52.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-neg52.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. neg-mul-152.5%

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

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

      \[\leadsto \frac{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)} - b}{\color{blue}{a \cdot \frac{1}{0.3333333333333333}}} \]
    2. add-cube-cbrt52.6%

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

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

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

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

    \[\leadsto \frac{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)} - b}{\color{blue}{{\left(\sqrt[3]{a}\right)}^{2} \cdot \left(\sqrt[3]{a} \cdot 3\right)}} \]
  6. Step-by-step derivation
    1. add-cbrt-cube52.6%

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

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

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

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

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

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

    \[\leadsto \frac{\color{blue}{\frac{\mathsf{fma}\left(b, b, \left(a \cdot c\right) \cdot -3\right) - b \cdot b}{\sqrt{\mathsf{fma}\left(b, b, \left(a \cdot c\right) \cdot -3\right)} + b}}}{{\left(\sqrt[3]{a}\right)}^{2} \cdot \left(\sqrt[3]{a} \cdot 3\right)} \]
  10. Taylor expanded in b around 0 97.8%

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

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

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

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

Alternative 2: 89.4% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3} \leq -0.09:\\ \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(-3 \cdot c\right)\right)} - b}{\frac{a}{0.3333333333333333}}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-0.5, \frac{c}{b}, -0.375 \cdot \left(\frac{a}{{b}^{3}} \cdot \left(c \cdot c\right)\right)\right) + -0.5625 \cdot \frac{a \cdot a}{\frac{{b}^{5}}{{c}^{3}}}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= (/ (- (sqrt (- (* b b) (* c (* a 3.0)))) b) (* a 3.0)) -0.09)
   (/ (- (sqrt (fma b b (* a (* -3.0 c)))) b) (/ a 0.3333333333333333))
   (+
    (fma -0.5 (/ c b) (* -0.375 (* (/ a (pow b 3.0)) (* c c))))
    (* -0.5625 (/ (* a a) (/ (pow b 5.0) (pow c 3.0)))))))
double code(double a, double b, double c) {
	double tmp;
	if (((sqrt(((b * b) - (c * (a * 3.0)))) - b) / (a * 3.0)) <= -0.09) {
		tmp = (sqrt(fma(b, b, (a * (-3.0 * c)))) - b) / (a / 0.3333333333333333);
	} else {
		tmp = fma(-0.5, (c / b), (-0.375 * ((a / pow(b, 3.0)) * (c * c)))) + (-0.5625 * ((a * a) / (pow(b, 5.0) / pow(c, 3.0))));
	}
	return tmp;
}
function code(a, b, c)
	tmp = 0.0
	if (Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 3.0)))) - b) / Float64(a * 3.0)) <= -0.09)
		tmp = Float64(Float64(sqrt(fma(b, b, Float64(a * Float64(-3.0 * c)))) - b) / Float64(a / 0.3333333333333333));
	else
		tmp = Float64(fma(-0.5, Float64(c / b), Float64(-0.375 * Float64(Float64(a / (b ^ 3.0)) * Float64(c * c)))) + Float64(-0.5625 * Float64(Float64(a * a) / Float64((b ^ 5.0) / (c ^ 3.0)))));
	end
	return tmp
end
code[a_, b_, c_] := If[LessEqual[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], -0.09], N[(N[(N[Sqrt[N[(b * b + N[(a * N[(-3.0 * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a / 0.3333333333333333), $MachinePrecision]), $MachinePrecision], N[(N[(-0.5 * N[(c / b), $MachinePrecision] + N[(-0.375 * N[(N[(a / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision] * N[(c * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-0.5625 * N[(N[(a * a), $MachinePrecision] / N[(N[Power[b, 5.0], $MachinePrecision] / N[Power[c, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3} \leq -0.09:\\
\;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(-3 \cdot c\right)\right)} - b}{\frac{a}{0.3333333333333333}}\\

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


\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)) < -0.089999999999999997

    1. Initial program 82.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-sub082.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-neg82.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-82.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-neg82.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. neg-mul-182.2%

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

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

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

    1. Initial program 44.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-sub044.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-neg44.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-44.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-neg44.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. neg-mul-144.6%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{-1.6875 \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{5} \cdot {\left(\sqrt{3}\right)}^{2}} + \left(-1.5 \cdot \frac{c}{b \cdot {\left(\sqrt{3}\right)}^{2}} + -1.125 \cdot \frac{a \cdot {c}^{2}}{{b}^{3} \cdot {\left(\sqrt{3}\right)}^{2}}\right)} \]
    7. Simplified92.4%

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

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

Alternative 3: 85.3% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3} \leq -0.008:\\ \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(-3 \cdot c\right)\right)} - b}{{\left(\sqrt{a \cdot 3}\right)}^{2}}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-0.375, \frac{a}{{b}^{3}} \cdot \left(c \cdot c\right), -0.5 \cdot \frac{c}{b}\right)\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= (/ (- (sqrt (- (* b b) (* c (* a 3.0)))) b) (* a 3.0)) -0.008)
   (/ (- (sqrt (fma b b (* a (* -3.0 c)))) b) (pow (sqrt (* a 3.0)) 2.0))
   (fma -0.375 (* (/ a (pow b 3.0)) (* c c)) (* -0.5 (/ c b)))))
double code(double a, double b, double c) {
	double tmp;
	if (((sqrt(((b * b) - (c * (a * 3.0)))) - b) / (a * 3.0)) <= -0.008) {
		tmp = (sqrt(fma(b, b, (a * (-3.0 * c)))) - b) / pow(sqrt((a * 3.0)), 2.0);
	} else {
		tmp = fma(-0.375, ((a / pow(b, 3.0)) * (c * c)), (-0.5 * (c / b)));
	}
	return tmp;
}
function code(a, b, c)
	tmp = 0.0
	if (Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 3.0)))) - b) / Float64(a * 3.0)) <= -0.008)
		tmp = Float64(Float64(sqrt(fma(b, b, Float64(a * Float64(-3.0 * c)))) - b) / (sqrt(Float64(a * 3.0)) ^ 2.0));
	else
		tmp = fma(-0.375, Float64(Float64(a / (b ^ 3.0)) * Float64(c * c)), Float64(-0.5 * Float64(c / b)));
	end
	return tmp
end
code[a_, b_, c_] := If[LessEqual[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], -0.008], N[(N[(N[Sqrt[N[(b * b + N[(a * N[(-3.0 * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[Power[N[Sqrt[N[(a * 3.0), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], N[(-0.375 * N[(N[(a / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision] * N[(c * c), $MachinePrecision]), $MachinePrecision] + N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

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

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


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

    1. Initial program 79.9%

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

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

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

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

        \[\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. neg-mul-179.9%

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

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

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

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

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

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

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

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

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

    1. Initial program 42.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 97.8% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := -3 \cdot \left(a \cdot c\right)\\ \frac{\frac{t_0}{b + \sqrt{\mathsf{fma}\left(b, b, t_0\right)}}}{{\left(\sqrt[3]{a}\right)}^{2} \cdot \left(\sqrt[3]{a} \cdot 3\right)} \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (* -3.0 (* a c))))
   (/
    (/ t_0 (+ b (sqrt (fma b b t_0))))
    (* (pow (cbrt a) 2.0) (* (cbrt a) 3.0)))))
double code(double a, double b, double c) {
	double t_0 = -3.0 * (a * c);
	return (t_0 / (b + sqrt(fma(b, b, t_0)))) / (pow(cbrt(a), 2.0) * (cbrt(a) * 3.0));
}
function code(a, b, c)
	t_0 = Float64(-3.0 * Float64(a * c))
	return Float64(Float64(t_0 / Float64(b + sqrt(fma(b, b, t_0)))) / Float64((cbrt(a) ^ 2.0) * Float64(cbrt(a) * 3.0)))
end
code[a_, b_, c_] := Block[{t$95$0 = N[(-3.0 * N[(a * c), $MachinePrecision]), $MachinePrecision]}, N[(N[(t$95$0 / N[(b + N[Sqrt[N[(b * b + t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[Power[N[Power[a, 1/3], $MachinePrecision], 2.0], $MachinePrecision] * N[(N[Power[a, 1/3], $MachinePrecision] * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := -3 \cdot \left(a \cdot c\right)\\
\frac{\frac{t_0}{b + \sqrt{\mathsf{fma}\left(b, b, t_0\right)}}}{{\left(\sqrt[3]{a}\right)}^{2} \cdot \left(\sqrt[3]{a} \cdot 3\right)}
\end{array}
\end{array}
Derivation
  1. Initial program 52.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-sub052.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-neg52.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-52.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-neg52.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. neg-mul-152.5%

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

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

      \[\leadsto \frac{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)} - b}{\color{blue}{a \cdot \frac{1}{0.3333333333333333}}} \]
    2. add-cube-cbrt52.6%

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

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

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

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

    \[\leadsto \frac{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)} - b}{\color{blue}{{\left(\sqrt[3]{a}\right)}^{2} \cdot \left(\sqrt[3]{a} \cdot 3\right)}} \]
  6. Step-by-step derivation
    1. add-cbrt-cube52.6%

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

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

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

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

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

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

    \[\leadsto \frac{\color{blue}{\frac{\mathsf{fma}\left(b, b, \left(a \cdot c\right) \cdot -3\right) - b \cdot b}{\sqrt{\mathsf{fma}\left(b, b, \left(a \cdot c\right) \cdot -3\right)} + b}}}{{\left(\sqrt[3]{a}\right)}^{2} \cdot \left(\sqrt[3]{a} \cdot 3\right)} \]
  10. Taylor expanded in b around 0 97.8%

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

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

Alternative 5: 85.3% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3} \leq -0.008:\\ \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(-3 \cdot c\right)\right)} - b}{\frac{a}{0.3333333333333333}}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-0.375, \frac{a}{{b}^{3}} \cdot \left(c \cdot c\right), -0.5 \cdot \frac{c}{b}\right)\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= (/ (- (sqrt (- (* b b) (* c (* a 3.0)))) b) (* a 3.0)) -0.008)
   (/ (- (sqrt (fma b b (* a (* -3.0 c)))) b) (/ a 0.3333333333333333))
   (fma -0.375 (* (/ a (pow b 3.0)) (* c c)) (* -0.5 (/ c b)))))
double code(double a, double b, double c) {
	double tmp;
	if (((sqrt(((b * b) - (c * (a * 3.0)))) - b) / (a * 3.0)) <= -0.008) {
		tmp = (sqrt(fma(b, b, (a * (-3.0 * c)))) - b) / (a / 0.3333333333333333);
	} else {
		tmp = fma(-0.375, ((a / pow(b, 3.0)) * (c * c)), (-0.5 * (c / b)));
	}
	return tmp;
}
function code(a, b, c)
	tmp = 0.0
	if (Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 3.0)))) - b) / Float64(a * 3.0)) <= -0.008)
		tmp = Float64(Float64(sqrt(fma(b, b, Float64(a * Float64(-3.0 * c)))) - b) / Float64(a / 0.3333333333333333));
	else
		tmp = fma(-0.375, Float64(Float64(a / (b ^ 3.0)) * Float64(c * c)), Float64(-0.5 * Float64(c / b)));
	end
	return tmp
end
code[a_, b_, c_] := If[LessEqual[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], -0.008], N[(N[(N[Sqrt[N[(b * b + N[(a * N[(-3.0 * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a / 0.3333333333333333), $MachinePrecision]), $MachinePrecision], N[(-0.375 * N[(N[(a / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision] * N[(c * c), $MachinePrecision]), $MachinePrecision] + N[(-0.5 * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3} \leq -0.008:\\
\;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(-3 \cdot c\right)\right)} - b}{\frac{a}{0.3333333333333333}}\\

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


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

    1. Initial program 79.9%

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

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

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

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

        \[\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. neg-mul-179.9%

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

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

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

    1. Initial program 42.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 85.0% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3} \leq -0.008:\\ \;\;\;\;0.3333333333333333 \cdot \frac{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(-3 \cdot c\right)\right)} - b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1.5 \cdot \left(c \cdot \frac{a}{b}\right) + -1.125 \cdot \frac{a}{\frac{\frac{{b}^{3}}{c \cdot c}}{a}}}{a \cdot 3}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= (/ (- (sqrt (- (* b b) (* c (* a 3.0)))) b) (* a 3.0)) -0.008)
   (* 0.3333333333333333 (/ (- (sqrt (fma b b (* a (* -3.0 c)))) b) a))
   (/
    (+ (* -1.5 (* c (/ a b))) (* -1.125 (/ a (/ (/ (pow b 3.0) (* c c)) a))))
    (* a 3.0))))
double code(double a, double b, double c) {
	double tmp;
	if (((sqrt(((b * b) - (c * (a * 3.0)))) - b) / (a * 3.0)) <= -0.008) {
		tmp = 0.3333333333333333 * ((sqrt(fma(b, b, (a * (-3.0 * c)))) - b) / a);
	} else {
		tmp = ((-1.5 * (c * (a / b))) + (-1.125 * (a / ((pow(b, 3.0) / (c * c)) / a)))) / (a * 3.0);
	}
	return tmp;
}
function code(a, b, c)
	tmp = 0.0
	if (Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 3.0)))) - b) / Float64(a * 3.0)) <= -0.008)
		tmp = Float64(0.3333333333333333 * Float64(Float64(sqrt(fma(b, b, Float64(a * Float64(-3.0 * c)))) - b) / a));
	else
		tmp = Float64(Float64(Float64(-1.5 * Float64(c * Float64(a / b))) + Float64(-1.125 * Float64(a / Float64(Float64((b ^ 3.0) / Float64(c * c)) / a)))) / Float64(a * 3.0));
	end
	return tmp
end
code[a_, b_, c_] := If[LessEqual[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], -0.008], N[(0.3333333333333333 * N[(N[(N[Sqrt[N[(b * b + N[(a * N[(-3.0 * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(N[(N[(-1.5 * N[(c * N[(a / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-1.125 * N[(a / N[(N[(N[Power[b, 3.0], $MachinePrecision] / N[(c * c), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3} \leq -0.008:\\
\;\;\;\;0.3333333333333333 \cdot \frac{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(-3 \cdot c\right)\right)} - b}{a}\\

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


\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)) < -0.0080000000000000002

    1. Initial program 79.9%

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

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

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

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

        \[\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. neg-mul-179.9%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)}}{a \cdot 3} - \frac{b}{\color{blue}{\left(\sqrt[3]{3 \cdot a} \cdot \sqrt[3]{3 \cdot a}\right) \cdot \sqrt[3]{3 \cdot a}}} \]
      6. add-cube-cbrt79.5%

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

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

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

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

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

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

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

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

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

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

    1. Initial program 42.0%

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{-1.5 \cdot \frac{a \cdot c}{b} + -1.125 \cdot \frac{{a}^{2} \cdot {c}^{2}}{{b}^{3}}}}{3 \cdot a} \]
    5. Step-by-step derivation
      1. fma-def89.3%

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(-1.5, \frac{a}{\frac{b}{c}}, -1.125 \cdot \frac{\color{blue}{a \cdot a}}{\frac{{b}^{3}}{{c}^{2}}}\right)}{3 \cdot a} \]
      5. unpow289.3%

        \[\leadsto \frac{\mathsf{fma}\left(-1.5, \frac{a}{\frac{b}{c}}, -1.125 \cdot \frac{a \cdot a}{\frac{{b}^{3}}{\color{blue}{c \cdot c}}}\right)}{3 \cdot a} \]
    6. Simplified89.3%

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

        \[\leadsto \frac{\color{blue}{-1.5 \cdot \frac{a}{\frac{b}{c}} + -1.125 \cdot \frac{a \cdot a}{\frac{{b}^{3}}{c \cdot c}}}}{3 \cdot a} \]
      2. associate-/r/89.1%

        \[\leadsto \frac{-1.5 \cdot \color{blue}{\left(\frac{a}{b} \cdot c\right)} + -1.125 \cdot \frac{a \cdot a}{\frac{{b}^{3}}{c \cdot c}}}{3 \cdot a} \]
      3. associate-/l*89.1%

        \[\leadsto \frac{-1.5 \cdot \left(\frac{a}{b} \cdot c\right) + -1.125 \cdot \color{blue}{\frac{a}{\frac{\frac{{b}^{3}}{c \cdot c}}{a}}}}{3 \cdot a} \]
    8. Applied egg-rr89.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3} \leq -0.008:\\ \;\;\;\;0.3333333333333333 \cdot \frac{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(-3 \cdot c\right)\right)} - b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1.5 \cdot \left(c \cdot \frac{a}{b}\right) + -1.125 \cdot \frac{a}{\frac{\frac{{b}^{3}}{c \cdot c}}{a}}}{a \cdot 3}\\ \end{array} \]

Alternative 7: 85.0% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3} \leq -0.008:\\ \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(-3 \cdot c\right)\right)} - b}{\frac{a}{0.3333333333333333}}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1.5 \cdot \left(c \cdot \frac{a}{b}\right) + -1.125 \cdot \frac{a}{\frac{\frac{{b}^{3}}{c \cdot c}}{a}}}{a \cdot 3}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= (/ (- (sqrt (- (* b b) (* c (* a 3.0)))) b) (* a 3.0)) -0.008)
   (/ (- (sqrt (fma b b (* a (* -3.0 c)))) b) (/ a 0.3333333333333333))
   (/
    (+ (* -1.5 (* c (/ a b))) (* -1.125 (/ a (/ (/ (pow b 3.0) (* c c)) a))))
    (* a 3.0))))
double code(double a, double b, double c) {
	double tmp;
	if (((sqrt(((b * b) - (c * (a * 3.0)))) - b) / (a * 3.0)) <= -0.008) {
		tmp = (sqrt(fma(b, b, (a * (-3.0 * c)))) - b) / (a / 0.3333333333333333);
	} else {
		tmp = ((-1.5 * (c * (a / b))) + (-1.125 * (a / ((pow(b, 3.0) / (c * c)) / a)))) / (a * 3.0);
	}
	return tmp;
}
function code(a, b, c)
	tmp = 0.0
	if (Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 3.0)))) - b) / Float64(a * 3.0)) <= -0.008)
		tmp = Float64(Float64(sqrt(fma(b, b, Float64(a * Float64(-3.0 * c)))) - b) / Float64(a / 0.3333333333333333));
	else
		tmp = Float64(Float64(Float64(-1.5 * Float64(c * Float64(a / b))) + Float64(-1.125 * Float64(a / Float64(Float64((b ^ 3.0) / Float64(c * c)) / a)))) / Float64(a * 3.0));
	end
	return tmp
end
code[a_, b_, c_] := If[LessEqual[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], -0.008], N[(N[(N[Sqrt[N[(b * b + N[(a * N[(-3.0 * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(a / 0.3333333333333333), $MachinePrecision]), $MachinePrecision], N[(N[(N[(-1.5 * N[(c * N[(a / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-1.125 * N[(a / N[(N[(N[Power[b, 3.0], $MachinePrecision] / N[(c * c), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * 3.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3} \leq -0.008:\\
\;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(-3 \cdot c\right)\right)} - b}{\frac{a}{0.3333333333333333}}\\

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


\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)) < -0.0080000000000000002

    1. Initial program 79.9%

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

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

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

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

        \[\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. neg-mul-179.9%

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

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

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

    1. Initial program 42.0%

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{-1.5 \cdot \frac{a \cdot c}{b} + -1.125 \cdot \frac{{a}^{2} \cdot {c}^{2}}{{b}^{3}}}}{3 \cdot a} \]
    5. Step-by-step derivation
      1. fma-def89.3%

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(-1.5, \frac{a}{\frac{b}{c}}, -1.125 \cdot \frac{\color{blue}{a \cdot a}}{\frac{{b}^{3}}{{c}^{2}}}\right)}{3 \cdot a} \]
      5. unpow289.3%

        \[\leadsto \frac{\mathsf{fma}\left(-1.5, \frac{a}{\frac{b}{c}}, -1.125 \cdot \frac{a \cdot a}{\frac{{b}^{3}}{\color{blue}{c \cdot c}}}\right)}{3 \cdot a} \]
    6. Simplified89.3%

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

        \[\leadsto \frac{\color{blue}{-1.5 \cdot \frac{a}{\frac{b}{c}} + -1.125 \cdot \frac{a \cdot a}{\frac{{b}^{3}}{c \cdot c}}}}{3 \cdot a} \]
      2. associate-/r/89.1%

        \[\leadsto \frac{-1.5 \cdot \color{blue}{\left(\frac{a}{b} \cdot c\right)} + -1.125 \cdot \frac{a \cdot a}{\frac{{b}^{3}}{c \cdot c}}}{3 \cdot a} \]
      3. associate-/l*89.1%

        \[\leadsto \frac{-1.5 \cdot \left(\frac{a}{b} \cdot c\right) + -1.125 \cdot \color{blue}{\frac{a}{\frac{\frac{{b}^{3}}{c \cdot c}}{a}}}}{3 \cdot a} \]
    8. Applied egg-rr89.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3} \leq -0.008:\\ \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(-3 \cdot c\right)\right)} - b}{\frac{a}{0.3333333333333333}}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1.5 \cdot \left(c \cdot \frac{a}{b}\right) + -1.125 \cdot \frac{a}{\frac{\frac{{b}^{3}}{c \cdot c}}{a}}}{a \cdot 3}\\ \end{array} \]

Alternative 8: 85.0% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3} \leq -0.008:\\
\;\;\;\;\frac{\sqrt{b \cdot b - \left(a \cdot c\right) \cdot 3} - b}{a \cdot 3}\\

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


\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)) < -0.0080000000000000002

    1. Initial program 79.9%

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

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

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

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

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

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

    1. Initial program 42.0%

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{-1.5 \cdot \frac{a \cdot c}{b} + -1.125 \cdot \frac{{a}^{2} \cdot {c}^{2}}{{b}^{3}}}}{3 \cdot a} \]
    5. Step-by-step derivation
      1. fma-def89.3%

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(-1.5, \frac{a}{\frac{b}{c}}, -1.125 \cdot \frac{\color{blue}{a \cdot a}}{\frac{{b}^{3}}{{c}^{2}}}\right)}{3 \cdot a} \]
      5. unpow289.3%

        \[\leadsto \frac{\mathsf{fma}\left(-1.5, \frac{a}{\frac{b}{c}}, -1.125 \cdot \frac{a \cdot a}{\frac{{b}^{3}}{\color{blue}{c \cdot c}}}\right)}{3 \cdot a} \]
    6. Simplified89.3%

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

        \[\leadsto \frac{\color{blue}{-1.5 \cdot \frac{a}{\frac{b}{c}} + -1.125 \cdot \frac{a \cdot a}{\frac{{b}^{3}}{c \cdot c}}}}{3 \cdot a} \]
      2. associate-/r/89.1%

        \[\leadsto \frac{-1.5 \cdot \color{blue}{\left(\frac{a}{b} \cdot c\right)} + -1.125 \cdot \frac{a \cdot a}{\frac{{b}^{3}}{c \cdot c}}}{3 \cdot a} \]
      3. associate-/l*89.1%

        \[\leadsto \frac{-1.5 \cdot \left(\frac{a}{b} \cdot c\right) + -1.125 \cdot \color{blue}{\frac{a}{\frac{\frac{{b}^{3}}{c \cdot c}}{a}}}}{3 \cdot a} \]
    8. Applied egg-rr89.1%

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

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

Alternative 9: 76.7% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3} \leq -1.856 \cdot 10^{-6}:\\
\;\;\;\;\frac{\sqrt{b \cdot b - \left(a \cdot c\right) \cdot 3} - b}{a \cdot 3}\\

\mathbf{else}:\\
\;\;\;\;-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)) < -1.8560000000000001e-6

    1. Initial program 74.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. sqr-neg74.3%

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

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

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

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

    if -1.8560000000000001e-6 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 3 a) c)))) (*.f64 3 a))

    1. Initial program 31.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. sqr-neg31.7%

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

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

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

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

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

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

Alternative 10: 64.1% 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 52.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. sqr-neg52.5%

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

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

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

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

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

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

Reproduce

?
herbie shell --seed 2023275 
(FPCore (a b c)
  :name "Cubic critical, narrow range"
  :precision binary64
  :pre (and (and (and (< 1.0536712127723509e-8 a) (< a 94906265.62425156)) (and (< 1.0536712127723509e-8 b) (< b 94906265.62425156))) (and (< 1.0536712127723509e-8 c) (< c 94906265.62425156)))
  (/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))