Quadratic roots, narrow range

Percentage Accurate: 55.7% → 91.7%
Time: 11.4s
Alternatives: 13
Speedup: 29.0×

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(4 \cdot a\right) \cdot c}}{2 \cdot a} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))
double code(double a, double b, double c) {
	return (-b + sqrt(((b * b) - ((4.0 * a) * c)))) / (2.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) - ((4.0d0 * a) * c)))) / (2.0d0 * a)
end function
public static double code(double a, double b, double c) {
	return (-b + Math.sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a);
}
def code(a, b, c):
	return (-b + math.sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a)
function code(a, b, c)
	return Float64(Float64(Float64(-b) + sqrt(Float64(Float64(b * b) - Float64(Float64(4.0 * a) * c)))) / Float64(2.0 * a))
end
function tmp = code(a, b, c)
	tmp = (-b + sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a);
end
code[a_, b_, c_] := N[(N[((-b) + N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(4.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \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 13 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.7% accurate, 1.0× speedup?

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

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

Alternative 1: 91.7% accurate, 0.1× speedup?

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

\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)\\
\mathbf{if}\;\frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} - b}{a \cdot 2} \leq -15:\\
\;\;\;\;\frac{\frac{b \cdot b - t_0}{\left(-b\right) - \sqrt{t_0}}}{a \cdot 2}\\

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


\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 4 a) c)))) (*.f64 2 a)) < -15

    1. Initial program 87.2%

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

        \[\leadsto \frac{\left(-b\right) + \color{blue}{{\left(b \cdot b - \left(4 \cdot a\right) \cdot c\right)}^{0.5}}}{2 \cdot a} \]
      2. fma-neg87.5%

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

        \[\leadsto \frac{\left(-b\right) + {\left(\mathsf{fma}\left(b, b, -\color{blue}{c \cdot \left(4 \cdot a\right)}\right)\right)}^{0.5}}{2 \cdot a} \]
      4. distribute-rgt-neg-in87.5%

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

        \[\leadsto \frac{\left(-b\right) + {\left(\mathsf{fma}\left(b, b, c \cdot \left(-\color{blue}{a \cdot 4}\right)\right)\right)}^{0.5}}{2 \cdot a} \]
      6. distribute-rgt-neg-in87.5%

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

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

      \[\leadsto \frac{\left(-b\right) + \color{blue}{{\left(\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)\right)}^{0.5}}}{2 \cdot a} \]
    4. Step-by-step derivation
      1. flip-+87.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{b \cdot b - \mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}{\left(-b\right) - \sqrt{\color{blue}{{b}^{2}} + c \cdot \left(a \cdot -4\right)}}}{2 \cdot a} \]
      9. +-commutative88.6%

        \[\leadsto \frac{\frac{b \cdot b - \mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}{\left(-b\right) - \sqrt{\color{blue}{c \cdot \left(a \cdot -4\right) + {b}^{2}}}}}{2 \cdot a} \]
      10. fma-def88.6%

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

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

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

    if -15 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))) (*.f64 2 a))

    1. Initial program 50.3%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{{c}^{2} \cdot a}{{b}^{3}} + \left(-1 \cdot \frac{c}{b} + \left(-0.25 \cdot \frac{{a}^{3} \cdot \left(16 \cdot \frac{{c}^{4}}{{b}^{6}} + {\left(-2 \cdot \frac{{c}^{2}}{{b}^{3}}\right)}^{2}\right)}{b} + -2 \cdot \frac{{c}^{3} \cdot {a}^{2}}{{b}^{5}}\right)\right)} \]
    3. Step-by-step derivation
      1. +-commutative93.5%

        \[\leadsto \color{blue}{\left(-1 \cdot \frac{c}{b} + \left(-0.25 \cdot \frac{{a}^{3} \cdot \left(16 \cdot \frac{{c}^{4}}{{b}^{6}} + {\left(-2 \cdot \frac{{c}^{2}}{{b}^{3}}\right)}^{2}\right)}{b} + -2 \cdot \frac{{c}^{3} \cdot {a}^{2}}{{b}^{5}}\right)\right) + -1 \cdot \frac{{c}^{2} \cdot a}{{b}^{3}}} \]
      2. mul-1-neg93.5%

        \[\leadsto \left(-1 \cdot \frac{c}{b} + \left(-0.25 \cdot \frac{{a}^{3} \cdot \left(16 \cdot \frac{{c}^{4}}{{b}^{6}} + {\left(-2 \cdot \frac{{c}^{2}}{{b}^{3}}\right)}^{2}\right)}{b} + -2 \cdot \frac{{c}^{3} \cdot {a}^{2}}{{b}^{5}}\right)\right) + \color{blue}{\left(-\frac{{c}^{2} \cdot a}{{b}^{3}}\right)} \]
      3. unsub-neg93.5%

        \[\leadsto \color{blue}{\left(-1 \cdot \frac{c}{b} + \left(-0.25 \cdot \frac{{a}^{3} \cdot \left(16 \cdot \frac{{c}^{4}}{{b}^{6}} + {\left(-2 \cdot \frac{{c}^{2}}{{b}^{3}}\right)}^{2}\right)}{b} + -2 \cdot \frac{{c}^{3} \cdot {a}^{2}}{{b}^{5}}\right)\right) - \frac{{c}^{2} \cdot a}{{b}^{3}}} \]
    4. Simplified93.5%

      \[\leadsto \color{blue}{\left(\mathsf{fma}\left(-2, \frac{a \cdot a}{\frac{{b}^{5}}{{c}^{3}}}, \frac{\left(-0.25 \cdot {a}^{3}\right) \cdot \mathsf{fma}\left(16, \frac{{c}^{4}}{{b}^{6}}, 4 \cdot \frac{{c}^{4}}{{b}^{6}}\right)}{b}\right) - \frac{c}{b}\right) - \frac{c}{\frac{{b}^{3}}{c}} \cdot a} \]
    5. Taylor expanded in c around 0 93.5%

      \[\leadsto \left(\mathsf{fma}\left(-2, \frac{a \cdot a}{\frac{{b}^{5}}{{c}^{3}}}, \frac{\color{blue}{-5 \cdot \frac{{c}^{4} \cdot {a}^{3}}{{b}^{6}}}}{b}\right) - \frac{c}{b}\right) - \frac{c}{\frac{{b}^{3}}{c}} \cdot a \]
    6. Step-by-step derivation
      1. associate-/l*93.5%

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

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

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

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

Alternative 2: 91.7% accurate, 0.2× speedup?

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

\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)\\
\mathbf{if}\;\frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} - b}{a \cdot 2} \leq -15:\\
\;\;\;\;\frac{\frac{b \cdot b - t_0}{\left(-b\right) - \sqrt{t_0}}}{a \cdot 2}\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.25, \frac{{\left(a \cdot c\right)}^{4}}{a} \cdot \frac{20}{{b}^{7}}, \frac{-2 \cdot {c}^{3}}{\frac{{b}^{5}}{a \cdot a}} - \frac{c}{b}\right) - c \cdot \left(a \cdot \frac{c}{{b}^{3}}\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 4 a) c)))) (*.f64 2 a)) < -15

    1. Initial program 87.2%

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

        \[\leadsto \frac{\left(-b\right) + \color{blue}{{\left(b \cdot b - \left(4 \cdot a\right) \cdot c\right)}^{0.5}}}{2 \cdot a} \]
      2. fma-neg87.5%

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

        \[\leadsto \frac{\left(-b\right) + {\left(\mathsf{fma}\left(b, b, -\color{blue}{c \cdot \left(4 \cdot a\right)}\right)\right)}^{0.5}}{2 \cdot a} \]
      4. distribute-rgt-neg-in87.5%

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

        \[\leadsto \frac{\left(-b\right) + {\left(\mathsf{fma}\left(b, b, c \cdot \left(-\color{blue}{a \cdot 4}\right)\right)\right)}^{0.5}}{2 \cdot a} \]
      6. distribute-rgt-neg-in87.5%

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

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

      \[\leadsto \frac{\left(-b\right) + \color{blue}{{\left(\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)\right)}^{0.5}}}{2 \cdot a} \]
    4. Step-by-step derivation
      1. flip-+87.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{b \cdot b - \mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}{\left(-b\right) - \sqrt{\color{blue}{{b}^{2}} + c \cdot \left(a \cdot -4\right)}}}{2 \cdot a} \]
      9. +-commutative88.6%

        \[\leadsto \frac{\frac{b \cdot b - \mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}{\left(-b\right) - \sqrt{\color{blue}{c \cdot \left(a \cdot -4\right) + {b}^{2}}}}}{2 \cdot a} \]
      10. fma-def88.6%

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

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

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

    if -15 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))) (*.f64 2 a))

    1. Initial program 50.3%

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

        \[\leadsto \frac{\left(-b\right) + \color{blue}{{\left(b \cdot b - \left(4 \cdot a\right) \cdot c\right)}^{0.5}}}{2 \cdot a} \]
      2. fma-neg50.4%

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

        \[\leadsto \frac{\left(-b\right) + {\left(\mathsf{fma}\left(b, b, -\color{blue}{c \cdot \left(4 \cdot a\right)}\right)\right)}^{0.5}}{2 \cdot a} \]
      4. distribute-rgt-neg-in50.4%

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

        \[\leadsto \frac{\left(-b\right) + {\left(\mathsf{fma}\left(b, b, c \cdot \left(-\color{blue}{a \cdot 4}\right)\right)\right)}^{0.5}}{2 \cdot a} \]
      6. distribute-rgt-neg-in50.4%

        \[\leadsto \frac{\left(-b\right) + {\left(\mathsf{fma}\left(b, b, c \cdot \color{blue}{\left(a \cdot \left(-4\right)\right)}\right)\right)}^{0.5}}{2 \cdot a} \]
      7. metadata-eval50.4%

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

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

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

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

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

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

        \[\leadsto \sqrt[3]{\left(\frac{\left(-b\right) + \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)}}{a \cdot 2} \cdot \frac{\left(-b\right) + \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)}}{\color{blue}{a \cdot 2}}\right) \cdot \frac{\left(-b\right) + {\left(\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)\right)}^{0.5}}{2 \cdot a}} \]
      6. unpow1/250.4%

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

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

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \frac{{c}^{2} \cdot a}{{b}^{3}} + \left(-0.25 \cdot \frac{{\left(-2 \cdot \left({c}^{2} \cdot {a}^{2}\right)\right)}^{2} + 16 \cdot \left({c}^{4} \cdot {a}^{4}\right)}{a \cdot {b}^{7}} + \left(-1 \cdot \frac{c}{b} + -2 \cdot \frac{{c}^{3} \cdot {a}^{2}}{{b}^{5}}\right)\right)} \]
    9. Step-by-step derivation
      1. +-commutative93.5%

        \[\leadsto \color{blue}{\left(-0.25 \cdot \frac{{\left(-2 \cdot \left({c}^{2} \cdot {a}^{2}\right)\right)}^{2} + 16 \cdot \left({c}^{4} \cdot {a}^{4}\right)}{a \cdot {b}^{7}} + \left(-1 \cdot \frac{c}{b} + -2 \cdot \frac{{c}^{3} \cdot {a}^{2}}{{b}^{5}}\right)\right) + -1 \cdot \frac{{c}^{2} \cdot a}{{b}^{3}}} \]
      2. mul-1-neg93.5%

        \[\leadsto \left(-0.25 \cdot \frac{{\left(-2 \cdot \left({c}^{2} \cdot {a}^{2}\right)\right)}^{2} + 16 \cdot \left({c}^{4} \cdot {a}^{4}\right)}{a \cdot {b}^{7}} + \left(-1 \cdot \frac{c}{b} + -2 \cdot \frac{{c}^{3} \cdot {a}^{2}}{{b}^{5}}\right)\right) + \color{blue}{\left(-\frac{{c}^{2} \cdot a}{{b}^{3}}\right)} \]
      3. unsub-neg93.5%

        \[\leadsto \color{blue}{\left(-0.25 \cdot \frac{{\left(-2 \cdot \left({c}^{2} \cdot {a}^{2}\right)\right)}^{2} + 16 \cdot \left({c}^{4} \cdot {a}^{4}\right)}{a \cdot {b}^{7}} + \left(-1 \cdot \frac{c}{b} + -2 \cdot \frac{{c}^{3} \cdot {a}^{2}}{{b}^{5}}\right)\right) - \frac{{c}^{2} \cdot a}{{b}^{3}}} \]
    10. Simplified93.5%

      \[\leadsto \color{blue}{\mathsf{fma}\left(-0.25, \frac{\mathsf{fma}\left(16, {c}^{4} \cdot {a}^{4}, 4 \cdot \left({c}^{4} \cdot {a}^{4}\right)\right)}{a \cdot {b}^{7}}, \frac{{c}^{3} \cdot -2}{\frac{{b}^{5}}{a \cdot a}} - \frac{c}{b}\right) - c \cdot \left(a \cdot \frac{c}{{b}^{3}}\right)} \]
    11. Taylor expanded in c around 0 93.5%

      \[\leadsto \mathsf{fma}\left(-0.25, \color{blue}{\frac{{c}^{4} \cdot \left(4 \cdot {a}^{4} + 16 \cdot {a}^{4}\right)}{a \cdot {b}^{7}}}, \frac{{c}^{3} \cdot -2}{\frac{{b}^{5}}{a \cdot a}} - \frac{c}{b}\right) - c \cdot \left(a \cdot \frac{c}{{b}^{3}}\right) \]
    12. Step-by-step derivation
      1. distribute-rgt-out93.5%

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

        \[\leadsto \mathsf{fma}\left(-0.25, \frac{\color{blue}{\left({c}^{4} \cdot {a}^{4}\right) \cdot \left(4 + 16\right)}}{a \cdot {b}^{7}}, \frac{{c}^{3} \cdot -2}{\frac{{b}^{5}}{a \cdot a}} - \frac{c}{b}\right) - c \cdot \left(a \cdot \frac{c}{{b}^{3}}\right) \]
      3. times-frac93.5%

        \[\leadsto \mathsf{fma}\left(-0.25, \color{blue}{\frac{{c}^{4} \cdot {a}^{4}}{a} \cdot \frac{4 + 16}{{b}^{7}}}, \frac{{c}^{3} \cdot -2}{\frac{{b}^{5}}{a \cdot a}} - \frac{c}{b}\right) - c \cdot \left(a \cdot \frac{c}{{b}^{3}}\right) \]
    13. Simplified93.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} - b}{a \cdot 2} \leq -15:\\ \;\;\;\;\frac{\frac{b \cdot b - \mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}{\left(-b\right) - \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}}}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-0.25, \frac{{\left(a \cdot c\right)}^{4}}{a} \cdot \frac{20}{{b}^{7}}, \frac{-2 \cdot {c}^{3}}{\frac{{b}^{5}}{a \cdot a}} - \frac{c}{b}\right) - c \cdot \left(a \cdot \frac{c}{{b}^{3}}\right)\\ \end{array} \]

Alternative 3: 89.3% accurate, 0.2× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\left({c}^{3} \cdot \left(-2 \cdot \frac{a \cdot a}{{b}^{5}}\right) - \frac{c}{b}\right) - a \cdot \frac{c \cdot c}{{b}^{3}}\\


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

    1. Initial program 83.5%

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

        \[\leadsto \frac{\left(-b\right) + \color{blue}{{\left(b \cdot b - \left(4 \cdot a\right) \cdot c\right)}^{0.5}}}{2 \cdot a} \]
      2. fma-neg83.6%

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

        \[\leadsto \frac{\left(-b\right) + {\left(\mathsf{fma}\left(b, b, -\color{blue}{c \cdot \left(4 \cdot a\right)}\right)\right)}^{0.5}}{2 \cdot a} \]
      4. distribute-rgt-neg-in83.6%

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

        \[\leadsto \frac{\left(-b\right) + {\left(\mathsf{fma}\left(b, b, c \cdot \left(-\color{blue}{a \cdot 4}\right)\right)\right)}^{0.5}}{2 \cdot a} \]
      6. distribute-rgt-neg-in83.6%

        \[\leadsto \frac{\left(-b\right) + {\left(\mathsf{fma}\left(b, b, c \cdot \color{blue}{\left(a \cdot \left(-4\right)\right)}\right)\right)}^{0.5}}{2 \cdot a} \]
      7. metadata-eval83.6%

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

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

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

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

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

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

        \[\leadsto \sqrt[3]{\left(\frac{\left(-b\right) + \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)}}{a \cdot 2} \cdot \frac{\left(-b\right) + \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)}}{\color{blue}{a \cdot 2}}\right) \cdot \frac{\left(-b\right) + {\left(\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)\right)}^{0.5}}{2 \cdot a}} \]
      6. unpow1/283.6%

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

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

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

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

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

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

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

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

    if -1.5 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))) (*.f64 2 a))

    1. Initial program 48.4%

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

        \[\leadsto \frac{\left(-b\right) + \color{blue}{{\left(b \cdot b - \left(4 \cdot a\right) \cdot c\right)}^{0.5}}}{2 \cdot a} \]
      2. fma-neg48.5%

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

        \[\leadsto \frac{\left(-b\right) + {\left(\mathsf{fma}\left(b, b, -\color{blue}{c \cdot \left(4 \cdot a\right)}\right)\right)}^{0.5}}{2 \cdot a} \]
      4. distribute-rgt-neg-in48.5%

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

        \[\leadsto \frac{\left(-b\right) + {\left(\mathsf{fma}\left(b, b, c \cdot \left(-\color{blue}{a \cdot 4}\right)\right)\right)}^{0.5}}{2 \cdot a} \]
      6. distribute-rgt-neg-in48.5%

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

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

      \[\leadsto \frac{\left(-b\right) + \color{blue}{{\left(\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)\right)}^{0.5}}}{2 \cdot a} \]
    4. Taylor expanded in b around inf 92.0%

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

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

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

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

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

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

Alternative 4: 89.3% accurate, 0.3× speedup?

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

\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)\\
\mathbf{if}\;\frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} - b}{a \cdot 2} \leq -1.5:\\
\;\;\;\;\frac{\frac{b \cdot b - t_0}{\left(-b\right) - \sqrt{t_0}}}{a \cdot 2}\\

\mathbf{else}:\\
\;\;\;\;\left({c}^{3} \cdot \left(-2 \cdot \frac{a \cdot a}{{b}^{5}}\right) - \frac{c}{b}\right) - a \cdot \frac{c \cdot c}{{b}^{3}}\\


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

    1. Initial program 83.5%

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

        \[\leadsto \frac{\left(-b\right) + \color{blue}{{\left(b \cdot b - \left(4 \cdot a\right) \cdot c\right)}^{0.5}}}{2 \cdot a} \]
      2. fma-neg83.6%

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

        \[\leadsto \frac{\left(-b\right) + {\left(\mathsf{fma}\left(b, b, -\color{blue}{c \cdot \left(4 \cdot a\right)}\right)\right)}^{0.5}}{2 \cdot a} \]
      4. distribute-rgt-neg-in83.6%

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

        \[\leadsto \frac{\left(-b\right) + {\left(\mathsf{fma}\left(b, b, c \cdot \left(-\color{blue}{a \cdot 4}\right)\right)\right)}^{0.5}}{2 \cdot a} \]
      6. distribute-rgt-neg-in83.6%

        \[\leadsto \frac{\left(-b\right) + {\left(\mathsf{fma}\left(b, b, c \cdot \color{blue}{\left(a \cdot \left(-4\right)\right)}\right)\right)}^{0.5}}{2 \cdot a} \]
      7. metadata-eval83.6%

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

      \[\leadsto \frac{\left(-b\right) + \color{blue}{{\left(\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)\right)}^{0.5}}}{2 \cdot a} \]
    4. Step-by-step derivation
      1. flip-+83.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{b \cdot b - \mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}{\left(-b\right) - \sqrt{\color{blue}{{b}^{2}} + c \cdot \left(a \cdot -4\right)}}}{2 \cdot a} \]
      9. +-commutative84.7%

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

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

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

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

    if -1.5 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))) (*.f64 2 a))

    1. Initial program 48.4%

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

        \[\leadsto \frac{\left(-b\right) + \color{blue}{{\left(b \cdot b - \left(4 \cdot a\right) \cdot c\right)}^{0.5}}}{2 \cdot a} \]
      2. fma-neg48.5%

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

        \[\leadsto \frac{\left(-b\right) + {\left(\mathsf{fma}\left(b, b, -\color{blue}{c \cdot \left(4 \cdot a\right)}\right)\right)}^{0.5}}{2 \cdot a} \]
      4. distribute-rgt-neg-in48.5%

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

        \[\leadsto \frac{\left(-b\right) + {\left(\mathsf{fma}\left(b, b, c \cdot \left(-\color{blue}{a \cdot 4}\right)\right)\right)}^{0.5}}{2 \cdot a} \]
      6. distribute-rgt-neg-in48.5%

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

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

      \[\leadsto \frac{\left(-b\right) + \color{blue}{{\left(\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)\right)}^{0.5}}}{2 \cdot a} \]
    4. Taylor expanded in b around inf 92.0%

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

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

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

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

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

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

Alternative 5: 89.3% accurate, 0.3× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\left({c}^{3} \cdot \left(-2 \cdot \frac{a \cdot a}{{b}^{5}}\right) - \frac{c}{b}\right) - a \cdot \frac{c \cdot c}{{b}^{3}}\\


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

    1. Initial program 83.5%

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

        \[\leadsto \frac{\left(-b\right) + \color{blue}{{\left(b \cdot b - \left(4 \cdot a\right) \cdot c\right)}^{0.5}}}{2 \cdot a} \]
      2. fma-neg83.6%

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

        \[\leadsto \frac{\left(-b\right) + {\left(\mathsf{fma}\left(b, b, -\color{blue}{c \cdot \left(4 \cdot a\right)}\right)\right)}^{0.5}}{2 \cdot a} \]
      4. distribute-rgt-neg-in83.6%

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

        \[\leadsto \frac{\left(-b\right) + {\left(\mathsf{fma}\left(b, b, c \cdot \left(-\color{blue}{a \cdot 4}\right)\right)\right)}^{0.5}}{2 \cdot a} \]
      6. distribute-rgt-neg-in83.6%

        \[\leadsto \frac{\left(-b\right) + {\left(\mathsf{fma}\left(b, b, c \cdot \color{blue}{\left(a \cdot \left(-4\right)\right)}\right)\right)}^{0.5}}{2 \cdot a} \]
      7. metadata-eval83.6%

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

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

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

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

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

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

        \[\leadsto \sqrt[3]{\left(\frac{\left(-b\right) + \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)}}{a \cdot 2} \cdot \frac{\left(-b\right) + \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)}}{\color{blue}{a \cdot 2}}\right) \cdot \frac{\left(-b\right) + {\left(\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)\right)}^{0.5}}{2 \cdot a}} \]
      6. unpow1/283.6%

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{0.5}{a} \cdot \frac{\color{blue}{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)} - b \cdot b}{\sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)} + b} \]
    11. Applied egg-rr84.8%

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

    if -1.5 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))) (*.f64 2 a))

    1. Initial program 48.4%

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

        \[\leadsto \frac{\left(-b\right) + \color{blue}{{\left(b \cdot b - \left(4 \cdot a\right) \cdot c\right)}^{0.5}}}{2 \cdot a} \]
      2. fma-neg48.5%

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

        \[\leadsto \frac{\left(-b\right) + {\left(\mathsf{fma}\left(b, b, -\color{blue}{c \cdot \left(4 \cdot a\right)}\right)\right)}^{0.5}}{2 \cdot a} \]
      4. distribute-rgt-neg-in48.5%

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

        \[\leadsto \frac{\left(-b\right) + {\left(\mathsf{fma}\left(b, b, c \cdot \left(-\color{blue}{a \cdot 4}\right)\right)\right)}^{0.5}}{2 \cdot a} \]
      6. distribute-rgt-neg-in48.5%

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

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

      \[\leadsto \frac{\left(-b\right) + \color{blue}{{\left(\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)\right)}^{0.5}}}{2 \cdot a} \]
    4. Taylor expanded in b around inf 92.0%

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

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

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

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

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

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

Alternative 6: 89.1% accurate, 0.3× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\left({c}^{3} \cdot \left(-2 \cdot \frac{a \cdot a}{{b}^{5}}\right) - \frac{c}{b}\right) - a \cdot \frac{c \cdot c}{{b}^{3}}\\


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

    1. Initial program 83.5%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
    2. Step-by-step derivation
      1. fma-neg83.6%

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

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

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

        \[\leadsto \frac{\left(-b\right) + \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(-\color{blue}{a \cdot 4}\right)\right)}}{2 \cdot a} \]
      5. distribute-rgt-neg-in83.6%

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

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

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

    if -1.5 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))) (*.f64 2 a))

    1. Initial program 48.4%

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

        \[\leadsto \frac{\left(-b\right) + \color{blue}{{\left(b \cdot b - \left(4 \cdot a\right) \cdot c\right)}^{0.5}}}{2 \cdot a} \]
      2. fma-neg48.5%

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

        \[\leadsto \frac{\left(-b\right) + {\left(\mathsf{fma}\left(b, b, -\color{blue}{c \cdot \left(4 \cdot a\right)}\right)\right)}^{0.5}}{2 \cdot a} \]
      4. distribute-rgt-neg-in48.5%

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

        \[\leadsto \frac{\left(-b\right) + {\left(\mathsf{fma}\left(b, b, c \cdot \left(-\color{blue}{a \cdot 4}\right)\right)\right)}^{0.5}}{2 \cdot a} \]
      6. distribute-rgt-neg-in48.5%

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

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

      \[\leadsto \frac{\left(-b\right) + \color{blue}{{\left(\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)\right)}^{0.5}}}{2 \cdot a} \]
    4. Taylor expanded in b around inf 92.0%

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

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

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

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

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

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

Alternative 7: 84.9% accurate, 0.3× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{-c}{b} - a \cdot \left(c \cdot \frac{c}{{b}^{3}}\right)\right)\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 4 a) c)))) (*.f64 2 a)) < -0.0100000000000000002

    1. Initial program 80.3%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
    2. Step-by-step derivation
      1. fma-neg80.4%

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

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

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

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

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

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

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

    if -0.0100000000000000002 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))) (*.f64 2 a))

    1. Initial program 43.5%

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

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

        \[\leadsto \color{blue}{-1 \cdot \frac{c}{b} + -1 \cdot \frac{{c}^{2} \cdot a}{{b}^{3}}} \]
      2. mul-1-neg89.8%

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

        \[\leadsto \color{blue}{-1 \cdot \frac{c}{b} - \frac{{c}^{2} \cdot a}{{b}^{3}}} \]
      4. associate-*r/89.8%

        \[\leadsto \color{blue}{\frac{-1 \cdot c}{b}} - \frac{{c}^{2} \cdot a}{{b}^{3}} \]
      5. neg-mul-189.8%

        \[\leadsto \frac{\color{blue}{-c}}{b} - \frac{{c}^{2} \cdot a}{{b}^{3}} \]
      6. associate-/l*89.8%

        \[\leadsto \frac{-c}{b} - \color{blue}{\frac{{c}^{2}}{\frac{{b}^{3}}{a}}} \]
      7. associate-/r/89.8%

        \[\leadsto \frac{-c}{b} - \color{blue}{\frac{{c}^{2}}{{b}^{3}} \cdot a} \]
      8. unpow289.8%

        \[\leadsto \frac{-c}{b} - \frac{\color{blue}{c \cdot c}}{{b}^{3}} \cdot a \]
      9. associate-/l*89.8%

        \[\leadsto \frac{-c}{b} - \color{blue}{\frac{c}{\frac{{b}^{3}}{c}}} \cdot a \]
    4. Simplified89.8%

      \[\leadsto \color{blue}{\frac{-c}{b} - \frac{c}{\frac{{b}^{3}}{c}} \cdot a} \]
    5. Step-by-step derivation
      1. log1p-expm1-u89.8%

        \[\leadsto \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{-c}{b} - \frac{c}{\frac{{b}^{3}}{c}} \cdot a\right)\right)} \]
      2. *-commutative89.8%

        \[\leadsto \mathsf{log1p}\left(\mathsf{expm1}\left(\frac{-c}{b} - \color{blue}{a \cdot \frac{c}{\frac{{b}^{3}}{c}}}\right)\right) \]
      3. associate-/r/89.8%

        \[\leadsto \mathsf{log1p}\left(\mathsf{expm1}\left(\frac{-c}{b} - a \cdot \color{blue}{\left(\frac{c}{{b}^{3}} \cdot c\right)}\right)\right) \]
    6. Applied egg-rr89.8%

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

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

Alternative 8: 84.8% accurate, 0.4× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\frac{-c}{b} - a \cdot \left(c \cdot \frac{c}{{b}^{3}}\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 4 a) c)))) (*.f64 2 a)) < -0.0100000000000000002

    1. Initial program 80.3%

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

        \[\leadsto \frac{\left(-b\right) + \color{blue}{{\left(b \cdot b - \left(4 \cdot a\right) \cdot c\right)}^{0.5}}}{2 \cdot a} \]
      2. fma-neg80.4%

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

        \[\leadsto \frac{\left(-b\right) + {\left(\mathsf{fma}\left(b, b, -\color{blue}{c \cdot \left(4 \cdot a\right)}\right)\right)}^{0.5}}{2 \cdot a} \]
      4. distribute-rgt-neg-in80.4%

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

        \[\leadsto \frac{\left(-b\right) + {\left(\mathsf{fma}\left(b, b, c \cdot \left(-\color{blue}{a \cdot 4}\right)\right)\right)}^{0.5}}{2 \cdot a} \]
      6. distribute-rgt-neg-in80.4%

        \[\leadsto \frac{\left(-b\right) + {\left(\mathsf{fma}\left(b, b, c \cdot \color{blue}{\left(a \cdot \left(-4\right)\right)}\right)\right)}^{0.5}}{2 \cdot a} \]
      7. metadata-eval80.4%

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

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

        \[\leadsto \color{blue}{\left(\left(-b\right) + {\left(\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)\right)}^{0.5}\right) \cdot \frac{1}{2 \cdot a}} \]
      2. unpow1/280.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -0.0100000000000000002 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))) (*.f64 2 a))

    1. Initial program 43.5%

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

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

        \[\leadsto \color{blue}{-1 \cdot \frac{c}{b} + -1 \cdot \frac{{c}^{2} \cdot a}{{b}^{3}}} \]
      2. mul-1-neg89.8%

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

        \[\leadsto \color{blue}{-1 \cdot \frac{c}{b} - \frac{{c}^{2} \cdot a}{{b}^{3}}} \]
      4. associate-*r/89.8%

        \[\leadsto \color{blue}{\frac{-1 \cdot c}{b}} - \frac{{c}^{2} \cdot a}{{b}^{3}} \]
      5. neg-mul-189.8%

        \[\leadsto \frac{\color{blue}{-c}}{b} - \frac{{c}^{2} \cdot a}{{b}^{3}} \]
      6. associate-/l*89.8%

        \[\leadsto \frac{-c}{b} - \color{blue}{\frac{{c}^{2}}{\frac{{b}^{3}}{a}}} \]
      7. associate-/r/89.8%

        \[\leadsto \frac{-c}{b} - \color{blue}{\frac{{c}^{2}}{{b}^{3}} \cdot a} \]
      8. unpow289.8%

        \[\leadsto \frac{-c}{b} - \frac{\color{blue}{c \cdot c}}{{b}^{3}} \cdot a \]
      9. associate-/l*89.8%

        \[\leadsto \frac{-c}{b} - \color{blue}{\frac{c}{\frac{{b}^{3}}{c}}} \cdot a \]
    4. Simplified89.8%

      \[\leadsto \color{blue}{\frac{-c}{b} - \frac{c}{\frac{{b}^{3}}{c}} \cdot a} \]
    5. Step-by-step derivation
      1. associate-/r/89.8%

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

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

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

Alternative 9: 84.9% accurate, 0.4× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\frac{-c}{b} - a \cdot \left(c \cdot \frac{c}{{b}^{3}}\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 4 a) c)))) (*.f64 2 a)) < -0.0100000000000000002

    1. Initial program 80.3%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
    2. Step-by-step derivation
      1. fma-neg80.4%

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

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

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

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

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

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

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

    if -0.0100000000000000002 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))) (*.f64 2 a))

    1. Initial program 43.5%

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

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

        \[\leadsto \color{blue}{-1 \cdot \frac{c}{b} + -1 \cdot \frac{{c}^{2} \cdot a}{{b}^{3}}} \]
      2. mul-1-neg89.8%

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

        \[\leadsto \color{blue}{-1 \cdot \frac{c}{b} - \frac{{c}^{2} \cdot a}{{b}^{3}}} \]
      4. associate-*r/89.8%

        \[\leadsto \color{blue}{\frac{-1 \cdot c}{b}} - \frac{{c}^{2} \cdot a}{{b}^{3}} \]
      5. neg-mul-189.8%

        \[\leadsto \frac{\color{blue}{-c}}{b} - \frac{{c}^{2} \cdot a}{{b}^{3}} \]
      6. associate-/l*89.8%

        \[\leadsto \frac{-c}{b} - \color{blue}{\frac{{c}^{2}}{\frac{{b}^{3}}{a}}} \]
      7. associate-/r/89.8%

        \[\leadsto \frac{-c}{b} - \color{blue}{\frac{{c}^{2}}{{b}^{3}} \cdot a} \]
      8. unpow289.8%

        \[\leadsto \frac{-c}{b} - \frac{\color{blue}{c \cdot c}}{{b}^{3}} \cdot a \]
      9. associate-/l*89.8%

        \[\leadsto \frac{-c}{b} - \color{blue}{\frac{c}{\frac{{b}^{3}}{c}}} \cdot a \]
    4. Simplified89.8%

      \[\leadsto \color{blue}{\frac{-c}{b} - \frac{c}{\frac{{b}^{3}}{c}} \cdot a} \]
    5. Step-by-step derivation
      1. associate-/r/89.8%

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

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

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

Alternative 10: 84.8% accurate, 0.5× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\frac{-c}{b} - a \cdot \left(c \cdot \frac{c}{{b}^{3}}\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 4 a) c)))) (*.f64 2 a)) < -0.0100000000000000002

    1. Initial program 80.3%

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

    if -0.0100000000000000002 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))) (*.f64 2 a))

    1. Initial program 43.5%

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

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

        \[\leadsto \color{blue}{-1 \cdot \frac{c}{b} + -1 \cdot \frac{{c}^{2} \cdot a}{{b}^{3}}} \]
      2. mul-1-neg89.8%

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

        \[\leadsto \color{blue}{-1 \cdot \frac{c}{b} - \frac{{c}^{2} \cdot a}{{b}^{3}}} \]
      4. associate-*r/89.8%

        \[\leadsto \color{blue}{\frac{-1 \cdot c}{b}} - \frac{{c}^{2} \cdot a}{{b}^{3}} \]
      5. neg-mul-189.8%

        \[\leadsto \frac{\color{blue}{-c}}{b} - \frac{{c}^{2} \cdot a}{{b}^{3}} \]
      6. associate-/l*89.8%

        \[\leadsto \frac{-c}{b} - \color{blue}{\frac{{c}^{2}}{\frac{{b}^{3}}{a}}} \]
      7. associate-/r/89.8%

        \[\leadsto \frac{-c}{b} - \color{blue}{\frac{{c}^{2}}{{b}^{3}} \cdot a} \]
      8. unpow289.8%

        \[\leadsto \frac{-c}{b} - \frac{\color{blue}{c \cdot c}}{{b}^{3}} \cdot a \]
      9. associate-/l*89.8%

        \[\leadsto \frac{-c}{b} - \color{blue}{\frac{c}{\frac{{b}^{3}}{c}}} \cdot a \]
    4. Simplified89.8%

      \[\leadsto \color{blue}{\frac{-c}{b} - \frac{c}{\frac{{b}^{3}}{c}} \cdot a} \]
    5. Step-by-step derivation
      1. associate-/r/89.8%

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

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

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

Alternative 11: 85.0% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 79.6%

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

        \[\leadsto \frac{\left(-b\right) + \color{blue}{{\left(b \cdot b - \left(4 \cdot a\right) \cdot c\right)}^{0.5}}}{2 \cdot a} \]
      2. fma-neg79.7%

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

        \[\leadsto \frac{\left(-b\right) + {\left(\mathsf{fma}\left(b, b, -\color{blue}{c \cdot \left(4 \cdot a\right)}\right)\right)}^{0.5}}{2 \cdot a} \]
      4. distribute-rgt-neg-in79.7%

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

        \[\leadsto \frac{\left(-b\right) + {\left(\mathsf{fma}\left(b, b, c \cdot \left(-\color{blue}{a \cdot 4}\right)\right)\right)}^{0.5}}{2 \cdot a} \]
      6. distribute-rgt-neg-in79.7%

        \[\leadsto \frac{\left(-b\right) + {\left(\mathsf{fma}\left(b, b, c \cdot \color{blue}{\left(a \cdot \left(-4\right)\right)}\right)\right)}^{0.5}}{2 \cdot a} \]
      7. metadata-eval79.7%

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

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

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

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

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

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

        \[\leadsto \sqrt[3]{\left(\frac{\left(-b\right) + \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)}}{a \cdot 2} \cdot \frac{\left(-b\right) + \sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)}}{\color{blue}{a \cdot 2}}\right) \cdot \frac{\left(-b\right) + {\left(\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)\right)}^{0.5}}{2 \cdot a}} \]
      6. unpow1/279.6%

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

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

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

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

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

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

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

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

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

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

    if 16.5 < b

    1. Initial program 45.6%

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

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

        \[\leadsto \color{blue}{-1 \cdot \frac{c}{b} + -1 \cdot \frac{{c}^{2} \cdot a}{{b}^{3}}} \]
      2. mul-1-neg88.3%

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

        \[\leadsto \color{blue}{-1 \cdot \frac{c}{b} - \frac{{c}^{2} \cdot a}{{b}^{3}}} \]
      4. associate-*r/88.3%

        \[\leadsto \color{blue}{\frac{-1 \cdot c}{b}} - \frac{{c}^{2} \cdot a}{{b}^{3}} \]
      5. neg-mul-188.3%

        \[\leadsto \frac{\color{blue}{-c}}{b} - \frac{{c}^{2} \cdot a}{{b}^{3}} \]
      6. associate-/l*88.3%

        \[\leadsto \frac{-c}{b} - \color{blue}{\frac{{c}^{2}}{\frac{{b}^{3}}{a}}} \]
      7. associate-/r/88.3%

        \[\leadsto \frac{-c}{b} - \color{blue}{\frac{{c}^{2}}{{b}^{3}} \cdot a} \]
      8. unpow288.3%

        \[\leadsto \frac{-c}{b} - \frac{\color{blue}{c \cdot c}}{{b}^{3}} \cdot a \]
      9. associate-/l*88.3%

        \[\leadsto \frac{-c}{b} - \color{blue}{\frac{c}{\frac{{b}^{3}}{c}}} \cdot a \]
    4. Simplified88.3%

      \[\leadsto \color{blue}{\frac{-c}{b} - \frac{c}{\frac{{b}^{3}}{c}} \cdot a} \]
    5. Step-by-step derivation
      1. associate-/r/88.3%

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

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

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

Alternative 12: 81.3% accurate, 1.0× speedup?

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

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \frac{c}{b} + -1 \cdot \frac{{c}^{2} \cdot a}{{b}^{3}}} \]
    2. mul-1-neg82.5%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{c}{b} - \frac{{c}^{2} \cdot a}{{b}^{3}}} \]
    4. associate-*r/82.5%

      \[\leadsto \color{blue}{\frac{-1 \cdot c}{b}} - \frac{{c}^{2} \cdot a}{{b}^{3}} \]
    5. neg-mul-182.5%

      \[\leadsto \frac{\color{blue}{-c}}{b} - \frac{{c}^{2} \cdot a}{{b}^{3}} \]
    6. associate-/l*82.5%

      \[\leadsto \frac{-c}{b} - \color{blue}{\frac{{c}^{2}}{\frac{{b}^{3}}{a}}} \]
    7. associate-/r/82.5%

      \[\leadsto \frac{-c}{b} - \color{blue}{\frac{{c}^{2}}{{b}^{3}} \cdot a} \]
    8. unpow282.5%

      \[\leadsto \frac{-c}{b} - \frac{\color{blue}{c \cdot c}}{{b}^{3}} \cdot a \]
    9. associate-/l*82.5%

      \[\leadsto \frac{-c}{b} - \color{blue}{\frac{c}{\frac{{b}^{3}}{c}}} \cdot a \]
  4. Simplified82.5%

    \[\leadsto \color{blue}{\frac{-c}{b} - \frac{c}{\frac{{b}^{3}}{c}} \cdot a} \]
  5. Step-by-step derivation
    1. associate-/r/82.5%

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

    \[\leadsto \frac{-c}{b} - \color{blue}{\left(\frac{c}{{b}^{3}} \cdot c\right)} \cdot a \]
  7. Final simplification82.5%

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

Alternative 13: 64.2% accurate, 29.0× speedup?

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

\\
\frac{-c}{b}
\end{array}
Derivation
  1. Initial program 53.6%

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

    \[\leadsto \color{blue}{-1 \cdot \frac{c}{b}} \]
  3. Step-by-step derivation
    1. associate-*r/66.0%

      \[\leadsto \color{blue}{\frac{-1 \cdot c}{b}} \]
    2. neg-mul-166.0%

      \[\leadsto \frac{\color{blue}{-c}}{b} \]
  4. Simplified66.0%

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

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

Reproduce

?
herbie shell --seed 2023187 
(FPCore (a b c)
  :name "Quadratic roots, 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) (* (* 4.0 a) c)))) (* 2.0 a)))