Average Error: 28.5 → 16.4
Time: 7.3s
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(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
\[\begin{array}{l} \mathbf{if}\;b \le 140.4798093952274200546526117250323295593:\\ \;\;\;\;\frac{\frac{\left(b \cdot b - \left(4 \cdot a\right) \cdot c\right) - b \cdot b}{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} + b}}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;-1 \cdot \frac{c}{b}\\ \end{array}\]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}
\begin{array}{l}
\mathbf{if}\;b \le 140.4798093952274200546526117250323295593:\\
\;\;\;\;\frac{\frac{\left(b \cdot b - \left(4 \cdot a\right) \cdot c\right) - b \cdot b}{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} + b}}{2 \cdot a}\\

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

\end{array}
double f(double a, double b, double c) {
        double r19348 = b;
        double r19349 = -r19348;
        double r19350 = r19348 * r19348;
        double r19351 = 4.0;
        double r19352 = a;
        double r19353 = r19351 * r19352;
        double r19354 = c;
        double r19355 = r19353 * r19354;
        double r19356 = r19350 - r19355;
        double r19357 = sqrt(r19356);
        double r19358 = r19349 + r19357;
        double r19359 = 2.0;
        double r19360 = r19359 * r19352;
        double r19361 = r19358 / r19360;
        return r19361;
}

double f(double a, double b, double c) {
        double r19362 = b;
        double r19363 = 140.47980939522742;
        bool r19364 = r19362 <= r19363;
        double r19365 = r19362 * r19362;
        double r19366 = 4.0;
        double r19367 = a;
        double r19368 = r19366 * r19367;
        double r19369 = c;
        double r19370 = r19368 * r19369;
        double r19371 = r19365 - r19370;
        double r19372 = r19371 - r19365;
        double r19373 = sqrt(r19371);
        double r19374 = r19373 + r19362;
        double r19375 = r19372 / r19374;
        double r19376 = 2.0;
        double r19377 = r19376 * r19367;
        double r19378 = r19375 / r19377;
        double r19379 = -1.0;
        double r19380 = r19369 / r19362;
        double r19381 = r19379 * r19380;
        double r19382 = r19364 ? r19378 : r19381;
        return r19382;
}

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

    1. Initial program 15.1

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
    2. Simplified15.1

      \[\leadsto \color{blue}{\frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} - b}{2 \cdot a}}\]
    3. Using strategy rm
    4. Applied flip--15.1

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

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

    if 140.47980939522742 < b

    1. Initial program 34.7

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
    2. Simplified34.7

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

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

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

Reproduce

herbie shell --seed 2019351 
(FPCore (a b c)
  :name "Quadratic roots, 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) (* (* 4 a) c)))) (* 2 a)))