Average Error: 33.9 → 11.2
Time: 5.8s
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 -5.87486430558009272 \cdot 10^{54}:\\ \;\;\;\;1 \cdot \left(\frac{-1}{2} \cdot \frac{c}{b_2}\right)\\ \mathbf{elif}\;b_2 \le -9.8475017814633646 \cdot 10^{24}:\\ \;\;\;\;\frac{\frac{1 \cdot \mathsf{fma}\left(b_2, b_2, -\left(b_2 \cdot b_2 - a \cdot c\right)\right)}{a}}{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}\\ \mathbf{elif}\;b_2 \le -3.1369770416067291 \cdot 10^{-74}:\\ \;\;\;\;1 \cdot \left(\frac{-1}{2} \cdot \frac{c}{b_2}\right)\\ \mathbf{elif}\;b_2 \le 1.05775171304890479 \cdot 10^{130}:\\ \;\;\;\;1 \cdot \frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a}\\ \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 -5.87486430558009272 \cdot 10^{54}:\\
\;\;\;\;1 \cdot \left(\frac{-1}{2} \cdot \frac{c}{b_2}\right)\\

\mathbf{elif}\;b_2 \le -9.8475017814633646 \cdot 10^{24}:\\
\;\;\;\;\frac{\frac{1 \cdot \mathsf{fma}\left(b_2, b_2, -\left(b_2 \cdot b_2 - a \cdot c\right)\right)}{a}}{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}\\

\mathbf{elif}\;b_2 \le -3.1369770416067291 \cdot 10^{-74}:\\
\;\;\;\;1 \cdot \left(\frac{-1}{2} \cdot \frac{c}{b_2}\right)\\

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

\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{b_2}{a}\\

\end{array}
double f(double a, double b_2, double c) {
        double r16647 = b_2;
        double r16648 = -r16647;
        double r16649 = r16647 * r16647;
        double r16650 = a;
        double r16651 = c;
        double r16652 = r16650 * r16651;
        double r16653 = r16649 - r16652;
        double r16654 = sqrt(r16653);
        double r16655 = r16648 - r16654;
        double r16656 = r16655 / r16650;
        return r16656;
}

double f(double a, double b_2, double c) {
        double r16657 = b_2;
        double r16658 = -5.874864305580093e+54;
        bool r16659 = r16657 <= r16658;
        double r16660 = 1.0;
        double r16661 = -0.5;
        double r16662 = c;
        double r16663 = r16662 / r16657;
        double r16664 = r16661 * r16663;
        double r16665 = r16660 * r16664;
        double r16666 = -9.847501781463365e+24;
        bool r16667 = r16657 <= r16666;
        double r16668 = r16657 * r16657;
        double r16669 = a;
        double r16670 = r16669 * r16662;
        double r16671 = r16668 - r16670;
        double r16672 = -r16671;
        double r16673 = fma(r16657, r16657, r16672);
        double r16674 = r16660 * r16673;
        double r16675 = r16674 / r16669;
        double r16676 = -r16657;
        double r16677 = sqrt(r16671);
        double r16678 = r16676 + r16677;
        double r16679 = r16675 / r16678;
        double r16680 = -3.136977041606729e-74;
        bool r16681 = r16657 <= r16680;
        double r16682 = 1.0577517130489048e+130;
        bool r16683 = r16657 <= r16682;
        double r16684 = r16676 - r16677;
        double r16685 = r16684 / r16669;
        double r16686 = r16660 * r16685;
        double r16687 = -2.0;
        double r16688 = r16657 / r16669;
        double r16689 = r16687 * r16688;
        double r16690 = r16683 ? r16686 : r16689;
        double r16691 = r16681 ? r16665 : r16690;
        double r16692 = r16667 ? r16679 : r16691;
        double r16693 = r16659 ? r16665 : r16692;
        return r16693;
}

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 < -5.874864305580093e+54 or -9.847501781463365e+24 < b_2 < -3.136977041606729e-74

    1. Initial program 54.2

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

      \[\leadsto \color{blue}{\frac{1}{\frac{a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}}\]
    4. Using strategy rm
    5. Applied *-un-lft-identity54.2

      \[\leadsto \frac{1}{\frac{a}{\color{blue}{1 \cdot \left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right)}}}\]
    6. Applied *-un-lft-identity54.2

      \[\leadsto \frac{1}{\frac{\color{blue}{1 \cdot a}}{1 \cdot \left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right)}}\]
    7. Applied times-frac54.2

      \[\leadsto \frac{1}{\color{blue}{\frac{1}{1} \cdot \frac{a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}}\]
    8. Applied add-cube-cbrt54.2

      \[\leadsto \frac{\color{blue}{\left(\sqrt[3]{1} \cdot \sqrt[3]{1}\right) \cdot \sqrt[3]{1}}}{\frac{1}{1} \cdot \frac{a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}\]
    9. Applied times-frac54.2

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

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

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

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

    if -5.874864305580093e+54 < b_2 < -9.847501781463365e+24

    1. Initial program 44.0

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

      \[\leadsto \color{blue}{\frac{1}{\frac{a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}}\]
    4. Using strategy rm
    5. Applied flip--44.0

      \[\leadsto \frac{1}{\frac{a}{\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}}}}}\]
    6. Applied associate-/r/44.0

      \[\leadsto \frac{1}{\color{blue}{\frac{a}{\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}} \cdot \left(\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}\right)}}\]
    7. Applied associate-/r*44.0

      \[\leadsto \color{blue}{\frac{\frac{1}{\frac{a}{\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}}}\]
    8. Simplified49.9

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

    if -3.136977041606729e-74 < b_2 < 1.0577517130489048e+130

    1. Initial program 12.7

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

      \[\leadsto \color{blue}{\frac{1}{\frac{a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}}\]
    4. Using strategy rm
    5. Applied *-un-lft-identity12.9

      \[\leadsto \frac{1}{\frac{a}{\color{blue}{1 \cdot \left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right)}}}\]
    6. Applied *-un-lft-identity12.9

      \[\leadsto \frac{1}{\frac{\color{blue}{1 \cdot a}}{1 \cdot \left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right)}}\]
    7. Applied times-frac12.9

      \[\leadsto \frac{1}{\color{blue}{\frac{1}{1} \cdot \frac{a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}}\]
    8. Applied add-cube-cbrt12.9

      \[\leadsto \frac{\color{blue}{\left(\sqrt[3]{1} \cdot \sqrt[3]{1}\right) \cdot \sqrt[3]{1}}}{\frac{1}{1} \cdot \frac{a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}\]
    9. Applied times-frac12.9

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

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

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

    if 1.0577517130489048e+130 < b_2

    1. Initial program 55.7

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

      \[\leadsto \color{blue}{\frac{1}{\frac{a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}}\]
    4. Taylor expanded around 0 3.2

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -5.87486430558009272 \cdot 10^{54}:\\ \;\;\;\;1 \cdot \left(\frac{-1}{2} \cdot \frac{c}{b_2}\right)\\ \mathbf{elif}\;b_2 \le -9.8475017814633646 \cdot 10^{24}:\\ \;\;\;\;\frac{\frac{1 \cdot \mathsf{fma}\left(b_2, b_2, -\left(b_2 \cdot b_2 - a \cdot c\right)\right)}{a}}{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}\\ \mathbf{elif}\;b_2 \le -3.1369770416067291 \cdot 10^{-74}:\\ \;\;\;\;1 \cdot \left(\frac{-1}{2} \cdot \frac{c}{b_2}\right)\\ \mathbf{elif}\;b_2 \le 1.05775171304890479 \cdot 10^{130}:\\ \;\;\;\;1 \cdot \frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a}\\ \end{array}\]

Reproduce

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