Average Error: 33.8 → 8.8
Time: 17.2s
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 -3.56950087216670373 \cdot 10^{75}:\\ \;\;\;\;0.5 \cdot \frac{c}{b} - 0.66666666666666663 \cdot \frac{b}{a}\\ \mathbf{elif}\;b \le -7.69176766011856365 \cdot 10^{-301}:\\ \;\;\;\;\frac{\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{3}}{a}\\ \mathbf{elif}\;b \le 1.958082194924451 \cdot 10^{133}:\\ \;\;\;\;\frac{\frac{\left(3 \cdot a\right) \cdot \frac{c}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}{3}}{a}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b}\\ \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 -3.56950087216670373 \cdot 10^{75}:\\
\;\;\;\;0.5 \cdot \frac{c}{b} - 0.66666666666666663 \cdot \frac{b}{a}\\

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

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

\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\

\end{array}
double f(double a, double b, double c) {
        double r99712 = b;
        double r99713 = -r99712;
        double r99714 = r99712 * r99712;
        double r99715 = 3.0;
        double r99716 = a;
        double r99717 = r99715 * r99716;
        double r99718 = c;
        double r99719 = r99717 * r99718;
        double r99720 = r99714 - r99719;
        double r99721 = sqrt(r99720);
        double r99722 = r99713 + r99721;
        double r99723 = r99722 / r99717;
        return r99723;
}

double f(double a, double b, double c) {
        double r99724 = b;
        double r99725 = -3.5695008721667037e+75;
        bool r99726 = r99724 <= r99725;
        double r99727 = 0.5;
        double r99728 = c;
        double r99729 = r99728 / r99724;
        double r99730 = r99727 * r99729;
        double r99731 = 0.6666666666666666;
        double r99732 = a;
        double r99733 = r99724 / r99732;
        double r99734 = r99731 * r99733;
        double r99735 = r99730 - r99734;
        double r99736 = -7.691767660118564e-301;
        bool r99737 = r99724 <= r99736;
        double r99738 = r99724 * r99724;
        double r99739 = 3.0;
        double r99740 = r99739 * r99732;
        double r99741 = r99740 * r99728;
        double r99742 = r99738 - r99741;
        double r99743 = sqrt(r99742);
        double r99744 = r99743 - r99724;
        double r99745 = r99744 / r99739;
        double r99746 = r99745 / r99732;
        double r99747 = 1.958082194924451e+133;
        bool r99748 = r99724 <= r99747;
        double r99749 = -r99724;
        double r99750 = r99749 - r99743;
        double r99751 = r99728 / r99750;
        double r99752 = r99740 * r99751;
        double r99753 = r99752 / r99739;
        double r99754 = r99753 / r99732;
        double r99755 = -0.5;
        double r99756 = r99755 * r99729;
        double r99757 = r99748 ? r99754 : r99756;
        double r99758 = r99737 ? r99746 : r99757;
        double r99759 = r99726 ? r99735 : r99758;
        return r99759;
}

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 < -3.5695008721667037e+75

    1. Initial program 42.2

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

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

    if -3.5695008721667037e+75 < b < -7.691767660118564e-301

    1. Initial program 9.4

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

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

    if -7.691767660118564e-301 < b < 1.958082194924451e+133

    1. Initial program 33.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-+33.2

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

      \[\leadsto \frac{\frac{\color{blue}{0 + \left(3 \cdot a\right) \cdot c}}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}{3 \cdot a}\]
    5. Using strategy rm
    6. Applied associate-/r*16.6

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

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

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

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

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

    if 1.958082194924451e+133 < b

    1. Initial program 61.9

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

      \[\leadsto \color{blue}{-0.5 \cdot \frac{c}{b}}\]
  3. Recombined 4 regimes into one program.
  4. Final simplification8.8

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -3.56950087216670373 \cdot 10^{75}:\\ \;\;\;\;0.5 \cdot \frac{c}{b} - 0.66666666666666663 \cdot \frac{b}{a}\\ \mathbf{elif}\;b \le -7.69176766011856365 \cdot 10^{-301}:\\ \;\;\;\;\frac{\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{3}}{a}\\ \mathbf{elif}\;b \le 1.958082194924451 \cdot 10^{133}:\\ \;\;\;\;\frac{\frac{\left(3 \cdot a\right) \cdot \frac{c}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}{3}}{a}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b}\\ \end{array}\]

Reproduce

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