Cubic critical, narrow range

Percentage Accurate: 55.9% → 99.5%
Time: 20.8s
Alternatives: 8
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 8 alternatives:

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

Initial Program: 55.9% 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.5% accurate, 0.5× speedup?

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

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

    \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
  2. Applied egg-rr56.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 84.9% 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.0007:\\ \;\;\;\;\left(b - \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -3\right)\right)}\right) \cdot \frac{-0.3333333333333333}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-1.5, \frac{a}{\frac{b}{c}}, -1.125 \cdot \frac{\frac{c}{b} \cdot \left(a \cdot a\right)}{b \cdot \frac{b}{c}}\right)}{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.0007)
   (* (- b (sqrt (fma b b (* c (* a -3.0))))) (/ -0.3333333333333333 a))
   (/
    (fma -1.5 (/ a (/ b c)) (* -1.125 (/ (* (/ c b) (* a a)) (* b (/ b c)))))
    (* 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.0007) {
		tmp = (b - sqrt(fma(b, b, (c * (a * -3.0))))) * (-0.3333333333333333 / a);
	} else {
		tmp = fma(-1.5, (a / (b / c)), (-1.125 * (((c / b) * (a * a)) / (b * (b / c))))) / (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.0007)
		tmp = Float64(Float64(b - sqrt(fma(b, b, Float64(c * Float64(a * -3.0))))) * Float64(-0.3333333333333333 / a));
	else
		tmp = Float64(fma(-1.5, Float64(a / Float64(b / c)), Float64(-1.125 * Float64(Float64(Float64(c / b) * Float64(a * a)) / Float64(b * Float64(b / c))))) / 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.0007], N[(N[(b - N[Sqrt[N[(b * b + N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-0.3333333333333333 / a), $MachinePrecision]), $MachinePrecision], N[(N[(-1.5 * N[(a / N[(b / c), $MachinePrecision]), $MachinePrecision] + N[(-1.125 * N[(N[(N[(c / b), $MachinePrecision] * N[(a * a), $MachinePrecision]), $MachinePrecision] / N[(b * N[(b / c), $MachinePrecision]), $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.0007:\\
\;\;\;\;\left(b - \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -3\right)\right)}\right) \cdot \frac{-0.3333333333333333}{a}\\

\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-1.5, \frac{a}{\frac{b}{c}}, -1.125 \cdot \frac{\frac{c}{b} \cdot \left(a \cdot a\right)}{b \cdot \frac{b}{c}}\right)}{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)) < -6.99999999999999993e-4

    1. Initial program 79.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. fma-neg79.1%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{1}{-3 \cdot a} \cdot \left(-\left(\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -3\right)\right)} - b\right)\right)} \]
      12. distribute-lft-neg-in79.1%

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

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

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

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

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

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

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

    1. Initial program 42.9%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
    2. Taylor expanded in b around inf 89.3%

      \[\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} \]
    3. 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. unpow289.3%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\mathsf{fma}\left(-1.5, \frac{a}{\frac{b}{c}}, -1.125 \cdot \color{blue}{\frac{\frac{c}{b} \cdot \left(a \cdot a\right)}{\frac{b}{c} \cdot b}}\right)}{3 \cdot a} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification86.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.0007:\\ \;\;\;\;\left(b - \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -3\right)\right)}\right) \cdot \frac{-0.3333333333333333}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-1.5, \frac{a}{\frac{b}{c}}, -1.125 \cdot \frac{\frac{c}{b} \cdot \left(a \cdot a\right)}{b \cdot \frac{b}{c}}\right)}{a \cdot 3}\\ \end{array} \]

Alternative 3: 84.9% 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.0007:\\ \;\;\;\;\frac{b - \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -3\right)\right)}}{a} \cdot -0.3333333333333333\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-1.5, \frac{a}{\frac{b}{c}}, -1.125 \cdot \frac{\frac{c}{b} \cdot \left(a \cdot a\right)}{b \cdot \frac{b}{c}}\right)}{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.0007)
   (* (/ (- b (sqrt (fma b b (* c (* a -3.0))))) a) -0.3333333333333333)
   (/
    (fma -1.5 (/ a (/ b c)) (* -1.125 (/ (* (/ c b) (* a a)) (* b (/ b c)))))
    (* 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.0007) {
		tmp = ((b - sqrt(fma(b, b, (c * (a * -3.0))))) / a) * -0.3333333333333333;
	} else {
		tmp = fma(-1.5, (a / (b / c)), (-1.125 * (((c / b) * (a * a)) / (b * (b / c))))) / (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.0007)
		tmp = Float64(Float64(Float64(b - sqrt(fma(b, b, Float64(c * Float64(a * -3.0))))) / a) * -0.3333333333333333);
	else
		tmp = Float64(fma(-1.5, Float64(a / Float64(b / c)), Float64(-1.125 * Float64(Float64(Float64(c / b) * Float64(a * a)) / Float64(b * Float64(b / c))))) / 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.0007], N[(N[(N[(b - N[Sqrt[N[(b * b + N[(c * N[(a * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision] * -0.3333333333333333), $MachinePrecision], N[(N[(-1.5 * N[(a / N[(b / c), $MachinePrecision]), $MachinePrecision] + N[(-1.125 * N[(N[(N[(c / b), $MachinePrecision] * N[(a * a), $MachinePrecision]), $MachinePrecision] / N[(b * N[(b / c), $MachinePrecision]), $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.0007:\\
\;\;\;\;\frac{b - \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -3\right)\right)}}{a} \cdot -0.3333333333333333\\

\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-1.5, \frac{a}{\frac{b}{c}}, -1.125 \cdot \frac{\frac{c}{b} \cdot \left(a \cdot a\right)}{b \cdot \frac{b}{c}}\right)}{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)) < -6.99999999999999993e-4

    1. Initial program 79.0%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
    2. Applied egg-rr79.1%

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

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

    1. Initial program 42.9%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
    2. Taylor expanded in b around inf 89.3%

      \[\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} \]
    3. 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. unpow289.3%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\mathsf{fma}\left(-1.5, \frac{a}{\frac{b}{c}}, -1.125 \cdot \color{blue}{\frac{\frac{c}{b} \cdot \left(a \cdot a\right)}{\frac{b}{c} \cdot b}}\right)}{3 \cdot a} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification86.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.0007:\\ \;\;\;\;\frac{b - \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -3\right)\right)}}{a} \cdot -0.3333333333333333\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-1.5, \frac{a}{\frac{b}{c}}, -1.125 \cdot \frac{\frac{c}{b} \cdot \left(a \cdot a\right)}{b \cdot \frac{b}{c}}\right)}{a \cdot 3}\\ \end{array} \]

Alternative 4: 84.8% 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.0007:\\ \;\;\;\;-0.3333333333333333 \cdot \left(\frac{-1}{a} \cdot \left(\sqrt{b \cdot b + a \cdot \left(c \cdot -3\right)} - b\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-1.5, \frac{a}{\frac{b}{c}}, -1.125 \cdot \frac{\frac{c}{b} \cdot \left(a \cdot a\right)}{b \cdot \frac{b}{c}}\right)}{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.0007)
   (*
    -0.3333333333333333
    (* (/ -1.0 a) (- (sqrt (+ (* b b) (* a (* c -3.0)))) b)))
   (/
    (fma -1.5 (/ a (/ b c)) (* -1.125 (/ (* (/ c b) (* a a)) (* b (/ b c)))))
    (* 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.0007) {
		tmp = -0.3333333333333333 * ((-1.0 / a) * (sqrt(((b * b) + (a * (c * -3.0)))) - b));
	} else {
		tmp = fma(-1.5, (a / (b / c)), (-1.125 * (((c / b) * (a * a)) / (b * (b / c))))) / (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.0007)
		tmp = Float64(-0.3333333333333333 * Float64(Float64(-1.0 / a) * Float64(sqrt(Float64(Float64(b * b) + Float64(a * Float64(c * -3.0)))) - b)));
	else
		tmp = Float64(fma(-1.5, Float64(a / Float64(b / c)), Float64(-1.125 * Float64(Float64(Float64(c / b) * Float64(a * a)) / Float64(b * Float64(b / c))))) / 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.0007], N[(-0.3333333333333333 * N[(N[(-1.0 / a), $MachinePrecision] * N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] + N[(a * N[(c * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(-1.5 * N[(a / N[(b / c), $MachinePrecision]), $MachinePrecision] + N[(-1.125 * N[(N[(N[(c / b), $MachinePrecision] * N[(a * a), $MachinePrecision]), $MachinePrecision] / N[(b * N[(b / c), $MachinePrecision]), $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.0007:\\
\;\;\;\;-0.3333333333333333 \cdot \left(\frac{-1}{a} \cdot \left(\sqrt{b \cdot b + a \cdot \left(c \cdot -3\right)} - b\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-1.5, \frac{a}{\frac{b}{c}}, -1.125 \cdot \frac{\frac{c}{b} \cdot \left(a \cdot a\right)}{b \cdot \frac{b}{c}}\right)}{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)) < -6.99999999999999993e-4

    1. Initial program 79.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. neg-sub079.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{1}{\frac{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{a}{0.3333333333333333}\right)\right)}{\frac{1}{\sqrt{\frac{1}{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -3\right)\right)}}} - b}}} \]
      6. associate-/r/78.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\frac{-1}{a} \cdot \left(\sqrt{\color{blue}{b \cdot b + a \cdot \left(c \cdot -3\right)}} - b\right)\right) \cdot -0.3333333333333333 \]
    11. Applied egg-rr79.0%

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

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

    1. Initial program 42.9%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
    2. Taylor expanded in b around inf 89.3%

      \[\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} \]
    3. 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. unpow289.3%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\mathsf{fma}\left(-1.5, \frac{a}{\frac{b}{c}}, -1.125 \cdot \color{blue}{\frac{\frac{c}{b} \cdot \left(a \cdot a\right)}{\frac{b}{c} \cdot b}}\right)}{3 \cdot a} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification86.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.0007:\\ \;\;\;\;-0.3333333333333333 \cdot \left(\frac{-1}{a} \cdot \left(\sqrt{b \cdot b + a \cdot \left(c \cdot -3\right)} - b\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-1.5, \frac{a}{\frac{b}{c}}, -1.125 \cdot \frac{\frac{c}{b} \cdot \left(a \cdot a\right)}{b \cdot \frac{b}{c}}\right)}{a \cdot 3}\\ \end{array} \]

Alternative 5: 84.8% 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.0007:\\ \;\;\;\;-0.3333333333333333 \cdot \left(\frac{-1}{a} \cdot \left(\sqrt{b \cdot b + a \cdot \left(c \cdot -3\right)} - b\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{-1.5 \cdot \frac{c \cdot a}{b} + -1.125 \cdot \left(\frac{a}{\frac{b}{a}} \cdot \left(\frac{c}{b} \cdot \frac{c}{b}\right)\right)}{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.0007)
   (*
    -0.3333333333333333
    (* (/ -1.0 a) (- (sqrt (+ (* b b) (* a (* c -3.0)))) b)))
   (/
    (+ (* -1.5 (/ (* c a) b)) (* -1.125 (* (/ a (/ b a)) (* (/ c b) (/ c b)))))
    (* 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.0007) {
		tmp = -0.3333333333333333 * ((-1.0 / a) * (sqrt(((b * b) + (a * (c * -3.0)))) - b));
	} else {
		tmp = ((-1.5 * ((c * a) / b)) + (-1.125 * ((a / (b / a)) * ((c / b) * (c / b))))) / (a * 3.0);
	}
	return tmp;
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8) :: tmp
    if (((sqrt(((b * b) - (c * (a * 3.0d0)))) - b) / (a * 3.0d0)) <= (-0.0007d0)) then
        tmp = (-0.3333333333333333d0) * (((-1.0d0) / a) * (sqrt(((b * b) + (a * (c * (-3.0d0))))) - b))
    else
        tmp = (((-1.5d0) * ((c * a) / b)) + ((-1.125d0) * ((a / (b / a)) * ((c / b) * (c / b))))) / (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.0007) {
		tmp = -0.3333333333333333 * ((-1.0 / a) * (Math.sqrt(((b * b) + (a * (c * -3.0)))) - b));
	} else {
		tmp = ((-1.5 * ((c * a) / b)) + (-1.125 * ((a / (b / a)) * ((c / b) * (c / b))))) / (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.0007:
		tmp = -0.3333333333333333 * ((-1.0 / a) * (math.sqrt(((b * b) + (a * (c * -3.0)))) - b))
	else:
		tmp = ((-1.5 * ((c * a) / b)) + (-1.125 * ((a / (b / a)) * ((c / b) * (c / b))))) / (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.0007)
		tmp = Float64(-0.3333333333333333 * Float64(Float64(-1.0 / a) * Float64(sqrt(Float64(Float64(b * b) + Float64(a * Float64(c * -3.0)))) - b)));
	else
		tmp = Float64(Float64(Float64(-1.5 * Float64(Float64(c * a) / b)) + Float64(-1.125 * Float64(Float64(a / Float64(b / a)) * Float64(Float64(c / b) * Float64(c / b))))) / 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.0007)
		tmp = -0.3333333333333333 * ((-1.0 / a) * (sqrt(((b * b) + (a * (c * -3.0)))) - b));
	else
		tmp = ((-1.5 * ((c * a) / b)) + (-1.125 * ((a / (b / a)) * ((c / b) * (c / b))))) / (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.0007], N[(-0.3333333333333333 * N[(N[(-1.0 / a), $MachinePrecision] * N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] + N[(a * N[(c * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(-1.5 * N[(N[(c * a), $MachinePrecision] / b), $MachinePrecision]), $MachinePrecision] + N[(-1.125 * N[(N[(a / N[(b / a), $MachinePrecision]), $MachinePrecision] * N[(N[(c / b), $MachinePrecision] * N[(c / b), $MachinePrecision]), $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.0007:\\
\;\;\;\;-0.3333333333333333 \cdot \left(\frac{-1}{a} \cdot \left(\sqrt{b \cdot b + a \cdot \left(c \cdot -3\right)} - b\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{-1.5 \cdot \frac{c \cdot a}{b} + -1.125 \cdot \left(\frac{a}{\frac{b}{a}} \cdot \left(\frac{c}{b} \cdot \frac{c}{b}\right)\right)}{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)) < -6.99999999999999993e-4

    1. Initial program 79.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. neg-sub079.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{1}{\frac{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{a}{0.3333333333333333}\right)\right)}{\frac{1}{\sqrt{\frac{1}{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -3\right)\right)}}} - b}}} \]
      6. associate-/r/78.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\frac{-1}{a} \cdot \left(\sqrt{\color{blue}{b \cdot b + a \cdot \left(c \cdot -3\right)}} - b\right)\right) \cdot -0.3333333333333333 \]
    11. Applied egg-rr79.0%

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

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

    1. Initial program 42.9%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
    2. Taylor expanded in b around inf 89.3%

      \[\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} \]
    3. Step-by-step derivation
      1. *-commutative89.3%

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

        \[\leadsto \frac{-1.5 \cdot \frac{a \cdot c}{b} + -1.125 \cdot \frac{{c}^{2} \cdot {a}^{2}}{\color{blue}{\left(b \cdot b\right) \cdot b}}}{3 \cdot a} \]
      3. times-frac89.3%

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

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

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

      \[\leadsto \frac{-1.5 \cdot \frac{a \cdot c}{b} + -1.125 \cdot \color{blue}{\left(\frac{c \cdot c}{b \cdot b} \cdot \frac{a \cdot a}{b}\right)}}{3 \cdot a} \]
    5. Step-by-step derivation
      1. *-commutative89.3%

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

        \[\leadsto \frac{-1.5 \cdot \frac{a \cdot c}{b} + -1.125 \cdot \left(\color{blue}{\frac{a}{\frac{b}{a}}} \cdot \frac{c \cdot c}{b \cdot b}\right)}{3 \cdot a} \]
      3. times-frac89.3%

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

      \[\leadsto \frac{-1.5 \cdot \frac{a \cdot c}{b} + -1.125 \cdot \color{blue}{\left(\frac{a}{\frac{b}{a}} \cdot \left(\frac{c}{b} \cdot \frac{c}{b}\right)\right)}}{3 \cdot a} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification86.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.0007:\\ \;\;\;\;-0.3333333333333333 \cdot \left(\frac{-1}{a} \cdot \left(\sqrt{b \cdot b + a \cdot \left(c \cdot -3\right)} - b\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{-1.5 \cdot \frac{c \cdot a}{b} + -1.125 \cdot \left(\frac{a}{\frac{b}{a}} \cdot \left(\frac{c}{b} \cdot \frac{c}{b}\right)\right)}{a \cdot 3}\\ \end{array} \]

Alternative 6: 84.8% 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 -0.0007:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{-1.5 \cdot \frac{c \cdot a}{b} + -1.125 \cdot \left(\frac{a}{\frac{b}{a}} \cdot \left(\frac{c}{b} \cdot \frac{c}{b}\right)\right)}{a \cdot 3}\\ \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 -0.0007)
     t_0
     (/
      (+
       (* -1.5 (/ (* c a) b))
       (* -1.125 (* (/ a (/ b a)) (* (/ c b) (/ c b)))))
      (* a 3.0)))))
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 <= -0.0007) {
		tmp = t_0;
	} else {
		tmp = ((-1.5 * ((c * a) / b)) + (-1.125 * ((a / (b / a)) * ((c / b) * (c / b))))) / (a * 3.0);
	}
	return tmp;
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (sqrt(((b * b) - (c * (a * 3.0d0)))) - b) / (a * 3.0d0)
    if (t_0 <= (-0.0007d0)) then
        tmp = t_0
    else
        tmp = (((-1.5d0) * ((c * a) / b)) + ((-1.125d0) * ((a / (b / a)) * ((c / b) * (c / b))))) / (a * 3.0d0)
    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 <= -0.0007) {
		tmp = t_0;
	} else {
		tmp = ((-1.5 * ((c * a) / b)) + (-1.125 * ((a / (b / a)) * ((c / b) * (c / b))))) / (a * 3.0);
	}
	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 <= -0.0007:
		tmp = t_0
	else:
		tmp = ((-1.5 * ((c * a) / b)) + (-1.125 * ((a / (b / a)) * ((c / b) * (c / b))))) / (a * 3.0)
	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 <= -0.0007)
		tmp = t_0;
	else
		tmp = Float64(Float64(Float64(-1.5 * Float64(Float64(c * a) / b)) + Float64(-1.125 * Float64(Float64(a / Float64(b / a)) * Float64(Float64(c / b) * Float64(c / b))))) / Float64(a * 3.0));
	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 <= -0.0007)
		tmp = t_0;
	else
		tmp = ((-1.5 * ((c * a) / b)) + (-1.125 * ((a / (b / a)) * ((c / b) * (c / b))))) / (a * 3.0);
	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, -0.0007], t$95$0, N[(N[(N[(-1.5 * N[(N[(c * a), $MachinePrecision] / b), $MachinePrecision]), $MachinePrecision] + N[(-1.125 * N[(N[(a / N[(b / a), $MachinePrecision]), $MachinePrecision] * N[(N[(c / b), $MachinePrecision] * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * 3.0), $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 -0.0007:\\
\;\;\;\;t_0\\

\mathbf{else}:\\
\;\;\;\;\frac{-1.5 \cdot \frac{c \cdot a}{b} + -1.125 \cdot \left(\frac{a}{\frac{b}{a}} \cdot \left(\frac{c}{b} \cdot \frac{c}{b}\right)\right)}{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)) < -6.99999999999999993e-4

    1. Initial program 79.0%

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

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

    1. Initial program 42.9%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
    2. Taylor expanded in b around inf 89.3%

      \[\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} \]
    3. Step-by-step derivation
      1. *-commutative89.3%

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

        \[\leadsto \frac{-1.5 \cdot \frac{a \cdot c}{b} + -1.125 \cdot \frac{{c}^{2} \cdot {a}^{2}}{\color{blue}{\left(b \cdot b\right) \cdot b}}}{3 \cdot a} \]
      3. times-frac89.3%

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

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

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

      \[\leadsto \frac{-1.5 \cdot \frac{a \cdot c}{b} + -1.125 \cdot \color{blue}{\left(\frac{c \cdot c}{b \cdot b} \cdot \frac{a \cdot a}{b}\right)}}{3 \cdot a} \]
    5. Step-by-step derivation
      1. *-commutative89.3%

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

        \[\leadsto \frac{-1.5 \cdot \frac{a \cdot c}{b} + -1.125 \cdot \left(\color{blue}{\frac{a}{\frac{b}{a}}} \cdot \frac{c \cdot c}{b \cdot b}\right)}{3 \cdot a} \]
      3. times-frac89.3%

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

      \[\leadsto \frac{-1.5 \cdot \frac{a \cdot c}{b} + -1.125 \cdot \color{blue}{\left(\frac{a}{\frac{b}{a}} \cdot \left(\frac{c}{b} \cdot \frac{c}{b}\right)\right)}}{3 \cdot a} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification86.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.0007:\\ \;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1.5 \cdot \frac{c \cdot a}{b} + -1.125 \cdot \left(\frac{a}{\frac{b}{a}} \cdot \left(\frac{c}{b} \cdot \frac{c}{b}\right)\right)}{a \cdot 3}\\ \end{array} \]

Alternative 7: 80.8% accurate, 4.3× speedup?

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

\\
\frac{-1.5 \cdot \frac{c \cdot a}{b} + -1.125 \cdot \left(\frac{a}{\frac{b}{a}} \cdot \left(\frac{c}{b} \cdot \frac{c}{b}\right)\right)}{a \cdot 3}
\end{array}
Derivation
  1. Initial program 54.4%

    \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
  2. Taylor expanded in b around inf 79.6%

    \[\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} \]
  3. Step-by-step derivation
    1. *-commutative79.6%

      \[\leadsto \frac{-1.5 \cdot \frac{a \cdot c}{b} + -1.125 \cdot \frac{\color{blue}{{c}^{2} \cdot {a}^{2}}}{{b}^{3}}}{3 \cdot a} \]
    2. unpow379.6%

      \[\leadsto \frac{-1.5 \cdot \frac{a \cdot c}{b} + -1.125 \cdot \frac{{c}^{2} \cdot {a}^{2}}{\color{blue}{\left(b \cdot b\right) \cdot b}}}{3 \cdot a} \]
    3. times-frac79.6%

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

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

      \[\leadsto \frac{-1.5 \cdot \frac{a \cdot c}{b} + -1.125 \cdot \left(\frac{c \cdot c}{b \cdot b} \cdot \frac{\color{blue}{a \cdot a}}{b}\right)}{3 \cdot a} \]
  4. Applied egg-rr79.6%

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

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

      \[\leadsto \frac{-1.5 \cdot \frac{a \cdot c}{b} + -1.125 \cdot \left(\color{blue}{\frac{a}{\frac{b}{a}}} \cdot \frac{c \cdot c}{b \cdot b}\right)}{3 \cdot a} \]
    3. times-frac79.6%

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

    \[\leadsto \frac{-1.5 \cdot \frac{a \cdot c}{b} + -1.125 \cdot \color{blue}{\left(\frac{a}{\frac{b}{a}} \cdot \left(\frac{c}{b} \cdot \frac{c}{b}\right)\right)}}{3 \cdot a} \]
  7. Final simplification79.6%

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

Alternative 8: 64.0% accurate, 23.2× speedup?

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

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

    \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
  2. Taylor expanded in b around inf 64.6%

    \[\leadsto \color{blue}{-0.5 \cdot \frac{c}{b}} \]
  3. Final simplification64.6%

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

Reproduce

?
herbie shell --seed 2023297 
(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)))