Average Error: 43.7 → 11.2
Time: 17.9s
Precision: 64
\[1.1102230246251565 \cdot 10^{-16} \lt a \lt 9007199254740992.0 \land 1.1102230246251565 \cdot 10^{-16} \lt b \lt 9007199254740992.0 \land 1.1102230246251565 \cdot 10^{-16} \lt c \lt 9007199254740992.0\]
\[\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 0.002027355084314286:\\ \;\;\;\;\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 0.002027355084314286:\\
\;\;\;\;\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 r1013215 = b;
        double r1013216 = -r1013215;
        double r1013217 = r1013215 * r1013215;
        double r1013218 = 4.0;
        double r1013219 = a;
        double r1013220 = r1013218 * r1013219;
        double r1013221 = c;
        double r1013222 = r1013220 * r1013221;
        double r1013223 = r1013217 - r1013222;
        double r1013224 = sqrt(r1013223);
        double r1013225 = r1013216 + r1013224;
        double r1013226 = 2.0;
        double r1013227 = r1013226 * r1013219;
        double r1013228 = r1013225 / r1013227;
        return r1013228;
}

double f(double a, double b, double c) {
        double r1013229 = b;
        double r1013230 = 0.002027355084314286;
        bool r1013231 = r1013229 <= r1013230;
        double r1013232 = r1013229 * r1013229;
        double r1013233 = a;
        double r1013234 = -4.0;
        double r1013235 = c;
        double r1013236 = r1013234 * r1013235;
        double r1013237 = r1013233 * r1013236;
        double r1013238 = r1013232 + r1013237;
        double r1013239 = sqrt(r1013238);
        double r1013240 = r1013238 * r1013239;
        double r1013241 = r1013232 * r1013229;
        double r1013242 = r1013240 - r1013241;
        double r1013243 = r1013229 * r1013239;
        double r1013244 = r1013243 + r1013232;
        double r1013245 = r1013238 + r1013244;
        double r1013246 = r1013242 / r1013245;
        double r1013247 = r1013246 / r1013233;
        double r1013248 = 2.0;
        double r1013249 = r1013247 / r1013248;
        double r1013250 = -2.0;
        double r1013251 = r1013235 / r1013229;
        double r1013252 = r1013250 * r1013251;
        double r1013253 = r1013252 / r1013248;
        double r1013254 = r1013231 ? r1013249 : r1013253;
        return r1013254;
}

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

    1. Initial program 20.3

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

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

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

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

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

    1. Initial program 46.1

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le 0.002027355084314286:\\ \;\;\;\;\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 2019138 
(FPCore (a b c)
  :name "Quadratic roots, medium range"
  :pre (and (< 1.1102230246251565e-16 a 9007199254740992.0) (< 1.1102230246251565e-16 b 9007199254740992.0) (< 1.1102230246251565e-16 c 9007199254740992.0))
  (/ (+ (- b) (sqrt (- (* b b) (* (* 4 a) c)))) (* 2 a)))