Average Error: 20.0 → 6.8
Time: 18.7s
Precision: binary64
Cost: 7952
\[\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 := \frac{\left(-b\right) - b}{a \cdot 2}\\ t_1 := \sqrt{b \cdot b + c \cdot \left(a \cdot -4\right)}\\ \mathbf{if}\;b \leq -1.5061884147831686 \cdot 10^{+150}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array}\\ \mathbf{elif}\;b \leq 1.12 \cdot 10^{-302}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{t_1 - b}\\ \end{array}\\ \mathbf{elif}\;b \leq 8.6 \cdot 10^{+122}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-\frac{b + t_1}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{a}\\ \end{array}\\ \mathbf{elif}\;b \geq 0:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{\left(a \cdot \frac{c \cdot 2}{b} - b\right) - 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 (/ (- (- b) b) (* a 2.0)))
        (t_1 (sqrt (+ (* b b) (* c (* a -4.0))))))
   (if (<= b -1.5061884147831686e+150)
     (if (>= b 0.0) t_0 (/ (- c) b))
     (if (<= b 1.12e-302)
       (if (>= b 0.0) t_0 (/ (* c 2.0) (- t_1 b)))
       (if (<= b 8.6e+122)
         (if (>= b 0.0) (- (/ (+ b t_1) (* a 2.0))) (/ b a))
         (if (>= b 0.0)
           (- (/ c b) (/ b a))
           (/ (* c 2.0) (- (- (* a (/ (* c 2.0) b)) b) 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 = (-b - b) / (a * 2.0);
	double t_1 = sqrt(((b * b) + (c * (a * -4.0))));
	double tmp_1;
	if (b <= -1.5061884147831686e+150) {
		double tmp_2;
		if (b >= 0.0) {
			tmp_2 = t_0;
		} else {
			tmp_2 = -c / b;
		}
		tmp_1 = tmp_2;
	} else if (b <= 1.12e-302) {
		double tmp_3;
		if (b >= 0.0) {
			tmp_3 = t_0;
		} else {
			tmp_3 = (c * 2.0) / (t_1 - b);
		}
		tmp_1 = tmp_3;
	} else if (b <= 8.6e+122) {
		double tmp_4;
		if (b >= 0.0) {
			tmp_4 = -((b + t_1) / (a * 2.0));
		} else {
			tmp_4 = b / a;
		}
		tmp_1 = tmp_4;
	} else if (b >= 0.0) {
		tmp_1 = (c / b) - (b / a);
	} else {
		tmp_1 = (c * 2.0) / (((a * ((c * 2.0) / b)) - b) - b);
	}
	return tmp_1;
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8) :: tmp
    if (b >= 0.0d0) then
        tmp = (-b - sqrt(((b * b) - ((4.0d0 * a) * c)))) / (2.0d0 * a)
    else
        tmp = (2.0d0 * c) / (-b + sqrt(((b * b) - ((4.0d0 * a) * c))))
    end if
    code = tmp
end function
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    real(8) :: tmp_1
    real(8) :: tmp_2
    real(8) :: tmp_3
    real(8) :: tmp_4
    t_0 = (-b - b) / (a * 2.0d0)
    t_1 = sqrt(((b * b) + (c * (a * (-4.0d0)))))
    if (b <= (-1.5061884147831686d+150)) then
        if (b >= 0.0d0) then
            tmp_2 = t_0
        else
            tmp_2 = -c / b
        end if
        tmp_1 = tmp_2
    else if (b <= 1.12d-302) then
        if (b >= 0.0d0) then
            tmp_3 = t_0
        else
            tmp_3 = (c * 2.0d0) / (t_1 - b)
        end if
        tmp_1 = tmp_3
    else if (b <= 8.6d+122) then
        if (b >= 0.0d0) then
            tmp_4 = -((b + t_1) / (a * 2.0d0))
        else
            tmp_4 = b / a
        end if
        tmp_1 = tmp_4
    else if (b >= 0.0d0) then
        tmp_1 = (c / b) - (b / a)
    else
        tmp_1 = (c * 2.0d0) / (((a * ((c * 2.0d0) / b)) - b) - b)
    end if
    code = tmp_1
end function
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 = (-b - b) / (a * 2.0);
	double t_1 = Math.sqrt(((b * b) + (c * (a * -4.0))));
	double tmp_1;
	if (b <= -1.5061884147831686e+150) {
		double tmp_2;
		if (b >= 0.0) {
			tmp_2 = t_0;
		} else {
			tmp_2 = -c / b;
		}
		tmp_1 = tmp_2;
	} else if (b <= 1.12e-302) {
		double tmp_3;
		if (b >= 0.0) {
			tmp_3 = t_0;
		} else {
			tmp_3 = (c * 2.0) / (t_1 - b);
		}
		tmp_1 = tmp_3;
	} else if (b <= 8.6e+122) {
		double tmp_4;
		if (b >= 0.0) {
			tmp_4 = -((b + t_1) / (a * 2.0));
		} else {
			tmp_4 = b / a;
		}
		tmp_1 = tmp_4;
	} else if (b >= 0.0) {
		tmp_1 = (c / b) - (b / a);
	} else {
		tmp_1 = (c * 2.0) / (((a * ((c * 2.0) / b)) - b) - b);
	}
	return tmp_1;
}
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 = (-b - b) / (a * 2.0)
	t_1 = math.sqrt(((b * b) + (c * (a * -4.0))))
	tmp_1 = 0
	if b <= -1.5061884147831686e+150:
		tmp_2 = 0
		if b >= 0.0:
			tmp_2 = t_0
		else:
			tmp_2 = -c / b
		tmp_1 = tmp_2
	elif b <= 1.12e-302:
		tmp_3 = 0
		if b >= 0.0:
			tmp_3 = t_0
		else:
			tmp_3 = (c * 2.0) / (t_1 - b)
		tmp_1 = tmp_3
	elif b <= 8.6e+122:
		tmp_4 = 0
		if b >= 0.0:
			tmp_4 = -((b + t_1) / (a * 2.0))
		else:
			tmp_4 = b / a
		tmp_1 = tmp_4
	elif b >= 0.0:
		tmp_1 = (c / b) - (b / a)
	else:
		tmp_1 = (c * 2.0) / (((a * ((c * 2.0) / b)) - b) - b)
	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(Float64(-b) - b) / Float64(a * 2.0))
	t_1 = sqrt(Float64(Float64(b * b) + Float64(c * Float64(a * -4.0))))
	tmp_1 = 0.0
	if (b <= -1.5061884147831686e+150)
		tmp_2 = 0.0
		if (b >= 0.0)
			tmp_2 = t_0;
		else
			tmp_2 = Float64(Float64(-c) / b);
		end
		tmp_1 = tmp_2;
	elseif (b <= 1.12e-302)
		tmp_3 = 0.0
		if (b >= 0.0)
			tmp_3 = t_0;
		else
			tmp_3 = Float64(Float64(c * 2.0) / Float64(t_1 - b));
		end
		tmp_1 = tmp_3;
	elseif (b <= 8.6e+122)
		tmp_4 = 0.0
		if (b >= 0.0)
			tmp_4 = Float64(-Float64(Float64(b + t_1) / Float64(a * 2.0)));
		else
			tmp_4 = Float64(b / a);
		end
		tmp_1 = tmp_4;
	elseif (b >= 0.0)
		tmp_1 = Float64(Float64(c / b) - Float64(b / a));
	else
		tmp_1 = Float64(Float64(c * 2.0) / Float64(Float64(Float64(a * Float64(Float64(c * 2.0) / b)) - b) - b));
	end
	return tmp_1
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 = (-b - b) / (a * 2.0);
	t_1 = sqrt(((b * b) + (c * (a * -4.0))));
	tmp_2 = 0.0;
	if (b <= -1.5061884147831686e+150)
		tmp_3 = 0.0;
		if (b >= 0.0)
			tmp_3 = t_0;
		else
			tmp_3 = -c / b;
		end
		tmp_2 = tmp_3;
	elseif (b <= 1.12e-302)
		tmp_4 = 0.0;
		if (b >= 0.0)
			tmp_4 = t_0;
		else
			tmp_4 = (c * 2.0) / (t_1 - b);
		end
		tmp_2 = tmp_4;
	elseif (b <= 8.6e+122)
		tmp_5 = 0.0;
		if (b >= 0.0)
			tmp_5 = -((b + t_1) / (a * 2.0));
		else
			tmp_5 = b / a;
		end
		tmp_2 = tmp_5;
	elseif (b >= 0.0)
		tmp_2 = (c / b) - (b / a);
	else
		tmp_2 = (c * 2.0) / (((a * ((c * 2.0) / b)) - b) - b);
	end
	tmp_6 = 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[(N[((-b) - b), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(N[(b * b), $MachinePrecision] + N[(c * N[(a * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[b, -1.5061884147831686e+150], If[GreaterEqual[b, 0.0], t$95$0, N[((-c) / b), $MachinePrecision]], If[LessEqual[b, 1.12e-302], If[GreaterEqual[b, 0.0], t$95$0, N[(N[(c * 2.0), $MachinePrecision] / N[(t$95$1 - b), $MachinePrecision]), $MachinePrecision]], If[LessEqual[b, 8.6e+122], If[GreaterEqual[b, 0.0], (-N[(N[(b + t$95$1), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]), N[(b / a), $MachinePrecision]], If[GreaterEqual[b, 0.0], N[(N[(c / b), $MachinePrecision] - N[(b / a), $MachinePrecision]), $MachinePrecision], N[(N[(c * 2.0), $MachinePrecision] / N[(N[(N[(a * N[(N[(c * 2.0), $MachinePrecision] / b), $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision] - 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 := \frac{\left(-b\right) - b}{a \cdot 2}\\
t_1 := \sqrt{b \cdot b + c \cdot \left(a \cdot -4\right)}\\
\mathbf{if}\;b \leq -1.5061884147831686 \cdot 10^{+150}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;t_0\\

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


\end{array}\\

\mathbf{elif}\;b \leq 1.12 \cdot 10^{-302}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;t_0\\

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


\end{array}\\

\mathbf{elif}\;b \leq 8.6 \cdot 10^{+122}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;-\frac{b + t_1}{a \cdot 2}\\

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


\end{array}\\

\mathbf{elif}\;b \geq 0:\\
\;\;\;\;\frac{c}{b} - \frac{b}{a}\\

\mathbf{else}:\\
\;\;\;\;\frac{c \cdot 2}{\left(a \cdot \frac{c \cdot 2}{b} - b\right) - 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 b < -1.5061884147831686e150

    1. Initial program 37.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 37.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 1.5

      \[\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. Simplified1.5

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

    if -1.5061884147831686e150 < b < 1.12e-302

    1. Initial program 8.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 8.8

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

    if 1.12e-302 < b < 8.59999999999999943e122

    1. Initial program 9.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 9.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}:\\ \;\;\;\;\frac{2 \cdot c}{\color{blue}{\left(-b\right) + \left(2 \cdot \frac{c \cdot a}{b} + -1 \cdot b\right)}}\\ \end{array} \]
    3. Simplified9.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}:\\ \;\;\;\;\frac{2 \cdot c}{\color{blue}{\left(-b\right) + \left(\frac{c \cdot 2}{b} \cdot a - b\right)}}\\ \end{array} \]
      Proof
      (-.f64 (*.f64 (/.f64 (*.f64 c 2) b) a) b): 0 points increase in error, 0 points decrease in error
      (-.f64 (Rewrite<= associate-/r/_binary64 (/.f64 (*.f64 c 2) (/.f64 b a))) b): 13 points increase in error, 14 points decrease in error
      (-.f64 (Rewrite<= associate-*l/_binary64 (*.f64 (/.f64 c (/.f64 b a)) 2)) b): 0 points increase in error, 1 points decrease in error
      (-.f64 (*.f64 (Rewrite<= associate-/l*_binary64 (/.f64 (*.f64 c a) b)) 2) b): 22 points increase in error, 17 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 c around inf 9.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}:\\ \;\;\;\;\frac{b}{a}\\ \end{array} \]

    if 8.59999999999999943e122 < b

    1. Initial program 52.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. Taylor expanded in b around -inf 52.5

      \[\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. Simplified52.5

      \[\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 \cdot 2}{b} \cdot a - b\right)}}\\ \end{array} \]
      Proof
      (-.f64 (*.f64 (/.f64 (*.f64 c 2) b) a) b): 0 points increase in error, 0 points decrease in error
      (-.f64 (Rewrite<= associate-/r/_binary64 (/.f64 (*.f64 c 2) (/.f64 b a))) b): 13 points increase in error, 14 points decrease in error
      (-.f64 (Rewrite<= associate-*l/_binary64 (*.f64 (/.f64 c (/.f64 b a)) 2)) b): 0 points increase in error, 1 points decrease in error
      (-.f64 (*.f64 (Rewrite<= associate-/l*_binary64 (/.f64 (*.f64 c a) b)) 2) b): 22 points increase in error, 17 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 10.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 \cdot 2}{b} \cdot a - b\right)}\\ \end{array} \]
    5. Simplified2.8

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{\color{blue}{\mathsf{fma}\left(b, -2, \frac{c \cdot 2}{b} \cdot a\right)}}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) + \left(\frac{c \cdot 2}{b} \cdot a - b\right)}\\ \end{array} \]
      Proof
      (fma.f64 b -2 (*.f64 (/.f64 (*.f64 c 2) b) a)): 0 points increase in error, 0 points decrease in error
      (fma.f64 b -2 (Rewrite<= associate-/r/_binary64 (/.f64 (*.f64 c 2) (/.f64 b a)))): 13 points increase in error, 14 points decrease in error
      (fma.f64 b -2 (Rewrite<= associate-*l/_binary64 (*.f64 (/.f64 c (/.f64 b a)) 2))): 0 points increase in error, 1 points decrease in error
      (fma.f64 b -2 (*.f64 (Rewrite<= associate-/l*_binary64 (/.f64 (*.f64 c a) b)) 2)): 22 points increase in error, 17 points decrease in error
      (fma.f64 b -2 (Rewrite<= *-commutative_binary64 (*.f64 2 (/.f64 (*.f64 c a) b)))): 0 points increase in error, 0 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
    6. Taylor expanded in b around 0 2.7

      \[\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) + \left(\frac{c \cdot 2}{b} \cdot a - b\right)}\\ \end{array} \]
    7. Simplified2.7

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -1.5061884147831686 \cdot 10^{+150}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{\left(-b\right) - b}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array}\\ \mathbf{elif}\;b \leq 1.12 \cdot 10^{-302}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{\left(-b\right) - b}{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 \leq 8.6 \cdot 10^{+122}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-\frac{b + \sqrt{b \cdot b + c \cdot \left(a \cdot -4\right)}}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{a}\\ \end{array}\\ \mathbf{elif}\;b \geq 0:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{\left(a \cdot \frac{c \cdot 2}{b} - b\right) - b}\\ \end{array} \]

Alternatives

Alternative 1
Error6.4
Cost38052
\[\begin{array}{l} t_0 := \sqrt{b \cdot b + c \cdot \left(a \cdot -4\right)}\\ t_1 := \frac{c \cdot 2}{t_0 - b}\\ t_2 := \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-\frac{b + t_0}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \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{b}{a}\\ \end{array}\\ \mathbf{elif}\;t_2 \leq -5 \cdot 10^{-298}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{\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)}}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array}\\ \mathbf{elif}\;t_2 \leq 0:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{\left(a \cdot \frac{c \cdot 2}{b} - b\right) - b}\\ \end{array}\\ \mathbf{elif}\;t_2 \leq 2 \cdot 10^{+295}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;b \geq 0:\\ \;\;\;\;t_3\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array} \]
Alternative 2
Error6.7
Cost7952
\[\begin{array}{l} t_0 := \sqrt{b \cdot b + c \cdot \left(a \cdot -4\right)}\\ \mathbf{if}\;b \leq -1.5061884147831686 \cdot 10^{+150}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{\left(-b\right) - b}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array}\\ \mathbf{elif}\;b \leq 5.8 \cdot 10^{-304}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{c}{b}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{t_0 - b}\\ \end{array}\\ \mathbf{elif}\;b \leq 8.6 \cdot 10^{+122}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-\frac{b + t_0}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{a}\\ \end{array}\\ \mathbf{elif}\;b \geq 0:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{\left(a \cdot \frac{c \cdot 2}{b} - b\right) - b}\\ \end{array} \]
Alternative 3
Error6.5
Cost7820
\[\begin{array}{l} t_0 := \sqrt{b \cdot b + c \cdot \left(a \cdot -4\right)}\\ \mathbf{if}\;b \leq -1.5061884147831686 \cdot 10^{+150}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{\left(-b\right) - b}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array}\\ \mathbf{elif}\;b \leq 8.6 \cdot 10^{+122}:\\ \;\;\;\;\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}\\ \mathbf{elif}\;b \geq 0:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{\left(a \cdot \frac{c \cdot 2}{b} - b\right) - b}\\ \end{array} \]
Alternative 4
Error14.6
Cost7756
\[\begin{array}{l} \mathbf{if}\;b \leq -1.5061884147831686 \cdot 10^{+150}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{\left(-b\right) - b}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array}\\ \mathbf{elif}\;b \leq 0:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{c}{b}\\ \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{c}{b} - \frac{b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{\left(a \cdot \frac{c \cdot 2}{b} - b\right) - b}\\ \end{array} \]
Alternative 5
Error19.9
Cost7632
\[\begin{array}{l} t_0 := \frac{\left(-b\right) - b}{a \cdot 2}\\ t_1 := \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;c \cdot \frac{2}{\sqrt{c \cdot \left(a \cdot -4\right)} - b}\\ \end{array}\\ \mathbf{if}\;b \leq -1.15 \cdot 10^{-66}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b}\\ \end{array}\\ \mathbf{elif}\;b \leq -8.4 \cdot 10^{-125}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;b \leq -1.92 \cdot 10^{-208}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{c}{b}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{\left(a \cdot \frac{c \cdot 2}{b} - b\right) - b}\\ \end{array}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 6
Error22.8
Cost1092
\[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{c}{b} - \frac{b}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{\left(a \cdot \frac{c \cdot 2}{b} - b\right) - b}\\ \end{array} \]
Alternative 7
Error45.1
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 8
Error23.0
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 2022317 
(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)))))))