Average Error: 34.2 → 12.0
Time: 21.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 -1.139975678520567663603045399522192354667 \cdot 10^{154}:\\ \;\;\;\;\frac{\frac{\left(1.5 \cdot \frac{a \cdot c}{b} - b\right) - b}{3}}{a}\\ \mathbf{elif}\;b \le -3.147780135831067691283932115788099034227 \cdot 10^{-262}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\\ \mathbf{elif}\;b \le 2.048582467390676806206106891122023768278 \cdot 10^{118}:\\ \;\;\;\;\frac{\frac{\frac{a}{\frac{\sqrt{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} + b}}{3}}}{\frac{\sqrt{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} + b}}{c}}}{3} \cdot \frac{-1}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\frac{-\left(3 \cdot a\right) \cdot c}{\left(b - 1.5 \cdot \frac{a \cdot c}{b}\right) + b}}{3}}{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.139975678520567663603045399522192354667 \cdot 10^{154}:\\
\;\;\;\;\frac{\frac{\left(1.5 \cdot \frac{a \cdot c}{b} - b\right) - b}{3}}{a}\\

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

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

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

\end{array}
double f(double a, double b, double c) {
        double r116689 = b;
        double r116690 = -r116689;
        double r116691 = r116689 * r116689;
        double r116692 = 3.0;
        double r116693 = a;
        double r116694 = r116692 * r116693;
        double r116695 = c;
        double r116696 = r116694 * r116695;
        double r116697 = r116691 - r116696;
        double r116698 = sqrt(r116697);
        double r116699 = r116690 + r116698;
        double r116700 = r116699 / r116694;
        return r116700;
}

double f(double a, double b, double c) {
        double r116701 = b;
        double r116702 = -1.1399756785205677e+154;
        bool r116703 = r116701 <= r116702;
        double r116704 = 1.5;
        double r116705 = a;
        double r116706 = c;
        double r116707 = r116705 * r116706;
        double r116708 = r116707 / r116701;
        double r116709 = r116704 * r116708;
        double r116710 = r116709 - r116701;
        double r116711 = r116710 - r116701;
        double r116712 = 3.0;
        double r116713 = r116711 / r116712;
        double r116714 = r116713 / r116705;
        double r116715 = -3.1477801358310677e-262;
        bool r116716 = r116701 <= r116715;
        double r116717 = -r116701;
        double r116718 = r116701 * r116701;
        double r116719 = r116712 * r116705;
        double r116720 = r116719 * r116706;
        double r116721 = r116718 - r116720;
        double r116722 = sqrt(r116721);
        double r116723 = r116717 + r116722;
        double r116724 = r116723 / r116719;
        double r116725 = 2.048582467390677e+118;
        bool r116726 = r116701 <= r116725;
        double r116727 = r116722 + r116701;
        double r116728 = sqrt(r116727);
        double r116729 = r116728 / r116712;
        double r116730 = r116705 / r116729;
        double r116731 = r116728 / r116706;
        double r116732 = r116730 / r116731;
        double r116733 = r116732 / r116712;
        double r116734 = -1.0;
        double r116735 = r116734 / r116705;
        double r116736 = r116733 * r116735;
        double r116737 = -r116720;
        double r116738 = r116701 - r116709;
        double r116739 = r116738 + r116701;
        double r116740 = r116737 / r116739;
        double r116741 = r116740 / r116712;
        double r116742 = r116741 / r116705;
        double r116743 = r116726 ? r116736 : r116742;
        double r116744 = r116716 ? r116724 : r116743;
        double r116745 = r116703 ? r116714 : r116744;
        return r116745;
}

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.1399756785205677e+154

    1. Initial program 64.0

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

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

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

    if -1.1399756785205677e+154 < b < -3.1477801358310677e-262

    1. Initial program 7.4

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

    if -3.1477801358310677e-262 < b < 2.048582467390677e+118

    1. Initial program 32.3

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

      \[\leadsto \color{blue}{\frac{\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{3}}{a}}\]
    3. Using strategy rm
    4. Applied flip--32.4

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

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

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

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

      \[\leadsto \frac{\frac{0 - \color{blue}{\frac{a \cdot 3}{\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} + b}{c}}}}{3}}{a}\]
    10. Using strategy rm
    11. Applied div-inv14.7

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

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

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

      \[\leadsto \frac{0 - \frac{a \cdot 3}{\color{blue}{\frac{\sqrt{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} + b}}{1} \cdot \frac{\sqrt{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} + b}}{c}}}}{3} \cdot \frac{1}{a}\]
    16. Applied associate-/r*15.1

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

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

    if 2.048582467390677e+118 < b

    1. Initial program 60.6

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

      \[\leadsto \color{blue}{\frac{\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{3}}{a}}\]
    3. Using strategy rm
    4. Applied flip--60.6

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -1.139975678520567663603045399522192354667 \cdot 10^{154}:\\ \;\;\;\;\frac{\frac{\left(1.5 \cdot \frac{a \cdot c}{b} - b\right) - b}{3}}{a}\\ \mathbf{elif}\;b \le -3.147780135831067691283932115788099034227 \cdot 10^{-262}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\\ \mathbf{elif}\;b \le 2.048582467390676806206106891122023768278 \cdot 10^{118}:\\ \;\;\;\;\frac{\frac{\frac{a}{\frac{\sqrt{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} + b}}{3}}}{\frac{\sqrt{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} + b}}{c}}}{3} \cdot \frac{-1}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\frac{-\left(3 \cdot a\right) \cdot c}{\left(b - 1.5 \cdot \frac{a \cdot c}{b}\right) + b}}{3}}{a}\\ \end{array}\]

Reproduce

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