Average Error: 28.5 → 16.6
Time: 41.9s
Precision: 64
\[1.0536712127723509 \cdot 10^{-08} \lt a \lt 94906265.62425156 \land 1.0536712127723509 \cdot 10^{-08} \lt b \lt 94906265.62425156 \land 1.0536712127723509 \cdot 10^{-08} \lt c \lt 94906265.62425156\]
\[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3.0 \cdot a\right) \cdot c}}{3.0 \cdot a}\]
\[\begin{array}{l} \mathbf{if}\;b \le 781.9086092205042:\\ \;\;\;\;\frac{\frac{\left(b \cdot b - a \cdot \left(3.0 \cdot c\right)\right) \cdot \sqrt{b \cdot b - a \cdot \left(3.0 \cdot c\right)} - \left(b \cdot b\right) \cdot b}{\left(b \cdot b - a \cdot \left(3.0 \cdot c\right)\right) + \left(b \cdot \sqrt{b \cdot b - a \cdot \left(3.0 \cdot c\right)} + b \cdot b\right)}}{a \cdot 3.0}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{-1.5}{\frac{3.0}{a}}}{\frac{a}{\frac{c}{b}}}\\ \end{array}\]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3.0 \cdot a\right) \cdot c}}{3.0 \cdot a}
\begin{array}{l}
\mathbf{if}\;b \le 781.9086092205042:\\
\;\;\;\;\frac{\frac{\left(b \cdot b - a \cdot \left(3.0 \cdot c\right)\right) \cdot \sqrt{b \cdot b - a \cdot \left(3.0 \cdot c\right)} - \left(b \cdot b\right) \cdot b}{\left(b \cdot b - a \cdot \left(3.0 \cdot c\right)\right) + \left(b \cdot \sqrt{b \cdot b - a \cdot \left(3.0 \cdot c\right)} + b \cdot b\right)}}{a \cdot 3.0}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{-1.5}{\frac{3.0}{a}}}{\frac{a}{\frac{c}{b}}}\\

\end{array}
double f(double a, double b, double c) {
        double r3964404 = b;
        double r3964405 = -r3964404;
        double r3964406 = r3964404 * r3964404;
        double r3964407 = 3.0;
        double r3964408 = a;
        double r3964409 = r3964407 * r3964408;
        double r3964410 = c;
        double r3964411 = r3964409 * r3964410;
        double r3964412 = r3964406 - r3964411;
        double r3964413 = sqrt(r3964412);
        double r3964414 = r3964405 + r3964413;
        double r3964415 = r3964414 / r3964409;
        return r3964415;
}

double f(double a, double b, double c) {
        double r3964416 = b;
        double r3964417 = 781.9086092205042;
        bool r3964418 = r3964416 <= r3964417;
        double r3964419 = r3964416 * r3964416;
        double r3964420 = a;
        double r3964421 = 3.0;
        double r3964422 = c;
        double r3964423 = r3964421 * r3964422;
        double r3964424 = r3964420 * r3964423;
        double r3964425 = r3964419 - r3964424;
        double r3964426 = sqrt(r3964425);
        double r3964427 = r3964425 * r3964426;
        double r3964428 = r3964419 * r3964416;
        double r3964429 = r3964427 - r3964428;
        double r3964430 = r3964416 * r3964426;
        double r3964431 = r3964430 + r3964419;
        double r3964432 = r3964425 + r3964431;
        double r3964433 = r3964429 / r3964432;
        double r3964434 = r3964420 * r3964421;
        double r3964435 = r3964433 / r3964434;
        double r3964436 = -1.5;
        double r3964437 = r3964421 / r3964420;
        double r3964438 = r3964436 / r3964437;
        double r3964439 = r3964422 / r3964416;
        double r3964440 = r3964420 / r3964439;
        double r3964441 = r3964438 / r3964440;
        double r3964442 = r3964418 ? r3964435 : r3964441;
        return r3964442;
}

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

    1. Initial program 17.1

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3.0 \cdot a\right) \cdot c}}{3.0 \cdot a}\]
    2. Simplified17.1

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

      \[\leadsto \frac{\color{blue}{\frac{{\left(\sqrt{b \cdot b - \left(3.0 \cdot a\right) \cdot c}\right)}^{3} - {b}^{3}}{\sqrt{b \cdot b - \left(3.0 \cdot a\right) \cdot c} \cdot \sqrt{b \cdot b - \left(3.0 \cdot a\right) \cdot c} + \left(b \cdot b + \sqrt{b \cdot b - \left(3.0 \cdot a\right) \cdot c} \cdot b\right)}}}{3.0 \cdot a}\]
    5. Simplified16.4

      \[\leadsto \frac{\frac{\color{blue}{\sqrt{b \cdot b - \left(3.0 \cdot c\right) \cdot a} \cdot \left(b \cdot b - \left(3.0 \cdot c\right) \cdot a\right) - \left(b \cdot b\right) \cdot b}}{\sqrt{b \cdot b - \left(3.0 \cdot a\right) \cdot c} \cdot \sqrt{b \cdot b - \left(3.0 \cdot a\right) \cdot c} + \left(b \cdot b + \sqrt{b \cdot b - \left(3.0 \cdot a\right) \cdot c} \cdot b\right)}}{3.0 \cdot a}\]
    6. Simplified16.4

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

    if 781.9086092205042 < b

    1. Initial program 35.8

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3.0 \cdot a\right) \cdot c}}{3.0 \cdot a}\]
    2. Simplified35.8

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

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

      \[\leadsto \color{blue}{\frac{-1.5}{\frac{3.0 \cdot a}{\frac{a \cdot c}{b}}}}\]
    6. Using strategy rm
    7. Applied *-un-lft-identity16.8

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

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

      \[\leadsto \frac{-1.5}{\color{blue}{\frac{3.0}{\frac{a}{1}} \cdot \frac{a}{\frac{c}{b}}}}\]
    10. Applied associate-/r*16.7

      \[\leadsto \color{blue}{\frac{\frac{-1.5}{\frac{3.0}{\frac{a}{1}}}}{\frac{a}{\frac{c}{b}}}}\]
    11. Simplified16.7

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

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

Reproduce

herbie shell --seed 2019165 
(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)))