Average Error: 33.8 → 9.1
Time: 15.3s
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.098619512916649965849050740853908172435 \cdot 10^{69}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le 7.285221369089651361886008799284200164439 \cdot 10^{-305}:\\ \;\;\;\;-\frac{\frac{c \cdot a}{a}}{b_2 - \sqrt{b_2 \cdot b_2 - c \cdot a}}\\ \mathbf{elif}\;b_2 \le 3.628799960716311990444092539387346352569 \cdot 10^{50}:\\ \;\;\;\;\frac{-1}{\frac{a}{\sqrt{b_2 \cdot b_2 - c \cdot a} + b_2}}\\ \mathbf{else}:\\ \;\;\;\;\frac{b_2 \cdot -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.098619512916649965849050740853908172435 \cdot 10^{69}:\\
\;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\

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

\mathbf{elif}\;b_2 \le 3.628799960716311990444092539387346352569 \cdot 10^{50}:\\
\;\;\;\;\frac{-1}{\frac{a}{\sqrt{b_2 \cdot b_2 - c \cdot a} + b_2}}\\

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

\end{array}
double f(double a, double b_2, double c) {
        double r27231 = b_2;
        double r27232 = -r27231;
        double r27233 = r27231 * r27231;
        double r27234 = a;
        double r27235 = c;
        double r27236 = r27234 * r27235;
        double r27237 = r27233 - r27236;
        double r27238 = sqrt(r27237);
        double r27239 = r27232 - r27238;
        double r27240 = r27239 / r27234;
        return r27240;
}

double f(double a, double b_2, double c) {
        double r27241 = b_2;
        double r27242 = -1.09861951291665e+69;
        bool r27243 = r27241 <= r27242;
        double r27244 = -0.5;
        double r27245 = c;
        double r27246 = r27245 / r27241;
        double r27247 = r27244 * r27246;
        double r27248 = 7.285221369089651e-305;
        bool r27249 = r27241 <= r27248;
        double r27250 = a;
        double r27251 = r27245 * r27250;
        double r27252 = r27251 / r27250;
        double r27253 = r27241 * r27241;
        double r27254 = r27253 - r27251;
        double r27255 = sqrt(r27254);
        double r27256 = r27241 - r27255;
        double r27257 = r27252 / r27256;
        double r27258 = -r27257;
        double r27259 = 3.628799960716312e+50;
        bool r27260 = r27241 <= r27259;
        double r27261 = -1.0;
        double r27262 = r27255 + r27241;
        double r27263 = r27250 / r27262;
        double r27264 = r27261 / r27263;
        double r27265 = -2.0;
        double r27266 = r27241 * r27265;
        double r27267 = r27266 / r27250;
        double r27268 = r27260 ? r27264 : r27267;
        double r27269 = r27249 ? r27258 : r27268;
        double r27270 = r27243 ? r27247 : r27269;
        return r27270;
}

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.09861951291665e+69

    1. Initial program 57.9

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

      \[\leadsto \color{blue}{\frac{-\left(b_2 + \sqrt{b_2 \cdot b_2 - a \cdot c}\right)}{a}}\]
    3. Taylor expanded around -inf 3.3

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

    if -1.09861951291665e+69 < b_2 < 7.285221369089651e-305

    1. Initial program 30.2

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

      \[\leadsto \color{blue}{\frac{-\left(b_2 + \sqrt{b_2 \cdot b_2 - a \cdot c}\right)}{a}}\]
    3. Using strategy rm
    4. Applied neg-mul-130.2

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

      \[\leadsto \color{blue}{\frac{-1}{\frac{a}{b_2 + \sqrt{b_2 \cdot b_2 - a \cdot c}}}}\]
    6. Using strategy rm
    7. Applied flip-+30.3

      \[\leadsto \frac{-1}{\frac{a}{\color{blue}{\frac{b_2 \cdot b_2 - \sqrt{b_2 \cdot b_2 - a \cdot c} \cdot \sqrt{b_2 \cdot b_2 - a \cdot c}}{b_2 - \sqrt{b_2 \cdot b_2 - a \cdot c}}}}}\]
    8. Applied associate-/r/30.3

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

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

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

    if 7.285221369089651e-305 < b_2 < 3.628799960716312e+50

    1. Initial program 9.6

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

      \[\leadsto \color{blue}{\frac{-\left(b_2 + \sqrt{b_2 \cdot b_2 - a \cdot c}\right)}{a}}\]
    3. Using strategy rm
    4. Applied neg-mul-19.6

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

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

    if 3.628799960716312e+50 < b_2

    1. Initial program 38.1

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

      \[\leadsto \color{blue}{\frac{-\left(b_2 + \sqrt{b_2 \cdot b_2 - a \cdot c}\right)}{a}}\]
    3. Using strategy rm
    4. Applied flip-+61.0

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

      \[\leadsto \frac{-\frac{\color{blue}{0 + a \cdot c}}{b_2 - \sqrt{b_2 \cdot b_2 - a \cdot c}}}{a}\]
    6. Taylor expanded around 0 6.3

      \[\leadsto \color{blue}{-2 \cdot \frac{b_2}{a}}\]
    7. Simplified6.3

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -1.098619512916649965849050740853908172435 \cdot 10^{69}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le 7.285221369089651361886008799284200164439 \cdot 10^{-305}:\\ \;\;\;\;-\frac{\frac{c \cdot a}{a}}{b_2 - \sqrt{b_2 \cdot b_2 - c \cdot a}}\\ \mathbf{elif}\;b_2 \le 3.628799960716311990444092539387346352569 \cdot 10^{50}:\\ \;\;\;\;\frac{-1}{\frac{a}{\sqrt{b_2 \cdot b_2 - c \cdot a} + b_2}}\\ \mathbf{else}:\\ \;\;\;\;\frac{b_2 \cdot -2}{a}\\ \end{array}\]

Reproduce

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