Cubic critical, narrow range

Percentage Accurate: 55.0% → 92.3%
Time: 12.8s
Alternatives: 10
Speedup: 23.2×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 10 alternatives:

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

Initial Program: 55.0% accurate, 1.0× speedup?

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

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

Alternative 1: 92.3% accurate, 0.1× speedup?

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

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

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


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

    1. Initial program 93.7%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
    2. Step-by-step derivation
      1. /-rgt-identity93.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 9.60000000000000024e-4 < b

    1. Initial program 53.2%

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

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

        \[\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-/r/53.2%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{-0.5625 \cdot \frac{{c}^{3} \cdot {a}^{2}}{{b}^{5}} + \left(-0.16666666666666666 \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)}{a \cdot {b}^{7}} + \left(-0.5 \cdot \frac{c}{b} + -0.375 \cdot \frac{{c}^{2} \cdot a}{{b}^{3}}\right)\right)} \]
    5. Step-by-step derivation
      1. fma-def92.6%

        \[\leadsto \color{blue}{\mathsf{fma}\left(-0.5625, \frac{{c}^{3} \cdot {a}^{2}}{{b}^{5}}, -0.16666666666666666 \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)}{a \cdot {b}^{7}} + \left(-0.5 \cdot \frac{c}{b} + -0.375 \cdot \frac{{c}^{2} \cdot a}{{b}^{3}}\right)\right)} \]
      2. unpow292.6%

        \[\leadsto \mathsf{fma}\left(-0.5625, \frac{{c}^{3} \cdot \color{blue}{\left(a \cdot a\right)}}{{b}^{5}}, -0.16666666666666666 \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)}{a \cdot {b}^{7}} + \left(-0.5 \cdot \frac{c}{b} + -0.375 \cdot \frac{{c}^{2} \cdot a}{{b}^{3}}\right)\right) \]
      3. fma-def92.6%

        \[\leadsto \mathsf{fma}\left(-0.5625, \frac{{c}^{3} \cdot \left(a \cdot a\right)}{{b}^{5}}, \color{blue}{\mathsf{fma}\left(-0.16666666666666666, \frac{{\left(-1.125 \cdot \left({c}^{2} \cdot {a}^{2}\right)\right)}^{2} + 5.0625 \cdot \left({c}^{4} \cdot {a}^{4}\right)}{a \cdot {b}^{7}}, -0.5 \cdot \frac{c}{b} + -0.375 \cdot \frac{{c}^{2} \cdot a}{{b}^{3}}\right)}\right) \]
    6. Simplified92.6%

      \[\leadsto \color{blue}{\mathsf{fma}\left(-0.5625, \frac{{c}^{3} \cdot \left(a \cdot a\right)}{{b}^{5}}, \mathsf{fma}\left(-0.16666666666666666, \frac{{\left(\left(\left(c \cdot c\right) \cdot \left(a \cdot a\right)\right) \cdot -1.125\right)}^{2} + 5.0625 \cdot \left({c}^{4} \cdot {a}^{4}\right)}{a \cdot {b}^{7}}, \mathsf{fma}\left(-0.5, \frac{c}{b}, \frac{-0.375 \cdot \left(a \cdot \left(c \cdot c\right)\right)}{{b}^{3}}\right)\right)\right)} \]
    7. Taylor expanded in c around 0 92.6%

      \[\leadsto \mathsf{fma}\left(-0.5625, \frac{{c}^{3} \cdot \left(a \cdot a\right)}{{b}^{5}}, \mathsf{fma}\left(-0.16666666666666666, \color{blue}{\frac{{c}^{4} \cdot \left(1.265625 \cdot {a}^{4} + 5.0625 \cdot {a}^{4}\right)}{a \cdot {b}^{7}}}, \mathsf{fma}\left(-0.5, \frac{c}{b}, \frac{-0.375 \cdot \left(a \cdot \left(c \cdot c\right)\right)}{{b}^{3}}\right)\right)\right) \]
    8. Step-by-step derivation
      1. *-commutative92.6%

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

        \[\leadsto \mathsf{fma}\left(-0.5625, \frac{{c}^{3} \cdot \left(a \cdot a\right)}{{b}^{5}}, \mathsf{fma}\left(-0.16666666666666666, \frac{{c}^{4} \cdot \color{blue}{\left({a}^{4} \cdot \left(1.265625 + 5.0625\right)\right)}}{{b}^{7} \cdot a}, \mathsf{fma}\left(-0.5, \frac{c}{b}, \frac{-0.375 \cdot \left(a \cdot \left(c \cdot c\right)\right)}{{b}^{3}}\right)\right)\right) \]
      3. associate-*r*92.6%

        \[\leadsto \mathsf{fma}\left(-0.5625, \frac{{c}^{3} \cdot \left(a \cdot a\right)}{{b}^{5}}, \mathsf{fma}\left(-0.16666666666666666, \frac{\color{blue}{\left({c}^{4} \cdot {a}^{4}\right) \cdot \left(1.265625 + 5.0625\right)}}{{b}^{7} \cdot a}, \mathsf{fma}\left(-0.5, \frac{c}{b}, \frac{-0.375 \cdot \left(a \cdot \left(c \cdot c\right)\right)}{{b}^{3}}\right)\right)\right) \]
      4. times-frac92.6%

        \[\leadsto \mathsf{fma}\left(-0.5625, \frac{{c}^{3} \cdot \left(a \cdot a\right)}{{b}^{5}}, \mathsf{fma}\left(-0.16666666666666666, \color{blue}{\frac{{c}^{4} \cdot {a}^{4}}{{b}^{7}} \cdot \frac{1.265625 + 5.0625}{a}}, \mathsf{fma}\left(-0.5, \frac{c}{b}, \frac{-0.375 \cdot \left(a \cdot \left(c \cdot c\right)\right)}{{b}^{3}}\right)\right)\right) \]
    9. Simplified92.6%

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

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

Alternative 2: 89.8% accurate, 0.2× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < 0.021999999999999999

    1. Initial program 88.7%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
    2. Step-by-step derivation
      1. /-rgt-identity88.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 0.021999999999999999 < b

    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. /-rgt-identity52.0%

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

        \[\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-/r/52.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 89.8% accurate, 0.2× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < 0.017500000000000002

    1. Initial program 88.7%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
    2. Step-by-step derivation
      1. /-rgt-identity88.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 0.017500000000000002 < b

    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-frac52.0%

        \[\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. Taylor expanded in b around inf 90.1%

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

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(-1.125, \frac{\left(c \cdot c\right) \cdot \left(a \cdot a\right)}{{b}^{3}}, \mathsf{fma}\left(-1.5, \frac{c}{\frac{b}{a}}, \frac{{c}^{3} \cdot {a}^{3}}{{b}^{5}} \cdot -1.6875\right)\right)}}{3 \cdot a} \]
    7. Taylor expanded in c around 0 90.5%

      \[\leadsto \color{blue}{-0.5625 \cdot \frac{{c}^{3} \cdot {a}^{2}}{{b}^{5}} + \left(-0.5 \cdot \frac{c}{b} + -0.375 \cdot \frac{{c}^{2} \cdot a}{{b}^{3}}\right)} \]
    8. Step-by-step derivation
      1. +-commutative90.5%

        \[\leadsto \color{blue}{\left(-0.5 \cdot \frac{c}{b} + -0.375 \cdot \frac{{c}^{2} \cdot a}{{b}^{3}}\right) + -0.5625 \cdot \frac{{c}^{3} \cdot {a}^{2}}{{b}^{5}}} \]
      2. associate-*r/90.5%

        \[\leadsto \left(\color{blue}{\frac{-0.5 \cdot c}{b}} + -0.375 \cdot \frac{{c}^{2} \cdot a}{{b}^{3}}\right) + -0.5625 \cdot \frac{{c}^{3} \cdot {a}^{2}}{{b}^{5}} \]
      3. associate-*l/90.4%

        \[\leadsto \left(\color{blue}{\frac{-0.5}{b} \cdot c} + -0.375 \cdot \frac{{c}^{2} \cdot a}{{b}^{3}}\right) + -0.5625 \cdot \frac{{c}^{3} \cdot {a}^{2}}{{b}^{5}} \]
      4. associate-+l+90.4%

        \[\leadsto \color{blue}{\frac{-0.5}{b} \cdot c + \left(-0.375 \cdot \frac{{c}^{2} \cdot a}{{b}^{3}} + -0.5625 \cdot \frac{{c}^{3} \cdot {a}^{2}}{{b}^{5}}\right)} \]
      5. associate-*l/90.5%

        \[\leadsto \color{blue}{\frac{-0.5 \cdot c}{b}} + \left(-0.375 \cdot \frac{{c}^{2} \cdot a}{{b}^{3}} + -0.5625 \cdot \frac{{c}^{3} \cdot {a}^{2}}{{b}^{5}}\right) \]
      6. associate-*r/90.5%

        \[\leadsto \color{blue}{-0.5 \cdot \frac{c}{b}} + \left(-0.375 \cdot \frac{{c}^{2} \cdot a}{{b}^{3}} + -0.5625 \cdot \frac{{c}^{3} \cdot {a}^{2}}{{b}^{5}}\right) \]
      7. +-commutative90.5%

        \[\leadsto -0.5 \cdot \frac{c}{b} + \color{blue}{\left(-0.5625 \cdot \frac{{c}^{3} \cdot {a}^{2}}{{b}^{5}} + -0.375 \cdot \frac{{c}^{2} \cdot a}{{b}^{3}}\right)} \]
      8. fma-def90.5%

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

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

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

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

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

Alternative 4: 85.7% accurate, 0.4× speedup?

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

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

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


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

    1. Initial program 81.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. /-rgt-identity81.0%

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

        \[\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-/r/81.0%

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

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

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

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

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

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

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

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

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

    1. Initial program 48.5%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
    2. Step-by-step derivation
      1. /-rgt-identity48.5%

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

        \[\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-/r/48.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -0.5 \cdot \frac{c}{b} + \color{blue}{\frac{-0.375}{\frac{{b}^{3}}{a \cdot \left(c \cdot c\right)}}} \]
      3. *-commutative88.2%

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

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

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

Alternative 5: 85.7% accurate, 0.4× speedup?

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

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

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


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

    1. Initial program 81.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. /-rgt-identity81.0%

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

        \[\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-/r/81.0%

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 48.5%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
    2. Step-by-step derivation
      1. /-rgt-identity48.5%

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

        \[\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-/r/48.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -0.5 \cdot \frac{c}{b} + \color{blue}{\frac{-0.375}{\frac{{b}^{3}}{a \cdot \left(c \cdot c\right)}}} \]
      3. *-commutative88.2%

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

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

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

Alternative 6: 85.7% accurate, 0.4× speedup?

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

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

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


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

    1. Initial program 81.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. /-rgt-identity81.0%

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

        \[\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-/r/81.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 48.5%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
    2. Step-by-step derivation
      1. /-rgt-identity48.5%

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

        \[\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-/r/48.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -0.5 \cdot \frac{c}{b} + \color{blue}{\frac{-0.375}{\frac{{b}^{3}}{a \cdot \left(c \cdot c\right)}}} \]
      3. *-commutative88.2%

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

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

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

Alternative 7: 85.7% accurate, 0.5× speedup?

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

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

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


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

    1. Initial program 81.0%

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

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

    1. Initial program 48.5%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
    2. Step-by-step derivation
      1. /-rgt-identity48.5%

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

        \[\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-/r/48.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -0.5 \cdot \frac{c}{b} + \color{blue}{\frac{-0.375}{\frac{{b}^{3}}{a \cdot \left(c \cdot c\right)}}} \]
      3. *-commutative88.2%

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

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

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

Alternative 8: 84.9% accurate, 1.0× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < 0.20000000000000001

    1. Initial program 85.8%

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

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

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

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

        \[\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/85.8%

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

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

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

        \[\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. *-commutative85.8%

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

        \[\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/85.8%

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

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

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

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

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

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

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

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

    if 0.20000000000000001 < b

    1. Initial program 51.1%

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

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

        \[\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-/r/51.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 82.1% accurate, 1.0× speedup?

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

\\
-0.5 \cdot \frac{c}{b} + \frac{-0.375}{\frac{{b}^{3}}{a \cdot \left(c \cdot c\right)}}
\end{array}
Derivation
  1. Initial program 55.7%

    \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
  2. Step-by-step derivation
    1. /-rgt-identity55.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 64.7% 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 55.7%

    \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
  2. Step-by-step derivation
    1. /-rgt-identity55.7%

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

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

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

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

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

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

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

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

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

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

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

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

Reproduce

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