Average Error: 33.6 → 8.7
Time: 20.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 -1.5149816282130165 \cdot 10^{+129}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le -269812493880.8871:\\ \;\;\;\;\frac{1}{\left(\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2\right) \cdot \frac{a}{c \cdot a}}\\ \mathbf{elif}\;b_2 \le -1.2640598463005194 \cdot 10^{-05}:\\ \;\;\;\;\frac{a}{\frac{\left(\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2\right) \cdot a}{c}}\\ \mathbf{elif}\;b_2 \le -6.721230302992335 \cdot 10^{-178}:\\ \;\;\;\;\frac{\frac{c}{\sqrt[3]{e^{\log \left(\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2\right)}} \cdot \left(\sqrt[3]{e^{\log \left(\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2\right)}} \cdot \sqrt[3]{e^{\log \left(\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2\right)}}\right)} \cdot a}{a}\\ \mathbf{elif}\;b_2 \le 4.428811787936615 \cdot 10^{+82}:\\ \;\;\;\;\frac{1}{\frac{a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - c \cdot a}}}\\ \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.5149816282130165 \cdot 10^{+129}:\\
\;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\

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

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

\mathbf{elif}\;b_2 \le -6.721230302992335 \cdot 10^{-178}:\\
\;\;\;\;\frac{\frac{c}{\sqrt[3]{e^{\log \left(\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2\right)}} \cdot \left(\sqrt[3]{e^{\log \left(\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2\right)}} \cdot \sqrt[3]{e^{\log \left(\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2\right)}}\right)} \cdot a}{a}\\

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

\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 r1099580 = b_2;
        double r1099581 = -r1099580;
        double r1099582 = r1099580 * r1099580;
        double r1099583 = a;
        double r1099584 = c;
        double r1099585 = r1099583 * r1099584;
        double r1099586 = r1099582 - r1099585;
        double r1099587 = sqrt(r1099586);
        double r1099588 = r1099581 - r1099587;
        double r1099589 = r1099588 / r1099583;
        return r1099589;
}

double f(double a, double b_2, double c) {
        double r1099590 = b_2;
        double r1099591 = -1.5149816282130165e+129;
        bool r1099592 = r1099590 <= r1099591;
        double r1099593 = -0.5;
        double r1099594 = c;
        double r1099595 = r1099594 / r1099590;
        double r1099596 = r1099593 * r1099595;
        double r1099597 = -269812493880.8871;
        bool r1099598 = r1099590 <= r1099597;
        double r1099599 = 1.0;
        double r1099600 = r1099590 * r1099590;
        double r1099601 = a;
        double r1099602 = r1099594 * r1099601;
        double r1099603 = r1099600 - r1099602;
        double r1099604 = sqrt(r1099603);
        double r1099605 = r1099604 - r1099590;
        double r1099606 = r1099601 / r1099602;
        double r1099607 = r1099605 * r1099606;
        double r1099608 = r1099599 / r1099607;
        double r1099609 = -1.2640598463005194e-05;
        bool r1099610 = r1099590 <= r1099609;
        double r1099611 = r1099605 * r1099601;
        double r1099612 = r1099611 / r1099594;
        double r1099613 = r1099601 / r1099612;
        double r1099614 = -6.721230302992335e-178;
        bool r1099615 = r1099590 <= r1099614;
        double r1099616 = log(r1099605);
        double r1099617 = exp(r1099616);
        double r1099618 = cbrt(r1099617);
        double r1099619 = r1099618 * r1099618;
        double r1099620 = r1099618 * r1099619;
        double r1099621 = r1099594 / r1099620;
        double r1099622 = r1099621 * r1099601;
        double r1099623 = r1099622 / r1099601;
        double r1099624 = 4.428811787936615e+82;
        bool r1099625 = r1099590 <= r1099624;
        double r1099626 = -r1099590;
        double r1099627 = r1099626 - r1099604;
        double r1099628 = r1099601 / r1099627;
        double r1099629 = r1099599 / r1099628;
        double r1099630 = 0.5;
        double r1099631 = r1099630 * r1099595;
        double r1099632 = 2.0;
        double r1099633 = r1099590 / r1099601;
        double r1099634 = r1099632 * r1099633;
        double r1099635 = r1099631 - r1099634;
        double r1099636 = r1099625 ? r1099629 : r1099635;
        double r1099637 = r1099615 ? r1099623 : r1099636;
        double r1099638 = r1099610 ? r1099613 : r1099637;
        double r1099639 = r1099598 ? r1099608 : r1099638;
        double r1099640 = r1099592 ? r1099596 : r1099639;
        return r1099640;
}

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 6 regimes
  2. if b_2 < -1.5149816282130165e+129

    1. Initial program 60.9

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

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

    if -1.5149816282130165e+129 < b_2 < -269812493880.8871

    1. Initial program 44.8

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

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

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

      \[\leadsto \frac{\frac{a \cdot c}{\color{blue}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}{a}\]
    6. Using strategy rm
    7. Applied *-un-lft-identity13.0

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

      \[\leadsto \frac{\color{blue}{\frac{a}{1} \cdot \frac{c}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}{a}\]
    9. Simplified12.8

      \[\leadsto \frac{\color{blue}{a} \cdot \frac{c}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{a}\]
    10. Using strategy rm
    11. Applied add-exp-log15.8

      \[\leadsto \frac{a \cdot \frac{c}{\color{blue}{e^{\log \left(\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2\right)}}}}{a}\]
    12. Using strategy rm
    13. Applied clear-num16.2

      \[\leadsto \color{blue}{\frac{1}{\frac{a}{a \cdot \frac{c}{e^{\log \left(\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2\right)}}}}}\]
    14. Simplified10.4

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

    if -269812493880.8871 < b_2 < -1.2640598463005194e-05

    1. Initial program 46.7

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

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

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

      \[\leadsto \frac{\frac{a \cdot c}{\color{blue}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}{a}\]
    6. Using strategy rm
    7. Applied *-un-lft-identity18.5

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

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

      \[\leadsto \frac{\color{blue}{a} \cdot \frac{c}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{a}\]
    10. Using strategy rm
    11. Applied add-exp-log19.7

      \[\leadsto \frac{a \cdot \frac{c}{\color{blue}{e^{\log \left(\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2\right)}}}}{a}\]
    12. Using strategy rm
    13. Applied associate-/l*17.4

      \[\leadsto \color{blue}{\frac{a}{\frac{a}{\frac{c}{e^{\log \left(\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2\right)}}}}}\]
    14. Simplified16.1

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

    if -1.2640598463005194e-05 < b_2 < -6.721230302992335e-178

    1. Initial program 30.5

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

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

      \[\leadsto \frac{\frac{a \cdot c}{\color{blue}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}{a}\]
    6. Using strategy rm
    7. Applied *-un-lft-identity16.0

      \[\leadsto \frac{\frac{a \cdot c}{\color{blue}{1 \cdot \left(\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2\right)}}}{a}\]
    8. Applied times-frac11.5

      \[\leadsto \frac{\color{blue}{\frac{a}{1} \cdot \frac{c}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}{a}\]
    9. Simplified11.5

      \[\leadsto \frac{\color{blue}{a} \cdot \frac{c}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{a}\]
    10. Using strategy rm
    11. Applied add-exp-log14.9

      \[\leadsto \frac{a \cdot \frac{c}{\color{blue}{e^{\log \left(\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2\right)}}}}{a}\]
    12. Using strategy rm
    13. Applied add-cube-cbrt14.9

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

    if -6.721230302992335e-178 < b_2 < 4.428811787936615e+82

    1. Initial program 12.0

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

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

    if 4.428811787936615e+82 < b_2

    1. Initial program 42.3

      \[\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} - 2 \cdot \frac{b_2}{a}}\]
  3. Recombined 6 regimes into one program.
  4. Final simplification8.7

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -1.5149816282130165 \cdot 10^{+129}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le -269812493880.8871:\\ \;\;\;\;\frac{1}{\left(\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2\right) \cdot \frac{a}{c \cdot a}}\\ \mathbf{elif}\;b_2 \le -1.2640598463005194 \cdot 10^{-05}:\\ \;\;\;\;\frac{a}{\frac{\left(\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2\right) \cdot a}{c}}\\ \mathbf{elif}\;b_2 \le -6.721230302992335 \cdot 10^{-178}:\\ \;\;\;\;\frac{\frac{c}{\sqrt[3]{e^{\log \left(\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2\right)}} \cdot \left(\sqrt[3]{e^{\log \left(\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2\right)}} \cdot \sqrt[3]{e^{\log \left(\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2\right)}}\right)} \cdot a}{a}\\ \mathbf{elif}\;b_2 \le 4.428811787936615 \cdot 10^{+82}:\\ \;\;\;\;\frac{1}{\frac{a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - c \cdot a}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - 2 \cdot \frac{b_2}{a}\\ \end{array}\]

Reproduce

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