Average Error: 34.2 → 12.0
Time: 21.7s
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{1.5 \cdot \frac{a \cdot c}{b} - 2 \cdot 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{1.5 \cdot \frac{a \cdot c}{b} - 2 \cdot 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 r113036 = b;
        double r113037 = -r113036;
        double r113038 = r113036 * r113036;
        double r113039 = 3.0;
        double r113040 = a;
        double r113041 = r113039 * r113040;
        double r113042 = c;
        double r113043 = r113041 * r113042;
        double r113044 = r113038 - r113043;
        double r113045 = sqrt(r113044);
        double r113046 = r113037 + r113045;
        double r113047 = r113046 / r113041;
        return r113047;
}

double f(double a, double b, double c) {
        double r113048 = b;
        double r113049 = -1.1399756785205677e+154;
        bool r113050 = r113048 <= r113049;
        double r113051 = 1.5;
        double r113052 = a;
        double r113053 = c;
        double r113054 = r113052 * r113053;
        double r113055 = r113054 / r113048;
        double r113056 = r113051 * r113055;
        double r113057 = 2.0;
        double r113058 = r113057 * r113048;
        double r113059 = r113056 - r113058;
        double r113060 = 3.0;
        double r113061 = r113059 / r113060;
        double r113062 = r113061 / r113052;
        double r113063 = -3.1477801358310677e-262;
        bool r113064 = r113048 <= r113063;
        double r113065 = -r113048;
        double r113066 = r113048 * r113048;
        double r113067 = r113060 * r113052;
        double r113068 = r113067 * r113053;
        double r113069 = r113066 - r113068;
        double r113070 = sqrt(r113069);
        double r113071 = r113065 + r113070;
        double r113072 = r113071 / r113067;
        double r113073 = 2.048582467390677e+118;
        bool r113074 = r113048 <= r113073;
        double r113075 = r113070 + r113048;
        double r113076 = sqrt(r113075);
        double r113077 = r113076 / r113060;
        double r113078 = r113052 / r113077;
        double r113079 = r113076 / r113053;
        double r113080 = r113078 / r113079;
        double r113081 = r113080 / r113060;
        double r113082 = -1.0;
        double r113083 = r113082 / r113052;
        double r113084 = r113081 * r113083;
        double r113085 = -r113068;
        double r113086 = r113048 - r113056;
        double r113087 = r113086 + r113048;
        double r113088 = r113085 / r113087;
        double r113089 = r113088 / r113060;
        double r113090 = r113089 / r113052;
        double r113091 = r113074 ? r113084 : r113090;
        double r113092 = r113064 ? r113072 : r113091;
        double r113093 = r113050 ? r113062 : r113092;
        return r113093;
}

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}{1.5 \cdot \frac{a \cdot c}{b} - 2 \cdot 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{1.5 \cdot \frac{a \cdot c}{b} - 2 \cdot 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)))