Average Error: 20.0 → 6.7
Time: 19.1s
Precision: binary64
Cost: 14412
\[\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 := \left(-b\right) - b\\ t_1 := \frac{t_0}{2 \cdot a}\\ t_2 := \sqrt{\mathsf{fma}\left(b, b, -4 \cdot \left(a \cdot c\right)\right)}\\ \mathbf{if}\;b \leq -7.755909129690683 \cdot 10^{+98}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot c}{t_0}\\ \end{array}\\ \mathbf{elif}\;b \leq 3.4 \cdot 10^{+115}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \frac{b + t_2}{a}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{c}{b - t_2}\\ \end{array}\\ \mathbf{elif}\;b \geq 0:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\frac{c + c}{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot 4\right)\right)} \cdot \left(b - \sqrt{c \cdot \left(a \cdot -4\right)}\right)\\ \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 (- (- b) b))
        (t_1 (/ t_0 (* 2.0 a)))
        (t_2 (sqrt (fma b b (* -4.0 (* a c))))))
   (if (<= b -7.755909129690683e+98)
     (if (>= b 0.0) t_1 (/ (* 2.0 c) t_0))
     (if (<= b 3.4e+115)
       (if (>= b 0.0) (* -0.5 (/ (+ b t_2) a)) (* -2.0 (/ c (- b t_2))))
       (if (>= b 0.0)
         t_1
         (*
          (/ (+ c c) (fma b b (* c (* a 4.0))))
          (- b (sqrt (* c (* a -4.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 = -b - b;
	double t_1 = t_0 / (2.0 * a);
	double t_2 = sqrt(fma(b, b, (-4.0 * (a * c))));
	double tmp_1;
	if (b <= -7.755909129690683e+98) {
		double tmp_2;
		if (b >= 0.0) {
			tmp_2 = t_1;
		} else {
			tmp_2 = (2.0 * c) / t_0;
		}
		tmp_1 = tmp_2;
	} else if (b <= 3.4e+115) {
		double tmp_3;
		if (b >= 0.0) {
			tmp_3 = -0.5 * ((b + t_2) / a);
		} else {
			tmp_3 = -2.0 * (c / (b - t_2));
		}
		tmp_1 = tmp_3;
	} else if (b >= 0.0) {
		tmp_1 = t_1;
	} else {
		tmp_1 = ((c + c) / fma(b, b, (c * (a * 4.0)))) * (b - sqrt((c * (a * -4.0))));
	}
	return tmp_1;
}
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(Float64(-b) - b)
	t_1 = Float64(t_0 / Float64(2.0 * a))
	t_2 = sqrt(fma(b, b, Float64(-4.0 * Float64(a * c))))
	tmp_1 = 0.0
	if (b <= -7.755909129690683e+98)
		tmp_2 = 0.0
		if (b >= 0.0)
			tmp_2 = t_1;
		else
			tmp_2 = Float64(Float64(2.0 * c) / t_0);
		end
		tmp_1 = tmp_2;
	elseif (b <= 3.4e+115)
		tmp_3 = 0.0
		if (b >= 0.0)
			tmp_3 = Float64(-0.5 * Float64(Float64(b + t_2) / a));
		else
			tmp_3 = Float64(-2.0 * Float64(c / Float64(b - t_2)));
		end
		tmp_1 = tmp_3;
	elseif (b >= 0.0)
		tmp_1 = t_1;
	else
		tmp_1 = Float64(Float64(Float64(c + c) / fma(b, b, Float64(c * Float64(a * 4.0)))) * Float64(b - sqrt(Float64(c * Float64(a * -4.0)))));
	end
	return tmp_1
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[((-b) - b), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(b * b + N[(-4.0 * N[(a * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[b, -7.755909129690683e+98], If[GreaterEqual[b, 0.0], t$95$1, N[(N[(2.0 * c), $MachinePrecision] / t$95$0), $MachinePrecision]], If[LessEqual[b, 3.4e+115], If[GreaterEqual[b, 0.0], N[(-0.5 * N[(N[(b + t$95$2), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(-2.0 * N[(c / N[(b - t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], If[GreaterEqual[b, 0.0], t$95$1, N[(N[(N[(c + c), $MachinePrecision] / N[(b * b + N[(c * N[(a * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(b - N[Sqrt[N[(c * N[(a * -4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $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 := \left(-b\right) - b\\
t_1 := \frac{t_0}{2 \cdot a}\\
t_2 := \sqrt{\mathsf{fma}\left(b, b, -4 \cdot \left(a \cdot c\right)\right)}\\
\mathbf{if}\;b \leq -7.755909129690683 \cdot 10^{+98}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;t_1\\

\mathbf{else}:\\
\;\;\;\;\frac{2 \cdot c}{t_0}\\


\end{array}\\

\mathbf{elif}\;b \leq 3.4 \cdot 10^{+115}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;-0.5 \cdot \frac{b + t_2}{a}\\

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


\end{array}\\

\mathbf{elif}\;b \geq 0:\\
\;\;\;\;t_1\\

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


\end{array}

Error

Derivation

  1. Split input into 3 regimes
  2. if b < -7.7559091296906829e98

    1. Initial program 30.2

      \[\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 30.2

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{\left(-b\right) - \color{blue}{b}}{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} \]
    3. Taylor expanded in b around -inf 3.0

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

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

    if -7.7559091296906829e98 < b < 3.4000000000000001e115

    1. Initial program 9.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. Simplified9.0

      \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \frac{b + \sqrt{\mathsf{fma}\left(b, b, \left(a \cdot c\right) \cdot -4\right)}}{a}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{c}{b - \sqrt{\mathsf{fma}\left(b, b, \left(a \cdot c\right) \cdot -4\right)}}\\ } \end{array}} \]
      Proof
      (if (>=.f64 b 0) (*.f64 -1/2 (/.f64 (+.f64 b (sqrt.f64 (fma.f64 b b (*.f64 (*.f64 a c) -4)))) a)) (*.f64 -2 (/.f64 c (-.f64 b (sqrt.f64 (fma.f64 b b (*.f64 (*.f64 a c) -4))))))): 0 points increase in error, 0 points decrease in error
      (if (>=.f64 b 0) (*.f64 (Rewrite<= metadata-eval (/.f64 -1 2)) (/.f64 (+.f64 b (sqrt.f64 (fma.f64 b b (*.f64 (*.f64 a c) -4)))) a)) (*.f64 -2 (/.f64 c (-.f64 b (sqrt.f64 (fma.f64 b b (*.f64 (*.f64 a c) -4))))))): 0 points increase in error, 0 points decrease in error
      (if (>=.f64 b 0) (*.f64 (/.f64 -1 2) (/.f64 (+.f64 b (sqrt.f64 (fma.f64 b b (*.f64 (*.f64 a c) (Rewrite<= metadata-eval (neg.f64 4)))))) a)) (*.f64 -2 (/.f64 c (-.f64 b (sqrt.f64 (fma.f64 b b (*.f64 (*.f64 a c) -4))))))): 0 points increase in error, 0 points decrease in error
      (if (>=.f64 b 0) (*.f64 (/.f64 -1 2) (/.f64 (+.f64 b (sqrt.f64 (fma.f64 b b (Rewrite<= distribute-rgt-neg-in_binary64 (neg.f64 (*.f64 (*.f64 a c) 4)))))) a)) (*.f64 -2 (/.f64 c (-.f64 b (sqrt.f64 (fma.f64 b b (*.f64 (*.f64 a c) -4))))))): 0 points increase in error, 0 points decrease in error
      (if (>=.f64 b 0) (*.f64 (/.f64 -1 2) (/.f64 (+.f64 b (sqrt.f64 (fma.f64 b b (neg.f64 (Rewrite<= *-commutative_binary64 (*.f64 4 (*.f64 a c))))))) a)) (*.f64 -2 (/.f64 c (-.f64 b (sqrt.f64 (fma.f64 b b (*.f64 (*.f64 a c) -4))))))): 0 points increase in error, 0 points decrease in error
      (if (>=.f64 b 0) (*.f64 (/.f64 -1 2) (/.f64 (+.f64 b (sqrt.f64 (fma.f64 b b (neg.f64 (Rewrite<= associate-*l*_binary64 (*.f64 (*.f64 4 a) c)))))) a)) (*.f64 -2 (/.f64 c (-.f64 b (sqrt.f64 (fma.f64 b b (*.f64 (*.f64 a c) -4))))))): 1 points increase in error, 2 points decrease in error
      (if (>=.f64 b 0) (*.f64 (/.f64 -1 2) (/.f64 (+.f64 b (sqrt.f64 (Rewrite<= fma-neg_binary64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c))))) a)) (*.f64 -2 (/.f64 c (-.f64 b (sqrt.f64 (fma.f64 b b (*.f64 (*.f64 a c) -4))))))): 0 points increase in error, 0 points decrease in error
      (if (>=.f64 b 0) (*.f64 (/.f64 -1 2) (/.f64 (+.f64 b (Rewrite<= remove-double-neg_binary64 (neg.f64 (neg.f64 (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c))))))) a)) (*.f64 -2 (/.f64 c (-.f64 b (sqrt.f64 (fma.f64 b b (*.f64 (*.f64 a c) -4))))))): 0 points increase in error, 0 points decrease in error
      (if (>=.f64 b 0) (*.f64 (/.f64 -1 2) (/.f64 (Rewrite<= sub-neg_binary64 (-.f64 b (neg.f64 (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))))) a)) (*.f64 -2 (/.f64 c (-.f64 b (sqrt.f64 (fma.f64 b b (*.f64 (*.f64 a c) -4))))))): 0 points increase in error, 0 points decrease in error
      (if (>=.f64 b 0) (*.f64 (/.f64 -1 2) (Rewrite=> div-sub_binary64 (-.f64 (/.f64 b a) (/.f64 (neg.f64 (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))) a)))) (*.f64 -2 (/.f64 c (-.f64 b (sqrt.f64 (fma.f64 b b (*.f64 (*.f64 a c) -4))))))): 1 points increase in error, 0 points decrease in error
      (if (>=.f64 b 0) (*.f64 (/.f64 -1 2) (-.f64 (/.f64 b a) (Rewrite<= distribute-neg-frac_binary64 (neg.f64 (/.f64 (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c))) a))))) (*.f64 -2 (/.f64 c (-.f64 b (sqrt.f64 (fma.f64 b b (*.f64 (*.f64 a c) -4))))))): 0 points increase in error, 0 points decrease in error
      (if (>=.f64 b 0) (*.f64 (/.f64 -1 2) (Rewrite=> sub-neg_binary64 (+.f64 (/.f64 b a) (neg.f64 (neg.f64 (/.f64 (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c))) a)))))) (*.f64 -2 (/.f64 c (-.f64 b (sqrt.f64 (fma.f64 b b (*.f64 (*.f64 a c) -4))))))): 0 points increase in error, 0 points decrease in error
      (if (>=.f64 b 0) (*.f64 (/.f64 -1 2) (+.f64 (/.f64 b a) (Rewrite=> remove-double-neg_binary64 (/.f64 (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c))) a)))) (*.f64 -2 (/.f64 c (-.f64 b (sqrt.f64 (fma.f64 b b (*.f64 (*.f64 a c) -4))))))): 0 points increase in error, 0 points decrease in error
      (if (>=.f64 b 0) (*.f64 (/.f64 -1 2) (Rewrite=> +-commutative_binary64 (+.f64 (/.f64 (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c))) a) (/.f64 b a)))) (*.f64 -2 (/.f64 c (-.f64 b (sqrt.f64 (fma.f64 b b (*.f64 (*.f64 a c) -4))))))): 0 points increase in error, 0 points decrease in error
      (if (>=.f64 b 0) (*.f64 (/.f64 -1 2) (+.f64 (/.f64 (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c))) a) (/.f64 (Rewrite<= remove-double-neg_binary64 (neg.f64 (neg.f64 b))) a))) (*.f64 -2 (/.f64 c (-.f64 b (sqrt.f64 (fma.f64 b b (*.f64 (*.f64 a c) -4))))))): 0 points increase in error, 0 points decrease in error
      (if (>=.f64 b 0) (*.f64 (/.f64 -1 2) (+.f64 (/.f64 (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c))) a) (Rewrite=> distribute-frac-neg_binary64 (neg.f64 (/.f64 (neg.f64 b) a))))) (*.f64 -2 (/.f64 c (-.f64 b (sqrt.f64 (fma.f64 b b (*.f64 (*.f64 a c) -4))))))): 0 points increase in error, 0 points decrease in error
      (if (>=.f64 b 0) (*.f64 (/.f64 -1 2) (Rewrite<= sub-neg_binary64 (-.f64 (/.f64 (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c))) a) (/.f64 (neg.f64 b) a)))) (*.f64 -2 (/.f64 c (-.f64 b (sqrt.f64 (fma.f64 b b (*.f64 (*.f64 a c) -4))))))): 0 points increase in error, 0 points decrease in error
      (if (>=.f64 b 0) (Rewrite<= distribute-lft-out--_binary64 (-.f64 (*.f64 (/.f64 -1 2) (/.f64 (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c))) a)) (*.f64 (/.f64 -1 2) (/.f64 (neg.f64 b) a)))) (*.f64 -2 (/.f64 c (-.f64 b (sqrt.f64 (fma.f64 b b (*.f64 (*.f64 a c) -4))))))): 0 points increase in error, 1 points decrease in error
      (if (>=.f64 b 0) (-.f64 (*.f64 (/.f64 -1 2) (/.f64 (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c))) a)) (Rewrite<= times-frac_binary64 (/.f64 (*.f64 -1 (neg.f64 b)) (*.f64 2 a)))) (*.f64 -2 (/.f64 c (-.f64 b (sqrt.f64 (fma.f64 b b (*.f64 (*.f64 a c) -4))))))): 0 points increase in error, 0 points decrease in error
      (if (>=.f64 b 0) (-.f64 (*.f64 (/.f64 -1 2) (/.f64 (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c))) a)) (/.f64 (Rewrite<= neg-mul-1_binary64 (neg.f64 (neg.f64 b))) (*.f64 2 a))) (*.f64 -2 (/.f64 c (-.f64 b (sqrt.f64 (fma.f64 b b (*.f64 (*.f64 a c) -4))))))): 0 points increase in error, 0 points decrease in error
      (if (>=.f64 b 0) (-.f64 (*.f64 (/.f64 -1 2) (/.f64 (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c))) a)) (/.f64 (Rewrite=> remove-double-neg_binary64 b) (*.f64 2 a))) (*.f64 -2 (/.f64 c (-.f64 b (sqrt.f64 (fma.f64 b b (*.f64 (*.f64 a c) -4))))))): 0 points increase in error, 0 points decrease in error
      (if (>=.f64 b 0) (-.f64 (Rewrite<= times-frac_binary64 (/.f64 (*.f64 -1 (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))) (*.f64 2 a))) (/.f64 b (*.f64 2 a))) (*.f64 -2 (/.f64 c (-.f64 b (sqrt.f64 (fma.f64 b b (*.f64 (*.f64 a c) -4))))))): 0 points increase in error, 0 points decrease in error
      (if (>=.f64 b 0) (-.f64 (/.f64 (Rewrite<= neg-mul-1_binary64 (neg.f64 (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c))))) (*.f64 2 a)) (/.f64 b (*.f64 2 a))) (*.f64 -2 (/.f64 c (-.f64 b (sqrt.f64 (fma.f64 b b (*.f64 (*.f64 a c) -4))))))): 0 points increase in error, 0 points decrease in error
      (if (>=.f64 b 0) (Rewrite<= div-sub_binary64 (/.f64 (-.f64 (neg.f64 (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))) b) (*.f64 2 a))) (*.f64 -2 (/.f64 c (-.f64 b (sqrt.f64 (fma.f64 b b (*.f64 (*.f64 a c) -4))))))): 0 points increase in error, 1 points decrease in error
      (if (>=.f64 b 0) (/.f64 (Rewrite<= unsub-neg_binary64 (+.f64 (neg.f64 (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))) (neg.f64 b))) (*.f64 2 a)) (*.f64 -2 (/.f64 c (-.f64 b (sqrt.f64 (fma.f64 b b (*.f64 (*.f64 a c) -4))))))): 0 points increase in error, 0 points decrease in error
      (if (>=.f64 b 0) (/.f64 (Rewrite<= +-commutative_binary64 (+.f64 (neg.f64 b) (neg.f64 (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))))) (*.f64 2 a)) (*.f64 -2 (/.f64 c (-.f64 b (sqrt.f64 (fma.f64 b b (*.f64 (*.f64 a c) -4))))))): 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 -2 (/.f64 c (-.f64 b (sqrt.f64 (fma.f64 b b (*.f64 (*.f64 a c) -4))))))): 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<= metadata-eval (/.f64 2 -1)) (/.f64 c (-.f64 b (sqrt.f64 (fma.f64 b b (*.f64 (*.f64 a c) -4))))))): 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 -1) (/.f64 (Rewrite<= /-rgt-identity_binary64 (/.f64 c 1)) (-.f64 b (sqrt.f64 (fma.f64 b b (*.f64 (*.f64 a c) -4))))))): 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 -1) (/.f64 (/.f64 c (Rewrite<= metadata-eval (*.f64 -1 -1))) (-.f64 b (sqrt.f64 (fma.f64 b b (*.f64 (*.f64 a c) -4))))))): 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 -1) (/.f64 (Rewrite<= associate-/l/_binary64 (/.f64 (/.f64 c -1) -1)) (-.f64 b (sqrt.f64 (fma.f64 b b (*.f64 (*.f64 a c) -4))))))): 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 -1) (/.f64 (/.f64 (/.f64 c -1) -1) (-.f64 b (sqrt.f64 (fma.f64 b b (*.f64 (*.f64 a c) (Rewrite<= metadata-eval (neg.f64 4))))))))): 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 -1) (/.f64 (/.f64 (/.f64 c -1) -1) (-.f64 b (sqrt.f64 (fma.f64 b b (Rewrite<= distribute-rgt-neg-in_binary64 (neg.f64 (*.f64 (*.f64 a c) 4))))))))): 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 -1) (/.f64 (/.f64 (/.f64 c -1) -1) (-.f64 b (sqrt.f64 (fma.f64 b b (neg.f64 (Rewrite<= *-commutative_binary64 (*.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 -1) (/.f64 (/.f64 (/.f64 c -1) -1) (-.f64 b (sqrt.f64 (fma.f64 b b (neg.f64 (Rewrite<= associate-*l*_binary64 (*.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)) (*.f64 (/.f64 2 -1) (/.f64 (/.f64 (/.f64 c -1) -1) (-.f64 b (sqrt.f64 (Rewrite<= fma-neg_binary64 (-.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)) (*.f64 (/.f64 2 -1) (Rewrite=> associate-/l/_binary64 (/.f64 (/.f64 c -1) (*.f64 (-.f64 b (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))) -1))))): 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 -1) (/.f64 (/.f64 c -1) (Rewrite<= *-commutative_binary64 (*.f64 -1 (-.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)) (*.f64 (/.f64 2 -1) (/.f64 (/.f64 c -1) (Rewrite<= neg-mul-1_binary64 (neg.f64 (-.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)) (*.f64 (/.f64 2 -1) (/.f64 (/.f64 c -1) (Rewrite<= sub0-neg_binary64 (-.f64 0 (-.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)) (*.f64 (/.f64 2 -1) (/.f64 (/.f64 c -1) (Rewrite<= associate-+l-_binary64 (+.f64 (-.f64 0 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)) (*.f64 (/.f64 2 -1) (/.f64 (/.f64 c -1) (+.f64 (Rewrite<= neg-sub0_binary64 (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<= times-frac_binary64 (/.f64 (*.f64 2 (/.f64 c -1)) (*.f64 -1 (+.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)) (/.f64 (Rewrite=> associate-*r/_binary64 (/.f64 (*.f64 2 c) -1)) (*.f64 -1 (+.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)) (/.f64 (Rewrite=> associate-/l*_binary64 (/.f64 2 (/.f64 -1 c))) (*.f64 -1 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c))))))): 12 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 (Rewrite=> associate-/r/_binary64 (*.f64 (/.f64 2 -1) c)) (*.f64 -1 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c))))))): 1 points increase in error, 12 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=> times-frac_binary64 (*.f64 (/.f64 (/.f64 2 -1) -1) (/.f64 c (+.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)) (*.f64 (/.f64 (Rewrite=> metadata-eval -2) -1) (/.f64 c (+.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)) (*.f64 (Rewrite=> metadata-eval 2) (/.f64 c (+.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=> associate-*r/_binary64 (/.f64 (*.f64 2 c) (+.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 3.4000000000000001e115 < b

    1. Initial program 51.7

      \[\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 2.9

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{\left(-b\right) - \color{blue}{b}}{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} \]
    3. Taylor expanded in b around 0 2.9

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

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{\left(-b\right) - b}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c + c}{\mathsf{fma}\left(b, b, \left(-c\right) \cdot \left(a \cdot -4\right)\right)} \cdot \left(b - \sqrt{c \cdot \left(a \cdot -4\right)}\right)\\ \end{array} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification6.7

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

Alternatives

Alternative 1
Error7.1
Cost44260
\[\begin{array}{l} t_0 := \left(-b\right) - b\\ t_1 := \sqrt{c \cdot \left(a \cdot -4\right) + b \cdot b}\\ t_2 := \frac{\left(-b\right) - t_1}{2 \cdot a}\\ t_3 := \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot c}{t_1 - b}\\ \end{array}\\ t_4 := \frac{t_0}{2 \cdot a}\\ \mathbf{if}\;t_3 \leq -\infty:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;t_4\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot c}{-b}\\ \end{array}\\ \mathbf{elif}\;t_3 \leq -4 \cdot 10^{-168}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;t_3 \leq 0:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot c}{\left(\left(2 \cdot a\right) \cdot \frac{c}{b} - b\right) - b}\\ \end{array}\\ \mathbf{elif}\;t_3 \leq 2 \cdot 10^{+268}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \frac{b + \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}}{a}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{c}{b - \sqrt{\mathsf{fma}\left(b, b, -4 \cdot \left(a \cdot c\right)\right)}}\\ \end{array}\\ \mathbf{elif}\;b \geq 0:\\ \;\;\;\;t_4\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot c}{t_0}\\ \end{array} \]
Alternative 2
Error7.1
Cost38052
\[\begin{array}{l} t_0 := \left(-b\right) - b\\ t_1 := \sqrt{c \cdot \left(a \cdot -4\right) + b \cdot b}\\ t_2 := \frac{\left(-b\right) - t_1}{2 \cdot a}\\ t_3 := \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot c}{t_1 - b}\\ \end{array}\\ t_4 := \frac{t_0}{2 \cdot a}\\ \mathbf{if}\;t_3 \leq -\infty:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;t_4\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot c}{-b}\\ \end{array}\\ \mathbf{elif}\;t_3 \leq -4 \cdot 10^{-168}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;t_3 \leq 0:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot c}{\left(\left(2 \cdot a\right) \cdot \frac{c}{b} - b\right) - b}\\ \end{array}\\ \mathbf{elif}\;t_3 \leq 2 \cdot 10^{+268}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;b \geq 0:\\ \;\;\;\;t_4\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot c}{t_0}\\ \end{array} \]
Alternative 3
Error6.7
Cost14028
\[\begin{array}{l} t_0 := \left(-b\right) - b\\ t_1 := \frac{t_0}{2 \cdot a}\\ t_2 := \sqrt{\mathsf{fma}\left(b, b, -4 \cdot \left(a \cdot c\right)\right)}\\ \mathbf{if}\;b \leq -7.755909129690683 \cdot 10^{+98}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot c}{t_0}\\ \end{array}\\ \mathbf{elif}\;b \leq 3.4 \cdot 10^{+115}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-0.5 \cdot \frac{b + t_2}{a}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{c}{b - t_2}\\ \end{array}\\ \mathbf{elif}\;b \geq 0:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot c}{-b}\\ \end{array} \]
Alternative 4
Error10.7
Cost7952
\[\begin{array}{l} t_0 := \left(-b\right) - b\\ t_1 := \frac{2 \cdot c}{t_0}\\ t_2 := \frac{t_0}{2 \cdot a}\\ t_3 := c \cdot \left(a \cdot -4\right)\\ \mathbf{if}\;b \leq -6.2 \cdot 10^{-28}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array}\\ \mathbf{elif}\;b \leq 2.9 \cdot 10^{-295}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot c}{\sqrt{t_3} - b}\\ \end{array}\\ \mathbf{elif}\;b \leq 3.4 \cdot 10^{+115}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{\left(-b\right) - \sqrt{t_3 + b \cdot b}}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array}\\ \mathbf{elif}\;b \geq 0:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot c}{-b}\\ \end{array} \]
Alternative 5
Error7.1
Cost7952
\[\begin{array}{l} t_0 := \sqrt{c \cdot \left(a \cdot -4\right) + b \cdot b}\\ t_1 := \left(-b\right) - b\\ t_2 := \frac{2 \cdot c}{t_1}\\ t_3 := \frac{t_1}{2 \cdot a}\\ \mathbf{if}\;b \leq -7.755909129690683 \cdot 10^{+98}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;t_3\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array}\\ \mathbf{elif}\;b \leq 2.9 \cdot 10^{-295}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;t_3\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot c}{t_0 - b}\\ \end{array}\\ \mathbf{elif}\;b \leq 3.4 \cdot 10^{+115}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{\left(-b\right) - t_0}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array}\\ \mathbf{elif}\;b \geq 0:\\ \;\;\;\;t_3\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot c}{-b}\\ \end{array} \]
Alternative 6
Error6.7
Cost7952
\[\begin{array}{l} t_0 := \left(-b\right) - b\\ t_1 := \frac{2 \cdot c}{t_0}\\ t_2 := \frac{t_0}{2 \cdot a}\\ t_3 := \sqrt{c \cdot \left(a \cdot -4\right) + b \cdot b}\\ \mathbf{if}\;b \leq -7.755909129690683 \cdot 10^{+98}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array}\\ \mathbf{elif}\;b \leq 10^{-180}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{\left(-b\right) - \sqrt{-4 \cdot \left(a \cdot c\right)}}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot c}{t_3 - b}\\ \end{array}\\ \mathbf{elif}\;b \leq 3.4 \cdot 10^{+115}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{\left(-b\right) - t_3}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array}\\ \mathbf{elif}\;b \geq 0:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot c}{-b}\\ \end{array} \]
Alternative 7
Error17.9
Cost7368
\[\begin{array}{l} t_0 := \left(-b\right) - b\\ t_1 := \frac{t_0}{2 \cdot a}\\ \mathbf{if}\;b \leq -6.2 \cdot 10^{-28}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot c}{t_0}\\ \end{array}\\ \mathbf{elif}\;b \geq 0:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot c}{\sqrt{c \cdot \left(a \cdot -4\right)} - b}\\ \end{array} \]
Alternative 8
Error22.2
Cost1092
\[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{\left(-b\right) - b}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot c}{\left(\left(2 \cdot a\right) \cdot \frac{c}{b} - b\right) - b}\\ \end{array} \]
Alternative 9
Error36.7
Cost644
\[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{\left(-b\right) - b}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot c}{-b}\\ \end{array} \]
Alternative 10
Error22.5
Cost644
\[\begin{array}{l} t_0 := \left(-b\right) - b\\ \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{t_0}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot c}{t_0}\\ \end{array} \]

Error

Reproduce

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