Average Error: 28.4 → 16.4
Time: 44.0s
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 1280.9648594844743:\\ \;\;\;\;\frac{\left(b \cdot b - c \cdot \left(3 \cdot a\right)\right) \cdot \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} - \left(b \cdot b\right) \cdot b}{\left(3 \cdot a\right) \cdot \left(\left(b \cdot \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} + b \cdot b\right) + \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} \cdot \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)}\right)}\\ \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 1280.9648594844743:\\
\;\;\;\;\frac{\left(b \cdot b - c \cdot \left(3 \cdot a\right)\right) \cdot \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} - \left(b \cdot b\right) \cdot b}{\left(3 \cdot a\right) \cdot \left(\left(b \cdot \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} + b \cdot b\right) + \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} \cdot \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)}\right)}\\

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

\end{array}
double f(double a, double b, double c, double __attribute__((unused)) d) {
        double r14103580 = b;
        double r14103581 = -r14103580;
        double r14103582 = r14103580 * r14103580;
        double r14103583 = 3.0;
        double r14103584 = a;
        double r14103585 = r14103583 * r14103584;
        double r14103586 = c;
        double r14103587 = r14103585 * r14103586;
        double r14103588 = r14103582 - r14103587;
        double r14103589 = sqrt(r14103588);
        double r14103590 = r14103581 + r14103589;
        double r14103591 = r14103590 / r14103585;
        return r14103591;
}

double f(double a, double b, double c, double __attribute__((unused)) d) {
        double r14103592 = b;
        double r14103593 = 1280.9648594844743;
        bool r14103594 = r14103592 <= r14103593;
        double r14103595 = r14103592 * r14103592;
        double r14103596 = c;
        double r14103597 = 3.0;
        double r14103598 = a;
        double r14103599 = r14103597 * r14103598;
        double r14103600 = r14103596 * r14103599;
        double r14103601 = r14103595 - r14103600;
        double r14103602 = sqrt(r14103601);
        double r14103603 = r14103601 * r14103602;
        double r14103604 = r14103595 * r14103592;
        double r14103605 = r14103603 - r14103604;
        double r14103606 = r14103592 * r14103602;
        double r14103607 = r14103606 + r14103595;
        double r14103608 = r14103602 * r14103602;
        double r14103609 = r14103607 + r14103608;
        double r14103610 = r14103599 * r14103609;
        double r14103611 = r14103605 / r14103610;
        double r14103612 = -0.5;
        double r14103613 = r14103596 / r14103592;
        double r14103614 = r14103612 * r14103613;
        double r14103615 = r14103594 ? r14103611 : r14103614;
        return r14103615;
}

Error

Bits error versus a

Bits error versus b

Bits error versus c

Bits error versus d

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 2 regimes
  2. if b < 1280.9648594844743

    1. Initial program 17.4

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

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

      \[\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. Applied associate-/l/17.5

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

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

    if 1280.9648594844743 < b

    1. Initial program 36.4

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

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

      \[\leadsto \frac{\color{blue}{\frac{-3}{2} \cdot \frac{a \cdot c}{b}}}{3 \cdot a}\]
    4. Using strategy rm
    5. Applied add-sqr-sqrt16.3

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

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

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

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

Reproduce

herbie shell --seed 2019104 
(FPCore (a b c d)
  :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)))