Average Error: 34.2 → 12.5
Time: 5.1s
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.5812949048043538 \cdot 10^{-96}:\\ \;\;\;\;\frac{1.5 \cdot \frac{a \cdot c}{b} - 2 \cdot b}{3 \cdot a}\\ \mathbf{elif}\;b \le 5.486208249157789 \cdot 10^{124}:\\ \;\;\;\;\frac{1}{\frac{1}{\frac{c}{1}} \cdot \left(\left(-b\right) - \sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{1}{\frac{c}{1}} \cdot \left(\left(-b\right) - \left(b - 1.5 \cdot \frac{a \cdot c}{b}\right)\right)}\\ \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.5812949048043538 \cdot 10^{-96}:\\
\;\;\;\;\frac{1.5 \cdot \frac{a \cdot c}{b} - 2 \cdot b}{3 \cdot a}\\

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

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

\end{array}
double f(double a, double b, double c) {
        double r89980 = b;
        double r89981 = -r89980;
        double r89982 = r89980 * r89980;
        double r89983 = 3.0;
        double r89984 = a;
        double r89985 = r89983 * r89984;
        double r89986 = c;
        double r89987 = r89985 * r89986;
        double r89988 = r89982 - r89987;
        double r89989 = sqrt(r89988);
        double r89990 = r89981 + r89989;
        double r89991 = r89990 / r89985;
        return r89991;
}

double f(double a, double b, double c) {
        double r89992 = b;
        double r89993 = -3.581294904804354e-96;
        bool r89994 = r89992 <= r89993;
        double r89995 = 1.5;
        double r89996 = a;
        double r89997 = c;
        double r89998 = r89996 * r89997;
        double r89999 = r89998 / r89992;
        double r90000 = r89995 * r89999;
        double r90001 = 2.0;
        double r90002 = r90001 * r89992;
        double r90003 = r90000 - r90002;
        double r90004 = 3.0;
        double r90005 = r90004 * r89996;
        double r90006 = r90003 / r90005;
        double r90007 = 5.486208249157789e+124;
        bool r90008 = r89992 <= r90007;
        double r90009 = 1.0;
        double r90010 = r89997 / r90009;
        double r90011 = r90009 / r90010;
        double r90012 = -r89992;
        double r90013 = r89992 * r89992;
        double r90014 = r90004 * r89998;
        double r90015 = r90013 - r90014;
        double r90016 = sqrt(r90015);
        double r90017 = r90012 - r90016;
        double r90018 = r90011 * r90017;
        double r90019 = r90009 / r90018;
        double r90020 = r89992 - r90000;
        double r90021 = r90012 - r90020;
        double r90022 = r90011 * r90021;
        double r90023 = r90009 / r90022;
        double r90024 = r90008 ? r90019 : r90023;
        double r90025 = r89994 ? r90006 : r90024;
        return r90025;
}

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 3 regimes
  2. if b < -3.581294904804354e-96

    1. Initial program 26.0

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

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

    if -3.581294904804354e-96 < b < 5.486208249157789e+124

    1. Initial program 27.9

      \[\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-+29.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. Simplified17.4

      \[\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 *-un-lft-identity17.4

      \[\leadsto \frac{\frac{0 + 3 \cdot \left(a \cdot c\right)}{\color{blue}{1 \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}}}{3 \cdot a}\]
    7. Applied *-un-lft-identity17.4

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

      \[\leadsto \frac{\color{blue}{\frac{1}{1} \cdot \frac{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}\]
    9. Applied associate-/l*17.6

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

      \[\leadsto \frac{\frac{1}{1}}{\color{blue}{\frac{3 \cdot a}{3 \cdot \left(a \cdot c\right)} \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}}\]
    11. Using strategy rm
    12. Applied clear-num16.9

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

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

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

    if 5.486208249157789e+124 < b

    1. Initial program 61.3

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

      \[\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. Simplified33.3

      \[\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 *-un-lft-identity33.3

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

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

      \[\leadsto \frac{\color{blue}{\frac{1}{1} \cdot \frac{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}\]
    9. Applied associate-/l*33.4

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

      \[\leadsto \frac{\frac{1}{1}}{\color{blue}{\frac{3 \cdot a}{3 \cdot \left(a \cdot c\right)} \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}}\]
    11. Using strategy rm
    12. Applied clear-num32.6

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -3.5812949048043538 \cdot 10^{-96}:\\ \;\;\;\;\frac{1.5 \cdot \frac{a \cdot c}{b} - 2 \cdot b}{3 \cdot a}\\ \mathbf{elif}\;b \le 5.486208249157789 \cdot 10^{124}:\\ \;\;\;\;\frac{1}{\frac{1}{\frac{c}{1}} \cdot \left(\left(-b\right) - \sqrt{b \cdot b - 3 \cdot \left(a \cdot c\right)}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{1}{\frac{c}{1}} \cdot \left(\left(-b\right) - \left(b - 1.5 \cdot \frac{a \cdot c}{b}\right)\right)}\\ \end{array}\]

Reproduce

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