Average Error: 44.2 → 10.9
Time: 19.6s
Precision: 64
\[1.1102230246251565 \cdot 10^{-16} \lt a \lt 9007199254740992.0 \land 1.1102230246251565 \cdot 10^{-16} \lt b \lt 9007199254740992.0 \land 1.1102230246251565 \cdot 10^{-16} \lt c \lt 9007199254740992.0\]
\[\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 2.6223433915322215 \cdot 10^{-05}:\\ \;\;\;\;\frac{\frac{\frac{\left(b \cdot b + a \cdot \left(-4 \cdot c\right)\right) \cdot \sqrt{b \cdot b + a \cdot \left(-4 \cdot c\right)} - \left(b \cdot b\right) \cdot b}{\left(b \cdot b + a \cdot \left(-4 \cdot c\right)\right) + \left(b \cdot \sqrt{b \cdot b + a \cdot \left(-4 \cdot c\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 2.6223433915322215 \cdot 10^{-05}:\\
\;\;\;\;\frac{\frac{\frac{\left(b \cdot b + a \cdot \left(-4 \cdot c\right)\right) \cdot \sqrt{b \cdot b + a \cdot \left(-4 \cdot c\right)} - \left(b \cdot b\right) \cdot b}{\left(b \cdot b + a \cdot \left(-4 \cdot c\right)\right) + \left(b \cdot \sqrt{b \cdot b + a \cdot \left(-4 \cdot c\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 r1064066 = b;
        double r1064067 = -r1064066;
        double r1064068 = r1064066 * r1064066;
        double r1064069 = 4.0;
        double r1064070 = a;
        double r1064071 = r1064069 * r1064070;
        double r1064072 = c;
        double r1064073 = r1064071 * r1064072;
        double r1064074 = r1064068 - r1064073;
        double r1064075 = sqrt(r1064074);
        double r1064076 = r1064067 + r1064075;
        double r1064077 = 2.0;
        double r1064078 = r1064077 * r1064070;
        double r1064079 = r1064076 / r1064078;
        return r1064079;
}

double f(double a, double b, double c) {
        double r1064080 = b;
        double r1064081 = 2.6223433915322215e-05;
        bool r1064082 = r1064080 <= r1064081;
        double r1064083 = r1064080 * r1064080;
        double r1064084 = a;
        double r1064085 = -4.0;
        double r1064086 = c;
        double r1064087 = r1064085 * r1064086;
        double r1064088 = r1064084 * r1064087;
        double r1064089 = r1064083 + r1064088;
        double r1064090 = sqrt(r1064089);
        double r1064091 = r1064089 * r1064090;
        double r1064092 = r1064083 * r1064080;
        double r1064093 = r1064091 - r1064092;
        double r1064094 = r1064080 * r1064090;
        double r1064095 = r1064094 + r1064083;
        double r1064096 = r1064089 + r1064095;
        double r1064097 = r1064093 / r1064096;
        double r1064098 = r1064097 / r1064084;
        double r1064099 = 2.0;
        double r1064100 = r1064098 / r1064099;
        double r1064101 = -2.0;
        double r1064102 = r1064086 / r1064080;
        double r1064103 = r1064101 * r1064102;
        double r1064104 = r1064103 / r1064099;
        double r1064105 = r1064082 ? r1064100 : r1064104;
        return r1064105;
}

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 < 2.6223433915322215e-05

    1. Initial program 17.7

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

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

      \[\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. Simplified17.2

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

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

    if 2.6223433915322215e-05 < b

    1. Initial program 45.8

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le 2.6223433915322215 \cdot 10^{-05}:\\ \;\;\;\;\frac{\frac{\frac{\left(b \cdot b + a \cdot \left(-4 \cdot c\right)\right) \cdot \sqrt{b \cdot b + a \cdot \left(-4 \cdot c\right)} - \left(b \cdot b\right) \cdot b}{\left(b \cdot b + a \cdot \left(-4 \cdot c\right)\right) + \left(b \cdot \sqrt{b \cdot b + a \cdot \left(-4 \cdot c\right)} + b \cdot b\right)}}{a}}{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{-2 \cdot \frac{c}{b}}{2}\\ \end{array}\]

Reproduce

herbie shell --seed 2019139 
(FPCore (a b c)
  :name "Quadratic roots, medium range"
  :pre (and (< 1.1102230246251565e-16 a 9007199254740992.0) (< 1.1102230246251565e-16 b 9007199254740992.0) (< 1.1102230246251565e-16 c 9007199254740992.0))
  (/ (+ (- b) (sqrt (- (* b b) (* (* 4 a) c)))) (* 2 a)))