Average Error: 28.6 → 16.9
Time: 55.8s
Precision: 64
\[1.0536712127723509 \cdot 10^{-08} \lt a \lt 94906265.62425156 \land 1.0536712127723509 \cdot 10^{-08} \lt b \lt 94906265.62425156 \land 1.0536712127723509 \cdot 10^{-08} \lt c \lt 94906265.62425156\]
\[\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 91.36334998724752:\\ \;\;\;\;\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)} - \left(b \cdot b\right) \cdot b}{\left(b \cdot b - 4 \cdot \left(c \cdot a\right)\right) + \left(b \cdot \sqrt{b \cdot b - 4 \cdot \left(c \cdot a\right)} + b \cdot b\right)}}{a \cdot 2}\\ \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 91.36334998724752:\\
\;\;\;\;\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)} - \left(b \cdot b\right) \cdot b}{\left(b \cdot b - 4 \cdot \left(c \cdot a\right)\right) + \left(b \cdot \sqrt{b \cdot b - 4 \cdot \left(c \cdot a\right)} + b \cdot b\right)}}{a \cdot 2}\\

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

\end{array}
double f(double a, double b, double c) {
        double r4983928 = b;
        double r4983929 = -r4983928;
        double r4983930 = r4983928 * r4983928;
        double r4983931 = 4.0;
        double r4983932 = a;
        double r4983933 = r4983931 * r4983932;
        double r4983934 = c;
        double r4983935 = r4983933 * r4983934;
        double r4983936 = r4983930 - r4983935;
        double r4983937 = sqrt(r4983936);
        double r4983938 = r4983929 + r4983937;
        double r4983939 = 2.0;
        double r4983940 = r4983939 * r4983932;
        double r4983941 = r4983938 / r4983940;
        return r4983941;
}

double f(double a, double b, double c) {
        double r4983942 = b;
        double r4983943 = 91.36334998724752;
        bool r4983944 = r4983942 <= r4983943;
        double r4983945 = r4983942 * r4983942;
        double r4983946 = 4.0;
        double r4983947 = c;
        double r4983948 = a;
        double r4983949 = r4983947 * r4983948;
        double r4983950 = r4983946 * r4983949;
        double r4983951 = r4983945 - r4983950;
        double r4983952 = sqrt(r4983951);
        double r4983953 = r4983951 * r4983952;
        double r4983954 = r4983945 * r4983942;
        double r4983955 = r4983953 - r4983954;
        double r4983956 = r4983942 * r4983952;
        double r4983957 = r4983956 + r4983945;
        double r4983958 = r4983951 + r4983957;
        double r4983959 = r4983955 / r4983958;
        double r4983960 = 2.0;
        double r4983961 = r4983948 * r4983960;
        double r4983962 = r4983959 / r4983961;
        double r4983963 = r4983947 / r4983942;
        double r4983964 = -r4983963;
        double r4983965 = r4983944 ? r4983962 : r4983964;
        return r4983965;
}

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

    1. Initial program 15.2

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
    2. Simplified15.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--15.3

      \[\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. Simplified14.6

      \[\leadsto \frac{\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)}}{\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. Simplified14.6

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

    if 91.36334998724752 < b

    1. Initial program 34.2

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

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

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

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

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

Reproduce

herbie shell --seed 2019128 
(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 a) c)))) (* 2 a)))