Average Error: 20.3 → 6.6
Time: 16.8s
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 := \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\\ t_1 := -\frac{b + t_0}{a \cdot 2}\\ t_2 := \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{t_0 - b}\\ \end{array}\\ t_3 := \frac{\left(-b\right) - b}{a \cdot 2}\\ \mathbf{if}\;t_2 \leq -\infty:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;t_3\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{-b}{c}}\\ \end{array}\\ \mathbf{elif}\;t_2 \leq -4 \cdot 10^{-284}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{\sqrt{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)} - b}\\ \end{array}\\ \mathbf{elif}\;t_2 \leq 0:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{c}{b}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{\left(\left(a \cdot 2\right) \cdot \frac{c}{b} - b\right) - b}\\ \end{array}\\ \mathbf{elif}\;t_2 \leq 5 \cdot 10^{+283}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;b \geq 0:\\ \;\;\;\;t_3\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \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 (sqrt (- (* b b) (* (* 4.0 a) c))))
        (t_1 (- (/ (+ b t_0) (* a 2.0))))
        (t_2 (if (>= b 0.0) t_1 (/ (* c 2.0) (- t_0 b))))
        (t_3 (/ (- (- b) b) (* a 2.0))))
   (if (<= t_2 (- INFINITY))
     (if (>= b 0.0) t_3 (/ 1.0 (/ (- b) c)))
     (if (<= t_2 -4e-284)
       (if (>= b 0.0)
         t_1
         (/
          (* c 2.0)
          (-
           (sqrt
            (+ (* b b) (fma c (* a -4.0) (fma c (* a -4.0) (* a (* 4.0 c))))))
           b)))
       (if (<= t_2 0.0)
         (if (>= b 0.0)
           (/ c b)
           (/ (* c 2.0) (- (- (* (* a 2.0) (/ c b)) b) b)))
         (if (<= t_2 5e+283) t_2 (if (>= b 0.0) t_3 (/ (- c) b))))))))
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 = sqrt(((b * b) - ((4.0 * a) * c)));
	double t_1 = -((b + t_0) / (a * 2.0));
	double tmp;
	if (b >= 0.0) {
		tmp = t_1;
	} else {
		tmp = (c * 2.0) / (t_0 - b);
	}
	double t_2 = tmp;
	double t_3 = (-b - b) / (a * 2.0);
	double tmp_2;
	if (t_2 <= -((double) INFINITY)) {
		double tmp_3;
		if (b >= 0.0) {
			tmp_3 = t_3;
		} else {
			tmp_3 = 1.0 / (-b / c);
		}
		tmp_2 = tmp_3;
	} else if (t_2 <= -4e-284) {
		double tmp_4;
		if (b >= 0.0) {
			tmp_4 = t_1;
		} else {
			tmp_4 = (c * 2.0) / (sqrt(((b * b) + fma(c, (a * -4.0), fma(c, (a * -4.0), (a * (4.0 * c)))))) - b);
		}
		tmp_2 = tmp_4;
	} else if (t_2 <= 0.0) {
		double tmp_5;
		if (b >= 0.0) {
			tmp_5 = c / b;
		} else {
			tmp_5 = (c * 2.0) / ((((a * 2.0) * (c / b)) - b) - b);
		}
		tmp_2 = tmp_5;
	} else if (t_2 <= 5e+283) {
		tmp_2 = t_2;
	} else if (b >= 0.0) {
		tmp_2 = t_3;
	} else {
		tmp_2 = -c / b;
	}
	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 = sqrt(Float64(Float64(b * b) - Float64(Float64(4.0 * a) * c)))
	t_1 = Float64(-Float64(Float64(b + t_0) / Float64(a * 2.0)))
	tmp = 0.0
	if (b >= 0.0)
		tmp = t_1;
	else
		tmp = Float64(Float64(c * 2.0) / Float64(t_0 - b));
	end
	t_2 = tmp
	t_3 = Float64(Float64(Float64(-b) - b) / Float64(a * 2.0))
	tmp_2 = 0.0
	if (t_2 <= Float64(-Inf))
		tmp_3 = 0.0
		if (b >= 0.0)
			tmp_3 = t_3;
		else
			tmp_3 = Float64(1.0 / Float64(Float64(-b) / c));
		end
		tmp_2 = tmp_3;
	elseif (t_2 <= -4e-284)
		tmp_4 = 0.0
		if (b >= 0.0)
			tmp_4 = t_1;
		else
			tmp_4 = Float64(Float64(c * 2.0) / Float64(sqrt(Float64(Float64(b * b) + fma(c, Float64(a * -4.0), fma(c, Float64(a * -4.0), Float64(a * Float64(4.0 * c)))))) - b));
		end
		tmp_2 = tmp_4;
	elseif (t_2 <= 0.0)
		tmp_5 = 0.0
		if (b >= 0.0)
			tmp_5 = Float64(c / b);
		else
			tmp_5 = Float64(Float64(c * 2.0) / Float64(Float64(Float64(Float64(a * 2.0) * Float64(c / b)) - b) - b));
		end
		tmp_2 = tmp_5;
	elseif (t_2 <= 5e+283)
		tmp_2 = t_2;
	elseif (b >= 0.0)
		tmp_2 = t_3;
	else
		tmp_2 = Float64(Float64(-c) / b);
	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[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(4.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = (-N[(N[(b + t$95$0), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision])}, Block[{t$95$2 = If[GreaterEqual[b, 0.0], t$95$1, N[(N[(c * 2.0), $MachinePrecision] / N[(t$95$0 - b), $MachinePrecision]), $MachinePrecision]]}, Block[{t$95$3 = N[(N[((-b) - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], If[GreaterEqual[b, 0.0], t$95$3, N[(1.0 / N[((-b) / c), $MachinePrecision]), $MachinePrecision]], If[LessEqual[t$95$2, -4e-284], If[GreaterEqual[b, 0.0], t$95$1, N[(N[(c * 2.0), $MachinePrecision] / N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] + N[(c * N[(a * -4.0), $MachinePrecision] + N[(c * N[(a * -4.0), $MachinePrecision] + N[(a * N[(4.0 * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision]], If[LessEqual[t$95$2, 0.0], If[GreaterEqual[b, 0.0], N[(c / b), $MachinePrecision], N[(N[(c * 2.0), $MachinePrecision] / N[(N[(N[(N[(a * 2.0), $MachinePrecision] * N[(c / b), $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision]], If[LessEqual[t$95$2, 5e+283], t$95$2, If[GreaterEqual[b, 0.0], t$95$3, N[((-c) / b), $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 := \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\\
t_1 := -\frac{b + t_0}{a \cdot 2}\\
t_2 := \begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;t_1\\

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


\end{array}\\
t_3 := \frac{\left(-b\right) - b}{a \cdot 2}\\
\mathbf{if}\;t_2 \leq -\infty:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;t_3\\

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


\end{array}\\

\mathbf{elif}\;t_2 \leq -4 \cdot 10^{-284}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;t_1\\

\mathbf{else}:\\
\;\;\;\;\frac{c \cdot 2}{\sqrt{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)} - b}\\


\end{array}\\

\mathbf{elif}\;t_2 \leq 0:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{c}{b}\\

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


\end{array}\\

\mathbf{elif}\;t_2 \leq 5 \cdot 10^{+283}:\\
\;\;\;\;t_2\\

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

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


\end{array}

Error

Derivation

  1. Split input into 5 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. Taylor expanded in b around inf 17.0

      \[\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. Applied egg-rr17.0

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{\left(-b\right) - b}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;{\left({\left(\frac{c \cdot -2}{b - \mathsf{hypot}\left(b, \sqrt{c \cdot \left(a \cdot -4\right)}\right)}\right)}^{3}\right)}^{0.3333333333333333}\\ \end{array} \]
    4. Taylor expanded in b around -inf 17.0

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{\left(-b\right) - b}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;{\left({\left(\frac{c \cdot -2}{2 \cdot b}\right)}^{3}\right)}^{0.3333333333333333}\\ \end{array} \]
    5. Applied egg-rr17.0

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

    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)))))) < -4.00000000000000015e-284

    1. Initial program 2.9

      \[\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. Applied egg-rr2.9

      \[\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}:\\ \;\;\;\;\frac{2 \cdot c}{\color{blue}{\left(-b\right)} + \sqrt{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)}}\\ \end{array} \]

    if -4.00000000000000015e-284 < (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 38.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 13.1

      \[\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}:\\ \;\;\;\;\frac{2 \cdot c}{\color{blue}{\left(-b\right) + \left(2 \cdot \frac{c \cdot a}{b} + -1 \cdot b\right)}}\\ \end{array} \]
    3. Simplified11.0

      \[\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}:\\ \;\;\;\;\frac{2 \cdot c}{\color{blue}{\left(-b\right) + \left(\frac{c}{b} \cdot \left(a \cdot 2\right) - b\right)}}\\ \end{array} \]
      Proof
      (-.f64 (*.f64 (/.f64 c b) (*.f64 a 2)) b): 0 points increase in error, 0 points decrease in error
      (-.f64 (Rewrite<= associate-*l*_binary64 (*.f64 (*.f64 (/.f64 c b) a) 2)) b): 0 points increase in error, 0 points decrease in error
      (-.f64 (*.f64 (Rewrite=> associate-*l/_binary64 (/.f64 (*.f64 c a) b)) 2) b): 26 points increase in error, 18 points decrease in error
      (-.f64 (Rewrite<= *-commutative_binary64 (*.f64 2 (/.f64 (*.f64 c a) b))) b): 0 points increase in error, 0 points decrease in error
      (Rewrite<= unsub-neg_binary64 (+.f64 (*.f64 2 (/.f64 (*.f64 c a) b)) (neg.f64 b))): 0 points increase in error, 0 points decrease in error
      (+.f64 (*.f64 2 (/.f64 (*.f64 c a) b)) (Rewrite<= mul-1-neg_binary64 (*.f64 -1 b))): 0 points increase in error, 0 points decrease in error
    4. Taylor expanded in b around inf 11.2

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

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

    if -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)))))) < 5.0000000000000004e283

    1. Initial program 2.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} \]

    if 5.0000000000000004e283 < (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 60.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 19.3

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-\frac{b + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} - b}\\ \end{array} \leq -\infty:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{\left(-b\right) - b}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{-b}{c}}\\ \end{array}\\ \mathbf{elif}\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-\frac{b + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} - b}\\ \end{array} \leq -4 \cdot 10^{-284}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-\frac{b + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{\sqrt{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)} - b}\\ \end{array}\\ \mathbf{elif}\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-\frac{b + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} - b}\\ \end{array} \leq 0:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{c}{b}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{\left(\left(a \cdot 2\right) \cdot \frac{c}{b} - b\right) - b}\\ \end{array}\\ \mathbf{elif}\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-\frac{b + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} - b}\\ \end{array} \leq 5 \cdot 10^{+283}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-\frac{b + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} - b}\\ \end{array}\\ \mathbf{elif}\;b \geq 0:\\ \;\;\;\;\frac{\left(-b\right) - b}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \]

Alternatives

Alternative 1
Error6.6
Cost38052
\[\begin{array}{l} t_0 := \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\\ t_1 := \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-\frac{b + t_0}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{t_0 - b}\\ \end{array}\\ t_2 := \frac{\left(-b\right) - b}{a \cdot 2}\\ \mathbf{if}\;t_1 \leq -\infty:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{-b}{c}}\\ \end{array}\\ \mathbf{elif}\;t_1 \leq -4 \cdot 10^{-284}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t_1 \leq 0:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{c}{b}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{\left(\left(a \cdot 2\right) \cdot \frac{c}{b} - b\right) - b}\\ \end{array}\\ \mathbf{elif}\;t_1 \leq 5 \cdot 10^{+283}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;b \geq 0:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \]
Alternative 2
Error10.2
Cost7952
\[\begin{array}{l} t_0 := \frac{\left(-b\right) - b}{a \cdot 2}\\ \mathbf{if}\;b \leq -4.8 \cdot 10^{-97}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot \frac{a \cdot c}{b} + b \cdot -2}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{\left(\frac{c}{\frac{b}{a + a}} - b\right) - b}\\ \end{array}\\ \mathbf{elif}\;b \leq -6.6 \cdot 10^{-294}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{\sqrt{c \cdot \left(a \cdot -4\right)} - b}\\ \end{array}\\ \mathbf{elif}\;b \leq 4.4 \cdot 10^{+119}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-\frac{b + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{b \cdot \left(-\sqrt[3]{-1}\right)}{a}\\ \end{array}\\ \mathbf{elif}\;b \geq 0:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{-b}{c}}\\ \end{array} \]
Alternative 3
Error7.0
Cost7952
\[\begin{array}{l} t_0 := \frac{\left(-b\right) - b}{a \cdot 2}\\ t_1 := \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\\ \mathbf{if}\;b \leq -6.7141644706807555 \cdot 10^{+131}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array}\\ \mathbf{elif}\;b \leq -6.6 \cdot 10^{-294}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{\mathsf{fma}\left(b, -2, \left(a \cdot 2\right) \cdot \frac{c}{b}\right)}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{t_1 - b}\\ \end{array}\\ \mathbf{elif}\;b \leq 4.4 \cdot 10^{+119}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-\frac{b + t_1}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{b \cdot \left(-\sqrt[3]{-1}\right)}{a}\\ \end{array}\\ \mathbf{elif}\;b \geq 0:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{-b}{c}}\\ \end{array} \]
Alternative 4
Error7.0
Cost7952
\[\begin{array}{l} t_0 := \left(-b\right) - b\\ t_1 := \frac{t_0}{a \cdot 2}\\ t_2 := \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\\ \mathbf{if}\;b \leq -6.7141644706807555 \cdot 10^{+131}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array}\\ \mathbf{elif}\;b \leq -6.6 \cdot 10^{-294}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{\mathsf{fma}\left(b, -2, \left(a \cdot 2\right) \cdot \frac{c}{b}\right)}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{t_2 - b}\\ \end{array}\\ \mathbf{elif}\;b \leq 4.4 \cdot 10^{+119}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-\frac{b + t_2}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{t_0}\\ \end{array}\\ \mathbf{elif}\;b \geq 0:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{-b}{c}}\\ \end{array} \]
Alternative 5
Error17.7
Cost7368
\[\begin{array}{l} \mathbf{if}\;b \leq -4.8 \cdot 10^{-97}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot \frac{a \cdot c}{b} + b \cdot -2}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{\left(\frac{c}{\frac{b}{a + a}} - b\right) - b}\\ \end{array}\\ \mathbf{elif}\;b \geq 0:\\ \;\;\;\;\frac{\left(-b\right) - b}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{\sqrt{c \cdot \left(a \cdot -4\right)} - b}\\ \end{array} \]
Alternative 6
Error22.3
Cost1220
\[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{b \cdot -2 + 2 \cdot \left(a \cdot \left(c \cdot \frac{1}{b}\right)\right)}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{\left(\left(a \cdot 2\right) \cdot \frac{c}{b} - b\right) - b}\\ \end{array} \]
Alternative 7
Error22.7
Cost644
\[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{\left(-b\right) - b}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{-b}{c}}\\ \end{array} \]
Alternative 8
Error22.5
Cost644
\[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{\left(-b\right) - b}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot \frac{-2}{b}}{2}\\ \end{array} \]
Alternative 9
Error22.4
Cost644
\[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{\left(-b\right) - b}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \]

Error

Reproduce

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