Average Error: 28.3 → 16.8
Time: 20.2s
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 60.51244836482759836826517130248248577118:\\ \;\;\;\;\frac{\frac{\frac{\left(b \cdot b - c \cdot \left(4 \cdot a\right)\right) \cdot \sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)} - \left(b \cdot b\right) \cdot b}{\left(b \cdot b - c \cdot \left(4 \cdot a\right)\right) + \left(b \cdot \sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)} + b \cdot b\right)}}{2}}{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 60.51244836482759836826517130248248577118:\\
\;\;\;\;\frac{\frac{\frac{\left(b \cdot b - c \cdot \left(4 \cdot a\right)\right) \cdot \sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)} - \left(b \cdot b\right) \cdot b}{\left(b \cdot b - c \cdot \left(4 \cdot a\right)\right) + \left(b \cdot \sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)} + b \cdot b\right)}}{2}}{a}\\

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

\end{array}
double f(double a, double b, double c) {
        double r1445413 = b;
        double r1445414 = -r1445413;
        double r1445415 = r1445413 * r1445413;
        double r1445416 = 4.0;
        double r1445417 = a;
        double r1445418 = r1445416 * r1445417;
        double r1445419 = c;
        double r1445420 = r1445418 * r1445419;
        double r1445421 = r1445415 - r1445420;
        double r1445422 = sqrt(r1445421);
        double r1445423 = r1445414 + r1445422;
        double r1445424 = 2.0;
        double r1445425 = r1445424 * r1445417;
        double r1445426 = r1445423 / r1445425;
        return r1445426;
}

double f(double a, double b, double c) {
        double r1445427 = b;
        double r1445428 = 60.5124483648276;
        bool r1445429 = r1445427 <= r1445428;
        double r1445430 = r1445427 * r1445427;
        double r1445431 = c;
        double r1445432 = 4.0;
        double r1445433 = a;
        double r1445434 = r1445432 * r1445433;
        double r1445435 = r1445431 * r1445434;
        double r1445436 = r1445430 - r1445435;
        double r1445437 = sqrt(r1445436);
        double r1445438 = r1445436 * r1445437;
        double r1445439 = r1445430 * r1445427;
        double r1445440 = r1445438 - r1445439;
        double r1445441 = r1445427 * r1445437;
        double r1445442 = r1445441 + r1445430;
        double r1445443 = r1445436 + r1445442;
        double r1445444 = r1445440 / r1445443;
        double r1445445 = 2.0;
        double r1445446 = r1445444 / r1445445;
        double r1445447 = r1445446 / r1445433;
        double r1445448 = -1.0;
        double r1445449 = r1445431 / r1445427;
        double r1445450 = r1445448 * r1445449;
        double r1445451 = r1445429 ? r1445447 : r1445450;
        return r1445451;
}

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

    1. Initial program 14.3

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

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

      \[\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)}}}{2}}{a}\]
    5. Simplified13.7

      \[\leadsto \frac{\frac{\frac{\color{blue}{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} \cdot \left(b \cdot b - \left(4 \cdot a\right) \cdot c\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)}}{2}}{a}\]
    6. Simplified13.7

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

    if 60.5124483648276 < b

    1. Initial program 33.9

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

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

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

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

Reproduce

herbie shell --seed 2019172 
(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.0 a) c)))) (* 2.0 a)))