Quadratic roots, narrow range

?

Percentage Accurate: 55.5% → 91.8%
Time: 13.3s
Precision: binary64
Cost: 66500

?

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

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


\end{array}

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.

Herbie found 9 alternatives:

AlternativeAccuracySpeedup

Accuracy vs Speed

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.

Bogosity?

Bogosity

Derivation?

  1. Split input into 2 regimes
  2. if b < 0.101999999999999993

    1. Initial program 85.1%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
    2. Applied egg-rr83.7%

      \[\leadsto \frac{\left(-b\right) + \color{blue}{\sqrt[3]{{\left(b \cdot b - c \cdot \left(a \cdot 4\right)\right)}^{1.5}}}}{2 \cdot a} \]
      Step-by-step derivation

      [Start]85.1%

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

      add-cbrt-cube [=>]83.5%

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

      pow3 [=>]83.3%

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

      sqrt-pow2 [=>]83.7%

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

      *-commutative [=>]83.7%

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

      *-commutative [=>]83.7%

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

      metadata-eval [=>]83.7%

      \[ \frac{\left(-b\right) + \sqrt[3]{{\left(b \cdot b - c \cdot \left(a \cdot 4\right)\right)}^{\color{blue}{1.5}}}}{2 \cdot a} \]
    3. Applied egg-rr84.3%

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

      [Start]83.7%

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

      flip3-+ [=>]83.8%

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

      fma-neg [=>]84.4%

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

      *-commutative [=>]84.4%

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

      *-commutative [<=]84.4%

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

      associate-*r* [=>]84.4%

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

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

      [Start]84.3%

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

      cube-neg [=>]84.3%

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

      mul-1-neg [<=]84.3%

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

      rem-cube-cbrt [=>]86.0%

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

      +-commutative [=>]86.0%

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

      mul-1-neg [=>]86.0%

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

      unsub-neg [=>]86.0%

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

      distribute-rgt-neg-in [=>]86.0%

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

      metadata-eval [=>]86.0%

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

    if 0.101999999999999993 < b

    1. Initial program 50.4%

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

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

      [Start]50.4%

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

      neg-sub0 [=>]50.4%

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

      associate-+l- [=>]50.4%

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

      sub0-neg [=>]50.4%

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

      neg-mul-1 [=>]50.4%

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

      associate-*l/ [<=]50.4%

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

      *-commutative [=>]50.4%

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

      associate-/r* [=>]50.4%

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

      /-rgt-identity [<=]50.4%

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

      metadata-eval [<=]50.4%

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

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

      \[\leadsto \color{blue}{\left(\mathsf{fma}\left(-0.25, \frac{\mathsf{fma}\left(16, \frac{{c}^{4}}{{b}^{6}}, 4 \cdot \frac{{c}^{4}}{{b}^{6}}\right)}{\frac{b}{{a}^{3}}}, \frac{\left(-2 \cdot \left(a \cdot a\right)\right) \cdot {c}^{3}}{{b}^{5}}\right) - \frac{c}{b}\right) - \frac{c \cdot c}{\frac{{b}^{3}}{a}}} \]
      Step-by-step derivation

      [Start]94.8%

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

      +-commutative [=>]94.8%

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

      mul-1-neg [=>]94.8%

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

      unsub-neg [=>]94.8%

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

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

      \[\leadsto \left(\mathsf{fma}\left(-0.25, \color{blue}{20 \cdot \frac{{c}^{4}}{\frac{{b}^{7}}{{a}^{3}}}}, \frac{\left(-2 \cdot \left(a \cdot a\right)\right) \cdot {c}^{3}}{{b}^{5}}\right) - \frac{c}{b}\right) - \frac{c \cdot c}{\frac{{b}^{3}}{a}} \]
      Step-by-step derivation

      [Start]94.8%

      \[ \left(\mathsf{fma}\left(-0.25, 20 \cdot \frac{{c}^{4} \cdot {a}^{3}}{{b}^{7}}, \frac{\left(-2 \cdot \left(a \cdot a\right)\right) \cdot {c}^{3}}{{b}^{5}}\right) - \frac{c}{b}\right) - \frac{c \cdot c}{\frac{{b}^{3}}{a}} \]

      associate-/l* [=>]94.8%

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

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

Alternatives

Alternative 1
Accuracy91.8%
Cost66500
\[\begin{array}{l} t_0 := {\left(\mathsf{fma}\left(b, b, \left(c \cdot a\right) \cdot -4\right)\right)}^{1.5}\\ t_1 := \sqrt[3]{t_0}\\ \mathbf{if}\;b \leq 0.102:\\ \;\;\;\;\frac{\frac{t_0 - {b}^{3}}{\mathsf{fma}\left(t_1, b + t_1, b \cdot b\right)}}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\left(\mathsf{fma}\left(-0.25, 20 \cdot \frac{{c}^{4}}{\frac{{b}^{7}}{{a}^{3}}}, \frac{\left(-2 \cdot \left(a \cdot a\right)\right) \cdot {c}^{3}}{{b}^{5}}\right) - \frac{c}{b}\right) - \frac{c \cdot c}{\frac{{b}^{3}}{a}}\\ \end{array} \]
Alternative 2
Accuracy91.8%
Cost60228
\[\begin{array}{l} t_0 := {\left(\mathsf{fma}\left(b, b, \left(c \cdot a\right) \cdot -4\right)\right)}^{1.5}\\ t_1 := \sqrt[3]{t_0}\\ \mathbf{if}\;b \leq 0.104:\\ \;\;\;\;\frac{\frac{t_0 - {b}^{3}}{b \cdot b + t_1 \cdot \left(b + t_1\right)}}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\left(\mathsf{fma}\left(-0.25, 20 \cdot \frac{{c}^{4}}{\frac{{b}^{7}}{{a}^{3}}}, \frac{\left(-2 \cdot \left(a \cdot a\right)\right) \cdot {c}^{3}}{{b}^{5}}\right) - \frac{c}{b}\right) - \frac{c \cdot c}{\frac{{b}^{3}}{a}}\\ \end{array} \]
Alternative 3
Accuracy91.7%
Cost47172
\[\begin{array}{l} t_0 := \sqrt[3]{b \cdot b}\\ \mathbf{if}\;b \leq 0.104:\\ \;\;\;\;\frac{\mathsf{fma}\left(-\sqrt[3]{b}, t_0, \sqrt[3]{b} \cdot t_0\right) + \left(\sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} - b\right)}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\left(\mathsf{fma}\left(-0.25, 20 \cdot \frac{{c}^{4}}{\frac{{b}^{7}}{{a}^{3}}}, \frac{\left(-2 \cdot \left(a \cdot a\right)\right) \cdot {c}^{3}}{{b}^{5}}\right) - \frac{c}{b}\right) - \frac{c \cdot c}{\frac{{b}^{3}}{a}}\\ \end{array} \]
Alternative 4
Accuracy88.7%
Cost46468
\[\begin{array}{l} t_0 := \sqrt[3]{b \cdot b}\\ \mathbf{if}\;b \leq 21.5:\\ \;\;\;\;\frac{\mathsf{fma}\left(-\sqrt[3]{b}, t_0, \sqrt[3]{b} \cdot t_0\right) + \left(\sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} - b\right)}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{\left(-2 \cdot \left(a \cdot a\right)\right) \cdot {c}^{3}}{{b}^{5}} - \frac{c}{b}\right) - \frac{c \cdot c}{\frac{{b}^{3}}{a}}\\ \end{array} \]
Alternative 5
Accuracy88.9%
Cost20868
\[\begin{array}{l} \mathbf{if}\;b \leq 20:\\ \;\;\;\;\left(b - \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)}\right) \cdot \frac{-0.5}{a}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{\left(-2 \cdot \left(a \cdot a\right)\right) \cdot {c}^{3}}{{b}^{5}} - \frac{c}{b}\right) - \frac{c \cdot c}{\frac{{b}^{3}}{a}}\\ \end{array} \]
Alternative 6
Accuracy85.3%
Cost13764
\[\begin{array}{l} \mathbf{if}\;b \leq 20:\\ \;\;\;\;\left(b - \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)}\right) \cdot \frac{-0.5}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot \left(-c\right)}{\frac{b \cdot \left(b \cdot b\right)}{a}} - \frac{c}{b}\\ \end{array} \]
Alternative 7
Accuracy85.3%
Cost7492
\[\begin{array}{l} \mathbf{if}\;b \leq 20:\\ \;\;\;\;\frac{-0.5}{a} \cdot \left(b - \sqrt{b \cdot b + a \cdot \left(c \cdot -4\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot \left(-c\right)}{\frac{b \cdot \left(b \cdot b\right)}{a}} - \frac{c}{b}\\ \end{array} \]
Alternative 8
Accuracy81.2%
Cost1024
\[\frac{c \cdot \left(-c\right)}{\frac{b \cdot \left(b \cdot b\right)}{a}} - \frac{c}{b} \]
Alternative 9
Accuracy64.2%
Cost256
\[\frac{-c}{b} \]

Reproduce?

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