Average Error: 34.5 → 6.4
Time: 7.4s
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 -2.352627898855756505328569566819961781299 \cdot 10^{142}:\\ \;\;\;\;0.5 \cdot \frac{c}{b} - 0.6666666666666666296592325124947819858789 \cdot \frac{b}{a}\\ \mathbf{elif}\;b \le -5.975900233814397332492519406778082603344 \cdot 10^{-306}:\\ \;\;\;\;\frac{\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3}}{a}\\ \mathbf{elif}\;b \le 9.171769784769278677227930818735754293126 \cdot 10^{125}:\\ \;\;\;\;\frac{1}{\frac{1}{\frac{c}{1}} \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}\\ \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 -2.352627898855756505328569566819961781299 \cdot 10^{142}:\\
\;\;\;\;0.5 \cdot \frac{c}{b} - 0.6666666666666666296592325124947819858789 \cdot \frac{b}{a}\\

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

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

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

\end{array}
double f(double a, double b, double c) {
        double r139522 = b;
        double r139523 = -r139522;
        double r139524 = r139522 * r139522;
        double r139525 = 3.0;
        double r139526 = a;
        double r139527 = r139525 * r139526;
        double r139528 = c;
        double r139529 = r139527 * r139528;
        double r139530 = r139524 - r139529;
        double r139531 = sqrt(r139530);
        double r139532 = r139523 + r139531;
        double r139533 = r139532 / r139527;
        return r139533;
}

double f(double a, double b, double c) {
        double r139534 = b;
        double r139535 = -2.3526278988557565e+142;
        bool r139536 = r139534 <= r139535;
        double r139537 = 0.5;
        double r139538 = c;
        double r139539 = r139538 / r139534;
        double r139540 = r139537 * r139539;
        double r139541 = 0.6666666666666666;
        double r139542 = a;
        double r139543 = r139534 / r139542;
        double r139544 = r139541 * r139543;
        double r139545 = r139540 - r139544;
        double r139546 = -5.975900233814397e-306;
        bool r139547 = r139534 <= r139546;
        double r139548 = -r139534;
        double r139549 = r139534 * r139534;
        double r139550 = 3.0;
        double r139551 = r139550 * r139542;
        double r139552 = r139551 * r139538;
        double r139553 = r139549 - r139552;
        double r139554 = sqrt(r139553);
        double r139555 = r139548 + r139554;
        double r139556 = r139555 / r139550;
        double r139557 = r139556 / r139542;
        double r139558 = 9.171769784769279e+125;
        bool r139559 = r139534 <= r139558;
        double r139560 = 1.0;
        double r139561 = r139538 / r139560;
        double r139562 = r139560 / r139561;
        double r139563 = r139548 - r139554;
        double r139564 = r139562 * r139563;
        double r139565 = r139560 / r139564;
        double r139566 = -0.5;
        double r139567 = r139566 * r139539;
        double r139568 = r139559 ? r139565 : r139567;
        double r139569 = r139547 ? r139557 : r139568;
        double r139570 = r139536 ? r139545 : r139569;
        return r139570;
}

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 < -2.3526278988557565e+142

    1. Initial program 59.5

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

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

    if -2.3526278988557565e+142 < b < -5.975900233814397e-306

    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 associate-/r*8.2

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

    if -5.975900233814397e-306 < b < 9.171769784769279e+125

    1. Initial program 33.8

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

      \[\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}{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-identity16.6

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

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

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

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

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

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

      \[\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)}\]

    if 9.171769784769279e+125 < b

    1. Initial program 60.8

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -2.352627898855756505328569566819961781299 \cdot 10^{142}:\\ \;\;\;\;0.5 \cdot \frac{c}{b} - 0.6666666666666666296592325124947819858789 \cdot \frac{b}{a}\\ \mathbf{elif}\;b \le -5.975900233814397332492519406778082603344 \cdot 10^{-306}:\\ \;\;\;\;\frac{\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3}}{a}\\ \mathbf{elif}\;b \le 9.171769784769278677227930818735754293126 \cdot 10^{125}:\\ \;\;\;\;\frac{1}{\frac{1}{\frac{c}{1}} \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b}\\ \end{array}\]

Reproduce

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