Average Error: 28.8 → 16.6
Time: 18.1s
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 107.32720840921216:\\ \;\;\;\;\frac{\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}{b \cdot \sqrt{b \cdot b + \left(c \cdot a\right) \cdot -4} + \left(b \cdot b + \left(b \cdot b + \left(c \cdot a\right) \cdot -4\right)\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 107.32720840921216:\\
\;\;\;\;\frac{\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}{b \cdot \sqrt{b \cdot b + \left(c \cdot a\right) \cdot -4} + \left(b \cdot b + \left(b \cdot b + \left(c \cdot a\right) \cdot -4\right)\right)}}{a}}{2}\\

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

\end{array}
double f(double a, double b, double c) {
        double r1300882 = b;
        double r1300883 = -r1300882;
        double r1300884 = r1300882 * r1300882;
        double r1300885 = 4.0;
        double r1300886 = a;
        double r1300887 = r1300885 * r1300886;
        double r1300888 = c;
        double r1300889 = r1300887 * r1300888;
        double r1300890 = r1300884 - r1300889;
        double r1300891 = sqrt(r1300890);
        double r1300892 = r1300883 + r1300891;
        double r1300893 = 2.0;
        double r1300894 = r1300893 * r1300886;
        double r1300895 = r1300892 / r1300894;
        return r1300895;
}

double f(double a, double b, double c) {
        double r1300896 = b;
        double r1300897 = 107.32720840921216;
        bool r1300898 = r1300896 <= r1300897;
        double r1300899 = r1300896 * r1300896;
        double r1300900 = c;
        double r1300901 = a;
        double r1300902 = r1300900 * r1300901;
        double r1300903 = -4.0;
        double r1300904 = r1300902 * r1300903;
        double r1300905 = r1300899 + r1300904;
        double r1300906 = sqrt(r1300905);
        double r1300907 = r1300905 * r1300906;
        double r1300908 = r1300899 * r1300896;
        double r1300909 = r1300907 - r1300908;
        double r1300910 = r1300896 * r1300906;
        double r1300911 = r1300899 + r1300905;
        double r1300912 = r1300910 + r1300911;
        double r1300913 = r1300909 / r1300912;
        double r1300914 = r1300913 / r1300901;
        double r1300915 = 2.0;
        double r1300916 = r1300914 / r1300915;
        double r1300917 = -2.0;
        double r1300918 = r1300900 / r1300896;
        double r1300919 = r1300917 * r1300918;
        double r1300920 = r1300919 / r1300915;
        double r1300921 = r1300898 ? r1300916 : r1300920;
        return r1300921;
}

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

    1. Initial program 15.4

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

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

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

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

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

    if 107.32720840921216 < b

    1. Initial program 34.8

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

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

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

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

Reproduce

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