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

\end{array}
double f(double a, double b, double c) {
        double r94390 = b;
        double r94391 = -r94390;
        double r94392 = r94390 * r94390;
        double r94393 = 3.0;
        double r94394 = a;
        double r94395 = r94393 * r94394;
        double r94396 = c;
        double r94397 = r94395 * r94396;
        double r94398 = r94392 - r94397;
        double r94399 = sqrt(r94398);
        double r94400 = r94391 + r94399;
        double r94401 = r94400 / r94395;
        return r94401;
}

double f(double a, double b, double c) {
        double r94402 = b;
        double r94403 = -7.949039921111462e+114;
        bool r94404 = r94402 <= r94403;
        double r94405 = 1.5;
        double r94406 = a;
        double r94407 = c;
        double r94408 = r94406 * r94407;
        double r94409 = r94408 / r94402;
        double r94410 = r94405 * r94409;
        double r94411 = 2.0;
        double r94412 = r94411 * r94402;
        double r94413 = r94410 - r94412;
        double r94414 = 3.0;
        double r94415 = r94414 * r94406;
        double r94416 = r94413 / r94415;
        double r94417 = -1.5885810260222291e-168;
        bool r94418 = r94402 <= r94417;
        double r94419 = r94402 * r94402;
        double r94420 = r94415 * r94407;
        double r94421 = r94419 - r94420;
        double r94422 = sqrt(r94421);
        double r94423 = r94422 - r94402;
        double r94424 = r94423 / r94414;
        double r94425 = r94424 / r94406;
        double r94426 = 1.955976202061806e+155;
        bool r94427 = r94402 <= r94426;
        double r94428 = -r94402;
        double r94429 = r94428 - r94422;
        double r94430 = r94407 / r94429;
        double r94431 = r94402 - r94410;
        double r94432 = r94428 - r94431;
        double r94433 = r94415 * r94432;
        double r94434 = r94420 / r94433;
        double r94435 = r94427 ? r94430 : r94434;
        double r94436 = r94418 ? r94425 : r94435;
        double r94437 = r94404 ? r94416 : r94436;
        return r94437;
}

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 \left(\left(-b\right) - \color{blue}{\left(b - 1.5 \cdot \frac{a \cdot c}{b}\right)}\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(\left(-b\right) - \left(b - 1.5 \cdot \frac{a \cdot c}{b}\right)\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)))