?

Average Error: 28.5 → 5.3
Time: 8.4s
Precision: binary64
Cost: 54724

?

\[\left(\left(1.0536712127723509 \cdot 10^{-8} < a \land a < 94906265.62425156\right) \land \left(1.0536712127723509 \cdot 10^{-8} < b \land b < 94906265.62425156\right)\right) \land \left(1.0536712127723509 \cdot 10^{-8} < c \land c < 94906265.62425156\right)\]
\[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
\[\begin{array}{l} t_0 := b \cdot b + a \cdot \left(c \cdot -4\right)\\ t_1 := \sqrt{t_0}\\ t_2 := b + t_1\\ \mathbf{if}\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \leq -19:\\ \;\;\;\;\frac{\begin{array}{l} \mathbf{if}\;t_2 \ne 0:\\ \;\;\;\;\frac{\sqrt{t_0 \cdot t_0} - b \cdot b}{t_2}\\ \mathbf{else}:\\ \;\;\;\;t_1 - b\\ \end{array}}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\left(-\frac{c}{b}\right) + \left(\left(\left(-\frac{a \cdot {c}^{2}}{{b}^{3}}\right) + -2 \cdot \frac{{c}^{3} \cdot {a}^{2}}{{b}^{5}}\right) + -0.25 \cdot \frac{{\left(c \cdot a\right)}^{4} \cdot 20}{a \cdot {b}^{7}}\right)\\ \end{array} \]
(FPCore (a b c)
 :precision binary64
 (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))
(FPCore (a b c)
 :precision binary64
 (let* ((t_0 (+ (* b b) (* a (* c -4.0)))) (t_1 (sqrt t_0)) (t_2 (+ b t_1)))
   (if (<= (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)) -19.0)
     (/
      (if (!= t_2 0.0) (/ (- (sqrt (* t_0 t_0)) (* b b)) t_2) (- t_1 b))
      (* a 2.0))
     (+
      (- (/ c b))
      (+
       (+
        (- (/ (* a (pow c 2.0)) (pow b 3.0)))
        (* -2.0 (/ (* (pow c 3.0) (pow a 2.0)) (pow b 5.0))))
       (* -0.25 (/ (* (pow (* c a) 4.0) 20.0) (* a (pow b 7.0)))))))))
double code(double a, double b, double c) {
	return (-b + sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a);
}
double code(double a, double b, double c) {
	double t_0 = (b * b) + (a * (c * -4.0));
	double t_1 = sqrt(t_0);
	double t_2 = b + t_1;
	double tmp_1;
	if (((-b + sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a)) <= -19.0) {
		double tmp_2;
		if (t_2 != 0.0) {
			tmp_2 = (sqrt((t_0 * t_0)) - (b * b)) / t_2;
		} else {
			tmp_2 = t_1 - b;
		}
		tmp_1 = tmp_2 / (a * 2.0);
	} else {
		tmp_1 = -(c / b) + ((-((a * pow(c, 2.0)) / pow(b, 3.0)) + (-2.0 * ((pow(c, 3.0) * pow(a, 2.0)) / pow(b, 5.0)))) + (-0.25 * ((pow((c * a), 4.0) * 20.0) / (a * pow(b, 7.0)))));
	}
	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
    code = (-b + sqrt(((b * b) - ((4.0d0 * a) * c)))) / (2.0d0 * a)
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) :: t_2
    real(8) :: tmp
    real(8) :: tmp_1
    real(8) :: tmp_2
    t_0 = (b * b) + (a * (c * (-4.0d0)))
    t_1 = sqrt(t_0)
    t_2 = b + t_1
    if (((-b + sqrt(((b * b) - ((4.0d0 * a) * c)))) / (2.0d0 * a)) <= (-19.0d0)) then
        if (t_2 /= 0.0d0) then
            tmp_2 = (sqrt((t_0 * t_0)) - (b * b)) / t_2
        else
            tmp_2 = t_1 - b
        end if
        tmp_1 = tmp_2 / (a * 2.0d0)
    else
        tmp_1 = -(c / b) + ((-((a * (c ** 2.0d0)) / (b ** 3.0d0)) + ((-2.0d0) * (((c ** 3.0d0) * (a ** 2.0d0)) / (b ** 5.0d0)))) + ((-0.25d0) * ((((c * a) ** 4.0d0) * 20.0d0) / (a * (b ** 7.0d0)))))
    end if
    code = tmp_1
end function
public static double code(double a, double b, double c) {
	return (-b + Math.sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a);
}
public static double code(double a, double b, double c) {
	double t_0 = (b * b) + (a * (c * -4.0));
	double t_1 = Math.sqrt(t_0);
	double t_2 = b + t_1;
	double tmp_1;
	if (((-b + Math.sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a)) <= -19.0) {
		double tmp_2;
		if (t_2 != 0.0) {
			tmp_2 = (Math.sqrt((t_0 * t_0)) - (b * b)) / t_2;
		} else {
			tmp_2 = t_1 - b;
		}
		tmp_1 = tmp_2 / (a * 2.0);
	} else {
		tmp_1 = -(c / b) + ((-((a * Math.pow(c, 2.0)) / Math.pow(b, 3.0)) + (-2.0 * ((Math.pow(c, 3.0) * Math.pow(a, 2.0)) / Math.pow(b, 5.0)))) + (-0.25 * ((Math.pow((c * a), 4.0) * 20.0) / (a * Math.pow(b, 7.0)))));
	}
	return tmp_1;
}
def code(a, b, c):
	return (-b + math.sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a)
def code(a, b, c):
	t_0 = (b * b) + (a * (c * -4.0))
	t_1 = math.sqrt(t_0)
	t_2 = b + t_1
	tmp_1 = 0
	if ((-b + math.sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a)) <= -19.0:
		tmp_2 = 0
		if t_2 != 0.0:
			tmp_2 = (math.sqrt((t_0 * t_0)) - (b * b)) / t_2
		else:
			tmp_2 = t_1 - b
		tmp_1 = tmp_2 / (a * 2.0)
	else:
		tmp_1 = -(c / b) + ((-((a * math.pow(c, 2.0)) / math.pow(b, 3.0)) + (-2.0 * ((math.pow(c, 3.0) * math.pow(a, 2.0)) / math.pow(b, 5.0)))) + (-0.25 * ((math.pow((c * a), 4.0) * 20.0) / (a * math.pow(b, 7.0)))))
	return tmp_1
function code(a, b, c)
	return Float64(Float64(Float64(-b) + sqrt(Float64(Float64(b * b) - Float64(Float64(4.0 * a) * c)))) / Float64(2.0 * a))
end
function code(a, b, c)
	t_0 = Float64(Float64(b * b) + Float64(a * Float64(c * -4.0)))
	t_1 = sqrt(t_0)
	t_2 = Float64(b + t_1)
	tmp_1 = 0.0
	if (Float64(Float64(Float64(-b) + sqrt(Float64(Float64(b * b) - Float64(Float64(4.0 * a) * c)))) / Float64(2.0 * a)) <= -19.0)
		tmp_2 = 0.0
		if (t_2 != 0.0)
			tmp_2 = Float64(Float64(sqrt(Float64(t_0 * t_0)) - Float64(b * b)) / t_2);
		else
			tmp_2 = Float64(t_1 - b);
		end
		tmp_1 = Float64(tmp_2 / Float64(a * 2.0));
	else
		tmp_1 = Float64(Float64(-Float64(c / b)) + Float64(Float64(Float64(-Float64(Float64(a * (c ^ 2.0)) / (b ^ 3.0))) + Float64(-2.0 * Float64(Float64((c ^ 3.0) * (a ^ 2.0)) / (b ^ 5.0)))) + Float64(-0.25 * Float64(Float64((Float64(c * a) ^ 4.0) * 20.0) / Float64(a * (b ^ 7.0))))));
	end
	return tmp_1
end
function tmp = code(a, b, c)
	tmp = (-b + sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a);
end
function tmp_4 = code(a, b, c)
	t_0 = (b * b) + (a * (c * -4.0));
	t_1 = sqrt(t_0);
	t_2 = b + t_1;
	tmp_2 = 0.0;
	if (((-b + sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a)) <= -19.0)
		tmp_3 = 0.0;
		if (t_2 ~= 0.0)
			tmp_3 = (sqrt((t_0 * t_0)) - (b * b)) / t_2;
		else
			tmp_3 = t_1 - b;
		end
		tmp_2 = tmp_3 / (a * 2.0);
	else
		tmp_2 = -(c / b) + ((-((a * (c ^ 2.0)) / (b ^ 3.0)) + (-2.0 * (((c ^ 3.0) * (a ^ 2.0)) / (b ^ 5.0)))) + (-0.25 * ((((c * a) ^ 4.0) * 20.0) / (a * (b ^ 7.0)))));
	end
	tmp_4 = tmp_2;
end
code[a_, b_, c_] := 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]
code[a_, b_, c_] := Block[{t$95$0 = N[(N[(b * b), $MachinePrecision] + N[(a * N[(c * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[t$95$0], $MachinePrecision]}, Block[{t$95$2 = N[(b + t$95$1), $MachinePrecision]}, If[LessEqual[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], -19.0], N[(If[Unequal[t$95$2, 0.0], N[(N[(N[Sqrt[N[(t$95$0 * t$95$0), $MachinePrecision]], $MachinePrecision] - N[(b * b), $MachinePrecision]), $MachinePrecision] / t$95$2), $MachinePrecision], N[(t$95$1 - b), $MachinePrecision]] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[((-N[(c / b), $MachinePrecision]) + N[(N[((-N[(N[(a * N[Power[c, 2.0], $MachinePrecision]), $MachinePrecision] / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision]) + N[(-2.0 * N[(N[(N[Power[c, 3.0], $MachinePrecision] * N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision] / N[Power[b, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-0.25 * N[(N[(N[Power[N[(c * a), $MachinePrecision], 4.0], $MachinePrecision] * 20.0), $MachinePrecision] / N[(a * N[Power[b, 7.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}
\begin{array}{l}
t_0 := b \cdot b + a \cdot \left(c \cdot -4\right)\\
t_1 := \sqrt{t_0}\\
t_2 := b + t_1\\
\mathbf{if}\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \leq -19:\\
\;\;\;\;\frac{\begin{array}{l}
\mathbf{if}\;t_2 \ne 0:\\
\;\;\;\;\frac{\sqrt{t_0 \cdot t_0} - b \cdot b}{t_2}\\

\mathbf{else}:\\
\;\;\;\;t_1 - b\\


\end{array}}{a \cdot 2}\\

\mathbf{else}:\\
\;\;\;\;\left(-\frac{c}{b}\right) + \left(\left(\left(-\frac{a \cdot {c}^{2}}{{b}^{3}}\right) + -2 \cdot \frac{{c}^{3} \cdot {a}^{2}}{{b}^{5}}\right) + -0.25 \cdot \frac{{\left(c \cdot a\right)}^{4} \cdot 20}{a \cdot {b}^{7}}\right)\\


\end{array}

Error?

Derivation?

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

    1. Initial program 9.9

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
    2. Simplified9.9

      \[\leadsto \color{blue}{\frac{\sqrt{b \cdot b - a \cdot \left(c \cdot 4\right)} - b}{a \cdot 2}} \]
      Proof

      [Start]9.9

      \[ \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]

      rational_best-simplify-62 [=>]9.9

      \[ \frac{\color{blue}{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} - \left(-\left(-b\right)\right)}}{2 \cdot a} \]

      rational_best-simplify-51 [=>]9.9

      \[ \frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} - \color{blue}{b}}{2 \cdot a} \]

      rational_best-simplify-3 [=>]9.9

      \[ \frac{\sqrt{b \cdot b - \color{blue}{c \cdot \left(4 \cdot a\right)}} - b}{2 \cdot a} \]

      rational_best-simplify-3 [=>]9.9

      \[ \frac{\sqrt{b \cdot b - c \cdot \color{blue}{\left(a \cdot 4\right)}} - b}{2 \cdot a} \]

      rational_best-simplify-113 [=>]9.9

      \[ \frac{\sqrt{b \cdot b - \color{blue}{a \cdot \left(c \cdot 4\right)}} - b}{2 \cdot a} \]

      rational_best-simplify-3 [=>]9.9

      \[ \frac{\sqrt{b \cdot b - a \cdot \left(c \cdot 4\right)} - b}{\color{blue}{a \cdot 2}} \]
    3. Applied egg-rr9.0

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

    if -19 < (/.f64 (+.f64 (neg.f64 b) (sqrt.f64 (-.f64 (*.f64 b b) (*.f64 (*.f64 4 a) c)))) (*.f64 2 a))

    1. Initial program 30.4

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
    2. Simplified30.4

      \[\leadsto \color{blue}{\frac{\sqrt{b \cdot b - a \cdot \left(c \cdot 4\right)} - b}{a \cdot 2}} \]
      Proof

      [Start]30.4

      \[ \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]

      rational_best-simplify-62 [=>]30.4

      \[ \frac{\color{blue}{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} - \left(-\left(-b\right)\right)}}{2 \cdot a} \]

      rational_best-simplify-51 [=>]30.4

      \[ \frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} - \color{blue}{b}}{2 \cdot a} \]

      rational_best-simplify-3 [=>]30.4

      \[ \frac{\sqrt{b \cdot b - \color{blue}{c \cdot \left(4 \cdot a\right)}} - b}{2 \cdot a} \]

      rational_best-simplify-3 [=>]30.4

      \[ \frac{\sqrt{b \cdot b - c \cdot \color{blue}{\left(a \cdot 4\right)}} - b}{2 \cdot a} \]

      rational_best-simplify-113 [=>]30.4

      \[ \frac{\sqrt{b \cdot b - \color{blue}{a \cdot \left(c \cdot 4\right)}} - b}{2 \cdot a} \]

      rational_best-simplify-3 [=>]30.4

      \[ \frac{\sqrt{b \cdot b - a \cdot \left(c \cdot 4\right)} - b}{\color{blue}{a \cdot 2}} \]
    3. Taylor expanded in b around inf 5.0

      \[\leadsto \color{blue}{-1 \cdot \frac{{c}^{2} \cdot a}{{b}^{3}} + \left(-0.25 \cdot \frac{{\left(-2 \cdot \left({c}^{2} \cdot {a}^{2}\right)\right)}^{2} + 16 \cdot \left({c}^{4} \cdot {a}^{4}\right)}{a \cdot {b}^{7}} + \left(-1 \cdot \frac{c}{b} + -2 \cdot \frac{{c}^{3} \cdot {a}^{2}}{{b}^{5}}\right)\right)} \]
    4. Simplified4.9

      \[\leadsto \color{blue}{\left(-\frac{c}{b}\right) + \left(\left(\left(-\frac{a \cdot {c}^{2}}{{b}^{3}}\right) + -2 \cdot \frac{{c}^{3} \cdot {a}^{2}}{{b}^{5}}\right) + -0.25 \cdot \frac{16 \cdot {\left(c \cdot a\right)}^{4} - {\left(c \cdot a\right)}^{4} \cdot -4}{a \cdot {b}^{7}}\right)} \]
      Proof

      [Start]5.0

      \[ -1 \cdot \frac{{c}^{2} \cdot a}{{b}^{3}} + \left(-0.25 \cdot \frac{{\left(-2 \cdot \left({c}^{2} \cdot {a}^{2}\right)\right)}^{2} + 16 \cdot \left({c}^{4} \cdot {a}^{4}\right)}{a \cdot {b}^{7}} + \left(-1 \cdot \frac{c}{b} + -2 \cdot \frac{{c}^{3} \cdot {a}^{2}}{{b}^{5}}\right)\right) \]

      rational_best-simplify-115 [=>]5.0

      \[ \color{blue}{-0.25 \cdot \frac{{\left(-2 \cdot \left({c}^{2} \cdot {a}^{2}\right)\right)}^{2} + 16 \cdot \left({c}^{4} \cdot {a}^{4}\right)}{a \cdot {b}^{7}} + \left(\left(-1 \cdot \frac{c}{b} + -2 \cdot \frac{{c}^{3} \cdot {a}^{2}}{{b}^{5}}\right) + -1 \cdot \frac{{c}^{2} \cdot a}{{b}^{3}}\right)} \]

      rational_best-simplify-1 [<=]5.0

      \[ -0.25 \cdot \frac{{\left(-2 \cdot \left({c}^{2} \cdot {a}^{2}\right)\right)}^{2} + 16 \cdot \left({c}^{4} \cdot {a}^{4}\right)}{a \cdot {b}^{7}} + \color{blue}{\left(-1 \cdot \frac{{c}^{2} \cdot a}{{b}^{3}} + \left(-1 \cdot \frac{c}{b} + -2 \cdot \frac{{c}^{3} \cdot {a}^{2}}{{b}^{5}}\right)\right)} \]

      rational_best-simplify-115 [=>]4.9

      \[ -0.25 \cdot \frac{{\left(-2 \cdot \left({c}^{2} \cdot {a}^{2}\right)\right)}^{2} + 16 \cdot \left({c}^{4} \cdot {a}^{4}\right)}{a \cdot {b}^{7}} + \color{blue}{\left(-1 \cdot \frac{c}{b} + \left(-2 \cdot \frac{{c}^{3} \cdot {a}^{2}}{{b}^{5}} + -1 \cdot \frac{{c}^{2} \cdot a}{{b}^{3}}\right)\right)} \]

      rational_best-simplify-115 [=>]4.9

      \[ \color{blue}{-1 \cdot \frac{c}{b} + \left(\left(-2 \cdot \frac{{c}^{3} \cdot {a}^{2}}{{b}^{5}} + -1 \cdot \frac{{c}^{2} \cdot a}{{b}^{3}}\right) + -0.25 \cdot \frac{{\left(-2 \cdot \left({c}^{2} \cdot {a}^{2}\right)\right)}^{2} + 16 \cdot \left({c}^{4} \cdot {a}^{4}\right)}{a \cdot {b}^{7}}\right)} \]

      rational_best-simplify-3 [=>]4.9

      \[ \color{blue}{\frac{c}{b} \cdot -1} + \left(\left(-2 \cdot \frac{{c}^{3} \cdot {a}^{2}}{{b}^{5}} + -1 \cdot \frac{{c}^{2} \cdot a}{{b}^{3}}\right) + -0.25 \cdot \frac{{\left(-2 \cdot \left({c}^{2} \cdot {a}^{2}\right)\right)}^{2} + 16 \cdot \left({c}^{4} \cdot {a}^{4}\right)}{a \cdot {b}^{7}}\right) \]

      rational_best-simplify-17 [=>]4.9

      \[ \color{blue}{\left(-\frac{c}{b}\right)} + \left(\left(-2 \cdot \frac{{c}^{3} \cdot {a}^{2}}{{b}^{5}} + -1 \cdot \frac{{c}^{2} \cdot a}{{b}^{3}}\right) + -0.25 \cdot \frac{{\left(-2 \cdot \left({c}^{2} \cdot {a}^{2}\right)\right)}^{2} + 16 \cdot \left({c}^{4} \cdot {a}^{4}\right)}{a \cdot {b}^{7}}\right) \]
    5. Taylor expanded in c around 0 4.9

      \[\leadsto \left(-\frac{c}{b}\right) + \left(\left(\left(-\frac{a \cdot {c}^{2}}{{b}^{3}}\right) + -2 \cdot \frac{{c}^{3} \cdot {a}^{2}}{{b}^{5}}\right) + -0.25 \cdot \color{blue}{\frac{{c}^{4} \cdot \left(16 \cdot {a}^{4} - -4 \cdot {a}^{4}\right)}{a \cdot {b}^{7}}}\right) \]
    6. Simplified4.9

      \[\leadsto \left(-\frac{c}{b}\right) + \left(\left(\left(-\frac{a \cdot {c}^{2}}{{b}^{3}}\right) + -2 \cdot \frac{{c}^{3} \cdot {a}^{2}}{{b}^{5}}\right) + -0.25 \cdot \color{blue}{\frac{{\left(c \cdot a\right)}^{4} \cdot 20}{a \cdot {b}^{7}}}\right) \]
      Proof

      [Start]4.9

      \[ \left(-\frac{c}{b}\right) + \left(\left(\left(-\frac{a \cdot {c}^{2}}{{b}^{3}}\right) + -2 \cdot \frac{{c}^{3} \cdot {a}^{2}}{{b}^{5}}\right) + -0.25 \cdot \frac{{c}^{4} \cdot \left(16 \cdot {a}^{4} - -4 \cdot {a}^{4}\right)}{a \cdot {b}^{7}}\right) \]

      rational_best-simplify-111 [=>]4.9

      \[ \left(-\frac{c}{b}\right) + \left(\left(\left(-\frac{a \cdot {c}^{2}}{{b}^{3}}\right) + -2 \cdot \frac{{c}^{3} \cdot {a}^{2}}{{b}^{5}}\right) + -0.25 \cdot \frac{\color{blue}{{c}^{4} \cdot \left(16 \cdot {a}^{4}\right) - {c}^{4} \cdot \left(-4 \cdot {a}^{4}\right)}}{a \cdot {b}^{7}}\right) \]

      rational_best-simplify-113 [<=]4.9

      \[ \left(-\frac{c}{b}\right) + \left(\left(\left(-\frac{a \cdot {c}^{2}}{{b}^{3}}\right) + -2 \cdot \frac{{c}^{3} \cdot {a}^{2}}{{b}^{5}}\right) + -0.25 \cdot \frac{\color{blue}{16 \cdot \left({c}^{4} \cdot {a}^{4}\right)} - {c}^{4} \cdot \left(-4 \cdot {a}^{4}\right)}{a \cdot {b}^{7}}\right) \]

      rational_best-simplify-3 [=>]4.9

      \[ \left(-\frac{c}{b}\right) + \left(\left(\left(-\frac{a \cdot {c}^{2}}{{b}^{3}}\right) + -2 \cdot \frac{{c}^{3} \cdot {a}^{2}}{{b}^{5}}\right) + -0.25 \cdot \frac{\color{blue}{\left({c}^{4} \cdot {a}^{4}\right) \cdot 16} - {c}^{4} \cdot \left(-4 \cdot {a}^{4}\right)}{a \cdot {b}^{7}}\right) \]

      rational_best-simplify-113 [<=]4.9

      \[ \left(-\frac{c}{b}\right) + \left(\left(\left(-\frac{a \cdot {c}^{2}}{{b}^{3}}\right) + -2 \cdot \frac{{c}^{3} \cdot {a}^{2}}{{b}^{5}}\right) + -0.25 \cdot \frac{\left({c}^{4} \cdot {a}^{4}\right) \cdot 16 - \color{blue}{-4 \cdot \left({c}^{4} \cdot {a}^{4}\right)}}{a \cdot {b}^{7}}\right) \]

      rational_best-simplify-3 [=>]4.9

      \[ \left(-\frac{c}{b}\right) + \left(\left(\left(-\frac{a \cdot {c}^{2}}{{b}^{3}}\right) + -2 \cdot \frac{{c}^{3} \cdot {a}^{2}}{{b}^{5}}\right) + -0.25 \cdot \frac{\left({c}^{4} \cdot {a}^{4}\right) \cdot 16 - \color{blue}{\left({c}^{4} \cdot {a}^{4}\right) \cdot -4}}{a \cdot {b}^{7}}\right) \]

      rational_best-simplify-110 [=>]4.9

      \[ \left(-\frac{c}{b}\right) + \left(\left(\left(-\frac{a \cdot {c}^{2}}{{b}^{3}}\right) + -2 \cdot \frac{{c}^{3} \cdot {a}^{2}}{{b}^{5}}\right) + -0.25 \cdot \frac{\color{blue}{\left({c}^{4} \cdot {a}^{4}\right) \cdot \left(16 - -4\right)}}{a \cdot {b}^{7}}\right) \]

      exponential-simplify-29 [=>]4.9

      \[ \left(-\frac{c}{b}\right) + \left(\left(\left(-\frac{a \cdot {c}^{2}}{{b}^{3}}\right) + -2 \cdot \frac{{c}^{3} \cdot {a}^{2}}{{b}^{5}}\right) + -0.25 \cdot \frac{\color{blue}{{\left(c \cdot a\right)}^{4}} \cdot \left(16 - -4\right)}{a \cdot {b}^{7}}\right) \]

      metadata-eval [=>]4.9

      \[ \left(-\frac{c}{b}\right) + \left(\left(\left(-\frac{a \cdot {c}^{2}}{{b}^{3}}\right) + -2 \cdot \frac{{c}^{3} \cdot {a}^{2}}{{b}^{5}}\right) + -0.25 \cdot \frac{{\left(c \cdot a\right)}^{4} \cdot \color{blue}{20}}{a \cdot {b}^{7}}\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification5.3

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \leq -19:\\ \;\;\;\;\frac{\begin{array}{l} \mathbf{if}\;b + \sqrt{b \cdot b + a \cdot \left(c \cdot -4\right)} \ne 0:\\ \;\;\;\;\frac{\sqrt{\left(b \cdot b + a \cdot \left(c \cdot -4\right)\right) \cdot \left(b \cdot b + a \cdot \left(c \cdot -4\right)\right)} - b \cdot b}{b + \sqrt{b \cdot b + a \cdot \left(c \cdot -4\right)}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{b \cdot b + a \cdot \left(c \cdot -4\right)} - b\\ \end{array}}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\left(-\frac{c}{b}\right) + \left(\left(\left(-\frac{a \cdot {c}^{2}}{{b}^{3}}\right) + -2 \cdot \frac{{c}^{3} \cdot {a}^{2}}{{b}^{5}}\right) + -0.25 \cdot \frac{{\left(c \cdot a\right)}^{4} \cdot 20}{a \cdot {b}^{7}}\right)\\ \end{array} \]

Alternatives

Alternative 1
Error6.8
Cost41028
\[\begin{array}{l} t_0 := b \cdot b + a \cdot \left(c \cdot -4\right)\\ t_1 := \sqrt{t_0}\\ t_2 := b + t_1\\ \mathbf{if}\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \leq -0.16:\\ \;\;\;\;\frac{\begin{array}{l} \mathbf{if}\;t_2 \ne 0:\\ \;\;\;\;\frac{\sqrt{t_0 \cdot t_0} - b \cdot b}{t_2}\\ \mathbf{else}:\\ \;\;\;\;t_1 - b\\ \end{array}}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\left(-\frac{c}{b}\right) + \left(\left(-\frac{a \cdot {c}^{2}}{{b}^{3}}\right) + -2 \cdot \frac{{c}^{3} \cdot {a}^{2}}{{b}^{5}}\right)\\ \end{array} \]
Alternative 2
Error6.9
Cost35076
\[\begin{array}{l} t_0 := b \cdot b + a \cdot \left(c \cdot -4\right)\\ t_1 := \sqrt{t_0}\\ t_2 := b + t_1\\ \mathbf{if}\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \leq -0.16:\\ \;\;\;\;\frac{\begin{array}{l} \mathbf{if}\;t_2 \ne 0:\\ \;\;\;\;\frac{\sqrt{t_0 \cdot t_0} - b \cdot b}{t_2}\\ \mathbf{else}:\\ \;\;\;\;t_1 - b\\ \end{array}}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{-2 \cdot \frac{c \cdot a}{b} + \left(-2 \cdot \frac{{\left(c \cdot a\right)}^{2}}{{b}^{3}} + -4 \cdot \frac{{\left(c \cdot a\right)}^{3}}{{b}^{5}}\right)}{a \cdot 2}\\ \end{array} \]
Alternative 3
Error9.3
Cost22600
\[\begin{array}{l} t_0 := b \cdot b + a \cdot \left(c \cdot -4\right)\\ t_1 := \sqrt{t_0}\\ t_2 := b + t_1\\ \mathbf{if}\;b \leq 43:\\ \;\;\;\;\frac{\begin{array}{l} \mathbf{if}\;t_2 \ne 0:\\ \;\;\;\;\frac{\sqrt{t_0 \cdot t_0} - b \cdot b}{t_2}\\ \mathbf{else}:\\ \;\;\;\;t_1 - b\\ \end{array}}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\left(-\frac{a \cdot {c}^{2}}{{b}^{3}}\right) - \frac{c}{b}\\ \end{array} \]
Alternative 4
Error15.1
Cost15496
\[\begin{array}{l} \mathbf{if}\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \leq -2.8 \cdot 10^{-6}:\\ \;\;\;\;\frac{\sqrt{\begin{array}{l} \mathbf{if}\;b \cdot b \ne 0:\\ \;\;\;\;\frac{b \cdot b}{b} \cdot \left(-4 \cdot \frac{c \cdot a}{b} + b\right)\\ \mathbf{else}:\\ \;\;\;\;b \cdot b + a \cdot \left(c \cdot -4\right)\\ \end{array}} - b}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;-\frac{c}{b}\\ \end{array} \]
Alternative 5
Error15.1
Cost14852
\[\begin{array}{l} \mathbf{if}\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \leq -2.8 \cdot 10^{-6}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - a \cdot \left(c \cdot 4\right)} - b}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;-\frac{c}{b}\\ \end{array} \]
Alternative 6
Error9.5
Cost13700
\[\begin{array}{l} \mathbf{if}\;b \leq 43:\\ \;\;\;\;\frac{\sqrt{b \cdot b - a \cdot \left(c \cdot 4\right)} - b}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\left(-\frac{a \cdot {c}^{2}}{{b}^{3}}\right) - \frac{c}{b}\\ \end{array} \]
Alternative 7
Error22.9
Cost256
\[-\frac{c}{b} \]

Error

Reproduce?

herbie shell --seed 2023104 
(FPCore (a b c)
  :name "Quadratic roots, narrow range"
  :precision binary64
  :pre (and (and (and (< 1.0536712127723509e-8 a) (< a 94906265.62425156)) (and (< 1.0536712127723509e-8 b) (< b 94906265.62425156))) (and (< 1.0536712127723509e-8 c) (< c 94906265.62425156)))
  (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))