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

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

\end{array}
double f(double a, double b, double c) {
        double r8809585 = b;
        double r8809586 = -r8809585;
        double r8809587 = r8809585 * r8809585;
        double r8809588 = 4.0;
        double r8809589 = a;
        double r8809590 = r8809588 * r8809589;
        double r8809591 = c;
        double r8809592 = r8809590 * r8809591;
        double r8809593 = r8809587 - r8809592;
        double r8809594 = sqrt(r8809593);
        double r8809595 = r8809586 + r8809594;
        double r8809596 = 2.0;
        double r8809597 = r8809596 * r8809589;
        double r8809598 = r8809595 / r8809597;
        return r8809598;
}

double f(double a, double b, double c) {
        double r8809599 = b;
        double r8809600 = 7.139718965113842e-05;
        bool r8809601 = r8809599 <= r8809600;
        double r8809602 = r8809599 * r8809599;
        double r8809603 = 4.0;
        double r8809604 = c;
        double r8809605 = a;
        double r8809606 = r8809604 * r8809605;
        double r8809607 = r8809603 * r8809606;
        double r8809608 = r8809602 - r8809607;
        double r8809609 = sqrt(r8809608);
        double r8809610 = r8809608 * r8809609;
        double r8809611 = r8809602 * r8809599;
        double r8809612 = r8809610 - r8809611;
        double r8809613 = 2.0;
        double r8809614 = r8809613 * r8809605;
        double r8809615 = r8809599 * r8809609;
        double r8809616 = r8809602 + r8809615;
        double r8809617 = r8809609 * r8809609;
        double r8809618 = r8809616 + r8809617;
        double r8809619 = r8809614 * r8809618;
        double r8809620 = r8809612 / r8809619;
        double r8809621 = r8809604 / r8809599;
        double r8809622 = -r8809621;
        double r8809623 = r8809601 ? r8809620 : r8809622;
        return r8809623;
}

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

    1. Initial program 18.5

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

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

      \[\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. Applied associate-/l/18.6

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

      \[\leadsto \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)}}{\left(2 \cdot a\right) \cdot \left(\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)\right)}\]

    if 7.139718965113842e-05 < b

    1. Initial program 45.5

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

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

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

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

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

Reproduce

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