Average Error: 28.7 → 16.2
Time: 32.7s
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 1647.131571019072:\\ \;\;\;\;\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 1647.131571019072:\\
\;\;\;\;\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 r4014280 = b;
        double r4014281 = -r4014280;
        double r4014282 = r4014280 * r4014280;
        double r4014283 = 3.0;
        double r4014284 = a;
        double r4014285 = r4014283 * r4014284;
        double r4014286 = c;
        double r4014287 = r4014285 * r4014286;
        double r4014288 = r4014282 - r4014287;
        double r4014289 = sqrt(r4014288);
        double r4014290 = r4014281 + r4014289;
        double r4014291 = r4014290 / r4014285;
        return r4014291;
}

double f(double a, double b, double c) {
        double r4014292 = b;
        double r4014293 = 1647.131571019072;
        bool r4014294 = r4014292 <= r4014293;
        double r4014295 = r4014292 * r4014292;
        double r4014296 = -3.0;
        double r4014297 = a;
        double r4014298 = c;
        double r4014299 = r4014297 * r4014298;
        double r4014300 = r4014296 * r4014299;
        double r4014301 = r4014295 + r4014300;
        double r4014302 = sqrt(r4014301);
        double r4014303 = r4014301 * r4014302;
        double r4014304 = r4014295 * r4014292;
        double r4014305 = r4014303 - r4014304;
        double r4014306 = r4014292 * r4014302;
        double r4014307 = r4014306 + r4014295;
        double r4014308 = r4014301 + r4014307;
        double r4014309 = r4014305 / r4014308;
        double r4014310 = 3.0;
        double r4014311 = r4014297 * r4014310;
        double r4014312 = r4014309 / r4014311;
        double r4014313 = -0.5;
        double r4014314 = r4014298 / r4014292;
        double r4014315 = r4014313 * r4014314;
        double r4014316 = r4014294 ? r4014312 : r4014315;
        return r4014316;
}

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

    1. Initial program 17.5

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Simplified17.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--17.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. Simplified16.8

      \[\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. Simplified16.8

      \[\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 1647.131571019072 < b

    1. Initial program 36.9

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

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

      \[\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 1647.131571019072:\\ \;\;\;\;\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 2019149 
(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)))