Average Error: 19.3 → 6.4
Time: 15.9s
Precision: binary64
Cost: 60994
\[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array}\]
\[\begin{array}{l} \mathbf{if}\;b \leq -9.120756384475955 \cdot 10^{+92}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \left(\frac{\sqrt[3]{c} \cdot \sqrt[3]{c}}{\sqrt[3]{b + \sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)}} \cdot \sqrt[3]{b + \sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)}}} \cdot \frac{\sqrt[3]{c}}{\sqrt[3]{b + \sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)}}}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) - b}{a \cdot 2}\\ \end{array}\\ \mathbf{elif}\;b \leq 1.3576793229541498 \cdot 10^{+107}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{c \cdot 2}{\left(-b\right) - \sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)} - b}{a \cdot 2}\\ \end{array}\\ \mathbf{elif}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{b + b}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)} - b}{a \cdot 2}\\ \end{array}\]
\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\

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

\end{array}
\begin{array}{l}
\mathbf{if}\;b \leq -9.120756384475955 \cdot 10^{+92}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;-2 \cdot \left(\frac{\sqrt[3]{c} \cdot \sqrt[3]{c}}{\sqrt[3]{b + \sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)}} \cdot \sqrt[3]{b + \sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)}}} \cdot \frac{\sqrt[3]{c}}{\sqrt[3]{b + \sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)}}}\right)\\

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

\end{array}\\

\mathbf{elif}\;b \leq 1.3576793229541498 \cdot 10^{+107}:\\
\;\;\;\;\begin{array}{l}
\mathbf{if}\;b \geq 0:\\
\;\;\;\;\frac{c \cdot 2}{\left(-b\right) - \sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)}}\\

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

\end{array}\\

\mathbf{elif}\;b \geq 0:\\
\;\;\;\;-2 \cdot \frac{c}{b + b}\\

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

\end{array}
(FPCore (a b c)
 :precision binary64
 (if (>= b 0.0)
   (/ (* 2.0 c) (- (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))))
   (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a))))
(FPCore (a b c)
 :precision binary64
 (if (<= b -9.120756384475955e+92)
   (if (>= b 0.0)
     (*
      -2.0
      (*
       (/
        (* (cbrt c) (cbrt c))
        (*
         (cbrt (+ b (sqrt (- (* b b) (* c (* 4.0 a))))))
         (cbrt (+ b (sqrt (- (* b b) (* c (* 4.0 a))))))))
       (/ (cbrt c) (cbrt (+ b (sqrt (- (* b b) (* c (* 4.0 a)))))))))
     (/ (- (- b) b) (* a 2.0)))
   (if (<= b 1.3576793229541498e+107)
     (if (>= b 0.0)
       (/ (* c 2.0) (- (- b) (sqrt (- (* b b) (* c (* 4.0 a))))))
       (/ (- (sqrt (- (* b b) (* c (* 4.0 a)))) b) (* a 2.0)))
     (if (>= b 0.0)
       (* -2.0 (/ c (+ b b)))
       (/ (- (sqrt (- (* b b) (* c (* 4.0 a)))) b) (* a 2.0))))))
double code(double a, double b, double c) {
	double tmp;
	if (b >= 0.0) {
		tmp = (2.0 * c) / (-b - sqrt((b * b) - ((4.0 * a) * c)));
	} else {
		tmp = (-b + sqrt((b * b) - ((4.0 * a) * c))) / (2.0 * a);
	}
	return tmp;
}
double code(double a, double b, double c) {
	double tmp;
	if (b <= -9.120756384475955e+92) {
		double tmp_1;
		if (b >= 0.0) {
			tmp_1 = -2.0 * (((cbrt(c) * cbrt(c)) / (cbrt(b + sqrt((b * b) - (c * (4.0 * a)))) * cbrt(b + sqrt((b * b) - (c * (4.0 * a)))))) * (cbrt(c) / cbrt(b + sqrt((b * b) - (c * (4.0 * a))))));
		} else {
			tmp_1 = (-b - b) / (a * 2.0);
		}
		tmp = tmp_1;
	} else if (b <= 1.3576793229541498e+107) {
		double tmp_2;
		if (b >= 0.0) {
			tmp_2 = (c * 2.0) / (-b - sqrt((b * b) - (c * (4.0 * a))));
		} else {
			tmp_2 = (sqrt((b * b) - (c * (4.0 * a))) - b) / (a * 2.0);
		}
		tmp = tmp_2;
	} else if (b >= 0.0) {
		tmp = -2.0 * (c / (b + b));
	} else {
		tmp = (sqrt((b * b) - (c * (4.0 * a))) - b) / (a * 2.0);
	}
	return tmp;
}

Error

Bits error versus a

Bits error versus b

Bits error versus c

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Alternatives

Alternative 1
Error21.2
Cost60673
\[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \left(\frac{\sqrt[3]{c} \cdot \sqrt[3]{c}}{\sqrt[3]{b + \sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)}} \cdot \sqrt[3]{b + \sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)}}} \cdot \frac{\sqrt[3]{c}}{\sqrt[3]{b + \sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)}}}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) - b}{a \cdot 2}\\ \end{array}\]
Alternative 2
Error19.4
Cost47361
\[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{b + \sqrt{\sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)}} \cdot \sqrt{\left|\sqrt[3]{b \cdot b - c \cdot \left(4 \cdot a\right)}\right| \cdot \sqrt{\sqrt[3]{b \cdot b - c \cdot \left(4 \cdot a\right)}}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)} - b}{a \cdot 2}\\ \end{array}\]
Alternative 3
Error21.1
Cost47105
\[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \left(\frac{\sqrt[3]{c} \cdot \sqrt[3]{c}}{\sqrt{b + \sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)}}} \cdot \frac{\sqrt[3]{c}}{\sqrt{b + \sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)}}}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) - b}{a \cdot 2}\\ \end{array}\]
Alternative 4
Error21.1
Cost41473
\[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \left(\sqrt[3]{\frac{c}{b + \sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)}}} \cdot \left(\sqrt[3]{\frac{c}{b + \sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)}}} \cdot \sqrt[3]{\frac{c}{b + \sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)}}}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) - b}{a \cdot 2}\\ \end{array}\]
Alternative 5
Error21.1
Cost41345
\[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \left(\frac{1}{\sqrt[3]{b + \sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)}} \cdot \sqrt[3]{b + \sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)}}} \cdot \frac{c}{\sqrt[3]{b + \sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)}}}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) - b}{a \cdot 2}\\ \end{array}\]
Alternative 6
Error19.5
Cost40961
\[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{b + \sqrt[3]{\sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)}} \cdot \left(\sqrt[3]{\sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)}} \cdot \sqrt[3]{\sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)}}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)} - b}{a \cdot 2}\\ \end{array}\]
Alternative 7
Error37.4
Cost34497
\[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{b + \frac{\sqrt{{b}^{6} - {\left(c \cdot \left(4 \cdot a\right)\right)}^{3}}}{\sqrt{{b}^{4} + c \cdot \left(\left(4 \cdot a\right) \cdot \left(b \cdot b + c \cdot \left(4 \cdot a\right)\right)\right)}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)} - b}{a \cdot 2}\\ \end{array}\]
Alternative 8
Error20.9
Cost27777
\[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \left(\frac{c}{\sqrt{b + \sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)}}} \cdot \frac{1}{\sqrt{b + \sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)}}}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) - b}{a \cdot 2}\\ \end{array}\]
Alternative 9
Error20.9
Cost27649
\[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{\frac{c}{\sqrt{b + \sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)}}}}{\sqrt{b + \sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) - b}{a \cdot 2}\\ \end{array}\]
Alternative 10
Error19.4
Cost27649
\[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\sqrt{b + \sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)}} \cdot \sqrt{b + \sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)} - b}{a \cdot 2}\\ \end{array}\]
Alternative 11
Error19.4
Cost27649
\[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{b + \sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{\sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)} - b} \cdot \sqrt{\sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)} - b}}{a \cdot 2}\\ \end{array}\]
Alternative 12
Error19.3
Cost27521
\[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{b + \sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{\sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)}} \cdot \sqrt{\sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)}} - b}{a \cdot 2}\\ \end{array}\]
Alternative 13
Error19.3
Cost27521
\[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{b + \sqrt{\sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)}} \cdot \sqrt{\sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)} - b}{a \cdot 2}\\ \end{array}\]
Alternative 14
Error19.4
Cost27521
\[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{b + \left|\sqrt[3]{b \cdot b - c \cdot \left(4 \cdot a\right)}\right| \cdot \sqrt{\sqrt[3]{b \cdot b - c \cdot \left(4 \cdot a\right)}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)} - b}{a \cdot 2}\\ \end{array}\]
Alternative 15
Error21.1
Cost27137
\[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \left(\left(\sqrt[3]{c} \cdot \sqrt[3]{c}\right) \cdot \frac{\sqrt[3]{c}}{b + \sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) - b}{a \cdot 2}\\ \end{array}\]
Alternative 16
Error24.7
Cost20545
\[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\sqrt[3]{{\left(b + \sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)}\right)}^{3}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)} - b}{a \cdot 2}\\ \end{array}\]
Alternative 17
Error24.4
Cost20545
\[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{b + \sqrt[3]{{\left(\sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)}\right)}^{3}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)} - b}{a \cdot 2}\\ \end{array}\]
Alternative 18
Error20.5
Cost20481
\[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{b + \sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{e^{\log \left(\sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)}\right)} - b}{a \cdot 2}\\ \end{array}\]
Alternative 19
Error20.6
Cost20481
\[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{b + \sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{e^{\log \left(\sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)} - b\right)}}{a \cdot 2}\\ \end{array}\]
Alternative 20
Error38.0
Cost14913
\[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{b + \sqrt{\frac{{b}^{4} - \left(a \cdot a\right) \cdot \left(\left(c \cdot c\right) \cdot 16\right)}{b \cdot b + c \cdot \left(4 \cdot a\right)}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) - b}{a \cdot 2}\\ \end{array}\]
Alternative 21
Error34.8
Cost8065
\[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\frac{c \cdot \left(4 \cdot a\right)}{b - \sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)} - b}{a \cdot 2}\\ \end{array}\]
Alternative 22
Error36.3
Cost8065
\[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \left(\left(b - \sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)}\right) \cdot \frac{c}{c \cdot \left(4 \cdot a\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) - b}{a \cdot 2}\\ \end{array}\]
Alternative 23
Error29.0
Cost8065
\[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{b + \sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{c \cdot \left(a \cdot -4\right)}{b + \sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)}}}{a \cdot 2}\\ \end{array}\]
Alternative 24
Error20.8
Cost7809
\[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \left(c \cdot \frac{1}{b + \sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) - b}{a \cdot 2}\\ \end{array}\]
Alternative 25
Error20.9
Cost7809
\[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{1}{\frac{b + \sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)}}{c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) - b}{a \cdot 2}\\ \end{array}\]
Alternative 26
Error19.3
Cost7745
\[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{c \cdot 2}{\left(-b\right) - \sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)} - b}{a \cdot 2}\\ \end{array}\]
Alternative 27
Error21.6
Cost7681
\[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{2 \cdot \left(b - \frac{c \cdot a}{b}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)} - b}{a \cdot 2}\\ \end{array}\]
Alternative 28
Error19.3
Cost7681
\[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{b + \sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)} - b}{a \cdot 2}\\ \end{array}\]
Alternative 29
Error20.9
Cost7681
\[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{b + b}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)} - b}{a \cdot 2}\\ \end{array}\]
Alternative 30
Error30.5
Cost7681
\[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{b + \sqrt{c \cdot \left(a \cdot -4\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)} - b}{a \cdot 2}\\ \end{array}\]
Alternative 31
Error20.8
Cost7681
\[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{b + \sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) - b}{a \cdot 2}\\ \end{array}\]
Alternative 32
Error37.4
Cost7681
\[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{b + \sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{b - b}{a \cdot 2}\\ \end{array}\]
Alternative 33
Error27.7
Cost7681
\[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{b + \sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{c \cdot \left(a \cdot -4\right)} - b}{a \cdot 2}\\ \end{array}\]
Alternative 34
Error32.0
Cost7553
\[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \left(c \cdot \frac{1}{b + \sqrt{c \cdot \left(a \cdot -4\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) - b}{a \cdot 2}\\ \end{array}\]
Alternative 35
Error32.0
Cost7425
\[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{b + \sqrt{c \cdot \left(a \cdot -4\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) - b}{a \cdot 2}\\ \end{array}\]
Alternative 36
Error37.4
Cost7425
\[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \left(c \cdot \frac{1}{\sqrt{c \cdot \left(a \cdot -4\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) - b}{a \cdot 2}\\ \end{array}\]
Alternative 37
Error37.4
Cost7297
\[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{\sqrt{c \cdot \left(a \cdot -4\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) - b}{a \cdot 2}\\ \end{array}\]
Alternative 38
Error23.1
Cost1281
\[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{b + \left(b - 2 \cdot \frac{c \cdot a}{b}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) - b}{a \cdot 2}\\ \end{array}\]
Alternative 39
Error23.1
Cost1153
\[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{2 \cdot \left(b - \frac{c \cdot a}{b}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) - b}{a \cdot 2}\\ \end{array}\]
Alternative 40
Error45.7
Cost1025
\[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{2 \cdot \frac{c \cdot a}{b}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) - b}{a \cdot 2}\\ \end{array}\]
Alternative 41
Error22.5
Cost897
\[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \left(c \cdot \frac{1}{b + b}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) - b}{a \cdot 2}\\ \end{array}\]
Alternative 42
Error22.4
Cost833
\[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{b + b}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) - b}{a \cdot 2}\\ \end{array}\]
Alternative 43
Error45.6
Cost833
\[\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \left(0.5 \cdot \frac{b}{a}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) - b}{a \cdot 2}\\ \end{array}\]
Alternative 44
Error61.6
Cost64
\[1\]
Alternative 45
Error56.1
Cost64
\[0\]
Alternative 46
Error61.6
Cost64
\[-1\]

Error

Derivation

  1. Split input into 3 regimes
  2. if b < -9.1207563844759551e92

    1. Initial program 45.9

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

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

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{b + \sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) - b}{2 \cdot a}\\ \end{array}\]
    5. Using strategy rm
    6. Applied add-cube-cbrt_binary644.1

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

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

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

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

    if -9.1207563844759551e92 < b < 1.35767932295414979e107

    1. Initial program 8.5

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

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

    if 1.35767932295414979e107 < b

    1. Initial program 29.7

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -9.120756384475955 \cdot 10^{+92}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;-2 \cdot \left(\frac{\sqrt[3]{c} \cdot \sqrt[3]{c}}{\sqrt[3]{b + \sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)}} \cdot \sqrt[3]{b + \sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)}}} \cdot \frac{\sqrt[3]{c}}{\sqrt[3]{b + \sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)}}}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) - b}{a \cdot 2}\\ \end{array}\\ \mathbf{elif}\;b \leq 1.3576793229541498 \cdot 10^{+107}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \geq 0:\\ \;\;\;\;\frac{c \cdot 2}{\left(-b\right) - \sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)} - b}{a \cdot 2}\\ \end{array}\\ \mathbf{elif}\;b \geq 0:\\ \;\;\;\;-2 \cdot \frac{c}{b + b}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)} - b}{a \cdot 2}\\ \end{array}\]

Reproduce

herbie shell --seed 2021022 
(FPCore (a b c)
  :name "jeff quadratic root 2"
  :precision binary64
  (if (>= b 0.0) (/ (* 2.0 c) (- (- b) (sqrt (- (* b b) (* (* 4.0 a) c))))) (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a))))