Average Error: 29.0 → 16.3
Time: 6.3s
Precision: 64
\[1.05367121277235087 \cdot 10^{-8} \lt a \lt 94906265.6242515594 \land 1.05367121277235087 \cdot 10^{-8} \lt b \lt 94906265.6242515594 \land 1.05367121277235087 \cdot 10^{-8} \lt c \lt 94906265.6242515594\]
\[\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 228.26278739030357:\\ \;\;\;\;\frac{\frac{{b}^{2} - \left({b}^{2} - \left(3 \cdot a\right) \cdot c\right)}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}{3 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-1.5 \cdot a\right) \cdot c}{\left(3 \cdot a\right) \cdot b}\\ \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 228.26278739030357:\\
\;\;\;\;\frac{\frac{{b}^{2} - \left({b}^{2} - \left(3 \cdot a\right) \cdot c\right)}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}{3 \cdot a}\\

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

\end{array}
double f(double a, double b, double c) {
        double r163386 = b;
        double r163387 = -r163386;
        double r163388 = r163386 * r163386;
        double r163389 = 3.0;
        double r163390 = a;
        double r163391 = r163389 * r163390;
        double r163392 = c;
        double r163393 = r163391 * r163392;
        double r163394 = r163388 - r163393;
        double r163395 = sqrt(r163394);
        double r163396 = r163387 + r163395;
        double r163397 = r163396 / r163391;
        return r163397;
}

double f(double a, double b, double c) {
        double r163398 = b;
        double r163399 = 228.26278739030357;
        bool r163400 = r163398 <= r163399;
        double r163401 = 2.0;
        double r163402 = pow(r163398, r163401);
        double r163403 = 3.0;
        double r163404 = a;
        double r163405 = r163403 * r163404;
        double r163406 = c;
        double r163407 = r163405 * r163406;
        double r163408 = r163402 - r163407;
        double r163409 = r163402 - r163408;
        double r163410 = -r163398;
        double r163411 = r163398 * r163398;
        double r163412 = r163411 - r163407;
        double r163413 = sqrt(r163412);
        double r163414 = r163410 - r163413;
        double r163415 = r163409 / r163414;
        double r163416 = r163415 / r163405;
        double r163417 = -1.5;
        double r163418 = r163417 * r163404;
        double r163419 = r163418 * r163406;
        double r163420 = r163405 * r163398;
        double r163421 = r163419 / r163420;
        double r163422 = r163400 ? r163416 : r163421;
        return r163422;
}

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 2 regimes
  2. if b < 228.26278739030357

    1. Initial program 16.3

      \[\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-+16.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. Simplified15.3

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

    if 228.26278739030357 < b

    1. Initial program 35.6

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

      \[\leadsto \frac{\color{blue}{-1.5 \cdot \frac{a \cdot c}{b}}}{3 \cdot a}\]
    3. Using strategy rm
    4. Applied *-un-lft-identity16.9

      \[\leadsto \frac{-1.5 \cdot \frac{a \cdot c}{\color{blue}{1 \cdot b}}}{3 \cdot a}\]
    5. Applied times-frac16.8

      \[\leadsto \frac{-1.5 \cdot \color{blue}{\left(\frac{a}{1} \cdot \frac{c}{b}\right)}}{3 \cdot a}\]
    6. Applied associate-*r*16.8

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

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

      \[\leadsto \frac{\color{blue}{\frac{\left(-1.5 \cdot a\right) \cdot c}{b}}}{3 \cdot a}\]
    10. Applied associate-/l/16.8

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le 228.26278739030357:\\ \;\;\;\;\frac{\frac{{b}^{2} - \left({b}^{2} - \left(3 \cdot a\right) \cdot c\right)}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}{3 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-1.5 \cdot a\right) \cdot c}{\left(3 \cdot a\right) \cdot b}\\ \end{array}\]

Reproduce

herbie shell --seed 2020045 
(FPCore (a b c)
  :name "Cubic critical, narrow range"
  :precision binary64
  :pre (and (< 1.0536712127723509e-08 a 94906265.62425156) (< 1.0536712127723509e-08 b 94906265.62425156) (< 1.0536712127723509e-08 c 94906265.62425156))
  (/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a)))