Average Error: 34.2 → 7.9
Time: 7.8s
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 -4.06002386255704936 \cdot 10^{127}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - 2 \cdot \frac{b_2}{a}\\ \mathbf{elif}\;b_2 \le 9.074871364580517 \cdot 10^{-259}:\\ \;\;\;\;\frac{1}{\frac{a}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}\\ \mathbf{elif}\;b_2 \le 2.35728636717399296 \cdot 10^{-31}:\\ \;\;\;\;\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{\left(\sqrt[3]{a} \cdot \sqrt[3]{a}\right) \cdot \frac{1}{\sqrt[3]{a} \cdot \sqrt[3]{a}}} \cdot \frac{\frac{\sqrt[3]{1}}{\frac{\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{\sqrt[3]{a}}}{c}}}{\sqrt[3]{a}}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \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 -4.06002386255704936 \cdot 10^{127}:\\
\;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - 2 \cdot \frac{b_2}{a}\\

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

\mathbf{elif}\;b_2 \le 2.35728636717399296 \cdot 10^{-31}:\\
\;\;\;\;\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{\left(\sqrt[3]{a} \cdot \sqrt[3]{a}\right) \cdot \frac{1}{\sqrt[3]{a} \cdot \sqrt[3]{a}}} \cdot \frac{\frac{\sqrt[3]{1}}{\frac{\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{\sqrt[3]{a}}}{c}}}{\sqrt[3]{a}}\\

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

\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 <= -4.0600238625570494e+127)) {
		temp = ((0.5 * (c / b_2)) - (2.0 * (b_2 / a)));
	} else {
		double temp_1;
		if ((b_2 <= 9.074871364580517e-259)) {
			temp_1 = (1.0 / (a / (sqrt(((b_2 * b_2) - (a * c))) - b_2)));
		} else {
			double temp_2;
			if ((b_2 <= 2.357286367173993e-31)) {
				temp_2 = (((cbrt(1.0) * cbrt(1.0)) / ((cbrt(a) * cbrt(a)) * (1.0 / (cbrt(a) * cbrt(a))))) * ((cbrt(1.0) / (((-b_2 - sqrt(((b_2 * b_2) - (a * c)))) / cbrt(a)) / c)) / cbrt(a)));
			} else {
				temp_2 = (-0.5 * (c / b_2));
			}
			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 < -4.0600238625570494e+127

    1. Initial program 54.1

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

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

    if -4.0600238625570494e+127 < b_2 < 9.074871364580517e-259

    1. Initial program 9.0

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

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

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

    if 9.074871364580517e-259 < b_2 < 2.357286367173993e-31

    1. Initial program 25.5

      \[\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Using strategy rm
    3. Applied flip-+25.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. Simplified17.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. Using strategy rm
    6. Applied clear-num17.9

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

      \[\leadsto \frac{\frac{1}{\color{blue}{\frac{\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}}{c}}}}{a}\]
    8. Using strategy rm
    9. Applied add-cube-cbrt15.2

      \[\leadsto \frac{\frac{1}{\frac{\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}}{c}}}{\color{blue}{\left(\sqrt[3]{a} \cdot \sqrt[3]{a}\right) \cdot \sqrt[3]{a}}}\]
    10. Applied *-un-lft-identity15.2

      \[\leadsto \frac{\frac{1}{\frac{\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}}{\color{blue}{1 \cdot c}}}}{\left(\sqrt[3]{a} \cdot \sqrt[3]{a}\right) \cdot \sqrt[3]{a}}\]
    11. Applied add-cube-cbrt14.4

      \[\leadsto \frac{\frac{1}{\frac{\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{\color{blue}{\left(\sqrt[3]{a} \cdot \sqrt[3]{a}\right) \cdot \sqrt[3]{a}}}}{1 \cdot c}}}{\left(\sqrt[3]{a} \cdot \sqrt[3]{a}\right) \cdot \sqrt[3]{a}}\]
    12. Applied *-un-lft-identity14.4

      \[\leadsto \frac{\frac{1}{\frac{\frac{\color{blue}{1 \cdot \left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right)}}{\left(\sqrt[3]{a} \cdot \sqrt[3]{a}\right) \cdot \sqrt[3]{a}}}{1 \cdot c}}}{\left(\sqrt[3]{a} \cdot \sqrt[3]{a}\right) \cdot \sqrt[3]{a}}\]
    13. Applied times-frac14.5

      \[\leadsto \frac{\frac{1}{\frac{\color{blue}{\frac{1}{\sqrt[3]{a} \cdot \sqrt[3]{a}} \cdot \frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{\sqrt[3]{a}}}}{1 \cdot c}}}{\left(\sqrt[3]{a} \cdot \sqrt[3]{a}\right) \cdot \sqrt[3]{a}}\]
    14. Applied times-frac14.5

      \[\leadsto \frac{\frac{1}{\color{blue}{\frac{\frac{1}{\sqrt[3]{a} \cdot \sqrt[3]{a}}}{1} \cdot \frac{\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{\sqrt[3]{a}}}{c}}}}{\left(\sqrt[3]{a} \cdot \sqrt[3]{a}\right) \cdot \sqrt[3]{a}}\]
    15. Applied add-cube-cbrt14.5

      \[\leadsto \frac{\frac{\color{blue}{\left(\sqrt[3]{1} \cdot \sqrt[3]{1}\right) \cdot \sqrt[3]{1}}}{\frac{\frac{1}{\sqrt[3]{a} \cdot \sqrt[3]{a}}}{1} \cdot \frac{\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{\sqrt[3]{a}}}{c}}}{\left(\sqrt[3]{a} \cdot \sqrt[3]{a}\right) \cdot \sqrt[3]{a}}\]
    16. Applied times-frac14.4

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

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

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

    if 2.357286367173993e-31 < b_2

    1. Initial program 55.3

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -4.06002386255704936 \cdot 10^{127}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - 2 \cdot \frac{b_2}{a}\\ \mathbf{elif}\;b_2 \le 9.074871364580517 \cdot 10^{-259}:\\ \;\;\;\;\frac{1}{\frac{a}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}\\ \mathbf{elif}\;b_2 \le 2.35728636717399296 \cdot 10^{-31}:\\ \;\;\;\;\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{\left(\sqrt[3]{a} \cdot \sqrt[3]{a}\right) \cdot \frac{1}{\sqrt[3]{a} \cdot \sqrt[3]{a}}} \cdot \frac{\frac{\sqrt[3]{1}}{\frac{\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{\sqrt[3]{a}}}{c}}}{\sqrt[3]{a}}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \end{array}\]

Reproduce

herbie shell --seed 2020056 +o rules:numerics
(FPCore (a b_2 c)
  :name "quad2p (problem 3.2.1, positive)"
  :precision binary64
  (/ (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))