Average Error: 28.8 → 17.3
Time: 27.1s
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 14.42119907524596733594535180600360035896:\\ \;\;\;\;\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}{\mathsf{fma}\left(b, \sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} + b, b \cdot b - c \cdot \left(a \cdot 3\right)\right)}}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \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 14.42119907524596733594535180600360035896:\\
\;\;\;\;\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}{\mathsf{fma}\left(b, \sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} + b, b \cdot b - c \cdot \left(a \cdot 3\right)\right)}}{a \cdot 3}\\

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

\end{array}
double f(double a, double b, double c) {
        double r4461363 = b;
        double r4461364 = -r4461363;
        double r4461365 = r4461363 * r4461363;
        double r4461366 = 3.0;
        double r4461367 = a;
        double r4461368 = r4461366 * r4461367;
        double r4461369 = c;
        double r4461370 = r4461368 * r4461369;
        double r4461371 = r4461365 - r4461370;
        double r4461372 = sqrt(r4461371);
        double r4461373 = r4461364 + r4461372;
        double r4461374 = r4461373 / r4461368;
        return r4461374;
}

double f(double a, double b, double c) {
        double r4461375 = b;
        double r4461376 = 14.421199075245967;
        bool r4461377 = r4461375 <= r4461376;
        double r4461378 = r4461375 * r4461375;
        double r4461379 = c;
        double r4461380 = a;
        double r4461381 = 3.0;
        double r4461382 = r4461380 * r4461381;
        double r4461383 = r4461379 * r4461382;
        double r4461384 = r4461378 - r4461383;
        double r4461385 = sqrt(r4461384);
        double r4461386 = r4461384 * r4461385;
        double r4461387 = r4461378 * r4461375;
        double r4461388 = r4461386 - r4461387;
        double r4461389 = r4461385 + r4461375;
        double r4461390 = fma(r4461375, r4461389, r4461384);
        double r4461391 = r4461388 / r4461390;
        double r4461392 = r4461391 / r4461382;
        double r4461393 = -0.5;
        double r4461394 = r4461379 / r4461375;
        double r4461395 = r4461393 * r4461394;
        double r4461396 = r4461377 ? r4461392 : r4461395;
        return r4461396;
}

Error

Bits error versus a

Bits error versus b

Bits error versus c

Derivation

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

    1. Initial program 13.9

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

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

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

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

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

    if 14.421199075245967 < b

    1. Initial program 33.4

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le 14.42119907524596733594535180600360035896:\\ \;\;\;\;\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}{\mathsf{fma}\left(b, \sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} + b, b \cdot b - c \cdot \left(a \cdot 3\right)\right)}}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b}\\ \end{array}\]

Reproduce

herbie shell --seed 2019200 +o rules:numerics
(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)))