Average Error: 43.8 → 11.3
Time: 17.0s
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 0.1979590906586723:\\ \;\;\;\;\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)} - \left(b \cdot b\right) \cdot b}{\left(b \cdot b - 4 \cdot \left(c \cdot a\right)\right) + \left(b \cdot \sqrt{b \cdot b - 4 \cdot \left(c \cdot a\right)} + b \cdot b\right)}}{a \cdot 2}\\ \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 0.1979590906586723:\\
\;\;\;\;\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)} - \left(b \cdot b\right) \cdot b}{\left(b \cdot b - 4 \cdot \left(c \cdot a\right)\right) + \left(b \cdot \sqrt{b \cdot b - 4 \cdot \left(c \cdot a\right)} + b \cdot b\right)}}{a \cdot 2}\\

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

\end{array}
double f(double a, double b, double c) {
        double r1099247 = b;
        double r1099248 = -r1099247;
        double r1099249 = r1099247 * r1099247;
        double r1099250 = 4.0;
        double r1099251 = a;
        double r1099252 = r1099250 * r1099251;
        double r1099253 = c;
        double r1099254 = r1099252 * r1099253;
        double r1099255 = r1099249 - r1099254;
        double r1099256 = sqrt(r1099255);
        double r1099257 = r1099248 + r1099256;
        double r1099258 = 2.0;
        double r1099259 = r1099258 * r1099251;
        double r1099260 = r1099257 / r1099259;
        return r1099260;
}

double f(double a, double b, double c) {
        double r1099261 = b;
        double r1099262 = 0.1979590906586723;
        bool r1099263 = r1099261 <= r1099262;
        double r1099264 = r1099261 * r1099261;
        double r1099265 = 4.0;
        double r1099266 = c;
        double r1099267 = a;
        double r1099268 = r1099266 * r1099267;
        double r1099269 = r1099265 * r1099268;
        double r1099270 = r1099264 - r1099269;
        double r1099271 = sqrt(r1099270);
        double r1099272 = r1099270 * r1099271;
        double r1099273 = r1099264 * r1099261;
        double r1099274 = r1099272 - r1099273;
        double r1099275 = r1099261 * r1099271;
        double r1099276 = r1099275 + r1099264;
        double r1099277 = r1099270 + r1099276;
        double r1099278 = r1099274 / r1099277;
        double r1099279 = 2.0;
        double r1099280 = r1099267 * r1099279;
        double r1099281 = r1099278 / r1099280;
        double r1099282 = -r1099266;
        double r1099283 = r1099282 / r1099261;
        double r1099284 = r1099263 ? r1099281 : r1099283;
        return r1099284;
}

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

    1. Initial program 22.9

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

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

      \[\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. Simplified22.4

      \[\leadsto \frac{\frac{\color{blue}{\left(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 \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. Simplified22.3

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

    if 0.1979590906586723 < b

    1. Initial program 47.4

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

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

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

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

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

Reproduce

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