Average Error: 44.0 → 11.0
Time: 25.9s
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 5.343652512340826 \cdot 10^{-05}:\\ \;\;\;\;\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}{\left(b + \sqrt{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 b}}{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 5.343652512340826 \cdot 10^{-05}:\\
\;\;\;\;\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}{\left(b + \sqrt{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 b}}{a}}{2}\\

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

\end{array}
double f(double a, double b, double c) {
        double r2123095 = b;
        double r2123096 = -r2123095;
        double r2123097 = r2123095 * r2123095;
        double r2123098 = 4.0;
        double r2123099 = a;
        double r2123100 = r2123098 * r2123099;
        double r2123101 = c;
        double r2123102 = r2123100 * r2123101;
        double r2123103 = r2123097 - r2123102;
        double r2123104 = sqrt(r2123103);
        double r2123105 = r2123096 + r2123104;
        double r2123106 = 2.0;
        double r2123107 = r2123106 * r2123099;
        double r2123108 = r2123105 / r2123107;
        return r2123108;
}

double f(double a, double b, double c) {
        double r2123109 = b;
        double r2123110 = 5.343652512340826e-05;
        bool r2123111 = r2123109 <= r2123110;
        double r2123112 = r2123109 * r2123109;
        double r2123113 = c;
        double r2123114 = a;
        double r2123115 = r2123113 * r2123114;
        double r2123116 = -4.0;
        double r2123117 = r2123115 * r2123116;
        double r2123118 = r2123112 + r2123117;
        double r2123119 = sqrt(r2123118);
        double r2123120 = r2123118 * r2123119;
        double r2123121 = r2123112 * r2123109;
        double r2123122 = r2123120 - r2123121;
        double r2123123 = r2123109 + r2123119;
        double r2123124 = r2123123 * r2123119;
        double r2123125 = r2123124 + r2123112;
        double r2123126 = r2123122 / r2123125;
        double r2123127 = r2123126 / r2123114;
        double r2123128 = 2.0;
        double r2123129 = r2123127 / r2123128;
        double r2123130 = -2.0;
        double r2123131 = r2123113 / r2123109;
        double r2123132 = r2123130 * r2123131;
        double r2123133 = r2123132 / r2123128;
        double r2123134 = r2123111 ? r2123129 : r2123133;
        return r2123134;
}

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

    1. Initial program 18.1

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

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

      \[\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.5

      \[\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) - 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)}}{a}}{2}\]
    6. Simplified17.5

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

    if 5.343652512340826e-05 < b

    1. Initial program 45.7

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

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

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

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

Reproduce

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