Average Error: 34.0 → 9.4
Time: 6.4s
Precision: 64
\[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
\[\begin{array}{l} \mathbf{if}\;b_2 \le -1.0366436397824178 \cdot 10^{68}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le -2.75036677292823045 \cdot 10^{-219}:\\ \;\;\;\;\frac{\frac{1}{\sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2} \cdot \sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}} \cdot \frac{a}{\frac{\sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{c}}}{a}\\ \mathbf{elif}\;b_2 \le 5.34931179548294658 \cdot 10^{30}:\\ \;\;\;\;\frac{1}{\frac{a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - 2 \cdot \frac{b_2}{a}\\ \end{array}\]
\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}
\begin{array}{l}
\mathbf{if}\;b_2 \le -1.0366436397824178 \cdot 10^{68}:\\
\;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\

\mathbf{elif}\;b_2 \le -2.75036677292823045 \cdot 10^{-219}:\\
\;\;\;\;\frac{\frac{1}{\sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2} \cdot \sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}} \cdot \frac{a}{\frac{\sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{c}}}{a}\\

\mathbf{elif}\;b_2 \le 5.34931179548294658 \cdot 10^{30}:\\
\;\;\;\;\frac{1}{\frac{a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - 2 \cdot \frac{b_2}{a}\\

\end{array}
double code(double a, double b_2, double c) {
	return ((-b_2 - sqrt(((b_2 * b_2) - (a * c)))) / a);
}
double code(double a, double b_2, double c) {
	double temp;
	if ((b_2 <= -1.0366436397824178e+68)) {
		temp = (-0.5 * (c / b_2));
	} else {
		double temp_1;
		if ((b_2 <= -2.7503667729282305e-219)) {
			temp_1 = (((1.0 / (cbrt((sqrt(((b_2 * b_2) - (a * c))) - b_2)) * cbrt((sqrt(((b_2 * b_2) - (a * c))) - b_2)))) * (a / (cbrt((sqrt(((b_2 * b_2) - (a * c))) - b_2)) / c))) / a);
		} else {
			double temp_2;
			if ((b_2 <= 5.349311795482947e+30)) {
				temp_2 = (1.0 / (a / (-b_2 - sqrt(((b_2 * b_2) - (a * c))))));
			} else {
				temp_2 = ((0.5 * (c / b_2)) - (2.0 * (b_2 / a)));
			}
			temp_1 = temp_2;
		}
		temp = temp_1;
	}
	return temp;
}

Error

Bits error versus a

Bits error versus b_2

Bits error versus c

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 4 regimes
  2. if b_2 < -1.0366436397824178e+68

    1. Initial program 57.9

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Taylor expanded around -inf 3.6

      \[\leadsto \color{blue}{\frac{-1}{2} \cdot \frac{c}{b_2}}\]

    if -1.0366436397824178e+68 < b_2 < -2.7503667729282305e-219

    1. Initial program 34.6

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Using strategy rm
    3. Applied flip--34.6

      \[\leadsto \frac{\color{blue}{\frac{\left(-b_2\right) \cdot \left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c} \cdot \sqrt{b_2 \cdot b_2 - a \cdot c}}{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}}}{a}\]
    4. Simplified16.9

      \[\leadsto \frac{\frac{\color{blue}{0 + a \cdot c}}{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}}{a}\]
    5. Simplified16.9

      \[\leadsto \frac{\frac{0 + a \cdot c}{\color{blue}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}{a}\]
    6. Using strategy rm
    7. Applied add-cube-cbrt17.6

      \[\leadsto \frac{\frac{0 + a \cdot c}{\color{blue}{\left(\sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2} \cdot \sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}\right) \cdot \sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}}{a}\]
    8. Applied *-un-lft-identity17.6

      \[\leadsto \frac{\frac{\color{blue}{1 \cdot \left(0 + a \cdot c\right)}}{\left(\sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2} \cdot \sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}\right) \cdot \sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}{a}\]
    9. Applied times-frac17.6

      \[\leadsto \frac{\color{blue}{\frac{1}{\sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2} \cdot \sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}} \cdot \frac{0 + a \cdot c}{\sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}}{a}\]
    10. Simplified16.9

      \[\leadsto \frac{\frac{1}{\sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2} \cdot \sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}} \cdot \color{blue}{\frac{a}{\frac{\sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{c}}}}{a}\]

    if -2.7503667729282305e-219 < b_2 < 5.349311795482947e+30

    1. Initial program 11.2

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Using strategy rm
    3. Applied clear-num11.3

      \[\leadsto \color{blue}{\frac{1}{\frac{a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}}\]

    if 5.349311795482947e+30 < b_2

    1. Initial program 35.5

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Taylor expanded around inf 6.4

      \[\leadsto \color{blue}{\frac{1}{2} \cdot \frac{c}{b_2} - 2 \cdot \frac{b_2}{a}}\]
  3. Recombined 4 regimes into one program.
  4. Final simplification9.4

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -1.0366436397824178 \cdot 10^{68}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le -2.75036677292823045 \cdot 10^{-219}:\\ \;\;\;\;\frac{\frac{1}{\sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2} \cdot \sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}} \cdot \frac{a}{\frac{\sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{c}}}{a}\\ \mathbf{elif}\;b_2 \le 5.34931179548294658 \cdot 10^{30}:\\ \;\;\;\;\frac{1}{\frac{a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - 2 \cdot \frac{b_2}{a}\\ \end{array}\]

Reproduce

herbie shell --seed 2020049 
(FPCore (a b_2 c)
  :name "quad2m (problem 3.2.1, negative)"
  :precision binary64
  (/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))