Average Error: 19.7 → 6.7
Time: 26.0s
Precision: binary64
Cost: 38052
\[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \end{array} \]
\[\begin{array}{l} t_0 := c \cdot \left(a \cdot -4\right)\\ t_1 := \sqrt{b \cdot b + t_0}\\ t_2 := \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{\left(-b\right) - t_1}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{t_1 - b}\\ \end{array}\\ \mathbf{if}\;t_2 \leq -\infty:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-0.5}{a} \cdot \left(b + \mathsf{hypot}\left(\sqrt{c \cdot -4} \cdot \sqrt{a}, b\right)\right)\\ \mathbf{else}:\\ \;\;\;\;c \cdot \frac{2}{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -4\right)\right)} - b}\\ \end{array}\\ \mathbf{elif}\;t_2 \leq -2 \cdot 10^{-259}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t_2 \leq 0:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{\left(-b\right) - \sqrt{t_0}}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{\mathsf{fma}\left(b, -2, 2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \end{array}\\ \mathbf{elif}\;t_2 \leq 2 \cdot 10^{+289}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;b \geq 0:\\ \;\;\;\;\frac{\left(-b\right) - b}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{b \cdot -2}\\ \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (>= b 0.0)
   (/ (- (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a))
   (/ (* 2.0 c) (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))))))
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (* c (* a -4.0)))
        (t_1 (sqrt (+ (* b b) t_0)))
        (t_2
         (if (>= b 0.0) (/ (- (- b) t_1) (* a 2.0)) (/ (* c 2.0) (- t_1 b)))))
   (if (<= t_2 (- INFINITY))
     (if (>= b 0.0)
       (* (/ -0.5 a) (+ b (hypot (* (sqrt (* c -4.0)) (sqrt a)) b)))
       (* c (/ 2.0 (- (sqrt (fma b b (* a (* c -4.0)))) b))))
     (if (<= t_2 -2e-259)
       t_2
       (if (<= t_2 0.0)
         (if (>= b 0.0)
           (/ (- (- b) (sqrt t_0)) (* a 2.0))
           (/ (* c 2.0) (fma b -2.0 (* 2.0 (* a (/ c b))))))
         (if (<= t_2 2e+289)
           t_2
           (if (>= b 0.0)
             (/ (- (- b) b) (* a 2.0))
             (/ (* c 2.0) (* b -2.0)))))))))
double code(double a, double b, double c) {
	double tmp;
	if (b >= 0.0) {
		tmp = (-b - sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a);
	} else {
		tmp = (2.0 * c) / (-b + sqrt(((b * b) - ((4.0 * a) * c))));
	}
	return tmp;
}
double code(double a, double b, double c) {
	double t_0 = c * (a * -4.0);
	double t_1 = sqrt(((b * b) + t_0));
	double tmp;
	if (b >= 0.0) {
		tmp = (-b - t_1) / (a * 2.0);
	} else {
		tmp = (c * 2.0) / (t_1 - b);
	}
	double t_2 = tmp;
	double tmp_2;
	if (t_2 <= -((double) INFINITY)) {
		double tmp_3;
		if (b >= 0.0) {
			tmp_3 = (-0.5 / a) * (b + hypot((sqrt((c * -4.0)) * sqrt(a)), b));
		} else {
			tmp_3 = c * (2.0 / (sqrt(fma(b, b, (a * (c * -4.0)))) - b));
		}
		tmp_2 = tmp_3;
	} else if (t_2 <= -2e-259) {
		tmp_2 = t_2;
	} else if (t_2 <= 0.0) {
		double tmp_4;
		if (b >= 0.0) {
			tmp_4 = (-b - sqrt(t_0)) / (a * 2.0);
		} else {
			tmp_4 = (c * 2.0) / fma(b, -2.0, (2.0 * (a * (c / b))));
		}
		tmp_2 = tmp_4;
	} else if (t_2 <= 2e+289) {
		tmp_2 = t_2;
	} else if (b >= 0.0) {
		tmp_2 = (-b - b) / (a * 2.0);
	} else {
		tmp_2 = (c * 2.0) / (b * -2.0);
	}
	return tmp_2;
}
function code(a, b, c)
	tmp = 0.0
	if (b >= 0.0)
		tmp = Float64(Float64(Float64(-b) - sqrt(Float64(Float64(b * b) - Float64(Float64(4.0 * a) * c)))) / Float64(2.0 * a));
	else
		tmp = Float64(Float64(2.0 * c) / Float64(Float64(-b) + sqrt(Float64(Float64(b * b) - Float64(Float64(4.0 * a) * c)))));
	end
	return tmp
end
function code(a, b, c)
	t_0 = Float64(c * Float64(a * -4.0))
	t_1 = sqrt(Float64(Float64(b * b) + t_0))
	tmp = 0.0
	if (b >= 0.0)
		tmp = Float64(Float64(Float64(-b) - t_1) / Float64(a * 2.0));
	else
		tmp = Float64(Float64(c * 2.0) / Float64(t_1 - b));
	end
	t_2 = tmp
	tmp_2 = 0.0
	if (t_2 <= Float64(-Inf))
		tmp_3 = 0.0
		if (b >= 0.0)
			tmp_3 = Float64(Float64(-0.5 / a) * Float64(b + hypot(Float64(sqrt(Float64(c * -4.0)) * sqrt(a)), b)));
		else
			tmp_3 = Float64(c * Float64(2.0 / Float64(sqrt(fma(b, b, Float64(a * Float64(c * -4.0)))) - b)));
		end
		tmp_2 = tmp_3;
	elseif (t_2 <= -2e-259)
		tmp_2 = t_2;
	elseif (t_2 <= 0.0)
		tmp_4 = 0.0
		if (b >= 0.0)
			tmp_4 = Float64(Float64(Float64(-b) - sqrt(t_0)) / Float64(a * 2.0));
		else
			tmp_4 = Float64(Float64(c * 2.0) / fma(b, -2.0, Float64(2.0 * Float64(a * Float64(c / b)))));
		end
		tmp_2 = tmp_4;
	elseif (t_2 <= 2e+289)
		tmp_2 = t_2;
	elseif (b >= 0.0)
		tmp_2 = Float64(Float64(Float64(-b) - b) / Float64(a * 2.0));
	else
		tmp_2 = Float64(Float64(c * 2.0) / Float64(b * -2.0));
	end
	return tmp_2
end
code[a_, b_, c_] := If[GreaterEqual[b, 0.0], 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], 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]]
code[a_, b_, c_] := Block[{t$95$0 = N[(c * N[(a * -4.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(N[(b * b), $MachinePrecision] + t$95$0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = If[GreaterEqual[b, 0.0], N[(N[((-b) - t$95$1), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(c * 2.0), $MachinePrecision] / N[(t$95$1 - b), $MachinePrecision]), $MachinePrecision]]}, If[LessEqual[t$95$2, (-Infinity)], If[GreaterEqual[b, 0.0], N[(N[(-0.5 / a), $MachinePrecision] * N[(b + N[Sqrt[N[(N[Sqrt[N[(c * -4.0), $MachinePrecision]], $MachinePrecision] * N[Sqrt[a], $MachinePrecision]), $MachinePrecision] ^ 2 + b ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c * N[(2.0 / N[(N[Sqrt[N[(b * b + N[(a * N[(c * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], If[LessEqual[t$95$2, -2e-259], t$95$2, If[LessEqual[t$95$2, 0.0], If[GreaterEqual[b, 0.0], N[(N[((-b) - N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(c * 2.0), $MachinePrecision] / N[(b * -2.0 + N[(2.0 * N[(a * N[(c / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], If[LessEqual[t$95$2, 2e+289], t$95$2, If[GreaterEqual[b, 0.0], N[(N[((-b) - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(c * 2.0), $MachinePrecision] / N[(b * -2.0), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\

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


\end{array}
\begin{array}{l}
t_0 := c \cdot \left(a \cdot -4\right)\\
t_1 := \sqrt{b \cdot b + t_0}\\
t_2 := \begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{\left(-b\right) - t_1}{a \cdot 2}\\

\mathbf{else}:\\
\;\;\;\;\frac{c \cdot 2}{t_1 - b}\\


\end{array}\\
\mathbf{if}\;t_2 \leq -\infty:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{-0.5}{a} \cdot \left(b + \mathsf{hypot}\left(\sqrt{c \cdot -4} \cdot \sqrt{a}, b\right)\right)\\

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


\end{array}\\

\mathbf{elif}\;t_2 \leq -2 \cdot 10^{-259}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;t_2 \leq 0:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{\left(-b\right) - \sqrt{t_0}}{a \cdot 2}\\

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


\end{array}\\

\mathbf{elif}\;t_2 \leq 2 \cdot 10^{+289}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;b \geq 0:\\
\;\;\;\;\frac{\left(-b\right) - b}{a \cdot 2}\\

\mathbf{else}:\\
\;\;\;\;\frac{c \cdot 2}{b \cdot -2}\\


\end{array}

Error

Derivation

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

    1. Initial program 64.0

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

      \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-0.5}{a} \cdot \left(b + \sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -4\right)\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;c \cdot \frac{2}{\sqrt{\mathsf{fma}\left(b, b, a \cdot \left(c \cdot -4\right)\right)} - b}\\ } \end{array}} \]
      Proof
      (if (>=.f64 b 0) (*.f64 (/.f64 -1/2 a) (+.f64 b (sqrt.f64 (fma.f64 b b (*.f64 a (*.f64 c -4)))))) (*.f64 c (/.f64 2 (-.f64 (sqrt.f64 (fma.f64 b b (*.f64 a (*.f64 c -4)))) b)))): 0 points increase in error, 0 points decrease in error
      (if (>=.f64 b 0) (*.f64 (/.f64 (Rewrite<= metadata-eval (/.f64 -1 2)) a) (+.f64 b (sqrt.f64 (fma.f64 b b (*.f64 a (*.f64 c -4)))))) (*.f64 c (/.f64 2 (-.f64 (sqrt.f64 (fma.f64 b b (*.f64 a (*.f64 c -4)))) b)))): 0 points increase in error, 0 points decrease in error
      (if (>=.f64 b 0) (*.f64 (Rewrite<= associate-/r*_binary64 (/.f64 -1 (*.f64 2 a))) (+.f64 b (sqrt.f64 (fma.f64 b b (*.f64 a (*.f64 c -4)))))) (*.f64 c (/.f64 2 (-.f64 (sqrt.f64 (fma.f64 b b (*.f64 a (*.f64 c -4)))) b)))): 0 points increase in error, 0 points decrease in error
      (if (>=.f64 b 0) (*.f64 (/.f64 -1 (*.f64 2 a)) (+.f64 b (sqrt.f64 (fma.f64 b b (*.f64 a (*.f64 c (Rewrite<= metadata-eval (neg.f64 4)))))))) (*.f64 c (/.f64 2 (-.f64 (sqrt.f64 (fma.f64 b b (*.f64 a (*.f64 c -4)))) b)))): 0 points increase in error, 0 points decrease in error
      (if (>=.f64 b 0) (*.f64 (/.f64 -1 (*.f64 2 a)) (+.f64 b (sqrt.f64 (fma.f64 b b (Rewrite<= associate-*l*_binary64 (*.f64 (*.f64 a c) (neg.f64 4))))))) (*.f64 c (/.f64 2 (-.f64 (sqrt.f64 (fma.f64 b b (*.f64 a (*.f64 c -4)))) b)))): 1 points increase in error, 0 points decrease in error
      (if (>=.f64 b 0) (*.f64 (/.f64 -1 (*.f64 2 a)) (+.f64 b (sqrt.f64 (fma.f64 b b (Rewrite<= *-commutative_binary64 (*.f64 (neg.f64 4) (*.f64 a c))))))) (*.f64 c (/.f64 2 (-.f64 (sqrt.f64 (fma.f64 b b (*.f64 a (*.f64 c -4)))) b)))): 0 points increase in error, 0 points decrease in error
      (if (>=.f64 b 0) (*.f64 (/.f64 -1 (*.f64 2 a)) (+.f64 b (sqrt.f64 (fma.f64 b b (Rewrite<= distribute-lft-neg-in_binary64 (neg.f64 (*.f64 4 (*.f64 a c)))))))) (*.f64 c (/.f64 2 (-.f64 (sqrt.f64 (fma.f64 b b (*.f64 a (*.f64 c -4)))) b)))): 0 points increase in error, 0 points decrease in error
      (if (>=.f64 b 0) (*.f64 (/.f64 -1 (*.f64 2 a)) (+.f64 b (sqrt.f64 (fma.f64 b b (neg.f64 (Rewrite<= associate-*l*_binary64 (*.f64 (*.f64 4 a) c))))))) (*.f64 c (/.f64 2 (-.f64 (sqrt.f64 (fma.f64 b b (*.f64 a (*.f64 c -4)))) b)))): 0 points increase in error, 1 points decrease in error
      (if (>=.f64 b 0) (*.f64 (/.f64 -1 (*.f64 2 a)) (+.f64 b (sqrt.f64 (Rewrite<= fma-neg_binary64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))))) (*.f64 c (/.f64 2 (-.f64 (sqrt.f64 (fma.f64 b b (*.f64 a (*.f64 c -4)))) b)))): 1 points increase in error, 0 points decrease in error
      (if (>=.f64 b 0) (*.f64 (/.f64 -1 (*.f64 2 a)) (+.f64 b (Rewrite<= remove-double-neg_binary64 (neg.f64 (neg.f64 (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))))))) (*.f64 c (/.f64 2 (-.f64 (sqrt.f64 (fma.f64 b b (*.f64 a (*.f64 c -4)))) b)))): 0 points increase in error, 0 points decrease in error
      (if (>=.f64 b 0) (*.f64 (/.f64 -1 (*.f64 2 a)) (Rewrite<= sub-neg_binary64 (-.f64 b (neg.f64 (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c))))))) (*.f64 c (/.f64 2 (-.f64 (sqrt.f64 (fma.f64 b b (*.f64 a (*.f64 c -4)))) b)))): 0 points increase in error, 0 points decrease in error
      (if (>=.f64 b 0) (*.f64 (/.f64 -1 (*.f64 2 a)) (Rewrite=> sub-neg_binary64 (+.f64 b (neg.f64 (neg.f64 (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))))))) (*.f64 c (/.f64 2 (-.f64 (sqrt.f64 (fma.f64 b b (*.f64 a (*.f64 c -4)))) b)))): 0 points increase in error, 0 points decrease in error
      (if (>=.f64 b 0) (*.f64 (/.f64 -1 (*.f64 2 a)) (+.f64 b (Rewrite=> remove-double-neg_binary64 (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))))) (*.f64 c (/.f64 2 (-.f64 (sqrt.f64 (fma.f64 b b (*.f64 a (*.f64 c -4)))) b)))): 0 points increase in error, 0 points decrease in error
      (if (>=.f64 b 0) (Rewrite=> associate-*l/_binary64 (/.f64 (*.f64 -1 (+.f64 b (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c))))) (*.f64 2 a))) (*.f64 c (/.f64 2 (-.f64 (sqrt.f64 (fma.f64 b b (*.f64 a (*.f64 c -4)))) b)))): 2 points increase in error, 18 points decrease in error
      (if (>=.f64 b 0) (/.f64 (Rewrite<= neg-mul-1_binary64 (neg.f64 (+.f64 b (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))))) (*.f64 2 a)) (*.f64 c (/.f64 2 (-.f64 (sqrt.f64 (fma.f64 b b (*.f64 a (*.f64 c -4)))) b)))): 0 points increase in error, 0 points decrease in error
      (if (>=.f64 b 0) (/.f64 (Rewrite<= distribute-neg-out_binary64 (+.f64 (neg.f64 b) (neg.f64 (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))))) (*.f64 2 a)) (*.f64 c (/.f64 2 (-.f64 (sqrt.f64 (fma.f64 b b (*.f64 a (*.f64 c -4)))) b)))): 0 points increase in error, 0 points decrease in error
      (if (>=.f64 b 0) (/.f64 (Rewrite<= sub-neg_binary64 (-.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c))))) (*.f64 2 a)) (*.f64 c (/.f64 2 (-.f64 (sqrt.f64 (fma.f64 b b (*.f64 a (*.f64 c -4)))) b)))): 0 points increase in error, 0 points decrease in error
      (if (>=.f64 b 0) (/.f64 (-.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))) (*.f64 2 a)) (*.f64 c (/.f64 2 (-.f64 (sqrt.f64 (fma.f64 b b (*.f64 a (*.f64 c (Rewrite<= metadata-eval (neg.f64 4)))))) b)))): 0 points increase in error, 0 points decrease in error
      (if (>=.f64 b 0) (/.f64 (-.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))) (*.f64 2 a)) (*.f64 c (/.f64 2 (-.f64 (sqrt.f64 (fma.f64 b b (Rewrite<= associate-*l*_binary64 (*.f64 (*.f64 a c) (neg.f64 4))))) b)))): 1 points increase in error, 0 points decrease in error
      (if (>=.f64 b 0) (/.f64 (-.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))) (*.f64 2 a)) (*.f64 c (/.f64 2 (-.f64 (sqrt.f64 (fma.f64 b b (Rewrite<= *-commutative_binary64 (*.f64 (neg.f64 4) (*.f64 a c))))) b)))): 0 points increase in error, 0 points decrease in error
      (if (>=.f64 b 0) (/.f64 (-.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))) (*.f64 2 a)) (*.f64 c (/.f64 2 (-.f64 (sqrt.f64 (fma.f64 b b (Rewrite<= distribute-lft-neg-in_binary64 (neg.f64 (*.f64 4 (*.f64 a c)))))) b)))): 0 points increase in error, 0 points decrease in error
      (if (>=.f64 b 0) (/.f64 (-.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))) (*.f64 2 a)) (*.f64 c (/.f64 2 (-.f64 (sqrt.f64 (fma.f64 b b (neg.f64 (Rewrite<= associate-*l*_binary64 (*.f64 (*.f64 4 a) c))))) b)))): 1 points increase in error, 1 points decrease in error
      (if (>=.f64 b 0) (/.f64 (-.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))) (*.f64 2 a)) (*.f64 c (/.f64 2 (-.f64 (sqrt.f64 (Rewrite<= fma-neg_binary64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))) b)))): 0 points increase in error, 0 points decrease in error
      (if (>=.f64 b 0) (/.f64 (-.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))) (*.f64 2 a)) (*.f64 c (/.f64 2 (Rewrite<= unsub-neg_binary64 (+.f64 (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c))) (neg.f64 b)))))): 0 points increase in error, 0 points decrease in error
      (if (>=.f64 b 0) (/.f64 (-.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))) (*.f64 2 a)) (*.f64 c (/.f64 2 (Rewrite<= +-commutative_binary64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))))))): 0 points increase in error, 0 points decrease in error
      (if (>=.f64 b 0) (/.f64 (-.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))) (*.f64 2 a)) (Rewrite<= *-commutative_binary64 (*.f64 (/.f64 2 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c))))) c))): 0 points increase in error, 0 points decrease in error
      (if (>=.f64 b 0) (/.f64 (-.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))) (*.f64 2 a)) (Rewrite=> associate-*l/_binary64 (/.f64 (*.f64 2 c) (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c))))))): 1 points increase in error, 13 points decrease in error
    3. Applied egg-rr64.0

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

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

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

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

    1. Initial program 2.3

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

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

    1. Initial program 35.6

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

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\color{blue}{\frac{2 \cdot c}{\mathsf{fma}\left(b, -2, 2 \cdot \left(\frac{c}{b} \cdot a\right)\right)}}\\ \end{array} \]
      Proof
      (fma.f64 b -2 (*.f64 2 (*.f64 (/.f64 c b) a))): 0 points increase in error, 0 points decrease in error
      (fma.f64 b -2 (*.f64 2 (Rewrite<= associate-/r/_binary64 (/.f64 c (/.f64 b a))))): 16 points increase in error, 21 points decrease in error
      (fma.f64 b -2 (*.f64 2 (Rewrite<= associate-/l*_binary64 (/.f64 (*.f64 c a) b)))): 27 points increase in error, 22 points decrease in error
      (Rewrite<= fma-def_binary64 (+.f64 (*.f64 b -2) (*.f64 2 (/.f64 (*.f64 c a) b)))): 0 points increase in error, 0 points decrease in error
      (+.f64 (Rewrite<= *-commutative_binary64 (*.f64 -2 b)) (*.f64 2 (/.f64 (*.f64 c a) b))): 0 points increase in error, 0 points decrease in error
      (Rewrite<= +-commutative_binary64 (+.f64 (*.f64 2 (/.f64 (*.f64 c a) b)) (*.f64 -2 b))): 0 points increase in error, 0 points decrease in error
    4. Taylor expanded in b around 0 10.3

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

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

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

    1. Initial program 61.5

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

      \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{\left(-b\right) + \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}\\ } \end{array}} \]
      Proof
      (if (>=.f64 b 0) (/.f64 (-.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 4 (*.f64 a c))))) (*.f64 a 2)) (/.f64 (*.f64 c 2) (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 4 (*.f64 a c))))))): 0 points increase in error, 0 points decrease in error
      (if (>=.f64 b 0) (/.f64 (-.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (Rewrite<= associate-*l*_binary64 (*.f64 (*.f64 4 a) c))))) (*.f64 a 2)) (/.f64 (*.f64 c 2) (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 4 (*.f64 a c))))))): 0 points increase in error, 1 points decrease in error
      (if (>=.f64 b 0) (/.f64 (-.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))) (Rewrite<= *-commutative_binary64 (*.f64 2 a))) (/.f64 (*.f64 c 2) (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 4 (*.f64 a c))))))): 0 points increase in error, 0 points decrease in error
      (if (>=.f64 b 0) (/.f64 (-.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))) (*.f64 2 a)) (/.f64 (Rewrite<= *-commutative_binary64 (*.f64 2 c)) (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 4 (*.f64 a c))))))): 0 points increase in error, 0 points decrease in error
      (if (>=.f64 b 0) (/.f64 (-.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))) (*.f64 2 a)) (/.f64 (*.f64 2 c) (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (Rewrite<= associate-*l*_binary64 (*.f64 (*.f64 4 a) c))))))): 1 points increase in error, 1 points decrease in error
    3. Taylor expanded in b around inf 19.3

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

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

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

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

Alternatives

Alternative 1
Error6.3
Cost7820
\[\begin{array}{l} t_0 := \sqrt{b \cdot b + -4 \cdot \left(a \cdot c\right)}\\ \mathbf{if}\;b \leq -6.5 \cdot 10^{+130}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{b + b}{a \cdot 2} + \frac{\frac{2}{\frac{\frac{b}{a}}{c}}}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{\mathsf{fma}\left(b, -2, 2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \end{array}\\ \mathbf{elif}\;b \leq 2.1 \cdot 10^{+107}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{\left(-b\right) - t_0}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{t_0 - b}\\ \end{array}\\ \mathbf{elif}\;b \geq 0:\\ \;\;\;\;\frac{\left(\left(c \cdot 2\right) \cdot \frac{a}{b} - b\right) - b}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \]
Alternative 2
Error13.6
Cost7760
\[\begin{array}{l} t_0 := \frac{c \cdot 2}{\mathsf{fma}\left(b, -2, 2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ t_1 := \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{\left(-b\right) - b}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{\sqrt{a \cdot \left(c \cdot -4\right)} - b}\\ \end{array}\\ \mathbf{if}\;b \leq -1.35 \cdot 10^{-113}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{b + b}{a \cdot 2} + \frac{\frac{2}{\frac{\frac{b}{a}}{c}}}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array}\\ \mathbf{elif}\;b \leq 4.7 \cdot 10^{-303}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;b \leq 4.2 \cdot 10^{-54}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{\left(-b\right) - \sqrt{c \cdot \left(a \cdot -4\right)}}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 3
Error9.9
Cost7760
\[\begin{array}{l} t_0 := \frac{\left(-b\right) - b}{a \cdot 2}\\ t_1 := \frac{c \cdot 2}{\mathsf{fma}\left(b, -2, 2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \mathbf{if}\;b \leq -1 \cdot 10^{+133}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{b + b}{a \cdot 2} + \frac{\frac{2}{\frac{\frac{b}{a}}{c}}}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array}\\ \mathbf{elif}\;b \leq 4.7 \cdot 10^{-303}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{\sqrt{b \cdot b + -4 \cdot \left(a \cdot c\right)} - b}\\ \end{array}\\ \mathbf{elif}\;b \leq 3.8 \cdot 10^{-55}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{\left(-b\right) - \sqrt{c \cdot \left(a \cdot -4\right)}}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array}\\ \mathbf{elif}\;b \geq 0:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{\sqrt{a \cdot \left(c \cdot -4\right)} - b}\\ \end{array} \]
Alternative 4
Error17.9
Cost7496
\[\begin{array}{l} \mathbf{if}\;b \leq -4.3 \cdot 10^{-116}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{b + b}{a \cdot 2} + \frac{\frac{2}{\frac{\frac{b}{a}}{c}}}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{\mathsf{fma}\left(b, -2, 2 \cdot \left(a \cdot \frac{c}{b}\right)\right)}\\ \end{array}\\ \mathbf{elif}\;b \geq 0:\\ \;\;\;\;\frac{\left(-b\right) - b}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{\sqrt{a \cdot \left(c \cdot -4\right)} - b}\\ \end{array} \]
Alternative 5
Error18.0
Cost7368
\[\begin{array}{l} t_0 := \frac{\left(-b\right) - b}{a \cdot 2}\\ \mathbf{if}\;b \leq -1.35 \cdot 10^{-113}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{b \cdot -2}\\ \end{array}\\ \mathbf{elif}\;b \geq 0:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{\sqrt{a \cdot \left(c \cdot -4\right)} - b}\\ \end{array} \]
Alternative 6
Error45.5
Cost644
\[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{\left(-b\right) - b}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{-b}{a}\\ \end{array} \]
Alternative 7
Error22.8
Cost644
\[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{\left(-b\right) - b}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{b \cdot -2}\\ \end{array} \]

Error

Reproduce

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