Average Error: 28.9 → 16.2
Time: 31.2s
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 \cdot a\right) \cdot c}}{3 \cdot a}\]
\[\begin{array}{l} \mathbf{if}\;b \le 2650.8680979433148:\\ \;\;\;\;\frac{\frac{\left(b \cdot b + -3 \cdot \left(a \cdot c\right)\right) \cdot \sqrt{b \cdot b + -3 \cdot \left(a \cdot c\right)} - \left(b \cdot b\right) \cdot b}{\left(b \cdot b + -3 \cdot \left(a \cdot c\right)\right) + \left(b \cdot \sqrt{b \cdot b + -3 \cdot \left(a \cdot c\right)} + b \cdot b\right)}}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{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 2650.8680979433148:\\
\;\;\;\;\frac{\frac{\left(b \cdot b + -3 \cdot \left(a \cdot c\right)\right) \cdot \sqrt{b \cdot b + -3 \cdot \left(a \cdot c\right)} - \left(b \cdot b\right) \cdot b}{\left(b \cdot b + -3 \cdot \left(a \cdot c\right)\right) + \left(b \cdot \sqrt{b \cdot b + -3 \cdot \left(a \cdot c\right)} + b \cdot b\right)}}{a \cdot 3}\\

\mathbf{else}:\\
\;\;\;\;\frac{-1}{2} \cdot \frac{c}{b}\\

\end{array}
double f(double a, double b, double c) {
        double r3986538 = b;
        double r3986539 = -r3986538;
        double r3986540 = r3986538 * r3986538;
        double r3986541 = 3.0;
        double r3986542 = a;
        double r3986543 = r3986541 * r3986542;
        double r3986544 = c;
        double r3986545 = r3986543 * r3986544;
        double r3986546 = r3986540 - r3986545;
        double r3986547 = sqrt(r3986546);
        double r3986548 = r3986539 + r3986547;
        double r3986549 = r3986548 / r3986543;
        return r3986549;
}

double f(double a, double b, double c) {
        double r3986550 = b;
        double r3986551 = 2650.8680979433148;
        bool r3986552 = r3986550 <= r3986551;
        double r3986553 = r3986550 * r3986550;
        double r3986554 = -3.0;
        double r3986555 = a;
        double r3986556 = c;
        double r3986557 = r3986555 * r3986556;
        double r3986558 = r3986554 * r3986557;
        double r3986559 = r3986553 + r3986558;
        double r3986560 = sqrt(r3986559);
        double r3986561 = r3986559 * r3986560;
        double r3986562 = r3986553 * r3986550;
        double r3986563 = r3986561 - r3986562;
        double r3986564 = r3986550 * r3986560;
        double r3986565 = r3986564 + r3986553;
        double r3986566 = r3986559 + r3986565;
        double r3986567 = r3986563 / r3986566;
        double r3986568 = 3.0;
        double r3986569 = r3986555 * r3986568;
        double r3986570 = r3986567 / r3986569;
        double r3986571 = -0.5;
        double r3986572 = r3986556 / r3986550;
        double r3986573 = r3986571 * r3986572;
        double r3986574 = r3986552 ? r3986570 : r3986573;
        return r3986574;
}

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

    1. Initial program 18.1

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

      \[\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--18.2

      \[\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. Simplified17.5

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

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

    if 2650.8680979433148 < b

    1. Initial program 37.7

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

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

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

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

      \[\leadsto \frac{\frac{-3}{2}}{\color{blue}{3 \cdot \frac{b}{c}}}\]
    7. Taylor expanded around 0 15.1

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

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

Reproduce

herbie shell --seed 2019146 
(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 a) c)))) (* 3 a)))