Average Error: 28.3 → 16.8
Time: 16.5s
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 - a \cdot \left(c \cdot 4\right)\right) \cdot \sqrt{b \cdot b - a \cdot \left(c \cdot 4\right)} - \left(b \cdot b\right) \cdot b}{\left(b \cdot b - a \cdot \left(c \cdot 4\right)\right) + \left(b \cdot \sqrt{b \cdot b - a \cdot \left(c \cdot 4\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 60.51244836482759836826517130248248577118:\\
\;\;\;\;\frac{\frac{\frac{\left(b \cdot b - a \cdot \left(c \cdot 4\right)\right) \cdot \sqrt{b \cdot b - a \cdot \left(c \cdot 4\right)} - \left(b \cdot b\right) \cdot b}{\left(b \cdot b - a \cdot \left(c \cdot 4\right)\right) + \left(b \cdot \sqrt{b \cdot b - a \cdot \left(c \cdot 4\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 r1623854 = b;
        double r1623855 = -r1623854;
        double r1623856 = r1623854 * r1623854;
        double r1623857 = 4.0;
        double r1623858 = a;
        double r1623859 = r1623857 * r1623858;
        double r1623860 = c;
        double r1623861 = r1623859 * r1623860;
        double r1623862 = r1623856 - r1623861;
        double r1623863 = sqrt(r1623862);
        double r1623864 = r1623855 + r1623863;
        double r1623865 = 2.0;
        double r1623866 = r1623865 * r1623858;
        double r1623867 = r1623864 / r1623866;
        return r1623867;
}

double f(double a, double b, double c) {
        double r1623868 = b;
        double r1623869 = 60.5124483648276;
        bool r1623870 = r1623868 <= r1623869;
        double r1623871 = r1623868 * r1623868;
        double r1623872 = a;
        double r1623873 = c;
        double r1623874 = 4.0;
        double r1623875 = r1623873 * r1623874;
        double r1623876 = r1623872 * r1623875;
        double r1623877 = r1623871 - r1623876;
        double r1623878 = sqrt(r1623877);
        double r1623879 = r1623877 * r1623878;
        double r1623880 = r1623871 * r1623868;
        double r1623881 = r1623879 - r1623880;
        double r1623882 = r1623868 * r1623878;
        double r1623883 = r1623882 + r1623871;
        double r1623884 = r1623877 + r1623883;
        double r1623885 = r1623881 / r1623884;
        double r1623886 = r1623885 / r1623872;
        double r1623887 = 2.0;
        double r1623888 = r1623886 / r1623887;
        double r1623889 = -2.0;
        double r1623890 = r1623873 / r1623868;
        double r1623891 = r1623889 * r1623890;
        double r1623892 = r1623891 / r1623887;
        double r1623893 = r1623870 ? r1623888 : r1623892;
        return r1623893;
}

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

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

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

    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}{a}}{2}}\]
    3. Taylor expanded around inf 18.1

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