Average Error: 34.2 → 6.9
Time: 5.5s
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.19915098118719145 \cdot 10^{121}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le -3.4150755057481537 \cdot 10^{-290}:\\ \;\;\;\;\frac{\frac{1}{\frac{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{1}}}{\frac{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{c}}\\ \mathbf{elif}\;b_2 \le 3.7711811459025421 \cdot 10^{84}:\\ \;\;\;\;\left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right) \cdot \frac{1}{a}\\ \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.19915098118719145 \cdot 10^{121}:\\
\;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\

\mathbf{elif}\;b_2 \le -3.4150755057481537 \cdot 10^{-290}:\\
\;\;\;\;\frac{\frac{1}{\frac{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{1}}}{\frac{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{c}}\\

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

\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.1991509811871915e+121)) {
		temp = (-0.5 * (c / b_2));
	} else {
		double temp_1;
		if ((b_2 <= -3.4150755057481537e-290)) {
			temp_1 = ((1.0 / (sqrt((sqrt(((b_2 * b_2) - (a * c))) - b_2)) / 1.0)) / (sqrt((sqrt(((b_2 * b_2) - (a * c))) - b_2)) / c));
		} else {
			double temp_2;
			if ((b_2 <= 3.771181145902542e+84)) {
				temp_2 = ((-b_2 - sqrt(((b_2 * b_2) - (a * c)))) * (1.0 / a));
			} 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.1991509811871915e+121

    1. Initial program 60.9

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

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

    if -1.1991509811871915e+121 < b_2 < -3.4150755057481537e-290

    1. Initial program 32.9

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

      \[\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. Simplified15.4

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

      \[\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 *-un-lft-identity15.4

      \[\leadsto \frac{\frac{0 + a \cdot c}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{\color{blue}{1 \cdot a}}\]
    8. Applied associate-/r*15.4

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

      \[\leadsto \frac{\color{blue}{\frac{a}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{c}}}}{a}\]
    10. Using strategy rm
    11. Applied *-un-lft-identity13.7

      \[\leadsto \frac{\frac{a}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{\color{blue}{1 \cdot c}}}}{a}\]
    12. Applied add-sqr-sqrt13.8

      \[\leadsto \frac{\frac{a}{\frac{\color{blue}{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2} \cdot \sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}{1 \cdot c}}}{a}\]
    13. Applied times-frac13.8

      \[\leadsto \frac{\frac{a}{\color{blue}{\frac{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{1} \cdot \frac{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{c}}}}{a}\]
    14. Applied *-un-lft-identity13.8

      \[\leadsto \frac{\frac{\color{blue}{1 \cdot a}}{\frac{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{1} \cdot \frac{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{c}}}{a}\]
    15. Applied times-frac14.5

      \[\leadsto \frac{\color{blue}{\frac{1}{\frac{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{1}} \cdot \frac{a}{\frac{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{c}}}}{a}\]
    16. Applied associate-/l*13.8

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

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

    if -3.4150755057481537e-290 < b_2 < 3.771181145902542e+84

    1. Initial program 10.5

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

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

    if 3.771181145902542e+84 < b_2

    1. Initial program 43.2

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

      \[\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 simplification6.9

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -1.19915098118719145 \cdot 10^{121}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le -3.4150755057481537 \cdot 10^{-290}:\\ \;\;\;\;\frac{\frac{1}{\frac{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{1}}}{\frac{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{c}}\\ \mathbf{elif}\;b_2 \le 3.7711811459025421 \cdot 10^{84}:\\ \;\;\;\;\left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right) \cdot \frac{1}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - 2 \cdot \frac{b_2}{a}\\ \end{array}\]

Reproduce

herbie shell --seed 2020056 
(FPCore (a b_2 c)
  :name "NMSE problem 3.2.1"
  :precision binary64
  (/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))