Average Error: 28.6 → 16.3
Time: 15.7s
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 563.9094021205955:\\ \;\;\;\;\frac{\frac{\frac{\left(b \cdot b + \left(-4 \cdot a\right) \cdot c\right) \cdot \sqrt{b \cdot b + \left(-4 \cdot a\right) \cdot c} - \left(b \cdot b\right) \cdot b}{\left(b \cdot b + \left(-4 \cdot a\right) \cdot c\right) + \left(b \cdot \sqrt{b \cdot b + \left(-4 \cdot a\right) \cdot c} + 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 563.9094021205955:\\
\;\;\;\;\frac{\frac{\frac{\left(b \cdot b + \left(-4 \cdot a\right) \cdot c\right) \cdot \sqrt{b \cdot b + \left(-4 \cdot a\right) \cdot c} - \left(b \cdot b\right) \cdot b}{\left(b \cdot b + \left(-4 \cdot a\right) \cdot c\right) + \left(b \cdot \sqrt{b \cdot b + \left(-4 \cdot a\right) \cdot c} + 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 r1774470 = b;
        double r1774471 = -r1774470;
        double r1774472 = r1774470 * r1774470;
        double r1774473 = 4.0;
        double r1774474 = a;
        double r1774475 = r1774473 * r1774474;
        double r1774476 = c;
        double r1774477 = r1774475 * r1774476;
        double r1774478 = r1774472 - r1774477;
        double r1774479 = sqrt(r1774478);
        double r1774480 = r1774471 + r1774479;
        double r1774481 = 2.0;
        double r1774482 = r1774481 * r1774474;
        double r1774483 = r1774480 / r1774482;
        return r1774483;
}

double f(double a, double b, double c) {
        double r1774484 = b;
        double r1774485 = 563.9094021205955;
        bool r1774486 = r1774484 <= r1774485;
        double r1774487 = r1774484 * r1774484;
        double r1774488 = -4.0;
        double r1774489 = a;
        double r1774490 = r1774488 * r1774489;
        double r1774491 = c;
        double r1774492 = r1774490 * r1774491;
        double r1774493 = r1774487 + r1774492;
        double r1774494 = sqrt(r1774493);
        double r1774495 = r1774493 * r1774494;
        double r1774496 = r1774487 * r1774484;
        double r1774497 = r1774495 - r1774496;
        double r1774498 = r1774484 * r1774494;
        double r1774499 = r1774498 + r1774487;
        double r1774500 = r1774493 + r1774499;
        double r1774501 = r1774497 / r1774500;
        double r1774502 = r1774501 / r1774489;
        double r1774503 = 2.0;
        double r1774504 = r1774502 / r1774503;
        double r1774505 = -2.0;
        double r1774506 = r1774491 / r1774484;
        double r1774507 = r1774505 * r1774506;
        double r1774508 = r1774507 / r1774503;
        double r1774509 = r1774486 ? r1774504 : r1774508;
        return r1774509;
}

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

    1. Initial program 16.6

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

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

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

      \[\leadsto \frac{\frac{\frac{\color{blue}{\sqrt{b \cdot b + c \cdot \left(-4 \cdot a\right)} \cdot \left(b \cdot b + c \cdot \left(-4 \cdot a\right)\right) - b \cdot \left(b \cdot b\right)}}{\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. Simplified16.0

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

    if 563.9094021205955 < b

    1. Initial program 36.0

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

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

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

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

Reproduce

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