Average Error: 28.8 → 16.6
Time: 18.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 6959.325006529954:\\ \;\;\;\;\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 6959.325006529954:\\
\;\;\;\;\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 r1669921 = b;
        double r1669922 = -r1669921;
        double r1669923 = r1669921 * r1669921;
        double r1669924 = 4.0;
        double r1669925 = a;
        double r1669926 = r1669924 * r1669925;
        double r1669927 = c;
        double r1669928 = r1669926 * r1669927;
        double r1669929 = r1669923 - r1669928;
        double r1669930 = sqrt(r1669929);
        double r1669931 = r1669922 + r1669930;
        double r1669932 = 2.0;
        double r1669933 = r1669932 * r1669925;
        double r1669934 = r1669931 / r1669933;
        return r1669934;
}

double f(double a, double b, double c) {
        double r1669935 = b;
        double r1669936 = 6959.325006529954;
        bool r1669937 = r1669935 <= r1669936;
        double r1669938 = r1669935 * r1669935;
        double r1669939 = c;
        double r1669940 = a;
        double r1669941 = r1669939 * r1669940;
        double r1669942 = 4.0;
        double r1669943 = r1669941 * r1669942;
        double r1669944 = r1669938 - r1669943;
        double r1669945 = sqrt(r1669944);
        double r1669946 = r1669944 * r1669945;
        double r1669947 = r1669938 * r1669935;
        double r1669948 = r1669946 - r1669947;
        double r1669949 = r1669935 * r1669945;
        double r1669950 = r1669949 + r1669938;
        double r1669951 = r1669944 + r1669950;
        double r1669952 = r1669948 / r1669951;
        double r1669953 = 2.0;
        double r1669954 = r1669953 * r1669940;
        double r1669955 = r1669952 / r1669954;
        double r1669956 = r1669939 / r1669935;
        double r1669957 = -r1669956;
        double r1669958 = r1669937 ? r1669955 : r1669957;
        return r1669958;
}

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

    1. Initial program 19.0

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

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

      \[\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. Simplified18.3

      \[\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. Simplified18.3

      \[\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 6959.325006529954 < b

    1. Initial program 38.1

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le 6959.325006529954:\\ \;\;\;\;\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 2019130 
(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)))