Average Error: 33.6 → 6.6
Time: 24.2s
Precision: 64
\[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
\[\begin{array}{l} \mathbf{if}\;b_2 \le -3.5014200692921863 \cdot 10^{+151}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le -1.6508238928289048 \cdot 10^{-192}:\\ \;\;\;\;\frac{1}{\left(\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2\right) \cdot \frac{1}{c}}\\ \mathbf{elif}\;b_2 \le 2.0930248844306297 \cdot 10^{+100}:\\ \;\;\;\;\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-2, \frac{b_2}{a}, \frac{\frac{1}{2}}{\frac{b_2}{c}}\right)\\ \end{array}\]
\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}
\begin{array}{l}
\mathbf{if}\;b_2 \le -3.5014200692921863 \cdot 10^{+151}:\\
\;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\

\mathbf{elif}\;b_2 \le -1.6508238928289048 \cdot 10^{-192}:\\
\;\;\;\;\frac{1}{\left(\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2\right) \cdot \frac{1}{c}}\\

\mathbf{elif}\;b_2 \le 2.0930248844306297 \cdot 10^{+100}:\\
\;\;\;\;\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-2, \frac{b_2}{a}, \frac{\frac{1}{2}}{\frac{b_2}{c}}\right)\\

\end{array}
double f(double a, double b_2, double c) {
        double r573672 = b_2;
        double r573673 = -r573672;
        double r573674 = r573672 * r573672;
        double r573675 = a;
        double r573676 = c;
        double r573677 = r573675 * r573676;
        double r573678 = r573674 - r573677;
        double r573679 = sqrt(r573678);
        double r573680 = r573673 - r573679;
        double r573681 = r573680 / r573675;
        return r573681;
}

double f(double a, double b_2, double c) {
        double r573682 = b_2;
        double r573683 = -3.5014200692921863e+151;
        bool r573684 = r573682 <= r573683;
        double r573685 = -0.5;
        double r573686 = c;
        double r573687 = r573686 / r573682;
        double r573688 = r573685 * r573687;
        double r573689 = -1.6508238928289048e-192;
        bool r573690 = r573682 <= r573689;
        double r573691 = 1.0;
        double r573692 = r573682 * r573682;
        double r573693 = a;
        double r573694 = r573693 * r573686;
        double r573695 = r573692 - r573694;
        double r573696 = sqrt(r573695);
        double r573697 = r573696 - r573682;
        double r573698 = r573691 / r573686;
        double r573699 = r573697 * r573698;
        double r573700 = r573691 / r573699;
        double r573701 = 2.0930248844306297e+100;
        bool r573702 = r573682 <= r573701;
        double r573703 = -r573682;
        double r573704 = r573703 - r573696;
        double r573705 = r573704 / r573693;
        double r573706 = -2.0;
        double r573707 = r573682 / r573693;
        double r573708 = 0.5;
        double r573709 = r573682 / r573686;
        double r573710 = r573708 / r573709;
        double r573711 = fma(r573706, r573707, r573710);
        double r573712 = r573702 ? r573705 : r573711;
        double r573713 = r573690 ? r573700 : r573712;
        double r573714 = r573684 ? r573688 : r573713;
        return r573714;
}

Error

Bits error versus a

Bits error versus b_2

Bits error versus c

Derivation

  1. Split input into 4 regimes
  2. if b_2 < -3.5014200692921863e+151

    1. Initial program 62.5

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Using strategy rm
    3. Applied flip--62.6

      \[\leadsto \frac{\color{blue}{\frac{\left(-b_2\right) \cdot \left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c} \cdot \sqrt{b_2 \cdot b_2 - a \cdot c}}{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}}}{a}\]
    4. Simplified61.9

      \[\leadsto \frac{\frac{\color{blue}{\left(b_2 \cdot b_2 - b_2 \cdot b_2\right) + a \cdot c}}{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}}{a}\]
    5. Simplified61.9

      \[\leadsto \frac{\frac{\left(b_2 \cdot b_2 - b_2 \cdot b_2\right) + a \cdot c}{\color{blue}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}{a}\]
    6. Taylor expanded around -inf 1.6

      \[\leadsto \color{blue}{\frac{-1}{2} \cdot \frac{c}{b_2}}\]

    if -3.5014200692921863e+151 < b_2 < -1.6508238928289048e-192

    1. Initial program 39.1

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Using strategy rm
    3. Applied flip--39.2

      \[\leadsto \frac{\color{blue}{\frac{\left(-b_2\right) \cdot \left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c} \cdot \sqrt{b_2 \cdot b_2 - a \cdot c}}{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}}}{a}\]
    4. Simplified15.1

      \[\leadsto \frac{\frac{\color{blue}{\left(b_2 \cdot b_2 - b_2 \cdot b_2\right) + a \cdot c}}{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}}{a}\]
    5. Simplified15.1

      \[\leadsto \frac{\frac{\left(b_2 \cdot b_2 - b_2 \cdot b_2\right) + a \cdot c}{\color{blue}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}{a}\]
    6. Using strategy rm
    7. Applied clear-num15.3

      \[\leadsto \color{blue}{\frac{1}{\frac{a}{\frac{\left(b_2 \cdot b_2 - b_2 \cdot b_2\right) + a \cdot c}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}}\]
    8. Simplified13.3

      \[\leadsto \frac{1}{\color{blue}{\left(\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2\right) \cdot \frac{a}{a \cdot c}}}\]
    9. Using strategy rm
    10. Applied associate-/r*6.4

      \[\leadsto \frac{1}{\left(\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2\right) \cdot \color{blue}{\frac{\frac{a}{a}}{c}}}\]
    11. Simplified6.4

      \[\leadsto \frac{1}{\left(\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2\right) \cdot \frac{\color{blue}{1}}{c}}\]

    if -1.6508238928289048e-192 < b_2 < 2.0930248844306297e+100

    1. Initial program 10.5

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Taylor expanded around inf 10.5

      \[\leadsto \frac{\left(-b_2\right) - \sqrt{\color{blue}{{b_2}^{2} - a \cdot c}}}{a}\]
    3. Simplified10.5

      \[\leadsto \frac{\left(-b_2\right) - \sqrt{\color{blue}{b_2 \cdot b_2 - a \cdot c}}}{a}\]

    if 2.0930248844306297e+100 < b_2

    1. Initial program 44.2

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Taylor expanded around inf 3.4

      \[\leadsto \color{blue}{\frac{1}{2} \cdot \frac{c}{b_2} - 2 \cdot \frac{b_2}{a}}\]
    3. Simplified3.4

      \[\leadsto \color{blue}{\mathsf{fma}\left(-2, \frac{b_2}{a}, \frac{\frac{1}{2}}{\frac{b_2}{c}}\right)}\]
  3. Recombined 4 regimes into one program.
  4. Final simplification6.6

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -3.5014200692921863 \cdot 10^{+151}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le -1.6508238928289048 \cdot 10^{-192}:\\ \;\;\;\;\frac{1}{\left(\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2\right) \cdot \frac{1}{c}}\\ \mathbf{elif}\;b_2 \le 2.0930248844306297 \cdot 10^{+100}:\\ \;\;\;\;\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-2, \frac{b_2}{a}, \frac{\frac{1}{2}}{\frac{b_2}{c}}\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2019151 +o rules:numerics
(FPCore (a b_2 c)
  :name "quad2m (problem 3.2.1, negative)"
  (/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))