Average Error: 28.5 → 17.0
Time: 22.2s
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 53.72772989939689125549193704500794410706:\\ \;\;\;\;\frac{\frac{\frac{\left(b \cdot b - c \cdot \left(4 \cdot a\right)\right) \cdot \sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)} - \left(b \cdot b\right) \cdot b}{\left(b \cdot b - c \cdot \left(4 \cdot a\right)\right) + \left(b \cdot \sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)} + b \cdot b\right)}}{2}}{a}\\ \mathbf{elif}\;b \le 250.8081548127311179996468126773834228516:\\ \;\;\;\;\frac{c}{b} \cdot -1\\ \mathbf{elif}\;b \le 2125.07914601017046152264811098575592041:\\ \;\;\;\;\frac{\frac{\frac{\left(b \cdot b - c \cdot \left(4 \cdot a\right)\right) \cdot \sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)} - \left(b \cdot b\right) \cdot b}{\left(b \cdot b - c \cdot \left(4 \cdot a\right)\right) + \left(b \cdot \sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)} + b \cdot b\right)}}{2}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} \cdot -1\\ \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 53.72772989939689125549193704500794410706:\\
\;\;\;\;\frac{\frac{\frac{\left(b \cdot b - c \cdot \left(4 \cdot a\right)\right) \cdot \sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)} - \left(b \cdot b\right) \cdot b}{\left(b \cdot b - c \cdot \left(4 \cdot a\right)\right) + \left(b \cdot \sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)} + b \cdot b\right)}}{2}}{a}\\

\mathbf{elif}\;b \le 250.8081548127311179996468126773834228516:\\
\;\;\;\;\frac{c}{b} \cdot -1\\

\mathbf{elif}\;b \le 2125.07914601017046152264811098575592041:\\
\;\;\;\;\frac{\frac{\frac{\left(b \cdot b - c \cdot \left(4 \cdot a\right)\right) \cdot \sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)} - \left(b \cdot b\right) \cdot b}{\left(b \cdot b - c \cdot \left(4 \cdot a\right)\right) + \left(b \cdot \sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)} + b \cdot b\right)}}{2}}{a}\\

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

\end{array}
double f(double a, double b, double c) {
        double r2090912 = b;
        double r2090913 = -r2090912;
        double r2090914 = r2090912 * r2090912;
        double r2090915 = 4.0;
        double r2090916 = a;
        double r2090917 = r2090915 * r2090916;
        double r2090918 = c;
        double r2090919 = r2090917 * r2090918;
        double r2090920 = r2090914 - r2090919;
        double r2090921 = sqrt(r2090920);
        double r2090922 = r2090913 + r2090921;
        double r2090923 = 2.0;
        double r2090924 = r2090923 * r2090916;
        double r2090925 = r2090922 / r2090924;
        return r2090925;
}

double f(double a, double b, double c) {
        double r2090926 = b;
        double r2090927 = 53.72772989939689;
        bool r2090928 = r2090926 <= r2090927;
        double r2090929 = r2090926 * r2090926;
        double r2090930 = c;
        double r2090931 = 4.0;
        double r2090932 = a;
        double r2090933 = r2090931 * r2090932;
        double r2090934 = r2090930 * r2090933;
        double r2090935 = r2090929 - r2090934;
        double r2090936 = sqrt(r2090935);
        double r2090937 = r2090935 * r2090936;
        double r2090938 = r2090929 * r2090926;
        double r2090939 = r2090937 - r2090938;
        double r2090940 = r2090926 * r2090936;
        double r2090941 = r2090940 + r2090929;
        double r2090942 = r2090935 + r2090941;
        double r2090943 = r2090939 / r2090942;
        double r2090944 = 2.0;
        double r2090945 = r2090943 / r2090944;
        double r2090946 = r2090945 / r2090932;
        double r2090947 = 250.80815481273112;
        bool r2090948 = r2090926 <= r2090947;
        double r2090949 = r2090930 / r2090926;
        double r2090950 = -1.0;
        double r2090951 = r2090949 * r2090950;
        double r2090952 = 2125.0791460101705;
        bool r2090953 = r2090926 <= r2090952;
        double r2090954 = r2090953 ? r2090946 : r2090951;
        double r2090955 = r2090948 ? r2090951 : r2090954;
        double r2090956 = r2090928 ? r2090946 : r2090955;
        return r2090956;
}

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 < 53.72772989939689 or 250.80815481273112 < b < 2125.0791460101705

    1. Initial program 17.3

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

      \[\leadsto \color{blue}{\frac{\frac{\sqrt{b \cdot b - \left(c \cdot a\right) \cdot 4} - b}{2}}{a}}\]
    3. Using strategy rm
    4. Applied flip3--17.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)}}}{2}}{a}\]
    5. Simplified16.6

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

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

    if 53.72772989939689 < b < 250.80815481273112 or 2125.0791460101705 < b

    1. Initial program 35.0

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

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

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

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

Reproduce

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