Average Error: 28.7 → 17.1
Time: 6.3s
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 17.714642954298647:\\ \;\;\;\;\frac{\frac{\left({b}^{2} - 3 \cdot \left(a \cdot c\right)\right) - {b}^{2}}{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} + b}}{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 17.714642954298647:\\
\;\;\;\;\frac{\frac{\left({b}^{2} - 3 \cdot \left(a \cdot c\right)\right) - {b}^{2}}{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} + b}}{3 \cdot a}\\

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

\end{array}
double f(double a, double b, double c) {
        double r90150 = b;
        double r90151 = -r90150;
        double r90152 = r90150 * r90150;
        double r90153 = 3.0;
        double r90154 = a;
        double r90155 = r90153 * r90154;
        double r90156 = c;
        double r90157 = r90155 * r90156;
        double r90158 = r90152 - r90157;
        double r90159 = sqrt(r90158);
        double r90160 = r90151 + r90159;
        double r90161 = r90160 / r90155;
        return r90161;
}

double f(double a, double b, double c) {
        double r90162 = b;
        double r90163 = 17.714642954298647;
        bool r90164 = r90162 <= r90163;
        double r90165 = 2.0;
        double r90166 = pow(r90162, r90165);
        double r90167 = 3.0;
        double r90168 = a;
        double r90169 = c;
        double r90170 = r90168 * r90169;
        double r90171 = r90167 * r90170;
        double r90172 = r90166 - r90171;
        double r90173 = r90172 - r90166;
        double r90174 = r90162 * r90162;
        double r90175 = r90167 * r90168;
        double r90176 = r90175 * r90169;
        double r90177 = r90174 - r90176;
        double r90178 = sqrt(r90177);
        double r90179 = r90178 + r90162;
        double r90180 = r90173 / r90179;
        double r90181 = r90180 / r90175;
        double r90182 = -0.5;
        double r90183 = r90169 / r90162;
        double r90184 = r90182 * r90183;
        double r90185 = r90164 ? r90181 : r90184;
        return r90185;
}

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

    1. Initial program 14.0

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

      \[\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 flip--14.0

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

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

    if 17.714642954298647 < b

    1. Initial program 33.6

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

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

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

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

Reproduce

herbie shell --seed 2020046 
(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)))