Average Error: 28.6 → 16.2
Time: 6.1s
Precision: 64
\[1.05367121277235087 \cdot 10^{-8} \lt a \lt 94906265.6242515594 \land 1.05367121277235087 \cdot 10^{-8} \lt b \lt 94906265.6242515594 \land 1.05367121277235087 \cdot 10^{-8} \lt c \lt 94906265.6242515594\]
\[\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 3187.18097597923543:\\ \;\;\;\;\frac{\frac{{b}^{2} - \left({b}^{2} - 3 \cdot \left(a \cdot c\right)\right)}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}{3 \cdot a}\\ \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 3187.18097597923543:\\
\;\;\;\;\frac{\frac{{b}^{2} - \left({b}^{2} - 3 \cdot \left(a \cdot c\right)\right)}{\left(-b\right) - \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}}{3 \cdot a}\\

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

\end{array}
double f(double a, double b, double c) {
        double r124129 = b;
        double r124130 = -r124129;
        double r124131 = r124129 * r124129;
        double r124132 = 3.0;
        double r124133 = a;
        double r124134 = r124132 * r124133;
        double r124135 = c;
        double r124136 = r124134 * r124135;
        double r124137 = r124131 - r124136;
        double r124138 = sqrt(r124137);
        double r124139 = r124130 + r124138;
        double r124140 = r124139 / r124134;
        return r124140;
}

double f(double a, double b, double c) {
        double r124141 = b;
        double r124142 = 3187.1809759792354;
        bool r124143 = r124141 <= r124142;
        double r124144 = 2.0;
        double r124145 = pow(r124141, r124144);
        double r124146 = 3.0;
        double r124147 = a;
        double r124148 = c;
        double r124149 = r124147 * r124148;
        double r124150 = r124146 * r124149;
        double r124151 = r124145 - r124150;
        double r124152 = r124145 - r124151;
        double r124153 = -r124141;
        double r124154 = r124141 * r124141;
        double r124155 = r124146 * r124147;
        double r124156 = r124155 * r124148;
        double r124157 = r124154 - r124156;
        double r124158 = sqrt(r124157);
        double r124159 = r124153 - r124158;
        double r124160 = r124152 / r124159;
        double r124161 = r124160 / r124155;
        double r124162 = -0.5;
        double r124163 = r124148 / r124141;
        double r124164 = r124162 * r124163;
        double r124165 = r124143 ? r124161 : r124164;
        return r124165;
}

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

    1. Initial program 18.3

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Using strategy rm
    3. Applied flip-+18.3

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

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

    if 3187.1809759792354 < b

    1. Initial program 37.4

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Taylor expanded around inf 15.4

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

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

Reproduce

herbie shell --seed 2020047 
(FPCore (a b c)
  :name "Cubic critical, narrow range"
  :precision binary64
  :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)))