Average Error: 44.2 → 10.9
Time: 15.1s
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 1.259608519028323 \cdot 10^{-05}:\\ \;\;\;\;\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 \cdot b - \left(c \cdot a\right) \cdot 4\right) + \left(b \cdot \sqrt{b \cdot b - \left(c \cdot a\right) \cdot 4} + b \cdot b\right)}}{2 \cdot a}\\ \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 1.259608519028323 \cdot 10^{-05}:\\
\;\;\;\;\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 \cdot b - \left(c \cdot a\right) \cdot 4\right) + \left(b \cdot \sqrt{b \cdot b - \left(c \cdot a\right) \cdot 4} + b \cdot b\right)}}{2 \cdot a}\\

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

\end{array}
double f(double a, double b, double c) {
        double r1176297 = b;
        double r1176298 = -r1176297;
        double r1176299 = r1176297 * r1176297;
        double r1176300 = 4.0;
        double r1176301 = a;
        double r1176302 = r1176300 * r1176301;
        double r1176303 = c;
        double r1176304 = r1176302 * r1176303;
        double r1176305 = r1176299 - r1176304;
        double r1176306 = sqrt(r1176305);
        double r1176307 = r1176298 + r1176306;
        double r1176308 = 2.0;
        double r1176309 = r1176308 * r1176301;
        double r1176310 = r1176307 / r1176309;
        return r1176310;
}

double f(double a, double b, double c) {
        double r1176311 = b;
        double r1176312 = 1.259608519028323e-05;
        bool r1176313 = r1176311 <= r1176312;
        double r1176314 = r1176311 * r1176311;
        double r1176315 = c;
        double r1176316 = a;
        double r1176317 = r1176315 * r1176316;
        double r1176318 = 4.0;
        double r1176319 = r1176317 * r1176318;
        double r1176320 = r1176314 - r1176319;
        double r1176321 = sqrt(r1176320);
        double r1176322 = r1176320 * r1176321;
        double r1176323 = r1176314 * r1176311;
        double r1176324 = r1176322 - r1176323;
        double r1176325 = r1176311 * r1176321;
        double r1176326 = r1176325 + r1176314;
        double r1176327 = r1176320 + r1176326;
        double r1176328 = r1176324 / r1176327;
        double r1176329 = 2.0;
        double r1176330 = r1176329 * r1176316;
        double r1176331 = r1176328 / r1176330;
        double r1176332 = r1176315 / r1176311;
        double r1176333 = -r1176332;
        double r1176334 = r1176313 ? r1176331 : r1176333;
        return r1176334;
}

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.259608519028323e-05

    1. Initial program 17.1

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

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

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

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

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

    if 1.259608519028323e-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{\sqrt{b \cdot b - \left(c \cdot a\right) \cdot 4} - b}{2 \cdot a}}\]
    3. Taylor expanded around inf 10.6

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

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

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

Reproduce

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