Average Error: 20.0 → 7.2
Time: 27.1s
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 := -1 \cdot \frac{b}{a}\\ t_1 := \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\\ t_2 := \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{\left(-b\right) - t_1}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) + t_1}\\ \end{array}\\ t_3 := \frac{\left(-b\right) - b}{2 \cdot a}\\ \mathbf{if}\;t_2 \leq -\infty:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;t_3\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array}\\ \mathbf{elif}\;t_2 \leq -5 \cdot 10^{-265}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t_2 \leq 0:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{c}{b} + t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) + -1 \cdot b}\\ \end{array}\\ \mathbf{elif}\;t_2 \leq 2 \cdot 10^{+240}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;b \geq 0:\\ \;\;\;\;t_3\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot c}{-2 \cdot 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 (* -1.0 (/ b a)))
        (t_1 (sqrt (- (* b b) (* (* 4.0 a) c))))
        (t_2
         (if (>= b 0.0)
           (/ (- (- b) t_1) (* 2.0 a))
           (/ (* 2.0 c) (+ (- b) t_1))))
        (t_3 (/ (- (- b) b) (* 2.0 a))))
   (if (<= t_2 (- INFINITY))
     (if (>= b 0.0) t_3 t_0)
     (if (<= t_2 -5e-265)
       t_2
       (if (<= t_2 0.0)
         (if (>= b 0.0) (+ (/ c b) t_0) (/ (* 2.0 c) (+ (- b) (* -1.0 b))))
         (if (<= t_2 2e+240)
           t_2
           (if (>= b 0.0) t_3 (/ (* 2.0 c) (* -2.0 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 = -1.0 * (b / a);
	double t_1 = sqrt(((b * b) - ((4.0 * a) * c)));
	double tmp;
	if (b >= 0.0) {
		tmp = (-b - t_1) / (2.0 * a);
	} else {
		tmp = (2.0 * c) / (-b + t_1);
	}
	double t_2 = tmp;
	double t_3 = (-b - b) / (2.0 * a);
	double tmp_2;
	if (t_2 <= -((double) INFINITY)) {
		double tmp_3;
		if (b >= 0.0) {
			tmp_3 = t_3;
		} else {
			tmp_3 = t_0;
		}
		tmp_2 = tmp_3;
	} else if (t_2 <= -5e-265) {
		tmp_2 = t_2;
	} else if (t_2 <= 0.0) {
		double tmp_4;
		if (b >= 0.0) {
			tmp_4 = (c / b) + t_0;
		} else {
			tmp_4 = (2.0 * c) / (-b + (-1.0 * b));
		}
		tmp_2 = tmp_4;
	} else if (t_2 <= 2e+240) {
		tmp_2 = t_2;
	} else if (b >= 0.0) {
		tmp_2 = t_3;
	} else {
		tmp_2 = (2.0 * c) / (-2.0 * b);
	}
	return tmp_2;
}
public static double code(double a, double b, double c) {
	double tmp;
	if (b >= 0.0) {
		tmp = (-b - Math.sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a);
	} else {
		tmp = (2.0 * c) / (-b + Math.sqrt(((b * b) - ((4.0 * a) * c))));
	}
	return tmp;
}
public static double code(double a, double b, double c) {
	double t_0 = -1.0 * (b / a);
	double t_1 = Math.sqrt(((b * b) - ((4.0 * a) * c)));
	double tmp;
	if (b >= 0.0) {
		tmp = (-b - t_1) / (2.0 * a);
	} else {
		tmp = (2.0 * c) / (-b + t_1);
	}
	double t_2 = tmp;
	double t_3 = (-b - b) / (2.0 * a);
	double tmp_2;
	if (t_2 <= -Double.POSITIVE_INFINITY) {
		double tmp_3;
		if (b >= 0.0) {
			tmp_3 = t_3;
		} else {
			tmp_3 = t_0;
		}
		tmp_2 = tmp_3;
	} else if (t_2 <= -5e-265) {
		tmp_2 = t_2;
	} else if (t_2 <= 0.0) {
		double tmp_4;
		if (b >= 0.0) {
			tmp_4 = (c / b) + t_0;
		} else {
			tmp_4 = (2.0 * c) / (-b + (-1.0 * b));
		}
		tmp_2 = tmp_4;
	} else if (t_2 <= 2e+240) {
		tmp_2 = t_2;
	} else if (b >= 0.0) {
		tmp_2 = t_3;
	} else {
		tmp_2 = (2.0 * c) / (-2.0 * b);
	}
	return tmp_2;
}
def code(a, b, c):
	tmp = 0
	if b >= 0.0:
		tmp = (-b - math.sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a)
	else:
		tmp = (2.0 * c) / (-b + math.sqrt(((b * b) - ((4.0 * a) * c))))
	return tmp
def code(a, b, c):
	t_0 = -1.0 * (b / a)
	t_1 = math.sqrt(((b * b) - ((4.0 * a) * c)))
	tmp = 0
	if b >= 0.0:
		tmp = (-b - t_1) / (2.0 * a)
	else:
		tmp = (2.0 * c) / (-b + t_1)
	t_2 = tmp
	t_3 = (-b - b) / (2.0 * a)
	tmp_2 = 0
	if t_2 <= -math.inf:
		tmp_3 = 0
		if b >= 0.0:
			tmp_3 = t_3
		else:
			tmp_3 = t_0
		tmp_2 = tmp_3
	elif t_2 <= -5e-265:
		tmp_2 = t_2
	elif t_2 <= 0.0:
		tmp_4 = 0
		if b >= 0.0:
			tmp_4 = (c / b) + t_0
		else:
			tmp_4 = (2.0 * c) / (-b + (-1.0 * b))
		tmp_2 = tmp_4
	elif t_2 <= 2e+240:
		tmp_2 = t_2
	elif b >= 0.0:
		tmp_2 = t_3
	else:
		tmp_2 = (2.0 * c) / (-2.0 * 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 = Float64(-1.0 * Float64(b / a))
	t_1 = sqrt(Float64(Float64(b * b) - Float64(Float64(4.0 * a) * c)))
	tmp = 0.0
	if (b >= 0.0)
		tmp = Float64(Float64(Float64(-b) - t_1) / Float64(2.0 * a));
	else
		tmp = Float64(Float64(2.0 * c) / Float64(Float64(-b) + t_1));
	end
	t_2 = tmp
	t_3 = Float64(Float64(Float64(-b) - b) / Float64(2.0 * a))
	tmp_2 = 0.0
	if (t_2 <= Float64(-Inf))
		tmp_3 = 0.0
		if (b >= 0.0)
			tmp_3 = t_3;
		else
			tmp_3 = t_0;
		end
		tmp_2 = tmp_3;
	elseif (t_2 <= -5e-265)
		tmp_2 = t_2;
	elseif (t_2 <= 0.0)
		tmp_4 = 0.0
		if (b >= 0.0)
			tmp_4 = Float64(Float64(c / b) + t_0);
		else
			tmp_4 = Float64(Float64(2.0 * c) / Float64(Float64(-b) + Float64(-1.0 * b)));
		end
		tmp_2 = tmp_4;
	elseif (t_2 <= 2e+240)
		tmp_2 = t_2;
	elseif (b >= 0.0)
		tmp_2 = t_3;
	else
		tmp_2 = Float64(Float64(2.0 * c) / Float64(-2.0 * b));
	end
	return tmp_2
end
function tmp_2 = code(a, b, c)
	tmp = 0.0;
	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))));
	end
	tmp_2 = tmp;
end
function tmp_6 = code(a, b, c)
	t_0 = -1.0 * (b / a);
	t_1 = sqrt(((b * b) - ((4.0 * a) * c)));
	tmp = 0.0;
	if (b >= 0.0)
		tmp = (-b - t_1) / (2.0 * a);
	else
		tmp = (2.0 * c) / (-b + t_1);
	end
	t_2 = tmp;
	t_3 = (-b - b) / (2.0 * a);
	tmp_3 = 0.0;
	if (t_2 <= -Inf)
		tmp_4 = 0.0;
		if (b >= 0.0)
			tmp_4 = t_3;
		else
			tmp_4 = t_0;
		end
		tmp_3 = tmp_4;
	elseif (t_2 <= -5e-265)
		tmp_3 = t_2;
	elseif (t_2 <= 0.0)
		tmp_5 = 0.0;
		if (b >= 0.0)
			tmp_5 = (c / b) + t_0;
		else
			tmp_5 = (2.0 * c) / (-b + (-1.0 * b));
		end
		tmp_3 = tmp_5;
	elseif (t_2 <= 2e+240)
		tmp_3 = t_2;
	elseif (b >= 0.0)
		tmp_3 = t_3;
	else
		tmp_3 = (2.0 * c) / (-2.0 * b);
	end
	tmp_6 = tmp_3;
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[(-1.0 * N[(b / a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(4.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = If[GreaterEqual[b, 0.0], N[(N[((-b) - t$95$1), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 * c), $MachinePrecision] / N[((-b) + t$95$1), $MachinePrecision]), $MachinePrecision]]}, Block[{t$95$3 = N[(N[((-b) - b), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], If[GreaterEqual[b, 0.0], t$95$3, t$95$0], If[LessEqual[t$95$2, -5e-265], t$95$2, If[LessEqual[t$95$2, 0.0], If[GreaterEqual[b, 0.0], N[(N[(c / b), $MachinePrecision] + t$95$0), $MachinePrecision], N[(N[(2.0 * c), $MachinePrecision] / N[((-b) + N[(-1.0 * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], If[LessEqual[t$95$2, 2e+240], t$95$2, If[GreaterEqual[b, 0.0], t$95$3, N[(N[(2.0 * c), $MachinePrecision] / N[(-2.0 * b), $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 := -1 \cdot \frac{b}{a}\\
t_1 := \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\\
t_2 := \begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{\left(-b\right) - t_1}{2 \cdot a}\\

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


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

\mathbf{else}:\\
\;\;\;\;t_0\\


\end{array}\\

\mathbf{elif}\;t_2 \leq -5 \cdot 10^{-265}:\\
\;\;\;\;t_2\\

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

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


\end{array}\\

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

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

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


\end{array}

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

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. Taylor expanded in b around inf 18.5

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{\left(-b\right) - b}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;-1 \cdot \frac{b}{a}\\ \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)))))) < -5.0000000000000001e-265 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.00000000000000003e240

    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} \]

    if -5.0000000000000001e-265 < (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.8

      \[\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 11.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) + -1 \cdot b}}\\ \end{array} \]
    3. Taylor expanded in b around inf 11.2

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

    if 2.00000000000000003e240 < (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 52.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 17.7

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

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

Alternatives

Alternative 1
Error10.5
Cost7820
\[\begin{array}{l} t_0 := \frac{\left(-b\right) - b}{2 \cdot a}\\ t_1 := \frac{2 \cdot c}{\left(-b\right) + -1 \cdot b}\\ \mathbf{if}\;b \leq -5.2 \cdot 10^{+153}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot c}{-2 \cdot b}\\ \end{array}\\ \mathbf{elif}\;b \leq 4 \cdot 10^{-304}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \end{array}\\ \mathbf{elif}\;b \leq 1.2 \cdot 10^{-113}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{\frac{\sqrt{-4 \cdot \left(c \cdot a\right)}}{a}}{-2}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array}\\ \mathbf{elif}\;b \geq 0:\\ \;\;\;\;\frac{c}{b} + -1 \cdot \frac{b}{a}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 2
Error13.9
Cost7504
\[\begin{array}{l} t_0 := \frac{2 \cdot c}{\left(-b\right) + -1 \cdot b}\\ t_1 := \frac{\left(-b\right) - b}{2 \cdot a}\\ \mathbf{if}\;b \leq -1.5 \cdot 10^{-61}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot c}{-2 \cdot b}\\ \end{array}\\ \mathbf{elif}\;b \leq 4 \cdot 10^{-304}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{\sqrt{\left(-4 \cdot a\right) \cdot c} - b} \cdot c\\ \end{array}\\ \mathbf{elif}\;b \leq 4.2 \cdot 10^{-111}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{\frac{\sqrt{-4 \cdot \left(c \cdot a\right)}}{a}}{-2}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array}\\ \mathbf{elif}\;b \geq 0:\\ \;\;\;\;\frac{c}{b} + -1 \cdot \frac{b}{a}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 3
Error13.9
Cost7504
\[\begin{array}{l} t_0 := \frac{2 \cdot c}{\left(-b\right) + -1 \cdot b}\\ t_1 := \frac{\left(-b\right) - b}{2 \cdot a}\\ \mathbf{if}\;b \leq -8.5 \cdot 10^{-61}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot c}{-2 \cdot b}\\ \end{array}\\ \mathbf{elif}\;b \leq 4 \cdot 10^{-304}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot c}{\sqrt{\left(-4 \cdot a\right) \cdot c} - b}\\ \end{array}\\ \mathbf{elif}\;b \leq 3 \cdot 10^{-111}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{\frac{\sqrt{-4 \cdot \left(c \cdot a\right)}}{a}}{-2}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array}\\ \mathbf{elif}\;b \geq 0:\\ \;\;\;\;\frac{c}{b} + -1 \cdot \frac{b}{a}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 4
Error18.7
Cost7240
\[\begin{array}{l} t_0 := \frac{2 \cdot c}{\left(-b\right) + -1 \cdot b}\\ \mathbf{if}\;b \leq 3.5 \cdot 10^{-113}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{-0.5}{a} \cdot \sqrt{-4 \cdot \left(c \cdot a\right)}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array}\\ \mathbf{elif}\;b \geq 0:\\ \;\;\;\;\frac{c}{b} + -1 \cdot \frac{b}{a}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 5
Error18.7
Cost7240
\[\begin{array}{l} t_0 := \frac{2 \cdot c}{\left(-b\right) + -1 \cdot b}\\ \mathbf{if}\;b \leq 4 \cdot 10^{-113}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{\frac{\sqrt{-4 \cdot \left(c \cdot a\right)}}{a}}{-2}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array}\\ \mathbf{elif}\;b \geq 0:\\ \;\;\;\;\frac{c}{b} + -1 \cdot \frac{b}{a}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 6
Error23.0
Cost772
\[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{c}{b} + -1 \cdot \frac{b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) + -1 \cdot b}\\ \end{array} \]
Alternative 7
Error45.7
Cost644
\[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{\left(-b\right) - b}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;-1 \cdot \frac{b}{a}\\ \end{array} \]
Alternative 8
Error23.0
Cost644
\[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{\left(-b\right) - b}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot c}{-2 \cdot b}\\ \end{array} \]

Error

Reproduce

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