Average Error: 43.9 → 11.5
Time: 52.6s
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 4.712102921992177:\\ \;\;\;\;\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)} - \left(b \cdot b\right) \cdot b}{\left(2 \cdot a\right) \cdot \left(\left(b \cdot b + b \cdot \sqrt{b \cdot b - 4 \cdot \left(c \cdot a\right)}\right) + \sqrt{b \cdot b - 4 \cdot \left(c \cdot a\right)} \cdot \sqrt{b \cdot b - 4 \cdot \left(c \cdot a\right)}\right)}\\ \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 4.712102921992177:\\
\;\;\;\;\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)} - \left(b \cdot b\right) \cdot b}{\left(2 \cdot a\right) \cdot \left(\left(b \cdot b + b \cdot \sqrt{b \cdot b - 4 \cdot \left(c \cdot a\right)}\right) + \sqrt{b \cdot b - 4 \cdot \left(c \cdot a\right)} \cdot \sqrt{b \cdot b - 4 \cdot \left(c \cdot a\right)}\right)}\\

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

\end{array}
double f(double a, double b, double c) {
        double r8363834 = b;
        double r8363835 = -r8363834;
        double r8363836 = r8363834 * r8363834;
        double r8363837 = 4.0;
        double r8363838 = a;
        double r8363839 = r8363837 * r8363838;
        double r8363840 = c;
        double r8363841 = r8363839 * r8363840;
        double r8363842 = r8363836 - r8363841;
        double r8363843 = sqrt(r8363842);
        double r8363844 = r8363835 + r8363843;
        double r8363845 = 2.0;
        double r8363846 = r8363845 * r8363838;
        double r8363847 = r8363844 / r8363846;
        return r8363847;
}

double f(double a, double b, double c) {
        double r8363848 = b;
        double r8363849 = 4.712102921992177;
        bool r8363850 = r8363848 <= r8363849;
        double r8363851 = r8363848 * r8363848;
        double r8363852 = 4.0;
        double r8363853 = c;
        double r8363854 = a;
        double r8363855 = r8363853 * r8363854;
        double r8363856 = r8363852 * r8363855;
        double r8363857 = r8363851 - r8363856;
        double r8363858 = sqrt(r8363857);
        double r8363859 = r8363857 * r8363858;
        double r8363860 = r8363851 * r8363848;
        double r8363861 = r8363859 - r8363860;
        double r8363862 = 2.0;
        double r8363863 = r8363862 * r8363854;
        double r8363864 = r8363848 * r8363858;
        double r8363865 = r8363851 + r8363864;
        double r8363866 = r8363858 * r8363858;
        double r8363867 = r8363865 + r8363866;
        double r8363868 = r8363863 * r8363867;
        double r8363869 = r8363861 / r8363868;
        double r8363870 = r8363853 / r8363848;
        double r8363871 = -r8363870;
        double r8363872 = r8363850 ? r8363869 : r8363871;
        return r8363872;
}

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

    1. Initial program 24.5

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

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

      \[\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. Applied associate-/l/24.6

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

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

    if 4.712102921992177 < b

    1. Initial program 48.0

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le 4.712102921992177:\\ \;\;\;\;\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)} - \left(b \cdot b\right) \cdot b}{\left(2 \cdot a\right) \cdot \left(\left(b \cdot b + b \cdot \sqrt{b \cdot b - 4 \cdot \left(c \cdot a\right)}\right) + \sqrt{b \cdot b - 4 \cdot \left(c \cdot a\right)} \cdot \sqrt{b \cdot b - 4 \cdot \left(c \cdot a\right)}\right)}\\ \mathbf{else}:\\ \;\;\;\;-\frac{c}{b}\\ \end{array}\]

Reproduce

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