Average Error: 43.0 → 11.7
Time: 15.9s
Precision: 64
\[1.1102230246251565404236316680908203125 \cdot 10^{-16} \lt a \lt 9007199254740992 \land 1.1102230246251565404236316680908203125 \cdot 10^{-16} \lt b \lt 9007199254740992 \land 1.1102230246251565404236316680908203125 \cdot 10^{-16} \lt c \lt 9007199254740992\]
\[\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 1.143841598112384838194601800742677966127 \cdot 10^{-6}:\\ \;\;\;\;\frac{\frac{\frac{\left(b \cdot b - \left(a \cdot 4\right) \cdot c\right) \cdot \sqrt{b \cdot b - \left(a \cdot 4\right) \cdot c} - \left(b \cdot b\right) \cdot b}{\left(b \cdot b - \left(a \cdot 4\right) \cdot c\right) + \left(b \cdot \sqrt{b \cdot b - \left(a \cdot 4\right) \cdot c} + 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 1.143841598112384838194601800742677966127 \cdot 10^{-6}:\\
\;\;\;\;\frac{\frac{\frac{\left(b \cdot b - \left(a \cdot 4\right) \cdot c\right) \cdot \sqrt{b \cdot b - \left(a \cdot 4\right) \cdot c} - \left(b \cdot b\right) \cdot b}{\left(b \cdot b - \left(a \cdot 4\right) \cdot c\right) + \left(b \cdot \sqrt{b \cdot b - \left(a \cdot 4\right) \cdot c} + 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 r2267015 = b;
        double r2267016 = -r2267015;
        double r2267017 = r2267015 * r2267015;
        double r2267018 = 4.0;
        double r2267019 = a;
        double r2267020 = r2267018 * r2267019;
        double r2267021 = c;
        double r2267022 = r2267020 * r2267021;
        double r2267023 = r2267017 - r2267022;
        double r2267024 = sqrt(r2267023);
        double r2267025 = r2267016 + r2267024;
        double r2267026 = 2.0;
        double r2267027 = r2267026 * r2267019;
        double r2267028 = r2267025 / r2267027;
        return r2267028;
}

double f(double a, double b, double c) {
        double r2267029 = b;
        double r2267030 = 1.1438415981123848e-06;
        bool r2267031 = r2267029 <= r2267030;
        double r2267032 = r2267029 * r2267029;
        double r2267033 = a;
        double r2267034 = 4.0;
        double r2267035 = r2267033 * r2267034;
        double r2267036 = c;
        double r2267037 = r2267035 * r2267036;
        double r2267038 = r2267032 - r2267037;
        double r2267039 = sqrt(r2267038);
        double r2267040 = r2267038 * r2267039;
        double r2267041 = r2267032 * r2267029;
        double r2267042 = r2267040 - r2267041;
        double r2267043 = r2267029 * r2267039;
        double r2267044 = r2267043 + r2267032;
        double r2267045 = r2267038 + r2267044;
        double r2267046 = r2267042 / r2267045;
        double r2267047 = r2267046 / r2267033;
        double r2267048 = 2.0;
        double r2267049 = r2267047 / r2267048;
        double r2267050 = -2.0;
        double r2267051 = r2267036 / r2267029;
        double r2267052 = r2267050 * r2267051;
        double r2267053 = r2267052 / r2267048;
        double r2267054 = r2267031 ? r2267049 : r2267053;
        return r2267054;
}

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 < 1.1438415981123848e-06

    1. Initial program 14.4

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
    2. Simplified14.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--14.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)}}}{a}}{2}\]
    5. Simplified13.8

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

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

    if 1.1438415981123848e-06 < b

    1. Initial program 44.2

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

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

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

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

Reproduce

herbie shell --seed 2019171 
(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.0 a) c)))) (* 2.0 a)))