Average Error: 34.3 → 8.2
Time: 5.0s
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 -8.95823697967250448 \cdot 10^{-5}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le -1.68158170222110598 \cdot 10^{-276}:\\ \;\;\;\;1 \cdot \frac{1 \cdot \frac{a}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{c}}}{a}\\ \mathbf{elif}\;b_2 \le 1.38731738723855584 \cdot 10^{50}:\\ \;\;\;\;1 \cdot \frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{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 -8.95823697967250448 \cdot 10^{-5}:\\
\;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\

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

\mathbf{elif}\;b_2 \le 1.38731738723855584 \cdot 10^{50}:\\
\;\;\;\;1 \cdot \frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{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 ((double) (((double) (((double) -(b_2)) - ((double) sqrt(((double) (((double) (b_2 * b_2)) - ((double) (a * c)))))))) / a));
}
double code(double a, double b_2, double c) {
	double VAR;
	if ((b_2 <= -8.958236979672504e-05)) {
		VAR = ((double) (-0.5 * ((double) (c / b_2))));
	} else {
		double VAR_1;
		if ((b_2 <= -1.681581702221106e-276)) {
			VAR_1 = ((double) (1.0 * ((double) (((double) (1.0 * ((double) (a / ((double) (((double) (((double) sqrt(((double) (((double) (b_2 * b_2)) - ((double) (a * c)))))) - b_2)) / c)))))) / a))));
		} else {
			double VAR_2;
			if ((b_2 <= 1.3873173872385558e+50)) {
				VAR_2 = ((double) (1.0 * ((double) (((double) (((double) -(b_2)) - ((double) sqrt(((double) (((double) (b_2 * b_2)) - ((double) (a * c)))))))) / a))));
			} else {
				VAR_2 = ((double) (((double) (0.5 * ((double) (c / b_2)))) - ((double) (2.0 * ((double) (b_2 / a))))));
			}
			VAR_1 = VAR_2;
		}
		VAR = VAR_1;
	}
	return VAR;
}

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 < -8.958236979672504e-05

    1. Initial program 56.2

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

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

    if -8.958236979672504e-05 < b_2 < -1.681581702221106e-276

    1. Initial program 26.2

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

      \[\leadsto \color{blue}{\frac{1}{\frac{a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}}\]
    4. Using strategy rm
    5. Applied *-un-lft-identity26.3

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

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

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

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

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

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

      \[\leadsto 1 \cdot \color{blue}{\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}}\]
    12. Using strategy rm
    13. Applied flip--26.2

      \[\leadsto 1 \cdot \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}\]
    14. Simplified16.7

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

      \[\leadsto 1 \cdot \frac{\frac{0 + a \cdot c}{\color{blue}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}{a}\]
    16. Using strategy rm
    17. Applied *-un-lft-identity16.7

      \[\leadsto 1 \cdot \frac{\frac{0 + a \cdot c}{\color{blue}{1 \cdot \left(\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2\right)}}}{a}\]
    18. Applied *-un-lft-identity16.7

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

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

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

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

    if -1.681581702221106e-276 < b_2 < 1.3873173872385558e+50

    1. Initial program 10.1

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

      \[\leadsto \color{blue}{\frac{1}{\frac{a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}}\]
    4. Using strategy rm
    5. Applied *-un-lft-identity10.3

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

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

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

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

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

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

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

    if 1.3873173872385558e+50 < b_2

    1. Initial program 37.3

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

      \[\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 simplification8.2

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -8.95823697967250448 \cdot 10^{-5}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le -1.68158170222110598 \cdot 10^{-276}:\\ \;\;\;\;1 \cdot \frac{1 \cdot \frac{a}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{c}}}{a}\\ \mathbf{elif}\;b_2 \le 1.38731738723855584 \cdot 10^{50}:\\ \;\;\;\;1 \cdot \frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - 2 \cdot \frac{b_2}{a}\\ \end{array}\]

Reproduce

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