Average Error: 34.3 → 10.1
Time: 18.8s
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 -7.94903992111146232901506129675699683521 \cdot 10^{114}:\\ \;\;\;\;\frac{1.5 \cdot \frac{a \cdot c}{b} - 2 \cdot b}{3 \cdot a}\\ \mathbf{elif}\;b \le -1.588581026022229142935221773282266391902 \cdot 10^{-168}:\\ \;\;\;\;\frac{\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{3}}{a}\\ \mathbf{elif}\;b \le 1.955976202061805945275962347105642351558 \cdot 10^{155}:\\ \;\;\;\;\frac{c}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(3 \cdot a\right) \cdot c}{\left(3 \cdot a\right) \cdot \left(1.5 \cdot \frac{a \cdot c}{b} - 2 \cdot b\right)}\\ \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 -7.94903992111146232901506129675699683521 \cdot 10^{114}:\\
\;\;\;\;\frac{1.5 \cdot \frac{a \cdot c}{b} - 2 \cdot b}{3 \cdot a}\\

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

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

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

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

double f(double a, double b, double c) {
        double r105266 = b;
        double r105267 = -7.949039921111462e+114;
        bool r105268 = r105266 <= r105267;
        double r105269 = 1.5;
        double r105270 = a;
        double r105271 = c;
        double r105272 = r105270 * r105271;
        double r105273 = r105272 / r105266;
        double r105274 = r105269 * r105273;
        double r105275 = 2.0;
        double r105276 = r105275 * r105266;
        double r105277 = r105274 - r105276;
        double r105278 = 3.0;
        double r105279 = r105278 * r105270;
        double r105280 = r105277 / r105279;
        double r105281 = -1.5885810260222291e-168;
        bool r105282 = r105266 <= r105281;
        double r105283 = r105266 * r105266;
        double r105284 = r105279 * r105271;
        double r105285 = r105283 - r105284;
        double r105286 = sqrt(r105285);
        double r105287 = r105286 - r105266;
        double r105288 = r105287 / r105278;
        double r105289 = r105288 / r105270;
        double r105290 = 1.955976202061806e+155;
        bool r105291 = r105266 <= r105290;
        double r105292 = -r105266;
        double r105293 = r105292 - r105286;
        double r105294 = r105271 / r105293;
        double r105295 = r105279 * r105277;
        double r105296 = r105284 / r105295;
        double r105297 = r105291 ? r105294 : r105296;
        double r105298 = r105282 ? r105289 : r105297;
        double r105299 = r105268 ? r105280 : r105298;
        return r105299;
}

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 < -7.949039921111462e+114

    1. Initial program 50.8

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

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

    if -7.949039921111462e+114 < b < -1.5885810260222291e-168

    1. Initial program 7.4

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

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

    if -1.5885810260222291e-168 < b < 1.955976202061806e+155

    1. Initial program 31.1

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

      \[\leadsto \frac{\frac{\color{blue}{\left(3 \cdot a\right) \cdot c}}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}{3 \cdot a}\]
    5. Using strategy rm
    6. Applied div-inv16.1

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

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

      \[\leadsto \frac{\left(3 \cdot a\right) \cdot c}{\color{blue}{\left(3 \cdot a\right) \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}}\]
    9. Using strategy rm
    10. Applied associate-/r*14.7

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

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

    if 1.955976202061806e+155 < 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.3

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -7.94903992111146232901506129675699683521 \cdot 10^{114}:\\ \;\;\;\;\frac{1.5 \cdot \frac{a \cdot c}{b} - 2 \cdot b}{3 \cdot a}\\ \mathbf{elif}\;b \le -1.588581026022229142935221773282266391902 \cdot 10^{-168}:\\ \;\;\;\;\frac{\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{3}}{a}\\ \mathbf{elif}\;b \le 1.955976202061805945275962347105642351558 \cdot 10^{155}:\\ \;\;\;\;\frac{c}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(3 \cdot a\right) \cdot c}{\left(3 \cdot a\right) \cdot \left(1.5 \cdot \frac{a \cdot c}{b} - 2 \cdot b\right)}\\ \end{array}\]

Reproduce

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