Average Error: 32.8 → 6.4
Time: 1.4m
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.1214768270116103 \cdot 10^{+154}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le 1.199441090208904 \cdot 10^{-250}:\\ \;\;\;\;\frac{c}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}\\ \mathbf{elif}\;b_2 \le 3.3389954009657566 \cdot 10^{+124}:\\ \;\;\;\;\left(-\frac{b_2}{a}\right) - \frac{\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 -1.1214768270116103 \cdot 10^{+154}:\\
\;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\

\mathbf{elif}\;b_2 \le 1.199441090208904 \cdot 10^{-250}:\\
\;\;\;\;\frac{c}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}\\

\mathbf{elif}\;b_2 \le 3.3389954009657566 \cdot 10^{+124}:\\
\;\;\;\;\left(-\frac{b_2}{a}\right) - \frac{\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 r4156168 = b_2;
        double r4156169 = -r4156168;
        double r4156170 = r4156168 * r4156168;
        double r4156171 = a;
        double r4156172 = c;
        double r4156173 = r4156171 * r4156172;
        double r4156174 = r4156170 - r4156173;
        double r4156175 = sqrt(r4156174);
        double r4156176 = r4156169 - r4156175;
        double r4156177 = r4156176 / r4156171;
        return r4156177;
}

double f(double a, double b_2, double c) {
        double r4156178 = b_2;
        double r4156179 = -1.1214768270116103e+154;
        bool r4156180 = r4156178 <= r4156179;
        double r4156181 = -0.5;
        double r4156182 = c;
        double r4156183 = r4156182 / r4156178;
        double r4156184 = r4156181 * r4156183;
        double r4156185 = 1.199441090208904e-250;
        bool r4156186 = r4156178 <= r4156185;
        double r4156187 = r4156178 * r4156178;
        double r4156188 = a;
        double r4156189 = r4156188 * r4156182;
        double r4156190 = r4156187 - r4156189;
        double r4156191 = sqrt(r4156190);
        double r4156192 = r4156191 - r4156178;
        double r4156193 = r4156182 / r4156192;
        double r4156194 = 3.3389954009657566e+124;
        bool r4156195 = r4156178 <= r4156194;
        double r4156196 = r4156178 / r4156188;
        double r4156197 = -r4156196;
        double r4156198 = r4156191 / r4156188;
        double r4156199 = r4156197 - r4156198;
        double r4156200 = -2.0;
        double r4156201 = r4156200 * r4156196;
        double r4156202 = r4156195 ? r4156199 : r4156201;
        double r4156203 = r4156186 ? r4156193 : r4156202;
        double r4156204 = r4156180 ? r4156184 : r4156203;
        return r4156204;
}

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.1214768270116103e+154

    1. Initial program 62.9

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

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

    if -1.1214768270116103e+154 < b_2 < 1.199441090208904e-250

    1. Initial program 32.2

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

      \[\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.2

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

      \[\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.2

      \[\leadsto \frac{\frac{a \cdot c}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{\color{blue}{1 \cdot a}}\]
    8. Applied *-un-lft-identity16.2

      \[\leadsto \frac{\color{blue}{1 \cdot \frac{a \cdot c}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}{1 \cdot a}\]
    9. Applied times-frac16.2

      \[\leadsto \color{blue}{\frac{1}{1} \cdot \frac{\frac{a \cdot c}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{a}}\]
    10. Simplified16.2

      \[\leadsto \color{blue}{1} \cdot \frac{\frac{a \cdot c}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}{a}\]
    11. Simplified8.4

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

    if 1.199441090208904e-250 < b_2 < 3.3389954009657566e+124

    1. Initial program 7.8

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

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

    if 3.3389954009657566e+124 < b_2

    1. Initial program 50.6

      \[\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity50.6

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

      \[\leadsto \frac{\left(-\color{blue}{1 \cdot b_2}\right) - 1 \cdot \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    5. Applied distribute-rgt-neg-in50.6

      \[\leadsto \frac{\color{blue}{1 \cdot \left(-b_2\right)} - 1 \cdot \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    6. Applied distribute-lft-out--50.6

      \[\leadsto \frac{\color{blue}{1 \cdot \left(\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}\right)}}{a}\]
    7. Applied associate-/l*50.6

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -1.1214768270116103 \cdot 10^{+154}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le 1.199441090208904 \cdot 10^{-250}:\\ \;\;\;\;\frac{c}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}\\ \mathbf{elif}\;b_2 \le 3.3389954009657566 \cdot 10^{+124}:\\ \;\;\;\;\left(-\frac{b_2}{a}\right) - \frac{\sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a}\\ \end{array}\]

Reproduce

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