Average Error: 34.7 → 6.6
Time: 5.1s
Precision: binary64
\[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
\[\begin{array}{l} \mathbf{if}\;b \leq -6.845054683259517 \cdot 10^{+108}:\\ \;\;\;\;\frac{c}{b} \cdot 0.5 - 0.6666666666666666 \cdot \frac{b}{a}\\ \mathbf{elif}\;b \leq -2.3344782568300924 \cdot 10^{-237}:\\ \;\;\;\;\frac{\sqrt{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}}{a \cdot \frac{3}{\sqrt{\sqrt{b \cdot b - 3 \cdot \left(c \cdot a\right)} - b}}}\\ \mathbf{elif}\;b \leq 1.100584786088886 \cdot 10^{+102}:\\ \;\;\;\;\frac{c}{\left(-b\right) - \sqrt{b \cdot b - \left(\sqrt[3]{3} \cdot \sqrt[3]{3}\right) \cdot \left(a \cdot \left(c \cdot \sqrt[3]{3}\right)\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{1.5 \cdot \left(c \cdot \frac{a}{b}\right) + b \cdot -2}\\ \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 \leq -6.845054683259517 \cdot 10^{+108}:\\
\;\;\;\;\frac{c}{b} \cdot 0.5 - 0.6666666666666666 \cdot \frac{b}{a}\\

\mathbf{elif}\;b \leq -2.3344782568300924 \cdot 10^{-237}:\\
\;\;\;\;\frac{\sqrt{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}}{a \cdot \frac{3}{\sqrt{\sqrt{b \cdot b - 3 \cdot \left(c \cdot a\right)} - b}}}\\

\mathbf{elif}\;b \leq 1.100584786088886 \cdot 10^{+102}:\\
\;\;\;\;\frac{c}{\left(-b\right) - \sqrt{b \cdot b - \left(\sqrt[3]{3} \cdot \sqrt[3]{3}\right) \cdot \left(a \cdot \left(c \cdot \sqrt[3]{3}\right)\right)}}\\

\mathbf{else}:\\
\;\;\;\;\frac{c}{1.5 \cdot \left(c \cdot \frac{a}{b}\right) + b \cdot -2}\\

\end{array}
double code(double a, double b, double c) {
	return (((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 <= -6.845054683259517e+108)) {
		VAR = ((double) (((double) ((c / b) * 0.5)) - ((double) (0.6666666666666666 * (b / a)))));
	} else {
		double VAR_1;
		if ((b <= -2.3344782568300924e-237)) {
			VAR_1 = (((double) sqrt(((double) (((double) sqrt(((double) (((double) (b * b)) - ((double) (c * ((double) (a * 3.0)))))))) - b)))) / ((double) (a * (3.0 / ((double) sqrt(((double) (((double) sqrt(((double) (((double) (b * b)) - ((double) (3.0 * ((double) (c * a)))))))) - b))))))));
		} else {
			double VAR_2;
			if ((b <= 1.100584786088886e+102)) {
				VAR_2 = (c / ((double) (((double) -(b)) - ((double) sqrt(((double) (((double) (b * b)) - ((double) (((double) (((double) cbrt(3.0)) * ((double) cbrt(3.0)))) * ((double) (a * ((double) (c * ((double) cbrt(3.0)))))))))))))));
			} else {
				VAR_2 = (c / ((double) (((double) (1.5 * ((double) (c * (a / b))))) + ((double) (b * -2.0)))));
			}
			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 < -6.84505468325951721e108

    1. Initial program 49.4

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

      \[\leadsto \color{blue}{0.5 \cdot \frac{c}{b} - 0.6666666666666666 \cdot \frac{b}{a}}\]
    3. Simplified3.2

      \[\leadsto \color{blue}{\frac{c}{b} \cdot 0.5 - 0.6666666666666666 \cdot \frac{b}{a}}\]

    if -6.84505468325951721e108 < b < -2.33447825683009239e-237

    1. Initial program 8.2

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

      \[\leadsto \frac{\color{blue}{\sqrt{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}} \cdot \sqrt{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}}{3 \cdot a}\]
    4. Applied associate-/l*8.5

      \[\leadsto \color{blue}{\frac{\sqrt{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}{\frac{3 \cdot a}{\sqrt{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}}}\]
    5. Simplified8.5

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

    if -2.33447825683009239e-237 < b < 1.100584786088886e102

    1. Initial program 31.7

      \[\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-+31.8

      \[\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. Simplified16.6

      \[\leadsto \frac{\frac{\color{blue}{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. Simplified16.5

      \[\leadsto \frac{\frac{3 \cdot \left(a \cdot c\right)}{\color{blue}{\left(-b\right) - \sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)}}}}{3 \cdot a}\]
    6. Using strategy rm
    7. Applied *-un-lft-identity16.5

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

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

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

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

      \[\leadsto 1 \cdot \color{blue}{\left(1 \cdot \frac{c}{\left(-b\right) - \sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)}}\right)}\]
    12. Using strategy rm
    13. Applied add-cube-cbrt9.5

      \[\leadsto 1 \cdot \left(1 \cdot \frac{c}{\left(-b\right) - \sqrt{b \cdot b - \color{blue}{\left(\left(\sqrt[3]{3} \cdot \sqrt[3]{3}\right) \cdot \sqrt[3]{3}\right)} \cdot \left(a \cdot c\right)}}\right)\]
    14. Applied associate-*l*9.5

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

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

    if 1.100584786088886e102 < b

    1. Initial program 59.6

      \[\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-+59.6

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

      \[\leadsto \frac{\frac{\color{blue}{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. Simplified32.1

      \[\leadsto \frac{\frac{3 \cdot \left(a \cdot c\right)}{\color{blue}{\left(-b\right) - \sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)}}}}{3 \cdot a}\]
    6. Using strategy rm
    7. Applied *-un-lft-identity32.1

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

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

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

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

      \[\leadsto 1 \cdot \color{blue}{\left(1 \cdot \frac{c}{\left(-b\right) - \sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)}}\right)}\]
    12. Taylor expanded around inf 6.6

      \[\leadsto 1 \cdot \left(1 \cdot \frac{c}{\color{blue}{1.5 \cdot \frac{a \cdot c}{b} - 2 \cdot b}}\right)\]
    13. Simplified2.3

      \[\leadsto 1 \cdot \left(1 \cdot \frac{c}{\color{blue}{1.5 \cdot \left(c \cdot \frac{a}{b}\right) + b \cdot -2}}\right)\]
  3. Recombined 4 regimes into one program.
  4. Final simplification6.6

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -6.845054683259517 \cdot 10^{+108}:\\ \;\;\;\;\frac{c}{b} \cdot 0.5 - 0.6666666666666666 \cdot \frac{b}{a}\\ \mathbf{elif}\;b \leq -2.3344782568300924 \cdot 10^{-237}:\\ \;\;\;\;\frac{\sqrt{\sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - b}}{a \cdot \frac{3}{\sqrt{\sqrt{b \cdot b - 3 \cdot \left(c \cdot a\right)} - b}}}\\ \mathbf{elif}\;b \leq 1.100584786088886 \cdot 10^{+102}:\\ \;\;\;\;\frac{c}{\left(-b\right) - \sqrt{b \cdot b - \left(\sqrt[3]{3} \cdot \sqrt[3]{3}\right) \cdot \left(a \cdot \left(c \cdot \sqrt[3]{3}\right)\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{1.5 \cdot \left(c \cdot \frac{a}{b}\right) + b \cdot -2}\\ \end{array}\]

Reproduce

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