Average Error: 34.3 → 11.0
Time: 24.5s
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.788852227312393602706038563213165103147 \cdot 10^{50}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{a \cdot c}{b}, 1.5, -2 \cdot b\right)}{3 \cdot a}\\ \mathbf{elif}\;b \le 3.612467054529498276131853656120983874215 \cdot 10^{-241}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-\sqrt[3]{b} \cdot \sqrt[3]{b}, \sqrt[3]{b}, \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}{3 \cdot a}\\ \mathbf{elif}\;b \le 6.107031321392312680053315278474894982897 \cdot 10^{157}:\\ \;\;\;\;\frac{\frac{1}{\sqrt[3]{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}} \cdot \sqrt[3]{\left(-b\right) - \left|\sqrt[3]{b \cdot b - \left(3 \cdot a\right) \cdot c}\right| \cdot \sqrt{\sqrt[3]{b \cdot b - \left(3 \cdot a\right) \cdot c}}}}}{\frac{3}{\frac{c}{\sqrt[3]{\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}}}}} \cdot \frac{a}{\frac{3 \cdot a}{\sqrt[3]{\sqrt[3]{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\left(3 \cdot a\right) \cdot c}{\left(-b\right) - \left(b - 1.5 \cdot \frac{a \cdot c}{b}\right)}}{3 \cdot a}\\ \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.788852227312393602706038563213165103147 \cdot 10^{50}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{a \cdot c}{b}, 1.5, -2 \cdot b\right)}{3 \cdot a}\\

\mathbf{elif}\;b \le 3.612467054529498276131853656120983874215 \cdot 10^{-241}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-\sqrt[3]{b} \cdot \sqrt[3]{b}, \sqrt[3]{b}, \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}{3 \cdot a}\\

\mathbf{elif}\;b \le 6.107031321392312680053315278474894982897 \cdot 10^{157}:\\
\;\;\;\;\frac{\frac{1}{\sqrt[3]{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}} \cdot \sqrt[3]{\left(-b\right) - \left|\sqrt[3]{b \cdot b - \left(3 \cdot a\right) \cdot c}\right| \cdot \sqrt{\sqrt[3]{b \cdot b - \left(3 \cdot a\right) \cdot c}}}}}{\frac{3}{\frac{c}{\sqrt[3]{\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}}}}} \cdot \frac{a}{\frac{3 \cdot a}{\sqrt[3]{\sqrt[3]{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}}}}\\

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

\end{array}
double f(double a, double b, double c) {
        double r102405 = b;
        double r102406 = -r102405;
        double r102407 = r102405 * r102405;
        double r102408 = 3.0;
        double r102409 = a;
        double r102410 = r102408 * r102409;
        double r102411 = c;
        double r102412 = r102410 * r102411;
        double r102413 = r102407 - r102412;
        double r102414 = sqrt(r102413);
        double r102415 = r102406 + r102414;
        double r102416 = r102415 / r102410;
        return r102416;
}

double f(double a, double b, double c) {
        double r102417 = b;
        double r102418 = -1.7888522273123936e+50;
        bool r102419 = r102417 <= r102418;
        double r102420 = a;
        double r102421 = c;
        double r102422 = r102420 * r102421;
        double r102423 = r102422 / r102417;
        double r102424 = 1.5;
        double r102425 = -2.0;
        double r102426 = r102425 * r102417;
        double r102427 = fma(r102423, r102424, r102426);
        double r102428 = 3.0;
        double r102429 = r102428 * r102420;
        double r102430 = r102427 / r102429;
        double r102431 = 3.612467054529498e-241;
        bool r102432 = r102417 <= r102431;
        double r102433 = cbrt(r102417);
        double r102434 = r102433 * r102433;
        double r102435 = -r102434;
        double r102436 = r102417 * r102417;
        double r102437 = r102429 * r102421;
        double r102438 = r102436 - r102437;
        double r102439 = sqrt(r102438);
        double r102440 = fma(r102435, r102433, r102439);
        double r102441 = r102440 / r102429;
        double r102442 = 6.107031321392313e+157;
        bool r102443 = r102417 <= r102442;
        double r102444 = 1.0;
        double r102445 = -r102417;
        double r102446 = r102445 - r102439;
        double r102447 = cbrt(r102446);
        double r102448 = cbrt(r102438);
        double r102449 = fabs(r102448);
        double r102450 = sqrt(r102448);
        double r102451 = r102449 * r102450;
        double r102452 = r102445 - r102451;
        double r102453 = cbrt(r102452);
        double r102454 = r102447 * r102453;
        double r102455 = r102444 / r102454;
        double r102456 = r102447 * r102447;
        double r102457 = cbrt(r102456);
        double r102458 = r102421 / r102457;
        double r102459 = r102428 / r102458;
        double r102460 = cbrt(r102447);
        double r102461 = r102429 / r102460;
        double r102462 = r102420 / r102461;
        double r102463 = r102459 * r102462;
        double r102464 = r102455 / r102463;
        double r102465 = r102424 * r102423;
        double r102466 = r102417 - r102465;
        double r102467 = r102445 - r102466;
        double r102468 = r102437 / r102467;
        double r102469 = r102468 / r102429;
        double r102470 = r102443 ? r102464 : r102469;
        double r102471 = r102432 ? r102441 : r102470;
        double r102472 = r102419 ? r102430 : r102471;
        return r102472;
}

Error

Bits error versus a

Bits error versus b

Bits error versus c

Derivation

  1. Split input into 4 regimes
  2. if b < -1.7888522273123936e+50

    1. Initial program 37.9

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

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

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

    if -1.7888522273123936e+50 < b < 3.612467054529498e-241

    1. Initial program 11.5

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

      \[\leadsto \frac{\left(-\color{blue}{\left(\sqrt[3]{b} \cdot \sqrt[3]{b}\right) \cdot \sqrt[3]{b}}\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    4. Applied distribute-lft-neg-in11.7

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

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

    if 3.612467054529498e-241 < b < 6.107031321392313e+157

    1. Initial program 37.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 flip-+37.1

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

      \[\leadsto \frac{\frac{\color{blue}{c \cdot \left(3 \cdot a\right) + 0}}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}{3 \cdot a}\]
    5. Using strategy rm
    6. Applied add-cube-cbrt16.6

      \[\leadsto \frac{\frac{c \cdot \left(3 \cdot a\right) + 0}{\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}\]
    7. Applied *-un-lft-identity16.6

      \[\leadsto \frac{\frac{\color{blue}{1 \cdot \left(c \cdot \left(3 \cdot a\right) + 0\right)}}{\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}\]
    8. Applied times-frac16.6

      \[\leadsto \frac{\color{blue}{\frac{1}{\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}}} \cdot \frac{c \cdot \left(3 \cdot a\right) + 0}{\sqrt[3]{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}}}{3 \cdot a}\]
    9. Applied associate-/l*15.3

      \[\leadsto \color{blue}{\frac{\frac{1}{\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}}}}{\frac{3 \cdot a}{\frac{c \cdot \left(3 \cdot a\right) + 0}{\sqrt[3]{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}}}}\]
    10. Simplified15.3

      \[\leadsto \frac{\frac{1}{\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}}}}{\color{blue}{\frac{3 \cdot a}{\frac{c \cdot \left(3 \cdot a\right)}{\sqrt[3]{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}}}}\]
    11. Using strategy rm
    12. Applied add-cube-cbrt15.4

      \[\leadsto \frac{\frac{1}{\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}}}}{\frac{3 \cdot a}{\frac{c \cdot \left(3 \cdot a\right)}{\sqrt[3]{\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}}}}}}}\]
    13. Applied cbrt-prod15.4

      \[\leadsto \frac{\frac{1}{\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}}}}{\frac{3 \cdot a}{\frac{c \cdot \left(3 \cdot a\right)}{\color{blue}{\sqrt[3]{\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}}} \cdot \sqrt[3]{\sqrt[3]{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}}}}}\]
    14. Applied times-frac14.6

      \[\leadsto \frac{\frac{1}{\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}}}}{\frac{3 \cdot a}{\color{blue}{\frac{c}{\sqrt[3]{\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}}}} \cdot \frac{3 \cdot a}{\sqrt[3]{\sqrt[3]{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}}}}}\]
    15. Applied times-frac8.6

      \[\leadsto \frac{\frac{1}{\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}}}}{\color{blue}{\frac{3}{\frac{c}{\sqrt[3]{\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}}}}} \cdot \frac{a}{\frac{3 \cdot a}{\sqrt[3]{\sqrt[3]{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}}}}}\]
    16. Using strategy rm
    17. Applied add-cube-cbrt8.6

      \[\leadsto \frac{\frac{1}{\sqrt[3]{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}} \cdot \sqrt[3]{\left(-b\right) - \sqrt{\color{blue}{\left(\sqrt[3]{b \cdot b - \left(3 \cdot a\right) \cdot c} \cdot \sqrt[3]{b \cdot b - \left(3 \cdot a\right) \cdot c}\right) \cdot \sqrt[3]{b \cdot b - \left(3 \cdot a\right) \cdot c}}}}}}{\frac{3}{\frac{c}{\sqrt[3]{\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}}}}} \cdot \frac{a}{\frac{3 \cdot a}{\sqrt[3]{\sqrt[3]{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}}}}\]
    18. Applied sqrt-prod8.6

      \[\leadsto \frac{\frac{1}{\sqrt[3]{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}} \cdot \sqrt[3]{\left(-b\right) - \color{blue}{\sqrt{\sqrt[3]{b \cdot b - \left(3 \cdot a\right) \cdot c} \cdot \sqrt[3]{b \cdot b - \left(3 \cdot a\right) \cdot c}} \cdot \sqrt{\sqrt[3]{b \cdot b - \left(3 \cdot a\right) \cdot c}}}}}}{\frac{3}{\frac{c}{\sqrt[3]{\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}}}}} \cdot \frac{a}{\frac{3 \cdot a}{\sqrt[3]{\sqrt[3]{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}}}}\]
    19. Simplified8.6

      \[\leadsto \frac{\frac{1}{\sqrt[3]{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}} \cdot \sqrt[3]{\left(-b\right) - \color{blue}{\left|\sqrt[3]{b \cdot b - \left(3 \cdot a\right) \cdot c}\right|} \cdot \sqrt{\sqrt[3]{b \cdot b - \left(3 \cdot a\right) \cdot c}}}}}{\frac{3}{\frac{c}{\sqrt[3]{\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}}}}} \cdot \frac{a}{\frac{3 \cdot a}{\sqrt[3]{\sqrt[3]{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}}}}\]

    if 6.107031321392313e+157 < b

    1. Initial program 64.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 flip-+64.0

      \[\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. Simplified37.2

      \[\leadsto \frac{\frac{\color{blue}{c \cdot \left(3 \cdot a\right) + 0}}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}{3 \cdot a}\]
    5. Taylor expanded around inf 13.9

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -1.788852227312393602706038563213165103147 \cdot 10^{50}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{a \cdot c}{b}, 1.5, -2 \cdot b\right)}{3 \cdot a}\\ \mathbf{elif}\;b \le 3.612467054529498276131853656120983874215 \cdot 10^{-241}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-\sqrt[3]{b} \cdot \sqrt[3]{b}, \sqrt[3]{b}, \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}{3 \cdot a}\\ \mathbf{elif}\;b \le 6.107031321392312680053315278474894982897 \cdot 10^{157}:\\ \;\;\;\;\frac{\frac{1}{\sqrt[3]{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}} \cdot \sqrt[3]{\left(-b\right) - \left|\sqrt[3]{b \cdot b - \left(3 \cdot a\right) \cdot c}\right| \cdot \sqrt{\sqrt[3]{b \cdot b - \left(3 \cdot a\right) \cdot c}}}}}{\frac{3}{\frac{c}{\sqrt[3]{\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}}}}} \cdot \frac{a}{\frac{3 \cdot a}{\sqrt[3]{\sqrt[3]{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\left(3 \cdot a\right) \cdot c}{\left(-b\right) - \left(b - 1.5 \cdot \frac{a \cdot c}{b}\right)}}{3 \cdot a}\\ \end{array}\]

Reproduce

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