Cubic critical, narrow range

Percentage Accurate: 55.6% → 91.8%
Time: 13.5s
Alternatives: 9
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 9 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: 91.8% accurate, 0.1× speedup?

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

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

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


\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

    1. Initial program 83.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-sub083.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 46.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-sub046.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto {\left(\frac{a \cdot 3}{\color{blue}{\mathsf{fma}\left(-1, b, \sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)}\right)}}\right)}^{-1} \]
      6. cancel-sign-sub-inv47.0%

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

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

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

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

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

      \[\leadsto {\color{blue}{\left(-2 \cdot \frac{b}{c} + \left(-3 \cdot \frac{-0.75 \cdot \left(c \cdot {a}^{2}\right) + 0.375 \cdot \left(c \cdot {a}^{2}\right)}{{b}^{3}} + \left(1.5 \cdot \frac{a}{b} + -3 \cdot \frac{-0.75 \cdot \left(c \cdot \left(a \cdot \left(-0.75 \cdot \left(c \cdot {a}^{2}\right) + 0.375 \cdot \left(c \cdot {a}^{2}\right)\right)\right)\right) + \left(0.5625 \cdot \left({c}^{2} \cdot {a}^{3}\right) + -0.2222222222222222 \cdot \frac{{\left(-1.125 \cdot \left({c}^{2} \cdot {a}^{2}\right)\right)}^{2} + 5.0625 \cdot \left({c}^{4} \cdot {a}^{4}\right)}{{c}^{2} \cdot a}\right)}{{b}^{5}}\right)\right)\right)}}^{-1} \]
    7. Step-by-step derivation
      1. fma-def94.6%

        \[\leadsto {\color{blue}{\left(\mathsf{fma}\left(-2, \frac{b}{c}, -3 \cdot \frac{-0.75 \cdot \left(c \cdot {a}^{2}\right) + 0.375 \cdot \left(c \cdot {a}^{2}\right)}{{b}^{3}} + \left(1.5 \cdot \frac{a}{b} + -3 \cdot \frac{-0.75 \cdot \left(c \cdot \left(a \cdot \left(-0.75 \cdot \left(c \cdot {a}^{2}\right) + 0.375 \cdot \left(c \cdot {a}^{2}\right)\right)\right)\right) + \left(0.5625 \cdot \left({c}^{2} \cdot {a}^{3}\right) + -0.2222222222222222 \cdot \frac{{\left(-1.125 \cdot \left({c}^{2} \cdot {a}^{2}\right)\right)}^{2} + 5.0625 \cdot \left({c}^{4} \cdot {a}^{4}\right)}{{c}^{2} \cdot a}\right)}{{b}^{5}}\right)\right)\right)}}^{-1} \]
      2. fma-def94.6%

        \[\leadsto {\left(\mathsf{fma}\left(-2, \frac{b}{c}, \color{blue}{\mathsf{fma}\left(-3, \frac{-0.75 \cdot \left(c \cdot {a}^{2}\right) + 0.375 \cdot \left(c \cdot {a}^{2}\right)}{{b}^{3}}, 1.5 \cdot \frac{a}{b} + -3 \cdot \frac{-0.75 \cdot \left(c \cdot \left(a \cdot \left(-0.75 \cdot \left(c \cdot {a}^{2}\right) + 0.375 \cdot \left(c \cdot {a}^{2}\right)\right)\right)\right) + \left(0.5625 \cdot \left({c}^{2} \cdot {a}^{3}\right) + -0.2222222222222222 \cdot \frac{{\left(-1.125 \cdot \left({c}^{2} \cdot {a}^{2}\right)\right)}^{2} + 5.0625 \cdot \left({c}^{4} \cdot {a}^{4}\right)}{{c}^{2} \cdot a}\right)}{{b}^{5}}\right)}\right)\right)}^{-1} \]
    8. Simplified94.6%

      \[\leadsto {\color{blue}{\left(\mathsf{fma}\left(-2, \frac{b}{c}, \mathsf{fma}\left(-3, \frac{c \cdot \left(a \cdot a\right)}{\frac{{b}^{3}}{-0.375}}, \mathsf{fma}\left(1.5, \frac{a}{b}, \frac{-3}{\frac{{b}^{5}}{\mathsf{fma}\left(-0.75, c \cdot \left(a \cdot \left(-0.375 \cdot \left(c \cdot \left(a \cdot a\right)\right)\right)\right), \mathsf{fma}\left(-0.2222222222222222, \frac{\mathsf{fma}\left(5.0625, {\left(c \cdot a\right)}^{4}, 1.265625 \cdot {\left(c \cdot a\right)}^{4}\right)}{a \cdot \left(c \cdot c\right)}, {a}^{3} \cdot \left(\left(c \cdot c\right) \cdot 0.5625\right)\right)\right)}}\right)\right)\right)\right)}}^{-1} \]
    9. Taylor expanded in c around 0 94.6%

      \[\leadsto {\left(\mathsf{fma}\left(-2, \frac{b}{c}, \mathsf{fma}\left(-3, \frac{c \cdot \left(a \cdot a\right)}{\frac{{b}^{3}}{-0.375}}, \mathsf{fma}\left(1.5, \frac{a}{b}, \frac{-3}{\frac{{b}^{5}}{\color{blue}{{c}^{2} \cdot \left(-0.2222222222222222 \cdot \frac{1.265625 \cdot {a}^{4} + 5.0625 \cdot {a}^{4}}{a} + \left(0.5625 \cdot {a}^{3} + 0.28125 \cdot {a}^{3}\right)\right)}}}\right)\right)\right)\right)}^{-1} \]
    10. Step-by-step derivation
      1. unpow294.6%

        \[\leadsto {\left(\mathsf{fma}\left(-2, \frac{b}{c}, \mathsf{fma}\left(-3, \frac{c \cdot \left(a \cdot a\right)}{\frac{{b}^{3}}{-0.375}}, \mathsf{fma}\left(1.5, \frac{a}{b}, \frac{-3}{\frac{{b}^{5}}{\color{blue}{\left(c \cdot c\right)} \cdot \left(-0.2222222222222222 \cdot \frac{1.265625 \cdot {a}^{4} + 5.0625 \cdot {a}^{4}}{a} + \left(0.5625 \cdot {a}^{3} + 0.28125 \cdot {a}^{3}\right)\right)}}\right)\right)\right)\right)}^{-1} \]
      2. fma-def94.6%

        \[\leadsto {\left(\mathsf{fma}\left(-2, \frac{b}{c}, \mathsf{fma}\left(-3, \frac{c \cdot \left(a \cdot a\right)}{\frac{{b}^{3}}{-0.375}}, \mathsf{fma}\left(1.5, \frac{a}{b}, \frac{-3}{\frac{{b}^{5}}{\left(c \cdot c\right) \cdot \color{blue}{\mathsf{fma}\left(-0.2222222222222222, \frac{1.265625 \cdot {a}^{4} + 5.0625 \cdot {a}^{4}}{a}, 0.5625 \cdot {a}^{3} + 0.28125 \cdot {a}^{3}\right)}}}\right)\right)\right)\right)}^{-1} \]
      3. distribute-rgt-out94.6%

        \[\leadsto {\left(\mathsf{fma}\left(-2, \frac{b}{c}, \mathsf{fma}\left(-3, \frac{c \cdot \left(a \cdot a\right)}{\frac{{b}^{3}}{-0.375}}, \mathsf{fma}\left(1.5, \frac{a}{b}, \frac{-3}{\frac{{b}^{5}}{\left(c \cdot c\right) \cdot \mathsf{fma}\left(-0.2222222222222222, \frac{\color{blue}{{a}^{4} \cdot \left(1.265625 + 5.0625\right)}}{a}, 0.5625 \cdot {a}^{3} + 0.28125 \cdot {a}^{3}\right)}}\right)\right)\right)\right)}^{-1} \]
      4. associate-/l*94.6%

        \[\leadsto {\left(\mathsf{fma}\left(-2, \frac{b}{c}, \mathsf{fma}\left(-3, \frac{c \cdot \left(a \cdot a\right)}{\frac{{b}^{3}}{-0.375}}, \mathsf{fma}\left(1.5, \frac{a}{b}, \frac{-3}{\frac{{b}^{5}}{\left(c \cdot c\right) \cdot \mathsf{fma}\left(-0.2222222222222222, \color{blue}{\frac{{a}^{4}}{\frac{a}{1.265625 + 5.0625}}}, 0.5625 \cdot {a}^{3} + 0.28125 \cdot {a}^{3}\right)}}\right)\right)\right)\right)}^{-1} \]
      5. metadata-eval94.6%

        \[\leadsto {\left(\mathsf{fma}\left(-2, \frac{b}{c}, \mathsf{fma}\left(-3, \frac{c \cdot \left(a \cdot a\right)}{\frac{{b}^{3}}{-0.375}}, \mathsf{fma}\left(1.5, \frac{a}{b}, \frac{-3}{\frac{{b}^{5}}{\left(c \cdot c\right) \cdot \mathsf{fma}\left(-0.2222222222222222, \frac{{a}^{4}}{\frac{a}{\color{blue}{6.328125}}}, 0.5625 \cdot {a}^{3} + 0.28125 \cdot {a}^{3}\right)}}\right)\right)\right)\right)}^{-1} \]
      6. distribute-rgt-out94.6%

        \[\leadsto {\left(\mathsf{fma}\left(-2, \frac{b}{c}, \mathsf{fma}\left(-3, \frac{c \cdot \left(a \cdot a\right)}{\frac{{b}^{3}}{-0.375}}, \mathsf{fma}\left(1.5, \frac{a}{b}, \frac{-3}{\frac{{b}^{5}}{\left(c \cdot c\right) \cdot \mathsf{fma}\left(-0.2222222222222222, \frac{{a}^{4}}{\frac{a}{6.328125}}, \color{blue}{{a}^{3} \cdot \left(0.5625 + 0.28125\right)}\right)}}\right)\right)\right)\right)}^{-1} \]
      7. metadata-eval94.6%

        \[\leadsto {\left(\mathsf{fma}\left(-2, \frac{b}{c}, \mathsf{fma}\left(-3, \frac{c \cdot \left(a \cdot a\right)}{\frac{{b}^{3}}{-0.375}}, \mathsf{fma}\left(1.5, \frac{a}{b}, \frac{-3}{\frac{{b}^{5}}{\left(c \cdot c\right) \cdot \mathsf{fma}\left(-0.2222222222222222, \frac{{a}^{4}}{\frac{a}{6.328125}}, {a}^{3} \cdot \color{blue}{0.84375}\right)}}\right)\right)\right)\right)}^{-1} \]
    11. Simplified94.6%

      \[\leadsto {\left(\mathsf{fma}\left(-2, \frac{b}{c}, \mathsf{fma}\left(-3, \frac{c \cdot \left(a \cdot a\right)}{\frac{{b}^{3}}{-0.375}}, \mathsf{fma}\left(1.5, \frac{a}{b}, \frac{-3}{\frac{{b}^{5}}{\color{blue}{\left(c \cdot c\right) \cdot \mathsf{fma}\left(-0.2222222222222222, \frac{{a}^{4}}{\frac{a}{6.328125}}, {a}^{3} \cdot 0.84375\right)}}}\right)\right)\right)\right)}^{-1} \]
    12. Taylor expanded in a around 0 94.6%

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

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

Alternative 2: 89.6% accurate, 0.2× speedup?

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

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

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


\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

    1. Initial program 83.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-sub083.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 46.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-sub046.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto {\left(\frac{a \cdot 3}{\color{blue}{\mathsf{fma}\left(-1, b, \sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)}\right)}}\right)}^{-1} \]
      6. cancel-sign-sub-inv47.0%

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

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

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

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

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

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

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

      \[\leadsto {\left(\frac{a \cdot 3}{\color{blue}{\log \left(e^{\mathsf{fma}\left(-1, b, \sqrt{\mathsf{fma}\left(b, b, \left(-3 \cdot c\right) \cdot a\right)}\right)}\right)}}\right)}^{-1} \]
    8. Taylor expanded in b around inf 92.5%

      \[\leadsto {\color{blue}{\left(-2 \cdot \frac{b}{c} + \left(-3 \cdot \frac{-0.75 \cdot \left(c \cdot {a}^{2}\right) + 0.375 \cdot \left(c \cdot {a}^{2}\right)}{{b}^{3}} + 1.5 \cdot \frac{a}{b}\right)\right)}}^{-1} \]
    9. Step-by-step derivation
      1. fma-def92.5%

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

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

        \[\leadsto {\left(\mathsf{fma}\left(-2, \frac{b}{c}, \color{blue}{\mathsf{fma}\left(1.5, \frac{a}{b}, -3 \cdot \frac{-0.75 \cdot \left(c \cdot {a}^{2}\right) + 0.375 \cdot \left(c \cdot {a}^{2}\right)}{{b}^{3}}\right)}\right)\right)}^{-1} \]
      4. *-commutative92.5%

        \[\leadsto {\left(\mathsf{fma}\left(-2, \frac{b}{c}, \mathsf{fma}\left(1.5, \frac{a}{b}, \color{blue}{\frac{-0.75 \cdot \left(c \cdot {a}^{2}\right) + 0.375 \cdot \left(c \cdot {a}^{2}\right)}{{b}^{3}} \cdot -3}\right)\right)\right)}^{-1} \]
      5. distribute-rgt-out92.5%

        \[\leadsto {\left(\mathsf{fma}\left(-2, \frac{b}{c}, \mathsf{fma}\left(1.5, \frac{a}{b}, \frac{\color{blue}{\left(c \cdot {a}^{2}\right) \cdot \left(-0.75 + 0.375\right)}}{{b}^{3}} \cdot -3\right)\right)\right)}^{-1} \]
      6. unpow292.5%

        \[\leadsto {\left(\mathsf{fma}\left(-2, \frac{b}{c}, \mathsf{fma}\left(1.5, \frac{a}{b}, \frac{\left(c \cdot \color{blue}{\left(a \cdot a\right)}\right) \cdot \left(-0.75 + 0.375\right)}{{b}^{3}} \cdot -3\right)\right)\right)}^{-1} \]
      7. metadata-eval92.5%

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

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

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

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

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

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

Alternative 3: 85.0% accurate, 0.3× speedup?

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

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

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


\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

    1. Initial program 83.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-sub083.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 46.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-sub046.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto {\left(\frac{a \cdot 3}{\color{blue}{\mathsf{fma}\left(-1, b, \sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)}\right)}}\right)}^{-1} \]
      6. cancel-sign-sub-inv47.0%

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

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

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

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

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

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

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

Alternative 4: 84.9% accurate, 0.4× speedup?

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

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

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


\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

    1. Initial program 83.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. /-rgt-identity83.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 46.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-sub046.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto {\left(\frac{a \cdot 3}{\color{blue}{\mathsf{fma}\left(-1, b, \sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)}\right)}}\right)}^{-1} \]
      6. cancel-sign-sub-inv47.0%

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

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

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

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

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

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

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

Alternative 5: 84.9% accurate, 0.4× speedup?

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

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

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


\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

    1. Initial program 83.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-sub083.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 46.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-sub046.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto {\left(\frac{a \cdot 3}{\color{blue}{\mathsf{fma}\left(-1, b, \sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)}\right)}}\right)}^{-1} \]
      6. cancel-sign-sub-inv47.0%

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

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

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

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

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

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

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

Alternative 6: 84.9% accurate, 0.5× speedup?

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

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

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


\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

    1. Initial program 83.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-sub083.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 46.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-sub046.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto {\left(\frac{a \cdot 3}{\color{blue}{\mathsf{fma}\left(-1, b, \sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)}\right)}}\right)}^{-1} \]
      6. cancel-sign-sub-inv47.0%

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

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

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

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

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

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

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

Alternative 7: 81.9% accurate, 1.0× speedup?

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

\\
{\left(-2 \cdot \frac{b}{c} + 1.5 \cdot \frac{a}{b}\right)}^{-1}
\end{array}
Derivation
  1. Initial program 52.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-sub052.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto {\left(\frac{a \cdot 3}{\color{blue}{\mathsf{fma}\left(-1, b, \sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)}\right)}}\right)}^{-1} \]
    6. cancel-sign-sub-inv52.0%

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

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

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

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

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

    \[\leadsto {\color{blue}{\left(-2 \cdot \frac{b}{c} + 1.5 \cdot \frac{a}{b}\right)}}^{-1} \]
  7. Final simplification83.7%

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

Alternative 8: 64.3% 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.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-sub052.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 3.2% accurate, 38.7× speedup?

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

\\
\frac{0}{a}
\end{array}
Derivation
  1. Initial program 52.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-sub052.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto {\left(\frac{a \cdot 3}{\color{blue}{\mathsf{fma}\left(-1, b, \sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)}\right)}}\right)}^{-1} \]
    6. cancel-sign-sub-inv52.0%

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

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

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

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

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

    \[\leadsto \color{blue}{0.3333333333333333 \cdot \frac{b + -1 \cdot b}{a}} \]
  7. Step-by-step derivation
    1. associate-*r/3.2%

      \[\leadsto \color{blue}{\frac{0.3333333333333333 \cdot \left(b + -1 \cdot b\right)}{a}} \]
    2. *-commutative3.2%

      \[\leadsto \frac{\color{blue}{\left(b + -1 \cdot b\right) \cdot 0.3333333333333333}}{a} \]
    3. distribute-rgt1-in3.2%

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

      \[\leadsto \frac{\left(\color{blue}{0} \cdot b\right) \cdot 0.3333333333333333}{a} \]
    5. mul0-lft3.2%

      \[\leadsto \frac{\color{blue}{0} \cdot 0.3333333333333333}{a} \]
    6. metadata-eval3.2%

      \[\leadsto \frac{\color{blue}{0}}{a} \]
  8. Simplified3.2%

    \[\leadsto \color{blue}{\frac{0}{a}} \]
  9. Final simplification3.2%

    \[\leadsto \frac{0}{a} \]

Reproduce

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