Average Error: 33.9 → 29.2
Time: 23.8s
Precision: 64
\[\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 5.03307751825146 \cdot 10^{+142}:\\ \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(-3 \cdot a, c, b \cdot b\right)} - b}{3 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;0\\ \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 5.03307751825146 \cdot 10^{+142}:\\
\;\;\;\;\frac{\sqrt{\mathsf{fma}\left(-3 \cdot a, c, b \cdot b\right)} - b}{3 \cdot a}\\

\mathbf{else}:\\
\;\;\;\;0\\

\end{array}
double f(double a, double b, double c) {
        double r5979555 = b;
        double r5979556 = -r5979555;
        double r5979557 = r5979555 * r5979555;
        double r5979558 = 3.0;
        double r5979559 = a;
        double r5979560 = r5979558 * r5979559;
        double r5979561 = c;
        double r5979562 = r5979560 * r5979561;
        double r5979563 = r5979557 - r5979562;
        double r5979564 = sqrt(r5979563);
        double r5979565 = r5979556 + r5979564;
        double r5979566 = r5979565 / r5979560;
        return r5979566;
}

double f(double a, double b, double c) {
        double r5979567 = b;
        double r5979568 = 5.03307751825146e+142;
        bool r5979569 = r5979567 <= r5979568;
        double r5979570 = -3.0;
        double r5979571 = a;
        double r5979572 = r5979570 * r5979571;
        double r5979573 = c;
        double r5979574 = r5979567 * r5979567;
        double r5979575 = fma(r5979572, r5979573, r5979574);
        double r5979576 = sqrt(r5979575);
        double r5979577 = r5979576 - r5979567;
        double r5979578 = 3.0;
        double r5979579 = r5979578 * r5979571;
        double r5979580 = r5979577 / r5979579;
        double r5979581 = 0.0;
        double r5979582 = r5979569 ? r5979580 : r5979581;
        return r5979582;
}

Error

Bits error versus a

Bits error versus b

Bits error versus c

Derivation

  1. Split input into 2 regimes
  2. if b < 5.03307751825146e+142

    1. Initial program 26.9

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

      \[\leadsto \color{blue}{\frac{\sqrt{\mathsf{fma}\left(-3 \cdot a, c, b \cdot b\right)} - b}{3 \cdot a}}\]
    3. Using strategy rm
    4. Applied associate-/r*26.9

      \[\leadsto \color{blue}{\frac{\frac{\sqrt{\mathsf{fma}\left(-3 \cdot a, c, b \cdot b\right)} - b}{3}}{a}}\]
    5. Using strategy rm
    6. Applied associate-/l/26.9

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

    if 5.03307751825146e+142 < b

    1. Initial program 61.6

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

      \[\leadsto \color{blue}{\frac{\sqrt{\mathsf{fma}\left(-3 \cdot a, c, b \cdot b\right)} - b}{3 \cdot a}}\]
    3. Taylor expanded around 0 38.5

      \[\leadsto \color{blue}{0}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification29.2

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le 5.03307751825146 \cdot 10^{+142}:\\ \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(-3 \cdot a, c, b \cdot b\right)} - b}{3 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array}\]

Reproduce

herbie shell --seed 2019165 +o rules:numerics
(FPCore (a b c)
  :name "Cubic critical"
  (/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a)))