Average Error: 34.0 → 8.3
Time: 5.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 -1.1214182120130159 \cdot 10^{148}:\\ \;\;\;\;\frac{\left(-b\right) + \left(1.5 \cdot \frac{a \cdot c}{b} - b\right)}{3 \cdot a}\\ \mathbf{elif}\;b \le -1.7247047038424937 \cdot 10^{-216}:\\ \;\;\;\;\frac{\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}\\ \mathbf{elif}\;b \le 4.3957752798560445 \cdot 10^{108}:\\ \;\;\;\;\frac{1}{1 \cdot \frac{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{-2 \cdot \frac{b}{c}}\\ \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.1214182120130159 \cdot 10^{148}:\\
\;\;\;\;\frac{\left(-b\right) + \left(1.5 \cdot \frac{a \cdot c}{b} - b\right)}{3 \cdot a}\\

\mathbf{elif}\;b \le -1.7247047038424937 \cdot 10^{-216}:\\
\;\;\;\;\frac{\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}\\

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

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

\end{array}
double f(double a, double b, double c) {
        double r105253 = b;
        double r105254 = -r105253;
        double r105255 = r105253 * r105253;
        double r105256 = 3.0;
        double r105257 = a;
        double r105258 = r105256 * r105257;
        double r105259 = c;
        double r105260 = r105258 * r105259;
        double r105261 = r105255 - r105260;
        double r105262 = sqrt(r105261);
        double r105263 = r105254 + r105262;
        double r105264 = r105263 / r105258;
        return r105264;
}

double f(double a, double b, double c) {
        double r105265 = b;
        double r105266 = -1.1214182120130159e+148;
        bool r105267 = r105265 <= r105266;
        double r105268 = -r105265;
        double r105269 = 1.5;
        double r105270 = a;
        double r105271 = c;
        double r105272 = r105270 * r105271;
        double r105273 = r105272 / r105265;
        double r105274 = r105269 * r105273;
        double r105275 = r105274 - r105265;
        double r105276 = r105268 + r105275;
        double r105277 = 3.0;
        double r105278 = r105277 * r105270;
        double r105279 = r105276 / r105278;
        double r105280 = -1.7247047038424937e-216;
        bool r105281 = r105265 <= r105280;
        double r105282 = r105265 * r105265;
        double r105283 = r105278 * r105271;
        double r105284 = r105282 - r105283;
        double r105285 = sqrt(r105284);
        double r105286 = r105268 + r105285;
        double r105287 = cbrt(r105286);
        double r105288 = r105287 * r105287;
        double r105289 = r105288 * r105287;
        double r105290 = r105289 / r105278;
        double r105291 = 4.3957752798560445e+108;
        bool r105292 = r105265 <= r105291;
        double r105293 = 1.0;
        double r105294 = 1.0;
        double r105295 = r105268 - r105285;
        double r105296 = r105295 / r105271;
        double r105297 = r105294 * r105296;
        double r105298 = r105293 / r105297;
        double r105299 = -2.0;
        double r105300 = r105265 / r105271;
        double r105301 = r105299 * r105300;
        double r105302 = r105293 / r105301;
        double r105303 = r105292 ? r105298 : r105302;
        double r105304 = r105281 ? r105290 : r105303;
        double r105305 = r105267 ? r105279 : r105304;
        return r105305;
}

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.1214182120130159e+148

    1. Initial program 60.1

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

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

    if -1.1214182120130159e+148 < b < -1.7247047038424937e-216

    1. Initial program 7.0

      \[\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-cube-cbrt7.9

      \[\leadsto \frac{\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}\]

    if -1.7247047038424937e-216 < b < 4.3957752798560445e+108

    1. Initial program 30.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 flip-+30.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. Simplified17.1

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

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

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

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

      \[\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.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. Taylor expanded around 0 10.7

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

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

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

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

    if 4.3957752798560445e+108 < b

    1. Initial program 60.4

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

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

      \[\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-identity32.8

      \[\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-identity32.8

      \[\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-frac32.8

      \[\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*32.9

      \[\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. Simplified31.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. Taylor expanded around 0 30.8

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -1.1214182120130159 \cdot 10^{148}:\\ \;\;\;\;\frac{\left(-b\right) + \left(1.5 \cdot \frac{a \cdot c}{b} - b\right)}{3 \cdot a}\\ \mathbf{elif}\;b \le -1.7247047038424937 \cdot 10^{-216}:\\ \;\;\;\;\frac{\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}\\ \mathbf{elif}\;b \le 4.3957752798560445 \cdot 10^{108}:\\ \;\;\;\;\frac{1}{1 \cdot \frac{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{-2 \cdot \frac{b}{c}}\\ \end{array}\]

Reproduce

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