Average Error: 28.8 → 17.3
Time: 26.8s
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 r2612660 = b;
        double r2612661 = -r2612660;
        double r2612662 = r2612660 * r2612660;
        double r2612663 = 3.0;
        double r2612664 = a;
        double r2612665 = r2612663 * r2612664;
        double r2612666 = c;
        double r2612667 = r2612665 * r2612666;
        double r2612668 = r2612662 - r2612667;
        double r2612669 = sqrt(r2612668);
        double r2612670 = r2612661 + r2612669;
        double r2612671 = r2612670 / r2612665;
        return r2612671;
}

double f(double a, double b, double c) {
        double r2612672 = b;
        double r2612673 = 14.421199075245967;
        bool r2612674 = r2612672 <= r2612673;
        double r2612675 = r2612672 * r2612672;
        double r2612676 = c;
        double r2612677 = a;
        double r2612678 = 3.0;
        double r2612679 = r2612677 * r2612678;
        double r2612680 = r2612676 * r2612679;
        double r2612681 = r2612675 - r2612680;
        double r2612682 = sqrt(r2612681);
        double r2612683 = r2612681 * r2612682;
        double r2612684 = r2612675 * r2612672;
        double r2612685 = r2612683 - r2612684;
        double r2612686 = r2612682 + r2612672;
        double r2612687 = fma(r2612672, r2612686, r2612681);
        double r2612688 = r2612685 / r2612687;
        double r2612689 = r2612688 / r2612679;
        double r2612690 = -0.5;
        double r2612691 = r2612676 / r2612672;
        double r2612692 = r2612690 * r2612691;
        double r2612693 = r2612674 ? r2612689 : r2612692;
        return r2612693;
}

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