Average Error: 35.2 → 13.1
Time: 6.3s
Precision: 64
\[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
\[\begin{array}{l} \mathbf{if}\;b \le -1.35706658714402349 \cdot 10^{154}:\\ \;\;\;\;\frac{1.5 \cdot \frac{a \cdot c}{b} - 2 \cdot b}{3 \cdot a}\\ \mathbf{elif}\;b \le 8.712853556825131 \cdot 10^{-110}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\\ \mathbf{elif}\;b \le 1.23006157124891213 \cdot 10^{154}:\\ \;\;\;\;\frac{\frac{\sqrt[3]{0 + 3 \cdot \left(a \cdot c\right)} \cdot \sqrt[3]{0 + 3 \cdot \left(a \cdot c\right)}}{\sqrt[3]{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}} \cdot \sqrt[3]{\left(-b\right) - e^{\log \left(\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}}}}{3} \cdot \frac{\frac{\sqrt[3]{0 + 3 \cdot \left(a \cdot c\right)}}{\sqrt[3]{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1.5 \cdot \frac{a \cdot c}{b}}{3 \cdot a}\\ \end{array}\]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}
\begin{array}{l}
\mathbf{if}\;b \le -1.35706658714402349 \cdot 10^{154}:\\
\;\;\;\;\frac{1.5 \cdot \frac{a \cdot c}{b} - 2 \cdot b}{3 \cdot a}\\

\mathbf{elif}\;b \le 8.712853556825131 \cdot 10^{-110}:\\
\;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\\

\mathbf{elif}\;b \le 1.23006157124891213 \cdot 10^{154}:\\
\;\;\;\;\frac{\frac{\sqrt[3]{0 + 3 \cdot \left(a \cdot c\right)} \cdot \sqrt[3]{0 + 3 \cdot \left(a \cdot c\right)}}{\sqrt[3]{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}} \cdot \sqrt[3]{\left(-b\right) - e^{\log \left(\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}}}}{3} \cdot \frac{\frac{\sqrt[3]{0 + 3 \cdot \left(a \cdot c\right)}}{\sqrt[3]{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}}{a}\\

\mathbf{else}:\\
\;\;\;\;\frac{-1.5 \cdot \frac{a \cdot c}{b}}{3 \cdot a}\\

\end{array}
double code(double a, double b, double c) {
	return ((double) (((double) (((double) -(b)) + ((double) sqrt(((double) (((double) (b * b)) - ((double) (((double) (3.0 * a)) * c)))))))) / ((double) (3.0 * a))));
}
double code(double a, double b, double c) {
	double VAR;
	if ((b <= -1.3570665871440235e+154)) {
		VAR = ((double) (((double) (((double) (1.5 * ((double) (((double) (a * c)) / b)))) - ((double) (2.0 * b)))) / ((double) (3.0 * a))));
	} else {
		double VAR_1;
		if ((b <= 8.71285355682513e-110)) {
			VAR_1 = ((double) (((double) (((double) -(b)) + ((double) sqrt(((double) (((double) (b * b)) - ((double) (((double) (3.0 * a)) * c)))))))) / ((double) (3.0 * a))));
		} else {
			double VAR_2;
			if ((b <= 1.2300615712489121e+154)) {
				VAR_2 = ((double) (((double) (((double) (((double) (((double) cbrt(((double) (0.0 + ((double) (3.0 * ((double) (a * c)))))))) * ((double) cbrt(((double) (0.0 + ((double) (3.0 * ((double) (a * c)))))))))) / ((double) (((double) cbrt(((double) (((double) -(b)) - ((double) sqrt(((double) (((double) (b * b)) - ((double) (((double) (3.0 * a)) * c)))))))))) * ((double) cbrt(((double) (((double) -(b)) - ((double) exp(((double) log(((double) sqrt(((double) (((double) (b * b)) - ((double) (((double) (3.0 * a)) * c)))))))))))))))))) / 3.0)) * ((double) (((double) (((double) cbrt(((double) (0.0 + ((double) (3.0 * ((double) (a * c)))))))) / ((double) cbrt(((double) (((double) -(b)) - ((double) sqrt(((double) (((double) (b * b)) - ((double) (((double) (3.0 * a)) * c)))))))))))) / a))));
			} else {
				VAR_2 = ((double) (((double) (-1.5 * ((double) (((double) (a * c)) / b)))) / ((double) (3.0 * a))));
			}
			VAR_1 = VAR_2;
		}
		VAR = VAR_1;
	}
	return VAR;
}

Error

Bits error versus a

Bits error versus b

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 < -1.3570665871440235e+154

    1. Initial program 64.0

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

      \[\leadsto \frac{\color{blue}{1.5 \cdot \frac{a \cdot c}{b} - 2 \cdot b}}{3 \cdot a}\]

    if -1.3570665871440235e+154 < b < 8.71285355682513e-110

    1. Initial program 12.0

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]

    if 8.71285355682513e-110 < b < 1.2300615712489121e+154

    1. Initial program 44.1

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

      \[\leadsto \frac{\color{blue}{\frac{\left(-b\right) \cdot \left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} \cdot \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}}{3 \cdot a}\]
    4. Simplified15.7

      \[\leadsto \frac{\frac{\color{blue}{0 + 3 \cdot \left(a \cdot c\right)}}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}{3 \cdot a}\]
    5. Using strategy rm
    6. Applied add-cube-cbrt16.2

      \[\leadsto \frac{\frac{0 + 3 \cdot \left(a \cdot c\right)}{\color{blue}{\left(\sqrt[3]{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}} \cdot \sqrt[3]{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}\right) \cdot \sqrt[3]{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}}}{3 \cdot a}\]
    7. Applied add-cube-cbrt16.4

      \[\leadsto \frac{\frac{\color{blue}{\left(\sqrt[3]{0 + 3 \cdot \left(a \cdot c\right)} \cdot \sqrt[3]{0 + 3 \cdot \left(a \cdot c\right)}\right) \cdot \sqrt[3]{0 + 3 \cdot \left(a \cdot c\right)}}}{\left(\sqrt[3]{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}} \cdot \sqrt[3]{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}\right) \cdot \sqrt[3]{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}}{3 \cdot a}\]
    8. Applied times-frac16.4

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

      \[\leadsto \color{blue}{\frac{\frac{\sqrt[3]{0 + 3 \cdot \left(a \cdot c\right)} \cdot \sqrt[3]{0 + 3 \cdot \left(a \cdot c\right)}}{\sqrt[3]{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}} \cdot \sqrt[3]{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}}{3} \cdot \frac{\frac{\sqrt[3]{0 + 3 \cdot \left(a \cdot c\right)}}{\sqrt[3]{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}}{a}}\]
    10. Using strategy rm
    11. Applied add-exp-log14.8

      \[\leadsto \frac{\frac{\sqrt[3]{0 + 3 \cdot \left(a \cdot c\right)} \cdot \sqrt[3]{0 + 3 \cdot \left(a \cdot c\right)}}{\sqrt[3]{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}} \cdot \sqrt[3]{\left(-b\right) - \color{blue}{e^{\log \left(\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}}}}}{3} \cdot \frac{\frac{\sqrt[3]{0 + 3 \cdot \left(a \cdot c\right)}}{\sqrt[3]{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}}{a}\]

    if 1.2300615712489121e+154 < b

    1. Initial program 64.0

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

      \[\leadsto \frac{\color{blue}{-1.5 \cdot \frac{a \cdot c}{b}}}{3 \cdot a}\]
  3. Recombined 4 regimes into one program.
  4. Final simplification13.1

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -1.35706658714402349 \cdot 10^{154}:\\ \;\;\;\;\frac{1.5 \cdot \frac{a \cdot c}{b} - 2 \cdot b}{3 \cdot a}\\ \mathbf{elif}\;b \le 8.712853556825131 \cdot 10^{-110}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\\ \mathbf{elif}\;b \le 1.23006157124891213 \cdot 10^{154}:\\ \;\;\;\;\frac{\frac{\sqrt[3]{0 + 3 \cdot \left(a \cdot c\right)} \cdot \sqrt[3]{0 + 3 \cdot \left(a \cdot c\right)}}{\sqrt[3]{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}} \cdot \sqrt[3]{\left(-b\right) - e^{\log \left(\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}}}}{3} \cdot \frac{\frac{\sqrt[3]{0 + 3 \cdot \left(a \cdot c\right)}}{\sqrt[3]{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1.5 \cdot \frac{a \cdot c}{b}}{3 \cdot a}\\ \end{array}\]

Reproduce

herbie shell --seed 2020123 
(FPCore (a b c)
  :name "Cubic critical"
  :precision binary64
  (/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a)))