Average Error: 28.4 → 16.8
Time: 19.8s
Precision: 64
\[1.053671212772350866701172186984739043147 \cdot 10^{-8} \lt a \lt 94906265.62425155937671661376953125 \land 1.053671212772350866701172186984739043147 \cdot 10^{-8} \lt b \lt 94906265.62425155937671661376953125 \land 1.053671212772350866701172186984739043147 \cdot 10^{-8} \lt c \lt 94906265.62425155937671661376953125\]
\[\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 60.51244836482759836826517130248248577118:\\ \;\;\;\;\frac{\frac{\left(b \cdot b - c \cdot \left(a \cdot 3\right)\right) \cdot \sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - \left(b \cdot b\right) \cdot b}{\left(b \cdot b - c \cdot \left(a \cdot 3\right)\right) + \left(b \cdot \sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} + b \cdot b\right)}}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{a \cdot 3}{\frac{a}{\frac{b}{c}} \cdot -1.5}}\\ \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 60.51244836482759836826517130248248577118:\\
\;\;\;\;\frac{\frac{\left(b \cdot b - c \cdot \left(a \cdot 3\right)\right) \cdot \sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - \left(b \cdot b\right) \cdot b}{\left(b \cdot b - c \cdot \left(a \cdot 3\right)\right) + \left(b \cdot \sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} + b \cdot b\right)}}{a \cdot 3}\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{a \cdot 3}{\frac{a}{\frac{b}{c}} \cdot -1.5}}\\

\end{array}
double f(double a, double b, double c) {
        double r4074406 = b;
        double r4074407 = -r4074406;
        double r4074408 = r4074406 * r4074406;
        double r4074409 = 3.0;
        double r4074410 = a;
        double r4074411 = r4074409 * r4074410;
        double r4074412 = c;
        double r4074413 = r4074411 * r4074412;
        double r4074414 = r4074408 - r4074413;
        double r4074415 = sqrt(r4074414);
        double r4074416 = r4074407 + r4074415;
        double r4074417 = r4074416 / r4074411;
        return r4074417;
}

double f(double a, double b, double c) {
        double r4074418 = b;
        double r4074419 = 60.5124483648276;
        bool r4074420 = r4074418 <= r4074419;
        double r4074421 = r4074418 * r4074418;
        double r4074422 = c;
        double r4074423 = a;
        double r4074424 = 3.0;
        double r4074425 = r4074423 * r4074424;
        double r4074426 = r4074422 * r4074425;
        double r4074427 = r4074421 - r4074426;
        double r4074428 = sqrt(r4074427);
        double r4074429 = r4074427 * r4074428;
        double r4074430 = r4074421 * r4074418;
        double r4074431 = r4074429 - r4074430;
        double r4074432 = r4074418 * r4074428;
        double r4074433 = r4074432 + r4074421;
        double r4074434 = r4074427 + r4074433;
        double r4074435 = r4074431 / r4074434;
        double r4074436 = r4074435 / r4074425;
        double r4074437 = 1.0;
        double r4074438 = r4074418 / r4074422;
        double r4074439 = r4074423 / r4074438;
        double r4074440 = -1.5;
        double r4074441 = r4074439 * r4074440;
        double r4074442 = r4074425 / r4074441;
        double r4074443 = r4074437 / r4074442;
        double r4074444 = r4074420 ? r4074436 : r4074443;
        return r4074444;
}

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 < 60.5124483648276

    1. Initial program 14.5

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

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

      \[\leadsto \frac{\color{blue}{\frac{{\left(\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}^{3} - {b}^{3}}{\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 \cdot b + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} \cdot b\right)}}}{3 \cdot a}\]
    5. Simplified13.9

      \[\leadsto \frac{\frac{\color{blue}{\sqrt{b \cdot b - \left(a \cdot 3\right) \cdot c} \cdot \left(b \cdot b - \left(a \cdot 3\right) \cdot c\right) - b \cdot \left(b \cdot 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 \cdot b + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} \cdot b\right)}}{3 \cdot a}\]
    6. Simplified13.9

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

    if 60.5124483648276 < b

    1. Initial program 34.2

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

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

      \[\leadsto \frac{\color{blue}{-1.5 \cdot \frac{a \cdot c}{b}}}{3 \cdot a}\]
    4. Using strategy rm
    5. Applied associate-/l*18.0

      \[\leadsto \frac{-1.5 \cdot \color{blue}{\frac{a}{\frac{b}{c}}}}{3 \cdot a}\]
    6. Using strategy rm
    7. Applied clear-num18.0

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

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

Reproduce

herbie shell --seed 2019172 
(FPCore (a b c)
  :name "Cubic critical, narrow range"
  :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.0 a) c)))) (* 3.0 a)))