Average Error: 28.7 → 16.2
Time: 13.1s
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 1459.466396695320781873306259512901306152:\\ \;\;\;\;\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 1459.466396695320781873306259512901306152:\\
\;\;\;\;\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 r29336 = b;
        double r29337 = -r29336;
        double r29338 = r29336 * r29336;
        double r29339 = 4.0;
        double r29340 = a;
        double r29341 = r29339 * r29340;
        double r29342 = c;
        double r29343 = r29341 * r29342;
        double r29344 = r29338 - r29343;
        double r29345 = sqrt(r29344);
        double r29346 = r29337 + r29345;
        double r29347 = 2.0;
        double r29348 = r29347 * r29340;
        double r29349 = r29346 / r29348;
        return r29349;
}

double f(double a, double b, double c) {
        double r29350 = b;
        double r29351 = 1459.4663966953208;
        bool r29352 = r29350 <= r29351;
        double r29353 = r29350 * r29350;
        double r29354 = 4.0;
        double r29355 = a;
        double r29356 = r29354 * r29355;
        double r29357 = c;
        double r29358 = r29356 * r29357;
        double r29359 = r29353 - r29358;
        double r29360 = r29359 - r29353;
        double r29361 = sqrt(r29359);
        double r29362 = r29361 + r29350;
        double r29363 = r29360 / r29362;
        double r29364 = 2.0;
        double r29365 = r29364 * r29355;
        double r29366 = r29363 / r29365;
        double r29367 = -1.0;
        double r29368 = r29357 / r29350;
        double r29369 = r29367 * r29368;
        double r29370 = r29352 ? r29366 : r29369;
        return r29370;
}

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

    1. Initial program 17.8

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

      \[\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--17.8

      \[\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. Simplified16.8

      \[\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 1459.4663966953208 < b

    1. Initial program 36.9

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le 1459.466396695320781873306259512901306152:\\ \;\;\;\;\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 2019304 
(FPCore (a b c)
  :name "Quadratic roots, narrow range"
  :precision binary64
  :pre (and (< 1.05367121277235087e-8 a 94906265.6242515594) (< 1.05367121277235087e-8 b 94906265.6242515594) (< 1.05367121277235087e-8 c 94906265.6242515594))
  (/ (+ (- b) (sqrt (- (* b b) (* (* 4 a) c)))) (* 2 a)))