Average Error: 28.6 → 16.2
Time: 7.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 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 r155281 = b;
        double r155282 = -r155281;
        double r155283 = r155281 * r155281;
        double r155284 = 3.0;
        double r155285 = a;
        double r155286 = r155284 * r155285;
        double r155287 = c;
        double r155288 = r155286 * r155287;
        double r155289 = r155283 - r155288;
        double r155290 = sqrt(r155289);
        double r155291 = r155282 + r155290;
        double r155292 = r155291 / r155286;
        return r155292;
}

double f(double a, double b, double c) {
        double r155293 = b;
        double r155294 = 3187.1809759792354;
        bool r155295 = r155293 <= r155294;
        double r155296 = 2.0;
        double r155297 = pow(r155293, r155296);
        double r155298 = 3.0;
        double r155299 = a;
        double r155300 = c;
        double r155301 = r155299 * r155300;
        double r155302 = r155298 * r155301;
        double r155303 = r155297 - r155302;
        double r155304 = r155297 - r155303;
        double r155305 = -r155293;
        double r155306 = r155293 * r155293;
        double r155307 = r155298 * r155299;
        double r155308 = r155307 * r155300;
        double r155309 = r155306 - r155308;
        double r155310 = sqrt(r155309);
        double r155311 = r155305 - r155310;
        double r155312 = r155304 / r155311;
        double r155313 = r155312 / r155307;
        double r155314 = -0.5;
        double r155315 = r155300 / r155293;
        double r155316 = r155314 * r155315;
        double r155317 = r155295 ? r155313 : r155316;
        return r155317;
}

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