Average Error: 33.9 → 11.2
Time: 5.5s
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 r73754 = b_2;
        double r73755 = -r73754;
        double r73756 = r73754 * r73754;
        double r73757 = a;
        double r73758 = c;
        double r73759 = r73757 * r73758;
        double r73760 = r73756 - r73759;
        double r73761 = sqrt(r73760);
        double r73762 = r73755 - r73761;
        double r73763 = r73762 / r73757;
        return r73763;
}

double f(double a, double b_2, double c) {
        double r73764 = b_2;
        double r73765 = -5.874864305580093e+54;
        bool r73766 = r73764 <= r73765;
        double r73767 = 1.0;
        double r73768 = -0.5;
        double r73769 = c;
        double r73770 = r73769 / r73764;
        double r73771 = r73768 * r73770;
        double r73772 = r73767 * r73771;
        double r73773 = -9.847501781463365e+24;
        bool r73774 = r73764 <= r73773;
        double r73775 = r73764 * r73764;
        double r73776 = a;
        double r73777 = r73776 * r73769;
        double r73778 = r73775 - r73777;
        double r73779 = -r73778;
        double r73780 = fma(r73764, r73764, r73779);
        double r73781 = r73767 * r73780;
        double r73782 = r73781 / r73776;
        double r73783 = -r73764;
        double r73784 = sqrt(r73778);
        double r73785 = r73783 + r73784;
        double r73786 = r73782 / r73785;
        double r73787 = -3.136977041606729e-74;
        bool r73788 = r73764 <= r73787;
        double r73789 = 1.0577517130489048e+130;
        bool r73790 = r73764 <= r73789;
        double r73791 = r73783 - r73784;
        double r73792 = r73791 / r73776;
        double r73793 = r73767 * r73792;
        double r73794 = -2.0;
        double r73795 = r73764 / r73776;
        double r73796 = r73794 * r73795;
        double r73797 = r73790 ? r73793 : r73796;
        double r73798 = r73788 ? r73772 : r73797;
        double r73799 = r73774 ? r73786 : r73798;
        double r73800 = r73766 ? r73772 : r73799;
        return r73800;
}

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 "NMSE problem 3.2.1"
  :precision binary64
  (/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))