Average Error: 28.6 → 16.5
Time: 17.6s
Precision: 64
\[1.0536712127723509 \cdot 10^{-08} \lt a \lt 94906265.62425156 \land 1.0536712127723509 \cdot 10^{-08} \lt b \lt 94906265.62425156 \land 1.0536712127723509 \cdot 10^{-08} \lt c \lt 94906265.62425156\]
\[\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 2029.693337701399:\\ \;\;\;\;\frac{\frac{\frac{\left(b \cdot b + a \cdot \left(-4 \cdot c\right)\right) \cdot \sqrt{b \cdot b + a \cdot \left(-4 \cdot c\right)} - \left(b \cdot b\right) \cdot b}{\left(b \cdot b + a \cdot \left(-4 \cdot c\right)\right) + \left(b \cdot \sqrt{b \cdot b + a \cdot \left(-4 \cdot c\right)} + b \cdot b\right)}}{a}}{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{-2 \cdot \frac{c}{b}}{2}\\ \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 2029.693337701399:\\
\;\;\;\;\frac{\frac{\frac{\left(b \cdot b + a \cdot \left(-4 \cdot c\right)\right) \cdot \sqrt{b \cdot b + a \cdot \left(-4 \cdot c\right)} - \left(b \cdot b\right) \cdot b}{\left(b \cdot b + a \cdot \left(-4 \cdot c\right)\right) + \left(b \cdot \sqrt{b \cdot b + a \cdot \left(-4 \cdot c\right)} + b \cdot b\right)}}{a}}{2}\\

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

\end{array}
double f(double a, double b, double c) {
        double r1007362 = b;
        double r1007363 = -r1007362;
        double r1007364 = r1007362 * r1007362;
        double r1007365 = 4.0;
        double r1007366 = a;
        double r1007367 = r1007365 * r1007366;
        double r1007368 = c;
        double r1007369 = r1007367 * r1007368;
        double r1007370 = r1007364 - r1007369;
        double r1007371 = sqrt(r1007370);
        double r1007372 = r1007363 + r1007371;
        double r1007373 = 2.0;
        double r1007374 = r1007373 * r1007366;
        double r1007375 = r1007372 / r1007374;
        return r1007375;
}

double f(double a, double b, double c) {
        double r1007376 = b;
        double r1007377 = 2029.693337701399;
        bool r1007378 = r1007376 <= r1007377;
        double r1007379 = r1007376 * r1007376;
        double r1007380 = a;
        double r1007381 = -4.0;
        double r1007382 = c;
        double r1007383 = r1007381 * r1007382;
        double r1007384 = r1007380 * r1007383;
        double r1007385 = r1007379 + r1007384;
        double r1007386 = sqrt(r1007385);
        double r1007387 = r1007385 * r1007386;
        double r1007388 = r1007379 * r1007376;
        double r1007389 = r1007387 - r1007388;
        double r1007390 = r1007376 * r1007386;
        double r1007391 = r1007390 + r1007379;
        double r1007392 = r1007385 + r1007391;
        double r1007393 = r1007389 / r1007392;
        double r1007394 = r1007393 / r1007380;
        double r1007395 = 2.0;
        double r1007396 = r1007394 / r1007395;
        double r1007397 = -2.0;
        double r1007398 = r1007382 / r1007376;
        double r1007399 = r1007397 * r1007398;
        double r1007400 = r1007399 / r1007395;
        double r1007401 = r1007378 ? r1007396 : r1007400;
        return r1007401;
}

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

    1. Initial program 18.0

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

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

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

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

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

    if 2029.693337701399 < 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{\frac{\sqrt{b \cdot b - \left(c \cdot a\right) \cdot 4} - b}{a}}{2}}\]
    3. Taylor expanded around inf 15.8

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

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

Reproduce

herbie shell --seed 2019139 
(FPCore (a b c)
  :name "Quadratic roots, narrow range"
  :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)))