Average Error: 20.0 → 6.9
Time: 14.3s
Precision: binary64
Cost: 69404
\[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
\[\begin{array}{l} t_0 := \sqrt[3]{c \cdot \frac{a}{b}}\\ t_1 := \left(-b\right) - b\\ t_2 := \sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)}\\ t_3 := \frac{t_2 - b}{2 \cdot a}\\ t_4 := \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b + \mathsf{fma}\left(c, a \cdot -4, \mathsf{fma}\left(c, a \cdot -4, a \cdot \left(c \cdot 4\right)\right)\right)}}\\ \mathbf{else}:\\ \;\;\;\;t_3\\ \end{array}\\ t_5 := \frac{2 \cdot c}{\left(-b\right) - t_2}\\ t_6 := \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;t_5\\ \mathbf{else}:\\ \;\;\;\;t_3\\ \end{array}\\ \mathbf{if}\;t_6 \leq -\infty:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;t_5\\ \mathbf{else}:\\ \;\;\;\;\frac{t_1}{2 \cdot a}\\ \end{array}\\ \mathbf{elif}\;t_6 \leq -1 \cdot 10^{-248}:\\ \;\;\;\;t_4\\ \mathbf{elif}\;t_6 \leq 0:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) + \left(0 - \mathsf{fma}\left(-2, {\left({\left({t_0}^{2}\right)}^{0.3333333333333333} \cdot \sqrt[3]{t_0}\right)}^{3}, b\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;t_3\\ \end{array}\\ \mathbf{elif}\;t_6 \leq 4 \cdot 10^{+203}:\\ \;\;\;\;t_4\\ \mathbf{elif}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{t_1}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (>= b 0.0)
   (/ (* 2.0 c) (- (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))))
   (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a))))
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (cbrt (* c (/ a b))))
        (t_1 (- (- b) b))
        (t_2 (sqrt (- (* b b) (* c (* 4.0 a)))))
        (t_3 (/ (- t_2 b) (* 2.0 a)))
        (t_4
         (if (>= b 0.0)
           (/
            (* 2.0 c)
            (-
             (- b)
             (sqrt
              (+
               (* b b)
               (fma c (* a -4.0) (fma c (* a -4.0) (* a (* c 4.0))))))))
           t_3))
        (t_5 (/ (* 2.0 c) (- (- b) t_2)))
        (t_6 (if (>= b 0.0) t_5 t_3)))
   (if (<= t_6 (- INFINITY))
     (if (>= b 0.0) t_5 (/ t_1 (* 2.0 a)))
     (if (<= t_6 -1e-248)
       t_4
       (if (<= t_6 0.0)
         (if (>= b 0.0)
           (/
            (* 2.0 c)
            (+
             (- b)
             (-
              0.0
              (fma
               -2.0
               (pow (* (pow (pow t_0 2.0) 0.3333333333333333) (cbrt t_0)) 3.0)
               b))))
           t_3)
         (if (<= t_6 4e+203)
           t_4
           (if (>= b 0.0) (/ (* 2.0 c) t_1) (- (/ c b) (/ b a)))))))))
double code(double a, double b, double c) {
	double tmp;
	if (b >= 0.0) {
		tmp = (2.0 * c) / (-b - sqrt(((b * b) - ((4.0 * a) * c))));
	} else {
		tmp = (-b + sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a);
	}
	return tmp;
}
double code(double a, double b, double c) {
	double t_0 = cbrt((c * (a / b)));
	double t_1 = -b - b;
	double t_2 = sqrt(((b * b) - (c * (4.0 * a))));
	double t_3 = (t_2 - b) / (2.0 * a);
	double tmp;
	if (b >= 0.0) {
		tmp = (2.0 * c) / (-b - sqrt(((b * b) + fma(c, (a * -4.0), fma(c, (a * -4.0), (a * (c * 4.0)))))));
	} else {
		tmp = t_3;
	}
	double t_4 = tmp;
	double t_5 = (2.0 * c) / (-b - t_2);
	double tmp_1;
	if (b >= 0.0) {
		tmp_1 = t_5;
	} else {
		tmp_1 = t_3;
	}
	double t_6 = tmp_1;
	double tmp_3;
	if (t_6 <= -((double) INFINITY)) {
		double tmp_4;
		if (b >= 0.0) {
			tmp_4 = t_5;
		} else {
			tmp_4 = t_1 / (2.0 * a);
		}
		tmp_3 = tmp_4;
	} else if (t_6 <= -1e-248) {
		tmp_3 = t_4;
	} else if (t_6 <= 0.0) {
		double tmp_5;
		if (b >= 0.0) {
			tmp_5 = (2.0 * c) / (-b + (0.0 - fma(-2.0, pow((pow(pow(t_0, 2.0), 0.3333333333333333) * cbrt(t_0)), 3.0), b)));
		} else {
			tmp_5 = t_3;
		}
		tmp_3 = tmp_5;
	} else if (t_6 <= 4e+203) {
		tmp_3 = t_4;
	} else if (b >= 0.0) {
		tmp_3 = (2.0 * c) / t_1;
	} else {
		tmp_3 = (c / b) - (b / a);
	}
	return tmp_3;
}
function code(a, b, c)
	tmp = 0.0
	if (b >= 0.0)
		tmp = Float64(Float64(2.0 * c) / Float64(Float64(-b) - sqrt(Float64(Float64(b * b) - Float64(Float64(4.0 * a) * c)))));
	else
		tmp = Float64(Float64(Float64(-b) + sqrt(Float64(Float64(b * b) - Float64(Float64(4.0 * a) * c)))) / Float64(2.0 * a));
	end
	return tmp
end
function code(a, b, c)
	t_0 = cbrt(Float64(c * Float64(a / b)))
	t_1 = Float64(Float64(-b) - b)
	t_2 = sqrt(Float64(Float64(b * b) - Float64(c * Float64(4.0 * a))))
	t_3 = Float64(Float64(t_2 - b) / Float64(2.0 * a))
	tmp = 0.0
	if (b >= 0.0)
		tmp = Float64(Float64(2.0 * c) / Float64(Float64(-b) - sqrt(Float64(Float64(b * b) + fma(c, Float64(a * -4.0), fma(c, Float64(a * -4.0), Float64(a * Float64(c * 4.0))))))));
	else
		tmp = t_3;
	end
	t_4 = tmp
	t_5 = Float64(Float64(2.0 * c) / Float64(Float64(-b) - t_2))
	tmp_1 = 0.0
	if (b >= 0.0)
		tmp_1 = t_5;
	else
		tmp_1 = t_3;
	end
	t_6 = tmp_1
	tmp_3 = 0.0
	if (t_6 <= Float64(-Inf))
		tmp_4 = 0.0
		if (b >= 0.0)
			tmp_4 = t_5;
		else
			tmp_4 = Float64(t_1 / Float64(2.0 * a));
		end
		tmp_3 = tmp_4;
	elseif (t_6 <= -1e-248)
		tmp_3 = t_4;
	elseif (t_6 <= 0.0)
		tmp_5 = 0.0
		if (b >= 0.0)
			tmp_5 = Float64(Float64(2.0 * c) / Float64(Float64(-b) + Float64(0.0 - fma(-2.0, (Float64(((t_0 ^ 2.0) ^ 0.3333333333333333) * cbrt(t_0)) ^ 3.0), b))));
		else
			tmp_5 = t_3;
		end
		tmp_3 = tmp_5;
	elseif (t_6 <= 4e+203)
		tmp_3 = t_4;
	elseif (b >= 0.0)
		tmp_3 = Float64(Float64(2.0 * c) / t_1);
	else
		tmp_3 = Float64(Float64(c / b) - Float64(b / a));
	end
	return tmp_3
end
code[a_, b_, c_] := If[GreaterEqual[b, 0.0], N[(N[(2.0 * c), $MachinePrecision] / N[((-b) - N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(4.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 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[(c * N[(a / b), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]}, Block[{t$95$1 = N[((-b) - b), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(c * N[(4.0 * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(N[(t$95$2 - b), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = If[GreaterEqual[b, 0.0], N[(N[(2.0 * c), $MachinePrecision] / N[((-b) - N[Sqrt[N[(N[(b * b), $MachinePrecision] + N[(c * N[(a * -4.0), $MachinePrecision] + N[(c * N[(a * -4.0), $MachinePrecision] + N[(a * N[(c * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$3]}, Block[{t$95$5 = N[(N[(2.0 * c), $MachinePrecision] / N[((-b) - t$95$2), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$6 = If[GreaterEqual[b, 0.0], t$95$5, t$95$3]}, If[LessEqual[t$95$6, (-Infinity)], If[GreaterEqual[b, 0.0], t$95$5, N[(t$95$1 / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]], If[LessEqual[t$95$6, -1e-248], t$95$4, If[LessEqual[t$95$6, 0.0], If[GreaterEqual[b, 0.0], N[(N[(2.0 * c), $MachinePrecision] / N[((-b) + N[(0.0 - N[(-2.0 * N[Power[N[(N[Power[N[Power[t$95$0, 2.0], $MachinePrecision], 0.3333333333333333], $MachinePrecision] * N[Power[t$95$0, 1/3], $MachinePrecision]), $MachinePrecision], 3.0], $MachinePrecision] + b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$3], If[LessEqual[t$95$6, 4e+203], t$95$4, If[GreaterEqual[b, 0.0], N[(N[(2.0 * c), $MachinePrecision] / t$95$1), $MachinePrecision], N[(N[(c / b), $MachinePrecision] - N[(b / a), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]]]
\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\

\mathbf{else}:\\
\;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\


\end{array}
\begin{array}{l}
t_0 := \sqrt[3]{c \cdot \frac{a}{b}}\\
t_1 := \left(-b\right) - b\\
t_2 := \sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)}\\
t_3 := \frac{t_2 - b}{2 \cdot a}\\
t_4 := \begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b + \mathsf{fma}\left(c, a \cdot -4, \mathsf{fma}\left(c, a \cdot -4, a \cdot \left(c \cdot 4\right)\right)\right)}}\\

\mathbf{else}:\\
\;\;\;\;t_3\\


\end{array}\\
t_5 := \frac{2 \cdot c}{\left(-b\right) - t_2}\\
t_6 := \begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;t_5\\

\mathbf{else}:\\
\;\;\;\;t_3\\


\end{array}\\
\mathbf{if}\;t_6 \leq -\infty:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;t_5\\

\mathbf{else}:\\
\;\;\;\;\frac{t_1}{2 \cdot a}\\


\end{array}\\

\mathbf{elif}\;t_6 \leq -1 \cdot 10^{-248}:\\
\;\;\;\;t_4\\

\mathbf{elif}\;t_6 \leq 0:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) + \left(0 - \mathsf{fma}\left(-2, {\left({\left({t_0}^{2}\right)}^{0.3333333333333333} \cdot \sqrt[3]{t_0}\right)}^{3}, b\right)\right)}\\

\mathbf{else}:\\
\;\;\;\;t_3\\


\end{array}\\

\mathbf{elif}\;t_6 \leq 4 \cdot 10^{+203}:\\
\;\;\;\;t_4\\

\mathbf{elif}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot c}{t_1}\\

\mathbf{else}:\\
\;\;\;\;\frac{c}{b} - \frac{b}{a}\\


\end{array}

Error

Derivation

  1. Split input into 4 regimes
  2. if (if (>=.f64 b 0) (/.f64 (*.f64 2 c) (-.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c))))) (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))) (*.f64 2 a))) < -inf.0

    1. Initial program 64.0

      \[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
    2. Taylor expanded in b around -inf 17.7

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

    if -inf.0 < (if (>=.f64 b 0) (/.f64 (*.f64 2 c) (-.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c))))) (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))) (*.f64 2 a))) < -9.9999999999999998e-249 or -0.0 < (if (>=.f64 b 0) (/.f64 (*.f64 2 c) (-.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c))))) (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))) (*.f64 2 a))) < 4e203

    1. Initial program 2.8

      \[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
    2. Applied egg-rr2.8

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{\color{blue}{b \cdot b + \mathsf{fma}\left(c, a \cdot -4, \mathsf{fma}\left(c, a \cdot -4, a \cdot \left(4 \cdot c\right)\right)\right)}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]

    if -9.9999999999999998e-249 < (if (>=.f64 b 0) (/.f64 (*.f64 2 c) (-.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c))))) (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))) (*.f64 2 a))) < -0.0

    1. Initial program 35.9

      \[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
    2. Taylor expanded in b around inf 12.4

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \color{blue}{\left(b + -2 \cdot \frac{c \cdot a}{b}\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
    3. Simplified10.1

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \color{blue}{\mathsf{fma}\left(-2, \frac{c}{\frac{b}{a}}, b\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
      Proof
      (fma.f64 -2 (/.f64 c (/.f64 b a)) b): 0 points increase in error, 0 points decrease in error
      (fma.f64 -2 (Rewrite<= associate-/l*_binary64 (/.f64 (*.f64 c a) b)) b): 31 points increase in error, 20 points decrease in error
      (Rewrite<= fma-def_binary64 (+.f64 (*.f64 -2 (/.f64 (*.f64 c a) b)) b)): 0 points increase in error, 0 points decrease in error
      (Rewrite<= +-commutative_binary64 (+.f64 b (*.f64 -2 (/.f64 (*.f64 c a) b)))): 0 points increase in error, 0 points decrease in error
    4. Applied egg-rr10.1

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \mathsf{fma}\left(-2, \color{blue}{{\left(\sqrt[3]{c \cdot \frac{a}{b}}\right)}^{3}}, b\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
    5. Applied egg-rr10.1

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

    if 4e203 < (if (>=.f64 b 0) (/.f64 (*.f64 2 c) (-.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c))))) (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))) (*.f64 2 a)))

    1. Initial program 47.1

      \[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
    2. Taylor expanded in b around inf 44.8

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \color{blue}{b}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array} \]
    3. Taylor expanded in b around -inf 14.4

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - b}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} + -1 \cdot \frac{b}{a}\\ \end{array} \]
    4. Simplified14.4

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - b}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \end{array} \]
      Proof
      (-.f64 (/.f64 c b) (/.f64 b a)): 0 points increase in error, 0 points decrease in error
      (Rewrite<= unsub-neg_binary64 (+.f64 (/.f64 c b) (neg.f64 (/.f64 b a)))): 0 points increase in error, 0 points decrease in error
      (+.f64 (/.f64 c b) (Rewrite<= mul-1-neg_binary64 (*.f64 -1 (/.f64 b a)))): 0 points increase in error, 0 points decrease in error
  3. Recombined 4 regimes into one program.
  4. Final simplification6.9

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

Alternatives

Alternative 1
Error45.1
Cost388
\[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-b}{a}\\ \end{array} \]

Error

Reproduce

herbie shell --seed 2022291 
(FPCore (a b c)
  :name "jeff quadratic root 2"
  :precision binary64
  (if (>= b 0.0) (/ (* 2.0 c) (- (- b) (sqrt (- (* b b) (* (* 4.0 a) c))))) (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a))))