Average Error: 33.7 → 8.7
Time: 2.0m
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.8085485579241775 \cdot 10^{39}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le 2.7444235711350233 \cdot 10^{-95}:\\ \;\;\;\;\frac{\frac{\sqrt[3]{1} \cdot \left(\sqrt[3]{1} \cdot a\right)}{1} \cdot \left(\sqrt[3]{1} \cdot \frac{c}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}\right)}{a}\\ \mathbf{elif}\;b_2 \le 7.3698697747524969 \cdot 10^{119}:\\ \;\;\;\;\frac{1}{\frac{a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{-2 \cdot 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 -4.8085485579241775 \cdot 10^{39}:\\
\;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\

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

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

\mathbf{else}:\\
\;\;\;\;\frac{-2 \cdot 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 <= -4.8085485579241775e+39)) {
		temp = (-0.5 * (c / b_2));
	} else {
		double temp_1;
		if ((b_2 <= 2.7444235711350233e-95)) {
			temp_1 = ((((cbrt(1.0) * (cbrt(1.0) * a)) / 1.0) * (cbrt(1.0) * (c / (sqrt(((b_2 * b_2) - (a * c))) - b_2)))) / a);
		} else {
			double temp_2;
			if ((b_2 <= 7.369869774752497e+119)) {
				temp_2 = (1.0 / (a / (-b_2 - sqrt(((b_2 * b_2) - (a * c))))));
			} else {
				temp_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 < -4.8085485579241775e+39

    1. Initial program 57.2

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

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

    if -4.8085485579241775e+39 < b_2 < 2.7444235711350233e-95

    1. Initial program 23.1

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

      \[\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.8

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

      \[\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-sqr-sqrt18.1

      \[\leadsto \frac{\frac{0 + a \cdot c}{\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}}}}{a}\]
    8. Applied *-un-lft-identity18.1

      \[\leadsto \frac{\frac{\color{blue}{1 \cdot \left(0 + a \cdot c\right)}}{\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}}}{a}\]
    9. Applied times-frac18.1

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

      \[\leadsto \frac{\frac{1}{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}} \cdot \color{blue}{\frac{a}{\frac{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{c}}}}{a}\]
    11. Using strategy rm
    12. Applied add-cube-cbrt17.1

      \[\leadsto \frac{\frac{\color{blue}{\left(\sqrt[3]{1} \cdot \sqrt[3]{1}\right) \cdot \sqrt[3]{1}}}{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}} \cdot \frac{a}{\frac{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{c}}}{a}\]
    13. Applied associate-/l*17.1

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

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

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

      \[\leadsto \frac{\frac{\sqrt[3]{1} \cdot \left(\sqrt[3]{1} \cdot a\right)}{\color{blue}{\frac{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{c}}{\sqrt[3]{1}}}}}{a}\]
    17. Using strategy rm
    18. Applied clear-num15.9

      \[\leadsto \frac{\frac{\sqrt[3]{1} \cdot \left(\sqrt[3]{1} \cdot a\right)}{\frac{\color{blue}{\frac{1}{\frac{c}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}}{\sqrt[3]{1}}}}{a}\]
    19. Applied associate-/l/15.9

      \[\leadsto \frac{\frac{\sqrt[3]{1} \cdot \left(\sqrt[3]{1} \cdot a\right)}{\color{blue}{\frac{1}{\sqrt[3]{1} \cdot \frac{c}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}}}{a}\]
    20. Applied associate-/r/15.8

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

    if 2.7444235711350233e-95 < b_2 < 7.369869774752497e+119

    1. Initial program 5.3

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

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

    if 7.369869774752497e+119 < b_2

    1. Initial program 51.9

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

      \[\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. Simplified62.8

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

      \[\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-sqr-sqrt62.8

      \[\leadsto \frac{\frac{0 + a \cdot c}{\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}}}}{a}\]
    8. Applied *-un-lft-identity62.8

      \[\leadsto \frac{\frac{\color{blue}{1 \cdot \left(0 + a \cdot c\right)}}{\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}}}{a}\]
    9. Applied times-frac62.8

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

      \[\leadsto \frac{\frac{1}{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}} \cdot \color{blue}{\frac{a}{\frac{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{c}}}}{a}\]
    11. Using strategy rm
    12. Applied add-cube-cbrt62.7

      \[\leadsto \frac{\frac{\color{blue}{\left(\sqrt[3]{1} \cdot \sqrt[3]{1}\right) \cdot \sqrt[3]{1}}}{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}} \cdot \frac{a}{\frac{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{c}}}{a}\]
    13. Applied associate-/l*62.7

      \[\leadsto \frac{\color{blue}{\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{\frac{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{\sqrt[3]{1}}}} \cdot \frac{a}{\frac{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{c}}}{a}\]
    14. Applied frac-times62.7

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

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

      \[\leadsto \frac{\frac{\sqrt[3]{1} \cdot \left(\sqrt[3]{1} \cdot a\right)}{\color{blue}{\frac{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{c}}{\sqrt[3]{1}}}}}{a}\]
    17. Taylor expanded around 0 2.4

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -4.8085485579241775 \cdot 10^{39}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le 2.7444235711350233 \cdot 10^{-95}:\\ \;\;\;\;\frac{\frac{\sqrt[3]{1} \cdot \left(\sqrt[3]{1} \cdot a\right)}{1} \cdot \left(\sqrt[3]{1} \cdot \frac{c}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}\right)}{a}\\ \mathbf{elif}\;b_2 \le 7.3698697747524969 \cdot 10^{119}:\\ \;\;\;\;\frac{1}{\frac{a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{-2 \cdot b_2}{a}\\ \end{array}\]

Reproduce

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