Average Error: 33.3 → 8.5
Time: 21.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 -3.101473652193339 \cdot 10^{+126}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le 3.3026083301884445 \cdot 10^{-291}:\\ \;\;\;\;\frac{\frac{c \cdot a}{a}}{\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2}\\ \mathbf{elif}\;b_2 \le 1.1638796624534952 \cdot 10^{+125}:\\ \;\;\;\;\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - c \cdot a}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - \frac{b_2}{a} \cdot 2\\ \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 -3.101473652193339 \cdot 10^{+126}:\\
\;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\

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

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

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

\end{array}
double f(double a, double b_2, double c) {
        double r652984 = b_2;
        double r652985 = -r652984;
        double r652986 = r652984 * r652984;
        double r652987 = a;
        double r652988 = c;
        double r652989 = r652987 * r652988;
        double r652990 = r652986 - r652989;
        double r652991 = sqrt(r652990);
        double r652992 = r652985 - r652991;
        double r652993 = r652992 / r652987;
        return r652993;
}

double f(double a, double b_2, double c) {
        double r652994 = b_2;
        double r652995 = -3.101473652193339e+126;
        bool r652996 = r652994 <= r652995;
        double r652997 = -0.5;
        double r652998 = c;
        double r652999 = r652998 / r652994;
        double r653000 = r652997 * r652999;
        double r653001 = 3.3026083301884445e-291;
        bool r653002 = r652994 <= r653001;
        double r653003 = a;
        double r653004 = r652998 * r653003;
        double r653005 = r653004 / r653003;
        double r653006 = r652994 * r652994;
        double r653007 = r653006 - r653004;
        double r653008 = sqrt(r653007);
        double r653009 = r653008 - r652994;
        double r653010 = r653005 / r653009;
        double r653011 = 1.1638796624534952e+125;
        bool r653012 = r652994 <= r653011;
        double r653013 = -r652994;
        double r653014 = r653013 - r653008;
        double r653015 = r653014 / r653003;
        double r653016 = 0.5;
        double r653017 = r653016 * r652999;
        double r653018 = r652994 / r653003;
        double r653019 = 2.0;
        double r653020 = r653018 * r653019;
        double r653021 = r653017 - r653020;
        double r653022 = r653012 ? r653015 : r653021;
        double r653023 = r653002 ? r653010 : r653022;
        double r653024 = r652996 ? r653000 : r653023;
        return r653024;
}

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 < -3.101473652193339e+126

    1. Initial program 60.4

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

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

    if -3.101473652193339e+126 < b_2 < 3.3026083301884445e-291

    1. Initial program 32.7

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

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

      \[\leadsto \frac{\frac{\left(b_2 \cdot b_2 - b_2 \cdot b_2\right) + 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-identity15.2

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

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

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

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

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

    if 3.3026083301884445e-291 < b_2 < 1.1638796624534952e+125

    1. Initial program 8.6

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

    if 1.1638796624534952e+125 < b_2

    1. Initial program 50.6

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -3.101473652193339 \cdot 10^{+126}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le 3.3026083301884445 \cdot 10^{-291}:\\ \;\;\;\;\frac{\frac{c \cdot a}{a}}{\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2}\\ \mathbf{elif}\;b_2 \le 1.1638796624534952 \cdot 10^{+125}:\\ \;\;\;\;\frac{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - c \cdot a}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b_2} - \frac{b_2}{a} \cdot 2\\ \end{array}\]

Reproduce

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