Average Error: 34.0 → 9.4
Time: 6.1s
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 -1.0366436397824178 \cdot 10^{68}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le -2.75036677292823045 \cdot 10^{-219}:\\ \;\;\;\;\frac{\frac{1}{\sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2} \cdot \sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}} \cdot \frac{a}{\frac{\sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{c}}}{a}\\ \mathbf{elif}\;b_2 \le 5.34931179548294658 \cdot 10^{30}:\\ \;\;\;\;\frac{1}{\frac{a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - 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 -1.0366436397824178 \cdot 10^{68}:\\
\;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\

\mathbf{elif}\;b_2 \le -2.75036677292823045 \cdot 10^{-219}:\\
\;\;\;\;\frac{\frac{1}{\sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2} \cdot \sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}} \cdot \frac{a}{\frac{\sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{c}}}{a}\\

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

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

\end{array}
double f(double a, double b_2, double c) {
        double r21695 = b_2;
        double r21696 = -r21695;
        double r21697 = r21695 * r21695;
        double r21698 = a;
        double r21699 = c;
        double r21700 = r21698 * r21699;
        double r21701 = r21697 - r21700;
        double r21702 = sqrt(r21701);
        double r21703 = r21696 - r21702;
        double r21704 = r21703 / r21698;
        return r21704;
}

double f(double a, double b_2, double c) {
        double r21705 = b_2;
        double r21706 = -1.0366436397824178e+68;
        bool r21707 = r21705 <= r21706;
        double r21708 = -0.5;
        double r21709 = c;
        double r21710 = r21709 / r21705;
        double r21711 = r21708 * r21710;
        double r21712 = -2.7503667729282305e-219;
        bool r21713 = r21705 <= r21712;
        double r21714 = 1.0;
        double r21715 = r21705 * r21705;
        double r21716 = a;
        double r21717 = r21716 * r21709;
        double r21718 = r21715 - r21717;
        double r21719 = sqrt(r21718);
        double r21720 = r21719 - r21705;
        double r21721 = cbrt(r21720);
        double r21722 = r21721 * r21721;
        double r21723 = r21714 / r21722;
        double r21724 = r21721 / r21709;
        double r21725 = r21716 / r21724;
        double r21726 = r21723 * r21725;
        double r21727 = r21726 / r21716;
        double r21728 = 5.349311795482947e+30;
        bool r21729 = r21705 <= r21728;
        double r21730 = -r21705;
        double r21731 = r21730 - r21719;
        double r21732 = r21716 / r21731;
        double r21733 = r21714 / r21732;
        double r21734 = 0.5;
        double r21735 = r21734 * r21710;
        double r21736 = 2.0;
        double r21737 = r21705 / r21716;
        double r21738 = r21736 * r21737;
        double r21739 = r21735 - r21738;
        double r21740 = r21729 ? r21733 : r21739;
        double r21741 = r21713 ? r21727 : r21740;
        double r21742 = r21707 ? r21711 : r21741;
        return r21742;
}

Error

Bits error versus a

Bits error versus b_2

Bits error versus c

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 4 regimes
  2. if b_2 < -1.0366436397824178e+68

    1. Initial program 57.9

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

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

    if -1.0366436397824178e+68 < b_2 < -2.7503667729282305e-219

    1. Initial program 34.6

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Using strategy rm
    3. Applied flip--34.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. Simplified16.9

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

      \[\leadsto \frac{\frac{0 + a \cdot c}{\color{blue}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}{a}\]
    6. Using strategy rm
    7. Applied add-cube-cbrt17.6

      \[\leadsto \frac{\frac{0 + a \cdot c}{\color{blue}{\left(\sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2} \cdot \sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}\right) \cdot \sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}}{a}\]
    8. Applied *-un-lft-identity17.6

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

      \[\leadsto \frac{\color{blue}{\frac{1}{\sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2} \cdot \sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}} \cdot \frac{0 + a \cdot c}{\sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}}{a}\]
    10. Simplified16.9

      \[\leadsto \frac{\frac{1}{\sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2} \cdot \sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}} \cdot \color{blue}{\frac{a}{\frac{\sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{c}}}}{a}\]

    if -2.7503667729282305e-219 < b_2 < 5.349311795482947e+30

    1. Initial program 11.2

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

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

    if 5.349311795482947e+30 < b_2

    1. Initial program 35.5

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -1.0366436397824178 \cdot 10^{68}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le -2.75036677292823045 \cdot 10^{-219}:\\ \;\;\;\;\frac{\frac{1}{\sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2} \cdot \sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}} \cdot \frac{a}{\frac{\sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{c}}}{a}\\ \mathbf{elif}\;b_2 \le 5.34931179548294658 \cdot 10^{30}:\\ \;\;\;\;\frac{1}{\frac{a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - 2 \cdot \frac{b_2}{a}\\ \end{array}\]

Reproduce

herbie shell --seed 2020049 
(FPCore (a b_2 c)
  :name "quad2m (problem 3.2.1, negative)"
  :precision binary64
  (/ (- (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))