Average Error: 43.8 → 11.2
Time: 24.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.0007241352840798785:\\ \;\;\;\;\frac{\frac{\left(b \cdot b - \left(c \cdot a\right) \cdot 4\right) \cdot \sqrt{b \cdot b - \left(c \cdot a\right) \cdot 4} - \left(b \cdot b\right) \cdot b}{\left(b \cdot b - \left(c \cdot a\right) \cdot 4\right) + \left(b \cdot \sqrt{b \cdot b - \left(c \cdot a\right) \cdot 4} + b \cdot b\right)}}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;-\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 0.0007241352840798785:\\
\;\;\;\;\frac{\frac{\left(b \cdot b - \left(c \cdot a\right) \cdot 4\right) \cdot \sqrt{b \cdot b - \left(c \cdot a\right) \cdot 4} - \left(b \cdot b\right) \cdot b}{\left(b \cdot b - \left(c \cdot a\right) \cdot 4\right) + \left(b \cdot \sqrt{b \cdot b - \left(c \cdot a\right) \cdot 4} + b \cdot b\right)}}{2 \cdot a}\\

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

\end{array}
double f(double a, double b, double c) {
        double r1250996 = b;
        double r1250997 = -r1250996;
        double r1250998 = r1250996 * r1250996;
        double r1250999 = 4.0;
        double r1251000 = a;
        double r1251001 = r1250999 * r1251000;
        double r1251002 = c;
        double r1251003 = r1251001 * r1251002;
        double r1251004 = r1250998 - r1251003;
        double r1251005 = sqrt(r1251004);
        double r1251006 = r1250997 + r1251005;
        double r1251007 = 2.0;
        double r1251008 = r1251007 * r1251000;
        double r1251009 = r1251006 / r1251008;
        return r1251009;
}

double f(double a, double b, double c) {
        double r1251010 = b;
        double r1251011 = 0.0007241352840798785;
        bool r1251012 = r1251010 <= r1251011;
        double r1251013 = r1251010 * r1251010;
        double r1251014 = c;
        double r1251015 = a;
        double r1251016 = r1251014 * r1251015;
        double r1251017 = 4.0;
        double r1251018 = r1251016 * r1251017;
        double r1251019 = r1251013 - r1251018;
        double r1251020 = sqrt(r1251019);
        double r1251021 = r1251019 * r1251020;
        double r1251022 = r1251013 * r1251010;
        double r1251023 = r1251021 - r1251022;
        double r1251024 = r1251010 * r1251020;
        double r1251025 = r1251024 + r1251013;
        double r1251026 = r1251019 + r1251025;
        double r1251027 = r1251023 / r1251026;
        double r1251028 = 2.0;
        double r1251029 = r1251028 * r1251015;
        double r1251030 = r1251027 / r1251029;
        double r1251031 = r1251014 / r1251010;
        double r1251032 = -r1251031;
        double r1251033 = r1251012 ? r1251030 : r1251032;
        return r1251033;
}

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.0007241352840798785

    1. Initial program 20.2

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

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

      \[\leadsto \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 \cdot a}\]
    5. Simplified19.6

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

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

    if 0.0007241352840798785 < b

    1. Initial program 45.9

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

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

      \[\leadsto \color{blue}{-1 \cdot \frac{c}{b}}\]
    4. Simplified10.5

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

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

Reproduce

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